SteamWar/BungeeCore
Archiviert
13
2

Merge branch 'master' into schemsearch
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
Chaoscaot 2023-04-12 02:05:58 +02:00
Commit afece3008c
3 geänderte Dateien mit 21 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -22,11 +22,12 @@ package de.steamwar.bungeecore.commands;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import de.steamwar.sql.BannedUserIPs; import de.steamwar.sql.BannedUserIPs;
import de.steamwar.sql.Punishment; import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -114,8 +115,9 @@ public class PunishmentCommand {
public PunishmentCommand(String command, Punishment.PunishmentType punishmentType) { public PunishmentCommand(String command, Punishment.PunishmentType punishmentType) {
new SWCommand(command, "bungeecore.ban") { new SWCommand(command, "bungeecore.ban") {
@Register(description = "PUNISHMENT_USAGE")
public void genericCommand(ProxiedPlayer player, String toPunish, String date, @ErrorMessage(allowEAs = false, value = "PUNISHMENT_USAGE") String... message) { @Register
public void genericCommand(ProxiedPlayer player, String toPunish, String date, @ErrorMessage(allowEAs = false, value = "PUNISHMENT_USAGE_REASON") String... message) {
SteamwarUser punisher = SteamwarUser.get(player.getUniqueId()); SteamwarUser punisher = SteamwarUser.get(player.getUniqueId());
if (punishmentType.isNeedsAdmin() && !punisher.getUserGroup().isAdminGroup()) { if (punishmentType.isNeedsAdmin() && !punisher.getUserGroup().isAdminGroup()) {
return; return;
@ -137,13 +139,18 @@ public class PunishmentCommand {
target.punish(punishmentType, banTime, msg, punisher.getId(), isPerma); target.punish(punishmentType, banTime, msg, punisher.getId(), isPerma);
Message.team(punishmentType.getTeamMessage(), new Message("PREFIX"), target.getUserName(), player.getName(), new Message((isPerma ? "PUNISHMENT_PERMA" : "PUNISHMENT_UNTIL"), banTime), msg); Message.team(punishmentType.getTeamMessage(), new Message("PREFIX"), target.getUserName(), player.getName(), new Message((isPerma ? "PUNISHMENT_PERMA" : "PUNISHMENT_UNTIL"), banTime), msg);
} }
@Register
public void genericError(ProxiedPlayer player, String... args) {
ChatSender.of(player).send(true, ChatMessageType.CHAT, null, null, new Message("PUNISHMENT_USAGE", command));
}
}; };
if (punishmentType.getUnpunishmentMessage() == null) { if (punishmentType.getUnpunishmentMessage() == null) {
return; return;
} }
String antiCommand = "un" + command; String antiCommand = "un" + command;
new SWCommand(antiCommand, "bungeecore.ban") { new SWCommand(antiCommand, "bungeecore.ban") {
@Register(description = "PUNISHMENT_USAGE") @Register
public void genericCommand(ProxiedPlayer player, String toUnpunish) { public void genericCommand(ProxiedPlayer player, String toUnpunish) {
if (punishmentType.isNeedsAdmin() && !SteamwarUser.get(player.getUniqueId()).getUserGroup().isAdminGroup()) { if (punishmentType.isNeedsAdmin() && !SteamwarUser.get(player.getUniqueId()).getUserGroup().isAdminGroup()) {
return; return;
@ -163,6 +170,11 @@ public class PunishmentCommand {
if(punishmentType == Punishment.PunishmentType.Ban) if(punishmentType == Punishment.PunishmentType.Ban)
BannedUserIPs.unbanIPs(target.getId()); BannedUserIPs.unbanIPs(target.getId());
} }
@Register
public void genericError(ProxiedPlayer player, String... args) {
ChatSender.of(player).send(true, ChatMessageType.CHAT, null, null, new Message("UNPUNISHMENT_USAGE", antiCommand));
}
}; };
} }
@ -191,7 +203,7 @@ public class PunishmentCommand {
StringBuilder st = new StringBuilder(); StringBuilder st = new StringBuilder();
for (int i = 0; i < arg.length(); i++) { for (int i = 0; i < arg.length(); i++) {
char c = arg.charAt(i); char c = arg.charAt(i);
if (Character.isDigit(c)) { if (c >= '0' && c <= '9') {
st.append(c); st.append(c);
continue; continue;
} }

Datei anzeigen

@ -124,7 +124,8 @@ STAT_SERVER=§7Server §e{0}§8: §7Below limit §e{1} §7Server count §e{2}
STAT_SEARCH_QUEUE=§7Schematic search queue: §e{0} STAT_SEARCH_QUEUE=§7Schematic search queue: §e{0}
#Ban&Mute-Command #Ban&Mute-Command
PUNISHMENT_USAGE=§8/§7{0} §8[§eplayer§8] [§edd§8.§emm§8.§eyyyy §7or §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7or §eperma§8] [§ereason§8] PUNISHMENT_USAGE=§8/§7{0} §8[§eplayer§8] [§edd§8.§emm§8.§eyyyy §7or §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7or §enumber§8[§eh§7our|§ed§7ay|§ew§7eek|§em§7onth|§ey§7ear§8] §7or §eperma§8] [§ereason§8]
PUNISHMENT_USAGE_REASON=§cPlease enter a reason.
UNPUNISHMENT_USAGE=§8/§7{0} §8[§eplayer§8] UNPUNISHMENT_USAGE=§8/§7{0} §8[§eplayer§8]
PUNISHMENT_UNTIL=until {0} PUNISHMENT_UNTIL=until {0}

Datei anzeigen

@ -108,7 +108,8 @@ MOD_USE_MODSENDER=§cBitte nutze den §c§lFabricModSender§c (https://steamwar.
STAT_SERVER=§7Server §e{0}§8: §7Startfähig §e{1} §7Serveranzahl §e{2} STAT_SERVER=§7Server §e{0}§8: §7Startfähig §e{1} §7Serveranzahl §e{2}
#Ban&Mute-Command #Ban&Mute-Command
PUNISHMENT_USAGE=§8/§7{0} §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7oder §eperma§8] [§eGrund§8] PUNISHMENT_USAGE=§8/§7{0} §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7oder §ezahl§8[§eh§7our|§ed§7ay|§ew§7eek|§em§7onth|§ey§7ear§8] §7oder §eperma§8] [§eGrund§8]
PUNISHMENT_USAGE_REASON=§cBitte gib einen Grund an.
UNPUNISHMENT_USAGE=§8/§7{0} §8[§eSpieler§8] UNPUNISHMENT_USAGE=§8/§7{0} §8[§eSpieler§8]
PUNISHMENT_UNTIL=bis zum {0} PUNISHMENT_UNTIL=bis zum {0}