added min onlinetime for enforce
This commit is contained in:
parent
2efb1cb69e
commit
626fbb6692
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -18,6 +18,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -31,6 +32,7 @@ public class BungeeQueue extends Plugin {
|
||||
public static Configuration conf;
|
||||
public static File dataFolder;
|
||||
|
||||
public static HashMap<ProxiedPlayer, Integer> waitingSince = new HashMap<>();
|
||||
public static List<ProxiedPlayer> list = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
|
@ -8,10 +8,7 @@ import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -72,7 +69,12 @@ public class MaxPlayers extends Command {
|
||||
|
||||
List<ProxiedPlayer> players = new ArrayList<>(BungeeQueue.targetServer.getPlayers());
|
||||
Collections.shuffle(players);
|
||||
|
||||
for (int i = 0; i < leftOver; i++) {
|
||||
if(BungeeQueue.waitingSince.get(players.get(i)) <= new Date().getTime()-1800000) {
|
||||
ProxyServer.getInstance().getLogger().warning("Canceling Maxplayer enforce on Player " + players.get(i).getName() + "!");
|
||||
continue;
|
||||
}
|
||||
evaluatedPlayers.add(players.get(i));
|
||||
|
||||
players.get(i).sendMessage(new ComponentBuilder("\n\n>> Achtung >> \n").bold(true).color(ChatColor.RED)
|
||||
|
@ -7,6 +7,9 @@ import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
public class PlayerJoin implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PostLoginEvent e) {
|
||||
@ -16,5 +19,6 @@ public class PlayerJoin implements Listener {
|
||||
.create()
|
||||
);
|
||||
BungeeQueue.list.add(e.getPlayer());
|
||||
BungeeQueue.waitingSince.put(e.getPlayer(), (int) new Date().getTime());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user