From 985d47dbf4c2334eb94567cad6fca09c5ede38e3 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 29 Feb 2016 21:20:21 -0600 Subject: [PATCH] Vanished players don't have rights diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index bd0fd80..df19327 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -184,6 +184,14 @@ public abstract class EntityArrow extends Entity implements IProjectile { } } + // Paper start - Allow arrows to fly through vanished players the shooter can't see + if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) { + if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) { + movingobjectposition = null; + } + } + // Paper end + if (movingobjectposition != null) { this.a(movingobjectposition); } diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java index 04fa947..140df3a 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -198,6 +198,14 @@ public class EntityFishingHook extends Entity { movingobjectposition = new MovingObjectPosition(entity); } + // Paper start - Allow fishing hooks to fly through vanished players the shooter can't see + if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && owner != null && owner instanceof EntityPlayer) { + if (!((EntityPlayer) owner).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) { + movingobjectposition = null; + } + } + // Paper end + if (movingobjectposition != null) { org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event if (movingobjectposition.entity != null) { diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java index 93014a4..e0fc22b 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java @@ -157,6 +157,14 @@ public abstract class EntityProjectile extends Entity implements IProjectile { movingobjectposition = new MovingObjectPosition(entity); } + // Paper start - Allow projectiles to fly through vanished players the shooter can't see + if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) { + if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) { + movingobjectposition = null; + } + } + // Paper end + if (movingobjectposition != null) { if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) { this.e(movingobjectposition.a()); diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java index 300573a..6eeb03b 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java @@ -21,7 +21,7 @@ public class ItemBlock extends Item { blockposition = blockposition.shift(enumdirection); } - if (itemstack.count != 0 && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) { + if (itemstack.count != 0 && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, entityhuman, itemstack)) { // Paper - Pass entityhuman instead of null int i = this.filterData(itemstack.getData()); IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index fab56f7..b26516a 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1685,6 +1685,14 @@ public abstract class World implements IBlockAccess { for (int i = 0; i < list.size(); ++i) { Entity entity1 = (Entity) list.get(i); + // Paper start - Allow block placement if the placer cannot see the vanished blocker + if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) { + if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) { + continue; + } + } + // Paper end + if (!entity1.dead && entity1.i && entity1 != entity && (entity == null || entity1.x(entity))) { return false; } -- 2.7.4