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 EntityDamageByEntityListener(), plugin);
|
||||||
pm.registerEvents(new FoodLevelChangeListener(), plugin);
|
pm.registerEvents(new FoodLevelChangeListener(), plugin);
|
||||||
pm.registerEvents(new PlayerRespawnListener(), plugin);
|
pm.registerEvents(new PlayerRespawnListener(), plugin);
|
||||||
|
pm.registerEvents(new EntityDamageListener(), plugin);
|
||||||
|
|
||||||
//WinConditions
|
//WinConditions
|
||||||
if(fileManager.getBooleanFromConfig("WinConditions.AllDead")) pm.registerEvents(new WinconditionAllDead(), plugin);
|
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);
|
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()){
|
for(FightPlayer fightPlayer: Fight.getBlueTeam().getPlayers()){
|
||||||
fightPlayer.getPlayer().setGameMode(gm);
|
fightPlayer.getPlayer().setGameMode(gm);
|
||||||
}
|
}
|
||||||
@ -264,9 +265,13 @@ public class FightSystem extends JavaPlugin {
|
|||||||
setAllPlayersGM(GameMode.SURVIVAL);
|
setAllPlayersGM(GameMode.SURVIVAL);
|
||||||
|
|
||||||
if(fileManager.getBooleanFromConfig("WinConditions.Timeout")) {
|
if(fileManager.getBooleanFromConfig("WinConditions.Timeout")) {
|
||||||
int time = fileManager.getIntegerFromConfig("WinConditionParams.TimeoutTime");
|
int timeTimeOver = fileManager.getIntegerFromConfig("WinConditionParams.TimeoutTime");
|
||||||
Countdown countdown = new Countdown(time, new FinishTimeOver());
|
Countdown countdownTimeOver = new Countdown(timeTimeOver, new FinishTimeOver());
|
||||||
countdown.startTimer(FightSystem.getPlugin());
|
countdownTimeOver.startTimer(plugin);
|
||||||
|
|
||||||
|
int timeNoEntern = fileManager.getIntegerFromConfig("WinConditionParams.EnterPhaseBegin");
|
||||||
|
Countdown countdownTimeNoEntern = new Countdown(timeNoEntern, new FinishNoneEntern());
|
||||||
|
countdownTimeNoEntern.startTimer(plugin);
|
||||||
}
|
}
|
||||||
Bukkit.broadcastMessage("§aArena freigegeben!");
|
Bukkit.broadcastMessage("§aArena freigegeben!");
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,7 @@ public class EntityDamageByEntityListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void handleEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
public void handleEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||||
if(instance.getFightState() != FightState.RUNNING) {
|
if(instance.getFightState() != FightState.RUNNING) {
|
||||||
if(event.getEntity() instanceof Player) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
|
||||||
if(event.getDamager() instanceof TNTPrimed) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if(event.getEntity() instanceof Player) {
|
if(event.getEntity() instanceof Player) {
|
||||||
Player player = ((Player) event.getEntity()).getPlayer();
|
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 oppositeFightTeam = Fight.getOpposite(fightTeam);
|
||||||
fightTeam.getFightPlayer(player).setOut(true);
|
fightTeam.getFightPlayer(player).setOut(true);
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §cist gestorben!");
|
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
|
@EventHandler
|
||||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||||
|
event.setJoinMessage(null);
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
|
@ -23,15 +23,11 @@ public class PlayerQuitListener implements Listener {
|
|||||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||||
fightTeam.getFightPlayer(player).setOut(true);
|
fightTeam.getFightPlayer(player).setOut(true);
|
||||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §chat den Fight verlassen!");
|
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...");
|
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 countdown = new Countdown(30*20, new FinishNoPlayersOnline());
|
||||||
countdown.startTimer(FightSystem.getPlugin());
|
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());
|
player.teleport(instance.getSpecSpawnLoc());
|
||||||
} else {
|
} else {
|
||||||
if(Fight.getPlayerTeam(player) == Fight.redTeam)
|
if(Fight.getPlayerTeam(player) == Fight.redTeam)
|
||||||
player.teleport(instance.getTeam1SpawnLoc());
|
event.setRespawnLocation(instance.getTeam1SpawnLoc());
|
||||||
else
|
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("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 ROT: §c" + FightSystem.getPlugin().getDamageRed() + "%").setScore(2);
|
||||||
if(Methods.isEnabled("WinConditions.PercentSystem")) objective.getScore("§eSchaden BLAU: §c" + FightSystem.getPlugin().getGetDamageBlue() + "%").setScore(3);
|
if(Methods.isEnabled("WinConditions.PercentSystem")) objective.getScore("§eSchaden BLAU: §c" + FightSystem.getPlugin().getGetDamageBlue() + "%").setScore(3);
|
||||||
|
index = 0;
|
||||||
}
|
}
|
||||||
player.setScoreboard(scoreboard);
|
player.setScoreboard(scoreboard);
|
||||||
index = 0;
|
|
||||||
}
|
}
|
||||||
}, 0, delay);
|
}, 0, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private FightTeam getIndexDisplay(int index) {
|
private FightTeam getIndexDisplay(int index) {
|
||||||
if(index == 0) {
|
if(index == 0) {
|
||||||
return Fight.redTeam;
|
return Fight.blueTeam;
|
||||||
}
|
}
|
||||||
if(index == 1) {
|
if(index == 1) {
|
||||||
return Fight.blueTeam;
|
return Fight.redTeam;
|
||||||
}
|
}
|
||||||
if(index == 2) {
|
if(index == 2) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -39,6 +39,7 @@ public class WinconditionAllDead implements Listener {
|
|||||||
FightTeam oppositeFightTeam = Fight.getOpposite(fightTeam);
|
FightTeam oppositeFightTeam = Fight.getOpposite(fightTeam);
|
||||||
|
|
||||||
if(fightTeam.allPlayersOut()) {
|
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);
|
instance.setSpectateState(oppositeFightTeam);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren