Merge branch 'master' into BauCommand
# Conflicts: # src/de/steamwar/bungeecore/commands/BauCommand.java
Dieser Commit ist enthalten in:
Commit
47dd2503cf
@ -95,6 +95,8 @@ public class TpCommand extends BasicCommand {
|
|||||||
} else {
|
} else {
|
||||||
sender.system("JOIN_PLAYER_BLOCK");
|
sender.system("JOIN_PLAYER_BLOCK");
|
||||||
}
|
}
|
||||||
|
}else if (BauLock.isLocked(SteamwarUser.get(bauserver.getOwner()), sender.user())) {
|
||||||
|
Message.send("BAU_LOCKED_NOALLOWED", player);
|
||||||
}else if (bauserver.getOwner().equals(player.getUniqueId()) || BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
|
}else if (bauserver.getOwner().equals(player.getUniqueId()) || BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
|
||||||
SubserverSystem.sendPlayer(subserver, player);
|
SubserverSystem.sendPlayer(subserver, player);
|
||||||
} else {
|
} else {
|
||||||
|
58
src/de/steamwar/bungeecore/sql/BauLock.java
Normale Datei
58
src/de/steamwar/bungeecore/sql/BauLock.java
Normale Datei
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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