Files
CatServer/patches/net/minecraft/command/CommandTP.java.patch
2019-02-24 22:29:41 +08:00

43 lines
2.2 KiB
Diff

--- ../src-base/minecraft/net/minecraft/command/CommandTP.java
+++ ../src-work/minecraft/net/minecraft/command/CommandTP.java
@@ -74,25 +74,12 @@
{
Entity entity1 = getEntity(server, sender, args[args.length - 1]);
- if (entity1.world != entity.world)
- {
- throw new CommandException("commands.tp.notSameDimension", new Object[0]);
+ // CraftBukkit Start
+ // Use Bukkit teleport method in all cases. It has cross dimensional handling, events
+ if (entity.getBukkitEntity().teleport(entity1.getBukkitEntity(), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND)) {
+ notifyCommandListener(sender, (ICommand) this, "commands.tp.success", new Object[] { entity.getName(), entity1.getName()});
+ // CraftBukkit End
}
- else
- {
- entity.dismountRidingEntity();
-
- if (entity instanceof EntityPlayerMP)
- {
- ((EntityPlayerMP)entity).connection.setPlayerLocation(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);
- }
- else
- {
- entity.setLocationAndAngles(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch);
- }
-
- notifyCommandListener(sender, this, "commands.tp.success", new Object[] {entity.getName(), entity1.getName()});
- }
}
}
}
@@ -143,7 +130,7 @@
}
teleportingEntity.dismountRidingEntity();
- ((EntityPlayerMP)teleportingEntity).connection.setPlayerLocation(argX.getAmount(), argY.getAmount(), argZ.getAmount(), f, f1, set);
+ ((EntityPlayerMP)teleportingEntity).connection.setPlayerLocation(argX.getAmount(), argY.getAmount(), argZ.getAmount(), f, f1, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND);
teleportingEntity.setRotationYawHead(f);
}
else