From 56e6dc83a09cb213256c7fc6c2eb380f73ce7ec8 Mon Sep 17 00:00:00 2001 From: isokissa3 Date: Fri, 30 Nov 2018 20:08:43 +0200 Subject: [PATCH] Fixed AsyncWorldEdit plugin exception --- Common/pom.xml | 2 +- Spigot/pom.xml | 2 +- WG/pom.xml | 2 +- WG6/pom.xml | 2 +- .../wg/wrappers/v6/WorldEditFlagHandler.java | 18 +++++++++++------ WG7/pom.xml | 2 +- .../wg/wrappers/v7/WorldEditFlagHandler.java | 20 +++++++++++++++---- pom.xml | 2 +- 8 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Common/pom.xml b/Common/pom.xml index 4ac4478..1c6a82b 100644 --- a/Common/pom.xml +++ b/Common/pom.xml @@ -3,7 +3,7 @@ net.goldtreeservers worldguardextraflags - 4.1.1 + 4.1.2-DEV net.goldtreeservers.worldguardextraflags diff --git a/Spigot/pom.xml b/Spigot/pom.xml index 62d54de..193b4f1 100644 --- a/Spigot/pom.xml +++ b/Spigot/pom.xml @@ -3,7 +3,7 @@ net.goldtreeservers worldguardextraflags - 4.1.1 + 4.1.2-DEV net.goldtreeservers.worldguardextraflags diff --git a/WG/pom.xml b/WG/pom.xml index 383b195..b586a94 100644 --- a/WG/pom.xml +++ b/WG/pom.xml @@ -3,7 +3,7 @@ net.goldtreeservers worldguardextraflags - 4.1.1 + 4.1.2-DEV net.goldtreeservers.worldguardextraflags diff --git a/WG6/pom.xml b/WG6/pom.xml index 4ab0d55..bc7e09f 100644 --- a/WG6/pom.xml +++ b/WG6/pom.xml @@ -3,7 +3,7 @@ net.goldtreeservers worldguardextraflags - 4.1.1 + 4.1.2-DEV net.goldtreeservers.worldguardextraflags diff --git a/WG6/src/main/java/net/goldtreeservers/worldguardextraflags/wg/wrappers/v6/WorldEditFlagHandler.java b/WG6/src/main/java/net/goldtreeservers/worldguardextraflags/wg/wrappers/v6/WorldEditFlagHandler.java index 0d1ec85..e2f949a 100644 --- a/WG6/src/main/java/net/goldtreeservers/worldguardextraflags/wg/wrappers/v6/WorldEditFlagHandler.java +++ b/WG6/src/main/java/net/goldtreeservers/worldguardextraflags/wg/wrappers/v6/WorldEditFlagHandler.java @@ -19,25 +19,31 @@ import net.goldtreeservers.worldguardextraflags.wg.WorldGuardUtils; public class WorldEditFlagHandler extends AbstractDelegateExtent { - protected final World world; + protected final org.bukkit.World world; protected final org.bukkit.entity.Player player; protected WorldEditFlagHandler(World world, Extent extent, Player player) { 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()); } @Override public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { - org.bukkit.World world = ((BukkitWorld)this.world).getWorld(); - - ApplicableRegionSet regions = WorldGuardPlugin.inst().getRegionContainer().get(world).getApplicableRegions(location); + ApplicableRegionSet regions = WorldGuardPlugin.inst().getRegionContainer().get(this.world).getApplicableRegions(location); - State state = WorldGuardUtils.queryState(this.player, world, regions.getRegions(), Flags.WORLDEDIT); + State state = WorldGuardUtils.queryState(this.player, this.world, regions.getRegions(), Flags.WORLDEDIT); if (state != State.DENY) { return super.setBlock(location, block); diff --git a/WG7/pom.xml b/WG7/pom.xml index 001ff66..0478187 100644 --- a/WG7/pom.xml +++ b/WG7/pom.xml @@ -3,7 +3,7 @@ net.goldtreeservers worldguardextraflags - 4.1.1 + 4.1.2-DEV net.goldtreeservers.worldguardextraflags diff --git a/WG7/src/main/java/net/goldtreeservers/worldguardextraflags/wg/wrappers/v7/WorldEditFlagHandler.java b/WG7/src/main/java/net/goldtreeservers/worldguardextraflags/wg/wrappers/v7/WorldEditFlagHandler.java index 90e9318..88321e5 100644 --- a/WG7/src/main/java/net/goldtreeservers/worldguardextraflags/wg/wrappers/v7/WorldEditFlagHandler.java +++ b/WG7/src/main/java/net/goldtreeservers/worldguardextraflags/wg/wrappers/v7/WorldEditFlagHandler.java @@ -19,23 +19,35 @@ import net.goldtreeservers.worldguardextraflags.wg.WorldGuardUtils; 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; public WorldEditFlagHandler(World world, Extent extent, Player player) { super(extent); + + this.weWorld = world; - 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()); } @Override 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) { return super.setBlock(location, block); diff --git a/pom.xml b/pom.xml index 95ad396..49b0a29 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ net.goldtreeservers worldguardextraflags WorldGuardExtraFlags - 4.1.1 + 4.1.2-DEV pom