Update to Minecraft 1.17

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-06-11 15:00:00 +10:00
parent 75faba7fde
commit b3a8254758
619 changed files with 10708 additions and 8451 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/commands/CommandTeleport.java
+++ b/net/minecraft/server/commands/CommandTeleport.java
@@ -35,6 +35,12 @@
@@ -36,6 +36,12 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
@@ -12,25 +12,23 @@
+
public class CommandTeleport {
private static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("commands.teleport.invalidPosition"));
@@ -150,9 +156,9 @@
private static final SimpleCommandExceptionType INVALID_POSITION = new SimpleCommandExceptionType(new ChatMessage("commands.teleport.invalidPosition"));
@@ -160,14 +166,29 @@
}
if (worldserver == entity.world) {
- ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set);
+ ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
if (worldserver == entity.level) {
- ((EntityPlayer) entity).connection.a(d0, d1, d2, f2, f3, set);
+ ((EntityPlayer) entity).connection.a(d0, d1, d2, f2, f3, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
} else {
- ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1);
+ ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
- ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f2, f3);
+ ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f2, f3, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
}
entity.setHeadRotation(f);
@@ -161,6 +167,21 @@
float f3 = MathHelper.g(f1);
f3 = MathHelper.a(f3, -90.0F, 90.0F);
entity.setHeadRotation(f2);
} else {
float f4 = MathHelper.a(f3, -90.0F, 90.0F);
+ // CraftBukkit start - Teleport event
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f3);
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f4);
+ EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to);
+ worldserver.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
@@ -41,9 +39,9 @@
+ d1 = to.getY();
+ d2 = to.getZ();
+ f2 = to.getYaw();
+ f3 = to.getPitch();
+ f4 = to.getPitch();
+ worldserver = ((CraftWorld) to.getWorld()).getHandle();
+ // CraftBukkit end
if (worldserver == entity.world) {
entity.setPositionRotation(d0, d1, d2, f2, f3);
entity.setHeadRotation(f2);
if (worldserver == entity.level) {
entity.setPositionRotation(d0, d1, d2, f2, f4);