SteamWar/FightSystem
Archiviert
13
1

Not stable version

Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Yaruma3341 2019-02-23 22:45:45 +01:00
Ursprung 34d24a2476
Commit 5af0a9dd1a
9 geänderte Dateien mit 46 neuen und 34 gelöschten Zeilen

Datei anzeigen

@ -178,6 +178,7 @@ public class FightSystem extends JavaPlugin {
pm.registerEvents(new EntityDamageByEntityListener(), plugin);
pm.registerEvents(new FoodLevelChangeListener(), plugin);
pm.registerEvents(new PlayerRespawnListener(), plugin);
pm.registerEvents(new EntityDamageListener(), plugin);
//WinConditions
if(fileManager.getBooleanFromConfig("WinConditions.AllDead")) pm.registerEvents(new WinconditionAllDead(), plugin);
@ -246,7 +247,7 @@ public class FightSystem extends JavaPlugin {
WorldEdit.replace(Fight.getRedTeam().getLeader().getPlayer(), team2cornerX, team2cornerY, team2cornerZ, team2cornerX + schemsizeX, team2cornerY + schemsizeY, team2cornerZ + schemsizeZ);
}
private void setAllPlayersGM(GameMode gm){
private void setAllPlayersGM(GameMode gm) {
for(FightPlayer fightPlayer: Fight.getBlueTeam().getPlayers()){
fightPlayer.getPlayer().setGameMode(gm);
}
@ -264,9 +265,13 @@ public class FightSystem extends JavaPlugin {
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());
int timeTimeOver = fileManager.getIntegerFromConfig("WinConditionParams.TimeoutTime");
Countdown countdownTimeOver = new Countdown(timeTimeOver, new FinishTimeOver());
countdownTimeOver.startTimer(plugin);
int timeNoEntern = fileManager.getIntegerFromConfig("WinConditionParams.EnterPhaseBegin");
Countdown countdownTimeNoEntern = new Countdown(timeNoEntern, new FinishNoneEntern());
countdownTimeNoEntern.startTimer(plugin);
}
Bukkit.broadcastMessage("§aArena freigegeben!");
}

Datei anzeigen

@ -19,12 +19,7 @@ public class EntityDamageByEntityListener implements Listener {
@EventHandler
public void handleEntityDamageByEntity(EntityDamageByEntityEvent event) {
if(instance.getFightState() != FightState.RUNNING) {
if(event.getEntity() instanceof Player) {
event.setCancelled(true);
}
if(event.getDamager() instanceof TNTPrimed) {
event.setCancelled(true);
}
} else {
if(event.getEntity() instanceof Player) {
Player player = ((Player) event.getEntity()).getPlayer();

Datei anzeigen

@ -0,0 +1,23 @@
package me.yaruma.fightsystem.listener;
import me.yaruma.fightsystem.FightSystem;
import me.yaruma.fightsystem.fight.Fight;
import me.yaruma.fightsystem.fight.FightState;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
public class EntityDamageListener implements Listener {
@EventHandler
public void handleEntityDamage(EntityDamageEvent event) {
Player player = (Player) event.getEntity();
if(Fight.getPlayerTeam(player) != null) {
if(FightSystem.getPlugin().getFightState() != FightState.RUNNING) event.setCancelled(true);
} else
event.setCancelled(true);
}
}

Datei anzeigen

@ -21,16 +21,6 @@ public class PlayerDeathListener implements Listener {
FightTeam oppositeFightTeam = Fight.getOpposite(fightTeam);
fightTeam.getFightPlayer(player).setOut(true);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §cist gestorben!");
if(fightTeam.allPlayersOut()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team " + fightTeam.getLeader().getPlayer().getName() + " §csind gestorben!");
instance.setSpectateState(oppositeFightTeam);
} else {
if(Fight.getPlayerTeam(player) == Fight.redTeam){
player.teleport(instance.getFightManager().getRedTeleportLocation());
}else{
player.teleport(instance.getFightManager().getBlueTeleportLocation());
}
}
}

Datei anzeigen

@ -24,6 +24,8 @@ public class PlayerJoinListener implements Listener {
@EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) {
event.setJoinMessage(null);
Player player = event.getPlayer();
player.setHealth(20);

Datei anzeigen

@ -23,15 +23,11 @@ public class PlayerQuitListener implements Listener {
FightTeam fightTeam = Fight.getPlayerTeam(player);
fightTeam.getFightPlayer(player).setOut(true);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §chat den Fight verlassen!");
if(fightTeam.allPlayersOut()) {
if(FightSystem.getPlugin().getFightState() == FightState.SETUP) {
if(fightTeam.allPlayersOut() && FightSystem.getPlugin().getFightState() == FightState.SETUP) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team von §6" + fightTeam.getLeader().getPlayer() + " §chaben den Kampf verlassen! \n §4Stoppe Server in 30 Sekunden...");
Countdown countdown = new Countdown(30*20, new FinishNoPlayersOnline());
countdown.startTimer(FightSystem.getPlugin());
} else {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team von §6" + fightTeam.getLeader().getPlayer() + " §csind tot oder haben den Kampf verlassen! \n §60 Sekunden Zeit zum Begutachten!");
FightSystem.getPlugin().setSpectateState(Fight.getOpposite(fightTeam));
}
}
}

Datei anzeigen

@ -18,9 +18,9 @@ public class PlayerRespawnListener implements Listener {
player.teleport(instance.getSpecSpawnLoc());
} else {
if(Fight.getPlayerTeam(player) == Fight.redTeam)
player.teleport(instance.getTeam1SpawnLoc());
event.setRespawnLocation(instance.getTeam1SpawnLoc());
else
player.teleport(instance.getTeam2SpawnLoc());
event.setRespawnLocation(instance.getTeam2SpawnLoc());
}
}

Datei anzeigen

@ -56,19 +56,19 @@ public class Scoreboard {
if(Methods.isEnabled("Fight.Entern")) objective.getScore("§7Entern: " + (FightSystem.getPlugin().isEntern() ? "§aja" : "§cnein")).setScore(1);
if(Methods.isEnabled("WinConditions.PercentSystem")) objective.getScore("§eSchaden ROT: §c" + FightSystem.getPlugin().getDamageRed() + "%").setScore(2);
if(Methods.isEnabled("WinConditions.PercentSystem")) objective.getScore("§eSchaden BLAU: §c" + FightSystem.getPlugin().getGetDamageBlue() + "%").setScore(3);
index = 0;
}
player.setScoreboard(scoreboard);
index = 0;
}
}, 0, delay);
}
private FightTeam getIndexDisplay(int index) {
if(index == 0) {
return Fight.redTeam;
return Fight.blueTeam;
}
if(index == 1) {
return Fight.blueTeam;
return Fight.redTeam;
}
if(index == 2) {
return null;

Datei anzeigen

@ -39,6 +39,7 @@ public class WinconditionAllDead implements Listener {
FightTeam oppositeFightTeam = Fight.getOpposite(fightTeam);
if(fightTeam.allPlayersOut()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team von §6" + fightTeam.getLeader().getPlayer() + " §csind tot oder haben den Kampf verlassen! \n §60 Sekunden Zeit zum Begutachten!");
instance.setSpectateState(oppositeFightTeam);
return;
}