SteamWar/FightSystem
Archiviert
13
1

Fix HellBells and Meteor
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-01-15 16:06:43 +01:00
Ursprung abc7e1a4f7
Commit f2b86c9b1d
2 geänderte Dateien mit 24 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -69,6 +69,7 @@ public class HellsBells {
GlobalRecorder.getInstance().system(stateSwapMessage); GlobalRecorder.getInstance().system(stateSwapMessage);
FightSystem.getMessage().broadcast(stateSwapMessage); FightSystem.getMessage().broadcast(stateSwapMessage);
currentDrops = 0; currentDrops = 0;
current = current.getNext();
} }
currentDrops++; currentDrops++;

Datei anzeigen

@ -15,7 +15,9 @@ import java.util.logging.Level;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fireball; import org.bukkit.entity.Fireball;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
@ -38,9 +40,16 @@ public class Meteor implements Listener {
public void startCountdown() { public void startCountdown() {
if (current == Meteor.State.PRE) { if (current == Meteor.State.PRE) {
Bukkit.getOnlinePlayers().forEach(player -> {
player.sendMessage("Starting");
});
current = current.getNext(); current = current.getNext();
} else if (current != Meteor.State.LAST && currentDrops >= current.SWITCH_AFTER) { } else if (current != Meteor.State.LAST && currentDrops >= current.SWITCH_AFTER) {
Bukkit.getOnlinePlayers().forEach(player -> {
player.sendMessage("Faster");
});
currentDrops = 0; currentDrops = 0;
current = current.getNext();
} }
currentDrops++; currentDrops++;
@ -51,8 +60,10 @@ public class Meteor implements Listener {
@EventHandler @EventHandler
public void explode(ProjectileHitEvent event) { public void explode(ProjectileHitEvent event) {
if (event.getEntity() instanceof Fireball) { if (event.getEntity() instanceof Fireball) {
event.getEntity().getWorld().createExplosion(event.getEntity().getLocation(), current.explosionSize); TNTPrimed tnt = world.spawn(event.getEntity().getLocation(), TNTPrimed.class);
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> event.getEntity().getWorld().createExplosion(event.getEntity().getLocation(), current.explosionSize), 1L); tnt.setVelocity(new Vector(0, 0, 0));
tnt.setFuseTicks(0);
tnt.setYield(current.explosionSize);
} }
} }
@ -67,6 +78,9 @@ public class Meteor implements Listener {
Meteor.Point redStart = new Meteor.Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset); Meteor.Point redStart = new Meteor.Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset);
Meteor.Point blueStart = new Meteor.Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset); Meteor.Point blueStart = new Meteor.Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset);
vector.setX(random.nextDouble() - 0.5);
vector.setZ(random.nextDouble() - 0.5);
Fireball fireballRed = world.spawn(redStart.toLocation(world), Fireball.class); Fireball fireballRed = world.spawn(redStart.toLocation(world), Fireball.class);
fireballRed.setDirection(vector); fireballRed.setDirection(vector);
fireballRed.setBounce(false); fireballRed.setBounce(false);
@ -74,6 +88,7 @@ public class Meteor implements Listener {
fireballRed.setYield(0); fireballRed.setYield(0);
Fireball fireballBlue = world.spawn(blueStart.toLocation(world), Fireball.class); Fireball fireballBlue = world.spawn(blueStart.toLocation(world), Fireball.class);
vector.setZ(vector.getZ() * -1);
fireballBlue.setDirection(vector); fireballBlue.setDirection(vector);
fireballBlue.setBounce(false); fireballBlue.setBounce(false);
fireballBlue.setIsIncendiary(false); fireballBlue.setIsIncendiary(false);
@ -143,12 +158,12 @@ public class Meteor implements Listener {
private enum State { private enum State {
PRE(60, 80, 1, 0, 0, 0), PRE(30, 40, 1, 0, 0, 0),
FIRST(40, 60, 3, 2, 1, 3), FIRST(25, 35, 3, 2, 2, 4),
SECOND(30, 40, 4, 4, 2, 5), SECOND(20, 30, 4, 4, 3, 6),
THIRD(20, 30, 4, 6, 3, 7), THIRD(15, 25, 4, 6, 4, 8),
FOURTH(10, 20, 5, 8, 5, 10), FOURTH(10, 20, 5, 8, 6, 11),
LAST(5, 10, 0, 10, 7, 15); LAST(5, 10, 0, 10, 8, 16);
State(int minTime, int maxTime, int switchAfter, int explosionSize, int minAmount, int maxAmount) { State(int minTime, int maxTime, int switchAfter, int explosionSize, int minAmount, int maxAmount) {