Package com.sk89q.worldedit.bukkit.selections

Examples of com.sk89q.worldedit.bukkit.selections.Selection


    } else if (this.args.length > 2) {
      return false;
    } else if (this.args.length == 1) {
      if (War.war.getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
        WorldEditPlugin worldEdit = (WorldEditPlugin) War.war.getServer().getPluginManager().getPlugin("WorldEdit");
        Selection selection = worldEdit.getSelection(player);
        if (selection != null && selection instanceof CuboidSelection) {
          Location min = selection.getMinimumPoint();
          Location max = selection.getMaximumPoint();
          ZoneSetter setter = new ZoneSetter(player, this.args[0]);
          setter.placeCorner1(min.getBlock());
          setter.placeCorner2(max.getBlock());
          return true;
        }
View Full Code Here


        try {
            WorldEditPlugin worldEdit = CraftBookPlugin.plugins.getWorldEdit();

            World world = ((Player) sender).getWorld();
            Selection sel = worldEdit.getSelection((Player) sender);
            if(sel == null) {
                sender.sendMessage(ChatColor.RED + "You have not made a selection!");
                return;
            }
            Vector min = BukkitUtil.toVector(sel.getMinimumPoint());
            Vector max = BukkitUtil.toVector(sel.getMaximumPoint());
            Vector size = max.subtract(min).add(1, 1, 1);

            // Check maximum size
            if (Area.instance.maxAreaSize != -1 && size.getBlockX() * size.getBlockY() * size.getBlockZ()
                    > Area.instance.maxAreaSize) {
View Full Code Here

    }

    @Override
    public boolean worldEdit(Player player) {
        WorldEditPlugin wep = (WorldEditPlugin) server.getPluginManager().getPlugin("WorldEdit");
        Selection sel = wep.getSelection(player);
        if(sel!=null)
        {
            Location pos1 = sel.getMinimumPoint();
            Location pos2 = sel.getMaximumPoint();   
            try{
          CuboidRegion region = (CuboidRegion) sel.getRegionSelector().getRegion();
          pos1 = new Location(player.getWorld(), region.getPos1().getX(), region.getPos1().getY(), region.getPos1().getZ());
          pos2 = new Location(player.getWorld(), region.getPos2().getX(), region.getPos2().getY(), region.getPos2().getZ());
            }catch(Exception e){
            }
            this.playerLoc1.put(player.getName(), pos1);
View Full Code Here

    {
      if (hasPlacedBoth(player.getName()))
      {
            WorldEditPlugin wep = (WorldEditPlugin) server.getPluginManager().getPlugin("WorldEdit");
            World world = playerLoc1.get(player.getName()).getWorld();
            Selection selection = new CuboidSelection(world, playerLoc1.get(player.getName()), playerLoc2.get(player.getName()));
            wep.setSelection(player, selection);
      }
    }
View Full Code Here

  public void createArenaFromSelection(Player pl) {
    FileConfiguration c = SettingsManager.getInstance().getSystemConfig();
    //SettingsManager s = SettingsManager.getInstance();

    WorldEditPlugin we = p.getWorldEdit();
    Selection sel = we.getSelection(pl);
    if (sel == null) {
      msgmgr.sendMessage(PrefixType.WARNING, "You must make a WorldEdit Selection first!", pl);
      return;
    }
    Location max = sel.getMaximumPoint();
    Location min = sel.getMinimumPoint();

    /* if(max.getWorld()!=SettingsManager.getGameWorld() || min.getWorld()!=SettingsManager.getGameWorld()){
            pl.sendMessage(ChatColor.RED+"Wrong World!");
            return;
        }*/
 
View Full Code Here

public class Test implements SubCommand{

  @Override
  public boolean onCommand(Player player, String[] args) {
    WorldEditPlugin we = GameManager.getInstance().getWorldEdit();
    Selection sel = we.getSelection(player);
    if (sel == null) {
      return false;
    }
    Location max = sel.getMaximumPoint();
    Location min = sel.getMinimumPoint();
   
    World w = max.getWorld();
   
    HashSet<Location> mark = new HashSet<Location>();
   
View Full Code Here

            c.set("sg-system.lobby.sign.set", true);
            s.saveSystemConfig();
        }

        WorldEditPlugin we = p.getWorldEdit();
        Selection sel = we.getSelection(pl);
        if (sel == null) {
            pl.sendMessage(ChatColor.RED + "You must make a WorldEdit Selection first");
            return;
        }
        if ((sel.getNativeMaximumPoint().getBlockX() - sel.getNativeMaximumPoint().getBlockX()) != 0 && (sel.getNativeMaximumPoint().getBlockZ() - sel.getNativeMaximumPoint().getBlockZ() != 0)) {
            pl.sendMessage(ChatColor.RED + " Must be in a straight line!");
            return;
        }

        Vector max = sel.getNativeMaximumPoint();
        Vector min = sel.getNativeMinimumPoint();

        c.set("sg-system.lobby.sign.world", pl.getWorld().getName());
        c.set("sg-system.lobby.sign.x1", max.getBlockX());
        c.set("sg-system.lobby.sign.y1", max.getBlockY());
        c.set("sg-system.lobby.sign.z1", max.getBlockZ());
View Full Code Here

    if (!c.getBoolean("sg-system.lobby.sign.set", false)) {
      c.set("sg-system.lobby.sign.set", true);
      s.saveSystemConfig();
    }
    WorldEditPlugin we = GameManager.getInstance().getWorldEdit();
    Selection sel = we.getSelection(pl);
    if (sel == null) {
      pl.sendMessage(ChatColor.RED + "You must make a WorldEdit Selection first");
      return;
    }
    if ((sel.getNativeMaximumPoint().getBlockX() - sel.getNativeMinimumPoint().getBlockX()) != 0 && (sel.getNativeMinimumPoint().getBlockZ() - sel.getNativeMaximumPoint().getBlockZ() != 0)) {
      pl.sendMessage(ChatColor.RED + " Must be in a straight line!");
      return;
    }
    Vector max = sel.getNativeMaximumPoint();
    Vector min = sel.getNativeMinimumPoint();
    int i = c.getInt("sg-system.lobby.signno", 0) + 1;
    c.set("sg-system.lobby.signno", i);
    c.set("sg-system.lobby.signs." + i + ".id", a);
    c.set("sg-system.lobby.signs." + i + ".world", pl.getWorld().getName());
    c.set("sg-system.lobby.signs." + i + ".x1", max.getBlockX());
View Full Code Here

        }
        // Radius
        else if (lastParam.equals("r") && player instanceof Player) {
          if (!Util.isInteger(values[0])) {
            if ((values[0].equalsIgnoreCase("we") || values[0].equalsIgnoreCase("worldedit")) && HawkEye.worldEdit != null) {
              Selection sel = HawkEye.worldEdit.getSelection((Player) player);
              double lRadius = Math.ceil(sel.getLength() / 2);
              double wRadius = Math.ceil(sel.getWidth() / 2);
              double hRadius = Math.ceil(sel.getHeight() / 2);

              if (Config.MaxRadius != 0 && (lRadius > Config.MaxRadius || wRadius > Config.MaxRadius || hRadius > Config.MaxRadius))
                throw new IllegalArgumentException("Selection too large, max radius: &7" + Config.MaxRadius);

              worldedit = true;
              minLoc = new Vector(sel.getMinimumPoint().getX(), sel.getMinimumPoint().getY(), sel.getMinimumPoint().getZ());
              maxLoc = new Vector(sel.getMaximumPoint().getX(), sel.getMaximumPoint().getY(), sel.getMaximumPoint().getZ());
            } else {
              throw new IllegalArgumentException("Invalid radius supplied: &7" + values[0]);
            }
          } else {
            radius = Integer.parseInt(values[0]);
View Full Code Here

      sender.sendMessage(ChatColor.DARK_GRAY + "No valid team names given.");
      sender.sendMessage("Teams are " + match.getTeamList());
      return true;
    }

    Selection sel = worldEdit.getSelection(player);
    AutoRefRegion reg = null;

    if ((sel instanceof CuboidSelection))
    {
      CuboidSelection csel = (CuboidSelection) sel;
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.bukkit.selections.Selection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.