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()))
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

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

View file

@ -348,10 +348,12 @@ public class SurgeWave extends WaterAbility {
super.remove();
thaw();
returnWater();
if (waveBlocks != null) {
for (Block block : waveBlocks.keySet()) {
finalRemoveWater(block);
}
}
}
public void returnWater() {
if (location != null && player.isOnline()) {
@ -360,11 +362,13 @@ public class SurgeWave extends WaterAbility {
}
private void thaw() {
if (frozenBlocks != null) {
for (Block block : frozenBlocks.keySet()) {
TempBlock.revertBlock(block, frozenBlocks.get(block));
frozenBlocks.remove(block);
}
}
}
public static boolean canThaw(Block block) {
for (SurgeWave surgeWave : getAbilities(SurgeWave.class)) {

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);