Not stable version
Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
34d24a2476
Commit
5af0a9dd1a
@ -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);
|
||||
@ -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!");
|
||||
}
|
||||
|
@ -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();
|
||||
|
23
src/me/yaruma/fightsystem/listener/EntityDamageListener.java
Normale Datei
23
src/me/yaruma/fightsystem/listener/EntityDamageListener.java
Normale Datei
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren