diff --git a/MobArena.jar b/MobArena.jar index f4ff4f3..801e7f4 100644 Binary files a/MobArena.jar and b/MobArena.jar differ diff --git a/resources/plugin.yml b/resources/plugin.yml index 72d10c0..3e7bfc0 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -1,6 +1,6 @@ name: MobArena main: com.garbagemule.MobArena.MobArena -version: 0.94.3.16 +version: 0.94.3.17 softdepend: [Spout,Permissions,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells] commands: ma: diff --git a/src/com/garbagemule/MobArena/MACommands.java b/src/com/garbagemule/MobArena/MACommands.java index 62589e0..6bfb010 100644 --- a/src/com/garbagemule/MobArena/MACommands.java +++ b/src/com/garbagemule/MobArena/MACommands.java @@ -7,6 +7,7 @@ import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.DyeColor; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.World; @@ -871,14 +872,19 @@ public class MACommands implements CommandExecutor MAUtils.tellPlayer(sender, Msg.MISC_NO_ACCESS); return true; } - if (am.selectedArena.p1 == null || am.selectedArena.p2 == null) + + Arena arena = am.getArenaAtLocation(p.getLocation()); + if (arena == null) + arena = am.selectedArena; + + if (arena.p1 == null || arena.p2 == null) { MAUtils.tellPlayer(sender, "The region is not defined for the selected arena."); return true; } - if (showingRegion || !am.selectedArena.edit) + if (showingRegion) { - MAUtils.tellPlayer(sender, "Must be in edit mode."); + MAUtils.tellPlayer(sender, "Already showing region."); return true; } @@ -898,8 +904,9 @@ public class MACommands implements CommandExecutor showingRegion = true; // Show the frame. - final World world = am.selectedArena.world; - final Set blocks = MAUtils.showRegion(world, am.selectedArena.p1, am.selectedArena.p2, mat.getId(), color); + final World world = arena.world; + final Set blocks = MAUtils.showRegion(p, world, arena.p1, arena.p2, mat.getId(), color); + final Player fp = p; // And hide the frame. plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, @@ -908,7 +915,8 @@ public class MACommands implements CommandExecutor public void run() { for (int[] buffer : blocks) - world.getBlockAt(buffer[0], buffer[1], buffer[2]).setTypeIdAndData(buffer[3], (byte) 0, false); + fp.sendBlockChange(new Location(world, buffer[0], buffer[1], buffer[2]), buffer[3], (byte) 0); + //world.getBlockAt(buffer[0], buffer[1], buffer[2]).setTypeIdAndData(buffer[3], (byte) 0, false); showingRegion = false; } }, 2*20); diff --git a/src/com/garbagemule/MobArena/MAUtils.java b/src/com/garbagemule/MobArena/MAUtils.java index a7d5be6..1133424 100644 --- a/src/com/garbagemule/MobArena/MAUtils.java +++ b/src/com/garbagemule/MobArena/MAUtils.java @@ -678,8 +678,8 @@ public class MAUtils /** * Create a frame spanned by the two input coordinates. * @return An int arry holding x,y,z and the original type IDs of each block. - */ - public static Set showRegion(World world, Location p1, Location p2, int id, byte color) + */ + public static Set showRegion(Player p, World world, Location p1, Location p2, int id, byte color) { Set result = new HashSet(); @@ -692,63 +692,62 @@ public class MAUtils { buffer = new int[] {i, y1, z1, world.getBlockTypeIdAt(i, y1, z1)}; result.add(buffer); - world.getBlockAt(i, y1, z1).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, i, y1, z1), id, color); buffer = new int[] {i, y2, z1, world.getBlockTypeIdAt(i, y2, z1)}; result.add(buffer); - world.getBlockAt(i, y2, z1).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, i, y2, z1), id, color); buffer = new int[] {i, y1, z2, world.getBlockTypeIdAt(i, y1, z2)}; result.add(buffer); - world.getBlockAt(i, y1, z2).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, i, y1, z2), id, color); buffer = new int[] {i, y2, z2, world.getBlockTypeIdAt(i, y2, z2)}; result.add(buffer); - world.getBlockAt(i, y2, z2).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, i, y2, z2), id, color); } for (int j = y1+1; j <= y2-1; j++) { buffer = new int[] {x1, j, z1, world.getBlockTypeIdAt(x1, j, z1)}; result.add(buffer); - world.getBlockAt(x1, j, z1).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, x1, j, z1), id, color); buffer = new int[] {x2, j, z1, world.getBlockTypeIdAt(x2, j, z1)}; result.add(buffer); - world.getBlockAt(x2, j, z1).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, x2, j, z1), id, color); buffer = new int[] {x1, j, z2, world.getBlockTypeIdAt(x1, j, z2)}; result.add(buffer); - world.getBlockAt(x1, j, z2).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, x1, j, z2), id, color); buffer = new int[] {x2, j, z2, world.getBlockTypeIdAt(x2, j, z2)}; result.add(buffer); - world.getBlockAt(x2, j, z2).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, x2, j, z2), id, color); } for (int k = z1+1; k <= z2-1; k++) { buffer = new int[] {x1, y1, k, world.getBlockTypeIdAt(x1, y1, k)}; result.add(buffer); - world.getBlockAt(x1, y1, k).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, x1, y1, k), id, color); buffer = new int[] {x2, y1, k, world.getBlockTypeIdAt(x2, y1, k)}; result.add(buffer); - world.getBlockAt(x2, y1, k).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, x2, y1, k), id, color); buffer = new int[] {x1, y2, k, world.getBlockTypeIdAt(x1, y2, k)}; result.add(buffer); - world.getBlockAt(x1, y2, k).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, x1, y2, k), id, color); buffer = new int[] {x2, y2, k, world.getBlockTypeIdAt(x2, y2, k)}; result.add(buffer); - world.getBlockAt(x2, y2, k).setTypeIdAndData(id, color, false); + p.sendBlockChange(new Location(world, x2, y2, k), id, color); } - return result; } - public static Set showRegion(World world, Location p1, Location p2, int id) + public static Set showRegion(Player p, World world, Location p1, Location p2, int id) { - return showRegion(world, p1, p2, id, (byte) 0); + return showRegion(p, world, p1, p2, id, (byte) 0); } /**