bugfixes
Dieser Commit ist enthalten in:
Ursprung
53aa5e1c54
Commit
ebb14eb610
@ -28,7 +28,7 @@ public class ShieldCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
||||||
boolean newShieldState = lobbyPlayer.isShield() ? false : true;
|
boolean newShieldState = !lobbyPlayer.isShield();
|
||||||
|
|
||||||
lobbyPlayer.setShield(newShieldState);
|
lobbyPlayer.setShield(newShieldState);
|
||||||
player.sendMessage("§7Dein Schild ist jetzt " + (newShieldState ? "§aan" : "§caus") + "§7.");
|
player.sendMessage("§7Dein Schild ist jetzt " + (newShieldState ? "§aan" : "§caus") + "§7.");
|
||||||
|
@ -11,6 +11,7 @@ public class LobbyInventory {
|
|||||||
public static Material PARTIKEL = Material.NAME_TAG;
|
public static Material PARTIKEL = Material.NAME_TAG;
|
||||||
public static Material ENDERPEARL_USED = Material.FIREWORK_CHARGE;
|
public static Material ENDERPEARL_USED = Material.FIREWORK_CHARGE;
|
||||||
public static Material ENDERPEARL_READY = Material.ENDER_PEARL;
|
public static Material ENDERPEARL_READY = Material.ENDER_PEARL;
|
||||||
|
public static Material SCHILD = Material.SHIELD;
|
||||||
|
|
||||||
public static void givePlayerLobbyItems(Player player) {
|
public static void givePlayerLobbyItems(Player player) {
|
||||||
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
||||||
@ -33,6 +34,12 @@ public class LobbyInventory {
|
|||||||
.setUnbreakable(true)
|
.setUnbreakable(true)
|
||||||
.removeAllAtributs()
|
.removeAllAtributs()
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
player.getInventory().setItem(8, new ItemBuilder(SCHILD)
|
||||||
|
.setDisplayName("§bSchild §8| " + (lobbyPlayer.isShield() ? "§caus" : "§aan"))
|
||||||
|
.setUnbreakable(true)
|
||||||
|
.removeAllAtributs()
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,14 +1,19 @@
|
|||||||
package de.steamwar.lobby.listener;
|
package de.steamwar.lobby.listener;
|
||||||
|
|
||||||
|
import de.steamwar.lobby.LobbySystem;
|
||||||
|
import de.steamwar.lobby.inventorys.LobbyInventory;
|
||||||
import de.steamwar.lobby.utils.LobbyPlayer;
|
import de.steamwar.lobby.utils.LobbyPlayer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.EnderPearl;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -75,5 +80,18 @@ public class ShieldListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void handlePlayerInteract(PlayerInteractEvent event) {
|
||||||
|
if(event.getMaterial() != LobbyInventory.SCHILD) return;
|
||||||
|
Action action = event.getAction();
|
||||||
|
if(action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) return;
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId());
|
||||||
|
lobbyPlayer.setShield(!lobbyPlayer.isShield());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren