Update 4 years with various permission systems to UserPerm
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
4db2ba6a5d
Commit
7f05d0f9ca
@ -28,15 +28,15 @@ import de.steamwar.bungeecore.listeners.ping.PingListener;
|
||||
import de.steamwar.bungeecore.network.BungeeNetworkHandler;
|
||||
import de.steamwar.bungeecore.network.NetworkReceiver;
|
||||
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.command.SWCommandUtils;
|
||||
import de.steamwar.command.SWTypeMapperCreator;
|
||||
import de.steamwar.command.TabCompletionCache;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.sql.Punishment;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.Team;
|
||||
import de.steamwar.sql.UserElo;
|
||||
import de.steamwar.sql.internal.Statement;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
@ -56,9 +56,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@ -72,9 +70,6 @@ public class BungeeCore extends Plugin {
|
||||
|
||||
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;
|
||||
private ErrorLogger errorLogger;
|
||||
private TablistManager tablistManager;
|
||||
@ -128,11 +123,6 @@ public class BungeeCore extends Plugin {
|
||||
//new Node.RemoteNode("lx");
|
||||
}
|
||||
|
||||
commands.put("/tp", null);
|
||||
commands.put("/bc", null);
|
||||
commands.put("/bauchat", null);
|
||||
commands.put("/local", null);
|
||||
|
||||
new TeamchatCommand();
|
||||
new MsgCommand();
|
||||
new RCommand();
|
||||
@ -326,12 +316,10 @@ public class BungeeCore extends Plugin {
|
||||
for(final String serverName : servers.getKeys()){
|
||||
final Configuration server = servers.getSection(serverName);
|
||||
List<String> cmds = server.getStringList("commands");
|
||||
serverPermissions.put(serverName, "bungeecore.server." + server.getString("permission"));
|
||||
String cmd = cmds.remove(0);
|
||||
new ServerSwitchCommand(
|
||||
cmd,
|
||||
serverName,
|
||||
serverPermissions.get(serverName),
|
||||
cmds.toArray(new String[0])
|
||||
);
|
||||
if(server.getBoolean("modchecked", false)) {
|
||||
|
@ -123,7 +123,7 @@ public class Message {
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -20,7 +20,7 @@
|
||||
package de.steamwar.bungeecore.bot.commands;
|
||||
|
||||
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.events.interaction.SlashCommandEvent;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
|
||||
@ -45,7 +45,7 @@ public abstract class BasicDiscordCommand extends CommandData {
|
||||
protected boolean testPermission(SlashCommandEvent event) {
|
||||
Member member = event.getMember();
|
||||
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();
|
||||
return false;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.bungeecore.bot.config;
|
||||
|
||||
import de.steamwar.sql.UserGroup;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -52,7 +52,7 @@ public class SteamwarDiscordBotConfig {
|
||||
public static String TICKET_CREATED;
|
||||
public static String TICKET_LOG;
|
||||
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) {
|
||||
TOKEN = config.getString("token");
|
||||
@ -109,7 +109,7 @@ public class SteamwarDiscordBotConfig {
|
||||
RANKS = new HashMap<>();
|
||||
Configuration ranksSections = config.getSection("ranks");
|
||||
for (String type : ranksSections.getKeys()) {
|
||||
RANKS.put(UserGroup.getUsergroup(type), ranksSections.getString(type));
|
||||
RANKS.put(UserPerm.valueOf(type.toUpperCase()), ranksSections.getString(type));
|
||||
}
|
||||
loaded = true;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.bot.config.DiscordTicketType;
|
||||
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.MessageBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
@ -141,10 +142,10 @@ public class DiscordTicketListener extends BasicDiscordListener {
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
boolean sendMessage;
|
||||
if(user.getDiscordId() == null) {
|
||||
sendMessage = user.getUserGroup().isCheckSchematics();
|
||||
sendMessage = user.hasPerm(UserPerm.CHECK);
|
||||
} else {
|
||||
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) {
|
||||
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());
|
||||
|
@ -42,7 +42,7 @@ public class DiscordRanks {
|
||||
guild.retrieveMemberById(steamwarUser.getDiscordId()).queue(member -> {
|
||||
List<Role> roleList = member.getRoles();
|
||||
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) {
|
||||
if (!strings.contains(role.getId())) {
|
||||
continue;
|
||||
|
@ -21,6 +21,7 @@ package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.bot.SteamwarDiscordBot;
|
||||
import de.steamwar.bungeecore.listeners.ConnectionListener;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
@ -29,7 +30,7 @@ import net.md_5.bungee.api.CommandSender;
|
||||
public class AlertCommand extends SWCommand {
|
||||
|
||||
public AlertCommand() {
|
||||
super("alert", "bungeecore.alert", "broadcast", "bbc");
|
||||
super("alert", ConnectionListener.ALERT_PERMISSION, "broadcast", "bbc");
|
||||
}
|
||||
|
||||
@Register(description = "USAGE_ALERT")
|
||||
|
@ -3,6 +3,7 @@ package de.steamwar.bungeecore.commands;
|
||||
import de.steamwar.bungeecore.ArenaMode;
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.ServerStarter;
|
||||
import de.steamwar.bungeecore.listeners.ConnectionListener;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
@ -21,7 +22,7 @@ public class BuilderCloudCommand extends SWCommand {
|
||||
private final Map<String, ServerStarter.Version> versionMap = new HashMap<>();
|
||||
|
||||
public BuilderCloudCommand() {
|
||||
super("buildercloud", "bungeecore.server.team", "builder");
|
||||
super("buildercloud", ConnectionListener.BUILDERCLOUD_PERMISSION, "builder");
|
||||
|
||||
versionMap.put("15", ServerStarter.Version.SPIGOT_15);
|
||||
versionMap.put("1.15", ServerStarter.Version.SPIGOT_15);
|
||||
|
@ -19,13 +19,13 @@
|
||||
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.*;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.Subserver;
|
||||
import de.steamwar.command.SWCommand;
|
||||
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.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public class JoinmeCommand extends SWCommand {
|
||||
@ -36,7 +36,7 @@ public class JoinmeCommand extends SWCommand {
|
||||
|
||||
@Register(description = "JOINME_USAGE")
|
||||
public void genericCommand(ProxiedPlayer player) {
|
||||
if (!player.hasPermission("bungeecore.joinme")) {
|
||||
if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.TEAM)) {
|
||||
Message.send("JOINME_USAGE", player);
|
||||
return;
|
||||
}
|
||||
@ -50,35 +50,9 @@ public class JoinmeCommand extends SWCommand {
|
||||
Message.send("JOINME_PLAYER_SELF", player);
|
||||
return;
|
||||
}
|
||||
ServerInfo server = target.getServer().getInfo();
|
||||
String serverPerm = BungeeCore.serverPermissions.get(server.getName());
|
||||
Subserver subserver = Subserver.getSubserver(target);
|
||||
|
||||
if(subserver != null) {
|
||||
Servertype type = subserver.getType();
|
||||
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);
|
||||
}
|
||||
Subserver subserver = Subserver.getSubserver(target);
|
||||
TpCommand.teleport(player, subserver != null ? subserver.getServer() : target.getServer().getInfo());
|
||||
}
|
||||
|
||||
@ClassValidator(ProxiedPlayer.class)
|
||||
|
@ -21,6 +21,7 @@ package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.listeners.ConnectionListener;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
@ -34,7 +35,7 @@ import java.util.stream.Collectors;
|
||||
public class KickCommand extends SWCommand {
|
||||
|
||||
public KickCommand() {
|
||||
super("kick", "bungeecore.kick");
|
||||
super("kick", ConnectionListener.KICK_PERMISSION);
|
||||
}
|
||||
|
||||
@Register(description = "KICK_USAGE")
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.listeners.ConnectionListener;
|
||||
import de.steamwar.bungeecore.listeners.PollSystem;
|
||||
import de.steamwar.sql.PollAnswer;
|
||||
import de.steamwar.command.SWCommand;
|
||||
@ -31,7 +32,7 @@ import java.util.Map;
|
||||
public class PollresultCommand extends SWCommand {
|
||||
|
||||
public PollresultCommand() {
|
||||
super("pollresult", "bungeecore.pollresults");
|
||||
super("pollresult", ConnectionListener.POLLRESULT_PERMISSION);
|
||||
}
|
||||
|
||||
@Register
|
||||
|
@ -22,11 +22,13 @@ package de.steamwar.bungeecore.commands;
|
||||
import com.google.gson.JsonParser;
|
||||
import de.steamwar.bungeecore.BungeeCore;
|
||||
import de.steamwar.bungeecore.Message;
|
||||
import de.steamwar.bungeecore.listeners.ConnectionListener;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.sql.BannedUserIPs;
|
||||
import de.steamwar.sql.Punishment;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
@ -114,12 +116,12 @@ public class PunishmentCommand {
|
||||
}
|
||||
|
||||
public PunishmentCommand(String command, Punishment.PunishmentType punishmentType) {
|
||||
new SWCommand(command, "bungeecore.ban") {
|
||||
new SWCommand(command, ConnectionListener.BAN_PERMISSION) {
|
||||
|
||||
@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());
|
||||
if (punishmentType.isNeedsAdmin() && !punisher.getUserGroup().isAdminGroup()) {
|
||||
if (punishmentType.isNeedsAdmin() && !punisher.hasPerm(UserPerm.MODERATION)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -149,10 +151,10 @@ public class PunishmentCommand {
|
||||
return;
|
||||
}
|
||||
String antiCommand = "un" + command;
|
||||
new SWCommand(antiCommand, "bungeecore.ban") {
|
||||
new SWCommand(antiCommand, ConnectionListener.BAN_PERMISSION) {
|
||||
@Register
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,7 @@ import de.steamwar.bungeecore.*;
|
||||
import de.steamwar.bungeecore.inventory.SWItem;
|
||||
import de.steamwar.bungeecore.inventory.SWListInv;
|
||||
import de.steamwar.bungeecore.inventory.SWStreamInv;
|
||||
import de.steamwar.sql.Fight;
|
||||
import de.steamwar.sql.Punishment;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.*;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
@ -58,7 +55,7 @@ public class ReplayCommand extends SWCommand {
|
||||
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();
|
||||
} else if(!fight.replayAllowed()) {
|
||||
sender.system("REPLAY_UNAVAILABLE");
|
||||
|
@ -20,17 +20,16 @@
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
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.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public class ServerSwitchCommand extends SWCommand {
|
||||
|
||||
private String serverName;
|
||||
private final String serverName;
|
||||
|
||||
public ServerSwitchCommand(String cmd, String name, String permission, String... aliases) {
|
||||
super(cmd, permission, aliases);
|
||||
public ServerSwitchCommand(String cmd, String name, String... aliases) {
|
||||
super(cmd, null, aliases);
|
||||
serverName = name;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.listeners.ChatListener;
|
||||
import de.steamwar.bungeecore.listeners.ConnectionListener;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
@ -27,7 +28,7 @@ import net.md_5.bungee.api.CommandSender;
|
||||
public class ServerTeamchatCommand extends SWCommand {
|
||||
|
||||
public ServerTeamchatCommand() {
|
||||
super("stc", "bungeecore.teamchat","serverteamchat");
|
||||
super("stc", ConnectionListener.TEAMCHAT_PERMISSION,"serverteamchat");
|
||||
}
|
||||
|
||||
@Register(description = "STC_USAGE")
|
||||
|
@ -20,16 +20,12 @@
|
||||
package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.*;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
import de.steamwar.sql.Punishment;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.Team;
|
||||
import de.steamwar.sql.*;
|
||||
import de.steamwar.bungeecore.util.BauLock;
|
||||
import de.steamwar.bungeecore.util.Chat19;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.sql.Event;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
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);
|
||||
if(CheckCommand.isChecking(player)){
|
||||
sender.system("CHECK_CHECKING");
|
||||
return;
|
||||
}
|
||||
|
||||
String serverPerm = BungeeCore.serverPermissions.get(server.getName());
|
||||
Subserver subserver = Subserver.getSubserver(server);
|
||||
if(subserver == null) {
|
||||
player.connect(server);
|
||||
return;
|
||||
}
|
||||
|
||||
if (subserver != null && subserver.getType() == Servertype.ARENA) {
|
||||
if (!PunishmentCommand.isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer))
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
switch (subserver.getType()) {
|
||||
case ARENA:
|
||||
if (PunishmentCommand.isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer))
|
||||
return;
|
||||
break;
|
||||
|
||||
} else if(subserver instanceof Bauserver) {
|
||||
case BAUSERVER:
|
||||
Bauserver bauserver = (Bauserver) subserver;
|
||||
ProxiedPlayer checker = BungeeCord.getInstance().getPlayer(bauserver.getOwner());
|
||||
if (checker != null && CheckCommand.isChecking(checker)) {
|
||||
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
||||
if (steamwarUser.getUserGroup().isCheckSchematics() || CheckCommand.getCheckingSchem(checker).getOwner() == steamwarUser.getId()) {
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
} else {
|
||||
if (!sender.user().hasPerm(UserPerm.CHECK) && CheckCommand.getCheckingSchem(checker).getOwner() != sender.user().getId()) {
|
||||
sender.system("JOIN_PLAYER_BLOCK");
|
||||
return;
|
||||
}
|
||||
}else if (BauLock.isLocked(SteamwarUser.get(bauserver.getOwner()), sender.user())) {
|
||||
Message.send("BAU_LOCKED_NOALLOWED", player);
|
||||
}else if (bauserver.getOwner().equals(player.getUniqueId()) || BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
} else {
|
||||
} else if (BauLock.isLocked(SteamwarUser.get(bauserver.getOwner()), sender.user())) {
|
||||
sender.system("BAU_LOCKED_NOALLOWED");
|
||||
return;
|
||||
} else if (!bauserver.getOwner().equals(player.getUniqueId()) && BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) == null) {
|
||||
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
|
||||
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")) {
|
||||
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);
|
||||
}
|
||||
SubserverSystem.sendPlayer(subserver, player);
|
||||
}
|
||||
|
||||
private static ServerInfo getTarget(String arg) {
|
||||
|
@ -29,6 +29,7 @@ import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.Tutorial;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
@ -83,9 +84,7 @@ public class TutorialCommand extends SWCommand {
|
||||
|
||||
@Validator("unreleased")
|
||||
public TypeValidator<ProxiedPlayer> unreleasedChecker() {
|
||||
return (sender, value, messageSender) -> {
|
||||
return (SteamwarUser.get((value).getUniqueId()).getUserGroup().isTeamGroup());
|
||||
};
|
||||
return (sender, value, messageSender) -> (SteamwarUser.get((value).getUniqueId()).hasPerm(UserPerm.TEAM));
|
||||
}
|
||||
|
||||
private void openInventory(ProxiedPlayer player, boolean released, boolean own) {
|
||||
@ -95,7 +94,7 @@ public class TutorialCommand extends SWCommand {
|
||||
player,
|
||||
Message.parse("TUTORIAL_TITLE", player),
|
||||
(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();
|
||||
openInventory(player, released, own);
|
||||
return;
|
||||
|
@ -78,15 +78,15 @@ public class WhoisCommand extends SWCommand {
|
||||
}
|
||||
|
||||
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_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());
|
||||
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_ID", player, user.getId());
|
||||
if (user.getDiscordId() != null) {
|
||||
@ -153,9 +153,9 @@ public class WhoisCommand extends SWCommand {
|
||||
return new TypeMapper<WhoisParameterTypes>() {
|
||||
@Override
|
||||
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)
|
||||
.filter(p -> p.userGroupSet.contains(userGroup))
|
||||
.filter(p -> user.hasPerm(p.perm))
|
||||
.filter(p -> p.getTabCompletes().contains(s))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
@ -163,9 +163,9 @@ public class WhoisCommand extends SWCommand {
|
||||
|
||||
@Override
|
||||
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)
|
||||
.filter(p -> p.userGroupSet.contains(userGroup))
|
||||
.filter(p -> user.hasPerm(p.perm))
|
||||
.flatMap(p -> p.getTabCompletes().stream())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@ -173,17 +173,17 @@ public class WhoisCommand extends SWCommand {
|
||||
}
|
||||
|
||||
private enum WhoisParameterTypes {
|
||||
ALL(Arrays.asList("-a", "-all"), UserGroup.Admin, UserGroup.Moderator, UserGroup.Developer, UserGroup.Supporter, UserGroup.Builder),
|
||||
MOD(Arrays.asList("-m", "-mod", "-mods"), UserGroup.Admin, UserGroup.Moderator, UserGroup.Developer);
|
||||
ALL(Arrays.asList("-a", "-all"), UserPerm.TEAM),
|
||||
MOD(Arrays.asList("-m", "-mod", "-mods"), UserPerm.MODERATION);
|
||||
|
||||
private final EnumSet<UserGroup> userGroupSet;
|
||||
private final UserPerm perm;
|
||||
|
||||
@Getter
|
||||
private List<String> tabCompletes;
|
||||
|
||||
|
||||
WhoisParameterTypes(List<String> tabCompletes, UserGroup... userGroups) {
|
||||
this.userGroupSet = EnumSet.copyOf(Arrays.asList(userGroups));
|
||||
WhoisParameterTypes(List<String> tabCompletes, UserPerm perm) {
|
||||
this.perm = perm;
|
||||
this.tabCompletes = tabCompletes;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import de.steamwar.sql.BannedUserIPs;
|
||||
import de.steamwar.sql.Punishment;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
@ -80,7 +81,7 @@ public class BanListener extends BasicListener {
|
||||
+ " Bannumgehung");
|
||||
|
||||
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.SHOWN)){
|
||||
StringBuilder potentialBan = new StringBuilder();
|
||||
|
@ -101,7 +101,7 @@ public class ChatListener extends BasicListener {
|
||||
|
||||
public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) {
|
||||
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))
|
||||
return;
|
||||
|
||||
@ -153,8 +153,7 @@ public class ChatListener extends BasicListener {
|
||||
}
|
||||
|
||||
SteamwarUser user = sender.user();
|
||||
UserGroup group = user.getUserGroup();
|
||||
if(!group.isTeamGroup() && (message.contains("http:") || message.contains("https:") || message.contains("www."))){
|
||||
if(!user.hasPerm(UserPerm.TEAM) && (message.contains("http:") || message.contains("https:") || message.contains("www."))){
|
||||
sender.system("CHAT_NO_LINKS");
|
||||
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) {
|
||||
UserGroup group = sender.getUserGroup();
|
||||
UserPerm.Prefix prefix = sender.prefix();
|
||||
String chatColorCode = sender.hasPerm(UserPerm.TEAM) ? "§f" : "§7";
|
||||
receiver.chat(new Message(format,
|
||||
sender,
|
||||
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() + " ",
|
||||
UserElo.getEmblem(sender, rankedModes),
|
||||
group.getColorCode(),
|
||||
group.getChatPrefix().length() == 0 ? "§f" : group.getChatPrefix() + " ",
|
||||
group.getChatColorCode()));
|
||||
prefix.getColorCode(),
|
||||
prefix.getChatPrefix().length() == 0 ? "§f" : prefix.getChatPrefix() + " ",
|
||||
chatColorCode));
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -31,7 +31,7 @@ import de.steamwar.bungeecore.commands.ModCommand;
|
||||
import de.steamwar.bungeecore.commands.MsgCommand;
|
||||
import de.steamwar.bungeecore.listeners.mods.Utils;
|
||||
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.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
@ -47,10 +47,16 @@ import java.util.*;
|
||||
|
||||
public class ConnectionListener extends BasicListener {
|
||||
|
||||
private static final String ADMIN_GROUP = "admin";
|
||||
public static final String TEAM_GROUP = "team";
|
||||
private 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";
|
||||
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<>();
|
||||
|
||||
@ -63,25 +69,36 @@ public class ConnectionListener extends BasicListener {
|
||||
ProxiedPlayer player = event.getPlayer();
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
|
||||
player.removeGroups("Admin", "team");
|
||||
player.removeGroups(TEAM_GROUP);
|
||||
|
||||
if(user.getUserGroup().isAdminGroup())
|
||||
player.addGroups(ADMIN_GROUP);
|
||||
|
||||
if(user.getUserGroup().isTeamGroup()) {
|
||||
player.addGroups(TEAM_GROUP);
|
||||
CheckCommand.sendReminder(player);
|
||||
if(user.hasPerm(UserPerm.ADMINISTRATION)) {
|
||||
player.setPermission("bungeecord.command.end", true);
|
||||
player.setPermission("bungeecord.command.reload", true);
|
||||
player.setPermission("bungeecord.command.ip", true);
|
||||
player.setPermission(SOFTRELOAD_PERMISSION, true);
|
||||
}
|
||||
|
||||
if(user.getUserGroup().isCheckSchematics())
|
||||
player.setPermission(CHECK_PERMISSION, true);
|
||||
if(user.hasPerm(UserPerm.MODERATION)) {
|
||||
player.setPermission(ALERT_PERMISSION, true);
|
||||
player.setPermission(KICK_PERMISSION, true);
|
||||
player.setPermission(POLLRESULT_PERMISSION, true);
|
||||
}
|
||||
|
||||
if(user.getUserGroup() != UserGroup.Member) {
|
||||
player.setPermission(YOUTUBER_MODS, true);
|
||||
player.setDisplayName(user.getUserGroup().getColorCode() + user.getUserGroup().getChatPrefix() + " " + player.getName() + "§r");
|
||||
player.setPermission("bungeecore.group." + user.getUserGroup().name().toLowerCase(), true);
|
||||
}else {
|
||||
player.setDisplayName("§f" + player.getName());
|
||||
if(user.hasPerm(UserPerm.TEAM)) {
|
||||
player.setPermission("bungeecord.command.list", true);
|
||||
player.setPermission("bungeecord.command.send", true);
|
||||
player.setPermission("bungeecord.command.server", true);
|
||||
player.setPermission(TEAMCHAT_PERMISSION, true);
|
||||
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()){
|
||||
|
@ -26,6 +26,7 @@ import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.messages.ChatSender;
|
||||
import de.steamwar.sql.Mod;
|
||||
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.TextComponent;
|
||||
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){
|
||||
SteamwarUser user = SteamwarUser.get(uuid);
|
||||
boolean privileged = user.getUserGroup().isPrivilegedMods();
|
||||
playerModMap.put(uuid,new ArrayList<>(mods));
|
||||
|
||||
ModType max = ModType.YELLOW;
|
||||
Iterator<Mod> it = mods.iterator();
|
||||
while(it.hasNext()){
|
||||
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();
|
||||
else if(mod.getModType() == ModType.RED)
|
||||
max = ModType.RED;
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
package de.steamwar.bungeecore.tablist;
|
||||
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserGroup;
|
||||
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.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.chat.ComponentSerializer;
|
||||
@ -62,11 +62,11 @@ interface TablistPart {
|
||||
|
||||
public Item(ProxiedPlayer player, boolean sameTeam) {
|
||||
this.uuid = player.getUniqueId();
|
||||
UserGroup userGroup = SteamwarUser.get(player.getUniqueId()).getUserGroup();
|
||||
if (userGroup == UserGroup.Member && sameTeam) {
|
||||
UserPerm.Prefix prefix = SteamwarUser.get(player.getUniqueId()).prefix();
|
||||
if (prefix == UserPerm.emptyPrefix && sameTeam) {
|
||||
this.displayName = reformat("§f" + player.getName());
|
||||
} else {
|
||||
this.displayName = reformat(userGroup.getColorCode() + player.getName());
|
||||
this.displayName = reformat(prefix.getColorCode() + player.getName());
|
||||
}
|
||||
this.properties = playerProperties(player);
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ WHOIS_USERNAME=§7Username§8: §e{0}
|
||||
WHOIS_UUID=§7UUID§8: §e{0}
|
||||
WHOIS_UUID_HOVER=§eCopy UUID
|
||||
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_JOINED_FIRST=§7Joined on§8: §e{0}
|
||||
WHOIS_HOURS_PLAYED=§7Online Time§8: §e{0}h
|
||||
|
@ -569,7 +569,7 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen.
|
||||
#WhoisCommand
|
||||
WHOIS_USAGE=§c/whois [Spieler/ID] [-a/-m]
|
||||
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_HOVER=§eUUID Kopieren
|
||||
WHOIS_ID=§7ID§8: §e{0}
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.messages;
|
||||
import de.steamwar.bungeecore.*;
|
||||
import de.steamwar.bungeecore.bot.listeners.DiscordChatListener;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
@ -61,7 +62,7 @@ public interface ChatSender {
|
||||
}
|
||||
|
||||
static Stream<ChatSender> serverteamReceivers() {
|
||||
return allReceivers().filter(player -> player.user().getUserGroup().isTeamGroup());
|
||||
return allReceivers().filter(player -> player.user().hasPerm(UserPerm.TEAM));
|
||||
}
|
||||
|
||||
SteamwarUser user();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren