Merge pull request #1256

bfbd24c5 Fix decompile error (Hugo Manrique)
1f5d23d9 Re-add Vanished players don't have rights patch (Hugo Manrique)

* pull/1256/head:
  Fix decompile error
  Re-add Vanished players don't have rights patch
This commit is contained in:
Aikar 2018-07-25 19:41:35 -04:00
commit 230b8d4258
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
9 changed files with 159 additions and 134 deletions

View File

@ -1,21 +1,11 @@
From 5e82fb8aede56d14967ad5e126ef1870ea6f10d8 Mon Sep 17 00:00:00 2001
From 6460da5f11f9c0a62d52da096c1e70e2d8b0fbd4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 30 Mar 2016 19:36:20 -0400
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
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -234,4 +234,5 @@ public class PaperCommand extends Command {
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Paper config reload complete.");
}
+
}
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 002da2a19..9f3aa2459 100644
index 002da2a191..9f3aa24590 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -150,7 +150,7 @@ public class BlockPosition extends BaseBlockPosition {
@ -69,7 +59,7 @@ index 002da2a19..9f3aa2459 100644
}
diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java
index a661789c1..785a1a218 100644
index a661789c1e..785a1a2184 100644
--- a/src/main/java/net/minecraft/server/DefinedStructure.java
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java
@@ -88,7 +88,7 @@ public class DefinedStructure {
@ -124,7 +114,7 @@ index a661789c1..785a1a218 100644
public Iterator<IBlockData> iterator() {
diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java
index 3b8f6ec16..bde5714dd 100644
index 3b8f6ec167..bde5714dd6 100644
--- a/src/main/java/net/minecraft/server/RegistryID.java
+++ b/src/main/java/net/minecraft/server/RegistryID.java
@@ -6,7 +6,7 @@ import java.util.Arrays;
@ -164,6 +154,19 @@ index 3b8f6ec16..bde5714dd 100644
this.e = 0;
this.f = 0;
diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java
index 4b5463cca2..53c9f21887 100644
--- a/src/main/java/net/minecraft/server/VoxelShape.java
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
@@ -67,7 +67,7 @@ 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;
}
--
2.16.1.windows.1
2.18.0

View File

@ -1,4 +1,4 @@
From 6e81d6e82a4e7ba0d6c513918f3a3f597851df36 Mon Sep 17 00:00:00 2001
From 98687afc6aeac6f87995e5b56eef3a7d35398cd8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 01:40:13 -0400
Subject: [PATCH] Add MinecraftKey Information to Objects
@ -6,7 +6,7 @@ Subject: [PATCH] Add MinecraftKey Information to Objects
Stores the reference to the objects respective MinecraftKey
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index a0ebc1eaa..e4c771a39 100644
index e8f7b7292d..7ff8e70b24 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -171,7 +171,7 @@ public class PaperCommand extends Command {
@ -18,15 +18,8 @@ index a0ebc1eaa..e4c771a39 100644
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
@@ -234,5 +234,5 @@ public class PaperCommand extends Command {
Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Paper config reload complete.");
}
-
+
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3fa32228b..e65558f7a 100644
index 29c7043c86..1a7d78a5c3 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -45,7 +45,7 @@ import org.bukkit.event.entity.EntityPortalEvent;
@ -88,7 +81,7 @@ index 3fa32228b..e65558f7a 100644
protected abstract void a(NBTTagCompound nbttagcompound);
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index 9a513b4e3..fa268f354 100644
index 9a513b4e3a..fa268f3543 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -238,6 +238,7 @@ public class EntityTypes<T extends Entity> {
@ -101,7 +94,7 @@ index 9a513b4e3..fa268f354 100644
}
diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java
new file mode 100644
index 000000000..61c2b993c
index 0000000000..61c2b993c9
--- /dev/null
+++ b/src/main/java/net/minecraft/server/KeyedObject.java
@@ -0,0 +1,8 @@
@ -114,7 +107,7 @@ index 000000000..61c2b993c
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 8a0453245..257dd1da9 100644
index 8a0453245d..257dd1da9c 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -7,11 +7,11 @@ import org.apache.logging.log4j.Logger;

View File

@ -0,0 +1,129 @@
From 56fc9a41a74bf432c9c846abb6fd7568eb3d4e8e Mon Sep 17 00:00:00 2001
From: Hugo Manrique <hugmanrique@gmail.com>
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 9f2a23d693..e657778469 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -92,7 +92,7 @@ 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<Entity> 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 c8f305e6d6..b57f6efb3a 100644
--- a/src/main/java/net/minecraft/server/IBlockData.java
+++ b/src/main/java/net/minecraft/server/IBlockData.java
@@ -179,6 +179,7 @@ public interface IBlockData extends IBlockDataHolder<IBlockData> {
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 1cecccef23..afc881d9af 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -70,7 +70,8 @@ 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 53c9f21887..71e4084320 100644
--- a/src/main/java/net/minecraft/server/VoxelShape.java
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
@@ -22,6 +22,7 @@ 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.");
@@ -40,6 +41,7 @@ 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 72e22c09ba..6d80e55c19 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1545,6 +1545,37 @@ 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 cf398cd250..140ddae0d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -804,6 +804,14 @@ 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;
}
--
2.18.0

View File

@ -1,4 +1,4 @@
From a3712df43902f6a1a841759c5c8e32c9187e9a99 Mon Sep 17 00:00:00 2001
From e03f8b9d7954cb8b1b292d87e3945393e19fb521 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 19:13:06 -0400
Subject: [PATCH] Thread Safe Iteration of Chunk Scheduler

View File

@ -1,4 +1,4 @@
From f159b677ff7fabd0341ec5ae5b74bddda4d86b52 Mon Sep 17 00:00:00 2001
From f6cfd4813697adbaeacbaa38f4181fc8b055a6fa Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:18:31 -0400
Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it

View File

@ -1,4 +1,4 @@
From 8b56a881c447a5f3f72582d443339843298a1f16 Mon Sep 17 00:00:00 2001
From 56148e925de0b60c171955575e92691cf2fb5457 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:44:23 -0400
Subject: [PATCH] Add some Debug to Chunk Entity slices
@ -61,7 +61,7 @@ index aa75cc4205..56a74c6062 100644
if (entity instanceof EntityItem) {
itemCounts[i]--;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9f2a23d693..7a63114fe5 100644
index e657778469..85358902ff 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -63,6 +63,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke

View File

@ -1,4 +1,4 @@
From cf496744a11659b8a12697b56a3d057b24203df9 Mon Sep 17 00:00:00 2001
From fb53e1fd3777d4bde51f4ac9a6e8fa0e623cd074 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 23:40:04 -0400
Subject: [PATCH] Optimize Region File Cache

View File

@ -1,4 +1,4 @@
From d4006d0f3ce1a5323bbdfce7446b59723f11512f Mon Sep 17 00:00:00 2001
From 59f7266c560b61d7e1e15e304a92282d3548b1b0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 25 Jul 2018 01:21:05 -0400
Subject: [PATCH] repair bad rcon.ip settings temporarily

View File

@ -1,100 +0,0 @@
From 6c9aa29b50e035dc386794e866d64ec07c4c9c19 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 16 Dec 2016 22:10:35 -0600
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 d79844a98..6d1e61e23 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -81,7 +81,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
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;
private Entity au;public void setVehicle(Entity entity) { this.au = entity; } // Paper // OBFHELPER
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index 60149c1ca..a5730d1c7 100644
--- 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
index d7bf8378e..424b956e8 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1805,6 +1805,33 @@ public abstract class World implements IBlockAccess {
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;
+ }
+ }
+
+ if (!entity1.dead && entity1.blocksEntitySpawning()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ // Paper end
+
public boolean a(AxisAlignedBB axisalignedbb, @Nullable Entity entity) {
List list = this.getEntities((Entity) null, axisalignedbb);
@@ -2695,7 +2722,7 @@ public abstract class World implements IBlockAccess {
AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().d(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
index 06a277b3b..5f816e44f 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -810,6 +810,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;
}
--
2.18.0