mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
a207d14a0e
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
24 lines
1.6 KiB
Diff
24 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach@zachbr.io>
|
|
Date: Thu, 16 Apr 2020 20:07:29 -0500
|
|
Subject: [PATCH] Restrict vanilla teleport command to valid locations
|
|
|
|
Fixes GH-3165, GH-3575
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/commands/TeleportCommand.java b/src/main/java/net/minecraft/server/commands/TeleportCommand.java
|
|
index 774180d9e450199309fee65b1d10e1592f84548a..d04ce9a323b079b4556b8c341fb11186e8d3e05d 100644
|
|
--- a/src/main/java/net/minecraft/server/commands/TeleportCommand.java
|
|
+++ b/src/main/java/net/minecraft/server/commands/TeleportCommand.java
|
|
@@ -141,6 +141,12 @@ public class TeleportCommand {
|
|
|
|
private static void performTeleport(CommandSourceStack source, Entity target, ServerLevel world, double x, double y, double z, Set<ClientboundPlayerPositionPacket.RelativeArgument> movementFlags, float yaw, float pitch, @Nullable TeleportCommand.LookAt facingLocation) throws CommandSyntaxException {
|
|
BlockPos blockposition = new BlockPos(x, y, z);
|
|
+ // Paper start - Don't allow teleport command to invalid locations
|
|
+ if (x <= -30000000 || z <= -30000000 || x > 30000000 || z > 30000000 || y > 30000000 || y <= -30000000) { // Copy/pasta from BaseBlockPosition#isValidLocation
|
|
+ org.bukkit.Bukkit.getLogger().warning("Refused to teleport " + target.getScoreboardName() + " to " + x + ", " + y + ", " + z);
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
|
|
if (!Level.isInSpawnableBounds(blockposition)) {
|
|
throw TeleportCommand.INVALID_POSITION.create();
|