Finish enter handler
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
3b46d45bc0
Commit
e4fe75693a
@ -21,7 +21,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
@ -77,6 +76,8 @@ public class FightSystem extends JavaPlugin {
|
||||
if(Core.getVersion() > 8)
|
||||
new ExtendedInventoryListener();
|
||||
|
||||
new EnterHandler();
|
||||
|
||||
new WinconditionAllDead();
|
||||
new WinconditionCaptainDead();
|
||||
new WinconditionPumpkinTechKO();
|
||||
@ -172,26 +173,11 @@ public class FightSystem extends JavaPlugin {
|
||||
setFightState(FightState.RUNNING);
|
||||
setAllPlayersGM(GameMode.SURVIVAL);
|
||||
|
||||
//TODO: Entern Countdowns and Entern chunk reload
|
||||
|
||||
FightStatistics.start();
|
||||
WaterRemover.init();
|
||||
Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!");
|
||||
}
|
||||
|
||||
public static void setEntern() {
|
||||
//TODO: Remove this function
|
||||
|
||||
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());
|
||||
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) {
|
||||
if(!fightState.ingame())
|
||||
throw new SecurityException(fightState.name());
|
||||
|
@ -4,12 +4,17 @@ import de.steamwar.fightsystem.Config;
|
||||
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 {
|
||||
|
||||
private final FightPlayer fightPlayer;
|
||||
private List<ITechHider.ChunkPos> chunkPos;
|
||||
|
||||
public EnternCountdown(FightPlayer fp) {
|
||||
super(fp.getKit().getEnterStage(), SWSound.BLOCK_NOTE_PLING, false);
|
||||
@ -24,17 +29,17 @@ public class EnternCountdown extends Countdown {
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
fightPlayer.getPlayer().sendMessage(FightSystem.PREFIX + "§aEntern ist nun erlaubt!");
|
||||
//TODO
|
||||
TechHider.reloadChunks(fightPlayer.getPlayer(), chunkPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
void count(){
|
||||
Player player = fightPlayer.getPlayer();
|
||||
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:
|
||||
@ -49,7 +54,8 @@ public class EnternCountdown extends Countdown {
|
||||
player.playSound(player.getLocation(), Countdown.getSound(SWSound.BLOCK_NOTE_PLING), 100.0F, 1.0F);
|
||||
|
||||
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a1 §rSekunde " + countdownCounting()));
|
||||
//TODO
|
||||
|
||||
chunkPos = TechHider.prepareChunkReload(player);
|
||||
break;
|
||||
case 0:
|
||||
player.playSound(player.getLocation(), Countdown.getSound(SWSound.BLOCK_NOTE_PLING), 100.0F, 2.0F);
|
||||
|
@ -1,26 +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();
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren