SteamWar/BungeeCore
Archiviert
13
2

Add EventCommand ML

Dieser Commit ist enthalten in:
Chaoscaot 2021-01-18 21:38:28 +01:00
Ursprung 8dc4bd5f61
Commit 1b77a53c85
2 geänderte Dateien mit 34 neuen und 26 gelöschten Zeilen

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.EventStarter; import de.steamwar.bungeecore.EventStarter;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.Event;
import de.steamwar.bungeecore.sql.EventFight; import de.steamwar.bungeecore.sql.EventFight;
@ -37,9 +38,6 @@ import java.util.Set;
public class EventCommand extends BasicCommand { public class EventCommand extends BasicCommand {
public static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("HH:mm");
static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.");
public EventCommand() { public EventCommand() {
super("event", ""); super("event", "");
} }
@ -64,13 +62,13 @@ public class EventCommand extends BasicCommand {
Team team = Team.get(args[0]); Team team = Team.get(args[0]);
if(team == null){ if(team == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieses Team gibt es nicht"); Message.send("EVENT_NO_TEAM", player);
return; return;
} }
Subserver eventArena = EventStarter.getEventServer().get(team.getTeamId()); Subserver eventArena = EventStarter.getEventServer().get(team.getTeamId());
if(eventArena == null || !Subserver.getServerList().contains(eventArena)){ if(eventArena == null || !Subserver.getServerList().contains(eventArena)){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDas Team kämpft derzeit nicht"); Message.send("EVENT_NO_FIGHT_TEAM", player);
return; return;
} }
@ -78,23 +76,20 @@ public class EventCommand extends BasicCommand {
} }
private void noCurrentEvent(ProxiedPlayer player){ private void noCurrentEvent(ProxiedPlayer player){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDerzeit findet kein Event statt"); Message.send("EVENT_NO_CURRENT", player);
List<Event> coming = Event.getComing(); List<Event> coming = Event.getComing();
if(!coming.isEmpty()){ if(!coming.isEmpty()){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§eKommende Events§8:"); DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_DATE_FORMAT", player));
Message.send("EVENT_COMING", player);
for(Event e : coming){ for(Event e : coming){
BungeeCore.send(player, "§7" + Message.send("EVENT_COMING_EVENT", player, e.getStart().toLocalDateTime().format(dateFormat), e.getEnd().toLocalDateTime().format(dateFormat), e.getEventName());
e.getStart().toLocalDateTime().format(DATE_FORMAT) +
"§8-§7" +
e.getEnd().toLocalDateTime().format(DATE_FORMAT) +
"§8: §e" +
e.getEventName());
Set<Team> teams = TeamTeilnahme.getTeams(e.getEventID()); Set<Team> teams = TeamTeilnahme.getTeams(e.getEventID());
if(!teams.isEmpty()){ if(!teams.isEmpty()){
StringBuilder tline = new StringBuilder("§7 Mit§8: "); StringBuilder tline = new StringBuilder();
for(Team t : teams){ for(Team t : teams){
tline.append("§").append(t.getTeamColor()).append(t.getTeamKuerzel()).append(" "); tline.append(Message.parse("EVENT_COMING_TEAM", player, t.getTeamColor(), t.getTeamKuerzel()));
} }
Message.send("EVENT_COMING_TEAMS", player, tline.toString());
BungeeCore.send(player, tline.toString()); BungeeCore.send(player, tline.toString());
} }
} }
@ -102,33 +97,30 @@ public class EventCommand extends BasicCommand {
} }
private void eventOverview(ProxiedPlayer player, Event currentEvent){ private void eventOverview(ProxiedPlayer player, Event currentEvent){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eevent §8[§eTeam§8] - §7Um dich zum Kampf zu teleportieren"); Message.send("EVENT_SYNTAX", player);
List<EventFight> fights = EventFight.getEvent(currentEvent.getEventID()); List<EventFight> fights = EventFight.getEvent(currentEvent.getEventID());
Instant now = Instant.now(); Instant now = Instant.now();
BungeeCore.send(player, "§e§l" + currentEvent.getEventName()); Message.send("EVENT_CURRENT_EVENT", player, currentEvent.getEventName());
DateTimeFormatter timeFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_TIME_FORMAT", player));
for(EventFight fight : fights){ for(EventFight fight : fights){
Team blue = Team.get(fight.getTeamBlue()); Team blue = Team.get(fight.getTeamBlue());
Team red = Team.get(fight.getTeamRed()); Team red = Team.get(fight.getTeamRed());
StringBuilder fline = new StringBuilder("§7") StringBuilder fline = new StringBuilder(Message.parse("EVENT_CURRENT_FIGHT", player, fight.getStartTime().toLocalDateTime().format(timeFormat), blue.getTeamColor(), blue.getTeamKuerzel(),
.append(fight.getStartTime().toLocalDateTime().format(TIME_FORMAT)) red.getTeamColor(), red.getTeamKuerzel()));
.append(" §e")
.append(blue.getTeamKuerzel())
.append("§8 vs §e")
.append(red.getTeamKuerzel());
if(now.isAfter(fight.getStartTime().toInstant().plus(35, ChronoUnit.MINUTES))){ if(now.isAfter(fight.getStartTime().toInstant().plus(35, ChronoUnit.MINUTES))){
switch(fight.getErgebnis()){ switch(fight.getErgebnis()){
case 1: case 1:
fline.append("§8: §7Sieg §e").append(blue.getTeamKuerzel()); fline.append(Message.parse("EVENT_CURRENT_FIGHT_WIN", player, blue.getTeamColor(), blue.getTeamKuerzel()));
break; break;
case 2: case 2:
fline.append("§8: §7Sieg §e").append(red.getTeamKuerzel()); fline.append(Message.parse("EVENT_CURRENT_FIGHT_WIN", player, red.getTeamColor(), red.getTeamKuerzel()));
break; break;
default: default:
fline.append("§8: §7Unentschieden"); fline.append(Message.parse("EVENT_CURRENT_FIGHT_DRAW", player));
} }
} }

Datei anzeigen

@ -154,6 +154,22 @@ CHALLENGE_CHALLENGED_MAP=auf §e{0} §7
CHALLENGE_ACCEPT=§7Klicke §ehier§7, um die Herausforderung anzunehmen CHALLENGE_ACCEPT=§7Klicke §ehier§7, um die Herausforderung anzunehmen
CHALLENGE_ACCEPT_HOVER=§aHerausforderung annehmen CHALLENGE_ACCEPT_HOVER=§aHerausforderung annehmen
#EventCommand
EVENT_TIME_FORMAT=HH:mm
EVENT_DATE_FORMAT=dd.MM.
EVENT_SYNTAX=§8/§eevent §8[§eTeam§8] - §7Um dich zum Kampf zu teleportieren
EVENT_NO_TEAM=§cDieses Team gibt es nicht
EVENT_NO_FIGHT_TEAM=§cDas Team kämpft derzeit nicht
EVENT_NO_CURRENT=§cDerzeit findet kein Event statt
EVENT_COMING=§eKommende Events§8:
EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2}
EVENT_COMING_TEAMS=§7 Mit§8:{0}
EVENT_COMING_TEAM= §{0}{1}
EVENT_CURRENT_EVENT=§e§l{0}
EVENT_CURRENT_FIGHT=§7{0} §{1}{2}§8 vs §{3}{4}
EVENT_CURRENT_FIGHT_WIN=§8: §7Sieg §{0}{1}
EVENT_CURRENT_FIGHT_DRAW=§8: §7Unentschieden
#CheckCommand #CheckCommand
CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8! CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8!
CHECK_NOT_CHECKING=§cDu prüfst derzeit nicht. CHECK_NOT_CHECKING=§cDu prüfst derzeit nicht.