Updated WorldEdit and WorldGuard to 7.0.0
It doesn't work without them atm because it tries to load a class from them
This commit is contained in:
parent
24ed3393d3
commit
14bdf0ebe0
6 changed files with 1093 additions and 1089 deletions
34
pom.xml
34
pom.xml
|
@ -49,7 +49,7 @@
|
||||||
<!-- Official WorldGuard and WorldEdit repository -->
|
<!-- Official WorldGuard and WorldEdit repository -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>sk89q-mvn2</id>
|
<id>sk89q-mvn2</id>
|
||||||
<url>http://maven.sk89q.com/repo</url>
|
<url>https://maven.enginehub.org/repo/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<!-- Official Multiverse repository -->
|
<!-- Official Multiverse repository -->
|
||||||
<repository>
|
<repository>
|
||||||
|
@ -81,23 +81,29 @@
|
||||||
<artifactId>plib</artifactId>
|
<artifactId>plib</artifactId>
|
||||||
<version>${plib.version}</version>
|
<version>${plib.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<!-- http://dl.bukkit.org/ -->
|
||||||
|
<groupId>org.bukkit</groupId>
|
||||||
|
<artifactId>bukkit</artifactId>
|
||||||
|
<version>${bukkit.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<!-- http://dl.bukkit.org/ -->
|
||||||
|
<groupId>org.bukkit.</groupId> <!-- Needed for WE integration -->
|
||||||
|
<artifactId>bukkit</artifactId>
|
||||||
|
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<!-- http://dl.bukkit.org/ -->
|
<!-- http://dev.bukkit.org/server-mods/worldguard/ -->
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>com.sk89q.worldguard</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>worldguard-bukkit</artifactId>
|
||||||
<version>${bukkit.version}</version>
|
<version>7.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<!-- http://dev.bukkit.org/server-mods/worldguard/ -->
|
<!-- http://dev.bukkit.org/server-mods/worldguard/ -->
|
||||||
<groupId>com.sk89q</groupId>
|
<groupId>com.sk89q.worldedit</groupId>
|
||||||
<artifactId>worldguard</artifactId>
|
<artifactId>worldedit-bukkit</artifactId>
|
||||||
<version>6.1</version>
|
<version>7.0.0</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<!-- http://dev.bukkit.org/server-mods/worldguard/ -->
|
|
||||||
<groupId>com.sk89q</groupId>
|
|
||||||
<artifactId>worldedit</artifactId>
|
|
||||||
<version>6.0.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<!-- http://dev.bukkit.org/server-mods/authme-reloaded/ -->
|
<!-- http://dev.bukkit.org/server-mods/authme-reloaded/ -->
|
||||||
|
|
|
@ -1,23 +1,14 @@
|
||||||
package de.jaschastarke.minecraft.limitedcreative.blockstate;
|
package de.jaschastarke.minecraft.limitedcreative.blockstate;
|
||||||
|
|
||||||
import java.util.Date;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import org.bukkit.Bukkit;
|
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||||
import org.bukkit.GameMode;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import org.bukkit.Location;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import org.bukkit.Material;
|
import com.sk89q.worldedit.world.World;
|
||||||
import org.bukkit.World;
|
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
|
||||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
|
||||||
|
|
||||||
import de.jaschastarke.LocaleString;
|
import de.jaschastarke.LocaleString;
|
||||||
import de.jaschastarke.bukkit.lib.chat.ChatFormattings;
|
import de.jaschastarke.bukkit.lib.chat.ChatFormattings;
|
||||||
import de.jaschastarke.bukkit.lib.commands.BukkitCommand;
|
import de.jaschastarke.bukkit.lib.commands.*;
|
||||||
import de.jaschastarke.bukkit.lib.commands.CommandContext;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.CommandException;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.HelpCommand;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.IHelpDescribed;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.MissingPermissionCommandException;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.annotations.IsCommand;
|
import de.jaschastarke.bukkit.lib.commands.annotations.IsCommand;
|
||||||
import de.jaschastarke.bukkit.lib.commands.annotations.Usages;
|
import de.jaschastarke.bukkit.lib.commands.annotations.Usages;
|
||||||
import de.jaschastarke.bukkit.lib.commands.parser.DefinedParameterParser;
|
import de.jaschastarke.bukkit.lib.commands.parser.DefinedParameterParser;
|
||||||
|
@ -32,6 +23,11 @@ import de.jaschastarke.minecraft.limitedcreative.blockstate.BlockState.Source;
|
||||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.DBModel.Cuboid;
|
import de.jaschastarke.minecraft.limitedcreative.blockstate.DBModel.Cuboid;
|
||||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.DBModel.DBTransaction;
|
import de.jaschastarke.minecraft.limitedcreative.blockstate.DBModel.DBTransaction;
|
||||||
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
|
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LimitedCreative-BlockState-Command: modify blockstate database to prevent drops of selected blocks (requires WorldEdit)
|
* LimitedCreative-BlockState-Command: modify blockstate database to prevent drops of selected blocks (requires WorldEdit)
|
||||||
|
@ -155,16 +151,21 @@ public class BlockStateCommand extends BukkitCommand implements IHelpDescribed {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldEditPlugin we = (WorldEditPlugin) mod.getPlugin().getServer().getPluginManager().getPlugin("WorldEdit");
|
BukkitPlayer bp = BukkitAdapter.adapt(context.getPlayer());
|
||||||
final Selection selection = we.getSelection(context.getPlayer());
|
Region region = null;
|
||||||
|
try {
|
||||||
|
region = WorldEdit.getInstance().getSessionManager().get(bp).getSelection(bp.getWorld());
|
||||||
|
} catch (Exception ignored) { //IncompleteRegionException
|
||||||
|
}
|
||||||
|
|
||||||
|
final Region selection = region;
|
||||||
if (selection == null) {
|
if (selection == null) {
|
||||||
context.response(L("command.blockstate.worledit_selection_empty"));
|
context.response(L("command.blockstate.worledit_selection_empty"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Location min = selection.getMinimumPoint();
|
final BlockVector3 min = selection.getMinimumPoint();
|
||||||
final Location max = selection.getMaximumPoint();
|
final BlockVector3 max = selection.getMaximumPoint();
|
||||||
|
|
||||||
mod.getPlugin().getServer().getScheduler().runTaskAsynchronously(mod.getPlugin(), new Runnable() {
|
mod.getPlugin().getServer().getScheduler().runTaskAsynchronously(mod.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -174,10 +175,12 @@ public class BlockStateCommand extends BukkitCommand implements IHelpDescribed {
|
||||||
DBTransaction update = mod.getModel().groupUpdate();
|
DBTransaction update = mod.getModel().groupUpdate();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
World w = selection.getWorld();
|
World w = selection.getWorld();
|
||||||
|
assert w != null;
|
||||||
|
org.bukkit.World bw = BukkitAdapter.adapt(w);
|
||||||
|
|
||||||
Cuboid c = new Cuboid();
|
Cuboid c = new Cuboid();
|
||||||
c.add(min);
|
c.add(new Location(bw, min.getBlockX(), min.getBlockY(), min.getBlockZ()));
|
||||||
c.add(max);
|
c.add(new Location(bw, max.getBlockX(), max.getBlockY(), max.getBlockZ()));
|
||||||
mod.getModel().cacheStates(c);
|
mod.getModel().cacheStates(c);
|
||||||
|
|
||||||
BlockState seed = new BlockState();
|
BlockState seed = new BlockState();
|
||||||
|
@ -188,9 +191,9 @@ public class BlockStateCommand extends BukkitCommand implements IHelpDescribed {
|
||||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
||||||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
||||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
||||||
Location loc = new Location(w, x, y, z);
|
BlockVector3 loc = BlockVector3.at(x, y, z);
|
||||||
if (w.getBlockAt(loc).getType() != Material.AIR && selection.contains(loc)) {
|
if (!w.getBlock(loc).getBlockType().getMaterial().isAir() && selection.contains(loc)) {
|
||||||
seed.setLocation(loc);
|
seed.setLocation(new Location(bw, x, y, z));
|
||||||
update.setState(new BlockState(seed));
|
update.setState(new BlockState(seed));
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
package de.jaschastarke.minecraft.limitedcreative.blockstate.worldedit;
|
package de.jaschastarke.minecraft.limitedcreative.blockstate.worldedit;
|
||||||
|
|
||||||
import java.util.Date;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
import de.jaschastarke.minecraft.limitedcreative.ModBlockStates;
|
||||||
|
import de.jaschastarke.minecraft.limitedcreative.blockstate.BlockState;
|
||||||
|
import de.jaschastarke.minecraft.limitedcreative.blockstate.BlockState.Source;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import java.util.Date;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
|
||||||
import com.sk89q.worldedit.extent.logging.AbstractLoggingExtent;
|
|
||||||
|
|
||||||
import de.jaschastarke.minecraft.limitedcreative.ModBlockStates;
|
public class EditSessionExtent extends AbstractDelegateExtent {
|
||||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.BlockState;
|
|
||||||
import de.jaschastarke.minecraft.limitedcreative.blockstate.BlockState.Source;
|
|
||||||
|
|
||||||
public class EditSessionExtent extends AbstractLoggingExtent {
|
|
||||||
private ModBlockStates mod;
|
private ModBlockStates mod;
|
||||||
private Player player = null;
|
private Player player = null;
|
||||||
private World world;
|
private World world;
|
||||||
|
@ -30,14 +29,15 @@ public class EditSessionExtent extends AbstractLoggingExtent {
|
||||||
/**
|
/**
|
||||||
* Called when a block is being changed.
|
* Called when a block is being changed.
|
||||||
*
|
*
|
||||||
* @param position the position
|
* @param pt the position
|
||||||
* @param newBlock the new block to replace the old one
|
* @param newBlock the new block to replace the old one
|
||||||
*/
|
*/
|
||||||
protected void onBlockChange(Vector pt, BaseBlock newBlock) {
|
@Override
|
||||||
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 pt, T newBlock) throws WorldEditException {
|
||||||
if (mod.isDebug())
|
if (mod.isDebug())
|
||||||
mod.getLog().debug("WorldEdit-Integration: BlockChange: "+pt.toString()+" BB: " + newBlock.toString());
|
mod.getLog().debug("WorldEdit-Integration: BlockChange: "+pt.toString()+" BB: " + newBlock.toString());
|
||||||
Location loc = new Location(world, pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
Location loc = new Location(world, pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||||
if (newBlock.getType() == 0) {
|
if (newBlock.getBlockType().getMaterial().isAir()) {
|
||||||
mod.getModel().removeState(loc.getBlock());
|
mod.getModel().removeState(loc.getBlock());
|
||||||
} else {
|
} else {
|
||||||
BlockState s = mod.getModel().getState(loc.getBlock());
|
BlockState s = mod.getModel().getState(loc.getBlock());
|
||||||
|
@ -54,5 +54,6 @@ public class EditSessionExtent extends AbstractLoggingExtent {
|
||||||
|
|
||||||
mod.getModel().setState(s);
|
mod.getModel().setState(s);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
package de.jaschastarke.minecraft.limitedcreative.regions;
|
package de.jaschastarke.minecraft.limitedcreative.regions;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
|
import com.sk89q.worldguard.protection.flags.FlagContext;
|
||||||
import com.sk89q.worldguard.protection.flags.InvalidFlagFormat;
|
import com.sk89q.worldguard.protection.flags.InvalidFlagFormat;
|
||||||
import com.sk89q.worldguard.protection.flags.RegionGroup;
|
import com.sk89q.worldguard.protection.flags.RegionGroup;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Well, that was an interesting idea, but it doesn't work.
|
* Well, that was an interesting idea, but it doesn't work.
|
||||||
|
@ -17,7 +15,8 @@ public class GameModeFlag extends Flag<GameMode> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameMode parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat {
|
public GameMode parseInput(FlagContext context) throws InvalidFlagFormat {
|
||||||
|
String input = context.getUserInput();
|
||||||
input = input.trim();
|
input = input.trim();
|
||||||
if (input.equalsIgnoreCase("creative")) {
|
if (input.equalsIgnoreCase("creative")) {
|
||||||
return GameMode.CREATIVE;
|
return GameMode.CREATIVE;
|
||||||
|
|
|
@ -1,31 +1,19 @@
|
||||||
package de.jaschastarke.minecraft.limitedcreative.regions;
|
package de.jaschastarke.minecraft.limitedcreative.regions;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import java.util.List;
|
import com.sk89q.worldguard.WorldGuard;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.World;
|
|
||||||
|
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
|
import com.sk89q.worldguard.protection.flags.FlagContext;
|
||||||
import com.sk89q.worldguard.protection.flags.InvalidFlagFormat;
|
import com.sk89q.worldguard.protection.flags.InvalidFlagFormat;
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
|
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||||
import de.jaschastarke.LocaleString;
|
import de.jaschastarke.LocaleString;
|
||||||
import de.jaschastarke.bukkit.lib.chat.ChatFormattings;
|
import de.jaschastarke.bukkit.lib.chat.ChatFormattings;
|
||||||
import de.jaschastarke.bukkit.lib.commands.BukkitCommand;
|
import de.jaschastarke.bukkit.lib.commands.*;
|
||||||
import de.jaschastarke.bukkit.lib.commands.CommandContext;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.CommandException;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.HelpCommand;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.ICommand;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.IHelpDescribed;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.MethodCommand;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.MissingPermissionCommandException;
|
|
||||||
import de.jaschastarke.bukkit.lib.commands.annotations.IsCommand;
|
import de.jaschastarke.bukkit.lib.commands.annotations.IsCommand;
|
||||||
import de.jaschastarke.bukkit.lib.commands.annotations.Usages;
|
import de.jaschastarke.bukkit.lib.commands.annotations.Usages;
|
||||||
import de.jaschastarke.bukkit.lib.commands.parser.DefinedParameterParser;
|
import de.jaschastarke.bukkit.lib.commands.parser.DefinedParameterParser;
|
||||||
|
@ -40,6 +28,13 @@ import de.jaschastarke.minecraft.limitedcreative.regions.worldguard.FlagList;
|
||||||
import de.jaschastarke.minecraft.limitedcreative.regions.worldguard.FlagValue;
|
import de.jaschastarke.minecraft.limitedcreative.regions.worldguard.FlagValue;
|
||||||
import de.jaschastarke.minecraft.limitedcreative.regions.worldguard.Region;
|
import de.jaschastarke.minecraft.limitedcreative.regions.worldguard.Region;
|
||||||
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
|
import de.jaschastarke.modularize.ModuleEntry.ModuleState;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LimitedCreative-Region-Command: configure creative regions
|
* LimitedCreative-Region-Command: configure creative regions
|
||||||
|
@ -138,7 +133,8 @@ public class RegionsCommand extends BukkitCommand implements IHelpDescribed {
|
||||||
if (idx > -1 && context.getArgument(idx) != null)
|
if (idx > -1 && context.getArgument(idx) != null)
|
||||||
w = Bukkit.getWorld(context.getArgument(idx));
|
w = Bukkit.getWorld(context.getArgument(idx));
|
||||||
if (w != null) {
|
if (w != null) {
|
||||||
RegionManager mgr = getWorldGuard().getRegionManager(w);
|
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||||
|
RegionManager mgr = container.get(BukkitAdapter.adapt(w));
|
||||||
if (mgr != null) {
|
if (mgr != null) {
|
||||||
List<String> hints = new ArrayList<String>();
|
List<String> hints = new ArrayList<String>();
|
||||||
for (String rId : mgr.getRegions().keySet()) {
|
for (String rId : mgr.getRegions().keySet()) {
|
||||||
|
@ -174,7 +170,8 @@ public class RegionsCommand extends BukkitCommand implements IHelpDescribed {
|
||||||
if (w == null)
|
if (w == null)
|
||||||
throw new CommandException(L("command.worldguard.world_not_found"));
|
throw new CommandException(L("command.worldguard.world_not_found"));
|
||||||
|
|
||||||
RegionManager mgr = getWorldGuard().getRegionManager(w);
|
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||||
|
RegionManager mgr = container.get(BukkitAdapter.adapt(w));
|
||||||
ProtectedRegion region = mgr.getRegion(params.getArgument(0));
|
ProtectedRegion region = mgr.getRegion(params.getArgument(0));
|
||||||
if (region == null && params.getArgument(0).equalsIgnoreCase("__global__")) {
|
if (region == null && params.getArgument(0).equalsIgnoreCase("__global__")) {
|
||||||
region = new GlobalProtectedRegion(params.getArgument(0));
|
region = new GlobalProtectedRegion(params.getArgument(0));
|
||||||
|
@ -202,7 +199,7 @@ public class RegionsCommand extends BukkitCommand implements IHelpDescribed {
|
||||||
String value = params.getValue();
|
String value = params.getValue();
|
||||||
try {
|
try {
|
||||||
if (value != null && value.trim().length() > 0) {
|
if (value != null && value.trim().length() > 0) {
|
||||||
reg.setFlag(flag, flag.parseInput(getWorldGuard(), context.getSender(), value));
|
reg.setFlag(flag, flag.parseInput(FlagContext.create().setInput(value).build()));
|
||||||
} else {
|
} else {
|
||||||
reg.setFlag(flag, null);
|
reg.setFlag(flag, null);
|
||||||
}
|
}
|
||||||
|
@ -237,17 +234,18 @@ public class RegionsCommand extends BukkitCommand implements IHelpDescribed {
|
||||||
throw new CommandException(L("command.worldguard.world_not_found"));
|
throw new CommandException(L("command.worldguard.world_not_found"));
|
||||||
|
|
||||||
ProtectedRegion region = null;
|
ProtectedRegion region = null;
|
||||||
|
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||||
if (params.getArgumentCount() == 0 && context.isPlayer()) {
|
if (params.getArgumentCount() == 0 && context.isPlayer()) {
|
||||||
RegionManager mgr = getWorldGuard().getRegionManager(context.getPlayer().getWorld());
|
RegionManager mgr = container.get(BukkitAdapter.adapt(context.getPlayer().getWorld()));
|
||||||
ApplicableRegionSet set = mgr.getApplicableRegions(context.getPlayer().getLocation());
|
ApplicableRegionSet set = mgr.getApplicableRegions(BukkitAdapter.asBlockVector(context.getPlayer().getLocation()));
|
||||||
if (set.size() > 0) {
|
if (set.size() > 0) {
|
||||||
region = set.iterator().next();
|
region = set.iterator().next();
|
||||||
} else {
|
} else {
|
||||||
region = getWorldGuard().getRegionManager(w).getRegion(GLOBAL_REGION);
|
region = container.get(BukkitAdapter.adapt(w)).getRegion(GLOBAL_REGION);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int rpc = params.getArgumentCount() > 1 ? 1 : 0;
|
int rpc = params.getArgumentCount() > 1 ? 1 : 0;
|
||||||
RegionManager mgr = getWorldGuard().getRegionManager(w);
|
RegionManager mgr = container.get(BukkitAdapter.adapt(w));
|
||||||
region = mgr.getRegion(params.getArgument(rpc));
|
region = mgr.getRegion(params.getArgument(rpc));
|
||||||
if (region == null && params.getArgument(rpc).equalsIgnoreCase(GLOBAL_REGION)) {
|
if (region == null && params.getArgument(rpc).equalsIgnoreCase(GLOBAL_REGION)) {
|
||||||
region = new GlobalProtectedRegion(params.getArgument(rpc));
|
region = new GlobalProtectedRegion(params.getArgument(rpc));
|
||||||
|
|
|
@ -17,14 +17,16 @@
|
||||||
*/
|
*/
|
||||||
package de.jaschastarke.minecraft.limitedcreative.regions.worldguard;
|
package de.jaschastarke.minecraft.limitedcreative.regions.worldguard;
|
||||||
|
|
||||||
import java.io.File;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import java.io.IOException;
|
import com.sk89q.worldguard.WorldGuard;
|
||||||
import java.util.ArrayList;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import java.util.Arrays;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
import java.util.HashMap;
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
import java.util.List;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
import java.util.Map;
|
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||||
|
import de.jaschastarke.minecraft.limitedcreative.ModRegions;
|
||||||
|
import de.jaschastarke.minecraft.limitedcreative.regions.WorldGuardIntegration;
|
||||||
|
import de.jaschastarke.utils.StringUtil;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
@ -32,15 +34,9 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.sk89q.worldguard.bukkit.BukkitUtil;
|
import java.io.File;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import java.io.IOException;
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import java.util.*;
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
|
||||||
|
|
||||||
import de.jaschastarke.minecraft.limitedcreative.ModRegions;
|
|
||||||
import de.jaschastarke.minecraft.limitedcreative.regions.WorldGuardIntegration;
|
|
||||||
import de.jaschastarke.utils.StringUtil;
|
|
||||||
|
|
||||||
public class CustomRegionManager {
|
public class CustomRegionManager {
|
||||||
protected YamlConfiguration c;
|
protected YamlConfiguration c;
|
||||||
|
@ -161,12 +157,13 @@ public class CustomRegionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionManager getWGManager(World world) {
|
public RegionManager getWGManager(World world) {
|
||||||
return getWorldGuard().getRegionManager(world);
|
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||||
|
return container.get(BukkitAdapter.adapt(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRegionsHash(Location loc) {
|
public String getRegionsHash(Location loc) {
|
||||||
StringBuilder hash = new StringBuilder(loc.getWorld().getName());
|
StringBuilder hash = new StringBuilder(loc.getWorld().getName());
|
||||||
List<String> idlist = getWGManager(loc.getWorld()).getApplicableRegionsIDs(BukkitUtil.toVector(loc));
|
List<String> idlist = getWGManager(loc.getWorld()).getApplicableRegionsIDs(BukkitAdapter.asBlockVector(loc));
|
||||||
if (idlist.size() > 0) {
|
if (idlist.size() > 0) {
|
||||||
hash.append("#");
|
hash.append("#");
|
||||||
String[] ids = idlist.toArray(new String[idlist.size()]);
|
String[] ids = idlist.toArray(new String[idlist.size()]);
|
||||||
|
@ -179,7 +176,7 @@ public class CustomRegionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicableRegions getRegionSet(Location loc) {
|
public ApplicableRegions getRegionSet(Location loc) {
|
||||||
return new ApplicableRegions(getWGManager(loc.getWorld()).getApplicableRegions(loc), this.world(loc.getWorld()));
|
return new ApplicableRegions(getWGManager(loc.getWorld()).getApplicableRegions(BukkitAdapter.asBlockVector(loc)), this.world(loc.getWorld()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicableRegions getRegionSet(Block block) {
|
public ApplicableRegions getRegionSet(Block block) {
|
||||||
|
|
Loading…
Reference in a new issue