From ad4c7aeffad81cf3c07caced69cec36a751ed1bd Mon Sep 17 00:00:00 2001 From: OmniCypher Date: Mon, 28 Mar 2016 15:26:47 -0700 Subject: [PATCH] Various Fixes Fixes FastSwimming on AirSpout slot Fixes command consistency Fixes bind command "ability does not exist" message Fixes add command description Fixes WaterArms move display Fixes WaterArms Spear Ice Dome --- .../projectkorra/projectkorra/PKListener.java | 19 ++++++++++++------- .../ability/util/ComboManager.java | 1 - .../projectkorra/airbending/AirSpout.java | 2 +- .../projectkorra/command/ClearCommand.java | 4 ++-- .../configuration/ConfigManager.java | 4 ++-- .../projectkorra/waterbending/WaterArms.java | 8 +++++--- .../waterbending/WaterArmsSpear.java | 3 +-- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java index c2ecf556..9ae4d0b3 100644 --- a/src/com/projectkorra/projectkorra/PKListener.java +++ b/src/com/projectkorra/projectkorra/PKListener.java @@ -142,6 +142,7 @@ import org.bukkit.event.player.PlayerAnimationEvent; import org.bukkit.event.player.PlayerGameModeChangeEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerMoveEvent; @@ -968,7 +969,6 @@ public class PKListener implements Listener { || type == Material.LEAVES || type == Material.LEAVES_2 || type == Material.LEATHER_LEGGINGS || type == Material.AIR)) { newDrops.add(drops.get(i)); - Bukkit.broadcastMessage("Adding " + drops.get(i)); } } if (plantArmor.getOldArmor() != null) { @@ -1251,12 +1251,6 @@ public class PKListener implements Listener { BlockSource.update(player, ClickType.SHIFT_DOWN); } - WaterArms waterArms = CoreAbility.getAbility(player, WaterArms.class); - if (!player.isSneaking() && waterArms != null) { - waterArms.displayBoundMsg(); - return; - } - AirScooter.check(player); @@ -1418,6 +1412,17 @@ public class PKListener implements Listener { } } } + + @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) + public void onPlayerSlotChange(PlayerItemHeldEvent event) { + Player player = event.getPlayer(); + + WaterArms waterArms = CoreAbility.getAbility(player, WaterArms.class); + if (waterArms != null) { + waterArms.displayBoundMsg(event.getNewSlot()+1); + return; + } + } @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerSwing(PlayerAnimationEvent event) { diff --git a/src/com/projectkorra/projectkorra/ability/util/ComboManager.java b/src/com/projectkorra/projectkorra/ability/util/ComboManager.java index 70535903..b8ccb35c 100644 --- a/src/com/projectkorra/projectkorra/ability/util/ComboManager.java +++ b/src/com/projectkorra/projectkorra/ability/util/ComboManager.java @@ -196,7 +196,6 @@ public class ComboManager { } list.add(info); RECENTLY_USED.put(name, list); - //Bukkit.broadcastMessage("recentlyUsedAbilities: " + recentlyUsedAbilities.get(name).size()); } /** diff --git a/src/com/projectkorra/projectkorra/airbending/AirSpout.java b/src/com/projectkorra/projectkorra/airbending/AirSpout.java index 9fbc57b0..d362f62f 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirSpout.java +++ b/src/com/projectkorra/projectkorra/airbending/AirSpout.java @@ -163,7 +163,7 @@ public class AirSpout extends AirAbility { @Override public boolean isSneakAbility() { - return true; + return false; } @Override diff --git a/src/com/projectkorra/projectkorra/command/ClearCommand.java b/src/com/projectkorra/projectkorra/command/ClearCommand.java index 420aa816..2291caaa 100644 --- a/src/com/projectkorra/projectkorra/command/ClearCommand.java +++ b/src/com/projectkorra/projectkorra/command/ClearCommand.java @@ -51,7 +51,7 @@ public class ClearCommand extends PKCommand { for (int i = 1; i <= 9; i++) { GeneralMethods.saveAbility(bPlayer, i, null); } - sender.sendMessage(cleared); + sender.sendMessage(ChatColor.YELLOW + cleared); } else if (args.size() == 1) { try { int slot = Integer.parseInt(args.get(0)); @@ -63,7 +63,7 @@ public class ClearCommand extends PKCommand { GeneralMethods.saveAbility(bPlayer, slot, null); sender.sendMessage(clearedSlot.replace("{slot}", String.valueOf(slot))); } else { - sender.sendMessage(alreadyEmpty); + sender.sendMessage(ChatColor.YELLOW + alreadyEmpty); } } catch (NumberFormatException e) { sender.sendMessage(ChatColor.RED + wrongNumber); diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index e7c7d18e..bd5a718e 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -190,12 +190,12 @@ public class ConfigManager { config.addDefault("Commands.Check.UpToDate", "You have the latest version of ProjectKorra."); config.addDefault("Commands.Bind.Description", "This command will bind an ability to the slot you specify (if you specify one), or the slot currently selected in your hotbar (If you do not specify a Slot #)."); - config.addDefault("Commands.Bind.AbilityDoesntExist", "This command will bind an ability to the slot you specify (if you specify one), or the slot currently selected in your hotbar (If you do not specify a Slot #)."); + config.addDefault("Commands.Bind.AbilityDoesntExist", "{ability} is not a valid ability."); config.addDefault("Commands.Bind.WrongNumber", "Slot must be an integer between 1 and 9."); config.addDefault("Commands.Bind.ElementToggledOff", "You have that ability's element toggled off currently."); config.addDefault("Commands.Bind.SuccessfullyBound", "Succesfully bound {ability} to slot {slot}."); - config.addDefault("Commands.Add.Choose", "This command will allow the user to add an element to the targeted , or themselves if the target is not specified. This command is typically reserved for server administrators."); + config.addDefault("Commands.Add.Description", "This command will allow the user to add an element to the targeted , or themselves if the target is not specified. This command is typically reserved for server administrators."); config.addDefault("Commands.Add.SuccessfullyAdded", "You are now also a {element}."); config.addDefault("Commands.Add.PlayerNotFound", "That player could not be found."); config.addDefault("Commands.Add.InvalidElement", "You must specify a valid element."); diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterArms.java b/src/com/projectkorra/projectkorra/waterbending/WaterArms.java index 24b322c6..04ab1d6c 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterArms.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterArms.java @@ -140,7 +140,6 @@ public class WaterArms extends WaterAbility { remove(); return; } - displayBoundMsg(); } } @@ -419,8 +418,11 @@ public class WaterArms extends WaterAbility { return false; } - public void displayBoundMsg() { - player.sendMessage(getElement().getColor() + sneakMsg + " " + bPlayer.getBoundAbilityName()); + public void displayBoundMsg(int slot) { + String name = bPlayer.getAbilities().get(slot); + if(name != null) { + player.sendMessage(getElement().getColor() + sneakMsg + " " + name); + } } /** diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterArmsSpear.java b/src/com/projectkorra/projectkorra/waterbending/WaterArmsSpear.java index 07101f2c..37a568f7 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterArmsSpear.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterArmsSpear.java @@ -211,8 +211,7 @@ public class WaterArmsSpear extends WaterAbility { } private void createIceBall() { - layer++; - for (Block block : GeneralMethods.getBlocksAroundPoint(location, layer)) { + for (Block block : GeneralMethods.getBlocksAroundPoint(location, spearSphere)) { if (isTransparent(player, block) && block.getType() != Material.ICE && !WaterArms.isUnbreakable(block)) { playIcebendingSound(block.getLocation()); new TempBlock(block, Material.ICE, (byte) 0);