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


Java Selection.getMaximumPoint方法代码示例

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


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

示例1: createLobbyFromSelection

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
public void createLobbyFromSelection(Player p, Game game){
    WorldEditPlugin worldEdit = plugin.getWorldEdit();
    Selection selection = worldEdit.getSelection(p);

    if(selection == null){
        MessageManager.getInstance().sendFMessage("error.noselection", p);
        return;
    }
    Location pos1 = selection.getMaximumPoint();//Max
    Location pos2 = selection.getMinimumPoint();//Min

    game.setLobby(new Lobby(pos1, pos2));

    YamlConfiguration config = SettingsManager.getInstance().getArenaConfig(game.getId());

    config.set("lobby.world", pos1.getWorld().getName());
    config.set("lobby.pos1.x", pos1.getBlockX());
    config.set("lobby.pos1.y", pos1.getBlockY());
    config.set("lobby.pos1.z", pos1.getBlockZ());
    config.set("lobby.pos2.x", pos2.getBlockX());
    config.set("lobby.pos2.y", pos2.getBlockY());
    config.set("lobby.pos2.z", pos2.getBlockZ());
    SettingsManager.getInstance().saveArenaConfig(game.getId());
    MessageManager.getInstance().sendFMessage("info.createlobby", p, "arena-" + game.getId());
}
 
开发者ID:endercrest,项目名称:ColorCube,代码行数:26,代码来源:LobbyManager.java

示例2: createArenaFromSelection

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
public void createArenaFromSelection(Player p){
    WorldEditPlugin we = plugin.getWorldEdit();
    Selection selection = we.getSelection(p);

    if(selection == null){
        msg.sendFMessage("error.noselection", p);
        return;
    }
    Location pos1 = selection.getMaximumPoint();
    Location pos2 = selection.getMinimumPoint();

    int id = settingsManager.getNextArenaID();
    YamlConfiguration config = SettingsManager.getInstance().createArenaConfig(id, pos1, pos2);
    if(config == null){
        MessageManager.getInstance().sendFMessage("error.nextid", p,
                "type-"+MessageManager.getInstance().getFValue("words.arena"));
        return;
    }
    SettingsManager.getInstance().incrementNextArenaId();
    addArena(id);
    msg.sendFMessage("info.create", p, "arena-" + id);
}
 
开发者ID:endercrest,项目名称:ColorCube,代码行数:23,代码来源:GameManager.java

示例3: 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

示例4: compare

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
@Override
public int compare(Selection o1, Selection o2) {
    Location o1Max = o1.getMaximumPoint();
    Location o1Min = o1.getMinimumPoint();
    Location o2Max = o2.getMaximumPoint();
    Location o2Min = o2.getMinimumPoint();
    int result;
    result = o1Max.getBlockX() - o2Max.getBlockX();
    if (result == 0) {
        result = o1Max.getBlockY() - o2Max.getBlockY();
        if (result == 0) {
            result = o1Max.getBlockZ() - o2Max.getBlockZ();
            if (result == 0) {
                result = o1Min.getBlockX() - o2Min.getBlockX();
                if (result == 0) {
                    result = o1Min.getBlockY() - o2Min.getBlockY();
                    if (result == 0) {
                        result = o1Min.getBlockZ() - o2Min.getBlockZ();
                        if (result == 0) {
                            result = o1.getWorld().getName().compareTo(o2.getWorld().getName());
                        }
                    }
                }
            }
        }
    }
    return result;
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:29,代码来源:Tools.java

示例5: toString

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
public static String toString(Selection sel) {
    Location min = sel.getMinimumPoint();
    Location max = sel.getMaximumPoint();
    return "X:" + min.getBlockX() + ", Y:" + min.getBlockY()
            + ", Z:" + min.getBlockZ() + " -> X:" + max.getBlockX()
            + ", Y:" + max.getBlockY() + ", Z:" + max.getBlockZ();
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:8,代码来源:Tools.java

示例6: getWorldEditRegionsInSelection

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
/**
 * Get all WorldGuard regions intersecting with a WorldEdit selection.
 * @param selection The selection to check
 * @return A list with all the WorldGuard regions intersecting with the selection
 */
public static List<ProtectedRegion> getWorldEditRegionsInSelection(Selection selection) {
	// Get all regions inside or intersecting with the WorldEdit selection of the player
	World world = selection.getWorld();
	RegionManager regionManager = AreaShop.getInstance().getWorldGuard().getRegionManager(world);
	ArrayList<ProtectedRegion> result = new ArrayList<>();
	Location selectionMin = selection.getMinimumPoint();
	Location selectionMax = selection.getMaximumPoint();
	for(ProtectedRegion region : regionManager.getRegions().values()) {
		BlockVector regionMin = region.getMinimumPoint();
		BlockVector regionMax = region.getMaximumPoint();
		if(
				(      // x part, resolves to true if the selection and region overlap anywhere on the x-axis
						(regionMin.getBlockX() <= selectionMax.getBlockX() && regionMin.getBlockX() >= selectionMin.getBlockX())
								|| (regionMax.getBlockX() <= selectionMax.getBlockX() && regionMax.getBlockX() >= selectionMin.getBlockX())
								|| (selectionMin.getBlockX() >= regionMin.getBlockX() && selectionMin.getBlockX() <= regionMax.getBlockX())
								|| (selectionMax.getBlockX() >= regionMin.getBlockX() && selectionMax.getBlockX() <= regionMax.getBlockX())
				) && ( // Y part, resolves to true if the selection and region overlap anywhere on the y-axis
						(regionMin.getBlockY() <= selectionMax.getBlockY() && regionMin.getBlockY() >= selectionMin.getBlockY())
								|| (regionMax.getBlockY() <= selectionMax.getBlockY() && regionMax.getBlockY() >= selectionMin.getBlockY())
								|| (selectionMin.getBlockY() >= regionMin.getBlockY() && selectionMin.getBlockY() <= regionMax.getBlockY())
								|| (selectionMax.getBlockY() >= regionMin.getBlockY() && selectionMax.getBlockY() <= regionMax.getBlockY())
				) && ( // Z part, resolves to true if the selection and region overlap anywhere on the z-axis
						(regionMin.getBlockZ() <= selectionMax.getBlockZ() && regionMin.getBlockZ() >= selectionMin.getBlockZ())
								|| (regionMax.getBlockZ() <= selectionMax.getBlockZ() && regionMax.getBlockZ() >= selectionMin.getBlockZ())
								|| (selectionMin.getBlockZ() >= regionMin.getBlockZ() && selectionMin.getBlockZ() <= regionMax.getBlockZ())
								|| (selectionMax.getBlockZ() >= regionMin.getBlockZ() && selectionMax.getBlockZ() <= regionMax.getBlockZ())
				)
		) {
			result.add(region);
		}
	}
	return result;
}
 
开发者ID:NLthijs48,项目名称:AreaShop,代码行数:39,代码来源:Utils.java

示例7: hasSelected

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
public boolean hasSelected(Player player) {
    final Selection selection = WORLDEDIT.getSelection(player);
    if (selection == null || selection.getMinimumPoint() == null || selection.getMaximumPoint() == null) {
        return false;
    }
    return true;
}
 
开发者ID:KodekPL,项目名称:jCustomPortals,代码行数:8,代码来源:WorldEditHandler.java

示例8: createPortalCmd

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
/***************/

    public void createPortalCmd(Player player, String permission, String[] args) {
        if (!hasPermission(player, permission)) return;

        final String portalName = args[2].toLowerCase();
        final CustomPortal portal = CustomPortal.getPortal(portalName);
        if (portal != null) {
            player.sendMessage(CustomPortalsPlugin.PREFIX + ChatColor.RED + "Portal with this name already exists!");
            return;
        }

        final String destinationName = args[3].toLowerCase();
        final Location destination = CustomPortal.getDestination(destinationName);
        if (destination == null) {
            player.sendMessage(CustomPortalsPlugin.PREFIX + ChatColor.RED + "Destination with this name does not exists!");
            return;
        }

        if (!CustomPortalsPlugin.getWorldEdit().hasSelected(player)) {
            player.sendMessage(CustomPortalsPlugin.PREFIX + ChatColor.RED + "You need to first select region with WorldEdit to create portal!");
            return;
        }

        final Selection selection = CustomPortalsPlugin.getWorldEdit().getSelection(player);
        if (selection instanceof CuboidSelection) {
            final Location loc1 = selection.getMinimumPoint();
            final Location loc2 = selection.getMaximumPoint();

            final PortalLocation pLoc = new PortalLocation(selection.getWorld(), new Vector(loc1.getBlockX(), loc1.getBlockY(), loc1.getBlockZ()),
                    new Vector(loc2.getBlockX(), loc2.getBlockY(), loc2.getBlockZ()));
            CustomPortal.addPortal(portalName, new CustomPortal(portalName, pLoc, destinationName), true);
            player.sendMessage(CustomPortalsPlugin.PREFIX + ChatColor.GREEN + "Portal with name '" + portalName + "' has been created and saved!");
        } else {
            player.sendMessage(CustomPortalsPlugin.PREFIX + ChatColor.RED + "Selection type need to be cuboid!");
        }
    }
 
开发者ID:KodekPL,项目名称:jCustomPortals,代码行数:38,代码来源:CommandsHandler.java

示例9: modifyPortalLocationCmd

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
public void modifyPortalLocationCmd(Player player, String permission, String[] args) {
    if (!hasPermission(player, permission)) return;

    final String portalName = args[3].toLowerCase();
    final CustomPortal portal = CustomPortal.getPortal(portalName);
    if (portal == null) {
        player.sendMessage(CustomPortalsPlugin.PREFIX + ChatColor.RED + "Portal with this name does not exists!");
        return;
    }

    if (!CustomPortalsPlugin.getWorldEdit().hasSelected(player)) {
        player.sendMessage(CustomPortalsPlugin.PREFIX + ChatColor.RED + "You need to first select region with WorldEdit to modify portal!");
        return;
    }

    final Selection selection = CustomPortalsPlugin.getWorldEdit().getSelection(player);
    if (selection instanceof CuboidSelection) {
        final Location loc1 = selection.getMinimumPoint();
        final Location loc2 = selection.getMaximumPoint();

        final PortalLocation pLoc = new PortalLocation(selection.getWorld(), new Vector(loc1.getBlockX(), loc1.getBlockY(), loc1.getBlockZ()),
                new Vector(loc2.getBlockX(), loc2.getBlockY(), loc2.getBlockZ()));
        CustomPortal.removePortal(portal.getName(), portal.getLocation().getWorld());
        CustomPortal.addPortal(portal.getName(), new CustomPortal(portal.getName(), pLoc, portal.getDestination()), true);
        player.sendMessage(CustomPortalsPlugin.PREFIX + ChatColor.GREEN + "Portal with name '" + portalName + "' has been modified and saved!");
    } else {
        player.sendMessage(CustomPortalsPlugin.PREFIX + ChatColor.RED + "Selection type need to be cuboid!");
    }
}
 
开发者ID:KodekPL,项目名称:jCustomPortals,代码行数:30,代码来源:CommandsHandler.java

示例10: getSelection

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
public static Location[] getSelection(Player p) {
    WorldEditPlugin we = getWorldEdit();
    Selection sel = we.getSelection(p);
    if (sel == null) {
        return null;
    }
    Location max = sel.getMaximumPoint();
    Location min = sel.getMinimumPoint();
    return new Location[]{min, max};
}
 
开发者ID:BossLetsPlays,项目名称:Minotaurus,代码行数:11,代码来源:SelectionManager.java

示例11: getSelection

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
@Override
public IRegionSelection getSelection(Player player) {
    PreCon.notNull(player);

    // Check that World Edit is installed
    if (!isWorldEditInstalled()) {
        return null;
    }

    WorldEditPlugin plugin = (WorldEditPlugin)_wePlugin;
    Selection sel;

    synchronized (_sync) {

        // Check for World Edit selection
        if ((sel = plugin.getSelection(player)) == null) {
            return null;
        }

        // Make sure both points are selected
        if (sel.getMaximumPoint() == null || sel.getMinimumPoint() == null) {
            return null;
        }

        if (!sel.getMaximumPoint().getWorld().equals(sel.getMinimumPoint().getWorld())) {
            return null;
        }

        return new SimpleRegionSelection(sel.getMinimumPoint(), sel.getMaximumPoint());
    }
}
 
开发者ID:JCThePants,项目名称:NucleusFramework,代码行数:32,代码来源:WorldEditSelectionProvider.java

示例12: getMaxPoint

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
public final Location getMaxPoint(Player player)
{
	if (! isEnabled())
		return null;

	try
	{
		Selection selection = getSelection(player);
		return selection != null ? selection.getMaximumPoint() : null;
	} catch (Throwable ex) { }
	return null;
}
 
开发者ID:dmulloy2,项目名称:SwornParkour,代码行数:13,代码来源:WorldEditHandler.java

示例13: getPlayerSelection

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
private Location[] getPlayerSelection(Player player) {
	Location[] locs = new Location[2];
	Selection psel = we.getSelection(player);
	locs[0] = psel.getMinimumPoint();
	locs[1] = psel.getMaximumPoint();
	return locs;
}
 
开发者ID:ShevchikUnsupportedProjects,项目名称:TNTRun,代码行数:8,代码来源:WEIntegration.java

示例14: run

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
@Override
public void run(DuelArena duelArena, CommandSender sender, String subCmd, String[] args) {
    if (!(sender instanceof Player)) {
        Util.sendMsg(sender, NO_CONSOLE);
        return;
    }

    if (args.length < 1) {
        Util.sendMsg(sender, ChatColor.GREEN + "Usage: /dueladmin create <arenaname>");
        return;
    }

    Player p = (Player) sender;

    Location pos1 = null;
    Location pos2 = null;

    WorldEditPlugin worldEdit = (WorldEditPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
    Selection selection = worldEdit.getSelection(p);

    if (selection != null) {
        World world = selection.getWorld();
        pos1 = selection.getMinimumPoint();
        pos2 = selection.getMaximumPoint();
    } else {
        Util.sendMsg(p, ChatColor.RED + "You have not selected a region, please select one first!");
        return;
    }
    String arenaName = getValue(args, 0, "Arena");

    DuelManager dm = plugin.getDuelManager();

    for (DuelArena da : dm.getDuelArenas()) {
        if (da.getName().equalsIgnoreCase(arenaName)) {
            Util.sendMsg(sender, ChatColor.RED + "There is already a duel arena with the name " + arenaName + ".");
            return;
        }
    }

    DuelArena newArena = new DuelArena(arenaName, pos1, pos2);

    dm.addDuelArena(newArena);

    Util.sendMsg(sender, ChatColor.GREEN + "Created a new Duel arena called " + ChatColor.GOLD + arenaName + ".");

}
 
开发者ID:teozfrank,项目名称:DuelMe,代码行数:47,代码来源:CreateCmd.java

示例15: process

import com.sk89q.worldedit.bukkit.selections.Selection; //导入方法依赖的package包/类
@Override
protected void process() throws CommandException
{
	try
	{
		reg = gv.regionManager.findRegion(args[0]);
		
		if (gv.gameManager.isBeingPlayed(reg))
			throw new CommandException("Une partie est en cours sur cette ar�ne");
		
		if (argsCount == 8)
		{				
			final Location pt1 = BukkitUtils.parseLocation(args[1], Arrays.copyOfRange(args, 2, 5));
			final Location pt2 = BukkitUtils.parseLocation(args[1], Arrays.copyOfRange(args, 5, 8));
			
			container = new AreaContainer(pt1, pt2);
		}
		else
		{
			if (isSenderConsole())
				throw new CommandException("Les coordonn�es sont obligatoires depuis la console");
			
			if (!gv.configurationHandler.worldEdit)
				throw new CommandException("WorldEdit doit �tre actif pour utiliser la s�lection");
			
			final Selection sel = gv.worldEdit.getSelection((Player)sender);
			
			if (sel == null)
				throw new CommandException("Vous devez d'abord s�lectionner une r�gion");
			
			if (!(sel instanceof CuboidSelection))
				throw new CommandException("La s�lection doit �tre cubique");
			
			container = new AreaContainer(sel.getMinimumPoint(), sel.getMaximumPoint());
		}
	}
	catch (Exception e)
	{
		throw new CommandException(e.getMessage());
	}
}
 
开发者ID:riking,项目名称:GrandVide,代码行数:42,代码来源:CommandSetLocation.java


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