本文整理匯總了Java中com.sk89q.worldguard.protection.managers.RegionManager.removeRegion方法的典型用法代碼示例。如果您正苦於以下問題:Java RegionManager.removeRegion方法的具體用法?Java RegionManager.removeRegion怎麽用?Java RegionManager.removeRegion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sk89q.worldguard.protection.managers.RegionManager
的用法示例。
在下文中一共展示了RegionManager.removeRegion方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
protected void execute(Event event) {
String name = (String) this.name.getSingle(event);
World world = (World) this.world.getSingle(event);
RegionManager regionManager = WGBukkit.getRegionManager(world);
if (!regionManager.hasRegion(name)) {
Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
return;
}
regionManager.removeRegion(name, RemovalStrategy.REMOVE_CHILDREN);
try {
regionManager.save();
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: onUpdate
import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
public void onUpdate(ObjectId updatedObject) {
ProcessingProtectedRegion region = storageAdapter.load(updatedObject);
ProtectedRegion protectedRegion = region.getRegion();
if (checkIsIgnored(RegionStorageAdapter.RegionPath.create(region.getWorld(), protectedRegion.getId())))
return;
RegionManager regionManager = getRegionManager(region.getWorld());
if (regionManager != null) {
regionManager.removeRegion(protectedRegion.getId());
regionManager.addRegion(protectedRegion);
String parent = region.getParent();
if (parent != null) {
try {
protectedRegion.setParent(regionManager.getRegion(parent));
} catch (ProtectedRegion.CircularInheritanceException ignore) {
LOGGER.warning("Circular inheritance for region " + protectedRegion.getId() + " of world " + region.getWorld() + ".");
}
}
}
}
示例3: updateRegion
import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public static void updateRegion(IslandInfo islandInfo) {
try {
ProtectedCuboidRegion region = setRegionFlags(islandInfo);
RegionManager regionManager = getWorldGuard().getRegionManager(uSkyBlock.getInstance().getWorld());
regionManager.removeRegion(islandInfo.getName() + "island");
regionManager.removeRegion(islandInfo.getLeader() + "island");
regionManager.addRegion(region);
String netherName = islandInfo.getName() + "nether";
region = setRegionFlags(islandInfo, netherName);
World netherWorld = uSkyBlock.getInstance().getSkyBlockNetherWorld();
if (netherWorld != null) {
regionManager = getWorldGuard().getRegionManager(netherWorld);
regionManager.removeRegion(netherName);
regionManager.addRegion(region);
}
islandInfo.setRegionVersion(getVersion());
} catch (Exception e) {
LogUtil.log(Level.SEVERE, "ERROR: Failed to update region for " + islandInfo.getName(), e);
}
}
示例4: spatial_remove
import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public boolean spatial_remove(final ABPortal portal) {
final SafeLocation location = portal.getLocation();
if ( location == null )
return true;
final HashSet<UUID> portals = worldPortals.get(location.getWorldId());
if ( portals != null && portals.contains(portal.uid) )
portals.remove(portal.uid);
final World world = location.getWorld();
if ( world == null )
return true;
final RegionManager rm = wg.getRegionManager(world);
if ( rm == null )
return true;
final String key = "abyss-" + portal.uid.toString();
if ( rm.hasRegion(key) )
rm.removeRegion(key);
return true;
}
示例5: deletarTerreno
import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public static void deletarTerreno(String player, String nome) {
World w = TerrenosManager.getTerrenoWorld(player, nome);
RegionManager rm = wg.getRegionManager(w);
ProtectedRegion terreno = TerrenosManager.getTerreno(player, nome);
delTerreno(w, terreno.getMinimumPoint(),terreno.getMaximumPoint());
rm.removeRegion(player.toLowerCase() + "-" + nome);
FilesManager.getDataFile().set(player.toLowerCase() + "." + nome.toLowerCase(), null);
FilesManager.saveDataFile();
try {
rm.save();
} catch (Exception e) {
Utils.logError("Ocorreu um erro ao salvar os terrenos");
e.printStackTrace();
}
}
示例6: removeProtection
import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public boolean removeProtection(World world, ProtectedRegion pr) {
RegionManager rm = wgp.getRegionManager(world);
rm.removeRegion(pr.getId());
try {
rm.save();
} catch (ProtectionDatabaseException ex) {
plugin.getLogger().log(Level.SEVERE, "Unexpected failure saving WorldGuard configuration: {0}", ex.toString());
return false;
}
return true;
}
示例7: onDelete
import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
public void onDelete(ObjectId deletedObject) {
RegionStorageAdapter.RegionPath path = storageAdapter.resolvePath(deletedObject);
RegionManager regionManager = getRegionManager(path);
if (regionManager != null)
regionManager.removeRegion(path.getId());
}
示例8: removeRegion
import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public RegionData removeRegion(RegionData regionData, World world) {
RegionManager manager = CubitBukkitPlugin.inst().getWorldGuardPlugin().getRegionManager(world);
manager.removeRegion(regionData.getRegionName());
return regionData;
}
示例9: removeIslandRegion
import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
public static void removeIslandRegion(String islandName) {
RegionManager regionManager = getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld());
regionManager.removeRegion(islandName + "island");
regionManager.removeRegion(islandName + "nether");
}
示例10: exec
import com.sk89q.worldguard.protection.managers.RegionManager; //導入方法依賴的package包/類
@Override
public Construct exec(Target t, Environment env, Construct... args) throws CancelCommandException, ConfigRuntimeException {
Static.checkPlugin("WorldGuard", t);
World world = null;
String region;
if (args.length == 1) {
region = args[0].val();
MCPlayer m = null;
if (env.getEnv(CommandHelperEnvironment.class).GetCommandSender() instanceof MCPlayer) {
m = env.getEnv(CommandHelperEnvironment.class).GetPlayer();
}
if (m != null) {
world = Bukkit.getServer().getWorld(m.getWorld().getName());
}
} else {
region = args[1].val();
world = Bukkit.getServer().getWorld(args[0].val());
}
if (world == null) {
throw new CREInvalidWorldException("Unknown world specified", t);
}
RegionManager mgr = WorldGuardPlugin.inst().getRegionManager(world);
ProtectedRegion regionExists = mgr.getRegion(region);
if (regionExists == null) {
throw new CREPluginInternalException(String.format("The region (%s) does not exist in world (%s).", region, world.getName()), t);
}
mgr.removeRegion(region);
try {
mgr.save();
} catch (StorageException e) {
throw new CREPluginInternalException("Error while removing protected region", t, e);
}
return CVoid.VOID;
}