Skip to content

Commit

Permalink
Add shadow ban
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Dec 19, 2020
1 parent f25a352 commit 1f7fbc1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/Xera/Bungee/Queue/Bungee/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public final class Config {
protected static String SERVERISFULLMESSAGE, QUEUEPOSITION, JOININGMAINSERVER,
QUEUEBYPASSPERMISSION, QUEUESERVER, QUEUEPRIORITYPERMISSION, REGEX,
KICKMESSAGE, ADMINPERMISSION, MAINSERVER, AUTHSERVER, SERVERDOWNKICKMESSAGE,
CUSTOMPROTOCOL, QUEUEVETERANPERMISSION, REGEXMESSAGE, PAUSEQUEUEIFMAINDOWNMESSAGE;
CUSTOMPROTOCOL, QUEUEVETERANPERMISSION, REGEXMESSAGE, PAUSEQUEUEIFMAINDOWNMESSAGE,
SHADOWBANPERMISSION, SHADOWBANMESSAGE;

protected static boolean POSITIONMESSAGEHOTBAR, ENABLEKICKMESSAGE, SERVERPINGINFOENABLE,
ENABLEAUTHSERVER, ALWAYSQUEUE, CUSTOMPROTOCOLENABLE, REGISTERTAB, AUTHFIRST, POSITIONMESSAGECHAT,
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/Xera/Bungee/Queue/Bungee/QueueListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,15 @@ private void connectPlayer(LinkedHashMap<UUID, String> queueMap) {
queueMap.remove(entry.getKey());

player.sendMessage(ChatMessageType.CHAT, ChatUtils.parseToComponent(Config.JOININGMAINSERVER.replaceAll("%server%", entry.getValue())));
player.connect(plugin.getProxy().getServerInfo(entry.getValue()));
player.resetTabHeader();

if (player.hasPermission(Config.SHADOWBANPERMISSION)) {
player.sendMessage(ChatMessageType.CHAT, ChatUtils.parseToComponent(Config.SHADOWBANMESSAGE));

queueMap.put(entry.getKey(), entry.getValue());
} else {
player.connect(plugin.getProxy().getServerInfo(entry.getValue()));
}
}

private void putQueueAuthFirst(ProxiedPlayer player, List<String> header, List<String> footer, LinkedHashMap<UUID, String> queueMap) {
Expand Down
9 changes: 7 additions & 2 deletions src/main/resources/bungeeconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CUSTOMPROTOCOL: "SERVERNAME &61.8.x to 1.16.x"
# Set the queue servers name that is in the bungee config.yml
# Note that the main server is always the one you login to first
# The main server server is the one that has a queue to protect it
# make sure you set the default server in bungee config.yml correctly
# Make sure you set the default server in bungee config.yml correctly
QUEUESERVER: "queue"
MAINSERVER: "main"

Expand Down Expand Up @@ -82,14 +82,19 @@ QUEUESERVERSLOTS: 9000
# please note this only guaranteed to not have issues 2000ms and higher
QUEUEMOVEDELAY: 2000

# Always add players to queue to prevent server crashing from too many joins
# Should the queue be always active or only when the main server is full?
# When activated you will always be sent into the queue server and then the main server.
ALWAYSQUEUE: true

# When your shadow banned you will be put in queue, but before joining it "fails" and you start all over again.
SHADOWBANMESSAGE: "&6You have lost connection to the server"

# Permissions
QUEUEBYPASSPERMISSION: "queue.override"
QUEUEPRIORITYPERMISSION: "queue.priority"
QUEUEVETERANPERMISSION: "queue.veteran"
ADMINPERMISSION: "queue.admin"
SHADOWBANPERMISSION: "queue.shadowban"

# Queue server tablist configuration use %position% to show the current position of the player
# and use %wait% to show the estimated wait time of the player (not very accurate yet)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ website: http://www.xera.ca/
permissions:
queue.admin:
description: Lets you bypass the plugin.
default: op
default: op

0 comments on commit 1f7fbc1

Please sign in to comment.