summaryrefslogtreecommitdiffstats
path: root/nms-patches/CommandTp.patch
blob: de9d839ea2630b37b914d0a0e389019c2de84502 (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
--- a/net/minecraft/server/CommandTp.java
+++ b/net/minecraft/server/CommandTp.java
@@ -97,27 +97,28 @@
             } else {
                 Entity entity = b(minecraftserver, icommandlistener, astring[astring.length - 1]);
 
-                if (entity.world != ((Entity) object).world) {
-                    throw new CommandException("commands.tp.notSameDimension", new Object[0]);
-                } else {
-                    ((Entity) object).stopRiding();
-                    if (object instanceof EntityPlayer) {
-                        ((EntityPlayer) object).playerConnection.a(entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch);
-                    } else {
-                        ((Entity) object).setPositionRotation(entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch);
-                    }
-
+                // CraftBukkit Start
+                // Use Bukkit teleport method in all cases. It has cross dimensional handling, events
+                if (((Entity) object).getBukkitEntity().teleport(entity.getBukkitEntity(), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND)) {
                     a(icommandlistener, (ICommand) this, "commands.tp.success", new Object[] { ((Entity) object).getName(), entity.getName()});
+                    // CraftBukkit End
                 }
             }
         }
     }
 
     public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) {
-        return astring.length != 1 && astring.length != 2 ? Collections.emptyList() : a(astring, minecraftserver.getPlayers());
+        return astring.length != 1 && astring.length != 2 ? Collections.<String>emptyList() : a(astring, minecraftserver.getPlayers()); // CraftBukkit - decompile error
     }
 
     public boolean isListStart(String[] astring, int i) {
         return i == 0;
     }
+
+    // CraftBukkit start - fix decompile error
+    @Override
+    public int compareTo(ICommand o) {
+        return a((ICommand) o);
+    }
+    // CraftBukkit end
 }