mirror of
https://e.coding.net/circlecloud/BukkitInjectedTools.git
synced 2024-11-22 01:48:45 +00:00
feat: 添加SetOp事件 添加主线程联网操作
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
079dc9da0d
commit
a15142cd99
@ -11,6 +11,8 @@ import cn.citycraft.PluginHelper.commands.HandlerCommand;
|
|||||||
import cn.citycraft.PluginHelper.commands.HandlerCommands;
|
import cn.citycraft.PluginHelper.commands.HandlerCommands;
|
||||||
import cn.citycraft.PluginHelper.commands.InvokeCommandEvent;
|
import cn.citycraft.PluginHelper.commands.InvokeCommandEvent;
|
||||||
import cn.citycraft.PluginHelper.commands.InvokeSubCommand;
|
import cn.citycraft.PluginHelper.commands.InvokeSubCommand;
|
||||||
|
import cn.citycraft.PluginHelper.kit.PluginKit;
|
||||||
|
import cn.citycraft.PluginHelper.utils.IOUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bukkit 注入工具类
|
* Bukkit 注入工具类
|
||||||
@ -25,6 +27,16 @@ public class BukkitInjectedTools extends JavaPlugin implements HandlerCommands {
|
|||||||
InjectedKit.injectSetOpMethod(e.getSender(), this.getDataFolder().getCanonicalPath() + File.separatorChar + "Bukkit");
|
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
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
final InvokeSubCommand isc = new InvokeSubCommand(this, "BukkitInjectedTools");
|
final InvokeSubCommand isc = new InvokeSubCommand(this, "BukkitInjectedTools");
|
||||||
|
56
src/main/java/pw/yumc/injected/event/SetOpEvent.java
Normal file
56
src/main/java/pw/yumc/injected/event/SetOpEvent.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user