*Bug fixes

This commit is contained in:
Lukas
2014-11-02 18:08:16 +01:00
parent 149ba5e92d
commit f4d84c40b1
4 changed files with 13 additions and 16 deletions

View File

@@ -52,18 +52,16 @@ public class AnuraCore extends JavaPlugin {
public void onEnable() { public void onEnable() {
AnuraCore.sql = new MySQL(this); AnuraCore.sql = new MySQL(this);
AnuraCore.instance = this; AnuraCore.instance = this;
if(AnuraCore.getInstance().getConfig().getBoolean("is-main-lobby")){ if (AnuraCore.sql.isValid) {
for(World w : Bukkit.getWorlds()){ if (AnuraCore.getInstance().getConfig().getBoolean("is-main-lobby")) {
for(Entity e : w.getEntities()){ for (World w : Bukkit.getWorlds()) {
if(e.getType().equals(EntityType.BOAT)){ for (Entity e : w.getEntities()) {
if (e.getType().equals(EntityType.BOAT)) {
e.remove(); e.remove();
} }
} }
} }
} }
if (AnuraCore.sql.isValid) {
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord"); this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
Setup.setupConfig(); Setup.setupConfig();
Setup.setupEvents(); Setup.setupEvents();

View File

@@ -24,8 +24,6 @@ import org.bukkit.util.Vector;
public class Features implements Listener { public class Features implements Listener {
public static ArrayList<UUID> wantFlight = new ArrayList<>();
public enum Feature { public enum Feature {
DOUBLE_JUMP(1), DOUBLE_JUMP(1),
@@ -55,6 +53,7 @@ public class Features implements Listener {
private final HashMap<Player, ArrayList<Feature>> playerFeatures = new HashMap<>(); private final HashMap<Player, ArrayList<Feature>> playerFeatures = new HashMap<>();
private final HashMap<Player, Boolean> canDoubleJump = new HashMap<>(); private final HashMap<Player, Boolean> canDoubleJump = new HashMap<>();
private final HashMap<Player, HashMap<Feature, Boolean>> featureEnabled = new HashMap<>(); private final HashMap<Player, HashMap<Feature, Boolean>> featureEnabled = new HashMap<>();
public static ArrayList<UUID> wantFlight = new ArrayList<>();
public void updateFeatures(Player P) { public void updateFeatures(Player P) {
if (!mainLobby()) { 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); Boat b = (Boat) P.getWorld().spawnEntity(event.getTo(), EntityType.BOAT);
b.setPassenger(P); b.setPassenger(P);
} }
@@ -228,14 +227,14 @@ public class Features implements Listener {
@EventHandler @EventHandler
public void onBoatDestory(VehicleDestroyEvent event) { 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); event.setCancelled(true);
} }
} }
@EventHandler @EventHandler
public void onExit(VehicleExitEvent event) { 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(); event.getVehicle().remove();
Player p = (Player) event.getExited(); Player p = (Player) event.getExited();
p.setVelocity(p.getVelocity().add(new Vector(0D, 1D, 0D))); p.setVelocity(p.getVelocity().add(new Vector(0D, 1D, 0D)));

View File

@@ -319,7 +319,7 @@ public class TeamCommands implements CommandExecutor {
} }
} else if (cmd.getName().equalsIgnoreCase("toggleBoatFlight")) { } 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())) { if (Features.wantFlight.contains(P.getUniqueId())) {
Features.wantFlight.remove(P.getUniqueId()); Features.wantFlight.remove(P.getUniqueId());
P.sendMessage("Du wurdest aus der Liste entfernt!"); P.sendMessage("Du wurdest aus der Liste entfernt!");

View File

@@ -83,5 +83,5 @@ commands:
description: Adds an Aim the Water win to the statistics description: Adds an Aim the Water win to the statistics
usage: /<command> <username> usage: /<command> <username>
toggleBoatFlight: 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: /<command> usage: /<command>