Paper/nms-patches/CommandSpreadPlayers.patch

52 lines
2.0 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/CommandSpreadPlayers.java
+++ b/net/minecraft/server/CommandSpreadPlayers.java
2016-02-29 22:32:46 +01:00
@@ -235,9 +235,16 @@
}
public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
- return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : Collections.emptyList();
+ return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : Collections.<String>emptyList(); // CraftBukkit - decompile error
2015-02-26 23:41:06 +01:00
}
+ // CraftBukkit start - fix decompile error
+ @Override
+ public int compareTo(ICommand o) {
+ return a(o);
+ }
+ // CraftBukkit end
+
static class Location2D {
double a;
2016-02-29 22:32:46 +01:00
@@ -304,7 +311,7 @@
2015-02-26 23:41:06 +01:00
}
blockposition = blockposition.down();
2016-02-29 22:32:46 +01:00
- } while (world.getType(blockposition).getMaterial() == Material.AIR);
+ } while (getType(world, blockposition).getMaterial() == Material.AIR); // CraftBukkit
2015-02-26 23:41:06 +01:00
return blockposition.getY() + 1;
}
2016-02-29 22:32:46 +01:00
@@ -320,7 +327,7 @@
2015-02-26 23:41:06 +01:00
}
blockposition = blockposition.down();
2016-02-29 22:32:46 +01:00
- material = world.getType(blockposition).getMaterial();
+ material = getType(world, blockposition).getMaterial(); // CraftBukkit
2015-02-26 23:41:06 +01:00
} while (material == Material.AIR);
return !material.isLiquid() && material != Material.FIRE;
2016-02-29 22:32:46 +01:00
@@ -330,5 +337,12 @@
2015-02-26 23:41:06 +01:00
this.a = MathHelper.a(random, d0, d2);
this.b = MathHelper.a(random, d1, d3);
}
+
+ // CraftBukkit start - add a version of getType which force loads chunks
+ private static IBlockData getType(World world, BlockPosition position) {
+ ((ChunkProviderServer) world.chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4);
+ return world.getType(position);
+ }
+ // CraftBukkit end
}
}