diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/PlayerBalancer.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/PlayerBalancer.java index 2291880..c479b1b 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/PlayerBalancer.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/PlayerBalancer.java @@ -1,14 +1,12 @@ package com.jaimemartz.playerbalancer; import com.google.common.reflect.TypeToken; -import com.jaimemartz.playerbalancer.commands.FallbackCommand; -import com.jaimemartz.playerbalancer.commands.MainCommand; -import com.jaimemartz.playerbalancer.commands.ManageCommand; +import com.jaimemartz.playerbalancer.commands.*; import com.jaimemartz.playerbalancer.connection.ServerAssignRegistry; +import com.jaimemartz.playerbalancer.helper.NetworkManager; +import com.jaimemartz.playerbalancer.helper.PasteHelper; +import com.jaimemartz.playerbalancer.helper.PlayerLocker; import com.jaimemartz.playerbalancer.listeners.*; -import com.jaimemartz.playerbalancer.manager.NetworkManager; -import com.jaimemartz.playerbalancer.manager.PasteHelper; -import com.jaimemartz.playerbalancer.manager.PlayerLocker; import com.jaimemartz.playerbalancer.ping.StatusManager; import com.jaimemartz.playerbalancer.section.SectionManager; import com.jaimemartz.playerbalancer.settings.SettingsHolder; @@ -41,7 +39,7 @@ public class PlayerBalancer extends Plugin { private final StringBuilder logsBuilder = new StringBuilder(); private FallbackCommand fallbackCommand; - private Command mainCommand, manageCommand; + private Command mainCommand, manageCommand, findCommand, listCommand, serverCommand; private Listener connectListener, kickListener, reloadListener, pluginMessageListener; @Override @@ -181,23 +179,27 @@ public class PlayerBalancer extends Plugin { getProxy().getPluginManager().registerListener(this, kickListener); } + //After the modules have loaded (hopefully?) getProxy().getScheduler().schedule(this, () -> { if (settings.getFeaturesProps().getCustomFindCommandProps().isEnabled()) { - Plugin plugin = getProxy().getPluginManager().getPlugin("cmd_find"); - if (plugin != null) { - getProxy().getPluginManager().unregisterCommands(plugin); - getLogger().info("Unregistered commands of the plugin: " + plugin.getDescription().getName()); - } + tryUnregisterCommands("cmd_find"); + findCommand = new CustomFindCommand(this); + getProxy().getPluginManager().registerCommand(this, findCommand); } if (settings.getFeaturesProps().getCustomListCommandProps().isEnabled()) { - Plugin plugin = getProxy().getPluginManager().getPlugin("cmd_list"); - if (plugin != null) { - getProxy().getPluginManager().unregisterCommands(plugin); - getLogger().info("Unregistered commands of the plugin: " + plugin.getDescription().getName()); - } + tryUnregisterCommands("cmd_list"); + listCommand = new CustomListCommand(this); + getProxy().getPluginManager().registerCommand(this, listCommand); } - }, 1L, TimeUnit.SECONDS); + + if (settings.getFeaturesProps().getCustomServerCommandProps().isEnabled()) { + tryUnregisterCommands("cmd_server"); + serverCommand = new CustomServerCommand(this); + getProxy().getPluginManager().registerCommand(this, serverCommand); + } + + }, 5L, TimeUnit.SECONDS); PasteHelper.reset(); getLogger().info("The plugin has finished loading without any problems"); @@ -214,6 +216,16 @@ public class PlayerBalancer extends Plugin { } } + private void tryUnregisterCommands(String pluginName) { + Plugin plugin = getProxy().getPluginManager().getPlugin(pluginName); + if (plugin != null) { + getProxy().getPluginManager().unregisterCommands(plugin); + getLogger().info("Unregistered all commands of the plugin: " + pluginName); + } else { + getLogger().warning("Could not find the plugin: " + pluginName); + } + } + private void execStop() { if (mainCommand != null) { getProxy().getPluginManager().unregisterCommand(mainCommand); @@ -269,6 +281,27 @@ public class PlayerBalancer extends Plugin { manageCommand = null; } + if (settings.getFeaturesProps().getCustomFindCommandProps().isEnabled()) { + if (findCommand != null) { + getProxy().getPluginManager().unregisterCommand(findCommand); + findCommand = null; + } + } + + if (settings.getFeaturesProps().getCustomListCommandProps().isEnabled()) { + if (listCommand != null) { + getProxy().getPluginManager().unregisterCommand(listCommand); + listCommand = null; + } + } + + if (settings.getFeaturesProps().getCustomServerCommandProps().isEnabled()) { + if (serverCommand != null) { + getProxy().getPluginManager().unregisterCommand(serverCommand); + serverCommand = null; + } + } + if (sectionManager != null) { sectionManager.flush(); } diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/custom/CustomFindCommand.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/CustomFindCommand.java similarity index 95% rename from Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/custom/CustomFindCommand.java rename to Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/CustomFindCommand.java index 6bd2d8b..d25aa30 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/custom/CustomFindCommand.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/CustomFindCommand.java @@ -1,4 +1,4 @@ -package com.jaimemartz.playerbalancer.commands.custom; +package com.jaimemartz.playerbalancer.commands; import com.jaimemartz.playerbalancer.PlayerBalancer; import com.jaimemartz.playerbalancer.settings.props.features.CustomFindCommandProps; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/custom/CustomListCommand.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/CustomListCommand.java similarity index 95% rename from Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/custom/CustomListCommand.java rename to Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/CustomListCommand.java index 1ab766b..7fc301b 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/custom/CustomListCommand.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/CustomListCommand.java @@ -1,4 +1,4 @@ -package com.jaimemartz.playerbalancer.commands.custom; +package com.jaimemartz.playerbalancer.commands; import com.jaimemartz.playerbalancer.PlayerBalancer; import com.jaimemartz.playerbalancer.settings.props.features.CustomListCommandProps; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/custom/CustomServerCommand.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/CustomServerCommand.java similarity index 95% rename from Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/custom/CustomServerCommand.java rename to Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/CustomServerCommand.java index fa8f463..782486b 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/custom/CustomServerCommand.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/CustomServerCommand.java @@ -1,4 +1,4 @@ -package com.jaimemartz.playerbalancer.commands.custom; +package com.jaimemartz.playerbalancer.commands; import com.jaimemartz.playerbalancer.PlayerBalancer; import com.jaimemartz.playerbalancer.settings.props.features.CustomServerCommandProps; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/FallbackCommand.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/FallbackCommand.java index ed05250..5517f8c 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/FallbackCommand.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/FallbackCommand.java @@ -87,8 +87,16 @@ public class FallbackCommand extends Command { return null; } - ServerSection target = plugin.getSectionManager().getBind(props.getRules(), current) - .orElse(current.getParent()); + ServerSection target = current.getParent(); + + String bindName = props.getRules().get(current.getName()); + if (bindName != null) { + ServerSection bind = plugin.getSectionManager().getByName(bindName); + if (bind != null) { + target = bind; + } + } + if (target == null) { MessageUtils.send(player, messages.getUnavailableServerMessage()); return null; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/MainCommand.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/MainCommand.java index d294595..8ef72de 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/MainCommand.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/MainCommand.java @@ -2,7 +2,7 @@ package com.jaimemartz.playerbalancer.commands; import com.google.common.base.Strings; import com.jaimemartz.playerbalancer.PlayerBalancer; -import com.jaimemartz.playerbalancer.manager.PasteHelper; +import com.jaimemartz.playerbalancer.helper.PasteHelper; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ClickEvent; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java index 35696f2..45f3d2b 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/commands/ManageCommand.java @@ -109,6 +109,13 @@ public class ManageCommand extends Command { .create()); } + sender.sendMessage(new ComponentBuilder("Alias: ") + .color(ChatColor.GRAY) + .append(String.valueOf(section.getProps().getAlias())) + .color(ChatColor.AQUA) + .create() + ); + sender.sendMessage(new ComponentBuilder("Position: ") .color(ChatColor.GRAY) .append(String.valueOf(section.getPosition())) diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/connection/ConnectionIntent.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/connection/ConnectionIntent.java index 0c9f7d9..3ba21a2 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/connection/ConnectionIntent.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/connection/ConnectionIntent.java @@ -1,7 +1,7 @@ package com.jaimemartz.playerbalancer.connection; import com.jaimemartz.playerbalancer.PlayerBalancer; -import com.jaimemartz.playerbalancer.manager.PlayerLocker; +import com.jaimemartz.playerbalancer.helper.PlayerLocker; import com.jaimemartz.playerbalancer.section.ServerSection; import com.jaimemartz.playerbalancer.utils.MessageUtils; import net.md_5.bungee.api.Callback; @@ -26,6 +26,7 @@ public abstract class ConnectionIntent { MessageUtils.send(player, plugin.getSettings().getMessagesProps().getConnectingMessage(), (str) -> str.replace("{section}", section.getName()) + .replace("{alias}", section.getProps().getAlias()) ); //Prevents removing servers from the section @@ -46,6 +47,8 @@ public abstract class ConnectionIntent { if (response) { //only if the connect has been executed correctly MessageUtils.send(player, plugin.getSettings().getMessagesProps().getConnectedMessage(), (str) -> str.replace("{server}", target.getName()) + .replace("{section}", section.getName()) + .replace("{alias}", section.getProps().getAlias()) ); } }); diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/manager/NetworkManager.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/helper/NetworkManager.java similarity index 93% rename from Main Plugin/src/main/java/com/jaimemartz/playerbalancer/manager/NetworkManager.java rename to Main Plugin/src/main/java/com/jaimemartz/playerbalancer/helper/NetworkManager.java index e7ea166..44cb45a 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/manager/NetworkManager.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/helper/NetworkManager.java @@ -1,4 +1,4 @@ -package com.jaimemartz.playerbalancer.manager; +package com.jaimemartz.playerbalancer.helper; import com.imaginarycode.minecraft.redisbungee.RedisBungee; import com.jaimemartz.playerbalancer.PlayerBalancer; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/manager/PasteHelper.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/helper/PasteHelper.java similarity index 99% rename from Main Plugin/src/main/java/com/jaimemartz/playerbalancer/manager/PasteHelper.java rename to Main Plugin/src/main/java/com/jaimemartz/playerbalancer/helper/PasteHelper.java index 33ad8b4..8f51357 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/manager/PasteHelper.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/helper/PasteHelper.java @@ -1,4 +1,4 @@ -package com.jaimemartz.playerbalancer.manager; +package com.jaimemartz.playerbalancer.helper; import com.google.common.io.CharStreams; import com.jaimemartz.playerbalancer.PlayerBalancer; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/manager/PlayerLocker.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/helper/PlayerLocker.java similarity index 95% rename from Main Plugin/src/main/java/com/jaimemartz/playerbalancer/manager/PlayerLocker.java rename to Main Plugin/src/main/java/com/jaimemartz/playerbalancer/helper/PlayerLocker.java index 413bfa7..736e99a 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/manager/PlayerLocker.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/helper/PlayerLocker.java @@ -1,4 +1,4 @@ -package com.jaimemartz.playerbalancer.manager; +package com.jaimemartz.playerbalancer.helper; import net.md_5.bungee.api.connection.ProxiedPlayer; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/PlayerDisconnectListener.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/PlayerDisconnectListener.java index 0dd148f..5cc15bd 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/PlayerDisconnectListener.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/PlayerDisconnectListener.java @@ -2,7 +2,7 @@ package com.jaimemartz.playerbalancer.listeners; import com.jaimemartz.playerbalancer.PlayerBalancer; import com.jaimemartz.playerbalancer.connection.ServerAssignRegistry; -import com.jaimemartz.playerbalancer.manager.PlayerLocker; +import com.jaimemartz.playerbalancer.helper.PlayerLocker; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.plugin.Listener; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/PluginMessageListener.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/PluginMessageListener.java index bbf8aba..c791b20 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/PluginMessageListener.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/PluginMessageListener.java @@ -7,7 +7,7 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonSerializer; import com.jaimemartz.playerbalancer.PlayerBalancer; import com.jaimemartz.playerbalancer.connection.ConnectionIntent; -import com.jaimemartz.playerbalancer.manager.PlayerLocker; +import com.jaimemartz.playerbalancer.helper.PlayerLocker; import com.jaimemartz.playerbalancer.ping.ServerStatus; import com.jaimemartz.playerbalancer.section.ServerSection; import net.md_5.bungee.api.config.ServerInfo; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerConnectListener.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerConnectListener.java index 6162018..e535aa7 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerConnectListener.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerConnectListener.java @@ -3,8 +3,9 @@ package com.jaimemartz.playerbalancer.listeners; import com.jaimemartz.playerbalancer.PlayerBalancer; import com.jaimemartz.playerbalancer.connection.ConnectionIntent; import com.jaimemartz.playerbalancer.connection.ServerAssignRegistry; -import com.jaimemartz.playerbalancer.manager.PlayerLocker; +import com.jaimemartz.playerbalancer.helper.PlayerLocker; import com.jaimemartz.playerbalancer.section.ServerSection; +import com.jaimemartz.playerbalancer.settings.props.features.PermissionRouterProps; import com.jaimemartz.playerbalancer.utils.MessageUtils; import net.md_5.bungee.api.Callback; import net.md_5.bungee.api.config.ServerInfo; @@ -14,11 +15,17 @@ import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventPriority; +import java.util.Optional; + public class ServerConnectListener implements Listener { private final PlayerBalancer plugin; + private final PermissionRouterProps permissionRouterProps; + public ServerConnectListener(PlayerBalancer plugin) { this.plugin = plugin; + + this.permissionRouterProps = plugin.getSettings().getFeaturesProps().getPermissionRouterProps(); } @EventHandler(priority = EventPriority.HIGHEST) @@ -26,6 +33,9 @@ public class ServerConnectListener implements Listener { ProxiedPlayer player = event.getPlayer(); ServerInfo target = event.getTarget(); + if (PlayerLocker.isLocked(player)) + return; + ServerSection section = getSection(player, target); if (section == null) @@ -53,8 +63,14 @@ public class ServerConnectListener implements Listener { ServerSection section = plugin.getSectionManager().getByServer(target); if (section != null) { - if (PlayerLocker.isLocked(player)) { - return null; + if (permissionRouterProps.isEnabled()) { + Optional bindName = permissionRouterProps.getRouteBind(player, section); + if (bindName.isPresent()) { + ServerSection bind = plugin.getSectionManager().getByName(bindName.get()); + if (bind != null) { + return bind; + } + } } //Checks only for servers (not the section server) diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerKickListener.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerKickListener.java index 3e8d678..34aeda7 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerKickListener.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/listeners/ServerKickListener.java @@ -2,7 +2,7 @@ package com.jaimemartz.playerbalancer.listeners; import com.jaimemartz.playerbalancer.PlayerBalancer; import com.jaimemartz.playerbalancer.connection.ConnectionIntent; -import com.jaimemartz.playerbalancer.manager.PlayerLocker; +import com.jaimemartz.playerbalancer.helper.PlayerLocker; import com.jaimemartz.playerbalancer.section.ServerSection; import com.jaimemartz.playerbalancer.settings.props.MessagesProps; import com.jaimemartz.playerbalancer.settings.props.features.KickHandlerProps; @@ -111,8 +111,16 @@ public class ServerKickListener implements Listener { } if (current != null) { - ServerSection target = plugin.getSectionManager().getBind(props.getRules(), current) - .orElse(current.getParent()); + ServerSection target = current.getParent(); + + String bindName = props.getRules().get(current.getName()); + if (bindName != null) { + ServerSection bind = plugin.getSectionManager().getByName(bindName); + if (bind != null) { + target = bind; + } + } + if (target == null) { MessageUtils.send(player, messages.getUnavailableServerMessage()); return null; diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/section/SectionManager.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/section/SectionManager.java index e9e82e7..70c1c7b 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/section/SectionManager.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/section/SectionManager.java @@ -349,12 +349,6 @@ public class SectionManager { return reiterativeSections.contains(section.getName()); } - public Optional getBind(Map rules, ServerSection section) { - String bind = rules.get(section.getName()); - ServerSection res = this.getByName(bind); - return Optional.ofNullable(res); - } - public Map getSections() { return sections; } diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/FeaturesProps.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/FeaturesProps.java index e613497..3a54d93 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/FeaturesProps.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/FeaturesProps.java @@ -31,4 +31,7 @@ public class FeaturesProps { @Setting(value = "custom-server-command") private CustomServerCommandProps customServerCommandProps; + + @Setting(value = "permission-router") + private PermissionRouterProps permissionRouterProps; } diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/features/PermissionRouterProps.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/features/PermissionRouterProps.java new file mode 100644 index 0000000..ea1c51f --- /dev/null +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/features/PermissionRouterProps.java @@ -0,0 +1,34 @@ +package com.jaimemartz.playerbalancer.settings.props.features; + +import com.jaimemartz.playerbalancer.section.ServerSection; +import lombok.Data; +import net.md_5.bungee.api.connection.ProxiedPlayer; +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +import java.util.Map; +import java.util.Optional; + +@ConfigSerializable +@Data +public class PermissionRouterProps { + @Setting + private boolean enabled; + + @Setting + private Map> rules; + + public Optional getRouteBind(ProxiedPlayer player, ServerSection section) { + Map routes = rules.get(section.getName()); + + if (routes != null) { + for (Map.Entry route : routes.entrySet()) { + if (player.hasPermission(route.getKey())) { + return Optional.of(route.getValue()); + } + } + } + + return Optional.empty(); + } +} diff --git a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/shared/SectionProps.java b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/shared/SectionProps.java index abd6bc1..35a0c72 100644 --- a/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/shared/SectionProps.java +++ b/Main Plugin/src/main/java/com/jaimemartz/playerbalancer/settings/props/shared/SectionProps.java @@ -13,6 +13,9 @@ public class SectionProps { @Setting private ProviderType provider; + @Setting + private String alias; + @Setting(value = "parent") private String parentName; diff --git a/Main Plugin/src/main/resources/default.conf b/Main Plugin/src/main/resources/default.conf index a7795aa..1a5c4fd 100644 --- a/Main Plugin/src/main/resources/default.conf +++ b/Main Plugin/src/main/resources/default.conf @@ -28,8 +28,8 @@ general { # Effectively remove (i.e comment) a message to disable it # Supported variables are shown in the default messages messages { - # connecting-server="&aConnecting to a {section} server" # this message is disabled by default! - connected-server="&aConnected to {server}" + # connecting-server="&aConnecting to an {section} ({alias}) server" # this message is disabled by default! + connected-server="&aConnected to {server} (an {alias} server)" invalid-input="&cThis is an invalid input type for this command" misc-failure="&cCould not find a server to get connected to" player-bypass="&cYou have not been moved because you have the playerbalancer.bypass permission" @@ -70,6 +70,7 @@ features { general-lobbies { parent="auth-lobbies" + alias="General Lobbies" servers=[ "Lobby[1-3]" ] @@ -141,8 +142,8 @@ features { # When the description of a server matches these, it will be set as non accessible # Be aware of colors, it is recommended to use the "contains" rule below or some others marker-descs=[ - "(?i).*maintenance*" # match if contains (regex) - "Game in progress", # match if exactly equal + "(?i).*maintenance*", # match if contains (regex) + "Game in progress" # match if exactly equal ] } @@ -237,12 +238,12 @@ features { } custom-list-command { - enabled = false + enabled=false command { - name = glist - permission = "" - aliases = [] + name=glist + permission="" + aliases=[] } formats { @@ -252,16 +253,26 @@ features { } custom-server-command { - enabled = false + enabled=false command { - name = glist - permission = "" - aliases = [] + name=server + permission="" + aliases=[] } formats { # Nothing yet } } + + permission-router { + enabled=false + + routes { + general-lobbies { + special.permission=other-lobby-section, + } + } + } }