Fix deprecated calls (#1072)

Update some deprecated calls
## Fixes
* Fixes the server loading the legacy `Material` API when a player used `TremorSense`
## Changes
* Added boundaries to `Levelled` block data in `GeneralMethods::getWaterData` and `GeneralMethods::getLavaData` to avoid future bugs
This commit is contained in:
Moros 2020-07-21 21:57:07 +00:00 committed by GitHub
parent f42f8bf2c3
commit 10ac727eda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 60 additions and 86 deletions

View file

@ -1225,19 +1225,11 @@ public class GeneralMethods {
} }
public static BlockData getLavaData(final int level) { public static BlockData getLavaData(final int level) {
final BlockData data = Material.LAVA.createBlockData(); return Material.LAVA.createBlockData(d -> ((Levelled) d).setLevel((level < 0 || level > ((Levelled) d).getMaximumLevel()) ? 0 : level));
if (data instanceof Levelled) {
((Levelled) data).setLevel(level);
}
return data;
} }
public static BlockData getWaterData(final int level) { public static BlockData getWaterData(final int level) {
final BlockData data = Material.WATER.createBlockData(); return Material.WATER.createBlockData(d -> ((Levelled) d).setLevel((level < 0 || level > ((Levelled) d).getMaximumLevel()) ? 0 : level));
if (data instanceof Levelled) {
((Levelled) data).setLevel(level);
}
return data;
} }
public static Entity getTargetedEntity(final Player player, final double range, final List<Entity> avoid) { public static Entity getTargetedEntity(final Player player, final double range, final List<Entity> avoid) {

View file

@ -1,8 +1,5 @@
package com.projectkorra.projectkorra.earthbending; package com.projectkorra.projectkorra.earthbending;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -20,9 +17,6 @@ import com.projectkorra.projectkorra.attribute.Attribute;
public class Tremorsense extends EarthAbility { public class Tremorsense extends EarthAbility {
@Deprecated
private static final Map<Block, Player> BLOCKS = new ConcurrentHashMap<Block, Player>();
private byte lightThreshold; private byte lightThreshold;
@Attribute("Depth") @Attribute("Depth")
private int maxDepth; private int maxDepth;
@ -108,11 +102,11 @@ public class Tremorsense extends EarthAbility {
if (isBendable && this.block == null) { if (isBendable && this.block == null) {
this.block = standBlock; this.block = standBlock;
this.player.sendBlockChange(this.block.getLocation(), Material.GLOWSTONE, (byte) 1); this.player.sendBlockChange(this.block.getLocation(), Material.GLOWSTONE.createBlockData());
} else if (isBendable && !this.block.equals(standBlock)) { } else if (isBendable && !this.block.equals(standBlock)) {
this.revertGlowBlock(); this.revertGlowBlock();
this.block = standBlock; this.block = standBlock;
this.player.sendBlockChange(this.block.getLocation(), Material.GLOWSTONE, (byte) 1); this.player.sendBlockChange(this.block.getLocation(), Material.GLOWSTONE.createBlockData());
} else if (this.block == null) { } else if (this.block == null) {
return; return;
} else if (!this.player.getWorld().equals(this.block.getWorld())) { } else if (!this.player.getWorld().equals(this.block.getWorld())) {
@ -133,7 +127,7 @@ public class Tremorsense extends EarthAbility {
public void revertGlowBlock() { public void revertGlowBlock() {
if (this.block != null) { if (this.block != null) {
this.player.sendBlockChange(this.block.getLocation(), this.block.getType(), this.block.getData()); this.player.sendBlockChange(this.block.getLocation(), this.block.getBlockData());
} }
} }
@ -172,12 +166,6 @@ public class Tremorsense extends EarthAbility {
return false; return false;
} }
@Deprecated
/** No longer used; will be removed in the next version. */
public static Map<Block, Player> getBlocks() {
return BLOCKS;
}
@Override @Override
public String getName() { public String getName() {
return "Tremorsense"; return "Tremorsense";

View file

@ -415,7 +415,7 @@ public class LavaFlow extends LavaAbility {
block.setType(Material.LAVA); block.setType(Material.LAVA);
block.setBlockData(GeneralMethods.getLavaData(0)); block.setBlockData(GeneralMethods.getLavaData(0));
} else { } else {
tblock = new TempBlock(block, Material.LAVA, GeneralMethods.getLavaData(0)); tblock = new TempBlock(block, Material.LAVA);
} }
if (tblock != null) { if (tblock != null) {

View file

@ -215,7 +215,7 @@ public class LavaSurge extends LavaAbility {
playEarthbendingSound(b.getLocation()); playEarthbendingSound(b.getLocation());
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
final TempBlock tb = new TempBlock(b, Material.LAVA, GeneralMethods.getLavaData(0)); final TempBlock tb = new TempBlock(b, Material.LAVA);
this.fractureTempBlocks.add(tb); this.fractureTempBlocks.add(tb);
} }
} }

View file

@ -233,7 +233,7 @@ public class LavaSurgeWall extends LavaAbility {
} }
private void addWallBlock(final Block block) { private void addWallBlock(final Block block) {
new TempBlock(block, Material.LAVA, GeneralMethods.getLavaData(0)); new TempBlock(block, Material.LAVA);
} }
private void breakBlock() { private void breakBlock() {
@ -273,7 +273,7 @@ public class LavaSurgeWall extends LavaAbility {
return; return;
} }
if (!TempBlock.isTempBlock(block)) { if (!TempBlock.isTempBlock(block)) {
new TempBlock(block, Material.LAVA, GeneralMethods.getLavaData(0)); new TempBlock(block, Material.LAVA);
AFFECTED_BLOCKS.put(block, block); AFFECTED_BLOCKS.put(block, block);
} }
} }

View file

@ -253,7 +253,7 @@ public class LavaSurgeWave extends LavaAbility {
if (GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) { if (GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
return; return;
} else if (!TempBlock.isTempBlock(block)) { } else if (!TempBlock.isTempBlock(block)) {
new TempBlock(block, Material.LAVA, GeneralMethods.getLavaData(0)); new TempBlock(block, Material.LAVA);
this.waveBlocks.put(block, block); this.waveBlocks.put(block, block);
} }
} }

View file

@ -140,7 +140,7 @@ public class TorrentWave extends WaterAbility {
} }
if (isTransparent(this.player, block)) { if (isTransparent(this.player, block)) {
final TempBlock tempBlock = new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); final TempBlock tempBlock = new TempBlock(block, Material.WATER);
this.blocks.add(tempBlock); this.blocks.add(tempBlock);
torrentBlocks.add(block); torrentBlocks.add(block);
} else { } else {

View file

@ -311,9 +311,9 @@ public class WaterManipulation extends WaterAbility {
} }
if (this.trail != null) { if (this.trail != null) {
this.trail2 = this.trail; this.trail2 = this.trail;
this.trail2.setType(Material.WATER, GeneralMethods.getWaterData(6)); this.trail2.setType(GeneralMethods.getWaterData(6));
} }
this.trail = new TempBlock(this.sourceBlock, Material.WATER, GeneralMethods.getWaterData(7)); this.trail = new TempBlock(this.sourceBlock, GeneralMethods.getWaterData(7));
this.sourceBlock = block; this.sourceBlock = block;
if (this.location.distanceSquared(this.targetDestination) <= 1 || this.location.distanceSquared(this.firstDestination) > this.range * this.range) { if (this.location.distanceSquared(this.targetDestination) <= 1 || this.location.distanceSquared(this.firstDestination) > this.range * this.range) {
@ -366,7 +366,7 @@ public class WaterManipulation extends WaterAbility {
if (PhaseChange.getFrozenBlocksAsBlock().contains(block)) { if (PhaseChange.getFrozenBlocksAsBlock().contains(block)) {
PhaseChange.getFrozenBlocksAsBlock().remove(block); PhaseChange.getFrozenBlocksAsBlock().remove(block);
} }
new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); new TempBlock(block, Material.WATER);
} else { } else {
if (isWater(block) && !AFFECTED_BLOCKS.containsKey(block)) { if (isWater(block) && !AFFECTED_BLOCKS.containsKey(block)) {
ParticleEffect.WATER_BUBBLE.display(block.getLocation().clone().add(.5, .5, .5), 5, Math.random(), Math.random(), Math.random(), 0); ParticleEffect.WATER_BUBBLE.display(block.getLocation().clone().add(.5, .5, .5), 5, Math.random(), Math.random(), Math.random(), 0);
@ -500,7 +500,7 @@ public class WaterManipulation extends WaterAbility {
if (isTransparent(player, block) && isTransparent(player, eyeLoc.getBlock())) { if (isTransparent(player, block) && isTransparent(player, eyeLoc.getBlock())) {
if (getTargetLocation(player, range).distanceSquared(block.getLocation()) > 1) { if (getTargetLocation(player, range).distanceSquared(block.getLocation()) > 1) {
final TempBlock tb = new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); final TempBlock tb = new TempBlock(block, Material.WATER);
final WaterManipulation waterManip = new WaterManipulation(player, block); final WaterManipulation waterManip = new WaterManipulation(player, block);
waterManip.moveWater(); waterManip.moveWater();

View file

@ -111,7 +111,7 @@ public class WaterSpout extends WaterAbility {
final Block block = loc.getBlock(); final Block block = loc.getBlock();
if ((!TempBlock.isTempBlock(block)) && (ElementalAbility.isAir(block.getType()) || !GeneralMethods.isSolid(block))) { if ((!TempBlock.isTempBlock(block)) && (ElementalAbility.isAir(block.getType()) || !GeneralMethods.isSolid(block))) {
this.blocks.add(new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(7))); this.blocks.add(new TempBlock(block, GeneralMethods.getWaterData(7)));
AFFECTED_BLOCKS.put(block, block); AFFECTED_BLOCKS.put(block, block);
} }
} }
@ -157,7 +157,7 @@ public class WaterSpout extends WaterAbility {
block = location.clone().add(0, i, 0).getBlock(); block = location.clone().add(0, i, 0).getBlock();
if (!TempBlock.isTempBlock(block)) { if (!TempBlock.isTempBlock(block)) {
this.blocks.add(new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0))); this.blocks.add(new TempBlock(block, Material.WATER));
AFFECTED_BLOCKS.put(block, block); AFFECTED_BLOCKS.put(block, block);
} }
this.rotateParticles(block); this.rotateParticles(block);
@ -286,7 +286,7 @@ public class WaterSpout extends WaterAbility {
if (!TempBlock.isTempBlock(blocki)) { if (!TempBlock.isTempBlock(blocki)) {
this.revertBaseBlock(); this.revertBaseBlock();
this.baseBlock = new TempBlock(blocki, Material.WATER, GeneralMethods.getWaterData(0)); this.baseBlock = new TempBlock(blocki, Material.WATER);
} }
this.base = blocki; this.base = blocki;

View file

@ -11,7 +11,6 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -305,7 +304,7 @@ public class WaterSpoutWave extends WaterAbility {
for (final Block block : GeneralMethods.getBlocksAroundPoint(this.player.getLocation().add(0, -1, 0), this.waveRadius)) { for (final Block block : GeneralMethods.getBlocksAroundPoint(this.player.getLocation().add(0, -1, 0), this.waveRadius)) {
if (ElementalAbility.isAir(block.getType()) && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) { if (ElementalAbility.isAir(block.getType()) && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
if (this.iceWave) { if (this.iceWave) {
this.createBlockDelay(block, Material.ICE, Material.ICE.createBlockData(), 2L); this.createBlockDelay(block, Material.ICE, 2L);
} else { } else {
this.createBlock(block, Material.WATER); this.createBlock(block, Material.WATER);
} }
@ -369,11 +368,11 @@ public class WaterSpoutWave extends WaterAbility {
} }
} }
public void createBlockDelay(final Block block, final Material mat, final BlockData data, final long delay) { public void createBlockDelay(final Block block, final Material mat, final long delay) {
final BukkitRunnable br = new BukkitRunnable() { final BukkitRunnable br = new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
WaterSpoutWave.this.createBlock(block, mat, data); WaterSpoutWave.this.createBlock(block, mat);
} }
}; };
br.runTaskLater(ProjectKorra.plugin, delay); br.runTaskLater(ProjectKorra.plugin, delay);
@ -381,11 +380,7 @@ public class WaterSpoutWave extends WaterAbility {
} }
public void createBlock(final Block block, final Material mat) { public void createBlock(final Block block, final Material mat) {
this.createBlock(block, mat, mat.createBlockData()); this.affectedBlocks.put(block, new TempBlock(block, mat));
}
public void createBlock(final Block block, final Material mat, final BlockData data) {
this.affectedBlocks.put(block, new TempBlock(block, mat, data));
} }
public void revertBlocks() { public void revertBlocks() {

View file

@ -196,7 +196,7 @@ public class IceBullet extends IceAbility implements ComboAbility {
} }
public void createBlock(final Block block, final Material mat, final BlockData data) { public void createBlock(final Block block, final Material mat, final BlockData data) {
this.affectedBlocks.put(block, new TempBlock(block, mat, data)); this.affectedBlocks.put(block, new TempBlock(block, data));
} }
public void drawWaterCircle(final Location loc, final double theta, final double increment, final double radius) { public void drawWaterCircle(final Location loc, final double theta, final double increment, final double radius) {

View file

@ -182,7 +182,7 @@ public class HealingWaters extends HealingAbility {
} }
private void giveHP(final Player player) { private void giveHP(final Player player) {
if (!player.isDead() && player.getHealth() < player.getMaxHealth()) { if (!player.isDead() && player.getHealth() < player.getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue()) {
this.applyHealing(player); this.applyHealing(player);
} else { } else {
this.healing = false; this.healing = false;
@ -199,7 +199,7 @@ public class HealingWaters extends HealingAbility {
} }
private void giveHP(final LivingEntity livingEntity) { private void giveHP(final LivingEntity livingEntity) {
if (!livingEntity.isDead() && livingEntity.getHealth() < livingEntity.getMaxHealth()) { if (!livingEntity.isDead() && livingEntity.getHealth() < livingEntity.getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue()) {
this.applyHealing(livingEntity); this.applyHealing(livingEntity);
} else { } else {
this.healing = false; this.healing = false;
@ -222,7 +222,7 @@ public class HealingWaters extends HealingAbility {
} }
private void applyHealing(final LivingEntity livingEntity) { private void applyHealing(final LivingEntity livingEntity) {
if (livingEntity.getHealth() < livingEntity.getMaxHealth()) { if (livingEntity.getHealth() < livingEntity.getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue()) {
livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30, this.potionPotency)); livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30, this.potionPotency));
AirAbility.breakBreathbendingHold(livingEntity); AirAbility.breakBreathbendingHold(livingEntity);
this.healing = true; this.healing = true;

View file

@ -379,11 +379,10 @@ public class PhaseChange extends IceAbility {
final Snow snow = (Snow) b.getBlockData(); final Snow snow = (Snow) b.getBlockData();
if (snow.getLayers() == snow.getMinimumLayers()) { if (snow.getLayers() == snow.getMinimumLayers()) {
tb.revertBlock(); tb.revertBlock();
new TempBlock(b, Material.AIR).setRevertTime(120 * 1000L); new TempBlock(b, Material.AIR.createBlockData(), 120 * 1000L);
} else { } else {
tb.revertBlock(); tb.revertBlock();
snow.setLayers(snow.getLayers() - 1); new TempBlock(b, Material.SNOW.createBlockData(d -> ((Snow) d).setLayers(snow.getLayers() - 1)), 120 * 1000L);
new TempBlock(b, Material.SNOW, snow).setRevertTime(120 * 1000L);
} }
} }
} }
@ -398,17 +397,17 @@ public class PhaseChange extends IceAbility {
b.setType(Material.WATER); b.setType(Material.WATER);
b.setBlockData(GeneralMethods.getWaterData(0)); b.setBlockData(GeneralMethods.getWaterData(0));
} else { } else {
new TempBlock(b, Material.WATER, GeneralMethods.getWaterData(0)); new TempBlock(b, Material.WATER);
} }
this.melted_blocks.add(b); this.melted_blocks.add(b);
} else if (b.getType() == Material.SNOW_BLOCK || b.getType() == Material.SNOW) { } else if (b.getType() == Material.SNOW_BLOCK || b.getType() == Material.SNOW) {
if (b.getBlockData() instanceof Snow) { if (b.getBlockData() instanceof Snow) {
final Snow snow = (Snow) b.getBlockData(); final Snow snow = (Snow) b.getBlockData();
if (snow.getLayers() == snow.getMinimumLayers()) { if (snow.getLayers() == snow.getMinimumLayers()) {
new TempBlock(b, Material.AIR).setRevertTime(120 * 1000L); new TempBlock(b, Material.AIR.createBlockData(), 120 * 1000L);
} else { } else {
snow.setLayers(snow.getLayers() - 1); snow.setLayers(snow.getLayers() - 1);
new TempBlock(b, Material.SNOW, snow).setRevertTime(120 * 1000L); new TempBlock(b, Material.SNOW.createBlockData(d -> ((Snow) d).setLayers(snow.getLayers() - 1)), 120 * 1000L);
} }
} }

View file

@ -233,7 +233,7 @@ public class WaterArms extends WaterAbility {
} }
if (!(this.getRightHandPos().getBlock().getLocation().equals(r1.getBlock().getLocation()))) { if (!(this.getRightHandPos().getBlock().getLocation().equals(r1.getBlock().getLocation()))) {
this.addBlock(r1.getBlock(), Material.WATER, GeneralMethods.getWaterData(3), 100); this.addBlock(r1.getBlock(), GeneralMethods.getWaterData(3), 100);
newBlocks.add(r1.getBlock()); newBlocks.add(r1.getBlock());
} }
@ -244,7 +244,7 @@ public class WaterArms extends WaterAbility {
return false; return false;
} }
this.addBlock(r2.getBlock(), Material.WATER, GeneralMethods.getWaterData(0), 100); this.addBlock(r2.getBlock(), Material.WATER.createBlockData(), 100);
newBlocks.add(r2.getBlock()); newBlocks.add(r2.getBlock());
for (int j = 1; j <= this.initLength; j++) { for (int j = 1; j <= this.initLength; j++) {
@ -257,9 +257,9 @@ public class WaterArms extends WaterAbility {
newBlocks.add(r3.getBlock()); newBlocks.add(r3.getBlock());
if (j >= 1 && this.selectedSlot == this.freezeSlot && this.bPlayer.canIcebend()) { if (j >= 1 && this.selectedSlot == this.freezeSlot && this.bPlayer.canIcebend()) {
this.addBlock(r3.getBlock(), Material.ICE, Material.ICE.createBlockData(), 100); this.addBlock(r3.getBlock(), Material.ICE.createBlockData(), 100);
} else { } else {
this.addBlock(r3.getBlock(), Material.WATER, GeneralMethods.getWaterData(0), 100); this.addBlock(r3.getBlock(), Material.WATER.createBlockData(), 100);
} }
} }
@ -288,7 +288,7 @@ public class WaterArms extends WaterAbility {
} }
if (!(this.getLeftHandPos().getBlock().getLocation().equals(l1.getBlock().getLocation()))) { if (!(this.getLeftHandPos().getBlock().getLocation().equals(l1.getBlock().getLocation()))) {
this.addBlock(l1.getBlock(), Material.WATER, GeneralMethods.getWaterData(3), 100); this.addBlock(l1.getBlock(), GeneralMethods.getWaterData(3), 100);
newBlocks.add(l1.getBlock()); newBlocks.add(l1.getBlock());
} }
@ -299,7 +299,7 @@ public class WaterArms extends WaterAbility {
return false; return false;
} }
this.addBlock(l2.getBlock(), Material.WATER, GeneralMethods.getWaterData(0), 100); this.addBlock(l2.getBlock(), Material.WATER.createBlockData(), 100);
newBlocks.add(l2.getBlock()); newBlocks.add(l2.getBlock());
for (int j = 1; j <= this.initLength; j++) { for (int j = 1; j <= this.initLength; j++) {
@ -312,9 +312,9 @@ public class WaterArms extends WaterAbility {
newBlocks.add(l3.getBlock()); newBlocks.add(l3.getBlock());
if (j >= 1 && this.selectedSlot == this.freezeSlot && this.bPlayer.canIcebend()) { if (j >= 1 && this.selectedSlot == this.freezeSlot && this.bPlayer.canIcebend()) {
this.addBlock(l3.getBlock(), Material.ICE, Material.ICE.createBlockData(), 100); this.addBlock(l3.getBlock(), Material.ICE.createBlockData(), 100);
} else { } else {
this.addBlock(l3.getBlock(), Material.WATER, GeneralMethods.getWaterData(0), 100); this.addBlock(l3.getBlock(), Material.WATER.createBlockData(), 100);
} }
} }
@ -324,18 +324,18 @@ public class WaterArms extends WaterAbility {
return true; return true;
} }
public void addBlock(final Block b, final Material m, final BlockData data, final long revertTime) { public void addBlock(final Block b, final BlockData data, final long revertTime) {
if (TempBlock.isTempBlock(b)) { if (TempBlock.isTempBlock(b)) {
final TempBlock tb = TempBlock.get(b); final TempBlock tb = TempBlock.get(b);
if (this.right.contains(b) || this.left.contains(b)) { if (this.right.contains(b) || this.left.contains(b)) {
tb.setType(m, data); tb.setType(data);
tb.setRevertTime(revertTime); tb.setRevertTime(revertTime);
} else { } else {
this.external.add(tb); this.external.add(tb);
} }
} else { } else {
new TempBlock(b, m, data).setRevertTime(revertTime); new TempBlock(b, data, revertTime);
} }
} }

View file

@ -262,7 +262,7 @@ public class WaterArmsWhip extends WaterAbility {
final int j = (int) Math.ceil(8 / (Math.pow(i, 1 / 3))); final int j = (int) Math.ceil(8 / (Math.pow(i, 1 / 3)));
this.waterArms.addToArm(l2.getBlock(), this.arm); this.waterArms.addToArm(l2.getBlock(), this.arm);
this.waterArms.addBlock(l2.getBlock(), Material.WATER, GeneralMethods.getWaterData(j), 40); this.waterArms.addBlock(l2.getBlock(), GeneralMethods.getWaterData(j), 40);
if (i == this.activeLength) { if (i == this.activeLength) {
this.end = l2.clone(); this.end = l2.clone();
@ -282,7 +282,7 @@ public class WaterArmsWhip extends WaterAbility {
} }
this.waterArms.addToArm(this.end.getBlock(), this.arm); this.waterArms.addToArm(this.end.getBlock(), this.arm);
this.waterArms.addBlock(this.end.getBlock(), Material.WATER, GeneralMethods.getWaterData(5), 40); this.waterArms.addBlock(this.end.getBlock(), GeneralMethods.getWaterData(5), 40);
this.performAction(this.end); this.performAction(this.end);
} else { } else {
this.performAction(l2); this.performAction(l2);

View file

@ -44,7 +44,7 @@ public class WaterReturn extends WaterAbility {
if (this.bPlayer.canBendIgnoreBindsCooldowns(this)) { if (this.bPlayer.canBendIgnoreBindsCooldowns(this)) {
if (isTransparent(player, block) && ((TempBlock.isTempBlock(block) && block.isLiquid()) || !block.isLiquid()) && this.hasEmptyWaterBottle()) { if (isTransparent(player, block) && ((TempBlock.isTempBlock(block) && block.isLiquid()) || !block.isLiquid()) && this.hasEmptyWaterBottle()) {
this.block = new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); this.block = new TempBlock(block, Material.WATER);
} }
} }
this.start(); this.start();
@ -84,7 +84,7 @@ public class WaterReturn extends WaterAbility {
final Block newblock = this.location.getBlock(); final Block newblock = this.location.getBlock();
if (isTransparent(this.player, newblock) && !newblock.isLiquid()) { if (isTransparent(this.player, newblock) && !newblock.isLiquid()) {
this.block.revertBlock(); this.block.revertBlock();
this.block = new TempBlock(newblock, Material.WATER, GeneralMethods.getWaterData(0)); this.block = new TempBlock(newblock, Material.WATER);
} else if (isTransparent(this.player, newblock)) { } else if (isTransparent(this.player, newblock)) {
if (isWater(newblock)) { if (isWater(newblock)) {
ParticleEffect.WATER_BUBBLE.display(newblock.getLocation().clone().add(.5, .5, .5), 5, Math.random(), Math.random(), Math.random(), 0); ParticleEffect.WATER_BUBBLE.display(newblock.getLocation().clone().add(.5, .5, .5), 5, Math.random(), Math.random(), Math.random(), 0);

View file

@ -43,7 +43,7 @@ public class WaterSourceGrabber {
this.player = player; this.player = player;
this.animimationSpeed = animationSpeed; this.animimationSpeed = animationSpeed;
this.material = Material.WATER; this.material = Material.WATER;
this.data = GeneralMethods.getWaterData(0); this.data = Material.WATER.createBlockData();
this.currentLoc = origin.clone(); this.currentLoc = origin.clone();
this.state = AnimationState.RISING; this.state = AnimationState.RISING;
this.affectedBlocks = new ConcurrentHashMap<>(); this.affectedBlocks = new ConcurrentHashMap<>();
@ -63,7 +63,7 @@ public class WaterSourceGrabber {
return; return;
} }
this.createBlock(block, this.material, this.data); this.createBlock(block, this.data);
if (Math.abs(locDiff) < 1) { if (Math.abs(locDiff) < 1) {
this.state = AnimationState.TOWARD; this.state = AnimationState.TOWARD;
} }
@ -80,7 +80,7 @@ public class WaterSourceGrabber {
return; return;
} }
this.createBlock(block, this.material, this.data); this.createBlock(block, this.data);
if (this.currentLoc.distanceSquared(eyeLoc) < 1.2) { if (this.currentLoc.distanceSquared(eyeLoc) < 1.2) {
this.state = AnimationState.FINISHED; this.state = AnimationState.FINISHED;
this.revertBlocks(); this.revertBlocks();
@ -106,11 +106,11 @@ public class WaterSourceGrabber {
} }
public void createBlock(final Block block, final Material mat) { public void createBlock(final Block block, final Material mat) {
this.createBlock(block, mat, mat.createBlockData()); this.createBlock(block, mat.createBlockData());
} }
public void createBlock(final Block block, final Material mat, final BlockData data) { public void createBlock(final Block block, final BlockData data) {
this.affectedBlocks.put(block, new TempBlock(block, mat, data)); this.affectedBlocks.put(block, new TempBlock(block, data));
} }
public Player getPlayer() { public Player getPlayer() {