diff --git a/src/de/steamwar/lobby/LobbySystem.java b/src/de/steamwar/lobby/LobbySystem.java index 9effc35..3e96350 100644 --- a/src/de/steamwar/lobby/LobbySystem.java +++ b/src/de/steamwar/lobby/LobbySystem.java @@ -1,6 +1,5 @@ package de.steamwar.lobby; -import de.steamwar.lobby.commands.FlyCommand; import de.steamwar.lobby.listener.*; import org.bukkit.Bukkit; import org.bukkit.plugin.PluginManager; @@ -14,12 +13,6 @@ public class LobbySystem extends JavaPlugin { public void onEnable() { instance = this; - init(); - - getCommand("fly").setExecutor(new FlyCommand()); - } - - public void init() { PluginManager pm = Bukkit.getPluginManager(); pm.registerEvents(new PlayerMoveListener(), instance); @@ -30,12 +23,10 @@ public class LobbySystem extends JavaPlugin { pm.registerEvents(new ParticleListener(), instance); pm.registerEvents(new PlayerHiderListener(), instance); pm.registerEvents(new EnderPearlListener(), instance); - pm.registerEvents(new ShieldListener(), instance); } public static LobbySystem getInstance() { return instance; } - } diff --git a/src/de/steamwar/lobby/commands/FlyCommand.java b/src/de/steamwar/lobby/commands/FlyCommand.java deleted file mode 100644 index d9e8c39..0000000 --- a/src/de/steamwar/lobby/commands/FlyCommand.java +++ /dev/null @@ -1,42 +0,0 @@ -package de.steamwar.lobby.commands; - -import de.steamwar.lobby.utils.LobbyPlayer; -import de.steamwar.sql.SteamwarUser; -import de.steamwar.sql.UserGroup; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class FlyCommand implements CommandExecutor { - - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if(!(sender instanceof Player)) - return false; - - Player player = (Player) sender; - SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId()); - UserGroup userGroup = steamwarUser.getUserGroup(); - - if(userGroup != UserGroup.Admin && - userGroup != UserGroup.Moderator && - userGroup != UserGroup.Developer && - userGroup != UserGroup.Supporter && - userGroup != UserGroup.Builder && - userGroup != UserGroup.Youtuber) { - player.sendMessage("§cDu verfügst nicht über die benötigten Rechte!"); - return false; - } - - LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); - boolean newFlightState = !lobbyPlayer.isFly(); - - lobbyPlayer.setFly(newFlightState); - player.setAllowFlight(newFlightState); - player.setFlying(newFlightState); - player.sendMessage("§7Du kannst jetzt " + (newFlightState ? "§afliegen§7." : "§cnicht §7mehr fliegen.")); - return false; - } -} diff --git a/src/de/steamwar/lobby/inventories/LobbyInventory.java b/src/de/steamwar/lobby/inventories/LobbyInventory.java index 2a67538..1a8d4ca 100644 --- a/src/de/steamwar/lobby/inventories/LobbyInventory.java +++ b/src/de/steamwar/lobby/inventories/LobbyInventory.java @@ -2,8 +2,6 @@ package de.steamwar.lobby.inventories; import de.steamwar.lobby.utils.ItemBuilder; import de.steamwar.lobby.utils.LobbyPlayer; -import de.steamwar.sql.SteamwarUser; -import de.steamwar.sql.UserGroup; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -37,22 +35,6 @@ public class LobbyInventory { .setUnbreakable(true) .removeAllAtributs() .build()); - - - UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup(); - if(userGroup != UserGroup.Admin && - userGroup != UserGroup.Moderator && - userGroup != UserGroup.Developer && - userGroup != UserGroup.Supporter && - userGroup != UserGroup.Builder && - userGroup != UserGroup.Youtuber) { - return; - } - player.getInventory().setItem(8, new ItemBuilder(SHIELD) - .setDisplayName("§bSchild §8| " + (lobbyPlayer.isShield() ? "§aan" : "§caus")) - .setUnbreakable(true) - .removeAllAtributs() - .build()); } diff --git a/src/de/steamwar/lobby/listener/DoubleJumpListener.java b/src/de/steamwar/lobby/listener/DoubleJumpListener.java index 3ecf583..5c282d8 100644 --- a/src/de/steamwar/lobby/listener/DoubleJumpListener.java +++ b/src/de/steamwar/lobby/listener/DoubleJumpListener.java @@ -25,8 +25,6 @@ public class DoubleJumpListener implements Listener { @EventHandler public void handlePlayerToggleFlight(PlayerToggleFlightEvent event) { Player player = event.getPlayer(); - if(LobbyPlayer.getLobbyPlayer(player.getUniqueId()).isFly()) - return; event.setCancelled(true); player.setAllowFlight(false); @@ -44,8 +42,6 @@ public class DoubleJumpListener implements Listener { @EventHandler public void handlePlayerMove(PlayerMoveEvent event) { Player player = event.getPlayer(); - if(LobbyPlayer.getLobbyPlayer(player.getUniqueId()).isFly()) - return; if(player.getLocation().add(0, -1, 0).getBlock().getType() == Material.AIR) return; diff --git a/src/de/steamwar/lobby/listener/PlayerConnectionListener.java b/src/de/steamwar/lobby/listener/PlayerConnectionListener.java index 2580335..2ff3aa6 100644 --- a/src/de/steamwar/lobby/listener/PlayerConnectionListener.java +++ b/src/de/steamwar/lobby/listener/PlayerConnectionListener.java @@ -22,8 +22,7 @@ public class PlayerConnectionListener implements Listener { event.setJoinMessage(null); Player player = event.getPlayer(); - LobbyPlayer lp = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); //initialisiert einen neuen LP falls nicht vorhanden - lp.setShield(false); + LobbyPlayer.getLobbyPlayer(player.getUniqueId()); //initialisiert einen neuen LP falls nicht vorhanden player.teleport(new Location(Bukkit.getWorlds().get(0), Config.SpawnX, Config.SpawnY, Config.SpawnZ, Config.Yaw, Config.Pitch)); player.getInventory().clear(); diff --git a/src/de/steamwar/lobby/listener/ShieldListener.java b/src/de/steamwar/lobby/listener/ShieldListener.java deleted file mode 100644 index 7952d5e..0000000 --- a/src/de/steamwar/lobby/listener/ShieldListener.java +++ /dev/null @@ -1,95 +0,0 @@ -package de.steamwar.lobby.listener; - -import de.steamwar.lobby.inventories.LobbyInventory; -import de.steamwar.lobby.utils.LobbyPlayer; -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -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.util.Vector; - -import java.util.Collection; - -public class ShieldListener implements Listener { - - double radius = 1.5D; - double multiplyer = 1.1D; - float height = 1.0F; - - @EventHandler - public void handlePlayerMove(PlayerMoveEvent event) { - Player player = event.getPlayer(); - LobbyPlayer lobbyPlayer = LobbyPlayer.getLobbyPlayer(player.getUniqueId()); - World world = player.getWorld(); - Location playerLocation = event.getTo(); - - Collection nearbyEntities = world.getNearbyEntities(playerLocation, radius, radius, radius); - - if(lobbyPlayer.isShield()) { - for(Entity entity : nearbyEntities) { - if(!(entity instanceof Player)) { - continue; - } - - Player entityPlayer = (Player) entity; - if(entityPlayer.getUniqueId() == player.getUniqueId()) { - continue; - } - if(LobbyPlayer.getLobbyPlayer(entityPlayer.getUniqueId()).isShield()) { - continue; - } - world.playEffect(playerLocation, Effect.ENDER_SIGNAL, 1); - Location location = entityPlayer.getLocation(); - - double x = location.getX() - playerLocation.getX(); - double y = location.getY() - playerLocation.getY(); - double z = location.getZ() - playerLocation.getZ(); - - entityPlayer.setVelocity(new Vector(x, y, z).multiply(multiplyer).add(new Vector(0.0F, height, 0.0F))); - } - } else { - for(Entity entity : nearbyEntities) { - if(!(entity instanceof Player)) { - continue; - } - - Player entityPlayer = (Player) entity; - LobbyPlayer entityPlayerLP = LobbyPlayer.getLobbyPlayer(entityPlayer.getUniqueId()); - if(!entityPlayerLP.isShield()) - continue; - - world.playEffect(entityPlayer.getLocation(), Effect.ENDER_SIGNAL, 1); - - Location location = entityPlayer.getLocation(); - - double x = playerLocation.getX() - location.getX(); - double y = playerLocation.getY() - location.getY(); - double z = playerLocation.getZ() - location.getZ(); - - player.setVelocity(new Vector(x, y, z).multiply(multiplyer).add(new Vector(0.0F, height, 0.0F))); - } - } - } - - @EventHandler - public void handlePlayerInteract(PlayerInteractEvent event) { - if(event.getMaterial() != LobbyInventory.SHIELD) 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()); - LobbyInventory.givePlayerLobbyItems(player); - } - - -} diff --git a/src/de/steamwar/lobby/utils/LobbyPlayer.java b/src/de/steamwar/lobby/utils/LobbyPlayer.java index f7fc43c..fe678a4 100644 --- a/src/de/steamwar/lobby/utils/LobbyPlayer.java +++ b/src/de/steamwar/lobby/utils/LobbyPlayer.java @@ -6,13 +6,11 @@ import java.util.*; public class LobbyPlayer { - private static Map cache = new HashMap(); + private static Map cache = new HashMap<>(); private PlayerHiderState hiderState; private Particle particle; - private boolean fly; private boolean enderPearlUsed; - private boolean shield; private LobbyPlayer(UUID uuid) { this.hiderState = PlayerHiderState.SHOW_ALL; @@ -35,14 +33,6 @@ public class LobbyPlayer { this.particle = particle; } - public boolean isFly() { - return fly; - } - - public void setFly(boolean fly) { - this.fly = fly; - } - public boolean isEnderPearlUsed() { return enderPearlUsed; } @@ -51,14 +41,6 @@ public class LobbyPlayer { this.enderPearlUsed = enderPearlUsed; } - public boolean isShield() { - return shield; - } - - public void setShield(boolean shield) { - this.shield = shield; - } - public void nexthHiderState() { if(this.hiderState == PlayerHiderState.SHOW_ALL) { this.hiderState = PlayerHiderState.SHOW_TEAM; diff --git a/src/plugin.yml b/src/plugin.yml index 30ba4f7..488c080 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,9 +1,7 @@ name: LobbySystem -version: 1.0 +version: "1.0" author: Yaruma3341 -depend: [SpigotCore] +depend: + - SpigotCore main: de.steamwar.lobby.LobbySystem -api-version: 1.13 - -commands: - fly: \ No newline at end of file +api-version: "1.13" \ No newline at end of file