Ban System Rework #150
@ -26,44 +26,76 @@ import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public class HelpCommand extends BasicCommand {
|
||||
|
||||
public HelpCommand() {
|
||||
super("help", "", "?");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if(args.length != 1){
|
||||
if (args.length < 1) {
|
||||
Message.send("HELP_LOBBY", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_LOBBY_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/l"));
|
||||
Message.send("HELP_BAU", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bau"));
|
||||
Message.send("HELP_BAUSERVER", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAUSERVER_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bauserver"));
|
||||
Message.send("HELP_BAUSERVER", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAUSERVER_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau"));
|
||||
Message.send("HELP_FIGHT", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_FIGHT_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/fight"));
|
||||
Message.send("HELP_CHALLENGE", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_CHALLENGE_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge"));
|
||||
Message.send("HELP_HISTORIC", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_HISTORIC_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/historic"));
|
||||
Message.send("HELP_TEAM", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_TEAM_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team"));
|
||||
Message.send("HELP_JOIN", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_JOIN_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join"));
|
||||
Message.send("HELP_LOCAL", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_LOCAL_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/local"));
|
||||
}else if(args[0].equalsIgnoreCase("bauserver")){
|
||||
return;
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("bauserver")) {
|
||||
sendBauHelp((ProxiedPlayer) sender);
|
||||
}else if(args[0].equalsIgnoreCase("bau")){
|
||||
Message.sendPrefixless("HELP_TNT", sender);
|
||||
Message.sendPrefixless("HELP_FIRE", sender);
|
||||
Message.sendPrefixless("HELP_TESTBLOCK", sender);
|
||||
Message.sendPrefixless("HELP_RESET", sender);
|
||||
Message.sendPrefixless("HELP_SPEED", sender);
|
||||
Message.sendPrefixless("HELP_NV", sender);
|
||||
Message.sendPrefixless("HELP_WV", sender);
|
||||
Message.sendPrefixless("HELP_TRACE", sender);
|
||||
Message.sendPrefixless("HELP_LOADER", sender);
|
||||
Message.sendPrefixless("HELP_PROTECT", sender);
|
||||
Message.sendPrefixless("HELP_FREEZE", sender);
|
||||
Message.sendPrefixless("HELP_SKULL", sender);
|
||||
Message.sendPrefixless("HELP_DEBUGSTICK", sender);
|
||||
Message.sendPrefixless("HELP_BAUINFO", sender);
|
||||
Message.sendPrefixless("HELP_BAUSERVER_SHORT", sender);
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("bau")) {
|
||||
bauHelpGroup((ProxiedPlayer) sender, args);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void bauHelpGroup(ProxiedPlayer p, String[] args) {
|
||||
if (args.length < 2) {
|
||||
sendBauHelpGroup(p);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "admin":
|
||||
case "owner":
|
||||
case "bauwelt":
|
||||
sendBauHelpAdmin(p);
|
||||
return;
|
||||
case "world":
|
||||
sendBauHelpWorld(p);
|
||||
return;
|
||||
case "player":
|
||||
sendBauHelpPlayer(p);
|
||||
return;
|
||||
case "worldedit":
|
||||
case "we":
|
||||
case "world-edit":
|
||||
case "edit":
|
||||
sendBauHelpWorldEdit(p);
|
||||
return;
|
||||
case "other":
|
||||
sendBauHelpOther(p);
|
||||
return;
|
||||
default:
|
||||
sendBauHelpGroup(p);
|
||||
}
|
||||
}
|
||||
|
||||
static void sendBauHelp(ProxiedPlayer p){
|
||||
private static void sendBauHelpGroup(ProxiedPlayer p) {
|
||||
Message.send("HELP_BAU_GROUP_ADMIN", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_GROUP_ADMIN_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau admin"));
|
||||
Message.send("HELP_BAU_GROUP_WORLD", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_GROUP_WORLD_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau world"));
|
||||
Message.send("HELP_BAU_GROUP_PLAYER", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_GROUP_PLAYER_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau player"));
|
||||
Message.send("HELP_BAU_GROUP_WE", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_GROUP_WE_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau we"));
|
||||
Message.send("HELP_BAU_GROUP_OTHER", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_GROUP_OTHER_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau other"));
|
||||
}
|
||||
|
||||
static void sendBauHelp(ProxiedPlayer p) {
|
||||
Message.send("HELP_BAU_TP", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TP_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau tp "));
|
||||
Message.send("HELP_BAU_ADDMEMBER", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_ADDMEMBER_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau addmember "));
|
||||
Message.send("HELP_BAU_DELMEMBER", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_DELMEMBER_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau delmember "));
|
||||
@ -72,6 +104,51 @@ public class HelpCommand extends BasicCommand {
|
||||
Message.send("HELP_BAU_TOGGLEWORLD", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TOGGLEWORLD_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau toggleworld "));
|
||||
Message.send("HELP_BAU_DELETE", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_DELETE_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau delete "));
|
||||
Message.send("HELP_BAU_TESTARENA", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TESTARENA_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau testarena "));
|
||||
Message.send("HELP_BAU_BAU", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_BAU_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau"));
|
||||
}
|
||||
|
||||
static void sendBauHelpWorld(ProxiedPlayer p) {
|
||||
Message.send("HELP_BAU_GROUP_WORLD_TITLE", p);
|
||||
Message.sendPrefixless("HELP_TNT", p);
|
||||
Message.sendPrefixless("HELP_FIRE", p);
|
||||
Message.sendPrefixless("HELP_FREEZE", p);
|
||||
Message.sendPrefixless("HELP_TPSLIMIT", p);
|
||||
Message.sendPrefixless("HELP_PROTECT", p);
|
||||
Message.sendPrefixless("HELP_RESET", p);
|
||||
}
|
||||
|
||||
static void sendBauHelpPlayer(ProxiedPlayer p) {
|
||||
Message.sendPrefixless("HELP_BAU_GROUP_PLAYER_TITLE", p);
|
||||
Message.sendPrefixless("HELP_SPEED", p);
|
||||
Message.sendPrefixless("HELP_NV", p);
|
||||
Message.sendPrefixless("HELP_WV", p);
|
||||
Message.sendPrefixless("HELP_DEBUGSTICK", p);
|
||||
Message.sendPrefixless("HELP_TRACE", p);
|
||||
Message.sendPrefixless("HELP_LOADER", p);
|
||||
}
|
||||
|
||||
static void sendBauHelpAdmin(ProxiedPlayer p) {
|
||||
Message.send("HELP_BAU_GROUP_ADMIN_TITLE", p);
|
||||
sendBauHelp(p);
|
||||
}
|
||||
|
||||
static void sendBauHelpWorldEdit(ProxiedPlayer p) {
|
||||
Message.sendPrefixless("HELP_BAU_GROUP_WE_TITLE", p);
|
||||
Message.sendPrefixless("HELP_WE_POS1", p);
|
||||
Message.sendPrefixless("HELP_WE_POS2", p);
|
||||
Message.sendPrefixless("HELP_WE_COPY", p);
|
||||
Message.sendPrefixless("HELP_WE_PASTE", p);
|
||||
Message.sendPrefixless("HELP_WE_FLOPY", p);
|
||||
Message.sendPrefixless("HELP_WE_FLOPYP", p);
|
||||
Message.sendPrefixless("HELP_WE_ROTATE_90", p);
|
||||
Message.sendPrefixless("HELP_WE_ROTATE_180", p);
|
||||
Message.sendPrefixless("HELP_WE_ROTATE_N90", p);
|
||||
}
|
||||
|
||||
static void sendBauHelpOther(ProxiedPlayer p) {
|
||||
Message.sendPrefixless("HELP_BAU_GROUP_OTHER_TITLE", p);
|
||||
Message.sendPrefixless("HELP_TESTBLOCK", p);
|
||||
Message.sendPrefixless("HELP_SKULL", p);
|
||||
Message.sendPrefixless("HELP_BAUINFO", p);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bungeecore.listeners;
|
||||
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.sql.BannedUserIPs;
|
||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
@ -31,6 +32,9 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.LoginEvent;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
public class BanListener extends BasicListener {
|
||||
@ -47,27 +51,32 @@ public class BanListener extends BasicListener {
|
||||
|
||||
List<BannedUserIPs> ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress());
|
||||
if(!ips.isEmpty()){
|
||||
StringBuilder potentialBan = new StringBuilder();
|
||||
potentialBan.append(BungeeCore.CHAT_PREFIX);
|
||||
potentialBan.append("§cMögliche Bannumgehung durch §r");
|
||||
potentialBan.append(user.getUserName());
|
||||
potentialBan.append("§c:");
|
||||
|
||||
for(BannedUserIPs banned : ips){
|
||||
SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID());
|
||||
potentialBan.append(" §e");
|
||||
potentialBan.append(banned.getTimestamp().toLocalDateTime().format(BungeeCore.DATE_FORMAT));
|
||||
potentialBan.append(" §c");
|
||||
potentialBan.append(bannedUser.getUserName());
|
||||
Timestamp highestBan = Timestamp.from(Instant.now());
|
||||
for(BannedUserIPs banned : ips) {
|
||||
if(highestBan.before(banned.getTimestamp()))
|
||||
highestBan = banned.getTimestamp();
|
||||
|
||||
}
|
||||
ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ban " + user.getUserName() + " "
|
||||
+ highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm"))
|
||||
+ " Bannumgehung");
|
||||
|
||||
TextComponent msg = new TextComponent(potentialBan.toString());
|
||||
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§cBanne Spieler wegen Bannumgehung").create()));
|
||||
msg.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ban " + user.getUserName() + " perma Bannumgehung"));
|
||||
for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){
|
||||
if ((target.hasPermission("bungeecore.teamchat"))
|
||||
&& (target.getChatMode() == ProxiedPlayer.ChatMode.COMMANDS_ONLY
|
||||
|| target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN)){
|
||||
StringBuilder potentialBan = new StringBuilder();
|
||||
potentialBan.append(Message.parsePrefixed("BAN_AVOIDING_ALERT", target, user.getUserName()));
|
||||
|
||||
for(BannedUserIPs banned : ips) {
|
||||
SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID());
|
||||
potentialBan.append(Message.parse("BAN_AVOIDING_LIST", target, bannedUser.getId(),
|
||||
banned.getTimestamp().toLocalDateTime().format(BungeeCore.DATE_FORMAT), bannedUser.getUserName()));
|
||||
}
|
||||
|
||||
TextComponent msg = new TextComponent(potentialBan.toString());
|
||||
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.parse("BAN_AVOIDING_BAN_HOVER", target)).create()));
|
||||
msg.setClickEvent(clickEvent);
|
||||
target.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
@ -209,6 +209,12 @@ public class SteamwarUser {
|
||||
if(player != null){
|
||||
updateBanIP(player.getAddress().getAddress().getHostAddress());
|
||||
player.disconnect(banMessage());
|
||||
for (BannedUserIPs banned:
|
||||
BannedUserIPs.get(player.getAddress().getAddress().getHostAddress())) {
|
||||
Lixfel
hat
Whoops! Mute/Ban. Whoops! Mute/Ban.
|
||||
SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID());
|
||||
if(bannedUser.isBanned() && banned.getTimestamp().before(time))
|
||||
bannedUser.ban(time, bannedUser.banReason);
|
||||
}
|
||||
}else
|
||||
updateBanIP("");
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ HELP_LOBBY=§7Kehre von überall mit §8/§el §7zur Lobby zurück!
|
||||
HELP_LOBBY_HOVER=§eZurück zur Lobby
|
||||
HELP_BAU=§7Komme mit §8/§ebau §7auf den Bauserver!
|
||||
HELP_BAU_HOVER=§eZum Bauserver
|
||||
HELP_BAUSERVER=§7Erhalte mit §8/§ehelp bauserver §7Hilfe zum Bauserver!
|
||||
HELP_BAUSERVER=§7Erhalte mit §8/§ehelp bau §7Hilfe zum Bauserver!
|
||||
HELP_BAUSERVER_HOVER=§eHilfe zum Bauserver
|
||||
HELP_FIGHT=§7Starte mit §8/§efight §7einen neuen Kampf!
|
||||
HELP_FIGHT_HOVER=§eZum Kampfsystem
|
||||
@ -38,7 +38,32 @@ HELP_FREEZE=§8/§efreeze §8- §7Unterbindet Blockupdates
|
||||
HELP_SKULL=§8/§eskull §8- §7Gibt dir den Kopf eines Spielers
|
||||
HELP_DEBUGSTICK=§8/§edebugstick §8- §7Gibt dir einen Debugstick (nur 1.15)
|
||||
HELP_BAUINFO=§8/§ebauinfo §8- §7Gibt dir Informationen über den Bauserver
|
||||
HELP_BAUSERVER_SHORT=§8/§ehelp bauserver §8- §7Hilfe zum Bauserver
|
||||
|
||||
HELP_WE_POS1=§8//§e1 §7» §8//§epos1
|
||||
HELP_WE_POS2=§8//§e2 §7» §8//§epos2
|
||||
HELP_WE_COPY=§8//§ec §7» §8//§ecopy
|
||||
HELP_WE_PASTE=§8//§ep §7» §8//§epaste
|
||||
HELP_WE_FLOPY=§8//§eflopy §7» §8//§ecopy §7& §8//§eflip
|
||||
HELP_WE_FLOPYP=§8//§eflopyp §7» §8//§ecopy §7& §8//§eflip §7& §8//§epaste
|
||||
HELP_WE_ROTATE_90=§8//§e90 §7» §8//§erotate 90
|
||||
HELP_WE_ROTATE_180=§8//§e180 §7» §8//§erotate 180
|
||||
HELP_WE_ROTATE_N90=§8//§e-90 §7» §8//§erotate -90
|
||||
|
||||
HELP_BAU_GROUP_ADMIN=§7Bauserver-Verwaltungsbefehle
|
||||
HELP_BAU_GROUP_ADMIN_HOVER=§eAlle Verwaltungsbefehle
|
||||
HELP_BAU_GROUP_ADMIN_TITLE=§7Alle Verwaltungsbefehle§8:
|
||||
HELP_BAU_GROUP_OTHER=§7Weitere Bauserverbefehle
|
||||
HELP_BAU_GROUP_OTHER_HOVER=§eWeitere Bauserverbefehle
|
||||
HELP_BAU_GROUP_OTHER_TITLE=§7Weitere Bauserverbefehle§8:
|
||||
HELP_BAU_GROUP_WE=§7WorldEdit-Abkürzungen
|
||||
HELP_BAU_GROUP_WE_HOVER=§eWorldEdit-Abkürzungen
|
||||
HELP_BAU_GROUP_WE_TITLE=§7WorldEdit-Abkürzungen§8:
|
||||
HELP_BAU_GROUP_PLAYER=§7Spielerbefehle
|
||||
HELP_BAU_GROUP_PLAYER_HOVER=§eSpielerbefehle
|
||||
HELP_BAU_GROUP_PLAYER_TITLE=§7Spielerbefehle§8:
|
||||
HELP_BAU_GROUP_WORLD=§7Weltverändernde Bauserverbefehle
|
||||
HELP_BAU_GROUP_WORLD_HOVER=§eWeltverändernde Bauserverbefehle
|
||||
HELP_BAU_GROUP_WORLD_TITLE=§7Weltverändernde Bauserverbefehle§8:
|
||||
|
||||
HELP_BAU_TP=§8/§ebau tp §8- §7Gehe auf Bauserver von Freunden!
|
||||
HELP_BAU_TP_HOVER=§eZu einem anderen Bauserver
|
||||
@ -78,6 +103,9 @@ BAN_CHANGED={0} verändert von {1} von {2} auf {3} wegen {4}
|
||||
BAN_INVALID_TIME=§cUngültige Zeitangabe.
|
||||
BAN_PERMA=Permanent
|
||||
Lixfel
hat
Können wir bitte im Farbschema bleiben? Können wir bitte im Farbschema bleiben?
|
||||
BAN_UNTIL=bis zum
|
||||
BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0}§c: §c
|
||||
BAN_AVOIDING_LIST={0} §e{1} §c
|
||||
BAN_AVOIDING_BAN_HOVER=§cBanne Spieler wegen Bannumgehung
|
||||
|
||||
MUTE_MESSAGE_YOU=§7Du hast §e{0} §7gemutet§8. §7Grund§8: §c{1}
|
||||
Lixfel
hat
Da brauchen wir kein spezielles Präfix. Und so schön du dir das gedacht hast: Die eckigen Klammern machens irgendwie wieder hässlich. ;) (Persönliche Meinung) Da brauchen wir kein spezielles Präfix. Und so schön du dir das gedacht hast: Die eckigen Klammern machens irgendwie wieder hässlich. ;) (Persönliche Meinung)
|
||||
|
||||
@ -85,8 +113,6 @@ BUG_MESSAGE=§7Dein Bugreport wurde gespeichert.
|
||||
|
||||
Lixfel
hat
same same
|
||||
IGNORE_YOURSELF=§cWie willst du dich selber ignorieren?
|
||||
IGNORE_ALREADY=§cDu ignorierst diesen Spieler bereits.
|
||||
IGNORE_IGNORE=§7Du ignorierst nun §e{0}§8.
|
||||
|
||||
IGNORE_MESSAGE=§7Du ignorierst nun §e{0}§8.
|
||||
|
||||
Lixfel
hat
klein schreiben klein schreiben
|
||||
#PollresultCommand
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Was soll der Schmarrn und das Rausentfernen der ganzen immer noch gültigen Werte?
Die Einträge die da Entfernt werden sind, wenn der Joinende Spieler, welcher nicht gebannt ist, dieselbe IP hat wie einer der Einträge. Dann ist dieser Eintrag für mich ungültig, weil der Spieler kommt ja drauf, wieso sollte er dann noch IPBanned sein?
Weil ggf. gerade kein Teammitglied online ist, was die Situation bewerten kann? Wenn er entbannt wird/der Bann ausgelaufen ist), dann werden die IPs gelöscht, vorher nicht (VPNs etc.).
Sofern in der ips Liste sich ein Spieler mit der ID vom grade beigetretener Spieler befindet wird dieser aus der Liste entfernt, weil dieser kann ja wieder darauf spielen, warum sollte man den dann noch einen nicht gebannten Spieler in der List lassen?
Das macht bereits ein anderes Codestück, die IPs nach einer Entbannung zu entfernen.