- Fix aim the water item

- Fix Exception in onDisable
This commit is contained in:
kaenganxt
2015-01-02 13:21:32 +01:00
parent c21435b87b
commit a8895a30fc
3 changed files with 14 additions and 5 deletions

View File

@@ -199,7 +199,7 @@ public class Core {
* Makes a player stand up
* @param P The player to end the sitting of
*/
public static void endSitting(Player P) {
public static void endSitting(Player P, boolean noRemove) {
try {
if (getMainClass().sittingPlayer.containsKey(P)) {
MaterialData md = getMainClass().sittingBlocks.get(P).getState().getData();
@@ -209,13 +209,17 @@ public class Core {
Entity a = (Entity) getMainClass().sittingPlayer.get(P);
P.teleport(loc);
a.remove();
getMainClass().sittingPlayer.remove(P);
if (!noRemove) {
getMainClass().sittingPlayer.remove(P);
}
getMainClass().sittingBlocks.remove(P);
} else {
Location loc = getMainClass().sittingPlayer.get(P).getLocation();
P.teleport(loc);
getMainClass().sittingPlayer.get(P).remove();
getMainClass().sittingPlayer.remove(P);
if (!noRemove) {
getMainClass().sittingPlayer.remove(P);
}
getMainClass().sittingBlocks.remove(P);
}
}
@@ -223,6 +227,10 @@ public class Core {
Errors.reportException(e);
}
}
public static void endSitting(Player P) {
endSitting(P, false);
}
/**
* Method to check if a given string can be converted into an integer

View File

@@ -105,8 +105,9 @@ public class AnuraCore extends JavaPlugin {
features.reset();
level.update();
for (Player P : this.sittingPlayer.keySet()) {
Core.endSitting(P);
Core.endSitting(P, true);
}
sittingPlayer.clear();
} catch (Throwable e) {
Errors.reportException(e);
}

View File

@@ -229,7 +229,7 @@ public class Setup {
Inventories.putIntoInventory("MINIGAMES", 1, Inventories.buildItems(Material.WHEAT, "inv_lobby_farmfight", ChatColor.YELLOW));
Inventories.putIntoInventory("MINIGAMES", 2, Inventories.buildItems(Material.FIREWORK, "inv_lobby_rocketmatch", ChatColor.DARK_AQUA));
Inventories.putIntoInventory("MINIGAMES", 4, Inventories.buildItems(Material.EXP_BOTTLE, "inv_lobby_xpbattle", ChatColor.GREEN));
Inventories.putIntoInventory("MINIGAMES", 5, Inventories.buildItems(Material.WATER_BUCKET, "inv_lobby_swim", ChatColor.DARK_AQUA));
Inventories.putIntoInventory("MINIGAMES", 5, Inventories.buildItems(Material.POTION, "inv_lobby_pool", ChatColor.DARK_AQUA));
} else {
Inventories.putIntoInventory("MINIGAMES", 0, Inventories.buildItems(Material.BOW, "inv_lobby_smash", ChatColor.GREEN, ChatColor.BLUE, "smash_description_1", "smash_description_2", "smash_description_3", "smash_description_4", "smash_description_5", "smash_description_6"));
Inventories.putIntoInventory("MINIGAMES", 3, Inventories.buildItems(Material.WHEAT, "inv_lobby_farmfight", ChatColor.YELLOW));