ModifyToggle #34
@ -21,6 +21,7 @@ package de.steamwar.lobby.command;
|
|||||||
|
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.lobby.LobbySystem;
|
import de.steamwar.lobby.LobbySystem;
|
||||||
|
import de.steamwar.lobby.listener.PlayerSpawn;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -52,15 +53,26 @@ public class ModifyCommand extends SWCommand implements Listener {
|
|||||||
if(!user.getUserGroup().isTeamGroup() && !user.getUserName().equals("joschi1"))
|
if(!user.getUserGroup().isTeamGroup() && !user.getUserName().equals("joschi1"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(modifying(player)) {
|
||||||
|
modifying.remove(player);
|
||||||
|
LobbySystem.getEntityServer(true).removePlayer(player);
|
||||||
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
|
player.setOp(false);
|
||||||
|
PlayerSpawn.giveItems(player);
|
||||||
|
}else {
|
||||||
modifying.add(player);
|
modifying.add(player);
|
||||||
Lixfel markierte diese Unterhaltung als gelöst
|
|||||||
LobbySystem.getEntityServer(true).addPlayer(player);
|
LobbySystem.getEntityServer(true).addPlayer(player);
|
||||||
player.setGameMode(GameMode.CREATIVE);
|
player.setGameMode(GameMode.CREATIVE);
|
||||||
player.setOp(true);
|
player.setOp(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLeave(PlayerQuitEvent event) {
|
public void onLeave(PlayerQuitEvent event) {
|
||||||
modifying.remove(event.getPlayer());
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
modifying.remove(player);
|
||||||
|
player.setOp(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register("waitinghallspawn")
|
@Register("waitinghallspawn")
|
||||||
|
@ -50,7 +50,6 @@ public class PlayerSpawn extends BasicListener {
|
|||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
e.setJoinMessage(null);
|
e.setJoinMessage(null);
|
||||||
player.getInventory().clear();
|
|
||||||
|
|
||||||
player.setGameMode(GameMode.ADVENTURE);
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
player.setWalkSpeed(0.5f);
|
player.setWalkSpeed(0.5f);
|
||||||
@ -68,6 +67,8 @@ public class PlayerSpawn extends BasicListener {
|
|||||||
public static void giveItems(Player player) {
|
public static void giveItems(Player player) {
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
|
||||||
|
inventory.clear();
|
||||||
|
|
||||||
inventory.setItem(EquipmentSlot.CHEST, ELYTRA);
|
inventory.setItem(EquipmentSlot.CHEST, ELYTRA);
|
||||||
|
|
||||||
player.getInventory().setItem(FIREWORK_SLOT, FIREWORK);
|
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.