Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JOIN:
- @EventHandler
- public void onJoin(PlayerJoinEvent e) {
- final Player p = e.getPlayer();
- Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(this, new Runnable() {
- for(Player po : Bukkit.getOnlinePlayers()) {
- if(po.hasPermission("bookchecker.check")) {
- Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
- @Override
- public void run() {
- String targetName = null;
- UUID targetUUID = null;
- if(e.getPlayer().getName().matches("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}")) {
- targetUUID = UUID.fromString(e.getPlayer().getName());
- } else {
- targetName = e.getPlayer().getName();
- }
- HashMap<String, List<String>> alts = new HashMap();
- if(targetUUID == null) {
- alts = Main.this.getAlts1(e.getPlayer(), targetName);
- } else if (targetName == null) {
- alts = Main.this.getAlts1(e.getPlayer(), targetUUID);
- }
- for (Map.Entry<String, List<String>> entry : alts.entrySet()) {
- po.sendMessage("§cNick'i, z ktorych sie logowal gracz §4[" + e.getPlayer().getName() + "]§c: §4" + ((List)entry.getValue()).toString());
- }
- }
- }, 1L);
- }
- }
- }
- GETALTS1:
- public HashMap<String, List<String>> getAlts1(Player p, String name) {
- UUID uuid = null;
- HashMap<String, List<String>> toReturn = new HashMap();
- String foundName;
- for(String s : Main.this.getConfig().getConfigurationSection("players.").getKeys(false)) {
- foundName = Main.this.getConfig().getString("players." + s + ".name");
- if(foundName.equalsIgnoreCase(name)) {
- uuid = UUID.fromString(s);
- break;
- }
- }
- if (uuid == null) {
- return toReturn;
- }
- List<String> ips = getConfig().getStringList("players." + uuid.toString() + ".ips");
- if ((getConfig().getBoolean("players." + uuid.toString() + ".allowChecks")) && (!p.hasPermission("bookchecker.bypass"))) {
- return toReturn;
- }
- for(String ip : ips) {
- toReturn.put(ip, findNames(ip));
- }
- return toReturn;
- }
- public HashMap<String, List<String>> getAlts1(Player p, UUID uuid) {
- HashMap<String, List<String>> toReturn = new HashMap();
- List<String> ips = getConfig().getStringList("players." + uuid.toString() + ".ips");
- if ((getConfig().getBoolean("players." + uuid.toString() + ".allowChecks")) && (!p.hasPermission("bookchecker.bypass"))) {
- return toReturn;
- }
- for(String ip : ips) {
- toReturn.put(ip, findNames(ip));
- }
- return toReturn;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement