Meteor #324
@ -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 {
|
||||
|
||||
Lixfel markierte diese Unterhaltung als gelöst
|
||||
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) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Auch nicht genau so in HellsBells?
Die Klasse schon, sie hat nur andere Werte! Vllt könnte man sich da eine kleine lineare State Machine ausdenken, welche das gleiche Macht.