SteamWar/FightSystem
Archiviert
13
1
Dieser Commit ist enthalten in:
lixfel 2019-02-23 17:44:36 +01:00
Ursprung 78f78fb6da
Commit b436560604
3 geänderte Dateien mit 66 neuen und 53 gelöschten Zeilen

Datei anzeigen

@ -6,15 +6,14 @@ import me.yaruma.fightsystem.commands.AkCommand;
import me.yaruma.fightsystem.fight.*;
import me.yaruma.fightsystem.listener.*;
import me.yaruma.fightsystem.manager.FileManager;
import me.yaruma.fightsystem.utils.countdown.Countdown;
import me.yaruma.fightsystem.utils.countdown.FinishNoPlayersOnline;
import me.yaruma.fightsystem.utils.countdown.FinishSetupOver;
import me.yaruma.fightsystem.utils.countdown.FinishSpectateOver;
import me.yaruma.fightsystem.utils.WorldEdit;
import me.yaruma.fightsystem.utils.countdown.*;
import me.yaruma.fightsystem.utils.scoreboard.Scoreboard;
import me.yaruma.fightsystem.winconditions.WinconditionAllDead;
import me.yaruma.fightsystem.winconditions.WinconditionCaptainDead;
import me.yaruma.fightsystem.winconditions.WinconditionPercentSystem;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@ -225,51 +224,84 @@ public class FightSystem extends JavaPlugin {
}
public void setPreRunningState() {
if(this.fightState == FightState.SETUP) {
this.fightState = FightState.PRE_RUNNING;
if(this.fightState != FightState.SETUP)
return;
this.fightState = FightState.PRE_RUNNING;
int time = fileManager.getIntegerFromConfig("Times.PreFightDuration");
Countdown countdown = new Countdown(time, new FinishPreRunning());
countdown.startTimer(this);
for(FightPlayer allFightPlayers : Fight.getBlueTeam().getPlayers()) {
allFightPlayers.getPlayer().getInventory().clear();
}
for(FightPlayer allFightPlayers : Fight.getRedTeam().getPlayers()) {
allFightPlayers.getPlayer().getInventory().clear();
}
instance.getFightManager().teleportAllToFightSpawn();
WorldEdit.replace(Fight.getBlueTeam().getLeader().getPlayer(), team1cornerX, team1cornerY, team1cornerZ, team1cornerX + schemsizeX, team1cornerY + schemsizeY, team1cornerZ + schemsizeZ);
WorldEdit.replace(Fight.getRedTeam().getLeader().getPlayer(), team2cornerX, team2cornerY, team2cornerZ, team2cornerX + schemsizeX, team2cornerY + schemsizeY, team2cornerZ + schemsizeZ);
}
private void setAllPlayersGM(GameMode gm){
for(FightPlayer fightPlayer: Fight.getBlueTeam().getPlayers()){
fightPlayer.getPlayer().setGameMode(gm);
}
for(FightPlayer fightPlayer: Fight.getRedTeam().getPlayers()){
fightPlayer.getPlayer().setGameMode(gm);
}
}
public void setRunningState() {
if(this.fightState == FightState.PRE_RUNNING) {
this.fightState = FightState.RUNNING;
if(this.fightState != FightState.PRE_RUNNING)
return;
this.fightState = FightState.RUNNING;
setAllPlayersGM(GameMode.SURVIVAL);
if(fileManager.getBooleanFromConfig("WinConditions.Timeout")) {
int time = fileManager.getIntegerFromConfig("WinConditionParams.TimeoutTime");
Countdown countdown = new Countdown(time, new FinishTimeOver());
countdown.startTimer(FightSystem.getPlugin());
}
Bukkit.broadcastMessage("§aArena freigegeben!");
}
public void setSpectateState(FightTeam winFightTeam) {
if(this.fightState == FightState.RUNNING) {
this.fightState = FightState.SPECTATE;
if(this.fightState != FightState.RUNNING):
return;
this.fightState = FightState.SPECTATE;
Bukkit.broadcastMessage(" ");
setAllPlayersGM(GameMode.SPECTATOR);
entern = true;
Bukkit.broadcastMessage(" ");
if(winFightTeam != null) {
if(winFightTeam != null) {
Bukkit.broadcastMessage(PREFIX + "§aDas Team von §6" + winFightTeam.getLeader().getPlayer().getName() + " §ahat gewonnen!");
plugin.getFightManager().teleportAllToFightSpawn();
Bukkit.broadcastMessage(PREFIX + "§aDas Team von §6" + winFightTeam.getLeader().getPlayer().getName() + " §ahat gewonnen!");
plugin.getFightManager().teleportAllToFightSpawn();
for(FightPlayer fightPlayer : winFightTeam.getPlayers()) {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Win"));
}
for(FightPlayer fightPlayer : Fight.getOpposite(winFightTeam).getPlayers()) {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Lose"));
}
} else {
//Keine Message! Wird in FinishTimeOver gesendet!
for(FightPlayer fightPlayer : winFightTeam.getPlayers()) {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Undecided"));
}
for(FightPlayer fightPlayer : Fight.getOpposite(winFightTeam).getPlayers()) {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Undecided"));
}
for(FightPlayer fightPlayer : winFightTeam.getPlayers()) {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Win"));
}
Countdown cancelAllCountdowns = new Countdown();
cancelAllCountdowns.cancelAllTimers(FightSystem.getPlugin());
Countdown countdown = new Countdown(20*60, new FinishSpectateOver());
countdown.startTimer(FightSystem.getPlugin());
for(FightPlayer fightPlayer : Fight.getOpposite(winFightTeam).getPlayers()) {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Lose"));
}
} else {
//Keine Message! Wird in FinishTimeOver gesendet!
for(FightPlayer fightPlayer : winFightTeam.getPlayers()) {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Undecided"));
}
for(FightPlayer fightPlayer : Fight.getOpposite(winFightTeam).getPlayers()) {
CoinSystem.getCoinsManager(fightPlayer.getPlayer()).addCoins(getMoneyToPay("Money.Undecided"));
}
}
Countdown cancelAllCountdowns = new Countdown();
cancelAllCountdowns.cancelAllTimers(FightSystem.getPlugin());
Countdown countdown = new Countdown(20*60, new FinishSpectateOver());
countdown.startTimer(FightSystem.getPlugin());
}
public int getMoneyToPay(String moneyPath) {

Datei anzeigen

@ -128,18 +128,6 @@ public class FightTeam {
broadcast(FightSystem.PREFIX + "§aEuer Team ist nun bereit!");
if(Fight.getOpposite(fightTeam).isReady()) {
instance.setPreRunningState();
int time = instance.getFileManager().getIntegerFromConfig("Times.PreFightDuration");
Countdown countdown = new Countdown(time, new FinishPreRunning());
countdown.startTimer(instance);
for(FightPlayer allFightPlayers : fightTeam.getPlayers()) {
allFightPlayers.getPlayer().getInventory().clear();
}
for(FightPlayer allFightPlayers : Fight.getOpposite(fightTeam).getPlayers()) {
allFightPlayers.getPlayer().getInventory().clear();
}
instance.getFightManager().teleportAllToFightSpawn();
WorldEdit.replace(fightTeam.getLeader().getPlayer(), instance.getTeam1cornerX(), instance.getTeam1cornerY(), instance.getTeam1cornerZ(), instance.getTeam1cornerX() + instance.getSchemsizeX(), instance.getTeam1cornerY() + instance.getSchemsizeY(), instance.getTeam1cornerZ() + instance.getSchemsizeZ());
WorldEdit.replace(Fight.getOpposite(fightTeam).getLeader().getPlayer(), instance.getTeam2cornerX(), instance.getTeam2cornerY(), instance.getTeam2cornerZ(), instance.getTeam2cornerX() + instance.getSchemsizeX(), instance.getTeam2cornerY() + instance.getSchemsizeY(), instance.getTeam2cornerZ() + instance.getSchemsizeZ());
}
} else {
fightTeam.getLeader().getPlayer().getInventory().setItem(3, new ItemBuilder(Material.INK_SACK, (short) 10).removeAllAtributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build());

Datei anzeigen

@ -16,12 +16,5 @@ public class FinishPreRunning implements CountdownCallback {
@Override
public void countdownFinished() {
FightSystem.getPlugin().setRunningState();
if(fileManager.getBooleanFromConfig("WinConditions.Timeout")) {
int time = fileManager.getIntegerFromConfig("WinConditionParams.TimeoutTime");
Countdown countdown = new Countdown(time, new FinishTimeOver());
countdown.startTimer(FightSystem.getPlugin());
}
Bukkit.broadcastMessage("§aArena freigegeben!");
}
}