Merge pull request 'ModifyToggle' (#34) from ModifyToggle into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #34 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
7277877293
@ -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,26 @@ 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);
|
||||
LobbySystem.getEntityServer(true).removePlayer(player);
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
player.setOp(false);
|
||||
PlayerSpawn.giveItems(player);
|
||||
}else {
|
||||
modifying.add(player);
|
||||
LobbySystem.getEntityServer(true).addPlayer(player);
|
||||
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