Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.SMS.Events;
- import org.bukkit.Bukkit;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
- import org.bukkit.event.server.ServerListPingEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- public class ServerListPingEvents implements Listener {
- private int onlinePlayers;
- private fr.SMS.Main.Main Main;
- @EventHandler
- public void onServerPing(ServerListPingEvent e){
- FileConfiguration config = YamlConfiguration.loadConfiguration(((JavaPlugin) Main.getConfig()).getFile());
- int ms = Main.getConfig().getInt("Slots");
- String AddSlot = Main.getConfig().getString("AddSlot");
- if(AddSlot.equalsIgnoreCase("true") || AddSlot.equalsIgnoreCase("false")){
- if(AddSlot.equalsIgnoreCase("true")){
- onlinePlayers = Bukkit.getOnlinePlayers().size();
- e.setMaxPlayers(++onlinePlayers);
- System.out.println("LOGGED !");
- }else{
- e.setMaxPlayers(ms);
- }
- }
- }
- @EventHandler
- public void onAsyncPlayerJoinEvent(AsyncPlayerPreLoginEvent e){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment