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


Java Selection.getLength方法代码示例

本文整理汇总了Java中com.sk89q.worldedit.bukkit.selections.Selection.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java Selection.getLength方法的具体用法?Java Selection.getLength怎么用?Java Selection.getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sk89q.worldedit.bukkit.selections.Selection的用法示例。


在下文中一共展示了Selection.getLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkConditions

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
public boolean checkConditions(Player p) {
	WorldEditPlugin worldEdit = (WorldEditPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
	Selection selection = worldEdit.getSelection(p);
	if (selection != null) {
		World world = selection.getWorld();
		if (selection.getHeight() == 1) {
			if (world.equals(getWorld())) {
				Location min = selection.getMinimumPoint();
				Location max = selection.getMaximumPoint();
				FloorPoints.set(min, max, Config.arenaName);
				this.cfg.set("configuration.floor.length", Integer.valueOf(selection.getLength()));
				this.cfg.set("configuration.floor.width", Integer.valueOf(selection.getWidth()));
				this.floorLength = selection.getLength();
				this.floorWidth = selection.getWidth();

				p.sendMessage(BlockParty.messageManager.SETUP_FLOOR_SET.replace("$ARENANAME$", Config.arenaName));
				return true;
			}
			p.sendMessage(BlockParty.messageManager.SETUP_FLOOR_ERROR_SAME_WORLD);
		} else {
			p.sendMessage(BlockParty.messageManager.SETUP_FLOOR_ERROR_MIN_HEIGHT);
		}
	} else {
		p.sendMessage(BlockParty.messageManager.SETUP_FLOOR_ERROR_WORLD_EDIT_SELECT);
	}
	return false;
}
 
开发者ID:Hansdekip,项目名称:BlockParty-1.8,代码行数:28,代码来源:Config.java

示例2: setBlocksTrigger

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
public static void setBlocksTrigger(Player p, int triggerIndex) {
    try {
        AnimationTrigger t = triggers.get(triggerIndex);
        if (!(t instanceof BlockInteractTrigger)) {
            p.sendMessage(ChatColor.RED + "Trigger at index #" + String.valueOf(triggerIndex) + " is not a Block Interaction trigger!");
            return;
        }

        Selection s = MCMEAnimations.WEPlugin.getSelection(p);
        if (s.getArea() > 16) {
            p.sendMessage(ChatColor.RED + "More than 16 blocks are selected! Create more triggers with less blocks each.");
            return;
        }
        if (s.getArea() == 0) {
            p.sendMessage(ChatColor.RED + "No blocks selected. Perform a WE selection before adding blocks to the trigger.");
            return;
        }

        ArrayList<Vector> locs = new ArrayList();

        int x1 = (int) s.getMinimumPoint().getX();
        int y1 = (int) s.getMinimumPoint().getY();
        int z1 = (int) s.getMinimumPoint().getZ();

        for (int x = x1; x < x1 + s.getWidth(); x++) {
            for (int y = y1; y < y1 + s.getHeight(); y++) {
                for (int z = z1; z < z1 + s.getLength(); z++) {
                    Vector v = new Vector(x, y, z);
                    locs.add(v);
                }
            }
        }

        t.setData(locs);
        p.sendMessage(ChatColor.BLUE + "Activation blocks stored.");
    } catch (Exception ex) {
        p.sendMessage(ChatColor.RED + "Could not set data for trigger at index #" + String.valueOf(triggerIndex) + "!");
    }
}
 
开发者ID:MCME,项目名称:Animations-Redux,代码行数:40,代码来源:AnimationFactory.java

示例3: onCommand

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (!(sender instanceof Player)) {
        sender.sendMessage(ChatColor.RED + "Only players can set event claim areas");
        return true;
    }

    if (args.length < 2) {
        sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
        return true;
    }

    WorldEditPlugin worldEditPlugin = plugin.getWorldEdit();

    if (worldEditPlugin == null) {
        sender.sendMessage(ChatColor.RED + "WorldEdit must be installed to set event claim areas.");
        return true;
    }

    Player player = (Player) sender;
    Selection selection = worldEditPlugin.getSelection(player);

    if (selection == null) {
        sender.sendMessage(ChatColor.RED + "You must make a WorldEdit selection to do this.");
        return true;
    }

    if (selection.getWidth() < MIN_EVENT_CLAIM_AREA || selection.getLength() < MIN_EVENT_CLAIM_AREA) {
        sender.sendMessage(ChatColor.RED + "Event claim areas must be at least " + MIN_EVENT_CLAIM_AREA + 'x' + MIN_EVENT_CLAIM_AREA + '.');
        return true;
    }

    Faction faction = plugin.getFactionManager().getFaction(args[1]);

    if (!(faction instanceof EventFaction)) {
        sender.sendMessage(ChatColor.RED + "There is not an event faction named '" + args[1] + "'.");
        return true;
    }

    ((EventFaction) faction).setClaim(new Cuboid(selection.getMinimumPoint(), selection.getMaximumPoint()), player);

    sender.sendMessage(ChatColor.YELLOW + "Updated the claim for event " + faction.getName() + ChatColor.YELLOW + '.');
    return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:45,代码来源:EventSetAreaArgument.java


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