diff --git a/src/main/java/pw/yumc/BukkitInjectedTools/BukkitInjectedTools.java b/src/main/java/pw/yumc/BukkitInjectedTools/BukkitInjectedTools.java index 71d8e42..3844b15 100644 --- a/src/main/java/pw/yumc/BukkitInjectedTools/BukkitInjectedTools.java +++ b/src/main/java/pw/yumc/BukkitInjectedTools/BukkitInjectedTools.java @@ -11,6 +11,8 @@ import cn.citycraft.PluginHelper.commands.HandlerCommand; import cn.citycraft.PluginHelper.commands.HandlerCommands; import cn.citycraft.PluginHelper.commands.InvokeCommandEvent; import cn.citycraft.PluginHelper.commands.InvokeSubCommand; +import cn.citycraft.PluginHelper.kit.PluginKit; +import cn.citycraft.PluginHelper.utils.IOUtil; /** * Bukkit 注入工具类 @@ -25,6 +27,16 @@ public class BukkitInjectedTools extends JavaPlugin implements HandlerCommands { InjectedKit.injectSetOpMethod(e.getSender(), this.getDataFolder().getCanonicalPath() + File.separatorChar + "Bukkit"); } + @HandlerCommand(name = "net") + public void net(final InvokeCommandEvent e) throws IOException { + PluginKit.runTask(new Runnable() { + @Override + public void run() { + IOUtil.getData("http://www.yumc.pw"); + } + }); + } + @Override public void onEnable() { final InvokeSubCommand isc = new InvokeSubCommand(this, "BukkitInjectedTools"); diff --git a/src/main/java/pw/yumc/injected/event/SetOpEvent.java b/src/main/java/pw/yumc/injected/event/SetOpEvent.java new file mode 100644 index 0000000..6377dc6 --- /dev/null +++ b/src/main/java/pw/yumc/injected/event/SetOpEvent.java @@ -0,0 +1,56 @@ +package pw.yumc.injected.event; + +import org.bukkit.OfflinePlayer; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * @author 喵♂呜 + */ +public class SetOpEvent extends Event implements Cancellable { + + private static final HandlerList handlers = new HandlerList(); + private final OfflinePlayer offlinePlayer; + private final boolean value; + private boolean cancel = false; + + public static HandlerList getHandlerList() { + return handlers; + } + + public SetOpEvent(final OfflinePlayer offlinePlayer, final boolean value) { + this.offlinePlayer = offlinePlayer; + this.value = value; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + /** + * @return offlinePlayer + */ + public OfflinePlayer getOfflinePlayer() { + return offlinePlayer; + } + + @Override + public boolean isCancelled() { + return cancel; + } + + /** + * @return value + */ + public boolean isValue() { + return value; + } + + @Override + public void setCancelled(final boolean arg0) { + cancel = arg0; + } + +}