Fix /locate command override

This commit is contained in:
CocoTheOwner 2021-02-07 12:52:07 +01:00
parent 672f2d717d
commit 28430cc1c3
2 changed files with 16 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package com.volmit.iris;
import com.volmit.iris.manager.*;
import com.volmit.iris.manager.command.CommandIris;
import com.volmit.iris.manager.command.CommandLocate;
import com.volmit.iris.manager.command.PermissionIris;
import com.volmit.iris.manager.link.BKLink;
import com.volmit.iris.manager.link.CitizensLink;
@ -20,6 +21,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import org.bukkit.event.Listener;
import java.io.BufferedInputStream;
import java.io.File;
@ -169,6 +171,7 @@ public class Iris extends VolmitPlugin
J.sr(this::tickQueue, 0);
J.ar(this::checkConfigHotload, 50);
PaperLib.suggestPaper(this);
getServer().getPluginManager().registerEvents(new CommandLocate(), this);
super.onEnable();
}

View File

@ -2,18 +2,26 @@ package com.volmit.iris.manager.command;
import com.volmit.iris.Iris;
import com.volmit.iris.scaffold.IrisWorlds;
import com.volmit.iris.util.Command;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class CommandLocate extends MortarCommand
public class CommandLocate extends MortarCommand implements Listener
{
@Command
private CommandIrisStudioGoto got0;
@EventHandler
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) {
if (event.getMessage().contains("locate") && IrisWorlds.isIrisWorld(event.getPlayer().getWorld())){
MortarSender s = (MortarSender) event.getPlayer();
s.sendMessage("/locate command blocked in Iris worlds. Please use '/ir goto' instead.");
event.setCancelled(true);
}
}
public CommandLocate()
{