13
0

Modify Toggle
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
MoBrot 2023-04-20 19:11:04 +02:00
Ursprung b1fb5a3e83
Commit 6e73dff5f7
2 geänderte Dateien mit 18 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -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,25 @@ 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);
player.setGameMode(GameMode.ADVENTURE);
player.setOp(false);
PlayerSpawn.giveItems(player);
}else {
modifying.add(player); modifying.add(player);
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")

Datei anzeigen

@ -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);