SteamWar/BungeeCore
Archiviert
13
2

Fix merge conflicts
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-09-17 11:34:51 +02:00
Ursprung 47dd2503cf
Commit c36a6885cf
2 geänderte Dateien mit 7 neuen und 39 gelöschten Zeilen

Datei anzeigen

@ -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.command.SWCommand;
import de.steamwar.command.TypeMapper;
@ -173,7 +170,7 @@ public class BauCommand extends SWCommand {
messageSender.send("BAU_TP_NOALLOWED");
return false;
}
if(isLocked(value, SteamwarUser.get(p))) {
if(BauLock.isLocked(value, SteamwarUser.get(p))) {
messageSender.send("BAU_LOCKED_NOALLOWED");
return false;
}
@ -296,12 +293,12 @@ public class BauCommand extends SWCommand {
@Register(value = "lock", description = "BAU_LOCKED_OPTIONS")
public void lock(ProxiedPlayer p, BauLockState bauLockState) {
setLocked(p, bauLockState);
BauLock.setLocked(p, bauLockState);
}
@Register("unlock")
public void unlock(ProxiedPlayer p) {
setLocked(p, BauLockState.OPEN);
BauLock.setLocked(p, BauLockState.OPEN);
}
private static BauweltMember member(ProxiedPlayer p, SteamwarUser member){
@ -331,27 +328,4 @@ public class BauCommand extends SWCommand {
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, BauLockState state) {
SteamwarUser owner = SteamwarUser.get(p.getUniqueId());
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;
}
}
}

Datei anzeigen

@ -20,21 +20,15 @@
package de.steamwar.bungeecore.sql;
import de.steamwar.bungeecore.Message;
import lombok.experimental.UtilityClass;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@UtilityClass
public class BauLock {
private static final String BAU_LOCK_CONFIG_NAME = "baulockstate";
public static void setLocked(ProxiedPlayer p, String arg) {
public static void setLocked(ProxiedPlayer p, BauLockState state) {
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());
}