Advertisement
Jnk1296

IP-Check | LoginReport.java

May 6th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.66 KB | None | 0 0
  1. package net.risenphoenix.jnk.ipcheck;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.entity.Player;
  6.  
  7. public class LoginReport {
  8.  
  9.     private static final String PLUG_NAME = "[IP-Check] ";
  10.    
  11.     public void execute(String ip, Player player, int accounts) {
  12.         Player[] online = Bukkit.getServer().getOnlinePlayers();
  13.         Player curPlayer = player;
  14.        
  15.         if ((curPlayer.hasPlayedBefore() && (accounts - 1) > Configuration.notifyThreshold) || (!curPlayer.hasPlayedBefore() && accounts > Configuration.notifyThreshold)) {
  16.             if (!Configuration.isExemptPlayer(player.getName()) && !Configuration.isExemptIp(ip)) { // If number of accounts is greater than threshold and player is not exempt
  17.                
  18.                 if (curPlayer.hasPlayedBefore()) {
  19.                     accounts -= 1; // subtract one from playersfound to make up for Recursion
  20.                 }
  21.                
  22.                 for(int i = 0; i < online.length; i++) {
  23.                     if (Configuration.detailNotify) { // If Detailed Notifications are enabled, display the detailed notification.
  24.                         if (online[i].hasPermission("ipcheck.getnotify") || online[i].isOp()) { // If player is an operator or has the ipcheck.getnotify permission
  25.                             online[i].sendMessage(ChatColor.DARK_GRAY + "---------------------------------------");
  26.                             online[i].sendMessage(ChatColor.GOLD + "Background Report for: " + ChatColor.LIGHT_PURPLE + player.getDisplayName());
  27.                             online[i].sendMessage(ChatColor.DARK_GRAY + "---------------------------------------");
  28.                             online[i].sendMessage(ChatColor.GOLD + "IP Address: " + ChatColor.LIGHT_PURPLE + ip);
  29.                             online[i].sendMessage(ChatColor.LIGHT_PURPLE + player.getDisplayName() + ChatColor.RED + " was found to have " + ChatColor.YELLOW + accounts + ChatColor.RED +
  30.                                     " possible alternative accounts. Perform command " + ChatColor.LIGHT_PURPLE + "'/c " + player.getDisplayName() + "'" +
  31.                                     ChatColor.RED + " for more information.");
  32.                             online[i].sendMessage(ChatColor.DARK_GRAY + "---------------------------------------");
  33.                         }
  34.                     } else if (!Configuration.detailNotify) { // If Detailed Notifications are disabled, display the simple notification.
  35.                         if (online[i].hasPermission("ipcheck.getnotify") || online[i].isOp()) { // If player is an operator or has the ipcheck.getnotify permission
  36.                             online[i].sendMessage(ChatColor.DARK_GRAY + "---------------------------------------");
  37.                             online[i].sendMessage(ChatColor.GOLD + PLUG_NAME + ChatColor.RED + "Warning! " + ChatColor.LIGHT_PURPLE + player.getDisplayName() + ChatColor.RED + " may have multiple accounts!");
  38.                             online[i].sendMessage(ChatColor.DARK_GRAY + "---------------------------------------");
  39.                         }
  40.                     }
  41.                 }
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement