geforkt von SteamWar/BungeeCore
+Fixed player connect with teleport
Dieser Commit ist enthalten in:
Ursprung
451de152b2
Commit
3e9bd2768b
@ -23,10 +23,7 @@ import de.steamwar.bungeecore.*;
|
||||
import de.steamwar.bungeecore.inventory.SWInventory;
|
||||
import de.steamwar.bungeecore.inventory.SWItem;
|
||||
import de.steamwar.bungeecore.network.NetworkSender;
|
||||
import de.steamwar.bungeecore.sql.BauLockState;
|
||||
import de.steamwar.bungeecore.sql.BauweltMember;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import de.steamwar.bungeecore.sql.UserConfig;
|
||||
import de.steamwar.bungeecore.sql.*;
|
||||
import de.steamwar.bungeecore.util.Chat19;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.network.packets.server.BaumemberUpdatePacket;
|
||||
@ -88,10 +85,10 @@ public class BauCommand extends BasicCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
setLocked(p, args[1].toUpperCase());
|
||||
BauLock.setLocked(p, args[1].toUpperCase());
|
||||
break;
|
||||
case "unlock":
|
||||
setLocked(p, "OPEN");
|
||||
BauLock.setLocked(p, "OPEN");
|
||||
break;
|
||||
default:
|
||||
HelpCommand.sendBauHelp(ChatSender.of(p));
|
||||
@ -142,7 +139,7 @@ public class BauCommand extends BasicCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(isLocked(worldOwner, SteamwarUser.get(p))) {
|
||||
if(BauLock.isLocked(worldOwner, SteamwarUser.get(p))) {
|
||||
Message.send("BAU_LOCKED_NOALLOWED", p);
|
||||
return;
|
||||
}
|
||||
@ -325,35 +322,4 @@ public class BauCommand extends BasicCommand {
|
||||
Message.send("BAU_MEMBER_TOGGLE_OFF", p, Message.parse(what, p));
|
||||
}
|
||||
}
|
||||
|
||||
private static final String BAU_LOCK_CONFIG_NAME = "baulockstate";
|
||||
private static void setLocked(ProxiedPlayer p, String arg) {
|
||||
SteamwarUser owner = SteamwarUser.get(p.getUniqueId());
|
||||
BauLockState state;
|
||||
try {
|
||||
state = BauLockState.valueOf(arg);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Message.send("BAU_LOCKED_OPTIONS", owner.getPlayer());
|
||||
return;
|
||||
}
|
||||
|
||||
UserConfig.updateUserConfig(owner.getId(), BAU_LOCK_CONFIG_NAME, state == BauLockState.OPEN ? null : state.name());
|
||||
Message.send("BAU_LOCKED_" + state.name(), owner.getPlayer());
|
||||
}
|
||||
|
||||
private static boolean isLocked(SteamwarUser owner, SteamwarUser target) {
|
||||
if (owner.getId() == target.getId())
|
||||
return false;
|
||||
|
||||
String state = UserConfig.getConfig(owner.getId(), BAU_LOCK_CONFIG_NAME);
|
||||
switch (state == null ? BauLockState.OPEN : BauLockState.valueOf(state)) {
|
||||
case NOBODY:
|
||||
return true;
|
||||
case TEAM:
|
||||
return owner.getTeam() != target.getTeam();
|
||||
case OPEN:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,10 @@ public class TpCommand extends BasicCommand {
|
||||
sender.system("JOIN_PLAYER_BLOCK");
|
||||
}
|
||||
} else if (bauserver.getOwner().equals(player.getUniqueId()) || BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
|
||||
if (BauLock.isLocked(SteamwarUser.get(bauserver.getOwner()), sender.user())) {
|
||||
Message.send("BAU_LOCKED_NOALLOWED", player);
|
||||
return;
|
||||
}
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
} else {
|
||||
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
|
||||
|
39
src/de/steamwar/bungeecore/sql/BauLock.java
Normale Datei
39
src/de/steamwar/bungeecore/sql/BauLock.java
Normale Datei
@ -0,0 +1,39 @@
|
||||
package de.steamwar.bungeecore.sql;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public class BauLock {
|
||||
|
||||
private static final String BAU_LOCK_CONFIG_NAME = "baulockstate";
|
||||
public static void setLocked(ProxiedPlayer p, String arg) {
|
||||
SteamwarUser owner = SteamwarUser.get(p.getUniqueId());
|
||||
BauLockState state;
|
||||
try {
|
||||
state = BauLockState.valueOf(arg);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Message.send("BAU_LOCKED_OPTIONS", owner.getPlayer());
|
||||
return;
|
||||
}
|
||||
|
||||
UserConfig.updateUserConfig(owner.getId(), BAU_LOCK_CONFIG_NAME, state == BauLockState.OPEN ? null : state.name());
|
||||
Message.send("BAU_LOCKED_" + state.name(), owner.getPlayer());
|
||||
}
|
||||
|
||||
public static boolean isLocked(SteamwarUser owner, SteamwarUser target) {
|
||||
if (owner.getId() == target.getId())
|
||||
return false;
|
||||
|
||||
String state = UserConfig.getConfig(owner.getId(), BAU_LOCK_CONFIG_NAME);
|
||||
switch (state == null ? BauLockState.OPEN : BauLockState.valueOf(state)) {
|
||||
case NOBODY:
|
||||
return true;
|
||||
case TEAM:
|
||||
return owner.getTeam() != target.getTeam();
|
||||
case OPEN:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren