本文整理汇总了Java中org.bukkit.event.Cancellable.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java Cancellable.isCancelled方法的具体用法?Java Cancellable.isCancelled怎么用?Java Cancellable.isCancelled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.Cancellable
的用法示例。
在下文中一共展示了Cancellable.isCancelled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runCommand
import org.bukkit.event.Cancellable; //导入方法依赖的package包/类
public static void runCommand(CommandSender sender, String command) {
if (CraftoAPI.instance() != null && CraftoAPI.instance().getServiceManager().getService(CommandService.class).isAvailable()) {
CommandService cmdService = CommandService.instance().get();
if (cmdService.processCompletely(sender, command)) {
return;
}
}
if (CraftoPlugin.instance() != null && CraftoPlugin.instance().getCommands() != null) {
CraftoCommands commands = CraftoPlugin.instance().getCommands();
Cancellable cancellable = new SimpleCancellable();
commands.handleCommandEvent(sender, command, cancellable);
if (!cancellable.isCancelled()) { // Command wasnt handled by craftocommands, so it has to be a bukkit command
Bukkit.getServer().dispatchCommand(sender, command);
}
}
else { Bukkit.getServer().dispatchCommand(sender, command); }
}
示例2: write
import org.bukkit.event.Cancellable; //导入方法依赖的package包/类
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
Cancellable cancellable = new de.alphahelix.alphalibary.reflection.nms.netty.Cancellable();
Object pckt = msg;
if (ChannelAbstract.PACKET_CLASS.isAssignableFrom(msg.getClass())) {
pckt = INCChannel.this.onPacketSend(this.owner, msg, cancellable);
}
if (cancellable.isCancelled()) {
return;
}
super.write(ctx, pckt, promise);
}
示例3: channelRead
import org.bukkit.event.Cancellable; //导入方法依赖的package包/类
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
Cancellable cancellable = new de.alphahelix.alphalibary.reflection.nms.netty.Cancellable();
Object pckt = msg;
if (ChannelAbstract.PACKET_CLASS.isAssignableFrom(msg.getClass())) {
pckt = INCChannel.this.onPacketReceive(this.owner, msg, cancellable);
}
if (cancellable.isCancelled()) {
return;
}
super.channelRead(ctx, pckt);
}
示例4: cancelEventIfNotOwned
import org.bukkit.event.Cancellable; //导入方法依赖的package包/类
public static void cancelEventIfNotOwned(Player ply, Chunk chunk, Cancellable e) {
if (ply.hasPermission("claimchunk.admin"))
return;
if (Config.getBool("protection", "blockPlayerChanges")) {
if (!e.isCancelled()) {
if (!canEdit(chunk.getWorld(), chunk.getX(), chunk.getZ(), ply.getUniqueId())) {
e.setCancelled(true);
Utils.toPlayer(ply, Config.getColor("errorColor"), Utils.getMsg("chunkNoEdit"));
}
}
}
}
示例5: execute
import org.bukkit.event.Cancellable; //导入方法依赖的package包/类
@Override
public void execute(CommandSender sender, String[] args) throws Exception {
NovaPlayer nPlayer = PlayerManager.getPlayer(sender);
NovaGuild guild = getParameter();
RegionSelection activeSelection = nPlayer.getActiveSelection();
if(activeSelection == null || !activeSelection.hasBothSelections()) {
Message.CHAT_REGION_VALIDATION_NOTSELECTED.send(sender);
return;
}
RegionValidity selectionValidity = plugin.getRegionManager().checkRegionSelect(activeSelection);
if(selectionValidity != RegionValidity.VALID) {
Message.CHAT_REGION_VALIDATION_NOTVALID.send(sender);
return;
}
if(guild.getRegions().size() >= Config.REGION_MAXAMOUNT.getInt() && nPlayer.getPreferences().getRegionMode() != RegionMode.RESIZE) {
Message.CHAT_REGION_MAXAMOUNT.clone().setVar(VarKey.AMOUNT, Config.REGION_MAXAMOUNT.getInt()).send(nPlayer);
return;
}
NovaRegion region;
Cancellable event;
if(nPlayer.getPreferences().getRegionMode() == RegionMode.RESIZE) {
region = activeSelection.getSelectedRegion();
event = new RegionResizeEvent(region, nPlayer, activeSelection, true);
ListenerManager.getLoggedPluginManager().callEvent((Event) event);
if(!event.isCancelled()) {
region.setCorner(0, activeSelection.getCorner(0));
region.setCorner(1, activeSelection.getCorner(1));
plugin.getDynmapManager().updateRegion(region);
Message.CHAT_REGION_RESIZE_SUCCESS.send(sender);
}
}
else {
region = new NovaRegionImpl(UUID.randomUUID(), nPlayer.getActiveSelection());
event = new RegionCreateEvent(region, nPlayer, true);
if(!event.isCancelled()) {
nPlayer.getGuild().addRegion(region);
plugin.getDynmapManager().addRegion(region);
Message.CHAT_REGION_CREATED.send(sender);
}
}
if(!event.isCancelled()) {
nPlayer.cancelToolProgress();
plugin.getRegionManager().checkAtRegionChange();
}
}
示例6: isCancelled
import org.bukkit.event.Cancellable; //导入方法依赖的package包/类
public boolean isCancelled() {
if(cause instanceof Cancellable == false) return false;
Cancellable cancel = (Cancellable) cause;
return cancel.isCancelled();
}
示例7: processCompletely
import org.bukkit.event.Cancellable; //导入方法依赖的package包/类
public boolean processCompletely(CommandSender executor, String input) {
Cancellable cancellable = new SimpleCancellable();
this.listener.processEvent(executor, input, cancellable);
return cancellable.isCancelled();
}