mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-03-13 15:20:14 +01:00
Ensure nuke commands runs on correct threads
This commit is contained in:
parent
0e4bab24cb
commit
07fbf93001
@ -38,17 +38,19 @@ public class Commandnuke extends EssentialsCommand {
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
player.sendMessage(tl("nuke"));
|
||||
final Location loc = player.getLocation();
|
||||
final World world = loc.getWorld();
|
||||
if (world != null) {
|
||||
for (int x = -10; x <= 10; x += 5) {
|
||||
for (int z = -10; z <= 10; z += 5) {
|
||||
final TNTPrimed entity = world.spawn(new Location(world, loc.getBlockX() + x, world.getHighestBlockYAt(loc) + 64, loc.getBlockZ() + z), TNTPrimed.class);
|
||||
entity.setMetadata(NUKE_META_KEY, new FixedMetadataValue(ess, true));
|
||||
ess.scheduleEntityDelayedTask(player, () -> {
|
||||
player.sendMessage(tl("nuke"));
|
||||
final Location loc = player.getLocation();
|
||||
final World world = loc.getWorld();
|
||||
if (world != null) {
|
||||
for (int x = -10; x <= 10; x += 5) {
|
||||
for (int z = -10; z <= 10; z += 5) {
|
||||
final TNTPrimed entity = world.spawn(new Location(world, loc.getBlockX() + x, world.getHighestBlockYAt(loc) + 64, loc.getBlockZ() + z), TNTPrimed.class);
|
||||
entity.setMetadata(NUKE_META_KEY, new FixedMetadataValue(ess, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user