所以我正在编辑一个用于 Minecraft spigot 的插件。
在反编译器/调试器中,这就是 me.twister915.ffly 下“FlyCommand.class”的显示内容
这是我的 intellij 项目中出现的同一文件的内容。
我正在尝试更改部分
public FlyCommand()
{
super("fly");
}
我认为 Intellij 认为这是需要编辑的地方。但我不知道如何改变,这样人们就不会在游戏中使用命令“/fly”。我宁愿将其更改为“/vfly”之类的内容
我不知道该怎么做。
最佳答案
您可以拦截CommandPreProcessEvent
(javadocs)并按照您想要的方式处理事件。
@EventHandler
public void onCmdPreProcess(PlayerCommandPreprocessEvent e) {
if (e.getMessage().equalsIgnoreCase("/" + "command") {
e.setCancelled(true); //Treat command in your way
}
}
关于Minecraft 的 Java 插件 - 更改命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46478466/