mirror of
https://github.com/TotalFreedomMC/TF-WorldGuardExtraFlagsPlugin.git
synced 2024-12-30 19:14:34 +00:00
Fixed AsyncWorldEdit plugin exception
This commit is contained in:
parent
e87f92fbe3
commit
56e6dc83a0
8 changed files with 34 additions and 16 deletions
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.goldtreeservers</groupId>
|
<groupId>net.goldtreeservers</groupId>
|
||||||
<artifactId>worldguardextraflags</artifactId>
|
<artifactId>worldguardextraflags</artifactId>
|
||||||
<version>4.1.1</version>
|
<version>4.1.2-DEV</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.goldtreeservers.worldguardextraflags</groupId>
|
<groupId>net.goldtreeservers.worldguardextraflags</groupId>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.goldtreeservers</groupId>
|
<groupId>net.goldtreeservers</groupId>
|
||||||
<artifactId>worldguardextraflags</artifactId>
|
<artifactId>worldguardextraflags</artifactId>
|
||||||
<version>4.1.1</version>
|
<version>4.1.2-DEV</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.goldtreeservers.worldguardextraflags</groupId>
|
<groupId>net.goldtreeservers.worldguardextraflags</groupId>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.goldtreeservers</groupId>
|
<groupId>net.goldtreeservers</groupId>
|
||||||
<artifactId>worldguardextraflags</artifactId>
|
<artifactId>worldguardextraflags</artifactId>
|
||||||
<version>4.1.1</version>
|
<version>4.1.2-DEV</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.goldtreeservers.worldguardextraflags</groupId>
|
<groupId>net.goldtreeservers.worldguardextraflags</groupId>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.goldtreeservers</groupId>
|
<groupId>net.goldtreeservers</groupId>
|
||||||
<artifactId>worldguardextraflags</artifactId>
|
<artifactId>worldguardextraflags</artifactId>
|
||||||
<version>4.1.1</version>
|
<version>4.1.2-DEV</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.goldtreeservers.worldguardextraflags</groupId>
|
<groupId>net.goldtreeservers.worldguardextraflags</groupId>
|
||||||
|
|
|
@ -19,25 +19,31 @@ import net.goldtreeservers.worldguardextraflags.wg.WorldGuardUtils;
|
||||||
|
|
||||||
public class WorldEditFlagHandler extends AbstractDelegateExtent
|
public class WorldEditFlagHandler extends AbstractDelegateExtent
|
||||||
{
|
{
|
||||||
protected final World world;
|
protected final org.bukkit.World world;
|
||||||
protected final org.bukkit.entity.Player player;
|
protected final org.bukkit.entity.Player player;
|
||||||
|
|
||||||
protected WorldEditFlagHandler(World world, Extent extent, Player player)
|
protected WorldEditFlagHandler(World world, Extent extent, Player player)
|
||||||
{
|
{
|
||||||
super(extent);
|
super(extent);
|
||||||
|
|
||||||
this.world = world;
|
if (world instanceof BukkitWorld)
|
||||||
|
{
|
||||||
|
this.world = ((BukkitWorld)world).getWorld();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.world = Bukkit.getWorld(world.getName());
|
||||||
|
}
|
||||||
|
|
||||||
this.player = Bukkit.getPlayer(player.getUniqueId());
|
this.player = Bukkit.getPlayer(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException
|
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException
|
||||||
{
|
{
|
||||||
org.bukkit.World world = ((BukkitWorld)this.world).getWorld();
|
ApplicableRegionSet regions = WorldGuardPlugin.inst().getRegionContainer().get(this.world).getApplicableRegions(location);
|
||||||
|
|
||||||
ApplicableRegionSet regions = WorldGuardPlugin.inst().getRegionContainer().get(world).getApplicableRegions(location);
|
State state = WorldGuardUtils.queryState(this.player, this.world, regions.getRegions(), Flags.WORLDEDIT);
|
||||||
|
|
||||||
State state = WorldGuardUtils.queryState(this.player, world, regions.getRegions(), Flags.WORLDEDIT);
|
|
||||||
if (state != State.DENY)
|
if (state != State.DENY)
|
||||||
{
|
{
|
||||||
return super.setBlock(location, block);
|
return super.setBlock(location, block);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.goldtreeservers</groupId>
|
<groupId>net.goldtreeservers</groupId>
|
||||||
<artifactId>worldguardextraflags</artifactId>
|
<artifactId>worldguardextraflags</artifactId>
|
||||||
<version>4.1.1</version>
|
<version>4.1.2-DEV</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.goldtreeservers.worldguardextraflags</groupId>
|
<groupId>net.goldtreeservers.worldguardextraflags</groupId>
|
||||||
|
|
|
@ -19,23 +19,35 @@ import net.goldtreeservers.worldguardextraflags.wg.WorldGuardUtils;
|
||||||
|
|
||||||
public class WorldEditFlagHandler extends AbstractDelegateExtent
|
public class WorldEditFlagHandler extends AbstractDelegateExtent
|
||||||
{
|
{
|
||||||
protected final World world;
|
protected final World weWorld;
|
||||||
|
|
||||||
|
protected final org.bukkit.World world;
|
||||||
protected final org.bukkit.entity.Player player;
|
protected final org.bukkit.entity.Player player;
|
||||||
|
|
||||||
public WorldEditFlagHandler(World world, Extent extent, Player player)
|
public WorldEditFlagHandler(World world, Extent extent, Player player)
|
||||||
{
|
{
|
||||||
super(extent);
|
super(extent);
|
||||||
|
|
||||||
this.world = world;
|
this.weWorld = world;
|
||||||
|
|
||||||
|
if (world instanceof BukkitWorld)
|
||||||
|
{
|
||||||
|
this.world = ((BukkitWorld)world).getWorld();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.world = Bukkit.getWorld(world.getName());
|
||||||
|
}
|
||||||
|
|
||||||
this.player = Bukkit.getPlayer(player.getUniqueId());
|
this.player = Bukkit.getPlayer(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException
|
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException
|
||||||
{
|
{
|
||||||
ApplicableRegionSet regions = WorldGuard.getInstance().getPlatform().getRegionContainer().get(this.world).getApplicableRegions(location);
|
ApplicableRegionSet regions = WorldGuard.getInstance().getPlatform().getRegionContainer().get(this.weWorld).getApplicableRegions(location);
|
||||||
|
|
||||||
State state = WorldGuardUtils.queryState(this.player, ((BukkitWorld)this.world).getWorld(), regions.getRegions(), Flags.WORLDEDIT);
|
State state = WorldGuardUtils.queryState(this.player, this.world, regions.getRegions(), Flags.WORLDEDIT);
|
||||||
if (state != State.DENY)
|
if (state != State.DENY)
|
||||||
{
|
{
|
||||||
return super.setBlock(location, block);
|
return super.setBlock(location, block);
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
||||||
<groupId>net.goldtreeservers</groupId>
|
<groupId>net.goldtreeservers</groupId>
|
||||||
<artifactId>worldguardextraflags</artifactId>
|
<artifactId>worldguardextraflags</artifactId>
|
||||||
<name>WorldGuardExtraFlags</name>
|
<name>WorldGuardExtraFlags</name>
|
||||||
<version>4.1.1</version>
|
<version>4.1.2-DEV</version>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue