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();
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private void fill() {
for (StockAbility a : StockAbility.values()) {

View file

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

View file

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

View file

@ -109,6 +109,7 @@ public class EarthBlast {
unfocusBlock();
}
@SuppressWarnings("deprecation")
private void focusBlock() {
if (EarthPassive.isPassiveSand(sourceblock))
EarthPassive.revertSand(sourceblock);
@ -130,6 +131,7 @@ public class EarthBlast {
location = sourceblock.getLocation();
}
@SuppressWarnings("deprecation")
private void unfocusBlock() {
if(destination != null){
breakBlock();
@ -204,6 +206,7 @@ public class EarthBlast {
}
}
@SuppressWarnings("deprecation")
private boolean progress() {
if (player.isDead() || !player.isOnline()
|| !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 int sandspeed = ProjectKorra.plugin.getConfig().getInt("Properties.Earth.Passive.SandRunPower");
@SuppressWarnings("deprecation")
public static boolean softenLanding(Player player) {
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
if (EarthMethods.canMetalbend(player) && EarthMethods.isMetalBlock(block)) {
@ -80,6 +81,7 @@ public class EarthPassive {
return (sandblocks.containsKey(block));
}
@SuppressWarnings("deprecation")
public static void revertSand(Block block) {
MaterialData materialdata = sandidentities.get(block);
sandidentities.remove(block);

View file

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

View file

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

View file

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

View file

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