crash fix (#994)

## Fixes
* Server crash with AirSwipe (or any move that can cause high velocity) on falling blocks or tnt
* Error with PhaseChange if you switch worlds while using
* Server crash with EarthGrab when used over void
This commit is contained in:
Josh 2019-08-01 15:47:44 -04:00 committed by Christopher Martin
parent a174664ecf
commit a57e599e62
4 changed files with 11 additions and 11 deletions

View file

@ -2128,15 +2128,12 @@ public class GeneralMethods {
public static void setVelocity(final Entity entity, final Vector velocity) {
if (entity instanceof TNTPrimed) {
if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingAffectFallingSand.TNT")) {
entity.setVelocity(velocity.multiply(ConfigManager.defaultConfig.get().getDouble("Properties.BendingAffectFallingSand.TNTStrengthMultiplier")));
velocity.multiply(ConfigManager.defaultConfig.get().getDouble("Properties.BendingAffectFallingSand.TNTStrengthMultiplier"));
}
return;
}
if (entity instanceof FallingBlock) {
} else if (entity instanceof FallingBlock) {
if (ConfigManager.defaultConfig.get().getBoolean("Properties.BendingAffectFallingSand.Normal")) {
entity.setVelocity(velocity.multiply(ConfigManager.defaultConfig.get().getDouble("Properties.BendingAffectFallingSand.NormalStrengthMultiplier")));
velocity.multiply(ConfigManager.defaultConfig.get().getDouble("Properties.BendingAffectFallingSand.NormalStrengthMultiplier"));
}
return;
}
// Attempt to stop velocity from going over the packet cap.

View file

@ -151,9 +151,11 @@ public class EarthGrab extends EarthAbility {
top.setType(Material.AIR);
}
while (!this.isEarthbendable(top)) {
if (this.isTransparent(top)) {
top = top.getRelative(BlockFace.DOWN);
if (!this.isEarthbendable(top)) {
Block under = top.getRelative(BlockFace.DOWN);
if (this.isTransparent(top) && this.isEarthbendable(under)) {
top = under;
} else {
this.remove();
return;

View file

@ -9,10 +9,11 @@ import com.projectkorra.projectkorra.ProjectKorra;
public class WorldGuardFlag {
public static void registerBendingWorldGuardFlag() {
final FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
try {
registry.register(new StateFlag("bending", false));
} catch (final Exception e) {
ProjectKorra.log.severe("Unable to register bending WorldGuard Flag");
ProjectKorra.log.severe("Unable to register bending WorldGuard flag: " + e);
}
}
}

View file

@ -194,7 +194,7 @@ public class PhaseChange extends IceAbility {
return;
}
if (this.meltLoc.distance(loc) < 1) {
if (this.meltLoc.getWorld().equals(loc.getWorld()) && this.meltLoc.distance(loc) < 1) {
return;
}