Multi stage entern and non tnt kits #167
@ -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,26 +173,11 @@ public class FightSystem extends JavaPlugin {
|
|||||||
setFightState(FightState.RUNNING);
|
setFightState(FightState.RUNNING);
|
||||||
setAllPlayersGM(GameMode.SURVIVAL);
|
setAllPlayersGM(GameMode.SURVIVAL);
|
||||||
|
|
||||||
//TODO: Entern Countdowns and Entern chunk reload
|
|
||||||
|
|
||||||
FightStatistics.start();
|
FightStatistics.start();
|
||||||
WaterRemover.init();
|
WaterRemover.init();
|
||||||
Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!");
|
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) {
|
public static void setSpectateState(FightTeam winFightTeam, String windescription) {
|
||||||
if(!fightState.ingame())
|
if(!fightState.ingame())
|
||||||
throw new SecurityException(fightState.name());
|
throw new SecurityException(fightState.name());
|
||||||
|
@ -4,12 +4,17 @@ import de.steamwar.fightsystem.Config;
|
|||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.fight.FightPlayer;
|
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||||
import de.steamwar.fightsystem.listener.BasicListener;
|
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 net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class EnternCountdown extends Countdown {
|
public class EnternCountdown extends Countdown {
|
||||||
|
|
||||||
private final FightPlayer fightPlayer;
|
private final FightPlayer fightPlayer;
|
||||||
|
private List<ITechHider.ChunkPos> chunkPos;
|
||||||
|
|
||||||
public EnternCountdown(FightPlayer fp) {
|
public EnternCountdown(FightPlayer fp) {
|
||||||
super(fp.getKit().getEnterStage(), SWSound.BLOCK_NOTE_PLING, false);
|
super(fp.getKit().getEnterStage(), SWSound.BLOCK_NOTE_PLING, false);
|
||||||
@ -24,17 +29,17 @@ public class EnternCountdown extends Countdown {
|
|||||||
@Override
|
@Override
|
||||||
public void countdownFinished() {
|
public void countdownFinished() {
|
||||||
fightPlayer.getPlayer().sendMessage(FightSystem.PREFIX + "§aEntern ist nun erlaubt!");
|
fightPlayer.getPlayer().sendMessage(FightSystem.PREFIX + "§aEntern ist nun erlaubt!");
|
||||||
//TODO
|
TechHider.reloadChunks(fightPlayer.getPlayer(), chunkPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void count(){
|
void count(){
|
||||||
Player player = fightPlayer.getPlayer();
|
|
||||||
if(!fightPlayer.isLiving()){
|
if(!fightPlayer.isLiving()){
|
||||||
disable();
|
disable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player player = fightPlayer.getPlayer();
|
||||||
int time = Config.EnterStages.get(fightPlayer.getKit().getEnterStage()) - FightSystem.getFightTime();
|
int time = Config.EnterStages.get(fightPlayer.getKit().getEnterStage()) - FightSystem.getFightTime();
|
||||||
switch (time) {
|
switch (time) {
|
||||||
case 900: case 600: case 300: case 180: case 120:
|
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);
|
player.playSound(player.getLocation(), Countdown.getSound(SWSound.BLOCK_NOTE_PLING), 100.0F, 1.0F);
|
||||||
|
|
||||||
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a1 §rSekunde " + countdownCounting()));
|
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a1 §rSekunde " + countdownCounting()));
|
||||||
//TODO
|
|
||||||
|
chunkPos = TechHider.prepareChunkReload(player);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
player.playSound(player.getLocation(), Countdown.getSound(SWSound.BLOCK_NOTE_PLING), 100.0F, 2.0F);
|
player.playSound(player.getLocation(), Countdown.getSound(SWSound.BLOCK_NOTE_PLING), 100.0F, 2.0F);
|
||||||
|
@ -1,26 +1,44 @@
|
|||||||
package de.steamwar.fightsystem.utils;
|
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.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependent;
|
import de.steamwar.fightsystem.states.StateDependent;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class EnterHandler implements StateDependent {
|
public class EnterHandler implements StateDependent {
|
||||||
private static final Set<FightState> enabled = EnumSet.of(FightState.RUNNING);
|
private static final Set<FightState> enabled = EnumSet.of(FightState.RUNNING);
|
||||||
|
private static final Set<EnternCountdown> countdowns = new HashSet<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<FightState> enabled() {
|
public Set<FightState> enabled() {
|
||||||
return 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
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
|
registerTeam(Fight.getBlueTeam());
|
||||||
|
registerTeam(Fight.getRedTeam());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
|
for(EnternCountdown countdown : countdowns){
|
||||||
|
countdown.disable();
|
||||||
|
}
|
||||||
|
countdowns.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren