SteamWar/BungeeCore
Archiviert
13
2

Fix DiscordRanks, TypeValidators
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <git-5w3l@lixfel.de>
Dieser Commit ist enthalten in:
Lixfel 2024-06-28 10:37:48 +02:00
Ursprung 581f3be791
Commit ba75129d57
6 geänderte Dateien mit 22 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -30,8 +30,6 @@ import org.apache.logging.log4j.core.config.Property;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class ErrorLogger extends AbstractAppender { public class ErrorLogger extends AbstractAppender {
@ -59,7 +57,7 @@ public class ErrorLogger extends AbstractAppender {
return; return;
String message = event.getMessage().getFormattedMessage(); String message = event.getMessage().getFormattedMessage();
for(String reason : ignoreContains) for(String reason : filteredMessages)
if(message.contains(reason)) if(message.contains(reason))
return; return;
@ -67,16 +65,16 @@ public class ErrorLogger extends AbstractAppender {
if(event.getThrown() != null) if(event.getThrown() != null)
event.getThrown().printStackTrace(new PrintStream(stacktraceOutput)); event.getThrown().printStackTrace(new PrintStream(stacktraceOutput));
String stacktrace = stacktraceOutput.toString(); String stacktrace = stacktraceOutput.toString();
if (stacktrace.contains("ErrorLogger")) for(String reason : filteredStacktraces)
if (stacktrace.contains(reason))
return; return;
SWException.log(message, stacktrace); SWException.log(message, stacktrace);
} }
private static final List<String> ignoreContains; private static final List<String> filteredMessages = List.of();
private static final List<String> filteredStacktraces = List.of(
static { "ErrorLogger",
List<String> contains = new ArrayList<>(); "Connection reset by peer"
ignoreContains = Collections.unmodifiableList(contains); );
}
} }

Datei anzeigen

@ -72,21 +72,21 @@ public class ChallengeCommand extends SWCommand {
public TypeValidator<Player> targetValidator() { public TypeValidator<Player> targetValidator() {
return (sender, value, messageSender) -> { return (sender, value, messageSender) -> {
if (value == null) { if (value == null) {
sender.system("CHALLENGE_OFFLINE"); messageSender.send("CHALLENGE_OFFLINE");
return false; return false;
} }
if (sender == value) { if (sender == value) {
sender.system("CHALLENGE_SELF"); messageSender.send("CHALLENGE_SELF");
return false; return false;
} }
if (IgnoreSystem.isIgnored(value.getUniqueId(), sender.user().getUUID())) { if (IgnoreSystem.isIgnored(value.getUniqueId(), sender.user().getUUID())) {
sender.system("CHALLENGE_IGNORED"); messageSender.send("CHALLENGE_IGNORED");
return false; return false;
} }
Subserver subserver = Subserver.getSubserver(value); Subserver subserver = Subserver.getSubserver(value);
if (subserver != null && subserver.getType() == Servertype.ARENA) { if (subserver != null && subserver.getType() == Servertype.ARENA) {
sender.system("CHALLENGE_INARENA"); messageSender.send("CHALLENGE_INARENA");
return false; return false;
} }
return true; return true;

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.velocitycore.commands;
import com.velocitypowered.api.proxy.server.RegisteredServer; import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo; import com.velocitypowered.api.proxy.server.ServerInfo;
import de.steamwar.messages.Message;
import de.steamwar.velocitycore.VelocityCore; import de.steamwar.velocitycore.VelocityCore;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWCommandUtils;
@ -80,7 +81,8 @@ public class DevCommand extends SWCommand {
public TypeValidator<PlayerChatter> punishmentGuardChecker() { public TypeValidator<PlayerChatter> punishmentGuardChecker() {
return (sender, value, messageSender) -> { return (sender, value, messageSender) -> {
if (sender.user().isPunished(Punishment.PunishmentType.NoDevServer)) { if (sender.user().isPunished(Punishment.PunishmentType.NoDevServer)) {
sender.system(PunishmentCommand.punishmentMessage(sender.user(), Punishment.PunishmentType.NoDevServer)); Message message = PunishmentCommand.punishmentMessage(sender.user(), Punishment.PunishmentType.NoDevServer);
messageSender.send(message.format(), message.params());
return false; return false;
} }
return true; return true;

Datei anzeigen

@ -521,7 +521,7 @@ public class TeamCommand extends SWCommand {
public TypeValidator<Chatter> isNotInTeamValidator() { public TypeValidator<Chatter> isNotInTeamValidator() {
return (sender, value, messageSender) -> { return (sender, value, messageSender) -> {
if (sender.user().getTeam() != 0) { if (sender.user().getTeam() != 0) {
sender.system("TEAM_IN_TEAM"); messageSender.send("TEAM_IN_TEAM");
return false; return false;
} }
return true; return true;
@ -532,7 +532,7 @@ public class TeamCommand extends SWCommand {
public TypeValidator<Chatter> isInTeamValidator() { public TypeValidator<Chatter> isInTeamValidator() {
return (sender, value, messageSender) -> { return (sender, value, messageSender) -> {
if (sender.user().getTeam() == 0) { if (sender.user().getTeam() == 0) {
sender.system("TEAM_NOT_IN_TEAM"); messageSender.send("TEAM_NOT_IN_TEAM");
return false; return false;
} }
return true; return true;
@ -544,11 +544,11 @@ public class TeamCommand extends SWCommand {
return (sender, value, messageSender) -> { return (sender, value, messageSender) -> {
SteamwarUser user = sender.user(); SteamwarUser user = sender.user();
if (user.getTeam() == 0) { if (user.getTeam() == 0) {
sender.system("TEAM_NOT_IN_TEAM"); messageSender.send("TEAM_NOT_IN_TEAM");
return false; return false;
} }
if (!user.isLeader()) { if (!user.isLeader()) {
sender.system("TEAM_NOT_LEADER"); messageSender.send("TEAM_NOT_LEADER");
return false; return false;
} }
return true; return true;

Datei anzeigen

@ -49,7 +49,7 @@ public class DiscordRanks {
.filter(role -> !role.getId().equals(prefixRole)) .filter(role -> !role.getId().equals(prefixRole))
.forEach(role -> guild.removeRoleFromMember(member, role).queue()); .forEach(role -> guild.removeRoleFromMember(member, role).queue());
if (member.getRoles().stream().noneMatch(role -> role.getId().equals(prefixRole)) && guild.getRoleById(prefixRole) != null) if (prefixRole != null && member.getRoles().stream().noneMatch(role -> role.getId().equals(prefixRole)))
guild.addRoleToMember(member, guild.getRoleById(prefixRole)).queue(); guild.addRoleToMember(member, guild.getRoleById(prefixRole)).queue();
}, e -> { }, e -> {
if(e instanceof ErrorResponseException err && err.getErrorCode() == 10007) if(e instanceof ErrorResponseException err && err.getErrorCode() == 10007)

Datei anzeigen

@ -74,7 +74,7 @@ public class PollSystem extends BasicListener {
public static TypeValidator<Chatter> noPoll() { public static TypeValidator<Chatter> noPoll() {
return (sender, value, messageSender) -> { return (sender, value, messageSender) -> {
if (PollSystem.noCurrentPoll()) { if (PollSystem.noCurrentPoll()) {
sender.system("POLL_NO_POLL"); messageSender.send("POLL_NO_POLL");
return false; return false;
} }
return true; return true;