如何在Spigot / Bukkit插件中将门户重定向到正确的世界?

时间:2018-04-29 18:43:26

标签: java plugins kotlin minecraft bukkit

我正在使用Spigot世界管理插件(重写当前的一个插件),我需要将nether和端口重定向到正确的世界。除了这个之外,我完成了插件的每个部分。以下是我需要的几个例子。

如果你进入 plotworld 世界并进入幽冥门户,你应该去 plotworld_nether

如果你进入 myworld_the_end 世界并进入最终门户网站,那么你应该去 myworld

1 个答案:

答案 0 :(得分:1)

看看PlayerPortalEvent,然后做一些这样的事情(在Kotlin回答你在问题中标记它):

@EventHandler
fun onPortalEvent(e: PlayerPortalEvent) {
    if (e.from == X) { //Where X is the location that you know the player is, use the world name or whatever you need
        e.setTo(Y) //Where Y is the location you want the TP to go to
    }
}

这对你来说已经足够了。

  1. 获取门户网站活动
  2. 验证from位置是否来自您要检查的世界/门户网站
  3. 将目的地设置为您想要的地方