SteamWar/FightSystem
Archiviert
13
1

Multi stage entern and non tnt kits #167

Manuell gemergt
Lixfel hat 5 Commits von multi-stage-entern nach master 2020-07-11 07:30:09 +02:00 zusammengeführt
26 geänderte Dateien mit 179 neuen und 64 gelöschten Zeilen

Datei anzeigen

@ -24,9 +24,10 @@ public class Config {
public static final int PreSchemPasteDuration; public static final int PreSchemPasteDuration;
public static final int SetupDuration; public static final int SetupDuration;
public static final int PreFightDuration; public static final int PreFightDuration;
public static final int EnterPhaseBegin;
public static final int SpectatorDuration; public static final int SpectatorDuration;
public static final boolean Entern;
// entern parameter
public static final List<Integer> EnterStages;
//arena parameter //arena parameter
public static final int SchemsizeX; public static final int SchemsizeX;
@ -183,16 +184,16 @@ public class Config {
PercentSystem = config.getBoolean("WinConditions.PercentSystem"); PercentSystem = config.getBoolean("WinConditions.PercentSystem");
RelativePercent = config.getBoolean("WinConditions.RelativePercent"); RelativePercent = config.getBoolean("WinConditions.RelativePercent");
Points = config.getBoolean("WinConditions.Points"); Points = config.getBoolean("WinConditions.Points");
Entern = config.getBoolean("WinConditions.Entern");
TechKO = config.getBoolean("WinConditions.TechKO"); TechKO = config.getBoolean("WinConditions.TechKO");
WaterTechKO = config.getBoolean("WinConditions.WaterTechKO"); WaterTechKO = config.getBoolean("WinConditions.WaterTechKO");
PumpkinTechKO = config.getBoolean("WinConditions.PumpkinTechKO"); PumpkinTechKO = config.getBoolean("WinConditions.PumpkinTechKO");
TimeoutTime = config.getInt("WinConditionParams.TimeoutTime"); TimeoutTime = config.getInt("WinConditionParams.TimeoutTime");
EnterPhaseBegin = config.getInt("WinConditionParams.EnterPhaseBegin");
PercentWin = config.getDouble("WinConditionParams.PercentWin"); PercentWin = config.getDouble("WinConditionParams.PercentWin");
IgnoredBlocks = Collections.unmodifiableList(config.getStringList("WinConditionParams.IgnoredBlocks")); IgnoredBlocks = Collections.unmodifiableList(config.getStringList("WinConditionParams.IgnoredBlocks"));
EnterStages = Collections.unmodifiableList(config.getIntegerList("EnterStages"));
MemberDefault = config.getString("Kits.MemberDefault"); MemberDefault = config.getString("Kits.MemberDefault");
LeaderDefault = config.getString("Kits.LeaderDefault"); LeaderDefault = config.getString("Kits.LeaderDefault");
PersonalKits = config.getBoolean("Kits.PersonalKits"); PersonalKits = config.getBoolean("Kits.PersonalKits");

Datei anzeigen

@ -11,7 +11,6 @@ public class IFightSystem {
private static Plugin plugin; private static Plugin plugin;
private static String prefix; private static String prefix;
private static EventFight eventFight; private static EventFight eventFight;
private static boolean entern = false;
private static Player eventLeiter; private static Player eventLeiter;
public static void init(Plugin plugin, String prefix){ public static void init(Plugin plugin, String prefix){
@ -21,9 +20,6 @@ public class IFightSystem {
static void setEventFight(EventFight ef){ static void setEventFight(EventFight ef){
eventFight = ef; eventFight = ef;
} }
static void setEntern(boolean entern){
IFightSystem.entern = entern;
}
static void setEventLeiter(Player el){ static void setEventLeiter(Player el){
eventLeiter = el; eventLeiter = el;
} }
@ -37,9 +33,6 @@ public class IFightSystem {
public static EventFight getEventFight(){ public static EventFight getEventFight(){
return eventFight; return eventFight;
} }
public static boolean isEntern(){
return entern;
}
public static Player getEventLeiter(){ public static Player getEventLeiter(){
return eventLeiter; return eventLeiter;
} }

Datei anzeigen

@ -6,4 +6,5 @@ public interface IFightTeam {
boolean isBlue(); boolean isBlue();
boolean isPlayerInTeam(Player player); boolean isPlayerInTeam(Player player);
boolean canPlayerEntern(Player player);
} }

Datei anzeigen

@ -70,13 +70,13 @@ public class ITechHider {
arenaMinZ > chunkZ || arenaMinZ > chunkZ ||
chunkZ > arenaMaxZ; chunkZ > arenaMaxZ;
}else if(ft.isBlue()){ }else if(ft.isBlue()){
return IFightSystem.isEntern() || return ft.canPlayerEntern(p) ||
redMinX > chunkX || redMinX > chunkX ||
chunkX > redMaxX || chunkX > redMaxX ||
redMinZ > chunkZ || redMinZ > chunkZ ||
chunkZ > redMaxZ; chunkZ > redMaxZ;
}else{ }else{
return IFightSystem.isEntern() || return ft.canPlayerEntern(p) ||
blueMinX > chunkX || blueMinX > chunkX ||
chunkX > blueMaxX || chunkX > blueMaxX ||
blueMinZ > chunkZ || blueMinZ > chunkZ ||

Datei anzeigen

@ -21,7 +21,6 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.logging.Level; import java.util.logging.Level;
@ -77,6 +76,8 @@ public class FightSystem extends JavaPlugin {
if(Core.getVersion() > 8) if(Core.getVersion() > 8)
new ExtendedInventoryListener(); new ExtendedInventoryListener();
new EnterHandler();
new WinconditionAllDead(); new WinconditionAllDead();
new WinconditionCaptainDead(); new WinconditionCaptainDead();
new WinconditionPumpkinTechKO(); new WinconditionPumpkinTechKO();
@ -172,30 +173,11 @@ public class FightSystem extends JavaPlugin {
setFightState(FightState.RUNNING); setFightState(FightState.RUNNING);
setAllPlayersGM(GameMode.SURVIVAL); setAllPlayersGM(GameMode.SURVIVAL);
if(Config.Entern)
mainCountdown = new EnternCountdown();
FightStatistics.start(); FightStatistics.start();
WaterRemover.init(); WaterRemover.init();
Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!"); Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!");
} }
public static void setEntern() {
if(fightState != FightState.RUNNING)
throw new SecurityException(fightState.name());
setFightState(FightState.ENTERN);
final List<ITechHider.ChunkPos> chunksBlue = TechHider.prepareChunkReload(Fight.getBlueTeam().getPlayers().iterator().next().getPlayer());
final List<ITechHider.ChunkPos> chunksRed = TechHider.prepareChunkReload(Fight.getRedTeam().getPlayers().iterator().next().getPlayer());
IFightSystem.setEntern(true);
for(FightPlayer player : Fight.getBlueTeam().getPlayers()){
TechHider.reloadChunks(player.getPlayer(), chunksBlue);
}
for(FightPlayer player : Fight.getRedTeam().getPlayers()){
TechHider.reloadChunks(player.getPlayer(), chunksRed);
}
}
public static void setSpectateState(FightTeam winFightTeam, String windescription) { public static void setSpectateState(FightTeam winFightTeam, String windescription) {
if(!fightState.ingame()) if(!fightState.ingame())
throw new SecurityException(fightState.name()); throw new SecurityException(fightState.name());

Datei anzeigen

@ -59,7 +59,7 @@ public abstract class Countdown {
BasicListener.toActionbar(p, msg); BasicListener.toActionbar(p, msg);
} }
private void count(){ void count(){
switch (time) { switch (time) {
case 900: case 600: case 300: case 180: case 120: case 900: case 600: case 300: case 180: case 120:
broadcast("§rNoch §a" + time / 60 + " §rMinuten " + countdownCounting()); broadcast("§rNoch §a" + time / 60 + " §rMinuten " + countdownCounting());

Datei anzeigen

@ -1,13 +1,24 @@
package de.steamwar.fightsystem.countdown; package de.steamwar.fightsystem.countdown;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import org.bukkit.Bukkit; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.listener.BasicListener;
import de.steamwar.fightsystem.utils.ITechHider;
import de.steamwar.fightsystem.utils.TechHider;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
import java.util.List;
public class EnternCountdown extends Countdown { public class EnternCountdown extends Countdown {
public EnternCountdown() { private final FightPlayer fightPlayer;
super(Config.EnterPhaseBegin, SWSound.BLOCK_NOTE_PLING, false); private List<ITechHider.ChunkPos> chunkPos;
public EnternCountdown(FightPlayer fp) {
super(fp.getKit().getEnterStage(), SWSound.BLOCK_NOTE_PLING, false);
fightPlayer = fp;
} }
@Override @Override
@ -17,7 +28,42 @@ public class EnternCountdown extends Countdown {
@Override @Override
public void countdownFinished() { public void countdownFinished() {
FightSystem.setEntern(); fightPlayer.getPlayer().sendMessage(FightSystem.PREFIX + "§aEntern ist nun erlaubt!");
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aEntern ist nun erlaubt!"); TechHider.reloadChunks(fightPlayer.getPlayer(), chunkPos);
}
@Override
void count(){
if(!fightPlayer.isLiving()){
disable();
return;
}
Player player = fightPlayer.getPlayer();
int time = Config.EnterStages.get(fightPlayer.getKit().getEnterStage()) - FightSystem.getFightTime();
switch (time) {
case 900: case 600: case 300: case 180: case 120:
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a" + time / 60 + " §rMinuten " + countdownCounting()));
break;
case 60: case 30: case 20: case 15: case 10: case 5: case 4: case 3: case 2:
player.playSound(player.getLocation(), Countdown.getSound(SWSound.BLOCK_NOTE_PLING), 100.0F, 1.0F);
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a" + time + " §rSekunden " + countdownCounting()));
break;
case 1:
player.playSound(player.getLocation(), Countdown.getSound(SWSound.BLOCK_NOTE_PLING), 100.0F, 1.0F);
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a1 §rSekunde " + countdownCounting()));
chunkPos = TechHider.prepareChunkReload(player);
break;
case 0:
player.playSound(player.getLocation(), Countdown.getSound(SWSound.BLOCK_NOTE_PLING), 100.0F, 2.0F);
disable();
countdownFinished();
break;
default:
}
} }
} }

Datei anzeigen

@ -1,5 +1,6 @@
package de.steamwar.fightsystem.fight; package de.steamwar.fightsystem.fight;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.kit.KitManager; import de.steamwar.fightsystem.kit.KitManager;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.kit.Kit; import de.steamwar.fightsystem.kit.Kit;
@ -62,4 +63,10 @@ public class FightPlayer {
public void addKill(){ public void addKill(){
kills++; kills++;
} }
public boolean canEntern(){
if(Config.EnterStages.size() <= kit.getEnterStage() || kit.getEnterStage() < 0)
return false;
return Config.EnterStages.get(kit.getEnterStage()) >= FightSystem.getFightTime();
}
} }

Datei anzeigen

@ -127,6 +127,11 @@ public class FightTeam implements IFightTeam{
return false; return false;
} }
@Override
public boolean canPlayerEntern(Player player) {
return getFightPlayer(player).canEntern();
}
public boolean isPlayerLeader(Player player) { public boolean isPlayerLeader(Player player) {
if(leader != null) if(leader != null)
return leader.getPlayer().equals(player); return leader.getPlayer().equals(player);

Datei anzeigen

@ -21,6 +21,8 @@ public class Kit {
private final ItemStack[] inventory; private final ItemStack[] inventory;
private final ItemStack[] armor; private final ItemStack[] armor;
private final Collection<PotionEffect> effects; private final Collection<PotionEffect> effects;
private final int enterStage;
private final boolean tnt;
Kit(String name, Player player) { Kit(String name, Player player) {
this.name = name; this.name = name;
@ -29,13 +31,15 @@ public class Kit {
this.inventory = player.getInventory().getContents(); this.inventory = player.getInventory().getContents();
this.armor = player.getInventory().getArmorContents(); this.armor = player.getInventory().getArmorContents();
this.effects = player.getActivePotionEffects(); this.effects = player.getActivePotionEffects();
this.enterStage = 0;
this.tnt = true;
} }
Kit(ConfigurationSection kit){ Kit(ConfigurationSection kit){
name = kit.getName(); name = kit.getName();
inventory = Objects.requireNonNull(kit.getList("Items")).toArray(new ItemStack[1]); inventory = Objects.requireNonNull(kit.getList("Items")).toArray(new ItemStack[0]);
if(kit.isList("Armor")) if(kit.isList("Armor"))
armor = Objects.requireNonNull(kit.getList("Armor")).toArray(new ItemStack[1]); armor = Objects.requireNonNull(kit.getList("Armor")).toArray(new ItemStack[0]);
else else
armor = null; armor = null;
leaderAllowed = kit.getBoolean("LeaderAllowed"); leaderAllowed = kit.getBoolean("LeaderAllowed");
@ -44,6 +48,8 @@ public class Kit {
effects = (Collection<PotionEffect>) kit.getList("Effects"); effects = (Collection<PotionEffect>) kit.getList("Effects");
else else
effects = null; effects = null;
enterStage = kit.getInt("EnterStage", 0);
tnt = kit.getBoolean("TNT", true);
} }
public String getName() { public String getName() {
@ -58,6 +64,16 @@ public class Kit {
return memberAllowed; return memberAllowed;
} }
/* Is this kit allowed to set/handle tnt? */
public boolean isTnt(){
return tnt;
}
/* In which stage is entern allowed? */
public int getEnterStage() {
return enterStage;
}
public boolean isStackInKit(ItemStack stack){ public boolean isStackInKit(ItemStack stack){
for(ItemStack is : inventory){ for(ItemStack is : inventory){
if(stack.equals(is)) if(stack.equals(is))
@ -88,6 +104,8 @@ public class Kit {
section.set("LeaderAllowed", leaderAllowed); section.set("LeaderAllowed", leaderAllowed);
section.set("MemberAllowed", memberAllowed); section.set("MemberAllowed", memberAllowed);
section.set("Effects", effects); section.set("Effects", effects);
section.set("EnterStage", enterStage);
section.set("TNT", tnt);
} }
/** /**

Datei anzeigen

@ -15,8 +15,7 @@ import java.util.logging.Level;
public class KitManager { public class KitManager {
private KitManager(){} private KitManager(){}
private static final String KITS_PATH = "plugins/" + FightSystem.getPlugin().getName() + "/kits.data"; private static final File kits = new File(FightSystem.getPlugin().getDataFolder(), "kits.data");
private static final File kits = new File(KITS_PATH);
private static final FileConfiguration kitData = YamlConfiguration.loadConfiguration(kits); private static final FileConfiguration kitData = YamlConfiguration.loadConfiguration(kits);
private static final ArrayList<Kit> loadedKits = new ArrayList<>(); private static final ArrayList<Kit> loadedKits = new ArrayList<>();
@ -49,7 +48,7 @@ public class KitManager {
} }
public static void loadAllKits() { public static void loadAllKits() {
if(!new File(KITS_PATH).exists()) { if(!kits.exists()) {
saveAllKits(); saveAllKits();
Bukkit.getLogger().log(Level.INFO, "kits.data erstellt!"); Bukkit.getLogger().log(Level.INFO, "kits.data erstellt!");
FightSystem.shutdown(null); FightSystem.shutdown(null);

Datei anzeigen

@ -10,7 +10,7 @@ import java.util.EnumSet;
public class EntityExplodeListener extends BasicListener { public class EntityExplodeListener extends BasicListener {
public EntityExplodeListener() { public EntityExplodeListener() {
super(EnumSet.of(FightState.RUNNING, FightState.ENTERN)); super(EnumSet.of(FightState.RUNNING));
} }
@EventHandler @EventHandler

Datei anzeigen

@ -15,7 +15,7 @@ import java.util.Objects;
public class InFightDamageListener extends BasicListener { public class InFightDamageListener extends BasicListener {
public InFightDamageListener() { public InFightDamageListener() {
super(EnumSet.of(FightState.RUNNING, FightState.ENTERN)); super(EnumSet.of(FightState.RUNNING));
} }
@EventHandler @EventHandler

Datei anzeigen

@ -1,9 +1,13 @@
package de.steamwar.fightsystem.listener; package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent; import org.bukkit.event.inventory.InventoryPickupItemEvent;
@ -17,7 +21,7 @@ import java.util.EnumSet;
public class InFightInventoryListener extends BasicListener { public class InFightInventoryListener extends BasicListener {
public InFightInventoryListener() { public InFightInventoryListener() {
super(EnumSet.of(FightState.RUNNING, FightState.ENTERN)); super(EnumSet.of(FightState.RUNNING));
} }
@EventHandler @EventHandler
@ -93,4 +97,12 @@ public class InFightInventoryListener extends BasicListener {
} }
} }
@EventHandler
public void onBlockPlace(BlockPlaceEvent e) {
FightPlayer fp = Fight.getFightPlayer(e.getPlayer());
if(fp != null && !fp.getKit().isTnt() && e.getBlockPlaced().getType() == Material.TNT){
BasicListener.toActionbar(e.getPlayer(), TextComponent.fromLegacyText("§cDu darfst kein TNT setzen!"));
e.setCancelled(true);
}
}
} }

Datei anzeigen

@ -15,7 +15,7 @@ public class PistonListener extends BasicListener {
public PistonListener() { public PistonListener() {
//Wenn Entern aktiv ist, sollen Raketen etc. entern können //Wenn Entern aktiv ist, sollen Raketen etc. entern können
super(Config.Entern super(Config.EnterStages.isEmpty()
? EnumSet.of(FightState.PRE_LEADER_SETUP, FightState.PRE_SCHEM_SETUP, FightState.POST_SCHEM_SETUP) ? EnumSet.of(FightState.PRE_LEADER_SETUP, FightState.PRE_SCHEM_SETUP, FightState.POST_SCHEM_SETUP)
: EnumSet.allOf(FightState.class)); : EnumSet.allOf(FightState.class));
} }

Datei anzeigen

@ -50,7 +50,7 @@ public class PlayerMoveListener extends BasicListener {
reset(event, DENY_TEAM); reset(event, DENY_TEAM);
else if(fightTeam == Fight.getBlueTeam() && player.getGameMode() == GameMode.SPECTATOR) else if(fightTeam == Fight.getBlueTeam() && player.getGameMode() == GameMode.SPECTATOR)
reset(event, DENY_ENTERN); reset(event, DENY_ENTERN);
}else if(fightTeam != null && FightSystem.getFightState() != FightState.ENTERN && player.getGameMode() != GameMode.SPECTATOR) }else if(fightTeam != null && player.getGameMode() != GameMode.SPECTATOR && !fightTeam.canPlayerEntern(player))
reset(event, DENY_ENTERN); reset(event, DENY_ENTERN);
} }

Datei anzeigen

@ -6,13 +6,12 @@ public enum FightState {
POST_SCHEM_SETUP(true, true, false, false), POST_SCHEM_SETUP(true, true, false, false),
PRE_RUNNING(false, false, true, false), PRE_RUNNING(false, false, true, false),
RUNNING(false, false, true, true), RUNNING(false, false, true, true),
ENTERN(false, false, true, true), //Can be skipped
SPECTATE(false, true, false, false); SPECTATE(false, true, false, false);
private final boolean setup; //PRE_LEADER_SETUP, PRE_SCHEM_SETUP, POST_SCHEM_SETUP private final boolean setup; //PRE_LEADER_SETUP, PRE_SCHEM_SETUP, POST_SCHEM_SETUP
private final boolean outgame; //PRE_LEADER_SETUP, PRE_SCHEM_SETUP, POST_SCHEM_SETUP, SPECTATE private final boolean outgame; //PRE_LEADER_SETUP, PRE_SCHEM_SETUP, POST_SCHEM_SETUP, SPECTATE
private final boolean ingame; //PRE_RUNNING, RUNNING, ENTERN private final boolean ingame; //PRE_RUNNING, RUNNING
private final boolean infight; //RUNNING, ENTERN private final boolean infight; //RUNNING
FightState(boolean setup, boolean outgame, boolean ingame, boolean infight){ FightState(boolean setup, boolean outgame, boolean ingame, boolean infight){
this.setup = setup; this.setup = setup;

Datei anzeigen

@ -0,0 +1,44 @@
package de.steamwar.fightsystem.utils;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.countdown.EnternCountdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
public class EnterHandler implements StateDependent {
private static final Set<FightState> enabled = EnumSet.of(FightState.RUNNING);
private static final Set<EnternCountdown> countdowns = new HashSet<>();
@Override
public Set<FightState> enabled() {
return enabled;
}
private void registerTeam(FightTeam team){
for(FightPlayer fp : team.getPlayers()){
if(Config.EnterStages.size() > fp.getKit().getEnterStage() && fp.getKit().getEnterStage() >= 0)
countdowns.add(new EnternCountdown(fp));
}
}
@Override
public void enable() {
registerTeam(Fight.getBlueTeam());
registerTeam(Fight.getRedTeam());
}
@Override
public void disable() {
for(EnternCountdown countdown : countdowns){
countdown.disable();
}
countdowns.clear();
}
}

Datei anzeigen

@ -19,7 +19,7 @@ public class FightScoreboard {
private FightScoreboard(){} private FightScoreboard(){}
private static final Set<FightState> fullScoreboard = EnumSet.of(FightState.RUNNING, FightState.ENTERN, FightState.SPECTATE); private static final Set<FightState> fullScoreboard = EnumSet.of(FightState.RUNNING, FightState.SPECTATE);
private static final Scoreboard scoreboard = Objects.requireNonNull(Bukkit.getScoreboardManager()).getMainScoreboard(); private static final Scoreboard scoreboard = Objects.requireNonNull(Bukkit.getScoreboardManager()).getMainScoreboard();
private static final Objective objective; private static final Objective objective;
private static int index = 0; private static int index = 0;
@ -70,8 +70,6 @@ public class FightScoreboard {
else else
objective.getScore("§7Zeit: §a" + fightTime + "s").setScore(3); objective.getScore("§7Zeit: §a" + fightTime + "s").setScore(3);
} }
if (Config.Entern)
objective.getScore("§7Entern: " + (FightSystem.getFightState() == FightState.ENTERN ? "§aja" : "§cnein")).setScore(2);
if(fullScoreboard.contains(FightSystem.getFightState())){ if(fullScoreboard.contains(FightSystem.getFightState())){
if (Config.PercentSystem){ if (Config.PercentSystem){

Datei anzeigen

@ -16,11 +16,19 @@ public class WaterRemover {
private static final Map<Location, Integer> explodedBlocks = Collections.synchronizedMap(new HashMap<>()); private static final Map<Location, Integer> explodedBlocks = Collections.synchronizedMap(new HashMap<>());
private static Set<Block> waterList = new HashSet<>(); private static Set<Block> waterList = new HashSet<>();
private static boolean isRunning = false;
private static int steps = 1;
public static void init() { public static void init() {
Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), () -> { Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), () -> {
if(isRunning){
steps++;
return;
}
isRunning = true;
wateredCheck(); wateredCheck();
removeWater(); removeWater();
isRunning = false;
}, 0, 20); }, 0, 20);
} }
@ -41,13 +49,14 @@ public class WaterRemover {
it.remove(); it.remove();
continue; continue;
} }
e.setValue(e.getValue() + 1); e.setValue(e.getValue() + steps);
if(e.getValue() > 15) if(e.getValue() > 15)
it.remove(); it.remove();
} }
steps = 1;
}catch(ConcurrentModificationException e){ }catch(ConcurrentModificationException e){
wateredCheck(); steps++;
} }
} }

Datei anzeigen

@ -10,7 +10,7 @@ import java.util.EnumSet;
abstract class PlayerWincondition extends ListenerWincondition { abstract class PlayerWincondition extends ListenerWincondition {
PlayerWincondition(boolean condition) { PlayerWincondition(boolean condition) {
super(condition, EnumSet.of(FightState.PRE_RUNNING, FightState.RUNNING, FightState.ENTERN)); super(condition, EnumSet.of(FightState.PRE_RUNNING, FightState.RUNNING));
} }
boolean isTarget(Player player){ boolean isTarget(Player player){

Datei anzeigen

@ -13,7 +13,7 @@ public class WinconditionHeartRatioTimeout extends Wincondition {
private TimeOverCountdown countdown; private TimeOverCountdown countdown;
public WinconditionHeartRatioTimeout() { public WinconditionHeartRatioTimeout() {
super(Config.HeartRatioTimeout, EnumSet.of(FightState.RUNNING, FightState.ENTERN)); super(Config.HeartRatioTimeout, EnumSet.of(FightState.RUNNING));
} }
@Override @Override

Datei anzeigen

@ -22,7 +22,7 @@ public class WinconditionPercentSystem extends ListenerWincondition {
private static final int schematicSize = Math.abs(Config.SchemsizeX * Config.SchemsizeY * Config.SchemsizeZ); private static final int schematicSize = Math.abs(Config.SchemsizeX * Config.SchemsizeY * Config.SchemsizeZ);
public WinconditionPercentSystem() { public WinconditionPercentSystem() {
super(Config.PercentSystem, EnumSet.of(FightState.RUNNING, FightState.ENTERN)); super(Config.PercentSystem, EnumSet.of(FightState.RUNNING));
} }
@EventHandler @EventHandler

Datei anzeigen

@ -22,7 +22,7 @@ public class WinconditionPumpkinTechKO extends Wincondition {
private BukkitTask task; private BukkitTask task;
public WinconditionPumpkinTechKO(){ public WinconditionPumpkinTechKO(){
super(Config.PumpkinTechKO, EnumSet.of(FightState.PRE_RUNNING, FightState.RUNNING, FightState.ENTERN)); super(Config.PumpkinTechKO, EnumSet.of(FightState.PRE_RUNNING, FightState.RUNNING));
} }
public static int getTeamBluePumpkins() { public static int getTeamBluePumpkins() {

Datei anzeigen

@ -89,7 +89,8 @@ public class WinconditionRelativePercent extends Wincondition{
} }
private int currentBlocks(){ private int currentBlocks(){
if(FightSystem.getFightState() == FightState.ENTERN || FightSystem.getFightState() == FightState.SPECTATE) // Entern active
if(!Config.EnterStages.isEmpty() && Config.EnterStages.get(0) <= FightSystem.getFightTime())
return currentBlocks; return currentBlocks;
int blocks = 0; int blocks = 0;

Datei anzeigen

@ -12,7 +12,7 @@ public class WinconditionTimeout extends Wincondition {
private TimeOverCountdown countdown; private TimeOverCountdown countdown;
public WinconditionTimeout() { public WinconditionTimeout() {
super(Config.Timeout, EnumSet.of(FightState.RUNNING, FightState.ENTERN)); super(Config.Timeout, EnumSet.of(FightState.RUNNING));
} }
@Override @Override