2017-01-20 11:21:44 +00:00
|
|
|
From 78754b772ed91985a032ffcf48369d4cd95fbe39 Mon Sep 17 00:00:00 2001
|
2016-12-17 04:13:45 +00:00
|
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
|
|
Date: Fri, 16 Dec 2016 22:10:35 -0600
|
|
|
|
Subject: [PATCH] Vanished players don't have rights
|
|
|
|
|
|
|
|
|
2016-12-17 05:02:33 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2017-01-20 11:21:44 +00:00
|
|
|
index 6656358..4582b44 100644
|
2016-12-17 05:02:33 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2016-12-20 22:34:27 +00:00
|
|
|
@@ -68,7 +68,7 @@ public abstract class Entity implements ICommandListener {
|
2016-12-17 05:02:33 +00:00
|
|
|
private static double f = 1.0D;
|
|
|
|
private static int entityCount;
|
|
|
|
private int id;
|
|
|
|
- public boolean i;
|
|
|
|
+ public boolean i; public boolean blocksEntitySpawning() { return i; } // Paper - OBFHELPER
|
|
|
|
public final List<Entity> passengers;
|
|
|
|
protected int j;
|
2016-12-29 05:53:02 +00:00
|
|
|
private Entity au;public void setVehicle(Entity entity) { this.au = entity; } // Paper // OBFHELPER
|
2016-12-17 04:13:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
|
2017-01-06 21:45:59 +00:00
|
|
|
index eb32871..a380e61 100644
|
2016-12-17 04:13:45 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
|
|
|
|
@@ -20,7 +20,7 @@ public class ItemBlock extends Item {
|
|
|
|
|
|
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
|
|
|
|
- if (!itemstack.isEmpty() && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, (Entity) null)) {
|
|
|
|
+ if (!itemstack.isEmpty() && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, entityhuman)) { // 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
|
2017-01-20 11:21:44 +00:00
|
|
|
index 5ea201e..fbdc450 100644
|
2016-12-17 04:13:45 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2016-12-28 00:46:41 +00:00
|
|
|
@@ -1796,6 +1796,33 @@ public abstract class World implements IBlockAccess {
|
2016-12-17 04:13:45 +00:00
|
|
|
return this.a(axisalignedbb, (Entity) null);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start - Based on method below
|
|
|
|
+ /**
|
|
|
|
+ * @param axisalignedbb area to search within
|
|
|
|
+ * @param entity causing the action ex. block placer
|
|
|
|
+ * @return if there are no visible players colliding
|
|
|
|
+ */
|
|
|
|
+ public boolean checkNoVisiblePlayerCollisions(AxisAlignedBB axisalignedbb, @Nullable Entity entity) {
|
|
|
|
+ List list = this.getEntities((Entity) null, axisalignedbb);
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < list.size(); ++i) {
|
|
|
|
+ Entity entity1 = (Entity) list.get(i);
|
|
|
|
+
|
|
|
|
+ if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) {
|
|
|
|
+ if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2016-12-17 05:02:33 +00:00
|
|
|
+ if (!entity1.dead && entity1.blocksEntitySpawning()) {
|
2016-12-17 04:13:45 +00:00
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
public boolean a(AxisAlignedBB axisalignedbb, @Nullable Entity entity) {
|
|
|
|
List list = this.getEntities((Entity) null, axisalignedbb);
|
|
|
|
|
2016-12-28 00:46:41 +00:00
|
|
|
@@ -2680,7 +2707,7 @@ public abstract class World implements IBlockAccess {
|
2016-12-17 04:13:45 +00:00
|
|
|
AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().c(this, blockposition);
|
|
|
|
|
|
|
|
// CraftBukkit start - store default return
|
|
|
|
- boolean defaultReturn = axisalignedbb != Block.k && !this.a(axisalignedbb.a(blockposition), entity) ? false : (iblockdata.getMaterial() == Material.ORIENTABLE && block == Blocks.ANVIL ? true : iblockdata.getMaterial().isReplaceable() && block.canPlace(this, blockposition, enumdirection));
|
|
|
|
+ boolean defaultReturn = axisalignedbb != Block.k && !this.checkNoVisiblePlayerCollisions(axisalignedbb.a(blockposition), entity) ? false : (iblockdata.getMaterial() == Material.ORIENTABLE && block == Blocks.ANVIL ? true : iblockdata.getMaterial().isReplaceable() && block.canPlace(this, blockposition, enumdirection)); // Paper - Use our entity search
|
|
|
|
BlockCanBuildEvent event = new BlockCanBuildEvent(this.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftMagicNumbers.getId(block), defaultReturn);
|
|
|
|
this.getServer().getPluginManager().callEvent(event);
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
2017-01-06 21:45:59 +00:00
|
|
|
index a7f827b..21a8cc7 100644
|
2016-12-17 04:13:45 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
@@ -797,6 +797,13 @@ public class CraftEventFactory {
|
|
|
|
Projectile projectile = (Projectile) entity.getBukkitEntity();
|
|
|
|
org.bukkit.entity.Entity collided = position.entity.getBukkitEntity();
|
|
|
|
com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided);
|
|
|
|
+
|
|
|
|
+ if (projectile.getShooter() instanceof Player && collided instanceof Player) {
|
|
|
|
+ if (!((Player) projectile.getShooter()).canSee((Player) collided)) {
|
|
|
|
+ event.setCancelled(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
Bukkit.getPluginManager().callEvent(event);
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
--
|
2017-01-06 21:45:59 +00:00
|
|
|
2.9.3
|
2016-12-17 04:13:45 +00:00
|
|
|
|