t
This commit is contained in:
parent
6a88523d78
commit
4f2702331e
@ -3,6 +3,7 @@ package rip.tilly.bedwars.game;
|
|||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -16,10 +17,10 @@ import rip.tilly.bedwars.game.arena.Arena;
|
|||||||
import rip.tilly.bedwars.game.arena.CopiedArena;
|
import rip.tilly.bedwars.game.arena.CopiedArena;
|
||||||
import rip.tilly.bedwars.generators.Generator;
|
import rip.tilly.bedwars.generators.Generator;
|
||||||
import rip.tilly.bedwars.generators.GeneratorTier;
|
import rip.tilly.bedwars.generators.GeneratorTier;
|
||||||
|
import rip.tilly.bedwars.generators.GeneratorType;
|
||||||
import rip.tilly.bedwars.utils.CC;
|
import rip.tilly.bedwars.utils.CC;
|
||||||
|
import rip.tilly.bedwars.utils.CustomLocation;
|
||||||
import rip.tilly.bedwars.utils.TimeUtils;
|
import rip.tilly.bedwars.utils.TimeUtils;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@ -220,4 +221,62 @@ public class Game {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void tick(int amount) {
|
||||||
|
if (this.secondsToMinutes(amount) == 5D) {
|
||||||
|
Bukkit.broadcastMessage(CC.translate("&bDiamond &egenerators have been upgraded to &bTier II"));
|
||||||
|
|
||||||
|
this.diamondGeneratorTier = GeneratorTier.TWO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.secondsToMinutes(amount) == 8D) {
|
||||||
|
Bukkit.broadcastMessage(CC.translate("&aEmerald &egenerators have been upgraded to &bTier II"));
|
||||||
|
|
||||||
|
this.emeraldGeneratorTier = GeneratorTier.TWO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.secondsToMinutes(amount) == 10D) {
|
||||||
|
Bukkit.broadcastMessage(CC.translate("&bDiamond &egenerators have been upgraded to &bTier II"));
|
||||||
|
|
||||||
|
this.diamondGeneratorTier = GeneratorTier.THREE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.secondsToMinutes(amount) == 12D) {
|
||||||
|
Bukkit.broadcastMessage(CC.translate("&aEmerald &egenerators have been upgraded to &bTier II"));
|
||||||
|
|
||||||
|
this.emeraldGeneratorTier = GeneratorTier.THREE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.secondsToMinutes(amount) == 15D) {
|
||||||
|
Bukkit.broadcastMessage(CC.translate("&bDiamond &egenerators have been upgraded to &bTier II"));
|
||||||
|
|
||||||
|
this.diamondGeneratorTier = GeneratorTier.FOUR;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CustomLocation customLocation : this.arena.getTeamGenerators()) {
|
||||||
|
Generator ironGenerator = new Generator(customLocation.toBukkitLocation(), GeneratorType.IRON, true, this);
|
||||||
|
ironGenerator.spawn();
|
||||||
|
|
||||||
|
Generator goldGenerator = new Generator(customLocation.toBukkitLocation(), GeneratorType.GOLD, true, this);
|
||||||
|
goldGenerator.spawn();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Generator generator : this.getActivatedGenerators()) {
|
||||||
|
generator.setActivated(true);
|
||||||
|
|
||||||
|
if (generator.getGeneratorType() == GeneratorType.DIAMOND) {
|
||||||
|
generator.setGeneratorTier(this.diamondGeneratorTier);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (generator.getGeneratorType() == GeneratorType.EMERALD) {
|
||||||
|
generator.setGeneratorTier(this.emeraldGeneratorTier);
|
||||||
|
}
|
||||||
|
|
||||||
|
generator.spawn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double secondsToMinutes(int seconds) {
|
||||||
|
return seconds / 60D;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ public class Generator {
|
|||||||
return this.generatorType;
|
return this.generatorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGeneratorTier() {
|
public void setGeneratorTier(GeneratorTier generatorTier) {
|
||||||
this.generatorTier = generatorTier;
|
this.generatorTier = generatorTier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package rip.tilly.bedwars.runnables;
|
package rip.tilly.bedwars.runnables;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
@ -8,11 +7,17 @@ import rip.tilly.bedwars.BedWars;
|
|||||||
import rip.tilly.bedwars.game.Game;
|
import rip.tilly.bedwars.game.Game;
|
||||||
import rip.tilly.bedwars.game.GameState;
|
import rip.tilly.bedwars.game.GameState;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class GameRunnable extends BukkitRunnable {
|
public class GameRunnable extends BukkitRunnable {
|
||||||
|
|
||||||
private final BedWars plugin = BedWars.getInstance();
|
private BedWars plugin = BedWars.getInstance();
|
||||||
private final Game game;
|
|
||||||
|
private Game game;
|
||||||
|
|
||||||
|
private int amount;
|
||||||
|
|
||||||
|
public GameRunnable(Game game) {
|
||||||
|
this.game = game;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -25,9 +30,13 @@ public class GameRunnable extends BukkitRunnable {
|
|||||||
this.game.broadcastWithSound("&eStarting match in &d" + this.game.getCountdown() + " &eseconds...", Sound.NOTE_PLING);
|
this.game.broadcastWithSound("&eStarting match in &d" + this.game.getCountdown() + " &eseconds...", Sound.NOTE_PLING);
|
||||||
this.game.broadcastTitle("&d&lStarting Match In...", "&e" + this.game.getCountdown());
|
this.game.broadcastTitle("&d&lStarting Match In...", "&e" + this.game.getCountdown());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case FIGHTING:
|
case FIGHTING:
|
||||||
|
this.amount++;
|
||||||
this.game.incrementDuration();
|
this.game.incrementDuration();
|
||||||
|
this.game.tick(this.amount);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ENDING:
|
case ENDING:
|
||||||
if (this.game.decrementCountdown() == 0) {
|
if (this.game.decrementCountdown() == 0) {
|
||||||
@ -45,6 +54,7 @@ public class GameRunnable extends BukkitRunnable {
|
|||||||
this.plugin.getGameManager().removeGame(this.game);
|
this.plugin.getGameManager().removeGame(this.game);
|
||||||
this.cancel();
|
this.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user