Guest User

Untitled

a guest
Jun 29th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. package fr.SMS.Events;
  2.  
  3.  
  4. import org.bukkit.Bukkit;
  5. import org.bukkit.configuration.file.FileConfiguration;
  6. import org.bukkit.configuration.file.YamlConfiguration;
  7. import org.bukkit.event.EventHandler;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
  10. import org.bukkit.event.server.ServerListPingEvent;
  11. import org.bukkit.plugin.java.JavaPlugin;
  12.  
  13.  
  14. public class ServerListPingEvents implements Listener {
  15.  
  16. private int onlinePlayers;
  17.  
  18.  
  19. private fr.SMS.Main.Main Main;
  20.  
  21. @EventHandler
  22. public void onServerPing(ServerListPingEvent e){
  23. FileConfiguration config = YamlConfiguration.loadConfiguration(((JavaPlugin) Main.getConfig()).getFile());
  24.  
  25.  
  26. int ms = Main.getConfig().getInt("Slots");
  27. String AddSlot = Main.getConfig().getString("AddSlot");
  28. if(AddSlot.equalsIgnoreCase("true") || AddSlot.equalsIgnoreCase("false")){
  29. if(AddSlot.equalsIgnoreCase("true")){
  30. onlinePlayers = Bukkit.getOnlinePlayers().size();
  31. e.setMaxPlayers(++onlinePlayers);
  32. System.out.println("LOGGED !");
  33.  
  34.  
  35.  
  36. }else{
  37. e.setMaxPlayers(ms);
  38.  
  39.  
  40. }
  41. }
  42.  
  43.  
  44.  
  45. }
  46.  
  47. @EventHandler
  48. public void onAsyncPlayerJoinEvent(AsyncPlayerPreLoginEvent e){
  49.  
  50.  
  51. }
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment