ModifyToggle #34
@ -21,6 +21,7 @@ package de.steamwar.lobby.command;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.lobby.LobbySystem;
|
||||
import de.steamwar.lobby.listener.PlayerSpawn;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
@ -52,15 +53,25 @@ public class ModifyCommand extends SWCommand implements Listener {
|
||||
if(!user.getUserGroup().isTeamGroup() && !user.getUserName().equals("joschi1"))
|
||||
return;
|
||||
|
||||
modifying.add(player);
|
||||
LobbySystem.getEntityServer(true).addPlayer(player);
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
player.setOp(true);
|
||||
if(modifying(player)) {
|
||||
modifying.remove(player);
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
player.setOp(false);
|
||||
PlayerSpawn.giveItems(player);
|
||||
}else {
|
||||
modifying.add(player);
|
||||
LobbySystem.getEntityServer(true).addPlayer(player);
|
||||
Lixfel markierte diese Unterhaltung als gelöst
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
player.setOp(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent event) {
|
||||
modifying.remove(event.getPlayer());
|
||||
Player player = event.getPlayer();
|
||||
|
||||
modifying.remove(player);
|
||||
player.setOp(false);
|
||||
}
|
||||
|
||||
@Register("waitinghallspawn")
|
||||
|
@ -50,7 +50,6 @@ public class PlayerSpawn extends BasicListener {
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
e.setJoinMessage(null);
|
||||
player.getInventory().clear();
|
||||
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
player.setWalkSpeed(0.5f);
|
||||
@ -68,6 +67,8 @@ public class PlayerSpawn extends BasicListener {
|
||||
public static void giveItems(Player player) {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
|
||||
inventory.clear();
|
||||
|
||||
inventory.setItem(EquipmentSlot.CHEST, ELYTRA);
|
||||
|
||||
player.getInventory().setItem(FIREWORK_SLOT, FIREWORK);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Du fühgst ihn ja hier hinzu. Aber beim removen solltest du dies auch wieder removen.