rtp强制传送到主世界

This commit is contained in:
zhangyuheng 2024-08-08 22:39:29 +08:00
parent cbf9718fb0
commit e50f0d035c
2 changed files with 13 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>EssentialsD</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<packaging>jar</packaging>
<name>EssentialsD</name>

View File

@ -199,7 +199,18 @@ public class TeleportManager {
}
if (CoolingDown(player)) return;
int radius = EssentialsD.config.getTpRtpRadius();
World world = player.getWorld();
// get main world
World world = null;
for (World w : EssentialsD.instance.getServer().getWorlds()) {
if (w.getEnvironment() == World.Environment.NORMAL) {
world = w;
break;
}
}
if (world == null) {
Notification.error(player, "未找到主世界");
return;
}
int x = (int) (Math.random() * radius * 2) - radius + (int) player.getLocation().getX();
int z = (int) (Math.random() * radius * 2) - radius + (int) player.getLocation().getZ();
XLogger.debug("RTP: " + x + " " + z);