SteamWar/BungeeCore
Archiviert
13
2

Merge branch 'master' into BauLock
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2022-09-16 23:30:02 +02:00
Commit be41928520
8 geänderte Dateien mit 39 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -97,7 +97,7 @@ dependencies {
compileOnly 'de.steamwar:waterfall:RELEASE' compileOnly 'de.steamwar:waterfall:RELEASE'
compileOnly 'de.steamwar:persistentbungeecore:RELEASE' compileOnly 'de.steamwar:persistentbungeecore:RELEASE'
implementation("net.dv8tion:JDA:4.3.0_299") { implementation("net.dv8tion:JDA:4.4.0_352") {
exclude module: 'opus-java' exclude module: 'opus-java'
} }

Datei anzeigen

@ -94,6 +94,7 @@ public class ArenaMode {
private final String serverJar; private final String serverJar;
private final String config; private final String config;
private final List<String> maps; private final List<String> maps;
private final Map<String, String> lowerToRealMapNames = new HashMap<>();
private final boolean historic; private final boolean historic;
private final String internalName; private final String internalName;
@ -106,6 +107,7 @@ public class ArenaMode {
this.serverJar = config.getString("Server.ServerJar"); this.serverJar = config.getString("Server.ServerJar");
this.config = internalName + ".yml"; this.config = internalName + ".yml";
this.maps = config.getStringList("Server.Maps"); this.maps = config.getStringList("Server.Maps");
maps.forEach(map -> lowerToRealMapNames.put(map.toLowerCase(), map));
this.displayName = config.getString("GameName", internalName); this.displayName = config.getString("GameName", internalName);
this.chatNames = config.getStringList("Server.ChatNames"); this.chatNames = config.getStringList("Server.ChatNames");
this.schemType = config.getString("Schematic.Type", "").toLowerCase(); this.schemType = config.getString("Schematic.Type", "").toLowerCase();
@ -155,6 +157,10 @@ public class ArenaMode {
return maps; return maps;
} }
public String convertToRealMapName(String map){
return lowerToRealMapNames.get(map.toLowerCase());
}
public String getChatName(){ public String getChatName(){
return chatNames.get(0); return chatNames.get(0);
} }

Datei anzeigen

@ -25,6 +25,9 @@ import de.steamwar.bungeecore.sql.SteamwarUser;
import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent; import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent;
import java.io.InputStream;
import java.util.concurrent.CompletableFuture;
public class PrivateMessageListener extends BasicDiscordListener { public class PrivateMessageListener extends BasicDiscordListener {
@Override @Override
@ -63,7 +66,9 @@ public class PrivateMessageListener extends BasicDiscordListener {
} }
try { try {
node.saveFromStream(attachment.retrieveInputStream().get(), newFormat); InputStream in = attachment.retrieveInputStream().get();
node.saveFromStream(in, newFormat);
in.close();
event.getMessage().reply("`" + name + "` wurde erfolgreich hochgeladen").queue(); event.getMessage().reply("`" + name + "` wurde erfolgreich hochgeladen").queue();
} catch (Exception e) { } catch (Exception e) {
event.getMessage().reply("`" + name + "` konnte nicht hochgeladen werden, bitte versuche es später nochmal oder wende dich an einen Developer").queue(); event.getMessage().reply("`" + name + "` konnte nicht hochgeladen werden, bitte versuche es später nochmal oder wende dich an einen Developer").queue();

Datei anzeigen

@ -79,9 +79,7 @@ public class TypeMappers {
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, String[] previousArguments, String s) {
if (previousArguments.length == 0) return null; if (previousArguments.length == 0) return null;
if (s.equalsIgnoreCase("random")) return "random"; if (s.equalsIgnoreCase("random")) return "random";
ArenaMode arenaMode = ArenaMode.getByChat(previousArguments[previousArguments.length - 1]); return ArenaMode.getByChat(previousArguments[previousArguments.length - 1]).convertToRealMapName(s);
if (arenaMode.getMaps().contains(s)) return s;
return null;
} }
@Override @Override

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Storage;
import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.Punishment;
import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.Team; import de.steamwar.bungeecore.sql.Team;
@ -31,8 +32,10 @@ import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.net.InetSocketAddress;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.Instant;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -78,15 +81,24 @@ public class WhoisCommand extends SWCommand {
Message.send("WHOIS_USERNAME", player, user.getUserName()); Message.send("WHOIS_USERNAME", player, user.getUserName());
Message.send("WHOIS_UUID", player, Message.parse("WHOIS_UUID_HOVER", player), new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, user.getUuid().toString()), user.getUuid().toString()); Message.send("WHOIS_UUID", player, Message.parse("WHOIS_UUID_HOVER", player), new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, user.getUuid().toString()), user.getUuid().toString());
Message.send("WHOIS_ID", player, user.getId()); Message.send("WHOIS_ID", player, user.getId());
Message.send("WHOIS_GROUP", player, user.getUserGroup().getColorCode(), user.getUserGroup().name());
if (user.getDiscordId() != null) { if (user.getDiscordId() != null) {
Message.send("WHOIS_DISCORD_ID", player, user.getDiscordId()); Message.send("WHOIS_DISCORD_ID", player, user.getDiscordId());
} }
Timestamp firstJoin = user.getFirstjoin(); Timestamp firstJoin = user.getFirstjoin();
if (firstJoin == null) if (firstJoin == null) {
Message.send("WHOIS_JOINED_FIRST", player, "0000-00-00 00:00:00"); Message.send("WHOIS_JOINED_FIRST", player, "0000-00-00 00:00:00");
else } else {
Message.send("WHOIS_JOINED_FIRST", player, firstJoin.toString()); Message.send("WHOIS_JOINED_FIRST", player, firstJoin.toString());
Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600)); }
Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / 3600d));
if(BungeeCord.getInstance().getPlayer(user.getUuid()) != null) {
ProxiedPlayer target = BungeeCord.getInstance().getPlayer(user.getUuid());
Message.send("WHOIS_CURRENT_PLAYED", player, new DecimalFormat("####.##").format((Instant.now().getEpochSecond() - Storage.sessions.get(target).toInstant().getEpochSecond()) / 60d));
Message.send("WHOIS_CURRENT_SERVER", player, target.getServer().getInfo().getName());
Message.send("WHOIS_CURRENT_PROTOCOL", player, target.getPendingConnection().getVersion());
}
Team team = Team.get(user.getTeam()); Team team = Team.get(user.getTeam());
Message.send("WHOIS_TEAM", player, Message.parse("WHOIS_TEAM_HOVER", player, team.getTeamName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + team.getTeamKuerzel()), team.getTeamColor(), team.getTeamKuerzel(), team.getTeamName()); Message.send("WHOIS_TEAM", player, Message.parse("WHOIS_TEAM_HOVER", player, team.getTeamName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + team.getTeamKuerzel()), team.getTeamColor(), team.getTeamKuerzel(), team.getTeamName());

Datei anzeigen

@ -326,14 +326,14 @@ public class SteamwarUser {
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid); ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid);
if (player != null) { if (player != null) {
updateBanIP(player.getAddress().getAddress().getHostAddress());
ChatSender.disconnect(player).system(punishmentMessage(punishment)); ChatSender.disconnect(player).system(punishmentMessage(punishment));
for (BannedUserIPs banned : BannedUserIPs.get(player.getAddress().getAddress().getHostAddress())) { for (BannedUserIPs banned : BannedUserIPs.get(player.getAddress().getAddress().getHostAddress())) {
SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID());
if (isPunished(punishment) && bannedUser.getPunishment(punishment).getEndTime().before(time)) { if (bannedUser.isPunished(punishment) && bannedUser.getPunishment(punishment).getEndTime().before(time)) {
bannedUser.punish(punishment, time, banReason, from, perma); bannedUser.punish(punishment, time, banReason, from, perma);
} }
} }
updateBanIP(player.getAddress().getAddress().getHostAddress());
} else { } else {
updateBanIP(""); updateBanIP("");
} }

Datei anzeigen

@ -583,9 +583,13 @@ WHOIS_USERNAME=§7Username§8: §e{0}
WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0}
WHOIS_UUID_HOVER=§eCopy UUID WHOIS_UUID_HOVER=§eCopy UUID
WHOIS_ID=§7ID§8: §e{0} WHOIS_ID=§7ID§8: §e{0}
WHOIS_GROUP=§7Group§8: {0}{1}
WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0} WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0}
WHOIS_JOINED_FIRST=§7Joined on§8: §e{0} WHOIS_JOINED_FIRST=§7Joined on§8: §e{0}
WHOIS_HOURS_PLAYED=§7Online Time§8: §e{0}h WHOIS_HOURS_PLAYED=§7Online Time§8: §e{0}h
WHOIS_CURRENT_PLAYED=§7Current Online Time§8: §e{0}m
WHOIS_CURRENT_SERVER=§7Current Server§8: §e{0}
WHOIS_CURRENT_PROTOCOL=§7Current Protocol§8: §e{0}
WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2} WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2}
WHOIS_TEAM_HOVER=§eShow {0} WHOIS_TEAM_HOVER=§eShow {0}
WHOIS_PUNISHMENTS=§7Punish: WHOIS_PUNISHMENTS=§7Punish:

Datei anzeigen

@ -559,12 +559,16 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen.
#WhoisCommand #WhoisCommand
WHOIS_USAGE=§c/whois [Spieler/ID] <-a> WHOIS_USAGE=§c/whois [Spieler/ID] <-a>
WHOIS_USERNAME=§7Username§8: §e{0} WHOIS_USERNAME=§7Username§8: §e{0}
WHOIS_GROUP=§7Gruppe§8: {0}{1}
WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0}
WHOIS_UUID_HOVER=§eUUID Kopieren WHOIS_UUID_HOVER=§eUUID Kopieren
WHOIS_ID=§7ID§8: §e{0} WHOIS_ID=§7ID§8: §e{0}
WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0} WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0}
WHOIS_JOINED_FIRST=§7Beigetreten am§8: §e{0} WHOIS_JOINED_FIRST=§7Beigetreten am§8: §e{0}
WHOIS_HOURS_PLAYED=§7Spielzeit§8: §e{0}h WHOIS_HOURS_PLAYED=§7Spielzeit§8: §e{0}h
WHOIS_CURRENT_PLAYED=§7Aktuell online§8: §e{0}m
WHOIS_CURRENT_SERVER=§7Aktueller Server§8: §e{0}
WHOIS_CURRENT_PROTOCOL=§7Aktuelle Version§8: §e{0}
WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2} WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2}
WHOIS_TEAM_HOVER=§e{0} anzeigen WHOIS_TEAM_HOVER=§e{0} anzeigen
WHOIS_PUNISHMENTS=§7Strafen: WHOIS_PUNISHMENTS=§7Strafen: