SteamWar/FightSystem
Archiviert
13
1
Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Yaruma3341 2019-04-14 13:55:40 +02:00
Ursprung a2c535a6e5
Commit 700d01bdac
3 geänderte Dateien mit 35 neuen und 27 gelöschten Zeilen

Datei anzeigen

@ -44,6 +44,11 @@ public class AkCommand implements CommandExecutor {
if(team != null){ if(team != null){
FightPlayer leader = team.getLeader(); FightPlayer leader = team.getLeader();
team.addMember(player); team.addMember(player);
player.setGameMode(GameMode.ADVENTURE);
if(team == Fight.getRedTeam())
player.teleport(Config.TeamRedSpawn);
else
player.teleport(Config.TeamBlueSpawn);
player.sendMessage(FightSystem.PREFIX + "§aDu bist dem Team von §6" + leader.getPlayer().getName() + " §abeigetreten!"); player.sendMessage(FightSystem.PREFIX + "§aDu bist dem Team von §6" + leader.getPlayer().getName() + " §abeigetreten!");
leader.sendMessage(FightSystem.PREFIX + "§aDer Spieler §6" + player.getName() + " §aist deinem Team beigetreten"); leader.sendMessage(FightSystem.PREFIX + "§aDer Spieler §6" + player.getName() + " §aist deinem Team beigetreten");
} }
@ -92,7 +97,9 @@ public class AkCommand implements CommandExecutor {
Player target = Bukkit.getPlayer(args[1]); Player target = Bukkit.getPlayer(args[1]);
if(target != null) { if(target != null) {
if(!(Fight.getOpposite(fightTeam).getInvited().contains(target) && fightTeam.getInvited().contains(target))) { if(Fight.getPlayerTeam(target) != null) {
player.sendMessage(FightSystem.PREFIX + "§cDer Spieler §6" + target.getName() + " §cist bereits in einem Team!");
} else if(!(Fight.getOpposite(fightTeam).getInvited().contains(target) && fightTeam.getInvited().contains(target))) {
fightTeam.getInvited().add(target); fightTeam.getInvited().add(target);
target.sendMessage(FightSystem.PREFIX + "§aDu wurdest von §6" + player.getName() + " §ain sein Team eingeladen!"); target.sendMessage(FightSystem.PREFIX + "§aDu wurdest von §6" + player.getName() + " §ain sein Team eingeladen!");
player.sendMessage(FightSystem.PREFIX + "§aDu hast den Spieler §6" + target.getName() + " §ain dein Team eingeladen!"); player.sendMessage(FightSystem.PREFIX + "§aDu hast den Spieler §6" + target.getName() + " §ain dein Team eingeladen!");

Datei anzeigen

@ -94,14 +94,13 @@ public class PlayerJoinListener implements Listener {
} }
} }
if(Fight.getRedTeam().getLeader().getPlayer() == player if(Fight.getRedTeam().hasTeamLeader() && Fight.getBlueTeam().hasTeamLeader() && instance.getFightState() == FightState.SETUP) {
|| Fight.getBlueTeam().getLeader().getPlayer() == player if(Fight.getRedTeam().getLeader().getPlayer() == player || Fight.getBlueTeam().getLeader().getPlayer() == player) {
&& Fight.getBlueTeam().hasTeamLeader()
&& Fight.getRedTeam().hasTeamLeader()) {
Countdown.cancelTimerType(CountdownType.NO_PLAYERS_ONLINE); Countdown.cancelTimerType(CountdownType.NO_PLAYERS_ONLINE);
Countdown countdown = new Countdown(Config.SetupDuration, new FinishSetupOver()); Countdown countdown = new Countdown(Config.SetupDuration, new FinishSetupOver());
countdown.startTimer(instance); countdown.startTimer(instance);
} }
}
instance.getScoreboard().setAutoScoreboard(20*10, player); instance.getScoreboard().setAutoScoreboard(20*10, player);
} }

Datei anzeigen

@ -19,6 +19,9 @@ public class WinconditionTechKO {
public static void addWater() { public static void addWater() {
if(!Config.TechKO) return; if(!Config.TechKO) return;
teamRedWater.clear();
teamBlueWater.clear();
int redMinX = Config.TeamRedCornerX; int redMinX = Config.TeamRedCornerX;
int redMinY = Config.TeamRedCornerY; int redMinY = Config.TeamRedCornerY;
int redMinZ = Config.TeamRedCornerZ; int redMinZ = Config.TeamRedCornerZ;
@ -33,19 +36,6 @@ public class WinconditionTechKO {
int blueMaxY = (blueMinY + Config.SchemsizeY); int blueMaxY = (blueMinY + Config.SchemsizeY);
int blueMaxZ = (blueMinZ + Config.SchemsizeZ); int blueMaxZ = (blueMinZ + Config.SchemsizeZ);
Bukkit.broadcastMessage(" " + redMinX);
Bukkit.broadcastMessage(" " + redMinY);
Bukkit.broadcastMessage(" " + redMinZ);
Bukkit.broadcastMessage(" " + redMaxX);
Bukkit.broadcastMessage(" " + redMaxY);
Bukkit.broadcastMessage(" " + redMaxZ);
Bukkit.broadcastMessage(" " + blueMinX);
Bukkit.broadcastMessage(" " + blueMinY);
Bukkit.broadcastMessage(" " + blueMinZ);
Bukkit.broadcastMessage(" " + blueMaxX);
Bukkit.broadcastMessage(" " + blueMaxY);
Bukkit.broadcastMessage(" " + blueMaxZ);
//Team Red //Team Red
for(int x = redMinX; x <= redMaxX; x++) { for(int x = redMinX; x <= redMaxX; x++) {
for(int y = redMinY; y <= redMaxY; y++) { for(int y = redMinY; y <= redMaxY; y++) {
@ -69,8 +59,18 @@ public class WinconditionTechKO {
} }
} }
} }
Bukkit.broadcastMessage("Red: " + teamRedWater.size());
Bukkit.broadcastMessage("Blue: " + teamBlueWater.size()); if(teamRedWater.isEmpty()) {
Bukkit.getScheduler().cancelTask(taskID);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team " + Config.TeamRedPrefix + Config.TeamRedName + " §6ist Tech K.O. !");
FightSystem.getPlugin().setSpectateState(Fight.getBlueTeam());
} else if(teamBlueWater.isEmpty()) {
Bukkit.getScheduler().cancelTask(taskID);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team " + Config.TeamBluePrefix + Config.TeamBlueName + " §6ist Tech K.O. !");
FightSystem.getPlugin().setSpectateState(Fight.getRedTeam());
}
Bukkit.broadcastMessage("RedList: " + teamRedWater.size());
Bukkit.broadcastMessage("BlueList: " + teamBlueWater.size());
} }
public static void removeWater() { public static void removeWater() {
@ -85,12 +85,13 @@ public class WinconditionTechKO {
} }
} }
if(teamRedWater.isEmpty()) { if(teamRedWater.isEmpty()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "6Das Team " + Config.TeamRedPrefix + Config.TeamRedName + " §6ist Tech K.O. !"); Bukkit.getScheduler().cancelTask(taskID);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team " + Config.TeamRedPrefix + Config.TeamRedName + " §6ist Tech K.O. !");
FightSystem.getPlugin().setSpectateState(Fight.getBlueTeam()); FightSystem.getPlugin().setSpectateState(Fight.getBlueTeam());
} }
//Team Blue //Team Blue
Iterator itrBlue = teamRedWater.iterator(); Iterator itrBlue = teamBlueWater.iterator();
while (itrRed.hasNext()) { while (itrRed.hasNext()) {
Location location = (Location) itrRed.next(); Location location = (Location) itrRed.next();
if(location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.STATIONARY_WATER) { if(location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.STATIONARY_WATER) {
@ -99,7 +100,8 @@ public class WinconditionTechKO {
} }
} }
if(teamBlueWater.isEmpty()) { if(teamBlueWater.isEmpty()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "6Das Team " + Config.TeamBluePrefix + Config.TeamBlueName + " §6ist Tech K.O. !"); Bukkit.getScheduler().cancelTask(taskID);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team " + Config.TeamBluePrefix + Config.TeamBlueName + " §6ist Tech K.O. !");
FightSystem.getPlugin().setSpectateState(Fight.getRedTeam()); FightSystem.getPlugin().setSpectateState(Fight.getRedTeam());
} }
} }
@ -109,7 +111,7 @@ public class WinconditionTechKO {
taskID = Bukkit.getScheduler().scheduleAsyncRepeatingTask(FightSystem.getPlugin(), new Runnable() { taskID = Bukkit.getScheduler().scheduleAsyncRepeatingTask(FightSystem.getPlugin(), new Runnable() {
@Override @Override
public void run() { public void run() {
removeWater(); addWater();
} }
}, 0, 20*20); }, 0, 20*20);
} }