summaryrefslogtreecommitdiffstats
path: root/nms-patches/CommandTp.patch
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2014-12-13 09:54:59 +1100
committermd_5 <git@md-5.net>2014-12-13 09:54:59 +1100
commite8efbb8a8762fed89dcb31f78f97693b55bfb2bc (patch)
tree88874e5172ea30d8ef4827793555df5233e7cc7d /nms-patches/CommandTp.patch
parent95169d476505c6cd70e01e1742584459f684da59 (diff)
downloadcraftbukkit-e8efbb8a8762fed89dcb31f78f97693b55bfb2bc.tar
craftbukkit-e8efbb8a8762fed89dcb31f78f97693b55bfb2bc.tar.gz
craftbukkit-e8efbb8a8762fed89dcb31f78f97693b55bfb2bc.tar.lz
craftbukkit-e8efbb8a8762fed89dcb31f78f97693b55bfb2bc.tar.xz
craftbukkit-e8efbb8a8762fed89dcb31f78f97693b55bfb2bc.zip
Handle cross dimensional teleports and events.
Diffstat (limited to 'nms-patches/CommandTp.patch')
-rw-r--r--nms-patches/CommandTp.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/nms-patches/CommandTp.patch b/nms-patches/CommandTp.patch
new file mode 100644
index 00000000..a84cc67f
--- /dev/null
+++ b/nms-patches/CommandTp.patch
@@ -0,0 +1,46 @@
+--- ../work/decompile-8eb82bde/net/minecraft/server/CommandTp.java 2014-12-13 09:54:39.438309447 +1100
++++ src/main/java/net/minecraft/server/CommandTp.java 2014-12-13 09:54:37.990309246 +1100
+@@ -19,7 +19,7 @@
+ return "commands.tp.usage";
+ }
+
+- public void execute(ICommandListener icommandlistener, String[] astring) {
++ public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException { // CraftBukkit - add throws
+ if (astring.length < 1) {
+ throw new ExceptionUsage("commands.tp.usage", new Object[0]);
+ } else {
+@@ -105,17 +105,11 @@
+ } else {
+ Entity entity = b(icommandlistener, astring[astring.length - 1]);
+
+- if (entity.world != ((Entity) object).world) {
+- throw new CommandException("commands.tp.notSameDimension", new Object[0]);
+- } else {
+- ((Entity) object).mount((Entity) null);
+- 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);
+- }
+-
+- a(icommandlistener, this, "commands.tp.success", new Object[] { ((Entity) object).getName(), entity.getName()});
++ // 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, this, "commands.tp.success", new Object[]{((Entity) object).getName(), entity.getName()});
++ // CraftBukkit End
+ }
+ }
+ }
+@@ -128,4 +122,11 @@
+ public boolean isListStart(String[] astring, int i) {
+ return i == 0;
+ }
++
++ // CraftBukkit start - fix decompile error
++ @Override
++ public int compareTo(Object o) {
++ return a((ICommand) o);
++ }
++ // CraftBukkit end
+ }