Various Fixes (#626)

* Various Fixes
This commit is contained in:
Christopher Martin 2016-10-18 16:29:42 -07:00 committed by GitHub
parent 030a241a60
commit a43c965e5b
7 changed files with 42 additions and 12 deletions

View file

@ -1136,7 +1136,7 @@ public class GeneralMethods {
}
public static boolean isAdjacentToThreeOrMoreSources(Block block) {
if (TempBlock.isTempBlock(block)) {
if (TempBlock.isTempBlock(block) || block.equals(null)) {
return false;
}
int sources = 0;
@ -1828,6 +1828,26 @@ public class GeneralMethods {
}
return;
}
// Attempt to stop velocity from going over the packet cap.
if(velocity.getX() > 4){
velocity.setX(4);
} else if(velocity.getX() < -4){
velocity.setX(-4);
}
if(velocity.getY() > 4){
velocity.setY(4);
} else if(velocity.getY() < -4){
velocity.setY(-4);
}
if(velocity.getZ() > 4){
velocity.setZ(4);
} else if(velocity.getZ() < -4){
velocity.setZ(-4);
}
entity.setVelocity(velocity);
}

View file

@ -984,7 +984,7 @@ public class PKListener implements Listener {
event.setCancelled(true);
}
if (bPlayer.getBoundAbilityName().equalsIgnoreCase("HealingWaters")) {
if (bPlayer.getBoundAbilityName().equalsIgnoreCase("HealingWaters") && event.getHand().equals(EquipmentSlot.HAND)) {
HealingWaters instance = CoreAbility.getAbility(player, HealingWaters.class);
if(instance != null && instance.charged) {
instance.click();
@ -1069,9 +1069,10 @@ public class PKListener implements Listener {
double distance1 = 0;
double distance2 = 0;
Location loc = Bloodbending.getBloodbendingLocation(player);
if (event.getPlayer().getWorld().equals(loc.getWorld()))
distance1 = event.getFrom().distance(loc);
distance2 = event.getTo().distance(loc);
if (event.getPlayer().getWorld().equals(loc.getWorld())) {
distance1 = event.getFrom().distance(loc);
distance2 = event.getTo().distance(loc);
}
if (distance2 > distance1) {
player.setVelocity(new Vector(0, 0, 0));
}

View file

@ -81,6 +81,7 @@ public class AirFlight extends FlightAbility {
if (!HOVERING.containsKey(playername)) {
HOVERING.put(playername, new PlayerFlyData(player.getAllowFlight(), player.isFlying()));
player.setVelocity(new Vector(0, 0, 0));
player.setAllowFlight(true);
player.setFlying(true);
}
} else {

View file

@ -56,7 +56,7 @@ public class EarthGrab extends EarthAbility {
} else {
Location targetLocation = GeneralMethods.getTargetedLocation(player, 1);
Block block = GeneralMethods.getTopBlock(targetLocation, 1, 1);
if(isEarthbendable(block) && block.getWorld().equals(player.getLocation()) && block.getLocation().distance(player.getLocation()) <= 1.3) {
if(isEarthbendable(block) && block.getWorld().equals(player.getWorld()) && block.getLocation().distance(player.getLocation()) <= 1.6) {
earthGrabSelf();
remove();
}

View file

@ -58,6 +58,10 @@ public class LogFilter implements Filter {
// Logged records contains record
return false;
}
if(Bukkit.getServer().getPluginManager().isPluginEnabled(ProjectKorra.plugin.getName())) {
return false;
}
final String toRecord = recordString;
Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, new Runnable() {

View file

@ -348,8 +348,10 @@ public class SurgeWave extends WaterAbility {
super.remove();
thaw();
returnWater();
for (Block block : waveBlocks.keySet()) {
finalRemoveWater(block);
if (waveBlocks != null) {
for (Block block : waveBlocks.keySet()) {
finalRemoveWater(block);
}
}
}
@ -360,9 +362,11 @@ public class SurgeWave extends WaterAbility {
}
private void thaw() {
for (Block block : frozenBlocks.keySet()) {
TempBlock.revertBlock(block, frozenBlocks.get(block));
frozenBlocks.remove(block);
if (frozenBlocks != null) {
for (Block block : frozenBlocks.keySet()) {
TempBlock.revertBlock(block, frozenBlocks.get(block));
frozenBlocks.remove(block);
}
}
}

View file

@ -222,7 +222,7 @@ public class Torrent extends WaterAbility {
double dy = 0;
double dz = Math.sin(phi) * radius;
loc.add(dx, dy, dz);
if(GeneralMethods.isAdjacentToThreeOrMoreSources(loc.getBlock())) {
if(isWater(loc.getBlock()) && GeneralMethods.isAdjacentToThreeOrMoreSources(loc.getBlock())) {
ParticleEffect.WATER_BUBBLE.display((float) Math.random(), (float) Math.random(), (float) Math.random(), 0f, 5, loc.getBlock().getLocation().clone().add(.5,.5,.5), 255.0);
}
loc.subtract(dx, dy, dz);