Fix pr stuff
Dieser Commit ist enthalten in:
Ursprung
e6417bd578
Commit
3f39066209
@ -32,11 +32,13 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.bukkit.util.Consumer;
|
import org.bukkit.util.Consumer;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class TNTSimulator {
|
public class TNTSimulator {
|
||||||
|
|
||||||
@ -195,15 +197,15 @@ public class TNTSimulator {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// Velocity Settings
|
// Velocity Settings
|
||||||
swInventory.setItem(13, new SWItem(tntSpawn.isxVelocity() ? Material.LIME_CONCRETE : Material.RED_CONCRETE, "§7TNT §eSprung X §8- §7" + active(tntSpawn.isxVelocity()), clickType -> {
|
swInventory.setItem(13, new SWItem(tntSpawn.isxVelocity() ? Material.LIME_CONCRETE : Material.RED_CONCRETE, "§7TNT §eSprung X §8- " + active(tntSpawn.isxVelocity()), clickType -> {
|
||||||
tntSpawn.setxVelocity(!tntSpawn.isxVelocity());
|
tntSpawn.setxVelocity(!tntSpawn.isxVelocity());
|
||||||
editTNT(player, tntSpawn);
|
editTNT(player, tntSpawn);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(22, new SWItem(tntSpawn.isyVelocity() ? Material.LIME_CONCRETE : Material.RED_CONCRETE, "§7TNT §eSprung Y §8- §7" + active(tntSpawn.isyVelocity()), clickType -> {
|
swInventory.setItem(22, new SWItem(tntSpawn.isyVelocity() ? Material.LIME_CONCRETE : Material.RED_CONCRETE, "§7TNT §eSprung Y §8- " + active(tntSpawn.isyVelocity()), clickType -> {
|
||||||
tntSpawn.setyVelocity(!tntSpawn.isyVelocity());
|
tntSpawn.setyVelocity(!tntSpawn.isyVelocity());
|
||||||
editTNT(player, tntSpawn);
|
editTNT(player, tntSpawn);
|
||||||
}));
|
}));
|
||||||
swInventory.setItem(31, new SWItem(tntSpawn.iszVelocity() ? Material.LIME_CONCRETE : Material.RED_CONCRETE, "§7TNT §eSprung Z §8- §7" + active(tntSpawn.iszVelocity()), clickType -> {
|
swInventory.setItem(31, new SWItem(tntSpawn.iszVelocity() ? Material.LIME_CONCRETE : Material.RED_CONCRETE, "§7TNT §eSprung Z §8- " + active(tntSpawn.iszVelocity()), clickType -> {
|
||||||
tntSpawn.setzVelocity(!tntSpawn.iszVelocity());
|
tntSpawn.setzVelocity(!tntSpawn.iszVelocity());
|
||||||
editTNT(player, tntSpawn);
|
editTNT(player, tntSpawn);
|
||||||
}));
|
}));
|
||||||
@ -316,12 +318,15 @@ public class TNTSimulator {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
AtomicInteger currentTick = new AtomicInteger(0);
|
AtomicInteger currentTick = new AtomicInteger(0);
|
||||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), () -> {
|
AtomicReference<Runnable> taskCanceler = new AtomicReference<>(() -> {});
|
||||||
|
BukkitTask bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), () -> {
|
||||||
int tick = currentTick.get();
|
int tick = currentTick.get();
|
||||||
spawnRandomList(first.getOrDefault(tick, EMPTY));
|
spawnRandomList(first.getOrDefault(tick, EMPTY));
|
||||||
spawnRandomList(second.getOrDefault(tick, EMPTY));
|
spawnRandomList(second.getOrDefault(tick, EMPTY));
|
||||||
|
if (tick > lastTick.get()) taskCanceler.get().run();
|
||||||
currentTick.incrementAndGet();
|
currentTick.incrementAndGet();
|
||||||
}, 1, 1);
|
}, 1, 1);
|
||||||
|
taskCanceler.set(bukkitTask::cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnRandomList(List<TNTSpawn> tntSpawns) {
|
private void spawnRandomList(List<TNTSpawn> tntSpawns) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren