Make showBlock(s) thread-safe.
This commit is contained in:
@@ -644,7 +644,10 @@ public class ArenaRegion
|
||||
showBlocks(p, map.values());
|
||||
}
|
||||
|
||||
public void showBlock(final Player p, final Location loc, int id, byte data) {
|
||||
public void showBlock(final Player p, final Location loc, final int id, final byte data) {
|
||||
arena.scheduleTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
p.sendBlockChange(loc, id, data);
|
||||
arena.scheduleTask(new Runnable() {
|
||||
@Override
|
||||
@@ -656,8 +659,13 @@ public class ArenaRegion
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
private void showBlocks(final Player p, Collection<Location> points) {
|
||||
private void showBlocks(final Player p, final Collection<Location> points) {
|
||||
arena.scheduleTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Grab all the blocks, and send block change events.
|
||||
final Map<Location,BlockState> blocks = new HashMap<Location,BlockState>();
|
||||
for (Location l : points) {
|
||||
@@ -665,7 +673,6 @@ public class ArenaRegion
|
||||
blocks.put(l, b.getState());
|
||||
p.sendBlockChange(l, 35, (byte) 14);
|
||||
}
|
||||
|
||||
arena.scheduleTask(new Runnable() {
|
||||
public void run() {
|
||||
// If the player isn't online, just forget it.
|
||||
@@ -685,6 +692,8 @@ public class ArenaRegion
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
private List<Location> getFramePoints(Location loc1, Location loc2) {
|
||||
List<Location> result = new ArrayList<Location>();
|
||||
|
||||
Reference in New Issue
Block a user