2014-06-22 22:30:53 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
2016-12-17 05:13:45 +01:00
|
|
|
Date: Fri, 16 Dec 2016 22:10:35 -0600
|
2014-12-06 05:28:08 +01:00
|
|
|
Subject: [PATCH] Vanished players don't have rights
|
2014-06-22 22:30:53 +02:00
|
|
|
|
2014-08-10 07:21:18 +02:00
|
|
|
|
2016-12-17 06:02:33 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2018-01-18 07:00:51 +01:00
|
|
|
index 42da707ae..9080006e5 100644
|
2016-12-17 06:02:33 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
|
|
|
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 06:53:02 +01:00
|
|
|
private Entity au;public void setVehicle(Entity entity) { this.au = entity; } // Paper // OBFHELPER
|
2015-01-07 05:13:40 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
|
2018-01-18 07:00:51 +01:00
|
|
|
index 60149c1ca..a5730d1c7 100644
|
2015-01-07 05:13:40 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
|
|
|
|
@@ -0,0 +0,0 @@ public class ItemBlock extends Item {
|
2016-03-01 00:09:49 +01:00
|
|
|
|
2016-11-17 03:23:38 +01:00
|
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
|
|
|
|
- if (!itemstack.isEmpty() && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, (Entity) null)) {
|
2016-12-17 05:13:45 +01:00
|
|
|
+ if (!itemstack.isEmpty() && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, entityhuman)) { // Paper - Pass entityhuman instead of null
|
2015-01-07 05:13:40 +01:00
|
|
|
int i = this.filterData(itemstack.getData());
|
|
|
|
IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman);
|
|
|
|
|
2014-06-22 22:30:53 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2018-01-18 07:00:51 +01:00
|
|
|
index ea6f46522..01dba285a 100644
|
2014-06-22 22:30:53 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
|
|
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
2016-12-17 05:13:45 +01:00
|
|
|
return this.a(axisalignedbb, (Entity) null);
|
|
|
|
}
|
2014-11-28 02:17:45 +01:00
|
|
|
|
2016-12-17 05:13:45 +01:00
|
|
|
+ // 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);
|
|
|
|
+
|
2014-07-22 01:52:19 +02:00
|
|
|
+ if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) {
|
|
|
|
+ if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) {
|
2014-06-22 22:30:53 +02:00
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
2014-11-28 02:17:45 +01:00
|
|
|
+
|
2016-12-17 06:02:33 +01:00
|
|
|
+ if (!entity1.dead && entity1.blocksEntitySpawning()) {
|
2016-12-17 05:13:45 +01:00
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
public boolean a(AxisAlignedBB axisalignedbb, @Nullable Entity entity) {
|
|
|
|
List list = this.getEntities((Entity) null, axisalignedbb);
|
|
|
|
|
|
|
|
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
2017-05-21 06:41:39 +02:00
|
|
|
AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().d(this, blockposition);
|
2016-12-17 05:13:45 +01:00
|
|
|
|
|
|
|
// 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
|
2018-01-18 07:00:51 +01:00
|
|
|
index 06a277b3b..5f816e44f 100644
|
2016-12-17 05:13:45 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
@@ -0,0 +0,0 @@ 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;
|
|
|
|
}
|
2015-03-08 02:16:09 +01:00
|
|
|
--
|