*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() {
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();

View File

@@ -23,8 +23,6 @@ import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.util.Vector;
public class Features implements Listener {
public static ArrayList<UUID> wantFlight = new ArrayList<>();
public enum Feature {
@@ -55,6 +53,7 @@ public class Features implements Listener {
private final HashMap<Player, ArrayList<Feature>> playerFeatures = new HashMap<>();
private final HashMap<Player, Boolean> canDoubleJump = new HashMap<>();
private final HashMap<Player, HashMap<Feature, Boolean>> featureEnabled = new HashMap<>();
public static ArrayList<UUID> 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)));

View File

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

View File

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