当前位置: 首页>>代码示例>>Java>>正文


Java Cancellable.isCancelled方法代码示例

本文整理汇总了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); }
	
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:21,代码来源:Utility.java

示例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);
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:13,代码来源:INCChannel.java

示例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);
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:12,代码来源:INCChannel.java

示例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"));
			}
		}
	}
}
 
开发者ID:cjburkey01,项目名称:ClaimChunk,代码行数:13,代码来源:ChunkHelper.java

示例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();
	}
}
 
开发者ID:MarcinWieczorek,项目名称:NovaGuilds,代码行数:57,代码来源:CommandAdminRegionBuy.java

示例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();
}
 
开发者ID:ProjectRixor,项目名称:Rixor,代码行数:6,代码来源:BlockChangeEvent.java

示例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();
}
 
开发者ID:Craftolution,项目名称:CraftoPlugin,代码行数:6,代码来源:CommandService.java


注:本文中的org.bukkit.event.Cancellable.isCancelled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。