當前位置: 首頁>>代碼示例>>Java>>正文


Java BlockCommandSender類代碼示例

本文整理匯總了Java中org.bukkit.command.BlockCommandSender的典型用法代碼示例。如果您正苦於以下問題:Java BlockCommandSender類的具體用法?Java BlockCommandSender怎麽用?Java BlockCommandSender使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BlockCommandSender類屬於org.bukkit.command包,在下文中一共展示了BlockCommandSender類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getListener

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
private net.minecraft.command.ICommandSender getListener(CommandSender sender) {
    if (sender instanceof Player) {
        return ((CraftPlayer) sender).getHandle();
    }
    if (sender instanceof BlockCommandSender) {
        return ((CraftBlockCommandSender) sender).getTileEntity();
    }
    if (sender instanceof CommandMinecart) {
        return ((net.minecraft.entity.EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).func_145822_e();
    }
    if (sender instanceof RemoteConsoleCommandSender) {
        return net.minecraft.network.rcon.RConConsoleSource.instance;
    }
    if (sender instanceof ConsoleCommandSender) {
        return ((CraftServer) sender.getServer()).getServer();
    }
    return null;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:19,代碼來源:VanillaCommandWrapper.java

示例2: getSender

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
private static Sender getSender(CommandSender sender) {
    if (sender instanceof LivingEntity) {
        LivingEntity livingEntity = (LivingEntity) sender;
        
        Sender s;
        
        if (cachedSenders.containsKey(livingEntity.getUniqueId())) {
            s = cachedSenders.get(livingEntity.getUniqueId());
            s.refresh(livingEntity);
        } else {
            cachedSenders.put(livingEntity.getUniqueId(), s = new Sender(livingEntity));
        }
        
        return s;
    }
    if (sender instanceof ConsoleCommandSender)
        return consoleSender == null ? consoleSender = new Sender(sender) : consoleSender;
    if (sender instanceof BlockCommandSender)
        return new Sender(sender);
    
    return null;
}
 
開發者ID:inventor02,項目名稱:RLStaffChat,代碼行數:23,代碼來源:AbstractCommand.java

示例3: onCommand

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
@Override
protected void onCommand(CommandSender sender, String[] args) {
    BlockCommandSender bcs = (BlockCommandSender) sender;
    if (!Dungeons.isDungeon(bcs.getBlock().getWorld())) {
        sender.sendMessage(ChatColor.RED + "This command can only be run in a dungeon.");
        return;
    }

    Dungeon d = getDungeon(bcs);
    if (d.isEditMode()) {
        sender.sendMessage(ChatColor.RED + "This command cannot be run in edit-mode.");
        return;
    }

    super.onCommand(sender, args);
    if (deleteOnExecute() && !d.isEditMode())
        bcs.getBlock().setType(Material.AIR); // Delete this command-block on execute, provided we aren't in edit-mode.
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:19,代碼來源:DungeonCommand.java

示例4: execute

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
public boolean execute(CommandSender sender, String label, String[] args) {
	VPSender vpSender;
	if(sender instanceof Player)
		vpSender = VanillaPlusCore.getPlayerManager().getPlayer(((Player)sender).getUniqueId());
	else if(sender instanceof BlockCommandSender)
		vpSender = new VPCommandBlock((BlockCommandSender) sender);
	else if(sender instanceof ConsoleCommandSender)
		vpSender = VanillaPlusCore.getVPConsole();
	else
		return false;
	if(label.equalsIgnoreCase(PlaceH.HELP.get())){
		showTopHelp(vpSender, label, args.length > 0 ? Utils.parseInt(args[0], 1, false) : 1);
		return true;
	}
	for(CommandPlus command : getLoaded())
		if(command.is(label.toLowerCase())){
			if(command.hasRequirement(vpSender))
				command.onExecute(vpSender, label, new LinkedList<String>(Arrays.asList(args)));
			return true;
		}
	return false;
}
 
開發者ID:dracnis,項目名稱:VanillaPlus,代碼行數:23,代碼來源:CPManager.java

示例5: getMailSender

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
/**
 * CommandSenderから、MailSenderを作成して返す
 * @param sender
 * @return MailSender
 */
public static MailSender getMailSender(CommandSender sender) {
    if ( sender == null ) {
        return null;
    } else if ( sender instanceof BlockCommandSender ) {
        return new MailSenderBlock((BlockCommandSender)sender);
    } else if ( sender instanceof ConsoleCommandSender ) {
        return new MailSenderConsole((ConsoleCommandSender)sender);
    } else if ( sender instanceof OfflinePlayer ) {
        OfflinePlayer player = (OfflinePlayer)sender;
        if ( Utility.isCB178orLater() ) {
            return new MailSenderPlayer("$" + player.getUniqueId().toString());
        } else {
            return new MailSenderPlayer(player.getName());
        }
    }
    return null;
}
 
開發者ID:ucchyocean,項目名稱:UndineMailer,代碼行數:23,代碼來源:MailSender.java

示例6: getListener

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
private ICommandListener getListener(CommandSender sender) {
    if (sender instanceof Player) {
        return ((CraftPlayer) sender).getHandle();
    }
    if (sender instanceof BlockCommandSender) {
        return ((CraftBlockCommandSender) sender).getTileEntity();
    }
    if (sender instanceof CommandMinecart) {
        return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock();
    }
    if (sender instanceof RemoteConsoleCommandSender) {
        return RemoteControlCommandListener.instance;
    }
    if (sender instanceof ConsoleCommandSender) {
        return ((CraftServer) sender.getServer()).getServer();
    }
    return null;
}
 
開發者ID:OvercastNetwork,項目名稱:CraftBukkit,代碼行數:19,代碼來源:VanillaCommandWrapper.java

示例7: execute

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
@Override
public boolean execute(org.bukkit.command.CommandSender sender, String label, String[] args) {
    if(!this.testPermission(sender)) {
        return true;
    }

    if((!this.command.player() && sender instanceof Player) || (!this.command.console() && sender instanceof ConsoleCommandSender) || (!this.command.commandblock() && sender instanceof BlockCommandSender)) {
        sendMessage(sender, "internal.cannot-use-command");
        return true;
    }

    if(args.length < this.command.min() || (this.command.max() > 0 && args.length > this.command.max())) {
        sendUsage(sender, label, this.command.usage());
        return true;
    }

    try {
        this.method.invoke(this.executor, sender, label, args);
    } catch(Throwable e) {
        sendMessage(sender, "internal.command-error");
        ModuleManager.getLogger().log(Level.SEVERE, "Exception while executing Peacecraft command \"" + label + "\".", e);
    }

    return true;
}
 
開發者ID:Steveice10,項目名稱:Peacecraft,代碼行數:26,代碼來源:PeacecraftCommand.java

示例8: getListener

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
private ICommandListener getListener(CommandSender sender) {
    if (sender instanceof Player) {
        return ((CraftPlayer) sender).getHandle();
    }
    if (sender instanceof BlockCommandSender) {
        return ((CraftBlockCommandSender) sender).getTileEntity();
    }
    if (sender instanceof CommandMinecart) {
        return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock();
    }
    if (sender instanceof RemoteConsoleCommandSender) {
        return RemoteControlCommandListener.getInstance();
    }
    if (sender instanceof ConsoleCommandSender) {
        return ((CraftServer) sender.getServer()).getServer();
    }
    if (sender instanceof ProxiedCommandSender) {
        return ((ProxiedNativeCommandSender) sender).getHandle();
    }
    throw new IllegalArgumentException("Cannot make " + sender + " a vanilla command listener");
}
 
開發者ID:tgnmc,項目名稱:Craftbukkit,代碼行數:22,代碼來源:VanillaCommandWrapper.java

示例9: toNMSIComandSender

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
public static Object toNMSIComandSender(CommandSender s) {
	try {
		if (s instanceof Entity) {
			return getEntityByUUID(((Entity) s).getUniqueId());
		} else if (s instanceof ConsoleCommandSender) {
			return getServer();
		} else if (s instanceof RemoteConsoleCommandSender) {
			return getRemoteControlCommandListener();
		} else if (s instanceof ProxiedCommandSender) {
			return getProxiedCommandSender((ProxiedCommandSender) s);
		} else if (s instanceof BlockCommandSender) {
			return getCommandBlockLogic(((BlockCommandSender) s).getBlock());
		} else if (s instanceof CommandMinecart) {
			return getCommandBlockLogic((CommandMinecart) s);
		}
		return null;
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
開發者ID:yushijinhun,項目名稱:AdvancedCommands,代碼行數:21,代碼來源:ReflectionHelper.java

示例10: localeForCommandSender

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
@Override
public Locale localeForCommandSender(CommandSender sender)
{
    if(sender instanceof BlockCommandSender)
        return commandBlockLocale;

    if(sender instanceof ConsoleCommandSender)
        return consoleLocale;

    if(sender instanceof RemoteConsoleCommandSender)
        return remoteConsoleLocale;

    if(sender instanceof Player)
        return LocaleUtils.toLocale(fetcher.getLocaleForPlayer((Player) sender));

    return Locale.ENGLISH;
}
 
開發者ID:Eluinhost,項目名稱:pluginframework,代碼行數:18,代碼來源:BukkitLocaleProvider.java

示例11: getName

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
protected final String getName(CommandSender sender)
{
	if (sender instanceof BlockCommandSender)
	{
		BlockCommandSender commandBlock = (BlockCommandSender) sender;
		Location location = commandBlock.getBlock().getLocation();
		return FormatUtil.format("CommandBlock ({0}, {1}, {2})", location.getBlockX(), location.getBlockY(), location.getBlockZ());
	}
	else if (sender instanceof ConsoleCommandSender)
	{
		return "Console";
	}
	else
	{
		return sender.getName();
	}
}
 
開發者ID:dmulloy2,項目名稱:SwornPermissions,代碼行數:18,代碼來源:SwornPermissionsCommand.java

示例12: parseSender

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
private MCCommandSender parseSender(CommandSender s, MCSubcommand mcsc){
	if (mcsc.commandSender().equals(MCCommandSender.GENERIC) || mcsc.commandSender().equals(null)){
		return MCCommandSender.GENERIC;
	}
	else if (s instanceof ConsoleCommandSender){
		return MCCommandSender.CONSOLE;
	}
	else if (s instanceof Player){
		return MCCommandSender.PLAYER;
	}
	else if (s instanceof RemoteConsoleCommandSender){
		return MCCommandSender.REMOTE;
	}
	else if (s instanceof BlockCommandSender){
		return MCCommandSender.COMMANDBLOCK;
	}else{
		return MCCommandSender.GENERIC;
	}
}
 
開發者ID:jiangzhonghui,項目名稱:multicraft-api,代碼行數:20,代碼來源:MCCommand.java

示例13: getListener

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
private ICommandListener getListener(CommandSender sender) {
    if (sender instanceof Player) {
        return ((CraftPlayer) sender).getHandle();
    }
    if (sender instanceof BlockCommandSender) {
        return ((CraftBlockCommandSender) sender).getTileEntity();
    }
    if (sender instanceof CommandMinecart) {
        return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock();
    }
    if (sender instanceof RemoteConsoleCommandSender) {
        return ((DedicatedServer)MinecraftServer.getServer()).remoteControlCommandListener;
    }
    if (sender instanceof ConsoleCommandSender) {
        return ((CraftServer) sender.getServer()).getServer();
    }
    if (sender instanceof ProxiedCommandSender) {
        return ((ProxiedNativeCommandSender) sender).getHandle();
    }
    throw new IllegalArgumentException("Cannot make " + sender + " a vanilla command listener");
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:22,代碼來源:VanillaCommandWrapper.java

示例14: canUse

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
@Override
public boolean canUse(CommandSender sender, boolean showMessage) {
    boolean passBlock = sender instanceof BlockCommandSender;
    if (!passBlock && showMessage)
        sender.sendMessage(ChatColor.RED + "This command can only be in a command block.");
    return passBlock;
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:8,代碼來源:BlockCommand.java

示例15: getLocation

import org.bukkit.command.BlockCommandSender; //導入依賴的package包/類
public static Location getLocation(CommandSender sender) {
    if (sender instanceof Entity) {
        return ((Entity)sender).getLocation();
    } else if (sender instanceof BlockCommandSender) {
        return ((BlockCommandSender)sender).getBlock().getLocation().add(0.5f, 0.5f, 0.5f);
    }
    return null;
}
 
開發者ID:GameBoxx,項目名稱:GameBoxx,代碼行數:9,代碼來源:Utils.java


注:本文中的org.bukkit.command.BlockCommandSender類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。