Hi, i want to use World Edit selctions in my Plugin. But i can't find any informations how. Did anyone know how i can get the selction type, the selction corners and how to set the selction?
I use WorldEdit's API and WorldGuard's API for custom protections. Here is an example on what I do to create protected regions in some of my plugins: Code: public static void addProtectedRegion(Player player, World world, int x, int y, int z, int radius, int delay, Map flags) { // get the region manager RegionManager rm = worldGuard.getRegionManager(world); // make a cuboid with two points to create a 3d cube in the world BlockVector b1 = new BlockVector(x + radius + 1, y + radius + 1, z + radius + 1); BlockVector b2 = new BlockVector(x - radius - 1, y - radius - 1, z - radius - 1); // create the protected region ProtectedCuboidRegion pr = new ProtectedCuboidRegion(/* fill in a name here */, b1, b2); DefaultDomain dd = new DefaultDomain(); // add the player to the region dd.addPlayer(player.getName()); // set the player as the owner pr.setOwners(dd); // set the flags if (flags == null) { flags = new HashMap(); flags.put(DefaultFlag.BUILD, State.DENY); flags.put(DefaultFlag.CREEPER_EXPLOSIONS, State.DENY); // // put more flag definitions here // } pr.setFlags(flags); try { rm.save(); } catch (Exception exp) { } } And to get the "worldGuard" object, I use this method in my plugin: Code: public static WorldGuardPlugin getWorldGuard(JavaPlugin plugin) { Plugin wPlugin = plugin.getServer().getPluginManager().getPlugin("WorldGuard"); if ((wPlugin == null) || (!(wPlugin instanceof WorldGuardPlugin))) { return null; } return (WorldGuardPlugin) wPlugin; } Also, make sure you use imports similar to these: Code: com.sk89q.worldedit.* com.sk89q.worldguard.bukkit.* com.sk89q.worldguard.protection.* etc... The code I posted is just an example, and somewhat specific to my uses. I hope this gets you started using thes APIs.
To be honest, I'm not sure, I don't use WorldEdit that much. Try looking around the WorldEdit API: http://jd.evil-co.de/worldedit/ Or Google search posts related to the API: http://www.google.com/#hl=en&sclien....,cf.osb&fp=e721378064efdd41&biw=1920&bih=900
If I recall correctly, WorldEdit/Guard needs to be loaded as a plugin in order to make use of the API. Someone correct me if I'm wrong - it has been a while since I used WorldEdit/Guard.
Code: RegionManager rm = WorldGuardPlugin.getRegionManager(world); That line shows errors! It says "The method getRegionManager(World) in the type WorldGuardPlugin is not applicable for the arguments (World)"
It means that you must use variable "world" with type "World". Example: Code: World world = player.getWorld();