SteamWar/FightSystem
Archiviert
13
1

Preventing copying

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-05-01 11:05:31 +02:00
Ursprung 04b5fa34f8
Commit 219d7acbe2

Datei anzeigen

@ -5,10 +5,14 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.sql.Schematic; import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserGroup;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.logging.Level;
public class CheckListener extends BasicListener { public class CheckListener extends BasicListener {
@ -16,6 +20,7 @@ public class CheckListener extends BasicListener {
super(Config.check() ? EnumSet.allOf(FightState.class) : EnumSet.noneOf(FightState.class)); super(Config.check() ? EnumSet.allOf(FightState.class) : EnumSet.noneOf(FightState.class));
} }
@EventHandler
public void onJoin(PlayerJoinEvent e){ public void onJoin(PlayerJoinEvent e){
Player player = e.getPlayer(); Player player = e.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
@ -31,6 +36,17 @@ public class CheckListener extends BasicListener {
player.kickPlayer(""); player.kickPlayer("");
} }
@EventHandler
public void handlePlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if(!event.getMessage().contains("copy") && !event.getMessage().contains("cut"))
return;
event.setCancelled(true);
player.sendMessage("§cDieser Befehl ist beim Prüfen gesperrt! Admin wird benachrichtigt.");
Bukkit.getLogger().log(Level.SEVERE, player.getName() + " tried to use a copy command!");
}
private static boolean allowedToCheck(SteamwarUser user) { private static boolean allowedToCheck(SteamwarUser user) {
return user.getUserGroup() == UserGroup.Supporter || return user.getUserGroup() == UserGroup.Supporter ||
user.getUserGroup() == UserGroup.Developer || user.getUserGroup() == UserGroup.Developer ||