summaryrefslogtreecommitdiffstats
path: root/nms-patches/CommandSpreadPlayers.patch
blob: 33279985d34271d52235d7996629a22c3e8c287d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--- a/net/minecraft/server/CommandSpreadPlayers.java
+++ b/net/minecraft/server/CommandSpreadPlayers.java
@@ -240,9 +240,16 @@
     }
 
     public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, @Nullable 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
     }
 
+    // CraftBukkit start - fix decompile error
+    @Override
+    public int compareTo(ICommand o) {
+        return a(o);
+    }
+    // CraftBukkit end
+
     static class Location2D {
 
         double a;
@@ -309,7 +316,7 @@
                 }
 
                 blockposition = blockposition.down();
-            } while (world.getType(blockposition).getMaterial() == Material.AIR);
+            } while (getType(world, blockposition).getMaterial() == Material.AIR); // CraftBukkit
 
             return blockposition.getY() + 1;
         }
@@ -325,7 +332,7 @@
                 }
 
                 blockposition = blockposition.down();
-                material = world.getType(blockposition).getMaterial();
+                material = getType(world, blockposition).getMaterial(); // CraftBukkit
             } while (material == Material.AIR);
 
             return !material.isLiquid() && material != Material.FIRE;
@@ -335,5 +342,12 @@
             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
     }
 }