Added premium command warning
This commit is contained in:
1 parent
b74faa2fd5
commit
6d1a97fd32
7 files changed
+116
-70
No files matched your search
@@ -6,10 +6,13 @@ import com.github.games647.fastlogin.bungee.listener.PlayerConnectionListener;
|
||||
import com.github.games647.fastlogin.bungee.listener.PluginMessageListener;
|
||||
import com.github.games647.fastlogin.core.FastLoginCore;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@@ -32,6 +35,7 @@ public class FastLoginBungee extends Plugin {
|
||||
private Configuration configuration;
|
||||
|
||||
private final Random random = new Random();
|
||||
private final Set<UUID> pendingConfirms = Sets.newHashSet();
|
||||
|
||||
private final ConcurrentMap<PendingConnection, BungeeLoginSession> session = Maps.newConcurrentMap();
|
||||
|
||||
@@ -101,6 +105,10 @@ public class FastLoginBungee extends Plugin {
|
||||
return session;
|
||||
}
|
||||
|
||||
public Set<UUID> getPendingConfirms() {
|
||||
return pendingConfirms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the auth plugin hook for BungeeCord
|
||||
*
|
||||
|
||||
+1
@@ -94,5 +94,6 @@ public class PlayerConnectionListener implements Listener {
|
||||
public void onDisconnect(PlayerDisconnectEvent disconnectEvent) {
|
||||
ProxiedPlayer player = disconnectEvent.getPlayer();
|
||||
plugin.getSession().remove(player.getPendingConnection());
|
||||
plugin.getPendingConfirms().remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
+9
@@ -8,6 +8,7 @@ import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.connection.Server;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
@@ -48,6 +49,14 @@ public class PluginMessageListener implements Listener {
|
||||
if ("ON".equals(subchannel)) {
|
||||
String playerName = dataInput.readUTF();
|
||||
|
||||
if (playerName.equals(fromPlayer.getName()) && plugin.getConfig().getBoolean("premium-warning")
|
||||
&& !plugin.getPendingConfirms().contains(fromPlayer.getUniqueId())) {
|
||||
fromPlayer.sendMessage(TextComponent.fromLegacyText(plugin.getCore().getMessage("premium-warming")));
|
||||
plugin.getPendingConfirms().add(fromPlayer.getUniqueId());
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getPendingConfirms().remove(fromPlayer.getUniqueId());
|
||||
AsyncToggleMessage task = new AsyncToggleMessage(plugin, fromPlayer, playerName, true);
|
||||
ProxyServer.getInstance().getScheduler().runAsync(plugin, task);
|
||||
} else if ("OFF".equals(subchannel)) {
|
||||
|
||||
Reference in new issue
Block a user