SteamWar/FightSystem
Archiviert
13
1

Update Meteor
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-01-15 16:36:41 +01:00
Ursprung 3440ca9d7d
Commit 545c5a4df0

Datei anzeigen

@ -9,13 +9,9 @@ import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.fightsystem.winconditions.Winconditions;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
@ -24,6 +20,10 @@ import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
public class Meteor implements Listener {
@ -36,6 +36,7 @@ public class Meteor implements Listener {
private Meteor.State current = Meteor.State.PRE;
private int currentDrops = 0;
private Meteor.MeteorCountdown currentCountdown;
private final AtomicInteger amount = new AtomicInteger(0);
private BukkitTask currentDropping;
public void startCountdown() {
@ -68,7 +69,12 @@ public class Meteor implements Listener {
}
public void drop() {
final AtomicInteger amount = new AtomicInteger(current.minAmount + random.nextInt(current.maxAmount - current.minAmount));
int randomAmount = current.minAmount + random.nextInt(current.maxAmount - current.minAmount);
if (amount.get() > 0) {
amount.set(amount.get() + randomAmount);
return;
}
amount.set(randomAmount);
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
int xOffset = getStart(xLength);
@ -158,12 +164,12 @@ public class Meteor implements Listener {
private enum State {
PRE(30, 40, 1, 0, 0, 0),
FIRST(25, 35, 3, 2, 2, 4),
SECOND(20, 30, 4, 4, 3, 6),
THIRD(15, 25, 4, 6, 4, 8),
FOURTH(10, 20, 5, 8, 6, 11),
LAST(5, 10, 0, 10, 8, 16);
PRE(60, 80, 1, 0, 0, 0),
FIRST(25, 35, 6, 2, 2, 4),
SECOND(20, 30, 7, 4, 3, 6),
THIRD(15, 25, 7, 4, 4, 8),
FOURTH(10, 20, 8, 6, 6, 11),
LAST(5, 10, 0, 6, 8, 16);
State(int minTime, int maxTime, int switchAfter, int explosionSize, int minAmount, int maxAmount) {