Signed-off-by: Lixfel <git-5w3l@lixfel.de>
Dieser Commit ist enthalten in:
Ursprung
581f3be791
Commit
ba75129d57
@ -30,8 +30,6 @@ import org.apache.logging.log4j.core.config.Property;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ErrorLogger extends AbstractAppender {
|
||||
@ -59,7 +57,7 @@ public class ErrorLogger extends AbstractAppender {
|
||||
return;
|
||||
|
||||
String message = event.getMessage().getFormattedMessage();
|
||||
for(String reason : ignoreContains)
|
||||
for(String reason : filteredMessages)
|
||||
if(message.contains(reason))
|
||||
return;
|
||||
|
||||
@ -67,16 +65,16 @@ public class ErrorLogger extends AbstractAppender {
|
||||
if(event.getThrown() != null)
|
||||
event.getThrown().printStackTrace(new PrintStream(stacktraceOutput));
|
||||
String stacktrace = stacktraceOutput.toString();
|
||||
if (stacktrace.contains("ErrorLogger"))
|
||||
return;
|
||||
for(String reason : filteredStacktraces)
|
||||
if (stacktrace.contains(reason))
|
||||
return;
|
||||
|
||||
SWException.log(message, stacktrace);
|
||||
}
|
||||
|
||||
private static final List<String> ignoreContains;
|
||||
|
||||
static {
|
||||
List<String> contains = new ArrayList<>();
|
||||
ignoreContains = Collections.unmodifiableList(contains);
|
||||
}
|
||||
private static final List<String> filteredMessages = List.of();
|
||||
private static final List<String> filteredStacktraces = List.of(
|
||||
"ErrorLogger",
|
||||
"Connection reset by peer"
|
||||
);
|
||||
}
|
||||
|
@ -72,21 +72,21 @@ public class ChallengeCommand extends SWCommand {
|
||||
public TypeValidator<Player> targetValidator() {
|
||||
return (sender, value, messageSender) -> {
|
||||
if (value == null) {
|
||||
sender.system("CHALLENGE_OFFLINE");
|
||||
messageSender.send("CHALLENGE_OFFLINE");
|
||||
return false;
|
||||
}
|
||||
if (sender == value) {
|
||||
sender.system("CHALLENGE_SELF");
|
||||
messageSender.send("CHALLENGE_SELF");
|
||||
return false;
|
||||
}
|
||||
if (IgnoreSystem.isIgnored(value.getUniqueId(), sender.user().getUUID())) {
|
||||
sender.system("CHALLENGE_IGNORED");
|
||||
messageSender.send("CHALLENGE_IGNORED");
|
||||
return false;
|
||||
}
|
||||
|
||||
Subserver subserver = Subserver.getSubserver(value);
|
||||
if (subserver != null && subserver.getType() == Servertype.ARENA) {
|
||||
sender.system("CHALLENGE_INARENA");
|
||||
messageSender.send("CHALLENGE_INARENA");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -21,6 +21,7 @@ package de.steamwar.velocitycore.commands;
|
||||
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
@ -80,7 +81,8 @@ public class DevCommand extends SWCommand {
|
||||
public TypeValidator<PlayerChatter> punishmentGuardChecker() {
|
||||
return (sender, value, messageSender) -> {
|
||||
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 true;
|
||||
|
@ -521,7 +521,7 @@ public class TeamCommand extends SWCommand {
|
||||
public TypeValidator<Chatter> isNotInTeamValidator() {
|
||||
return (sender, value, messageSender) -> {
|
||||
if (sender.user().getTeam() != 0) {
|
||||
sender.system("TEAM_IN_TEAM");
|
||||
messageSender.send("TEAM_IN_TEAM");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -532,7 +532,7 @@ public class TeamCommand extends SWCommand {
|
||||
public TypeValidator<Chatter> isInTeamValidator() {
|
||||
return (sender, value, messageSender) -> {
|
||||
if (sender.user().getTeam() == 0) {
|
||||
sender.system("TEAM_NOT_IN_TEAM");
|
||||
messageSender.send("TEAM_NOT_IN_TEAM");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -544,11 +544,11 @@ public class TeamCommand extends SWCommand {
|
||||
return (sender, value, messageSender) -> {
|
||||
SteamwarUser user = sender.user();
|
||||
if (user.getTeam() == 0) {
|
||||
sender.system("TEAM_NOT_IN_TEAM");
|
||||
messageSender.send("TEAM_NOT_IN_TEAM");
|
||||
return false;
|
||||
}
|
||||
if (!user.isLeader()) {
|
||||
sender.system("TEAM_NOT_LEADER");
|
||||
messageSender.send("TEAM_NOT_LEADER");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -49,7 +49,7 @@ public class DiscordRanks {
|
||||
.filter(role -> !role.getId().equals(prefixRole))
|
||||
.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();
|
||||
}, e -> {
|
||||
if(e instanceof ErrorResponseException err && err.getErrorCode() == 10007)
|
||||
|
@ -74,7 +74,7 @@ public class PollSystem extends BasicListener {
|
||||
public static TypeValidator<Chatter> noPoll() {
|
||||
return (sender, value, messageSender) -> {
|
||||
if (PollSystem.noCurrentPoll()) {
|
||||
sender.system("POLL_NO_POLL");
|
||||
messageSender.send("POLL_NO_POLL");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren