Fix WaterSpout Bugs

• Fixes WaterSpout not working over packed ice
• Fixes WaterWave exception when teleporting across worlds
• Fixes compile warnings (they were annoying me!)
This commit is contained in:
StrangeOne101 2015-10-18 11:48:05 +13:00
parent 012b355be7
commit f902a8ac7c
9 changed files with 18 additions and 10 deletions

View file

@ -87,6 +87,7 @@ public class AbilityModuleManager {
fill(); fill();
} }
@SuppressWarnings({ "unchecked", "rawtypes" })
private void fill() { private void fill() {
for (StockAbility a : StockAbility.values()) { for (StockAbility a : StockAbility.values()) {

View file

@ -31,7 +31,7 @@ public class ChiCombo {
*/ */
public static Map<Entity, Long> paralyzedEntities = new HashMap<Entity, Long>(); public static Map<Entity, Long> paralyzedEntities = new HashMap<Entity, Long>();
private Player player; //private Player player;
private Entity target; private Entity target;
public ChiCombo(Player player, String ability) { public ChiCombo(Player player, String ability) {
@ -41,7 +41,7 @@ public class ChiCombo {
if (!GeneralMethods.canBend(player.getName(), "Immobilize") || GeneralMethods.getBendingPlayer(player).isOnCooldown("Immobilize")) if (!GeneralMethods.canBend(player.getName(), "Immobilize") || GeneralMethods.getBendingPlayer(player).isOnCooldown("Immobilize"))
return; return;
else { else {
this.player = player; //this.player = player;
target = GeneralMethods.getTargetedEntity(player, 5, new ArrayList<Entity>()); target = GeneralMethods.getTargetedEntity(player, 5, new ArrayList<Entity>());
paralyze(target, IMMOBILIZE_DURATION); paralyze(target, IMMOBILIZE_DURATION);
instances.add(this); instances.add(this);

View file

@ -54,6 +54,7 @@ public class ImportCommand extends PKCommand {
if (string.equalsIgnoreCase("version")) if (string.equalsIgnoreCase("version"))
continue; continue;
String playername = string; String playername = string;
@SuppressWarnings("deprecation")
UUID uuid = ProjectKorra.plugin.getServer().getOfflinePlayer(playername).getUniqueId(); UUID uuid = ProjectKorra.plugin.getServer().getOfflinePlayer(playername).getUniqueId();
ArrayList<Element> element = new ArrayList<Element>(); ArrayList<Element> element = new ArrayList<Element>();
List<Integer> oe = bendingPlayers.getIntegerList(string + ".BendingTypes"); List<Integer> oe = bendingPlayers.getIntegerList(string + ".BendingTypes");

View file

@ -109,6 +109,7 @@ public class EarthBlast {
unfocusBlock(); unfocusBlock();
} }
@SuppressWarnings("deprecation")
private void focusBlock() { private void focusBlock() {
if (EarthPassive.isPassiveSand(sourceblock)) if (EarthPassive.isPassiveSand(sourceblock))
EarthPassive.revertSand(sourceblock); EarthPassive.revertSand(sourceblock);
@ -130,6 +131,7 @@ public class EarthBlast {
location = sourceblock.getLocation(); location = sourceblock.getLocation();
} }
@SuppressWarnings("deprecation")
private void unfocusBlock() { private void unfocusBlock() {
if(destination != null){ if(destination != null){
breakBlock(); breakBlock();
@ -204,6 +206,7 @@ public class EarthBlast {
} }
} }
@SuppressWarnings("deprecation")
private boolean progress() { private boolean progress() {
if (player.isDead() || !player.isOnline() if (player.isDead() || !player.isOnline()
|| !GeneralMethods.canBend(player.getName(), "EarthBlast")) { || !GeneralMethods.canBend(player.getName(), "EarthBlast")) {

View file

@ -26,6 +26,7 @@ public class EarthPassive {
private static final long duration = ProjectKorra.plugin.getConfig().getLong("Abilities.Earth.Passive.Duration"); private static final long duration = ProjectKorra.plugin.getConfig().getLong("Abilities.Earth.Passive.Duration");
private static int sandspeed = ProjectKorra.plugin.getConfig().getInt("Properties.Earth.Passive.SandRunPower"); private static int sandspeed = ProjectKorra.plugin.getConfig().getInt("Properties.Earth.Passive.SandRunPower");
@SuppressWarnings("deprecation")
public static boolean softenLanding(Player player) { public static boolean softenLanding(Player player) {
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN); Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
if (EarthMethods.canMetalbend(player) && EarthMethods.isMetalBlock(block)) { if (EarthMethods.canMetalbend(player) && EarthMethods.isMetalBlock(block)) {
@ -80,6 +81,7 @@ public class EarthPassive {
return (sandblocks.containsKey(block)); return (sandblocks.containsKey(block));
} }
@SuppressWarnings("deprecation")
public static void revertSand(Block block) { public static void revertSand(Block block) {
MaterialData materialdata = sandidentities.get(block); MaterialData materialdata = sandidentities.get(block);
sandidentities.remove(block); sandidentities.remove(block);

View file

@ -1,7 +1,6 @@
package com.projectkorra.projectkorra.waterbending; package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.AvatarState; import com.projectkorra.projectkorra.ability.AvatarState;

View file

@ -31,7 +31,6 @@ public class WaterPassive {
return false; return false;
} }
@SuppressWarnings("deprecation")
public static void handlePassive() { public static void handlePassive() {
for (Player player : Bukkit.getServer().getOnlinePlayers()) { for (Player player : Bukkit.getServer().getOnlinePlayers()) {
String ability = GeneralMethods.getBoundAbility(player); String ability = GeneralMethods.getBoundAbility(player);

View file

@ -41,6 +41,7 @@ public class WaterSpout {
private long interval = 50; private long interval = 50;
private int angle = 0; private int angle = 0;
private double rotation; private double rotation;
private boolean canBendOnPackedIce = false;
public WaterSpout(Player player) { public WaterSpout(Player player) {
// if (BendingPlayer.getBendingPlayer(player).isOnCooldown( // if (BendingPlayer.getBendingPlayer(player).isOnCooldown(
@ -52,6 +53,7 @@ public class WaterSpout {
return; return;
} }
this.player = player; this.player = player;
this.canBendOnPackedIce = ProjectKorra.plugin.getConfig().getBoolean("Properties.Water.CanBendPackedIce");
WaterWave wwave = new WaterWave(player, WaterWave.AbilityType.CLICK); WaterWave wwave = new WaterWave(player, WaterWave.AbilityType.CLICK);
if (WaterWave.instances.contains(wwave)) if (WaterWave.instances.contains(wwave))
@ -63,11 +65,13 @@ public class WaterSpout {
Material mat = topBlock.getType(); Material mat = topBlock.getType();
if (mat != Material.WATER && mat != Material.STATIONARY_WATER && mat != Material.ICE && mat != Material.PACKED_ICE && mat != Material.SNOW && mat != Material.SNOW_BLOCK) if (mat != Material.WATER && mat != Material.STATIONARY_WATER && mat != Material.ICE && mat != Material.PACKED_ICE && mat != Material.SNOW && mat != Material.SNOW_BLOCK)
return; return;
if (mat == Material.PACKED_ICE && !canBendOnPackedIce)
return;
new Flight(player); new Flight(player);
player.setAllowFlight(true); player.setAllowFlight(true);
instances.put(player, this); instances.put(player, this);
spout(player); spout(player);
} }
private void remove() { private void remove() {
@ -240,7 +244,7 @@ public class WaterSpout {
return height; return height;
return i; return i;
} }
if (blocki.getType() == Material.ICE || blocki.getType() == Material.SNOW || blocki.getType() == Material.SNOW_BLOCK) { if (blocki.getType() == Material.ICE || blocki.getType() == Material.SNOW || blocki.getType() == Material.SNOW_BLOCK || (blocki.getType() == Material.PACKED_ICE && spout.canBendOnPackedIce)) {
if (!TempBlock.isTempBlock(blocki)) { if (!TempBlock.isTempBlock(blocki)) {
revertBaseBlock(player); revertBaseBlock(player);
instances.get(player).baseblock = new TempBlock(blocki, Material.STATIONARY_WATER, (byte) 8); instances.get(player).baseblock = new TempBlock(blocki, Material.STATIONARY_WATER, (byte) 8);

View file

@ -9,7 +9,6 @@ import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -83,7 +82,7 @@ public class WaterWave {
public void progress() { public void progress() {
progressCounter++; progressCounter++;
if (player.isDead() || !player.isOnline()) { if (player.isDead() || !player.isOnline() || !origin.getWorld().equals(player.getWorld())) {
remove(); remove();
return; return;
} }