geforkt von SteamWar/BungeeCore
fix a few small things
Dieser Commit ist enthalten in:
Ursprung
ed55af8952
Commit
798009176c
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.bungeecore.commands;
|
package de.steamwar.bungeecore.commands;
|
||||||
|
|
||||||
import com.google.common.reflect.TypeParameter;
|
|
||||||
import de.steamwar.bungeecore.Message;
|
import de.steamwar.bungeecore.Message;
|
||||||
import de.steamwar.bungeecore.Storage;
|
import de.steamwar.bungeecore.Storage;
|
||||||
import de.steamwar.bungeecore.listeners.mods.Utils;
|
import de.steamwar.bungeecore.listeners.mods.Utils;
|
||||||
@ -27,22 +26,17 @@ import de.steamwar.bungeecore.sql.*;
|
|||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.command.SWCommandUtils;
|
import de.steamwar.command.SWCommandUtils;
|
||||||
import de.steamwar.command.TypeMapper;
|
import de.steamwar.command.TypeMapper;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.md_5.bungee.BungeeCord;
|
import net.md_5.bungee.BungeeCord;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
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 net.md_5.bungee.command.ConsoleCommandSender;
|
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.sql.Array;
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Supplier;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@ -74,7 +68,7 @@ public class WhoisCommand extends SWCommand {
|
|||||||
if (user == null) {
|
if (user == null) {
|
||||||
Message.send("UNKNOWN_PLAYER", player);
|
Message.send("UNKNOWN_PLAYER", player);
|
||||||
} else {
|
} else {
|
||||||
sendUserinfo(player, user, new HashSet<>(Arrays.asList(parameters)));
|
sendUserinfo(player, user, Arrays.asList(parameters));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +77,7 @@ public class WhoisCommand extends SWCommand {
|
|||||||
return SWCommandUtils.createMapper(s -> s, s -> BungeeCord.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList()));
|
return SWCommandUtils.createMapper(s -> s, s -> BungeeCord.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user, Set<WhoisParameterTypes> parameterTypes) {
|
private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user, List<WhoisParameterTypes> parameterTypes) {
|
||||||
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());
|
||||||
@ -109,17 +103,17 @@ public class WhoisCommand extends SWCommand {
|
|||||||
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());
|
||||||
|
|
||||||
if(Utils.synchronizedPlayerModMap.containsKey(user.getUuid())) {
|
if(Utils.playerModMap.containsKey(user.getUuid())) {
|
||||||
Mod.Platform modPlatform = Utils.synchronizedPlayerModMap.get(user.getUuid()).get(0).getPlatform();
|
Mod.Platform modPlatform = Utils.playerModMap.get(user.getUuid()).get(0).getPlatform();
|
||||||
Message.send("WHOIS_PLATFORM",player,modPlatform.toString());
|
Message.send("WHOIS_PLATFORM",player,modPlatform.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(parameterTypes.contains(WhoisParameterTypes.MOD)) {
|
if(parameterTypes.contains(WhoisParameterTypes.MOD)) {
|
||||||
List<Mod> activeMods = Utils.synchronizedPlayerModMap.get(user.getUuid());
|
List<Mod> activeMods = Utils.playerModMap.get(user.getUuid());
|
||||||
|
|
||||||
if(!activeMods.isEmpty()) {
|
if(!activeMods.isEmpty()) {
|
||||||
Message.send("WHOIS_ACTIVE_MODS",player);
|
Message.send("WHOIS_ACTIVE_MODS",player);
|
||||||
String result = activeMods.stream().map(mod -> mod.getModType().getColorCode() + mod.getModName()).collect(Collectors.joining("§8, "));
|
String result = activeMods.stream().map(mod -> "§" + mod.getModType().getColorCode() + mod.getModName()).collect(Collectors.joining("§8, "));
|
||||||
Message.send("WHOIS_ACTIVE_MOD", player,result);
|
Message.send("WHOIS_ACTIVE_MOD", player,result);
|
||||||
}else {
|
}else {
|
||||||
Message.send("WHOIS_NO_ACTIVE_MODS",player);
|
Message.send("WHOIS_NO_ACTIVE_MODS",player);
|
||||||
|
@ -31,7 +31,6 @@ import de.steamwar.bungeecore.commands.MsgCommand;
|
|||||||
import de.steamwar.bungeecore.listeners.mods.Utils;
|
import de.steamwar.bungeecore.listeners.mods.Utils;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import de.steamwar.bungeecore.sql.UserGroup;
|
import de.steamwar.bungeecore.sql.UserGroup;
|
||||||
import net.md_5.bungee.Util;
|
|
||||||
import net.md_5.bungee.api.AbstractReconnectHandler;
|
import net.md_5.bungee.api.AbstractReconnectHandler;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
@ -137,7 +136,7 @@ public class ConnectionListener extends BasicListener {
|
|||||||
public void onDisconnect(PlayerDisconnectEvent e){
|
public void onDisconnect(PlayerDisconnectEvent e){
|
||||||
ChallengeCommand.remove(e.getPlayer());
|
ChallengeCommand.remove(e.getPlayer());
|
||||||
MsgCommand.remove(e.getPlayer());
|
MsgCommand.remove(e.getPlayer());
|
||||||
Utils.synchronizedPlayerModMap.remove(e.getPlayer().getUniqueId());
|
Utils.playerModMap.remove(e.getPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -40,7 +40,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
public static final Map<UUID,List<Mod>> synchronizedPlayerModMap = new HashMap<>();
|
public static final Map<UUID,List<Mod>> playerModMap = new HashMap<>();
|
||||||
|
|
||||||
private Utils(){}
|
private Utils(){}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ public class Utils {
|
|||||||
static boolean handleMods(UUID uuid, Locale locale, Consumer<BaseComponent[]> disconnect, List<Mod> mods){
|
static boolean handleMods(UUID uuid, Locale locale, Consumer<BaseComponent[]> disconnect, List<Mod> mods){
|
||||||
SteamwarUser user = SteamwarUser.get(uuid);
|
SteamwarUser user = SteamwarUser.get(uuid);
|
||||||
boolean privileged = user.getUserGroup().privilegedMods();
|
boolean privileged = user.getUserGroup().privilegedMods();
|
||||||
synchronizedPlayerModMap.put(uuid,new ArrayList<>(mods));
|
playerModMap.put(uuid,new ArrayList<>(mods));
|
||||||
|
|
||||||
ModType max = ModType.YELLOW;
|
ModType max = ModType.YELLOW;
|
||||||
Iterator<Mod> it = mods.iterator();
|
Iterator<Mod> it = mods.iterator();
|
||||||
|
@ -74,11 +74,11 @@ public class Mod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum ModType {
|
public enum ModType {
|
||||||
UNKLASSIFIED(0,"§7 "),
|
UNKLASSIFIED(0,"7"),
|
||||||
GREEN(1,"§a "),
|
GREEN(1,"a"),
|
||||||
YELLOW(2,"§e "),
|
YELLOW(2,"e"),
|
||||||
RED(3,"§c "),
|
RED(3,"c"),
|
||||||
YOUTUBER_ONLY(4,"§6 ");
|
YOUTUBER_ONLY(4,"6");
|
||||||
|
|
||||||
static ModType valueOf(int value){
|
static ModType valueOf(int value){
|
||||||
for(ModType mt : values()){
|
for(ModType mt : values()){
|
||||||
|
@ -577,8 +577,6 @@ WHOIS_NO_PUNISHMENT=§a✓ §7Der Spieler hat keine aktiven Strafen.
|
|||||||
WHOIS_NO_ALL_PUNISHMENT=§a✓ §7Der Spieler hat noch nichts getan.
|
WHOIS_NO_ALL_PUNISHMENT=§a✓ §7Der Spieler hat noch nichts getan.
|
||||||
WHOIS_ACTIVE_MODS=§7Aktive Mods:
|
WHOIS_ACTIVE_MODS=§7Aktive Mods:
|
||||||
WHOIS_NO_ACTIVE_MODS=§7Der Spieler hat keine aktiven Mods.
|
WHOIS_NO_ACTIVE_MODS=§7Der Spieler hat keine aktiven Mods.
|
||||||
WHOIS_ACTIVE_MOD={0}
|
|
||||||
WHOIS_PLATFORM=§7Modloader:§e{0}
|
|
||||||
|
|
||||||
#VerifyCommand
|
#VerifyCommand
|
||||||
VERIFY_USAGE=§c/verify [Code]
|
VERIFY_USAGE=§c/verify [Code]
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren