daily pastebin goal
32%
SHARE
TWEET

Untitled

a guest May 16th, 2018 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     //Here you see players quitting
  2.     public void onPlayerQuit(PlayerQuitEvent event)
  3.     {
  4.         if(!(MAGConfig.getPersistence())) {return;}
  5.  
  6.         Player player = event.getPlayer();
  7.         if(MAGSetter.isGod(player))
  8.             MAGSetter.setGod(player);
  9.     }
  10.  
  11.  
  12.  
  13.  
  14.     //Here you see players joining, same idea with the early return
  15.     public void onPlayerJoin(PlayerJoinEvent event)
  16.     {
  17.         Player player = event.getPlayer();
  18.         MAGSetter.addGod(player);
  19.        
  20.         if(!MAGConfig.getPersistence()) {return;}
  21.        
  22.         if(MAGConfig.getPersGod(player))
  23.         {
  24.             MAGSetter.setGod(player);
  25.         }
  26.     }
  27.  
  28.  
  29.  
  30.  
  31.     //Now here is the "MAGSetter.setGod(Player p)" method that gets called if getPersistence() returns false
  32.     public static void setGod(Player player)
  33.     {
  34.         String playerName = player.getName();
  35.         if(godMode.get(playerName) == null)
  36.         {
  37.             godMode.put(playerName, new HashSet<Boolean>());
  38.         }
  39.         HashSet<Boolean> godSet = godMode.get(playerName);
  40.        
  41.         if(godSet.isEmpty())
  42.         {
  43.             if(!MAGArenaChecker.isPlayerInArena(player))
  44.             {
  45.                 godSet.add(true);
  46.                 player.sendMessage(ChatColor.AQUA + "MAG: God mode enabled");
  47.                 if(MAGConfig.getPersistence())
  48.                 {
  49.                     MAGConfig.addPersGod(player);
  50.                 }
  51.             }
  52.             else
  53.             {
  54.                 player.sendMessage(ChatColor.AQUA + "MAG: God mode not allowed in an Arena");
  55.             }
  56.         }
  57.         else if(godSet.contains(true))
  58.         {
  59.             godSet.remove(true);
  60.             godSet.add(false);
  61.             if(!MAGArenaChecker.isPlayerInArena(player))
  62.             {
  63.                 player.sendMessage(ChatColor.AQUA + "MAG: God mode disabled");
  64.                 if(MAGConfig.getPersistence())
  65.                 {
  66.                     MAGConfig.removePersGod(player);
  67.                 }
  68.             }
  69.             else
  70.             {
  71.                 player.sendMessage(ChatColor.AQUA + "MAG: God mode not allowed in an Arena");
  72.             }
  73.         }
  74.         else
  75.         {
  76.             godSet.remove(false);
  77.             godSet.add(true);
  78.             if(!MAGArenaChecker.isPlayerInArena(player))
  79.             {
  80.                 player.sendMessage(ChatColor.AQUA + "MAG: God mode enabled");
  81.                 if(MAGConfig.getPersistence())
  82.                 {
  83.                     MAGConfig.addPersGod(player);
  84.                 }
  85.             }
  86.             else
  87.             {
  88.                 player.sendMessage(ChatColor.AQUA + "MAG: God mode not allowed in an Arena!");
  89.             }
  90.         }
  91.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top