Archiviert
1
0

Notify owner on lock blocking join

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2024-02-06 22:34:23 +01:00
Ursprung 3b7fa8054d
Commit dabd880209
5 geänderte Dateien mit 29 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -161,11 +161,7 @@ public class BauCommand extends SWCommand {
messageSender.send("BAU_TP_NOALLOWED");
return false;
}
if(BauLock.isLocked(value, SteamwarUser.get(p.getUniqueId()))) {
messageSender.send("BAU_LOCKED_NOALLOWED");
return false;
}
return true;
return !BauLock.checkNotifyLocked(value, p);
};
}

Datei anzeigen

@ -20,7 +20,6 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.tablist.TablistManager;
import de.steamwar.sql.*;
import de.steamwar.bungeecore.util.BauLock;
import de.steamwar.bungeecore.util.Chat19;
@ -122,8 +121,7 @@ public class TpCommand extends SWCommand {
sender.system("JOIN_PLAYER_BLOCK");
return;
}
} else if (BauLock.isLocked(SteamwarUser.get(bauserver.getOwner()), sender.user())) {
sender.system("BAU_LOCKED_NOALLOWED");
} else if (BauLock.checkNotifyLocked(SteamwarUser.get(bauserver.getOwner()), player)) {
return;
} else if (!bauserver.getOwner().equals(player.getUniqueId()) && BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) == null) {
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());

Datei anzeigen

@ -20,10 +20,12 @@
package de.steamwar.bungeecore.util;
import de.steamwar.bungeecore.Message;
import de.steamwar.messages.ChatSender;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserConfig;
import de.steamwar.sql.UserPerm;
import lombok.experimental.UtilityClass;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@UtilityClass
@ -36,27 +38,44 @@ public class BauLock {
Message.send("BAU_LOCKED_" + state.name(), p);
}
public static boolean isLocked(SteamwarUser owner, SteamwarUser target) {
public static boolean checkNotifyLocked(SteamwarUser owner, ProxiedPlayer player) {
ChatSender sender = ChatSender.of(player);
SteamwarUser target = sender.user();
if (owner.getId() == target.getId())
return false;
boolean locked;
String state = UserConfig.getConfig(owner.getId(), BAU_LOCK_CONFIG_NAME);
switch (state == null ? BauLockState.OPEN : BauLockState.valueOf(state)) {
case NOBODY:
return true;
locked = true;
break;
case SERVERTEAM:
return !target.hasPerm(UserPerm.TEAM);
locked = !target.hasPerm(UserPerm.TEAM);
break;
case TEAM_AND_SERVERTEAM:
if (target.hasPerm(UserPerm.TEAM)) {
return false;
}
return owner.getTeam() != target.getTeam();
locked = owner.getTeam() != target.getTeam();
break;
case TEAM:
return owner.getTeam() != target.getTeam();
locked = owner.getTeam() != target.getTeam();
break;
case OPEN:
default:
return false;
locked = false;
}
if(locked) {
sender.system("BAU_LOCKED_NOALLOWED");
ProxiedPlayer ownerPlayer = ProxyServer.getInstance().getPlayer(owner.getUUID());
if(ownerPlayer != null)
ChatSender.of(ownerPlayer).system("BAU_LOCK_BLOCKED", player.getName());
}
return locked;
}
}

Datei anzeigen

@ -210,6 +210,7 @@ BAU_ADDMEMBER_ADDED_TARGET=§aYou have been added to the world of §e{0}§a.
BAU_TP_USAGE=§8/§7build tp §8[§eplayer§8]
BAU_TP_NOALLOWED=§cYou are not allowed to teleport to this player's world.
BAU_LOCKED_NOALLOWED=§cThe build server is currently locked.
BAU_LOCK_BLOCKED=§cYour build lock has prevented §e{0} §cfrom joining.
BAU_LOCKED_OPTIONS=§7Build server lock options§8: §cnobody§8, §eserverteam§8, §eteam_and_serverteam§8, §eteam§8, §aopen
BAU_LOCKED_NOBODY=§7You have locked your build server for all players.
BAU_LOCKED_SERVERTEAM=§7You have locked your build server for all players except added server team members.

Datei anzeigen

@ -193,6 +193,7 @@ BAU_ADDMEMBER_ADDED_TARGET=§aDu wurdest zu der Welt von §e{0} §ahinzugefügt.
BAU_TP_USAGE=§8/§7bau tp §8[§eSpieler§8]
BAU_TP_NOALLOWED=§cDu darfst dich nicht auf diese Welt teleportieren.
BAU_LOCKED_NOALLOWED=§cDer Bauserver ist momentan gesperrt.
BAU_LOCK_BLOCKED=§cDeine Bausperre hat den Beitritt von §e{0} §cverhindert.
BAU_LOCKED_OPTIONS=§7Bauserver-Sperroptionen§8: §cnobody§8, §eserverteam§8, §eteam_and_serverteam§8, §eteam§8, §aopen
BAU_LOCKED_NOBODY=§7Du hast deinen Bau für alle Spieler geschlossen.
BAU_LOCKED_SERVERTEAM=§7Du hast deinen Bau für alle außer hinzugefügte Serverteammitglieder gesperrt.