SteamWar/FightSystem
Archiviert
13
1

implemented schematic locking

Dieser Commit ist enthalten in:
Yaruma3341 2019-11-21 16:09:58 +01:00 committet von BuildTools
Ursprung 27c77b857f
Commit 2a6f28b935
12 geänderte Dateien mit 43 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -148,7 +148,7 @@ public class FightSystem extends JavaPlugin {
Bukkit.broadcastMessage(" "); Bukkit.broadcastMessage(" ");
if(winFightTeam != null) { if(winFightTeam != null) {
Bukkit.broadcastMessage(PREFIX + "§aDas Team " + winFightTeam.getName() + " §ahat gewonnen!"); Bukkit.broadcastMessage(PREFIX + "§aDas Team " + winFightTeam.getColoredName() + " §ahat gewonnen!");
} else { } else {
Bukkit.broadcastMessage(PREFIX + "§aKein Team hat gewonnen!"); Bukkit.broadcastMessage(PREFIX + "§aKein Team hat gewonnen!");
} }

Datei anzeigen

@ -83,7 +83,17 @@ public class AkCommand implements CommandExecutor {
player.sendMessage(FightSystem.PREFIX + "§cDu musst eine Seitenzahl angeben!"); player.sendMessage(FightSystem.PREFIX + "§cDu musst eine Seitenzahl angeben!");
return false; return false;
} }
}else } else if(args[0].equalsIgnoreCase("lockschem")) {
String teamName = args[1];
FightTeam fightTeam = Fight.getTeamByName(teamName);
if(fightTeam == null) {
player.sendMessage(FightSystem.PREFIX + "§cDieses Team existiert nicht!");
return false;
}
fightTeam.getSchematic().setSchemType(SchematicType.Normal);
player.sendMessage(FightSystem.PREFIX + "Schematic von " + fightTeam.getColoredName() + "§cgepserrt!");
} else
Commands.sendHelp(player); Commands.sendHelp(player);
break; break;
case 3: case 3:

Datei anzeigen

@ -87,7 +87,7 @@ class Commands {
return; return;
FightPlayer leader = team.getLeader(); FightPlayer leader = team.getLeader();
p.sendMessage(FightSystem.PREFIX + "§aDu bist Team " + team.getName() + " §abeigetreten!"); p.sendMessage(FightSystem.PREFIX + "§aDu bist Team " + team.getColoredName() + " §abeigetreten!");
leader.sendMessage(FightSystem.PREFIX + "§aDer Spieler §e" + p.getName() + " §aist deinem Team beigetreten!"); leader.sendMessage(FightSystem.PREFIX + "§aDer Spieler §e" + p.getName() + " §aist deinem Team beigetreten!");
team.addMember(p); team.addMember(p);
} }
@ -101,7 +101,7 @@ class Commands {
return; return;
FightPlayer leader = team.getLeader(); FightPlayer leader = team.getLeader();
p.sendMessage(FightSystem.PREFIX + "§aDu hast die Einladung von " + team.getName() + " §aabgelehnt!"); p.sendMessage(FightSystem.PREFIX + "§aDu hast die Einladung von " + team.getColoredName() + " §aabgelehnt!");
leader.sendMessage(FightSystem.PREFIX + "§cDer Spieler §e" + p.getName() + " §chat deine Einladung abgelehnt!"); leader.sendMessage(FightSystem.PREFIX + "§cDer Spieler §e" + p.getName() + " §chat deine Einladung abgelehnt!");
team.getInvited().remove(p); team.getInvited().remove(p);
} }
@ -114,7 +114,7 @@ class Commands {
if(fightTeam == null) if(fightTeam == null)
return; return;
p.sendMessage(FightSystem.PREFIX + "§aDu hast das Team " + fightTeam.getName() + " §averlassen!"); p.sendMessage(FightSystem.PREFIX + "§aDu hast das Team " + fightTeam.getColoredName() + " §averlassen!");
fightTeam.removePlayer(p); fightTeam.removePlayer(p);
} }

Datei anzeigen

@ -17,12 +17,12 @@ public class TechKOCountdown extends Countdown {
@Override @Override
final String countdownCounting() { final String countdownCounting() {
return "bis " + team.getName() + " §7einen Schuss abgegeben haben muss!"; return "bis " + team.getColoredName() + " §7einen Schuss abgegeben haben muss!";
} }
@Override @Override
void countdownFinished() { void countdownFinished() {
Bukkit.broadcastMessage(FightSystem.PREFIX + team.getName() + "§7 ist §eTech K§8.§eO§8.!"); Bukkit.broadcastMessage(FightSystem.PREFIX + team.getColoredName() + "§7 ist §eTech K§8.§eO§8.!");
FightSystem.setSpectateState(Fight.getOpposite(team)); FightSystem.setSpectateState(Fight.getOpposite(team));
} }
} }

Datei anzeigen

@ -66,4 +66,12 @@ public class Fight {
public static void setLevel(int level) { public static void setLevel(int level) {
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.setLevel(level)); Bukkit.getServer().getOnlinePlayers().forEach(player -> player.setLevel(level));
} }
public static FightTeam getTeamByName(String name) {
if(redTeam.getName().equalsIgnoreCase(name))
return redTeam;
if(blueTeam.getName().equalsIgnoreCase(name))
return blueTeam;
return null;
}
} }

Datei anzeigen

@ -149,9 +149,9 @@ public class FightTeam implements IFightTeam{
this.leader = null; this.leader = null;
if(!players.isEmpty()) { if(!players.isEmpty()) {
setLeader(players.iterator().next()); setLeader(players.iterator().next());
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §e" + leader.getPlayer().getName() + " §aist nun Leader von Team " + getName() + "§a!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §e" + leader.getPlayer().getName() + " §aist nun Leader von Team " + getColoredName() + "§a!");
}else if(!Config.event()){ }else if(!Config.event()){
FightSystem.shutdown(FightSystem.PREFIX + "§cTeam " + getName() + " §chat keine Spieler mehr.\n Arena schließt..."); FightSystem.shutdown(FightSystem.PREFIX + "§cTeam " + getColoredName() + " §chat keine Spieler mehr.\n Arena schließt...");
}else{ }else{
setLeader(null); setLeader(null);
} }
@ -286,6 +286,10 @@ public class FightTeam implements IFightTeam{
} }
public String getName() { public String getName() {
return name;
}
public String getColoredName() {
return prefix + name; return prefix + name;
} }
@ -293,6 +297,10 @@ public class FightTeam implements IFightTeam{
return prefix; return prefix;
} }
public Schematic getSchematic() {
return schematic;
}
public Location getSpawn() { public Location getSpawn() {
return spawn; return spawn;
} }

Datei anzeigen

@ -19,7 +19,7 @@ public class PlayerChatListener extends BasicListener {
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
if(fightTeam != null) { if(fightTeam != null) {
String teamName = fightTeam.getName(); String teamName = fightTeam.getColoredName();
if(message.startsWith(Config.TeamChatDetection)) { if(message.startsWith(Config.TeamChatDetection)) {
fightTeam.broadcast(teamName + " " + player.getName() + "» " + message.substring(1)); fightTeam.broadcast(teamName + " " + player.getName() + "» " + message.substring(1));
} else { } else {

Datei anzeigen

@ -47,7 +47,7 @@ public class FightScoreboard {
} }
private static void teamScoreboard(FightTeam fightTeam){ private static void teamScoreboard(FightTeam fightTeam){
objective.setDisplayName(fightTeam.getName()); objective.setDisplayName(fightTeam.getColoredName());
fightTeam.getPlayers().forEach(fp -> { fightTeam.getPlayers().forEach(fp -> {
if(fp.isLiving()) if(fp.isLiving())
objective.getScore(fightTeam.getPrefix() + fp.getPlayer().getName()).setScore((int) fp.getPlayer().getHealth()); objective.getScore(fightTeam.getPrefix() + fp.getPlayer().getName()).setScore((int) fp.getPlayer().getHealth());

Datei anzeigen

@ -14,7 +14,7 @@ public class EventTeamOffWincondition {
private void teamOff(FightTeam team){ private void teamOff(FightTeam team){
if(team.allPlayersOut()){ if(team.allPlayersOut()){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team " + team.getName() + " §6ist Offline!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team " + team.getColoredName() + " §6ist Offline!");
FightSystem.setSpectateState(Fight.getOpposite(team)); FightSystem.setSpectateState(Fight.getOpposite(team));
} }
} }

Datei anzeigen

@ -25,7 +25,7 @@ public class WinconditionAllDead extends PlayerWincondition {
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
if(fightTeam.allPlayersOut()) { if(fightTeam.allPlayersOut()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus " + fightTeam.getPrefix() + fightTeam.getName() + " §cist gestorben!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus " + fightTeam.getPrefix() + fightTeam.getColoredName() + " §cist gestorben!");
FightSystem.setSpectateState(Fight.getOpposite(fightTeam)); FightSystem.setSpectateState(Fight.getOpposite(fightTeam));
} }
} }
@ -39,7 +39,7 @@ public class WinconditionAllDead extends PlayerWincondition {
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
if(fightTeam.allPlayersOut()) { if(fightTeam.allPlayersOut()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus §6" + fightTeam.getPrefix() + fightTeam.getName() + " §chat den Kampf verlassen!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus §6" + fightTeam.getPrefix() + fightTeam.getColoredName() + " §chat den Kampf verlassen!");
FightSystem.setSpectateState(Fight.getOpposite(fightTeam)); FightSystem.setSpectateState(Fight.getOpposite(fightTeam));
} }
} }

Datei anzeigen

@ -25,7 +25,7 @@ public class WinconditionCaptainDead extends PlayerWincondition {
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
if(fightTeam.isPlayerLeader(player)) { if(fightTeam.isPlayerLeader(player)) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getName() + " §cist gestorben!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getColoredName() + " §cist gestorben!");
FightSystem.setSpectateState(Fight.getOpposite(fightTeam)); FightSystem.setSpectateState(Fight.getOpposite(fightTeam));
} }
} }
@ -39,7 +39,7 @@ public class WinconditionCaptainDead extends PlayerWincondition {
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
if(fightTeam.isPlayerLeader(player)) { if(fightTeam.isPlayerLeader(player)) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getName() + " §chat den Kampf verlassen!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getColoredName() + " §chat den Kampf verlassen!");
FightSystem.setSpectateState(Fight.getOpposite(fightTeam)); FightSystem.setSpectateState(Fight.getOpposite(fightTeam));
} }
} }

Datei anzeigen

@ -79,7 +79,7 @@ public class WinconditionWaterTechKO {
private static void checkEmpty(FightTeam team, Set<Location> teamWater){ private static void checkEmpty(FightTeam team, Set<Location> teamWater){
if(teamWater.isEmpty()){ if(teamWater.isEmpty()){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§eDas Team " + team.getName() + " §eist Tech K.O.!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§eDas Team " + team.getColoredName() + " §eist Tech K.O.!");
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> FightSystem.setSpectateState(Fight.getOpposite(team))); Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> FightSystem.setSpectateState(Fight.getOpposite(team)));
} }
} }