SteamWar/BungeeCore
Archiviert
13
2

Merge branch 'master' into arena_merging_2.0
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2022-04-01 18:00:50 +02:00
Commit 7a04359ecb
8 geänderte Dateien mit 44 neuen und 32 gelöschten Zeilen

Datei anzeigen

@ -85,13 +85,9 @@ public class ErrorLogger extends Handler {
static { static {
List<String> contains = new ArrayList<>(); List<String> contains = new ArrayList<>();
contains.add("ServerConnector");
contains.add("InitialHandler");
contains.add("UpstreamBridge");
contains.add("DownstreamBridge");
contains.add(" took ");
contains.add("No client connected for pending server!");
contains.add("Error authenticating "); contains.add("Error authenticating ");
contains.add("read timed out");
contains.add("Connection reset by peer");
ignoreContains = Collections.unmodifiableList(contains); ignoreContains = Collections.unmodifiableList(contains);
} }
} }

Datei anzeigen

@ -59,23 +59,27 @@ public class EventStarter implements Runnable {
EventFight next; EventFight next;
while((next = nextFight(fights)) != null){ while((next = nextFight(fights)) != null){
if(!BungeeCore.EVENT_MODE && Event.get(next.getEventID()).spectateSystem())
break; //Don't start EventServer if not the event bungee
Team blue = Team.get(next.getTeamBlue()); Team blue = Team.get(next.getTeamBlue());
Team red = Team.get(next.getTeamRed()); Team red = Team.get(next.getTeamRed());
ServerStarter starter = new ServerStarter().event(next);
ProxiedPlayer leiter = ProxyServer.getInstance().getPlayer(SteamwarUser.get(next.getKampfleiter()).getUuid()); //Don't start EventServer if not the event bungee
if(leiter != null) if(BungeeCore.EVENT_MODE || !Event.get(next.getEventID()).spectateSystem()) {
starter.send(leiter); ServerStarter starter = new ServerStarter().event(next);
Subserver subserver = starter.start(); ProxiedPlayer leiter = ProxyServer.getInstance().getPlayer(SteamwarUser.get(next.getKampfleiter()).getUuid());
if(leiter != null)
starter.send(leiter);
eventServer.put(blue.getTeamId(), subserver); Subserver subserver = starter.start();
eventServer.put(red.getTeamId(), subserver);
Message.broadcast("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER", eventServer.put(blue.getTeamId(), subserver);
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel()), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName()); eventServer.put(red.getTeamId(), subserver);
Message.broadcast("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel()), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName());
} else {
Message.broadcast("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/spectate"), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName());
}
} }
} }

Datei anzeigen

@ -35,6 +35,7 @@ import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.OnlineStatus; import net.dv8tion.jda.api.OnlineStatus;
import net.dv8tion.jda.api.entities.Activity; import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.requests.restaction.CommandListUpdateAction; import net.dv8tion.jda.api.requests.restaction.CommandListUpdateAction;
import net.dv8tion.jda.api.utils.MemberCachePolicy; import net.dv8tion.jda.api.utils.MemberCachePolicy;
@ -93,9 +94,13 @@ public class SteamwarDiscordBot {
EventManager.update(); EventManager.update();
SchematicsManager.update(); SchematicsManager.update();
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
activity(); try {
EventManager.update(); activity();
SchematicsManager.update(); EventManager.update();
SchematicsManager.update();
} catch (ErrorResponseException e) {
//ignored
}
}, 30, 30, TimeUnit.SECONDS); }, 30, 30, TimeUnit.SECONDS);
DiscordRolesMessage.sendMessage(); DiscordRolesMessage.sendMessage();
DiscordRulesMessage.sendMessage(); DiscordRulesMessage.sendMessage();

Datei anzeigen

@ -36,6 +36,7 @@ import net.md_5.bungee.config.Configuration;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.Instant; import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level; import java.util.logging.Level;
@ -127,13 +128,18 @@ public class CheckCommand extends BasicCommand {
for (SchematicNode schematic : schematicList) { for (SchematicNode schematic : schematicList) {
CheckSession current = currentSchems.get(schematic.getId()); CheckSession current = currentSchems.get(schematic.getId());
long waitedMillis = Timestamp.from(Instant.now()).getTime() - schematic.getLastUpdate().getTime();
String color = waitedMillis > 14400000 ? (waitedMillis > 86400000 ? "§c" : "§e") : "§a";
String waitTime = Timestamp.from(Instant.ofEpochMilli(waitedMillis)).toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("CHECK_LIST_WAIT", player, color)));
if (current == null) { if (current == null) {
Message.sendPrefixless("CHECK_LIST_TO_CHECK", player, Message.sendPrefixless("CHECK_LIST_TO_CHECK", player,
waitTime,
Message.parse("CHECK_LIST_TO_CHECK_HOVER", player), Message.parse("CHECK_LIST_TO_CHECK_HOVER", player),
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check schematic " + schematic.getId()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check schematic " + schematic.getId()),
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName()); schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName());
} else { } else {
Message.sendPrefixless("CHECK_LIST_CHECKING", player, Message.sendPrefixless("CHECK_LIST_CHECKING", player,
waitTime,
Message.parse("CHECK_LIST_CHECKING_HOVER", player), Message.parse("CHECK_LIST_CHECKING_HOVER", player),
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + current.checker.getName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + current.checker.getName()),
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName(), current.checker.getName()); schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName(), current.checker.getName());

Datei anzeigen

@ -174,7 +174,7 @@ public class ChatListener extends BasicListener {
public static void discordChat(SteamwarUser user, String message){ public static void discordChat(SteamwarUser user, String message){
String name = "§r" + user.getUserName() + "§r"; String name = "§r" + user.getUserName() + "§r";
if (user.getUserGroup() != UserGroup.Member) { if (user.getUserGroup() != UserGroup.Member) {
name = user.getUserGroup().getColorCode() + user.getUserGroup().name() + " " + user.getUserName() + "§r"; name = user.getUserGroup().getColorCode() + user.getUserGroup().getChatPrefix() + " " + user.getUserName() + "§r";
} }
String chatcolor = user.getUserGroup().getChatColorCode(); String chatcolor = user.getUserGroup().getChatColorCode();

Datei anzeigen

@ -26,13 +26,13 @@ public class Season {
public static int getSeason() { public static int getSeason() {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
int yearIndex = calendar.get(Calendar.MONTH) / 3; int yearIndex = calendar.get(Calendar.MONTH) / 4;
return (calendar.get(Calendar.YEAR) * 3 + yearIndex); return (calendar.get(Calendar.YEAR) * 3 + yearIndex);
} }
public static String getSeasonStart() { public static String getSeasonStart() {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) / 3 * 3 + 1) + "-1"; return calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) / 4 * 3 + 1) + "-1";
} }
public static String convertSeasonToString(int season){ public static String convertSeasonToString(int season){

Datei anzeigen

@ -24,12 +24,12 @@ import java.util.stream.Collectors;
public enum UserGroup { public enum UserGroup {
Admin("§4", "§e", "Admin", true, true, true, true), Admin("§4", "§e", "Obererzieher", true, true, true, true),
Developer("§3", "§f", "Dev", true, true, true, true), Developer("§3", "§f", "Seelsorger", true, true, true, true),
Moderator("§c", "§f", "Mod", true, true, true, true), Moderator("§c", "§f", "Schichtleiter", true, true, true, true),
Supporter("§9", "§f", "Sup", false, true, true, true), Supporter("§9", "§f", "Kindergärtner", false, true, true, true),
Builder("§2", "§f", "Arch", false, true, false, true), Builder("§2", "§f", "Hausmeister", false, true, false, true),
YouTuber("§5", "§f", "YT", false, false, false, true), YouTuber("§5", "§f", "Reporter", false, false, false, true),
Member("§7", "§7", "", false, false, false, false); Member("§7", "§7", "", false, false, false, false);
private final String colorCode; private final String colorCode;

Datei anzeigen

@ -245,9 +245,10 @@ CHECK_HELP_NEXT=§8/§7check next §8- §7Nächste Prüffrage§8/§7freigeben
CHECK_HELP_DECLINE=§8/§7check decline §8[§eGrund§8] - §7Schematic ablehnen CHECK_HELP_DECLINE=§8/§7check decline §8[§eGrund§8] - §7Schematic ablehnen
CHECK_HELP_CANCEL=§8/§7check cancel §8- §7Bricht den Prüfvorgang ab CHECK_HELP_CANCEL=§8/§7check cancel §8- §7Bricht den Prüfvorgang ab
CHECK_LIST_HEADER=§e§lZu prüfen sind {0} Schematics CHECK_LIST_HEADER=§e§lZu prüfen sind {0} Schematics
CHECK_LIST_TO_CHECK=§8{0} §7{1} §e{2} CHECK_LIST_TO_CHECK={0} §8{1} §7{2} §e{3}
CHECK_LIST_WAIT={0}d HH:mm
CHECK_LIST_TO_CHECK_HOVER=§eSchematic prüfen CHECK_LIST_TO_CHECK_HOVER=§eSchematic prüfen
CHECK_LIST_CHECKING=§8{0} §7{1} §e{2} §7wird geprüft von §e{3} CHECK_LIST_CHECKING={0} §8{1} §7{2} §e{3} §7wird geprüft von §e{4}
CHECK_LIST_CHECKING_HOVER=§eZum Prüfer CHECK_LIST_CHECKING_HOVER=§eZum Prüfer
CHECK_SCHEMATIC_ALREADY_CHECKING=§cDu prüfst schon eine Schematic! CHECK_SCHEMATIC_ALREADY_CHECKING=§cDu prüfst schon eine Schematic!
CHECK_SCHEMATIC_OWN=§cDu kannst nicht deine eigenen Schematics prüfen. CHECK_SCHEMATIC_OWN=§cDu kannst nicht deine eigenen Schematics prüfen.