mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-25 12:05:14 +01:00
Hopefully Fixed an NPE...
This commit is contained in:
parent
4053937019
commit
130c51c366
@ -62,7 +62,7 @@ public class MVEntityListener extends EntityListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defender instanceof Player){
|
if (defender instanceof Player && attacker instanceof Player){
|
||||||
if (!(this.plugin.worlds.get(w.getName()).pvp)) {
|
if (!(this.plugin.worlds.get(w.getName()).pvp)) {
|
||||||
this.plugin.playerSessions.get(((Player) attacker)).message(ChatColor.RED + "PVP is disabled in this World.");
|
this.plugin.playerSessions.get(((Player) attacker)).message(ChatColor.RED + "PVP is disabled in this World.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -32,7 +32,7 @@ public class MVTeleport {
|
|||||||
double x, y, z;
|
double x, y, z;
|
||||||
if(location==null){
|
if(location==null){
|
||||||
location = player.getLocation();
|
location = player.getLocation();
|
||||||
|
|
||||||
double srcComp = plugin.worlds.get(player.getWorld().getName()).compression;
|
double srcComp = plugin.worlds.get(player.getWorld().getName()).compression;
|
||||||
double trgComp = plugin.worlds.get(world.getName()).compression;
|
double trgComp = plugin.worlds.get(world.getName()).compression;
|
||||||
|
|
||||||
@ -40,9 +40,9 @@ public class MVTeleport {
|
|||||||
|
|
||||||
// If the Targets Compression is 0 then we teleport them to the Spawn of the World.
|
// If the Targets Compression is 0 then we teleport them to the Spawn of the World.
|
||||||
if(trgComp==0.0){
|
if(trgComp==0.0){
|
||||||
x = world.getSpawnLocation().getX();
|
x = world.getSpawnLocation().getX()+0.5;
|
||||||
y = world.getSpawnLocation().getY();
|
y = world.getSpawnLocation().getY();
|
||||||
z = world.getSpawnLocation().getZ();
|
z = world.getSpawnLocation().getZ()+0.5;
|
||||||
} else {
|
} else {
|
||||||
x = location.getX() / (srcComp != 0 ? srcComp : 1) * trgComp + 0.5;
|
x = location.getX() / (srcComp != 0 ? srcComp : 1) * trgComp + 0.5;
|
||||||
y = location.getY();
|
y = location.getY();
|
||||||
@ -80,7 +80,7 @@ public class MVTeleport {
|
|||||||
if (aux == -1) return null;
|
if (aux == -1) return null;
|
||||||
|
|
||||||
MultiVerseCore.log.info("Target location (safe): " + x + ", " + aux + ", " + z);
|
MultiVerseCore.log.info("Target location (safe): " + x + ", " + aux + ", " + z);
|
||||||
|
|
||||||
return new Location(world, x, aux, z, location.getYaw(),location.getPitch());
|
return new Location(world, x, aux, z, location.getYaw(),location.getPitch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user