From f2fe0329c1e52b986d277ffdcaea28eb6afe7283 Mon Sep 17 00:00:00 2001 From: Hugo Manrique Date: Mon, 23 Jul 2018 14:31:18 +0200 Subject: [PATCH 1/2] Re-add Vanished players don't have rights patch --- .../Vanished-players-don-t-have-rights.patch | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch diff --git a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch new file mode 100644 index 0000000000..66c71fbc13 --- /dev/null +++ b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch @@ -0,0 +1,127 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Hugo Manrique +Date: Mon, 23 Jul 2018 14:22:26 +0200 +Subject: [PATCH] Vanished players don't have rights + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index b6d6d4f3..ce2fdbeb 100644 +--- 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 INamableTileEntity, ICommandListener, Ke + private static int entityCount; + private final EntityTypes g; public EntityTypes getEntityType() { return g; } // Paper - OBFHELPER + private int id; +- public boolean j; ++ public boolean j; public boolean blocksEntitySpawning() { return j; } // Paper - OBFHELPER + public final List passengers; + protected int k; + private Entity ax; +diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java +index c8f305e6..b57f6efb 100644 +--- a/src/main/java/net/minecraft/server/IBlockData.java ++++ b/src/main/java/net/minecraft/server/IBlockData.java +@@ -0,0 +0,0 @@ public interface IBlockData extends IBlockDataHolder { + return this.getBlock().a(this, iblockaccess, blockposition); + } + ++ default VoxelShape getBlockShape(IBlockAccess iblockaccess, BlockPosition blockposition) { return h(iblockaccess, blockposition); } // Paper - OBFHELPER + default VoxelShape h(IBlockAccess iblockaccess, BlockPosition blockposition) { + return this.getBlock().f(this, iblockaccess, blockposition); + } +diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java +index 1cecccef..afc881d9 100644 +--- 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 { + + protected boolean b(BlockActionContext blockactioncontext, IBlockData iblockdata) { + // CraftBukkit start - store default return +- boolean defaultReturn = iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition()); ++ final World world = blockactioncontext.getWorld(); // Paper ++ boolean defaultReturn = iblockdata.canPlace(world, blockactioncontext.getClickPosition()) && world.a(iblockdata, blockactioncontext.getClickPosition()) && world.checkNoVisiblePlayerCollisions(blockactioncontext.getEntity(), iblockdata.getBlockShape(world, blockactioncontext.getClickPosition())); // Paper - Use our entity search + + BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), CraftBlockData.fromData(iblockdata), defaultReturn); + blockactioncontext.getWorld().getServer().getPluginManager().callEvent(event); +diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java +index 53c9f218..71e40843 100644 +--- a/src/main/java/net/minecraft/server/VoxelShape.java ++++ b/src/main/java/net/minecraft/server/VoxelShape.java +@@ -0,0 +0,0 @@ public abstract class VoxelShape { + return this.a(enumdirection_enumaxis, this.a.b(enumdirection_enumaxis)); + } + ++ public AxisAlignedBB getBounds() { return a(); } // Paper - OBFHELPER + public AxisAlignedBB a() { + if (this.b()) { + throw new UnsupportedOperationException("No bounds for empty shape."); +@@ -0,0 +0,0 @@ public abstract class VoxelShape { + + protected abstract DoubleList a(EnumDirection.EnumAxis enumdirection_enumaxis); + ++ public boolean isEmpty() { return b(); } // Paper - OBFHELPER + public boolean b() { + return this.a.a(); + } +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 127dcedc..302a3655 100644 +--- 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 GeneratorAccess, IIBlockAccess, AutoClose + } + } + ++ // Paper start - Based on method below ++ /** ++ * @param entity causing the action ex. block placer ++ * @param voxelshape area to search within ++ * @return if there are no visible players colliding ++ */ ++ public boolean checkNoVisiblePlayerCollisions(@Nullable Entity entity, VoxelShape voxelshape) { ++ if (voxelshape.isEmpty()) { ++ return true; ++ } else { ++ List list = this.getEntities((Entity) null, voxelshape.getBounds()); ++ ++ 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; ++ } ++ } ++ ++ if (!entity1.dead && entity1.blocksEntitySpawning()) { ++ return false; ++ } ++ } ++ ++ return true; ++ } ++ } ++ // Paper end ++ + public boolean a(@Nullable Entity entity, VoxelShape voxelshape) { + if (voxelshape.b()) { + return true; +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index cf398cd2..140ddae0 100644 +--- 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); ++ return event; ++ } ++ } ++ + Bukkit.getPluginManager().callEvent(event); + return event; + } +-- \ No newline at end of file From adbb709ff594ae9b31802528fef1c0557cf11337 Mon Sep 17 00:00:00 2001 From: Hugo Manrique Date: Mon, 23 Jul 2018 16:57:21 +0200 Subject: [PATCH 2/2] Fix decompile error --- Spigot-Server-Patches/MC-Dev-fixes.patch | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/MC-Dev-fixes.patch b/Spigot-Server-Patches/MC-Dev-fixes.patch index 61c39a92e2..bee1b88a38 100644 --- a/Spigot-Server-Patches/MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/MC-Dev-fixes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] MC Dev fixes diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index e8f7b7292..a0ebc1eaa 100644 +index e8f7b729..a0ebc1ea 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ public class PaperCommand extends Command { @@ -15,7 +15,7 @@ index e8f7b7292..a0ebc1eaa 100644 + } diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 002da2a19..121a137f3 100644 +index 002da2a1..121a137f 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { @@ -57,7 +57,7 @@ index 002da2a19..121a137f3 100644 } diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java -index 65910508f..15c7cc170 100644 +index a661789c..785a1a21 100644 --- a/src/main/java/net/minecraft/server/DefinedStructure.java +++ b/src/main/java/net/minecraft/server/DefinedStructure.java @@ -0,0 +0,0 @@ public class DefinedStructure { @@ -111,4 +111,17 @@ index 65910508f..15c7cc170 100644 } public Iterator iterator() { +diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java +index 4b5463cc..53c9f218 100644 +--- a/src/main/java/net/minecraft/server/VoxelShape.java ++++ b/src/main/java/net/minecraft/server/VoxelShape.java +@@ -0,0 +0,0 @@ public abstract class VoxelShape { + ArrayList arraylist = Lists.newArrayList(); + + this.b((d0, d1, d2, d3, d4, d5) -> { +- list.add(new AxisAlignedBB(d0, d1, d2, d3, d4, d5)); ++ arraylist.add(new AxisAlignedBB(d0, d1, d2, d3, d4, d5)); // Paper - decompile fix + }); + return arraylist; + } -- \ No newline at end of file