diff --git a/src/de/anura/core/AnuraCore.java b/src/de/anura/core/AnuraCore.java index 6b26186..9483b32 100644 --- a/src/de/anura/core/AnuraCore.java +++ b/src/de/anura/core/AnuraCore.java @@ -52,18 +52,16 @@ public class AnuraCore extends JavaPlugin { public void onEnable() { AnuraCore.sql = new MySQL(this); AnuraCore.instance = this; - if(AnuraCore.getInstance().getConfig().getBoolean("is-main-lobby")){ - for(World w : Bukkit.getWorlds()){ - for(Entity e : w.getEntities()){ - if(e.getType().equals(EntityType.BOAT)){ - e.remove(); + if (AnuraCore.sql.isValid) { + if (AnuraCore.getInstance().getConfig().getBoolean("is-main-lobby")) { + for (World w : Bukkit.getWorlds()) { + for (Entity e : w.getEntities()) { + if (e.getType().equals(EntityType.BOAT)) { + e.remove(); + } } } } - } - - - if (AnuraCore.sql.isValid) { this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); Setup.setupConfig(); Setup.setupEvents(); diff --git a/src/de/anura/core/Features.java b/src/de/anura/core/Features.java index 463c34c..38fac14 100644 --- a/src/de/anura/core/Features.java +++ b/src/de/anura/core/Features.java @@ -23,8 +23,6 @@ import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.util.Vector; public class Features implements Listener { - - public static ArrayList wantFlight = new ArrayList<>(); public enum Feature { @@ -55,6 +53,7 @@ public class Features implements Listener { private final HashMap> playerFeatures = new HashMap<>(); private final HashMap canDoubleJump = new HashMap<>(); private final HashMap> featureEnabled = new HashMap<>(); + public static ArrayList wantFlight = new ArrayList<>(); public void updateFeatures(Player P) { if (!mainLobby()) { @@ -198,7 +197,7 @@ public class Features implements Listener { } } - if (P.getLocation().getBlock().getType().equals(Material.STATIONARY_WATER) && P.getVehicle() == null) { + if (P.getLocation().getBlock().getType().equals(Material.STATIONARY_WATER) && P.getVehicle() == null && P.getVehicle().getType().equals(EntityType.BOAT)) { Boat b = (Boat) P.getWorld().spawnEntity(event.getTo(), EntityType.BOAT); b.setPassenger(P); } @@ -228,14 +227,14 @@ public class Features implements Listener { @EventHandler public void onBoatDestory(VehicleDestroyEvent event) { - if (event.getVehicle().getType().equals(EntityType.BOAT)) { + if (event.getVehicle().getType().equals(EntityType.BOAT) && AnuraCore.getInstance().getConfig().getBoolean("is-main-lobby")) { event.setCancelled(true); } } @EventHandler public void onExit(VehicleExitEvent event) { - if (event.getVehicle().getType().equals(EntityType.BOAT)) { + if (event.getVehicle().getType().equals(EntityType.BOAT) && AnuraCore.getInstance().getConfig().getBoolean("is-main-lobby")) { event.getVehicle().remove(); Player p = (Player) event.getExited(); p.setVelocity(p.getVelocity().add(new Vector(0D, 1D, 0D))); diff --git a/src/de/anura/core/commands/TeamCommands.java b/src/de/anura/core/commands/TeamCommands.java index f7bc83d..fbe16b1 100644 --- a/src/de/anura/core/commands/TeamCommands.java +++ b/src/de/anura/core/commands/TeamCommands.java @@ -319,7 +319,7 @@ public class TeamCommands implements CommandExecutor { } } else if (cmd.getName().equalsIgnoreCase("toggleBoatFlight")) { - if (P.hasPermission("core.boat.toggleflight")) { + if (P != null && P.hasPermission("core.boat.toggleflight")) { if (Features.wantFlight.contains(P.getUniqueId())) { Features.wantFlight.remove(P.getUniqueId()); P.sendMessage("Du wurdest aus der Liste entfernt!"); diff --git a/src/plugin.yml b/src/plugin.yml index ebbda5d..190b4cc 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -83,5 +83,5 @@ commands: description: Adds an Aim the Water win to the statistics usage: / toggleBoatFlight: - description: Adds an Aim the Water win to the statistics + description: Toggles if you automatic flight when you escape a boat (only in gamemode 1) usage: / \ No newline at end of file