SteamWar/BungeeCore
Archiviert
13
2

Update 4 years with various permission systems to UserPerm
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-08-29 17:47:49 +02:00
Ursprung 4db2ba6a5d
Commit 7f05d0f9ca
26 geänderte Dateien mit 152 neuen und 177 gelöschten Zeilen

Datei anzeigen

@ -28,15 +28,15 @@ import de.steamwar.bungeecore.listeners.ping.PingListener;
import de.steamwar.bungeecore.network.BungeeNetworkHandler; import de.steamwar.bungeecore.network.BungeeNetworkHandler;
import de.steamwar.bungeecore.network.NetworkReceiver; import de.steamwar.bungeecore.network.NetworkReceiver;
import de.steamwar.bungeecore.network.SWScriptSyntaxForwarder; import de.steamwar.bungeecore.network.SWScriptSyntaxForwarder;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserElo;
import de.steamwar.bungeecore.tablist.TablistManager; import de.steamwar.bungeecore.tablist.TablistManager;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.SWTypeMapperCreator; import de.steamwar.command.SWTypeMapperCreator;
import de.steamwar.command.TabCompletionCache; import de.steamwar.command.TabCompletionCache;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Team; import de.steamwar.sql.Team;
import de.steamwar.sql.UserElo;
import de.steamwar.sql.internal.Statement; import de.steamwar.sql.internal.Statement;
import net.md_5.bungee.BungeeCord; import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
@ -56,9 +56,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level; import java.util.logging.Level;
@ -72,9 +70,6 @@ public class BungeeCore extends Plugin {
private static BungeeCore instance; private static BungeeCore instance;
public static final Map<String, String> serverPermissions = new HashMap<>();
public static final Map<String, String> commands = new HashMap<>();
public static Node local; public static Node local;
private ErrorLogger errorLogger; private ErrorLogger errorLogger;
private TablistManager tablistManager; private TablistManager tablistManager;
@ -128,11 +123,6 @@ public class BungeeCore extends Plugin {
//new Node.RemoteNode("lx"); //new Node.RemoteNode("lx");
} }
commands.put("/tp", null);
commands.put("/bc", null);
commands.put("/bauchat", null);
commands.put("/local", null);
new TeamchatCommand(); new TeamchatCommand();
new MsgCommand(); new MsgCommand();
new RCommand(); new RCommand();
@ -326,12 +316,10 @@ public class BungeeCore extends Plugin {
for(final String serverName : servers.getKeys()){ for(final String serverName : servers.getKeys()){
final Configuration server = servers.getSection(serverName); final Configuration server = servers.getSection(serverName);
List<String> cmds = server.getStringList("commands"); List<String> cmds = server.getStringList("commands");
serverPermissions.put(serverName, "bungeecore.server." + server.getString("permission"));
String cmd = cmds.remove(0); String cmd = cmds.remove(0);
new ServerSwitchCommand( new ServerSwitchCommand(
cmd, cmd,
serverName, serverName,
serverPermissions.get(serverName),
cmds.toArray(new String[0]) cmds.toArray(new String[0])
); );
if(server.getBoolean("modchecked", false)) { if(server.getBoolean("modchecked", false)) {

Datei anzeigen

@ -123,7 +123,7 @@ public class Message {
} }
public static void team(String message, String onHover, ClickEvent onClick, Object... params) { public static void team(String message, String onHover, ClickEvent onClick, Object... params) {
ChatSender.serverteamReceivers().filter(player -> player.user().getUserGroup().isTeamGroup()).forEach(player -> player.prefixless(message, onHover != null ? new Message(onHover, params) : null, onClick, params)); ChatSender.serverteamReceivers().forEach(player -> player.prefixless(message, onHover != null ? new Message(onHover, params) : null, onClick, params));
} }
private final String format; private final String format;

Datei anzeigen

@ -20,7 +20,7 @@
package de.steamwar.bungeecore.bot.commands; package de.steamwar.bungeecore.bot.commands;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserPerm;
import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.commands.build.CommandData;
@ -45,7 +45,7 @@ public abstract class BasicDiscordCommand extends CommandData {
protected boolean testPermission(SlashCommandEvent event) { protected boolean testPermission(SlashCommandEvent event) {
Member member = event.getMember(); Member member = event.getMember();
SteamwarUser steamwarUser = SteamwarUser.get(member.getIdLong()); SteamwarUser steamwarUser = SteamwarUser.get(member.getIdLong());
if (steamwarUser == null || (!steamwarUser.getUserGroup().isTeamGroup() && steamwarUser.getUserGroup() != UserGroup.Builder)) { if (steamwarUser == null || (!steamwarUser.hasPerm(UserPerm.TEAM))) {
event.reply("Du hast für " + event.getName() + " keine Rechte oder es existiert keine Verknüpfung für dich.").setEphemeral(true).queue(); event.reply("Du hast für " + event.getName() + " keine Rechte oder es existiert keine Verknüpfung für dich.").setEphemeral(true).queue();
return false; return false;
} }

Datei anzeigen

@ -19,7 +19,7 @@
package de.steamwar.bungeecore.bot.config; package de.steamwar.bungeecore.bot.config;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserPerm;
import net.md_5.bungee.config.Configuration; import net.md_5.bungee.config.Configuration;
import java.util.ArrayList; import java.util.ArrayList;
@ -52,7 +52,7 @@ public class SteamwarDiscordBotConfig {
public static String TICKET_CREATED; public static String TICKET_CREATED;
public static String TICKET_LOG; public static String TICKET_LOG;
public static Map<String, DiscordTicketType> TICKET_TYPES; public static Map<String, DiscordTicketType> TICKET_TYPES;
public static Map<UserGroup, String> RANKS; public static Map<UserPerm, String> RANKS;
public static void loadConfig(Configuration config) { public static void loadConfig(Configuration config) {
TOKEN = config.getString("token"); TOKEN = config.getString("token");
@ -109,7 +109,7 @@ public class SteamwarDiscordBotConfig {
RANKS = new HashMap<>(); RANKS = new HashMap<>();
Configuration ranksSections = config.getSection("ranks"); Configuration ranksSections = config.getSection("ranks");
for (String type : ranksSections.getKeys()) { for (String type : ranksSections.getKeys()) {
RANKS.put(UserGroup.getUsergroup(type), ranksSections.getString(type)); RANKS.put(UserPerm.valueOf(type.toUpperCase()), ranksSections.getString(type));
} }
loaded = true; loaded = true;
} }

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.bot.config.DiscordTicketType; import de.steamwar.bungeecore.bot.config.DiscordTicketType;
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig; import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.MessageBuilder; import net.dv8tion.jda.api.MessageBuilder;
import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.Permission;
@ -141,10 +142,10 @@ public class DiscordTicketListener extends BasicDiscordListener {
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
boolean sendMessage; boolean sendMessage;
if(user.getDiscordId() == null) { if(user.getDiscordId() == null) {
sendMessage = user.getUserGroup().isCheckSchematics(); sendMessage = user.hasPerm(UserPerm.CHECK);
} else { } else {
if(event.getAuthor().getId().equals(user.getDiscordId())) return; if(event.getAuthor().getId().equals(user.getDiscordId())) return;
sendMessage = user.getDiscordId().equals(event.getChannel().getTopic()) || user.getUserGroup().isCheckSchematics(); sendMessage = user.getDiscordId().equals(event.getChannel().getTopic()) || user.hasPerm(UserPerm.CHECK);
} }
if(sendMessage) { if(sendMessage) {
Message.sendPrefixless("DISCORD_TICKET_MESSAGE", player, "Zur nachricht", new ClickEvent(ClickEvent.Action.OPEN_URL, event.getMessage().getJumpUrl()), event.getChannel().getName(), event.getAuthor().getName(), event.getMessage().getContentRaw()); Message.sendPrefixless("DISCORD_TICKET_MESSAGE", player, "Zur nachricht", new ClickEvent(ClickEvent.Action.OPEN_URL, event.getMessage().getJumpUrl()), event.getChannel().getName(), event.getAuthor().getName(), event.getMessage().getContentRaw());

Datei anzeigen

@ -42,7 +42,7 @@ public class DiscordRanks {
guild.retrieveMemberById(steamwarUser.getDiscordId()).queue(member -> { guild.retrieveMemberById(steamwarUser.getDiscordId()).queue(member -> {
List<Role> roleList = member.getRoles(); List<Role> roleList = member.getRoles();
Set<String> strings = new HashSet<>(SteamwarDiscordBotConfig.RANKS.values()); Set<String> strings = new HashSet<>(SteamwarDiscordBotConfig.RANKS.values());
String needed = SteamwarDiscordBotConfig.RANKS.get(steamwarUser.getUserGroup()); String needed = SteamwarDiscordBotConfig.RANKS.get(steamwarUser.prefix());
for (Role role : roleList) { for (Role role : roleList) {
if (!strings.contains(role.getId())) { if (!strings.contains(role.getId())) {
continue; continue;

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.bot.SteamwarDiscordBot; import de.steamwar.bungeecore.bot.SteamwarDiscordBot;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
@ -29,7 +30,7 @@ import net.md_5.bungee.api.CommandSender;
public class AlertCommand extends SWCommand { public class AlertCommand extends SWCommand {
public AlertCommand() { public AlertCommand() {
super("alert", "bungeecore.alert", "broadcast", "bbc"); super("alert", ConnectionListener.ALERT_PERMISSION, "broadcast", "bbc");
} }
@Register(description = "USAGE_ALERT") @Register(description = "USAGE_ALERT")

Datei anzeigen

@ -3,6 +3,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.ArenaMode; import de.steamwar.bungeecore.ArenaMode;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.ServerStarter; import de.steamwar.bungeecore.ServerStarter;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
@ -21,7 +22,7 @@ public class BuilderCloudCommand extends SWCommand {
private final Map<String, ServerStarter.Version> versionMap = new HashMap<>(); private final Map<String, ServerStarter.Version> versionMap = new HashMap<>();
public BuilderCloudCommand() { public BuilderCloudCommand() {
super("buildercloud", "bungeecore.server.team", "builder"); super("buildercloud", ConnectionListener.BUILDERCLOUD_PERMISSION, "builder");
versionMap.put("15", ServerStarter.Version.SPIGOT_15); versionMap.put("15", ServerStarter.Version.SPIGOT_15);
versionMap.put("1.15", ServerStarter.Version.SPIGOT_15); versionMap.put("1.15", ServerStarter.Version.SPIGOT_15);

Datei anzeigen

@ -19,13 +19,13 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.Message;
import de.steamwar.sql.BauweltMember; import de.steamwar.bungeecore.Subserver;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
import net.md_5.bungee.api.CommandSender; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
public class JoinmeCommand extends SWCommand { public class JoinmeCommand extends SWCommand {
@ -36,7 +36,7 @@ public class JoinmeCommand extends SWCommand {
@Register(description = "JOINME_USAGE") @Register(description = "JOINME_USAGE")
public void genericCommand(ProxiedPlayer player) { public void genericCommand(ProxiedPlayer player) {
if (!player.hasPermission("bungeecore.joinme")) { if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.TEAM)) {
Message.send("JOINME_USAGE", player); Message.send("JOINME_USAGE", player);
return; return;
} }
@ -50,35 +50,9 @@ public class JoinmeCommand extends SWCommand {
Message.send("JOINME_PLAYER_SELF", player); Message.send("JOINME_PLAYER_SELF", player);
return; return;
} }
ServerInfo server = target.getServer().getInfo();
String serverPerm = BungeeCore.serverPermissions.get(server.getName());
Subserver subserver = Subserver.getSubserver(target);
if(subserver != null) { Subserver subserver = Subserver.getSubserver(target);
Servertype type = subserver.getType(); TpCommand.teleport(player, subserver != null ? subserver.getServer() : target.getServer().getInfo());
if (type == Servertype.ARENA) {
SubserverSystem.sendPlayer(subserver, player);
} else if (type == Servertype.BAUSERVER) {
Bauserver bauserver = (Bauserver) subserver;
if (bauserver.getOwner().equals(player.getUniqueId()) ||
BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
SubserverSystem.sendPlayer(subserver, player);
} else {
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
Message.send("JOIN_PLAYER_BLOCK", player);
}
} else if(type == Servertype.BUILDER && !player.hasPermission("bungeecore.server.team")) {
Message.send("JOIN_PLAYER_BLOCK", player);
} else {
SubserverSystem.sendPlayer(subserver, player);
}
}else if(serverPerm != null && !player.hasPermission(serverPerm)){
Message.send("JOIN_PLAYER_BLOCK", player);
}else if(serverPerm == null && !player.getGroups().contains("team")) {
Message.send("JOIN_PLAYER_BLOCK", player);
}else{
player.connect(server);
}
} }
@ClassValidator(ProxiedPlayer.class) @ClassValidator(ProxiedPlayer.class)

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.listeners.ConnectionListener;
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;
@ -34,7 +35,7 @@ import java.util.stream.Collectors;
public class KickCommand extends SWCommand { public class KickCommand extends SWCommand {
public KickCommand() { public KickCommand() {
super("kick", "bungeecore.kick"); super("kick", ConnectionListener.KICK_PERMISSION);
} }
@Register(description = "KICK_USAGE") @Register(description = "KICK_USAGE")

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.bungeecore.listeners.PollSystem; import de.steamwar.bungeecore.listeners.PollSystem;
import de.steamwar.sql.PollAnswer; import de.steamwar.sql.PollAnswer;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
@ -31,7 +32,7 @@ import java.util.Map;
public class PollresultCommand extends SWCommand { public class PollresultCommand extends SWCommand {
public PollresultCommand() { public PollresultCommand() {
super("pollresult", "bungeecore.pollresults"); super("pollresult", ConnectionListener.POLLRESULT_PERMISSION);
} }
@Register @Register

Datei anzeigen

@ -22,11 +22,13 @@ 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.bungeecore.listeners.ConnectionListener;
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 de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import net.md_5.bungee.api.ChatMessageType; 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;
@ -114,12 +116,12 @@ 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, ConnectionListener.BAN_PERMISSION) {
@Register @Register
public void genericCommand(ProxiedPlayer player, String toPunish, String date, @ErrorMessage(allowEAs = false, value = "PUNISHMENT_USAGE_REASON") String... message) { 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.hasPerm(UserPerm.MODERATION)) {
return; return;
} }
@ -149,10 +151,10 @@ public class PunishmentCommand {
return; return;
} }
String antiCommand = "un" + command; String antiCommand = "un" + command;
new SWCommand(antiCommand, "bungeecore.ban") { new SWCommand(antiCommand, ConnectionListener.BAN_PERMISSION) {
@Register @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()).hasPerm(UserPerm.MODERATION)) {
return; return;
} }

Datei anzeigen

@ -23,10 +23,7 @@ import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWItem;
import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.inventory.SWListInv;
import de.steamwar.bungeecore.inventory.SWStreamInv; import de.steamwar.bungeecore.inventory.SWStreamInv;
import de.steamwar.sql.Fight; import de.steamwar.sql.*;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SchematicType;
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 net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -58,7 +55,7 @@ public class ReplayCommand extends SWCommand {
if (tMap != null) map = tMap; if (tMap != null) map = tMap;
} }
if (user.getUserGroup().isAdminGroup() && click.isShiftClick() && fight.replayExists()) { if (user.hasPerm(UserPerm.MODERATION) && click.isShiftClick() && fight.replayExists()) {
starter.test(mode, map, player).start(); starter.test(mode, map, player).start();
} else if(!fight.replayAllowed()) { } else if(!fight.replayAllowed()) {
sender.system("REPLAY_UNAVAILABLE"); sender.system("REPLAY_UNAVAILABLE");

Datei anzeigen

@ -20,17 +20,16 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
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.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
public class ServerSwitchCommand extends SWCommand { public class ServerSwitchCommand extends SWCommand {
private String serverName; private final String serverName;
public ServerSwitchCommand(String cmd, String name, String permission, String... aliases) { public ServerSwitchCommand(String cmd, String name, String... aliases) {
super(cmd, permission, aliases); super(cmd, null, aliases);
serverName = name; serverName = name;
} }

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.listeners.ChatListener; import de.steamwar.bungeecore.listeners.ChatListener;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
@ -27,7 +28,7 @@ import net.md_5.bungee.api.CommandSender;
public class ServerTeamchatCommand extends SWCommand { public class ServerTeamchatCommand extends SWCommand {
public ServerTeamchatCommand() { public ServerTeamchatCommand() {
super("stc", "bungeecore.teamchat","serverteamchat"); super("stc", ConnectionListener.TEAMCHAT_PERMISSION,"serverteamchat");
} }
@Register(description = "STC_USAGE") @Register(description = "STC_USAGE")

Datei anzeigen

@ -20,16 +20,12 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.*;
import de.steamwar.sql.BauweltMember; import de.steamwar.sql.*;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Team;
import de.steamwar.bungeecore.util.BauLock; import de.steamwar.bungeecore.util.BauLock;
import de.steamwar.bungeecore.util.Chat19; import de.steamwar.bungeecore.util.Chat19;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import de.steamwar.sql.Event;
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.ProxyServer; import net.md_5.bungee.api.ProxyServer;
@ -95,48 +91,52 @@ public class TpCommand extends SWCommand {
}; };
} }
public static void teleport(ProxiedPlayer player, ServerInfo server){ public static void teleport (ProxiedPlayer player, ServerInfo server) {
ChatSender sender = ChatSender.of(player); ChatSender sender = ChatSender.of(player);
if(CheckCommand.isChecking(player)){ if(CheckCommand.isChecking(player)){
sender.system("CHECK_CHECKING"); sender.system("CHECK_CHECKING");
return; return;
} }
String serverPerm = BungeeCore.serverPermissions.get(server.getName());
Subserver subserver = Subserver.getSubserver(server); Subserver subserver = Subserver.getSubserver(server);
if(subserver == null) {
player.connect(server);
return;
}
if (subserver != null && subserver.getType() == Servertype.ARENA) { switch (subserver.getType()) {
if (!PunishmentCommand.isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer)) case ARENA:
SubserverSystem.sendPlayer(subserver, player); if (PunishmentCommand.isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer))
return;
break;
} else if(subserver instanceof Bauserver) { case BAUSERVER:
Bauserver bauserver = (Bauserver) subserver; Bauserver bauserver = (Bauserver) subserver;
ProxiedPlayer checker = BungeeCord.getInstance().getPlayer(bauserver.getOwner()); ProxiedPlayer checker = BungeeCord.getInstance().getPlayer(bauserver.getOwner());
if (checker != null && CheckCommand.isChecking(checker)) { if (checker != null && CheckCommand.isChecking(checker)) {
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId()); if (!sender.user().hasPerm(UserPerm.CHECK) && CheckCommand.getCheckingSchem(checker).getOwner() != sender.user().getId()) {
if (steamwarUser.getUserGroup().isCheckSchematics() || CheckCommand.getCheckingSchem(checker).getOwner() == steamwarUser.getId()) {
SubserverSystem.sendPlayer(subserver, player);
} else {
sender.system("JOIN_PLAYER_BLOCK"); sender.system("JOIN_PLAYER_BLOCK");
return;
} }
}else if (BauLock.isLocked(SteamwarUser.get(bauserver.getOwner()), sender.user())) { } else if (BauLock.isLocked(SteamwarUser.get(bauserver.getOwner()), sender.user())) {
Message.send("BAU_LOCKED_NOALLOWED", player); sender.system("BAU_LOCKED_NOALLOWED");
}else if (bauserver.getOwner().equals(player.getUniqueId()) || BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) { return;
SubserverSystem.sendPlayer(subserver, player); } else if (!bauserver.getOwner().equals(player.getUniqueId()) && BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) == null) {
} else {
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
sender.system("JOIN_PLAYER_BLOCK"); sender.system("JOIN_PLAYER_BLOCK");
return;
}
break;
case BUILDER:
if(!sender.user().hasPerm(UserPerm.BUILD)) {
sender.system("JOIN_PLAYER_BLOCK");
return;
}
break;
} }
} else if(subserver instanceof Builderserver && !player.hasPermission("bungeecore.server.team")) { SubserverSystem.sendPlayer(subserver, player);
sender.system("JOIN_PLAYER_BLOCK");
} else if (serverPerm != null && !player.hasPermission(serverPerm)) {
sender.system("JOIN_PLAYER_BLOCK");
} else if (serverPerm == null && !player.getGroups().contains("team")) {
sender.system("JOIN_PLAYER_BLOCK");
} else {
player.connect(server);
}
} }
private static ServerInfo getTarget(String arg) { private static ServerInfo getTarget(String arg) {

Datei anzeigen

@ -29,6 +29,7 @@ import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Tutorial; import de.steamwar.sql.Tutorial;
import de.steamwar.sql.UserPerm;
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;
@ -83,9 +84,7 @@ public class TutorialCommand extends SWCommand {
@Validator("unreleased") @Validator("unreleased")
public TypeValidator<ProxiedPlayer> unreleasedChecker() { public TypeValidator<ProxiedPlayer> unreleasedChecker() {
return (sender, value, messageSender) -> { return (sender, value, messageSender) -> (SteamwarUser.get((value).getUniqueId()).hasPerm(UserPerm.TEAM));
return (SteamwarUser.get((value).getUniqueId()).getUserGroup().isTeamGroup());
};
} }
private void openInventory(ProxiedPlayer player, boolean released, boolean own) { private void openInventory(ProxiedPlayer player, boolean released, boolean own) {
@ -95,7 +94,7 @@ public class TutorialCommand extends SWCommand {
player, player,
Message.parse("TUTORIAL_TITLE", player), Message.parse("TUTORIAL_TITLE", player),
(click, tutorial) -> { (click, tutorial) -> {
if(!released && click.isShiftClick() && user.getUserGroup().isTeamGroup() && user.getId() != tutorial.getCreator()) { if(!released && click.isShiftClick() && user.hasPerm(UserPerm.TEAM) && user.getId() != tutorial.getCreator()) {
tutorial.release(); tutorial.release();
openInventory(player, released, own); openInventory(player, released, own);
return; return;

Datei anzeigen

@ -78,15 +78,15 @@ public class WhoisCommand extends SWCommand {
} }
private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user, EnumSet<WhoisParameterTypes> parameterTypes) { private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user, EnumSet<WhoisParameterTypes> parameterTypes) {
UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup(); SteamwarUser sender = SteamwarUser.get(player.getUniqueId());
Message.send("WHOIS_USERNAME", player, user.getUserName()); Message.send("WHOIS_USERNAME", player, user.getUserName());
Message.send("WHOIS_GROUP", player, user.getUserGroup().getColorCode(), user.getUserGroup().name()); Message.send("WHOIS_PERMS", player, user.perms().stream().map(Enum::name).collect(Collectors.joining(", ")));
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 (!userGroup.isTeamGroup()) return; if (!sender.hasPerm(UserPerm.TEAM)) return;
if (userGroup.isAdminGroup()) { if (sender.hasPerm(UserPerm.MODERATION)) {
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());
if (user.getDiscordId() != null) { if (user.getDiscordId() != null) {
@ -153,9 +153,9 @@ public class WhoisCommand extends SWCommand {
return new TypeMapper<WhoisParameterTypes>() { return new TypeMapper<WhoisParameterTypes>() {
@Override @Override
public WhoisParameterTypes map(CommandSender commandSender, String[] previousArguments, String s) { public WhoisParameterTypes map(CommandSender commandSender, String[] previousArguments, String s) {
UserGroup userGroup = SteamwarUser.get(((ProxiedPlayer) commandSender).getUniqueId()).getUserGroup(); SteamwarUser user = SteamwarUser.get(((ProxiedPlayer) commandSender).getUniqueId());
return Stream.of(values) return Stream.of(values)
.filter(p -> p.userGroupSet.contains(userGroup)) .filter(p -> user.hasPerm(p.perm))
.filter(p -> p.getTabCompletes().contains(s)) .filter(p -> p.getTabCompletes().contains(s))
.findFirst() .findFirst()
.orElse(null); .orElse(null);
@ -163,9 +163,9 @@ public class WhoisCommand extends SWCommand {
@Override @Override
public Collection<String> tabCompletes(CommandSender commandSender, String[] previousArguments, String s) { public Collection<String> tabCompletes(CommandSender commandSender, String[] previousArguments, String s) {
UserGroup userGroup = SteamwarUser.get(((ProxiedPlayer) commandSender).getUniqueId()).getUserGroup(); SteamwarUser user = SteamwarUser.get(((ProxiedPlayer) commandSender).getUniqueId());
return Stream.of(values) return Stream.of(values)
.filter(p -> p.userGroupSet.contains(userGroup)) .filter(p -> user.hasPerm(p.perm))
.flatMap(p -> p.getTabCompletes().stream()) .flatMap(p -> p.getTabCompletes().stream())
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@ -173,17 +173,17 @@ public class WhoisCommand extends SWCommand {
} }
private enum WhoisParameterTypes { private enum WhoisParameterTypes {
ALL(Arrays.asList("-a", "-all"), UserGroup.Admin, UserGroup.Moderator, UserGroup.Developer, UserGroup.Supporter, UserGroup.Builder), ALL(Arrays.asList("-a", "-all"), UserPerm.TEAM),
MOD(Arrays.asList("-m", "-mod", "-mods"), UserGroup.Admin, UserGroup.Moderator, UserGroup.Developer); MOD(Arrays.asList("-m", "-mod", "-mods"), UserPerm.MODERATION);
private final EnumSet<UserGroup> userGroupSet; private final UserPerm perm;
@Getter @Getter
private List<String> tabCompletes; private List<String> tabCompletes;
WhoisParameterTypes(List<String> tabCompletes, UserGroup... userGroups) { WhoisParameterTypes(List<String> tabCompletes, UserPerm perm) {
this.userGroupSet = EnumSet.copyOf(Arrays.asList(userGroups)); this.perm = perm;
this.tabCompletes = tabCompletes; this.tabCompletes = tabCompletes;
} }
} }

Datei anzeigen

@ -28,6 +28,7 @@ import de.steamwar.sql.BannedUserIPs;
import de.steamwar.sql.Punishment; import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import de.steamwar.sql.UserPerm;
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;
import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.ComponentBuilder;
@ -80,7 +81,7 @@ public class BanListener extends BasicListener {
+ " Bannumgehung"); + " Bannumgehung");
for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){
if ((target.hasPermission("bungeecore.teamchat")) if (SteamwarUser.get(target.getUniqueId()).hasPerm(UserPerm.TEAM)
&& (target.getChatMode() == ProxiedPlayer.ChatMode.COMMANDS_ONLY && (target.getChatMode() == ProxiedPlayer.ChatMode.COMMANDS_ONLY
|| target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN)){ || target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN)){
StringBuilder potentialBan = new StringBuilder(); StringBuilder potentialBan = new StringBuilder();

Datei anzeigen

@ -101,7 +101,7 @@ public class ChatListener extends BasicListener {
public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) { public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) {
SteamwarUser user = sender.user(); SteamwarUser user = sender.user();
final String coloredMessage = (user.getUserGroup() != UserGroup.Member || coloredTeams.contains(user.getTeam())) ? ChatColor.translateAlternateColorCodes('&', message) : message; final String coloredMessage = (user.prefix() != UserPerm.emptyPrefix || coloredTeams.contains(user.getTeam())) ? ChatColor.translateAlternateColorCodes('&', message) : message;
if(chatFilter(sender, coloredMessage)) if(chatFilter(sender, coloredMessage))
return; return;
@ -153,8 +153,7 @@ public class ChatListener extends BasicListener {
} }
SteamwarUser user = sender.user(); SteamwarUser user = sender.user();
UserGroup group = user.getUserGroup(); if(!user.hasPerm(UserPerm.TEAM) && (message.contains("http:") || message.contains("https:") || message.contains("www."))){
if(!group.isTeamGroup() && (message.contains("http:") || message.contains("https:") || message.contains("www."))){
sender.system("CHAT_NO_LINKS"); sender.system("CHAT_NO_LINKS");
return true; return true;
} }
@ -173,16 +172,17 @@ public class ChatListener extends BasicListener {
} }
private static void chatToReciever(ChatSender receiver, ChatSender msgReceiver, SteamwarUser sender, String format, String message) { private static void chatToReciever(ChatSender receiver, ChatSender msgReceiver, SteamwarUser sender, String format, String message) {
UserGroup group = sender.getUserGroup(); UserPerm.Prefix prefix = sender.prefix();
String chatColorCode = sender.hasPerm(UserPerm.TEAM) ? "§f" : "§7";
receiver.chat(new Message(format, receiver.chat(new Message(format,
sender, sender,
msgReceiver == null ? receiver : msgReceiver, msgReceiver == null ? receiver : msgReceiver,
highlightMentions(message, group.getChatColorCode(), receiver), highlightMentions(message, chatColorCode, receiver),
sender.getTeam() == 0 ? "" : "§" + Team.get(sender.getTeam()).getTeamColor() + Team.get(sender.getTeam()).getTeamKuerzel() + " ", sender.getTeam() == 0 ? "" : "§" + Team.get(sender.getTeam()).getTeamColor() + Team.get(sender.getTeam()).getTeamKuerzel() + " ",
UserElo.getEmblem(sender, rankedModes), UserElo.getEmblem(sender, rankedModes),
group.getColorCode(), prefix.getColorCode(),
group.getChatPrefix().length() == 0 ? "§f" : group.getChatPrefix() + " ", prefix.getChatPrefix().length() == 0 ? "§f" : prefix.getChatPrefix() + " ",
group.getChatColorCode())); chatColorCode));
} }
private static boolean filteredCommand(CommandSender sender, String message) { private static boolean filteredCommand(CommandSender sender, String message) {
@ -242,15 +242,6 @@ public class ChatListener extends BasicListener {
} }
} }
} }
if(e.getSender() instanceof ProxiedPlayer && cursor.length == 1 && cursor[0].startsWith("/")){
ProxiedPlayer player = (ProxiedPlayer) e.getSender();
for(String cmd : BungeeCore.commands.keySet()){
if(cmd.startsWith(cursor[0]) && player.hasPermission(BungeeCore.commands.get(cmd))){
suggestions.add(cmd);
}
}
}
} }
@EventHandler @EventHandler

Datei anzeigen

@ -31,7 +31,7 @@ import de.steamwar.bungeecore.commands.ModCommand;
import de.steamwar.bungeecore.commands.MsgCommand; import de.steamwar.bungeecore.commands.MsgCommand;
import de.steamwar.bungeecore.listeners.mods.Utils; import de.steamwar.bungeecore.listeners.mods.Utils;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserPerm;
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;
@ -47,10 +47,16 @@ import java.util.*;
public class ConnectionListener extends BasicListener { public class ConnectionListener extends BasicListener {
private static final String ADMIN_GROUP = "admin"; private static final String TEAM_GROUP = "team";
public static final String TEAM_GROUP = "team";
public static final String ALERT_PERMISSION = "bungeecore.alert";
public static final String BAN_PERMISSION = "bungeecore.ban";
public static final String BUILDERCLOUD_PERMISSION = "bungeecore.buildercloud";
public static final String CHECK_PERMISSION = "bungeecore.check"; public static final String CHECK_PERMISSION = "bungeecore.check";
private static final String YOUTUBER_MODS = "bungeecore.youtubermods"; public static final String KICK_PERMISSION = "bungeecore.kick";
public static final String POLLRESULT_PERMISSION = "bungeecore.pollresult";
public static final String SOFTRELOAD_PERMISSION = "bungeecore.softreload";
public static final String TEAMCHAT_PERMISSION = "bungeecore.teamchat";
private static final Set<UUID> newPlayers = new HashSet<>(); private static final Set<UUID> newPlayers = new HashSet<>();
@ -63,25 +69,36 @@ public class ConnectionListener extends BasicListener {
ProxiedPlayer player = event.getPlayer(); ProxiedPlayer player = event.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
player.removeGroups("Admin", "team"); player.removeGroups(TEAM_GROUP);
if(user.getUserGroup().isAdminGroup()) if(user.hasPerm(UserPerm.ADMINISTRATION)) {
player.addGroups(ADMIN_GROUP); player.setPermission("bungeecord.command.end", true);
player.setPermission("bungeecord.command.reload", true);
if(user.getUserGroup().isTeamGroup()) { player.setPermission("bungeecord.command.ip", true);
player.addGroups(TEAM_GROUP); player.setPermission(SOFTRELOAD_PERMISSION, true);
CheckCommand.sendReminder(player);
} }
if(user.getUserGroup().isCheckSchematics()) if(user.hasPerm(UserPerm.MODERATION)) {
player.setPermission(CHECK_PERMISSION, true); player.setPermission(ALERT_PERMISSION, true);
player.setPermission(KICK_PERMISSION, true);
player.setPermission(POLLRESULT_PERMISSION, true);
}
if(user.getUserGroup() != UserGroup.Member) { if(user.hasPerm(UserPerm.TEAM)) {
player.setPermission(YOUTUBER_MODS, true); player.setPermission("bungeecord.command.list", true);
player.setDisplayName(user.getUserGroup().getColorCode() + user.getUserGroup().getChatPrefix() + " " + player.getName() + "§r"); player.setPermission("bungeecord.command.send", true);
player.setPermission("bungeecore.group." + user.getUserGroup().name().toLowerCase(), true); player.setPermission("bungeecord.command.server", true);
}else { player.setPermission(TEAMCHAT_PERMISSION, true);
player.setDisplayName("§f" + player.getName()); player.setPermission(BAN_PERMISSION, true);
}
if(user.hasPerm(UserPerm.CHECK)) {
CheckCommand.sendReminder(player);
player.setPermission(CHECK_PERMISSION, true);
}
if(user.hasPerm(UserPerm.BUILD)) {
player.setPermission(BUILDERCLOUD_PERMISSION, true);
} }
for(Subserver subserver : Subserver.getServerList()){ for(Subserver subserver : Subserver.getServerList()){

Datei anzeigen

@ -26,6 +26,7 @@ import de.steamwar.sql.SteamwarUser;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import de.steamwar.sql.Mod; import de.steamwar.sql.Mod;
import de.steamwar.sql.Mod.ModType; import de.steamwar.sql.Mod.ModType;
import de.steamwar.sql.UserPerm;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -68,14 +69,13 @@ 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().isPrivilegedMods();
playerModMap.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();
while(it.hasNext()){ while(it.hasNext()){
Mod mod = it.next(); Mod mod = it.next();
if(mod.getModType() == ModType.UNKLASSIFIED || mod.getModType() == ModType.GREEN || (mod.getModType() == ModType.YOUTUBER_ONLY && privileged)) if(mod.getModType() == ModType.UNKLASSIFIED || mod.getModType() == ModType.GREEN || (mod.getModType() == ModType.YOUTUBER_ONLY && user.hasPerm(UserPerm.RESTRICTED_MODS)))
it.remove(); it.remove();
else if(mod.getModType() == ModType.RED) else if(mod.getModType() == ModType.RED)
max = ModType.RED; max = ModType.RED;

Datei anzeigen

@ -19,9 +19,9 @@
package de.steamwar.bungeecore.tablist; package de.steamwar.bungeecore.tablist;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.chat.ComponentSerializer; import net.md_5.bungee.chat.ComponentSerializer;
@ -62,11 +62,11 @@ interface TablistPart {
public Item(ProxiedPlayer player, boolean sameTeam) { public Item(ProxiedPlayer player, boolean sameTeam) {
this.uuid = player.getUniqueId(); this.uuid = player.getUniqueId();
UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup(); UserPerm.Prefix prefix = SteamwarUser.get(player.getUniqueId()).prefix();
if (userGroup == UserGroup.Member && sameTeam) { if (prefix == UserPerm.emptyPrefix && sameTeam) {
this.displayName = reformat("§f" + player.getName()); this.displayName = reformat("§f" + player.getName());
} else { } else {
this.displayName = reformat(userGroup.getColorCode() + player.getName()); this.displayName = reformat(prefix.getColorCode() + player.getName());
} }
this.properties = playerProperties(player); this.properties = playerProperties(player);
} }

Datei anzeigen

@ -593,7 +593,7 @@ WHOIS_USERNAME=§7Username§8: §e{0}
WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0}
WHOIS_UUID_HOVER=§eCopy UUID WHOIS_UUID_HOVER=§eCopy UUID
WHOIS_ID=§7ID§8: §e{0} WHOIS_ID=§7ID§8: §e{0}
WHOIS_GROUP=§7Group§8: {0}{1} WHOIS_PERMS=§7Perms§8: §7{0}
WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0} WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0}
WHOIS_JOINED_FIRST=§7Joined on§8: §e{0} WHOIS_JOINED_FIRST=§7Joined on§8: §e{0}
WHOIS_HOURS_PLAYED=§7Online Time§8: §e{0}h WHOIS_HOURS_PLAYED=§7Online Time§8: §e{0}h

Datei anzeigen

@ -569,7 +569,7 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen.
#WhoisCommand #WhoisCommand
WHOIS_USAGE=§c/whois [Spieler/ID] [-a/-m] WHOIS_USAGE=§c/whois [Spieler/ID] [-a/-m]
WHOIS_USERNAME=§7Username§8: §e{0} WHOIS_USERNAME=§7Username§8: §e{0}
WHOIS_GROUP=§7Gruppe§8: {0}{1} WHOIS_PERMS=§7Rechte§8: §7{0}
WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0}
WHOIS_UUID_HOVER=§eUUID Kopieren WHOIS_UUID_HOVER=§eUUID Kopieren
WHOIS_ID=§7ID§8: §e{0} WHOIS_ID=§7ID§8: §e{0}

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.messages;
import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.bot.listeners.DiscordChatListener; import de.steamwar.bungeecore.bot.listeners.DiscordChatListener;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import net.md_5.bungee.api.ChatMessageType; 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;
@ -61,7 +62,7 @@ public interface ChatSender {
} }
static Stream<ChatSender> serverteamReceivers() { static Stream<ChatSender> serverteamReceivers() {
return allReceivers().filter(player -> player.user().getUserGroup().isTeamGroup()); return allReceivers().filter(player -> player.user().hasPerm(UserPerm.TEAM));
} }
SteamwarUser user(); SteamwarUser user();