Guest User

main

a guest
Mar 5th, 2020
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 108.43 KB | None | 0 0
  1. import org.bukkit.plugin.java.*;
  2. import net.milkbowl.vault.economy.*;
  3. import ru.meedway.corerpg.menu.location.*;
  4. import org.bukkit.scheduler.*;
  5. import org.bukkit.command.*;
  6. import ru.meedway.corerpg.menu.vilshop.*;
  7. import org.bukkit.potion.*;
  8. import org.bukkit.event.*;
  9. import org.bukkit.plugin.*;
  10. import es.darkhorizon.dev.*;
  11. import mw.TravoQur.caseq.*;
  12. import org.bukkit.scoreboard.*;
  13. import org.bukkit.scoreboard.Scoreboard;
  14.  
  15. import de.Keyle.MyPet.*;
  16. import de.Keyle.MyPet.api.entity.*;
  17. import java.text.*;
  18. import org.bukkit.inventory.*;
  19. import org.bukkit.inventory.ItemStack;
  20.  
  21. import com.mewin.WGRegionEvents.events.*;
  22. import org.bukkit.configuration.file.*;
  23. import ru.meedway.warnrpg.*;
  24. import org.bukkit.craftbukkit.v1_12_R1.entity.*;
  25. import java.lang.reflect.*;
  26. import org.bukkit.craftbukkit.v1_12_R1.inventory.*;
  27. import java.io.*;
  28. import org.bukkit.*;
  29. import org.bukkit.Material;
  30. import org.bukkit.World;
  31. import org.bukkit.inventory.meta.*;
  32. import java.util.*;
  33. import ru.meedway.lvltop.*;
  34. import org.bukkit.util.*;
  35. import org.bukkit.util.Vector;
  36. import org.bukkit.craftbukkit.v1_12_R1.*;
  37. import net.minecraft.server.v1_12_R1.*;
  38. import org.bukkit.craftbukkit.v1_12_R1.util.*;
  39. import org.bukkit.event.entity.*;
  40. import org.bukkit.entity.*;
  41. import org.bukkit.entity.Entity;
  42. import org.bukkit.entity.Item;
  43.  
  44. import mw.donate.lyamour.*;
  45. import org.bukkit.event.player.*;
  46. import org.bukkit.event.block.*;
  47. import org.bukkit.block.*;
  48. import org.bukkit.block.Block;
  49.  
  50. public class Main extends JavaPlugin implements Listener
  51. {
  52.     public ArrayList<String> inportal;
  53.     private final Map<Player, Long> lastSneak;
  54.     HashMap<Integer, String> point;
  55.     HashMap<Integer, String> bos;
  56.     ArrayList<Player> list;
  57.     public static ArrayList<Player> boss1;
  58.     public static ArrayList<Player> boss2;
  59.     public static ArrayList<Player> boss3;
  60.     public static ArrayList<String> inpvp;
  61.     public static ArrayList<Player> arenalab;
  62.     public static ArrayList<Player> arenalog;
  63.     Set<String> antispam;
  64.     boolean b1;
  65.     private static final HashMap<String, Integer> expclan;
  66.     public static String kit;
  67.     public static int count;
  68.     public static int login;
  69.     public static int bosslevels;
  70.     public static int counts;
  71.     private static Main plugin;
  72.     public static Main instance;
  73.     public static Main m;
  74.     public static FileConfiguration c;
  75.     public static Economy economy;
  76.    
  77.     public Main() {
  78.         this.inportal = new ArrayList<String>();
  79.         this.lastSneak = new HashMap<Player, Long>();
  80.         this.point = new HashMap<Integer, String>();
  81.         this.bos = new HashMap<Integer, String>();
  82.         this.list = new ArrayList<Player>();
  83.         this.antispam = new HashSet<String>();
  84.         this.b1 = false;
  85.     }
  86.    
  87.     public static Main getPlugin() {
  88.         return Main.plugin;
  89.     }
  90.    
  91.     public static Main getInstance() {
  92.         return Main.instance;
  93.     }
  94.    
  95.     public void onEnable() {
  96.         Main.plugin = this;
  97.         (Main.m = this).setupEconomy();
  98.         Main.c = this.getConfig();
  99.         Main.c.options().copyDefaults(true);
  100.         Bukkit.getPluginManager().registerEvents((Listener)new ExpDrop(), (Plugin)this);
  101.         Bukkit.getPluginManager().registerEvents((Listener)new ChatEvents(), (Plugin)this);
  102.         Bukkit.getPluginManager().registerEvents((Listener)new KeepInventory(), (Plugin)this);
  103.         Bukkit.getPluginManager().registerEvents((Listener)new ShopMenuClick(), (Plugin)this);
  104.         Bukkit.getPluginManager().registerEvents((Listener)new LocationClick(), (Plugin)this);
  105.         Bukkit.getPluginManager().registerEvents((Listener)new VilClick(), (Plugin)this);
  106.         Bukkit.getPluginManager().registerEvents((Listener)new Inv(), (Plugin)this);
  107.         Bukkit.getPluginManager().registerEvents((Listener)new Utils(), (Plugin)this);
  108.         Bukkit.getPluginManager().registerEvents((Listener)this, (Plugin)this);
  109.         this.saveConfig();
  110.         new BukkitRunnable() {
  111.             public void run() {
  112.                 Main.refresh();
  113.                 Main.refresh2();
  114.                 Main.this.refreshclan();
  115.                 Main.this.removepoint();
  116.                 Main.this.randomEvent();
  117.             }
  118.         }.runTaskLater((Plugin)this, 60L);
  119.     }
  120.    
  121.     public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
  122.         if (cmd.getName().equalsIgnoreCase("levels")) {
  123.             final Player p = (Player)sender;
  124.             if (p.hasPermission("meedway.admin") && args.length > 0) {
  125.                 if (args[0].equalsIgnoreCase("get")) {
  126.                     final String a = args[1];
  127.                     sender.sendMessage("§6:" + Levels.getXP(a));
  128.                 }
  129.                 if (args[0].equalsIgnoreCase("set")) {
  130.                     final String a = args[1];
  131.                     final String b = args[2];
  132.                     final int c = Integer.parseInt(b);
  133.                     Levels.setXP(a, c);
  134.                     this.saveConfig();
  135.                 }
  136.                 if (args[0].equalsIgnoreCase("add")) {
  137.                     final String a = args[1];
  138.                     final String b = args[2];
  139.                     final int c = Integer.parseInt(b);
  140.                     Levels.addXP(a, c);
  141.                     this.saveConfig();
  142.                 }
  143.                 if (args[0].equalsIgnoreCase("npc")) {
  144.                     spawnVillagers();
  145.                 }
  146.                 if (args[0].equalsIgnoreCase("chest")) {
  147.                     this.openChest();
  148.                 }
  149.                 if (args[0].equalsIgnoreCase("s")) {
  150.                     ShopMenu.onSPO(p);
  151.                 }
  152.                 if (args[0].equalsIgnoreCase("p")) {
  153.                     ShopMenu.onPIT(p);
  154.                 }
  155.                 if (args[0].equalsIgnoreCase("chances")) {
  156.                     this.onChances(p);
  157.                 }
  158.                 if (args[0].equalsIgnoreCase("g")) {
  159.                     p.sendMessage("" + p.getFoodLevel());
  160.                 }
  161.                 if (args[0].equalsIgnoreCase("size")) {
  162.                     final int size = this.bos.size();
  163.                     p.sendMessage("" + size);
  164.                 }
  165.                 if (args[0].equalsIgnoreCase("clan")) {
  166.                     SignsUtil.setSign(p, "setName");
  167.                 }
  168.                 if (args[0].equalsIgnoreCase("random")) {
  169.                     this.onRandomEvent(p);
  170.                 }
  171.                 if (args[0].equalsIgnoreCase("addcoins")) {
  172.                     final String a = args[1];
  173.                     final String b = args[2];
  174.                     Integer.parseInt(b);
  175.                 }
  176.                 if (args[0].equalsIgnoreCase("getcoins")) {
  177.                     final String s = args[1];
  178.                 }
  179.                 if (args[0].equalsIgnoreCase("getplayerinfo")) {
  180.                     ShopMenu.onPlayerInfo(p, p);
  181.                 }
  182.                 if (args[0].equalsIgnoreCase("setvil")) {
  183.                     VilItem.onLoadItem();
  184.                 }
  185.                 if (args[0].equalsIgnoreCase("getvil")) {
  186.                     VilMenu.onMenu(p);
  187.                 }
  188.             }
  189.             return true;
  190.         }
  191.         if (cmd.getName().equalsIgnoreCase("kit")) {
  192.             final Player p = (Player)sender;
  193.             if (Cooldown.hasCooldown(p.getName(), "kit")) {
  194.                 final long time = Cooldown.getCooldown(p.getName(), "kit") / 1000L / 60L / 60L;
  195.                 final int timeformat = (int)time;
  196.                 p.sendMessage("§aДля повторного получения, ожидайте " + timeformat + "§a час(ов)");
  197.             }
  198.             else {
  199.                 onKit(p);
  200.                 Cooldown.setCooldown(p.getName(), 86400000L, "kit");
  201.             }
  202.             return false;
  203.         }
  204.         if (cmd.getName().equalsIgnoreCase("shop")) {
  205.             final Player p = (Player)sender;
  206.             p.sendMessage("§7▸ §aВзаимодействуйте с НПС на спавне для открытия меню торговца!");
  207.             return false;
  208.         }
  209.         if (cmd.getName().equalsIgnoreCase("donate")) {
  210.             final Player p = (Player)sender;
  211.             if (p.getWorld().equals(Bukkit.getWorld("world"))) {
  212.                 ShopMenu.onDonate(p);
  213.             }
  214.             else {
  215.                 p.sendMessage("§7▸ §aЭта команда работает только в РПГ мире!");
  216.             }
  217.             return false;
  218.         }
  219.         if (cmd.getName().equalsIgnoreCase("store-money")) {
  220.             if (Bukkit.getConsoleSender() == sender && args.length > 0) {
  221.                 if (args[0].equalsIgnoreCase("get")) {
  222.                     final String s2 = args[1];
  223.                 }
  224.                 if (args[0].equalsIgnoreCase("add")) {
  225.                     final String a2 = args[1];
  226.                     final String b2 = args[2];
  227.                     final int c2 = Integer.parseInt(b2);
  228.                     Main.economy.depositPlayer((OfflinePlayer)Bukkit.getPlayer(a2), (double)c2);
  229.                 }
  230.             }
  231.             return true;
  232.         }
  233.         if (cmd.getName().equalsIgnoreCase("spawn")) {
  234.             final Player p = (Player)sender;
  235.             p.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.5, 118.5, -179.1f, 3.9f));
  236.             p.setGameMode(GameMode.ADVENTURE);
  237.             return false;
  238.         }
  239.         if (cmd.getName().equalsIgnoreCase("help")) {
  240.             final Player p = (Player)sender;
  241.             p.sendMessage("§eПомощь по командам:");
  242.             p.sendMessage("§e/money send Ник 10 - передать монеты");
  243.             p.sendMessage("§e/coins send Ник 10 - передать коины");
  244.             p.sendMessage("§e/spawn - переместится на спавн");
  245.         }
  246.         else if (cmd.getName().equalsIgnoreCase("skyblock")) {
  247.             final Player p = (Player)sender;
  248.             p.teleport(new Location(Bukkit.getWorld("world"), -1317.0, 90.5, 112.0, 178.9f, 88.9f));
  249.         }
  250.         else if (cmd.getName().equalsIgnoreCase("youtube")) {
  251.             final Player p = (Player)sender;
  252.             p.sendMessage("§aСсылка на ютуб канал THIS : §ehttps://www.youtube.com/channel/UCKK20mhGEkWQZ0aiWMa3AYQ");
  253.         }
  254.         else if (cmd.getName().equalsIgnoreCase("vk")) {
  255.             final Player p = (Player)sender;
  256.             p.sendMessage("§aСсылка на вк группу: §ehttp://vk.com/meedway");
  257.         }
  258.         else if (cmd.getName().equalsIgnoreCase("discord")) {
  259.             final Player p = (Player)sender;
  260.             p.sendMessage("§aСсылка на дискорд: §ehttps://discord.gg/jcbsZs2");
  261.         }
  262.         else if (cmd.getName().equalsIgnoreCase("pvp")) {
  263.             final Player p = (Player)sender;
  264.             p.sendTitle("§aВы на пвп врене!", "§bВ данной локации вещи не выпадают!");
  265.             p.sendMessage("§aВы перемещены на локацию с ПВП ареной, на которой отсутсвует выпадение вещей!");
  266.             p.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.5, 118.5, -179.1f, 3.9f));
  267.         }
  268.         else if (cmd.getName().equalsIgnoreCase("this")) {
  269.             final Player p = (Player)sender;
  270.             final boolean bonus = Levels.getBonusYT(p.getName());
  271.             if (!bonus) {
  272.                 Levels.setBonusYT(p.getName());
  273.                 Bukkit.broadcastMessage("§aК нам зашел §e" + p.getName() + "§a новый подписчик канала §6THIS §c(/youtube)");
  274.                 p.sendMessage("§7▸ Бонус подписчику:");
  275.                 p.sendMessage("§a+ §e300 монет!");
  276.                 p.sendMessage("§a+ §bБесплатный набор: Нагрудник, Поножи, Ботинки, Оружие.");
  277.                 Main.economy.depositPlayer(p.getName(), 300.0);
  278.                 addAttr(p, "DAMAGE", "2", "mainhand", ShopItems.SISworld(1, false));
  279.                 addAttr(p, "MAX_HEALTH", "1", "chest", ShopItems.SIChestPlate(1, false));
  280.                 addAttr(p, "MAX_HEALTH", "1", "legs", ShopItems.SIPonoji(1, false));
  281.                 addAttr(p, "MAX_HEALTH", "0", "feet", ShopItems.SIBoots(1, false));
  282.                 Levels.addSub();
  283.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline lastsub 2 &aПоследний подписчик: &6" + p.getName());
  284.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline lastsub 3 &aВсего зашло: &6" + Levels.getSub() + " &aподписчиков");
  285.             }
  286.             else {
  287.                 p.sendMessage("§7▸ §cБонусный набор уже выдан!");
  288.             }
  289.             return false;
  290.         }
  291.         if (cmd.getName().equalsIgnoreCase("bilet")) {
  292.             if (Bukkit.getConsoleSender() == sender && args.length > 0) {
  293.                 if (args[0].equalsIgnoreCase("get")) {
  294.                     final String s3 = args[1];
  295.                 }
  296.                 if (args[0].equalsIgnoreCase("on")) {
  297.                     final String a2 = args[1];
  298.                     final String b2 = args[2];
  299.                     final int c2 = Integer.parseInt(b2);
  300.                     this.onBulet(a2, c2);
  301.                 }
  302.             }
  303.             return true;
  304.         }
  305.         if (cmd.getName().equalsIgnoreCase("admincase")) {
  306.             if (Bukkit.getConsoleSender() == sender && args[0].equalsIgnoreCase("addcoins")) {
  307.                 final String a2 = args[1];
  308.                 final String b2 = args[2];
  309.                 Integer.parseInt(b2);
  310.             }
  311.             return true;
  312.         }
  313.         if (cmd.getName().equalsIgnoreCase("adminreload")) {
  314.             if (Bukkit.getConsoleSender() == sender) {
  315.                 Utils.onTimerReload("§cВнимание ПЕРЕЗАГРУЗКА", "§cЧерез 60 секунд сервер отключится", 0, false);
  316.                 Utils.onTimerReload("§cВнимание ПЕРЕЗАГРУЗКА", "§cЧерез 30 секунд сервер отключится", 30, false);
  317.                 Utils.onTimerReload("§cВнимание ПЕРЕЗАГРУЗКА", "§cЧерез 5 секунд сервер отключится", 55, false);
  318.             }
  319.             return true;
  320.         }
  321.         if (cmd.getName().equalsIgnoreCase("tainik")) {
  322.             if (Bukkit.getConsoleSender() == sender && args.length > 0 && args[0].equalsIgnoreCase("give")) {
  323.                 final String a2 = args[1];
  324.                 final Player p2 = Bukkit.getPlayer(a2);
  325.                 this.onChances(p2);
  326.             }
  327.             return true;
  328.         }
  329.         if (cmd.getName().equalsIgnoreCase("tutorial")) {
  330.             if (Bukkit.getConsoleSender() == sender && args.length > 0 && args[0].equalsIgnoreCase("on")) {
  331.                 final String a2 = args[1];
  332.                 final Player p2 = Bukkit.getPlayer(a2);
  333.                 p2.teleport(new Location(Bukkit.getWorld("world"), 852.5, 54.0, 97.5, -98.9f, 9.6f));
  334.                 p2.sendTitle("§aОбучение начато!", "§eСледуйте указаниям...");
  335.             }
  336.             return true;
  337.         }
  338.         if (cmd.getName().equalsIgnoreCase("sys-tutorial")) {
  339.             if (Bukkit.getConsoleSender() == sender && args.length > 0 && args[0].equalsIgnoreCase("on")) {
  340.                 final String a2 = args[1];
  341.                 final Player p2 = Bukkit.getPlayer(a2);
  342.                 ShopMenu.onTutorial(p2);
  343.             }
  344.             return true;
  345.         }
  346.         return false;
  347.     }
  348.    
  349.     public static void onTutorials(final Player p) {
  350.         p.teleport(new Location(Bukkit.getWorld("world"), 852.5, 54.0, 97.5, -98.9f, 9.6f));
  351.         p.sendTitle("§aОбучение начато!", "§eСледуйте указаниям...");
  352.     }
  353.    
  354.     public void onBulet(final String player, final int c) {
  355.         final Player p = Bukkit.getPlayer(player);
  356.         p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 10, 5));
  357.         p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 10, 5));
  358.         p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 10, 10, true, false));
  359.         p.sendTitle("§aБилет принят!", "§сПристегните ремни, отправляемся!");
  360.         p.teleport(new Location(Bukkit.getWorld("world"), 48.5, 86.0, 103.5, 180.0f, -2.6f));
  361.         final Player player2 = null;
  362.         Bukkit.getScheduler().runTaskLater((Plugin)Main.m, () -> {
  363.             if (c == 1) {
  364.                 player2.sendTitle("§aВнимание, высадка!", "§eПункт назначения: §cСпавн");
  365.                 player2.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.5, 118.5, -179.1f, 3.9f));
  366.             }
  367.             if (c == 2) {
  368.                 player2.sendTitle("§aВнимание, высадка!", "§eПункт назначения: §cСмертельный лабиринт");
  369.                 this.onBrand2(player2);
  370.             }
  371.             if (c == 3) {
  372.                 player2.sendTitle("§aВнимание, высадка!", "§eПункт назначения: §cМистический лабиринт");
  373.                 this.onBrand1(player2);
  374.             }
  375.         }, 60L);
  376.     }
  377.    
  378.     public void onBrand1(final Player p) {
  379.         final Random r = new Random();
  380.         final int rt = r.nextInt(8) + 1;
  381.         if (rt == 1) {
  382.             p.teleport(new Location(Bukkit.getWorld("world"), -900.5, 61.5, 128.5, 1.2f, 6.0f));
  383.         }
  384.         if (rt == 2) {
  385.             p.teleport(new Location(Bukkit.getWorld("world"), -898.5, 61.5, 118.5, -87.3f, 2.7f));
  386.         }
  387.         if (rt == 3) {
  388.             p.teleport(new Location(Bukkit.getWorld("world"), -898.5, 61.5, 116.5, -177.3f, 0.8f));
  389.         }
  390.         if (rt == 4) {
  391.             p.teleport(new Location(Bukkit.getWorld("world"), -906.5, 61.5, 118.5, -179.7f, 1.6f));
  392.         }
  393.         if (rt == 5) {
  394.             p.teleport(new Location(Bukkit.getWorld("world"), -960.5, 61.5, 34.5, 91.0f, 1.9f));
  395.         }
  396.         if (rt == 6) {
  397.             p.teleport(new Location(Bukkit.getWorld("world"), -956.5, 61.5, 42.5, 0.9f, 2.0f));
  398.         }
  399.         if (rt == 7) {
  400.             p.teleport(new Location(Bukkit.getWorld("world"), -948.5, 61.5, 42.5, -91.8f, 2.3f));
  401.         }
  402.         if (rt == 8) {
  403.             p.teleport(new Location(Bukkit.getWorld("world"), -972.5, 61.5, 58.5, 89.4f, 1.5f));
  404.         }
  405.     }
  406.    
  407.     public void onBrand2(final Player p) {
  408.         final Random r = new Random();
  409.         final int rt = r.nextInt(8) + 1;
  410.         if (rt == 1) {
  411.             p.teleport(new Location(Bukkit.getWorld("world"), -900.5, 81.5, 128.5, 1.2f, 6.0f));
  412.         }
  413.         if (rt == 2) {
  414.             p.teleport(new Location(Bukkit.getWorld("world"), -898.5, 81.5, 118.5, -87.3f, 2.7f));
  415.         }
  416.         if (rt == 3) {
  417.             p.teleport(new Location(Bukkit.getWorld("world"), -898.5, 81.5, 116.5, -177.3f, 0.8f));
  418.         }
  419.         if (rt == 4) {
  420.             p.teleport(new Location(Bukkit.getWorld("world"), -906.5, 81.5, 118.5, -179.7f, 1.6f));
  421.         }
  422.         if (rt == 5) {
  423.             p.teleport(new Location(Bukkit.getWorld("world"), -960.5, 81.5, 34.5, 91.0f, 1.9f));
  424.         }
  425.         if (rt == 6) {
  426.             p.teleport(new Location(Bukkit.getWorld("world"), -956.5, 81.5, 42.5, 0.9f, 2.0f));
  427.         }
  428.         if (rt == 7) {
  429.             p.teleport(new Location(Bukkit.getWorld("world"), -948.5, 81.5, 42.5, -91.8f, 2.3f));
  430.         }
  431.         if (rt == 8) {
  432.             p.teleport(new Location(Bukkit.getWorld("world"), -972.5, 81.5, 58.5, 89.4f, 1.5f));
  433.         }
  434.     }
  435.    
  436.     @EventHandler(priority = EventPriority.HIGHEST)
  437.     public void AsyncPlayerChatEvent(final AsyncPlayerChatEvent event) {
  438.         if (!event.getMessage().toLowerCase().contains("!level!")) {
  439.             event.setFormat(event.getFormat().replace("!level!", "§8[§b" + Levels.getXP(event.getPlayer().getName()) + "§8]"));
  440.         }
  441.     }
  442.    
  443.     public static void onKit(final Player p) {
  444.         final Random r = new Random();
  445.         final int rt = r.nextInt(12) + 1;
  446.         if (rt == 1) {
  447.             ot(p, true, 100, 0);
  448.         }
  449.         if (rt == 2) {
  450.             ot(p, true, 200, 0);
  451.         }
  452.         if (rt == 3) {
  453.             ot(p, true, 300, 0);
  454.         }
  455.         if (rt == 4) {
  456.             ot(p, true, 400, 0);
  457.         }
  458.         if (rt == 5) {
  459.             ot(p, true, 500, 0);
  460.         }
  461.         if (rt == 6) {
  462.             ot(p, true, 600, 0);
  463.         }
  464.         if (rt == 7) {
  465.             ot(p, true, 700, 0);
  466.         }
  467.         if (rt == 8) {
  468.             ot(p, true, 800, 0);
  469.         }
  470.         if (rt == 9) {
  471.             ot(p, true, 900, 0);
  472.         }
  473.         if (rt == 10) {
  474.             ot(p, true, 1000, 0);
  475.         }
  476.         if (rt == 11) {
  477.             ot(p, true, 1100, 0);
  478.         }
  479.         if (rt == 12) {
  480.             ot(p, true, 1200, 0);
  481.         }
  482.         if (rt == 13) {
  483.             ot(p, false, 0, 3);
  484.         }
  485.     }
  486.    
  487.     public static void ot(final Player p, final boolean c, final int money, final int coins) {
  488.         if (c) {
  489.             p.sendTitle("§aПоздравляю", "§eВы получили:§c " + money + " монет");
  490.             Bukkit.broadcastMessage("§a[Награда дня] §e" + p.getName() + " получил ежедневную награду §c" + money + " монет!§e");
  491.             Main.economy.depositPlayer(p.getName(), (double)money);
  492.         }
  493.         else {
  494.             p.sendTitle("§aПоздравляю", "§eВы получили:§c " + coins + " коина");
  495.             Bukkit.broadcastMessage("§a[Награда дня] §e" + p.getName() + " получил ежедневную награду §c" + coins + " коинов§e!");
  496.             Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "geco give " + p.getName() + " coins 3");
  497.         }
  498.     }
  499.    
  500.     private boolean setupEconomy() {
  501.         final RegisteredServiceProvider economyProvider = this.getServer().getServicesManager().getRegistration((Class)Economy.class);
  502.         if (economyProvider != null) {
  503.             Main.economy = (Economy)economyProvider.getProvider();
  504.         }
  505.         return Main.economy != null;
  506.     }
  507.    
  508.     public static void createBoard(final Player player) {
  509.         final Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
  510.         final Objective objective = scoreboard.registerNewObjective("stats", "dummy");
  511.         setScore(objective, player);
  512.         setPrefix(scoreboard);
  513.         player.setScoreboard(scoreboard);
  514.     }
  515.    
  516.     public static void refresh() {
  517.         new BukkitRunnable() {
  518.             public void run() {
  519.                 for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
  520.                     final Scoreboard scoreboard = player.getScoreboard();
  521.                     if (scoreboard == null) {
  522.                         Main.createBoard(player);
  523.                     }
  524.                     else {
  525.                         scoreboard.getObjective("stats").unregister();
  526.                         final Objective objective = scoreboard.registerNewObjective("stats", "dummy");
  527.                         Main.setScore(objective, player);
  528.                         player.setScoreboard(scoreboard);
  529.                     }
  530.                 }
  531.             }
  532.         }.runTaskTimerAsynchronously((Plugin)Main.m, 0L, 80L);
  533.     }
  534.    
  535.     public static void refresh2() {
  536.         new BukkitRunnable() {
  537.             public void run() {
  538.                 Main.updatePrefix();
  539.                 Main.onEffectArhont();
  540.             }
  541.         }.runTaskTimerAsynchronously((Plugin)Main.m, 0L, 81L);
  542.     }
  543.    
  544.     public static void onEffectArhont() {
  545.         for (final Player p : Bukkit.getOnlinePlayers()) {
  546.             if (Levels.getArhont(p.getName())) {
  547.                 p.getLocation().getWorld().playEffect(p.getLocation().add(0.0, 2.0, 0.0), Effect.HAPPY_VILLAGER, 1);
  548.             }
  549.         }
  550.     }
  551.    
  552.     public static void setPrefix(final Scoreboard scoreboard) {
  553.         for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
  554.             final String string = "#" + player.getName();
  555.             String preo;
  556.             if (string.length() > 16) {
  557.                 preo = string.substring(0, 16);
  558.             }
  559.             else {
  560.                 preo = string;
  561.             }
  562.             String prefix;
  563.             String suffix;
  564.             if (player.getName().equalsIgnoreCase("TravoQur")) {
  565.                 prefix = "§fY§cT§e| §c";
  566.                 suffix = " §e" + main.clanGetTag(player) + " §4" + main.ClanName(player).replaceAll("&", "§");
  567.             }
  568.             else if (player.toString().equalsIgnoreCase(main.ClanOwner(player))) {
  569.                 prefix = "§c" + Levels.getLevel(player.getName()) + "ур §e| §6";
  570.                 suffix = " §6" + main.clanGetTag(player) + " " + main.ClanName(player).replaceAll("&", "§");
  571.             }
  572.             else {
  573.                 prefix = "§c" + Levels.getLevel(player.getName()) + "ур §e| §c";
  574.                 suffix = " §e" + main.clanGetTag(player) + " " + main.ClanName(player).replaceAll("&", "§");
  575.             }
  576.             Team team = scoreboard.getTeam(preo);
  577.             if (team == null) {
  578.                 team = scoreboard.registerNewTeam(preo);
  579.                 team.addPlayer((OfflinePlayer)player);
  580.                 team.setPrefix(prefix);
  581.                 team.setSuffix(suffix);
  582.             }
  583.             else {
  584.                 team.addEntry(player.getName());
  585.             }
  586.         }
  587.     }
  588.    
  589.     public static void updatePrefix() {
  590.         for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
  591.             for (final Team team : player.getScoreboard().getTeams()) {
  592.                 team.unregister();
  593.             }
  594.         }
  595.         for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
  596.             setPrefix(player.getScoreboard());
  597.         }
  598.     }
  599.    
  600.     public static void setScore(final Objective objective, final Player player) {
  601.         final int level = Levels.getLevel(player.getName());
  602.         final int getl = Levels.getl[level];
  603.         final int getEXP = Levels.getXP(player.getName());
  604.         final int getc = main.getclvl[level];
  605.         final int coins = getBal(player);
  606.         final int key = ConfigBox.getKey(player);
  607.         final String nuznoexp = formatValue((float)getl);
  608.         final String estexp = formatValue((float)getEXP);
  609.         final String cx = formatValue((float)main.ClanEXP(player));
  610.         final String cn = formatValue((float)getc);
  611.         objective.setDisplaySlot(DisplaySlot.SIDEBAR);
  612.         objective.setDisplayName("§e§lMeedWay.RU");
  613.         objective.getScore(" ").setScore(13);
  614.         objective.getScore("§fУровень: §a" + scorelevel(player)).setScore(12);
  615.         objective.getScore("§fОпыт: §e" + estexp + "§7/§e" + nuznoexp).setScore(11);
  616.         objective.getScore("  ").setScore(10);
  617.         objective.getScore("§fКлан: §e" + main.ClanName(player).replaceAll("&", "§")).setScore(9);
  618.         objective.getScore("§fОпыт клана: §b" + cx + "§7/§b" + cn).setScore(8);
  619.         objective.getScore("   ").setScore(7);
  620.         objective.getScore("§fКоины: §6" + coins).setScore(6);
  621.         objective.getScore("§fМонеты: §a" + Main.economy.getBalance((OfflinePlayer)player)).setScore(5);
  622.         objective.getScore("§fКлючи: §b" + key).setScore(4);
  623.         objective.getScore("    ").setScore(3);
  624.         objective.getScore(pet(player)).setScore(2);
  625.         objective.getScore("     ").setScore(1);
  626.         objective.getScore("§6vk.com/meedway").setScore(0);
  627.     }
  628.    
  629.     public static String scorelevel(final Player p) {
  630.         final int level = Levels.getLevel(p.getName());
  631.         if (level == 27) {
  632.             return level + "§c (MAX)";
  633.         }
  634.         return level + "";
  635.     }
  636.    
  637.     public static String pet(final Player p) {
  638.         if (MyPetApi.getPlugin().getPlayerManager().getMyPetPlayer(p) == null) {
  639.             return "§7Питомец: §cне приручен";
  640.         }
  641.         final MyPet pit = MyPetApi.getPlugin().getPlayerManager().getMyPetPlayer(p).getMyPet();
  642.         if (pit != null) {
  643.             final int exp = (int)pit.getExperience().getExp();
  644.             return "§fПитомец: §e" + pit.getExperience().getLevel() + "ур §a(" + exp + "/" + pit.getExperience().getExpByLevel(pit.getExperience().getLevel() + 1) + ")";
  645.         }
  646.         return "§7Питомец: §cне приручен";
  647.     }
  648.    
  649.     public static String formatValue(float value) {
  650.         final String[] arr = { "", "k", "M", "T", "B", "C", "E" };
  651.         int index;
  652.         for (index = 0; value / 1000.0f >= 1.0f; value /= 1000.0f, ++index) {}
  653.         final DecimalFormat decimalFormat = new DecimalFormat("#.##");
  654.         return String.format("%s%s", decimalFormat.format(value), arr[index]);
  655.     }
  656.    
  657.     public int RandInt() {
  658.         final int i = 0;
  659.         final Random r = new Random();
  660.         final int rt = r.nextInt(3) + 1;
  661.         if (rt == 1) {
  662.             return 1;
  663.         }
  664.         if (rt == 2) {
  665.             return 2;
  666.         }
  667.         if (rt == 3) {
  668.             return 3;
  669.         }
  670.         return 1;
  671.     }
  672.    
  673.     @EventHandler(priority = EventPriority.NORMAL)
  674.     public void onNeedPoint(final RegionEnterEvent e) {
  675.         final Player p = e.getPlayer();
  676.         final int bossgame = Main.boss1.size();
  677.         if (e.getRegion().getId().equals("bos")) {
  678.             if (bossgame == 0) {
  679.                 this.inportal.add(p.getName());
  680.                 final int sizep = this.inportal.size();
  681.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline bos 3 &eИгроков: " + sizep + "/3");
  682.                 if (sizep >= 3) {
  683.                     final int l = this.RandInt();
  684.                 }
  685.             }
  686.             else {
  687.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline bos 3 &cИдет сражение с монстром!");
  688.             }
  689.         }
  690.         if (e.getRegion().getId().equals("pvp")) {
  691.             Main.inpvp.add(p.getName());
  692.         }
  693.         if (e.getRegion().getId().equals("boss1")) {
  694.             Main.boss1.add(p);
  695.             Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm mobs spawn BossGET1 1 world,-122,68,95");
  696.         }
  697.         if (e.getRegion().getId().equals("boss2")) {
  698.             Main.boss1.add(p);
  699.             for (int i = 1; i <= 2; ++i) {
  700.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm mobs spawn BossGET2 1 world,-71,76,-137");
  701.             }
  702.         }
  703.         if (e.getRegion().getId().equals("boss3")) {
  704.             Main.boss1.add(p);
  705.             Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm mobs spawn BossGET3 1 world,159,63,22");
  706.         }
  707.         if (e.getRegion().getId().equals("tutorpoint")) {
  708.             p.teleport(new Location(Bukkit.getWorld("world"), 852.5, 52.0, 142.5, 91.2f, 3.0f));
  709.             addAttr(p, "DAMAGE", "10", "mainhand", ShopItems.SISworld(6, false));
  710.             p.getInventory().addItem(new ItemStack[] { ShopItems.SIBOOK(1, false) });
  711.         }
  712.         if (e.getRegion().getId().equals("tutorend")) {
  713.             p.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.5, 118.5, -179.1f, 3.9f));
  714.             p.sendTitle("§aОбучение пройдено!", "§eОстальное найдете в: §c/help");
  715.         }
  716.         if (e.getRegion().getId().equals("arenalab")) {
  717.             final int a = Main.arenalab.size();
  718.             if (a == 0) {
  719.                 Main.arenalab.add(p);
  720.                 for (int is = 1; is <= 2; ++is) {
  721.                     Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm mobs spawn BossLab 1 world,140,50,1640");
  722.                 }
  723.             }
  724.         }
  725.         if (e.getRegion().getId().equals("arenalog")) {
  726.             final int a = Main.arenalog.size();
  727.             if (a == 0) {
  728.                 Main.arenalog.add(p);
  729.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm mobs spawn BossLog 1 world,-931,94,82");
  730.             }
  731.         }
  732.         if (!main.ClanName(p).equals("")) {
  733.             if (e.getRegion().getId().equals("1")) {
  734.                 if (this.point.get(0) != main.ClanName(p)) {
  735.                     Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 1 2 &cЗахвачена кланом: §e" + main.ClanName(p) + "");
  736.                     Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "ad say 276 global &b&lЗимний замок &bзахвачен кланом: §e" + main.ClanName(p) + "");
  737.                     this.point.replace(0, main.ClanName(p));
  738.                 }
  739.             }
  740.             else if (e.getRegion().getId().equals("2")) {
  741.                 if (this.point.get(1) != main.ClanName(p)) {
  742.                     Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 2 2 &cЗахвачена кланом: §e" + main.ClanName(p) + "");
  743.                     Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "ad say 276 global &a&lКоварное поселение &aзахвачено кланом: §e" + main.ClanName(p) + "");
  744.                     this.point.replace(1, main.ClanName(p));
  745.                 }
  746.             }
  747.             else if (e.getRegion().getId().equals("3")) {
  748.                 if (this.point.get(2) != main.ClanName(p)) {
  749.                     Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 3 2 &cЗахвачена кланом: §e" + main.ClanName(p) + "");
  750.                     Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "ad say 276 global &4&lПиратский корабль &4захвачен кланом: §e" + main.ClanName(p) + "");
  751.                     this.point.replace(2, main.ClanName(p));
  752.                 }
  753.             }
  754.             else if (e.getRegion().getId().equals("4") && this.point.get(3) != main.ClanName(p)) {
  755.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 4 2 &cЗахвачена кланом: §e" + main.ClanName(p) + "");
  756.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "ad say 276 global &e&lМирное поселение &aзахвачено кланом: §e" + main.ClanName(p) + "");
  757.                 this.point.replace(3, main.ClanName(p));
  758.             }
  759.         }
  760.     }
  761.    
  762.     @EventHandler(priority = EventPriority.NORMAL)
  763.     public void noNeedPoint(final RegionLeaveEvent e) {
  764.         final Player p = e.getPlayer();
  765.         if (e.getRegion().getId().equals("bos")) {
  766.             Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
  767.                 @Override
  768.                 public void run() {
  769.                     Main.this.inportal.remove(p.getName());
  770.                     final int i = Main.this.inportal.size();
  771.                     Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline bos 3 &eИгроков: " + i + "/3");
  772.                 }
  773.             }, 5L);
  774.         }
  775.         if (e.getRegion().getId().equals("boss1")) {
  776.             Main.boss1.remove(p);
  777.         }
  778.         if (e.getRegion().getId().equals("boss2")) {
  779.             Main.boss1.remove(p);
  780.         }
  781.         if (e.getRegion().getId().equals("boss3")) {
  782.             Main.boss1.remove(p);
  783.         }
  784.         if (e.getRegion().getId().equals("pvp")) {
  785.             Main.inpvp.remove(p.getName());
  786.         }
  787.         if (e.getRegion().getId().equals("arenalab")) {
  788.             Main.arenalab.remove(p);
  789.         }
  790.         if (e.getRegion().getId().equals("arenalog")) {
  791.             Main.arenalog.remove(p);
  792.         }
  793.     }
  794.    
  795.     public void removepoint() {
  796.         new BukkitRunnable() {
  797.             public void run() {
  798.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 1 2 &cГотова к захвату!");
  799.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 2 2 &cГотова к захвату!");
  800.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 3 2 &cГотова к захвату!");
  801.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 4 2 &cГотова к захвату!");
  802.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline bos 3 &eИгроков: 0/3");
  803.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline booster 1 &r");
  804.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline booster 2 &r");
  805.                 Main.spawnVillagers();
  806.                 Levels.setBoosterNO();
  807.                 Main.this.point.put(0, null);
  808.                 Main.this.point.put(1, null);
  809.                 Main.this.point.put(2, null);
  810.                 Main.this.point.put(3, null);
  811.             }
  812.         }.runTaskLater((Plugin)this, 300L);
  813.     }
  814.    
  815.     public void refreshclan() {
  816.         new BukkitRunnable() {
  817.             public void run() {
  818.                 if (Main.this.point.get(0) != null) {
  819.                     final String clan = Main.this.point.get(0).toString();
  820.                     for (final Player p : Bukkit.getOnlinePlayers()) {
  821.                         if (main.ClanName(p).equals(clan)) {
  822.                             final int cl = main.ClanLVLint(p);
  823.                             p.sendMessage("§7▸ За удержание §bЗимнего замка §7начисленно: §b+1 опыт клана §7и §e" + (cl + 1) + " монет(ы)");
  824.                             Main.economy.depositPlayer(p.getName(), (double)(cl + 1));
  825.                         }
  826.                     }
  827.                     main.ClanSetEXP(clan);
  828.                 }
  829.                 if (Main.this.point.get(1) != null) {
  830.                     final String clan = Main.this.point.get(1).toString();
  831.                     for (final Player p : Bukkit.getOnlinePlayers()) {
  832.                         if (main.ClanName(p).equals(clan)) {
  833.                             final int cl = main.ClanLVLint(p);
  834.                             p.sendMessage("§7▸ За удержание §aКоварного поселения §7начисленно: §b+1 опыт клана §7и §e" + (cl + 1) + " монет(ы)");
  835.                             Main.economy.depositPlayer(p.getName(), (double)(cl + 1));
  836.                         }
  837.                     }
  838.                     main.ClanSetEXP(clan);
  839.                 }
  840.                 if (Main.this.point.get(2) != null) {
  841.                     final String clan = Main.this.point.get(2).toString();
  842.                     for (final Player p : Bukkit.getOnlinePlayers()) {
  843.                         if (main.ClanName(p).equals(clan)) {
  844.                             final int cl = main.ClanLVLint(p);
  845.                             p.sendMessage("§7▸ За удержание §cПиратского корабля §7начисленно: §b+1 опыт клана §7и §e" + (cl + 1) + " монет(ы)");
  846.                             Main.economy.depositPlayer(p.getName(), (double)(cl + 1));
  847.                         }
  848.                     }
  849.                     main.ClanSetEXP(clan);
  850.                 }
  851.                 if (Main.this.point.get(3) != null) {
  852.                     final String clan = Main.this.point.get(3).toString();
  853.                     for (final Player p : Bukkit.getOnlinePlayers()) {
  854.                         if (main.ClanName(p).equals(clan)) {
  855.                             final int cl = main.ClanLVLint(p);
  856.                             p.sendMessage("§7▸ За удержание §eМирной деревни §7начисленно: §b+1 опыт клана §7и §e" + (cl + 1) + " монет(ы)");
  857.                             Main.economy.depositPlayer(p.getName(), (double)(cl + 3));
  858.                         }
  859.                     }
  860.                     main.ClanSetEXP(clan);
  861.                 }
  862.             }
  863.         }.runTaskTimerAsynchronously((Plugin)Main.m, 0L, 2400L);
  864.     }
  865.    
  866.     public static void spawnVillagers() {
  867.         Location loc = new Location(Bukkit.getWorld("world"), 94.5, 87.0, 101.5, 1.0f, 0.0f);
  868.         final Evoker king = (Evoker)loc.getWorld().spawnEntity(loc, EntityType.EVOKER);
  869.         king.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
  870.         king.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
  871.         king.setCustomNameVisible(true);
  872.         king.setCustomName("§eНачать игру");
  873.         king.setCollidable(false);
  874.         king.setAI(false);
  875.         king.resetMaxHealth();
  876.         Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "gamerule sendCommandFeedback false");
  877.         loc = new Location(Bukkit.getWorld("world"), 91.5, 87.0, 101.5, 1.0f, 0.0f);
  878.         Villager king2 = (Villager)loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
  879.         king2.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
  880.         king2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
  881.         king2.setCustomNameVisible(true);
  882.         king2.setCustomName("§bСпособности");
  883.         king2.setCollidable(false);
  884.         king2.setAI(false);
  885.         king2.resetMaxHealth();
  886.         loc = new Location(Bukkit.getWorld("world"), 99.5, 87.0, 97.5, 1.0f, 0.0f);
  887.         king2 = (Villager)loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
  888.         king2.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
  889.         king2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
  890.         king2.setCustomNameVisible(true);
  891.         king2.setCustomName("§bКланы/Деревни");
  892.         king2.setCollidable(false);
  893.         king2.setAI(false);
  894.         king2.resetMaxHealth();
  895.         loc = new Location(Bukkit.getWorld("world"), 107.5, 87.0, 107.5, 90.0f, 0.0f);
  896.         king2 = (Villager)loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
  897.         king2.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
  898.         king2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
  899.         king2.setCustomNameVisible(true);
  900.         king2.setCustomName("§eТорговец");
  901.         king2.setCollidable(false);
  902.         king2.setAI(false);
  903.         king2.resetMaxHealth();
  904.         loc = new Location(Bukkit.getWorld("world"), 899.5, 55.0, 112.5, 94.1f, 8.0f);
  905.         king2 = (Villager)loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
  906.         king2.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
  907.         king2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
  908.         king2.setCustomNameVisible(true);
  909.         king2.setCustomName("§eТорговец");
  910.         king2.setCollidable(false);
  911.         king2.setAI(false);
  912.         king2.resetMaxHealth();
  913.         loc = new Location(Bukkit.getWorld("world"), 107.5, 87.0, 97.5, 49.2f, -2.0f);
  914.         king2 = (Villager)loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
  915.         king2.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
  916.         king2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
  917.         king2.setCustomNameVisible(true);
  918.         king2.setCustomName("§eКвестер");
  919.         king2.setCollidable(false);
  920.         king2.setAI(false);
  921.         king2.resetMaxHealth();
  922.         Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "gamerule sendCommandFeedback false");
  923.         Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "gamerule announceadvancements false");
  924.         Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "gamerule doWeatherCycle false");
  925.         loc = new Location(Bukkit.getWorld("world"), 107.5, 87.0, 99.5, 49.2f, -2.0f);
  926.         final Sheep king3 = (Sheep)loc.getWorld().spawnEntity(loc, EntityType.SHEEP);
  927.         king3.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
  928.         king3.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
  929.         king3.setCustomNameVisible(true);
  930.         king3.setCustomName("§eНаграда дня");
  931.         king3.setCollidable(false);
  932.         king3.setAI(false);
  933.         king3.resetMaxHealth();
  934.         loc = new Location(Bukkit.getWorld("world"), 65.5, 87.0, 102.5, -83.7f, -5.4f);
  935.         final Pig king4 = (Pig)loc.getWorld().spawnEntity(loc, EntityType.PIG);
  936.         king4.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
  937.         king4.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
  938.         king4.setCustomNameVisible(true);
  939.         king4.setCustomName("§bБилетер");
  940.         king4.setCollidable(false);
  941.         king4.setAI(false);
  942.         king4.resetMaxHealth();
  943.         loc = new Location(Bukkit.getWorld("world"), 82.5, 88.5, 112.5, 179.7f, 8.0f);
  944.         final Wolf king5 = (Wolf)loc.getWorld().spawnEntity(loc, EntityType.WOLF);
  945.         king5.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
  946.         king5.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
  947.         king5.setCustomNameVisible(true);
  948.         king5.setCustomName("§cБоевые питомцы");
  949.         king5.setCollidable(false);
  950.         king5.setAI(false);
  951.         king5.resetMaxHealth();
  952.     }
  953.    
  954.     @EventHandler
  955.     public void onPlayerInteractEntity(final PlayerInteractEntityEvent e) {
  956.         if (!(e.getRightClicked() instanceof Evoker) && !(e.getRightClicked() instanceof Villager) && !(e.getRightClicked() instanceof Sheep) && !(e.getRightClicked() instanceof Pig) && !(e.getRightClicked() instanceof Wolf)) {
  957.             return;
  958.         }
  959.         final Entity ent = e.getRightClicked();
  960.         if (ent instanceof Evoker) {
  961.             final Player p = e.getPlayer();
  962.             if (ent.getCustomName() == null) {
  963.                 return;
  964.             }
  965.             if (ent.getCustomName().equalsIgnoreCase("§eНачать игру")) {
  966.                 e.setCancelled(true);
  967.                 ShopMenu.onLocaion(p);
  968.             }
  969.         }
  970.         if (ent instanceof Villager) {
  971.             final Player p = e.getPlayer();
  972.             if (ent.getCustomName() == null) {
  973.                 return;
  974.             }
  975.             if (ent.getCustomName().equalsIgnoreCase("§bКланы/Деревни")) {
  976.                 e.setCancelled(true);
  977.                 p.chat("/clan open");
  978.             }
  979.             else if (ent.getCustomName().equalsIgnoreCase("§eТорговец")) {
  980.                 e.setCancelled(true);
  981.                 ShopMenu.onMainMenu(p);
  982.             }
  983.             else if (ent.getCustomName().equalsIgnoreCase("§eКвестер")) {
  984.                 e.setCancelled(true);
  985.                 ShopMenu.onQuests(p);
  986.             }
  987.             else if (ent.getCustomName().equalsIgnoreCase("§bСпособности")) {
  988.                 ShopMenu.onSPO(p);
  989.                 e.setCancelled(true);
  990.             }
  991.         }
  992.         if (ent instanceof Sheep) {
  993.             final Player p = e.getPlayer();
  994.             if (ent.getCustomName() == null) {
  995.                 return;
  996.             }
  997.             if (ent.getCustomName().equalsIgnoreCase("§eНаграда дня")) {
  998.                 ShopMenu.onNagrada(p);
  999.                 e.setCancelled(true);
  1000.             }
  1001.         }
  1002.         if (ent instanceof Pig) {
  1003.             final Player p = e.getPlayer();
  1004.             if (ent.getCustomName() == null) {
  1005.                 return;
  1006.             }
  1007.             if (ent.getCustomName().equalsIgnoreCase("§bБилетер")) {
  1008.                 ShopMenu.onBilet(p);
  1009.                 e.setCancelled(true);
  1010.             }
  1011.         }
  1012.         if (ent instanceof Wolf) {
  1013.             final Player p = e.getPlayer();
  1014.             if (ent.getCustomName() == null) {
  1015.                 return;
  1016.             }
  1017.             if (ent.getCustomName().equalsIgnoreCase("§cБоевые питомцы")) {
  1018.                 ShopMenu.onPIT(p);
  1019.                 e.setCancelled(true);
  1020.             }
  1021.         }
  1022.     }
  1023.    
  1024.     @EventHandler
  1025.     public void playerChat(final AsyncPlayerChatEvent event) {
  1026.         final File s = new File(Bukkit.getServer().getPluginManager().getPlugin("Clans").getDataFolder(), "settings.yml");
  1027.         final FileConfiguration sfile = (FileConfiguration)YamlConfiguration.loadConfiguration(s);
  1028.         final Player p = event.getPlayer();
  1029.         final int l = Levels.getLevel(p.getName());
  1030.         final String pl = p.getName();
  1031.         if (!main.ClanChatBoolean(p)) {
  1032.             event.setCancelled(true);
  1033.             for (final Player player : Bukkit.getOnlinePlayers()) {
  1034.                 player.sendMessage("§c" + l + "ур §e[" + main.ClanName(p) + "§e] §c" + pl + "§e : §7" + event.getMessage());
  1035.             }
  1036.         }
  1037.         else {
  1038.             event.setCancelled(true);
  1039.             final String clan = main.ClanName(p);
  1040.             for (final Player player2 : Bukkit.getOnlinePlayers()) {
  1041.                 if (main.ClanName(player2).equals(clan)) {
  1042.                     player2.sendMessage(sfile.getString("clan_chat.format").replaceAll("&", "§").replaceAll("%clan%", clan).replaceAll("%player%", p.getName()).replaceAll("%message%", event.getMessage()));
  1043.                 }
  1044.             }
  1045.         }
  1046.     }
  1047.    
  1048.     @EventHandler
  1049.     public void onPlayerQuit(final PlayerQuitEvent e) {
  1050.         e.setQuitMessage((String)null);
  1051.         final Player p = e.getPlayer();
  1052.         this.lastSneak.remove(p);
  1053.         final ActionBar actionbar = new ActionBar("§c- §a" + p.getName() + " §eвышел с сервера");
  1054.         final int online = Bukkit.getOnlinePlayers().size();
  1055.         for (final Player pl : Bukkit.getOnlinePlayers()) {
  1056.             actionbar.sendToPlayer(pl);
  1057.             this.createTabInfo(pl, Levels.getTab(1) + online + Levels.getTab(2), Levels.getTab(3));
  1058.         }
  1059.     }
  1060.    
  1061.     @EventHandler
  1062.     public void onPlayerKick(final PlayerKickEvent event) {
  1063.         final Player p = event.getPlayer();
  1064.         final ActionBar actionbar = new ActionBar("§c- §a" + p.getName() + " §eвышел с сервера");
  1065.         final int online = Bukkit.getOnlinePlayers().size();
  1066.         for (final Player pl : Bukkit.getOnlinePlayers()) {
  1067.             actionbar.sendToPlayer(pl);
  1068.             this.createTabInfo(pl, Levels.getTab(1) + online + Levels.getTab(2), Levels.getTab(3));
  1069.         }
  1070.         event.setLeaveMessage((String)null);
  1071.         try {
  1072.             if (p.isBanned()) {
  1073.                 event.setLeaveMessage((String)null);
  1074.             }
  1075.         }
  1076.         catch (NullPointerException e1) {
  1077.             event.setLeaveMessage((String)null);
  1078.         }
  1079.     }
  1080.    
  1081.     @EventHandler(priority = EventPriority.HIGHEST)
  1082.     public void onLoginEvent(final PlayerLoginEvent e) {
  1083.         final Player player = e.getPlayer();
  1084.         final String name = player.getName().toLowerCase();
  1085.         if (player == null) {
  1086.             return;
  1087.         }
  1088.         if (name.length() > 16 || name.length() < 3) {
  1089.             e.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Придумайте другой ник, от 3 до 16 символов");
  1090.             return;
  1091.         }
  1092.         if (!player.getName().matches("[a-zA-Z0-9_]*") || name.equalsIgnoreCase("Player")) {
  1093.             e.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Некоретный ник, разрешенные символы a-z A-Z 0-9 _");
  1094.         }
  1095.     }
  1096.    
  1097.     @EventHandler
  1098.     public void changeworld(final PlayerChangedWorldEvent e) {
  1099.         final World w = e.getPlayer().getLocation().getWorld();
  1100.         final Player p = e.getPlayer();
  1101.         if (w == Bukkit.getWorld("world")) {
  1102.             p.setGameMode(GameMode.ADVENTURE);
  1103.         }
  1104.         else if (w == Bukkit.getWorld("world_skyblock")) {
  1105.             p.setGameMode(GameMode.SURVIVAL);
  1106.         }
  1107.     }
  1108.    
  1109.     @EventHandler
  1110.     public void onPlayerJoin(final PlayerJoinEvent event) {
  1111.         event.setJoinMessage((String)null);
  1112.         final Player p = event.getPlayer();
  1113.         p.setGameMode(GameMode.ADVENTURE);
  1114.         final String name = p.getName();
  1115.         createBoard(p);
  1116.         new SchedulerLogin(p).runTaskTimer((Plugin)this, 0L, 5L);
  1117.         if (WarnRPG.statichasGameOver(p)) {
  1118.             p.teleport(new Location(Bukkit.getWorld("world"), 1053.5, 64.5, 325.5, 179.5f, 8.7f));
  1119.         }
  1120.         else {
  1121.             p.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.0, 118.5, -179.1f, 3.9f));
  1122.         }
  1123.         final ActionBar actionbar = new ActionBar("§c+ §a" + p.getName() + " §eзашел на сервер");
  1124.         final int online = Bukkit.getOnlinePlayers().size();
  1125.         for (final Player pl : Bukkit.getOnlinePlayers()) {
  1126.             actionbar.sendToPlayer(pl);
  1127.             this.createTabInfo(pl, Levels.getTab(1) + online + Levels.getTab(2), Levels.getTab(3));
  1128.         }
  1129.         if (!p.hasPlayedBefore()) {
  1130.             Bukkit.getScheduler().runTaskLater((Plugin)this, () -> ShopMenu.onTutorial(p), 140L);
  1131.             addAttr(p, "DAMAGE", "1", "mainhand", ShopItems.SISworld(0, false));
  1132.         }
  1133.     }
  1134.    
  1135.     public void onLoginMsg(final Player p) {
  1136.         p.getWorld().playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f);
  1137.         p.sendMessage("              §e§lСинхронизация");
  1138.         p.sendMessage("   ");
  1139.         p.sendMessage("§aОбновление от 13.07.19");
  1140.         p.sendMessage("§7- Шифт + ПКМ по игроку, просмотреть информацию");
  1141.         p.sendMessage("§7- В магазин добавлена печать нерушимости и стойкости");
  1142.         p.sendMessage(" ");
  1143.     }
  1144.    
  1145.     public void createTabInfo(final Player p, final String header, final String footer) {
  1146.         final CraftPlayer craftplayer = (CraftPlayer)p;
  1147.         final PlayerConnection connection = craftplayer.getHandle().playerConnection;
  1148.         final IChatBaseComponent headerJSON = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + header + "\"}");
  1149.         final IChatBaseComponent footerJSON = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + footer + "\"}");
  1150.         final PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
  1151.         try {
  1152.             final Field headerField = packet.getClass().getDeclaredField("a");
  1153.             headerField.setAccessible(true);
  1154.             headerField.set(packet, headerJSON);
  1155.             headerField.setAccessible(!headerField.isAccessible());
  1156.             final Field footerField = packet.getClass().getDeclaredField("b");
  1157.             footerField.setAccessible(true);
  1158.             footerField.set(packet, footerJSON);
  1159.             footerField.setAccessible(!footerField.isAccessible());
  1160.         }
  1161.         catch (Exception ex) {}
  1162.         connection.sendPacket((Packet)packet);
  1163.     }
  1164.    
  1165.     public void onDisable() {
  1166.         this.saveConfig();
  1167.         this.saveConfigs((YamlConfiguration)Main.c);
  1168.     }
  1169.    
  1170.     static NBTTagList getAttrList(final net.minecraft.server.v1_12_R1.ItemStack stack) {
  1171.         if (stack.getTag() == null) {
  1172.             stack.setTag(new NBTTagCompound());
  1173.         }
  1174.         final NBTTagList attrmod;
  1175.         if ((attrmod = stack.getTag().getList("AttributeModifiers", 10)) == null) {
  1176.             stack.getTag().set("AttributeModifiers", (NBTBase)new NBTTagList());
  1177.         }
  1178.         return stack.getTag().getList("AttributeModifiers", 10);
  1179.     }
  1180.    
  1181.     static void addAttr(final Player player, final String name, final String num, final String mesto, final ItemStack item) {
  1182.         int op = -1;
  1183.         final Attributes a = get(name);
  1184.         if (a == null) {
  1185.             player.sendMessage("\"§4" + name + "\" is not a valid attribute type.");
  1186.             return;
  1187.         }
  1188.         double amount = 0.0;
  1189.         try {
  1190.             amount = Double.parseDouble(num);
  1191.         }
  1192.         catch (NumberFormatException nfe) {
  1193.             player.sendMessage("\"§4" + num + "\" is not a valid number.");
  1194.             return;
  1195.         }
  1196.         final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
  1197.         final NBTTagList attrmod = getAttrList(nms);
  1198.         for (int i = 0; i < attrmod.size(); ++i) {
  1199.             final NBTTagCompound c = attrmod.get(i);
  1200.             if (c.getString("Name").equals(name)) {
  1201.                 player.sendMessage("§4An attribute with the name \"§f" + name + "\"§4 already exists!");
  1202.                 return;
  1203.             }
  1204.         }
  1205.         final NBTTagCompound c = new NBTTagCompound();
  1206.         c.set("Name", (NBTBase)new NBTTagString(name));
  1207.         c.set("AttributeName", (NBTBase)new NBTTagString(a.name));
  1208.         c.set("Amount", (NBTBase)new NBTTagDouble(amount));
  1209.         if (op == -1) {
  1210.             op = a.op;
  1211.         }
  1212.         c.set("Operation", (NBTBase)new NBTTagInt(op));
  1213.         final UUID randUUID = UUID.randomUUID();
  1214.         c.set("UUIDMost", (NBTBase)new NBTTagLong(randUUID.getMostSignificantBits()));
  1215.         c.set("UUIDLeast", (NBTBase)new NBTTagLong(randUUID.getLeastSignificantBits()));
  1216.         c.set("Slot", (NBTBase)new NBTTagString(mesto.toLowerCase()));
  1217.         attrmod.add((NBTBase)c);
  1218.         nms.getTag().set("AttributeModifiers", (NBTBase)attrmod);
  1219.         final CraftItemStack i2 = CraftItemStack.asCraftMirror(nms);
  1220.         player.getInventory().addItem(new ItemStack[] { (ItemStack)i2 });
  1221.     }
  1222.    
  1223.     public static ItemStack addAttrDrop(final String name, final String num, final String mesto, final ItemStack item) {
  1224.         int op = -1;
  1225.         final Attributes a = get(name);
  1226.         double amount = 0.0;
  1227.         try {
  1228.             amount = Double.parseDouble(num);
  1229.         }
  1230.         catch (NumberFormatException ex) {}
  1231.         final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
  1232.         final NBTTagList attrmod = getAttrList(nms);
  1233.         for (int i = 0; i < attrmod.size(); ++i) {
  1234.             final NBTTagCompound c = attrmod.get(i);
  1235.             if (c.getString("Name").equals(name)) {}
  1236.         }
  1237.         final NBTTagCompound c = new NBTTagCompound();
  1238.         c.set("Name", (NBTBase)new NBTTagString(name));
  1239.         c.set("AttributeName", (NBTBase)new NBTTagString(a.name));
  1240.         c.set("Amount", (NBTBase)new NBTTagDouble(amount));
  1241.         if (op == -1) {
  1242.             op = a.op;
  1243.         }
  1244.         c.set("Operation", (NBTBase)new NBTTagInt(op));
  1245.         final UUID randUUID = UUID.randomUUID();
  1246.         c.set("UUIDMost", (NBTBase)new NBTTagLong(randUUID.getMostSignificantBits()));
  1247.         c.set("UUIDLeast", (NBTBase)new NBTTagLong(randUUID.getLeastSignificantBits()));
  1248.         c.set("Slot", (NBTBase)new NBTTagString(mesto.toLowerCase()));
  1249.         attrmod.add((NBTBase)c);
  1250.         nms.getTag().set("AttributeModifiers", (NBTBase)attrmod);
  1251.         final CraftItemStack i2 = CraftItemStack.asCraftMirror(nms);
  1252.         return (ItemStack)i2;
  1253.     }
  1254.    
  1255.     static ItemStack attrRemove(final ItemStack item, final String string) {
  1256.         final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
  1257.         final NBTTagList attrmod = getAttrList(nms);
  1258.         final NBTTagList nlist = new NBTTagList();
  1259.         boolean r = false;
  1260.         for (int i = 0; i < attrmod.size(); ++i) {
  1261.             final NBTTagCompound c = attrmod.get(i);
  1262.             if (!c.getString("Name").equals(string)) {
  1263.                 nlist.add((NBTBase)attrmod.get(i));
  1264.             }
  1265.             else {
  1266.                 r = true;
  1267.             }
  1268.         }
  1269.         nms.getTag().set("AttributeModifiers", (NBTBase)nlist);
  1270.         final CraftItemStack i2 = CraftItemStack.asCraftMirror(nms);
  1271.         return (ItemStack)i2;
  1272.     }
  1273.    
  1274.     static int attrList(final Player player, final String[] args) {
  1275.         final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(player.getInventory().getItemInMainHand());
  1276.         final NBTTagList attrmod = getAttrList(nms);
  1277.         if (attrmod.size() == 0) {
  1278.             return 0;
  1279.         }
  1280.         for (int i = 0; i < attrmod.size(); ++i) {
  1281.             final NBTTagCompound c = attrmod.get(i);
  1282.             player.sendMessage(i + "");
  1283.             player.sendMessage("§e" + getByMCName(c.getString("AttributeName")) + ", " + c.getDouble("Amount"));
  1284.         }
  1285.         return 0;
  1286.     }
  1287.    
  1288.     private static void listOptions(final Player player) {
  1289.         final ArrayList<String> options = new ArrayList<String>();
  1290.         options.add("mainhand");
  1291.         options.add("offhand");
  1292.         options.add("feet");
  1293.         options.add("legs");
  1294.         options.add("chest");
  1295.         options.add("head");
  1296.         final StringBuilder sb = new StringBuilder();
  1297.         for (final String s : options) {
  1298.             if (sb.length() > 0) {
  1299.                 sb.append(", ");
  1300.             }
  1301.             sb.append(s);
  1302.         }
  1303.         player.sendMessage("§2Supported options: ");
  1304.         player.sendMessage("§e" + sb.toString());
  1305.     }
  1306.    
  1307.     static void attrListAll(final Player player, final String[] args) {
  1308.         player.sendMessage("§2Supported attribute types: ");
  1309.         final StringBuilder sb = new StringBuilder();
  1310.         for (final Attributes s : Attributes.values()) {
  1311.             if (sb.length() > 0) {
  1312.                 sb.append(", ");
  1313.             }
  1314.             sb.append(s);
  1315.         }
  1316.         player.sendMessage("§e" + sb.toString());
  1317.     }
  1318.    
  1319.     public void saveConfigs(final YamlConfiguration c) {
  1320.         try {
  1321.             c.save(new File(this.getDataFolder(), "config.yml"));
  1322.         }
  1323.         catch (IOException ex) {}
  1324.     }
  1325.    
  1326.     @EventHandler
  1327.     public void onIntercactDG(final PlayerInteractEvent e) {
  1328.         final Player p = e.getPlayer();
  1329.         final ItemStack hand = p.getInventory().getItemInMainHand();
  1330.         final ItemStack hand2 = p.getInventory().getItemInOffHand();
  1331.         if ((e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK) && hand != null && hand.hasItemMeta() && hand.getItemMeta().hasDisplayName() && (hand.getItemMeta().getDisplayName().equals("§cПрокачка для оружия") || hand.getItemMeta().getDisplayName().equals("§aПрокачка для брони"))) {
  1332.             final boolean spamhas = this.antispam.contains(p.getName());
  1333.             if (!spamhas) {
  1334.                 if (hand.getItemMeta().getDisplayName().equals("§cПрокачка для оружия")) {
  1335.                     if (p.getInventory().getItemInOffHand().getType() != Material.AIR) {
  1336.                         ShopMenu.YesUpgrade(p);
  1337.                     }
  1338.                     e.setCancelled(true);
  1339.                 }
  1340.                 else if (hand.getItemMeta().getDisplayName().equals("§aПрокачка для брони")) {
  1341.                     if (p.getInventory().getItemInOffHand().getType() != Material.AIR) {
  1342.                         ShopMenu.YesUpgradeHP(p);
  1343.                     }
  1344.                     e.setCancelled(true);
  1345.                 }
  1346.             }
  1347.             else {
  1348.                 p.sendMessage("§7▸ §cВы уже прокачиваете предмет! Дождитесь завершение прокачки!");
  1349.             }
  1350.         }
  1351.     }
  1352.    
  1353.     @EventHandler
  1354.     public void onClick(final PlayerInteractEvent e) {
  1355.         final Player p = e.getPlayer();
  1356.         final ItemStack i = p.getItemInHand();
  1357.         if (e.getClickedBlock() == null) {
  1358.             return;
  1359.         }
  1360.         if (e.getClickedBlock().getType() == null) {
  1361.             return;
  1362.         }
  1363.         if (e.getAction() == null) {
  1364.             return;
  1365.         }
  1366.         if (i == null) {
  1367.             return;
  1368.         }
  1369.         if (e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getType() == Material.ENCHANTMENT_TABLE) {
  1370.             p.chat("/bag");
  1371.             e.setCancelled(true);
  1372.         }
  1373.         if (e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getType() == Material.ANVIL) {
  1374.             p.sendTitle("§cНедостаточно навыков", "§cК сожалению вы не Кузнец");
  1375.             e.setCancelled(true);
  1376.         }
  1377.     }
  1378.    
  1379.     @EventHandler
  1380.     public void onRightClick(final PlayerInteractEntityEvent e) {
  1381.         final Entity entity = e.getRightClicked();
  1382.         if (entity.getType().equals((Object)EntityType.PLAYER)) {
  1383.             final Player ep = (Player)e.getRightClicked();
  1384.             final Player p = e.getPlayer();
  1385.             if (p.isSneaking()) {
  1386.                 ShopMenu.onPlayerInfo(p, ep);
  1387.             }
  1388.         }
  1389.     }
  1390.    
  1391.     @EventHandler(priority = EventPriority.NORMAL)
  1392.     public void onJoinNewLocation(final RegionEnterEvent e) {
  1393.         final Player p = e.getPlayer();
  1394.         final int l = Levels.getLevel(p.getName());
  1395.         if (e.getRegion().getId().equals("l2")) {
  1396.             if (l < 2) {
  1397.                 e.setCancelled(true);
  1398.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c2");
  1399.             }
  1400.         }
  1401.         else if (e.getRegion().getId().equals("l3")) {
  1402.             if (l < 3) {
  1403.                 e.setCancelled(true);
  1404.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c3");
  1405.             }
  1406.         }
  1407.         else if (e.getRegion().getId().equals("l4")) {
  1408.             if (l < 4) {
  1409.                 e.setCancelled(true);
  1410.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c4");
  1411.             }
  1412.         }
  1413.         else if (e.getRegion().getId().equals("l5")) {
  1414.             if (l < 5) {
  1415.                 e.setCancelled(true);
  1416.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c5");
  1417.             }
  1418.         }
  1419.         else if (e.getRegion().getId().equals("l6")) {
  1420.             if (l < 6) {
  1421.                 e.setCancelled(true);
  1422.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c6");
  1423.             }
  1424.         }
  1425.         else if (e.getRegion().getId().equals("l7")) {
  1426.             if (l < 7) {
  1427.                 e.setCancelled(true);
  1428.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c7");
  1429.             }
  1430.         }
  1431.         else if (e.getRegion().getId().equals("l8")) {
  1432.             if (l < 8) {
  1433.                 e.setCancelled(true);
  1434.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c8");
  1435.             }
  1436.         }
  1437.         else if (e.getRegion().getId().equals("l9")) {
  1438.             if (l < 9) {
  1439.                 e.setCancelled(true);
  1440.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c9");
  1441.             }
  1442.         }
  1443.         else if (e.getRegion().getId().equals("l10")) {
  1444.             if (l < 10) {
  1445.                 e.setCancelled(true);
  1446.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c10");
  1447.             }
  1448.         }
  1449.         else if (e.getRegion().getId().equals("l11")) {
  1450.             if (l < 11) {
  1451.                 e.setCancelled(true);
  1452.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c11");
  1453.             }
  1454.         }
  1455.         else if (e.getRegion().getId().equals("l12")) {
  1456.             if (l < 12) {
  1457.                 e.setCancelled(true);
  1458.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c12");
  1459.             }
  1460.         }
  1461.         else if (e.getRegion().getId().equals("l13")) {
  1462.             if (l < 13) {
  1463.                 e.setCancelled(true);
  1464.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c13");
  1465.             }
  1466.         }
  1467.         else if (e.getRegion().getId().equals("l14")) {
  1468.             if (l < 14) {
  1469.                 e.setCancelled(true);
  1470.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c14");
  1471.             }
  1472.         }
  1473.         else if (e.getRegion().getId().equals("l15")) {
  1474.             if (l < 15) {
  1475.                 e.setCancelled(true);
  1476.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c15");
  1477.             }
  1478.         }
  1479.         else if (e.getRegion().getId().equals("l16")) {
  1480.             if (l < 16) {
  1481.                 e.setCancelled(true);
  1482.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c16");
  1483.             }
  1484.         }
  1485.         else if (e.getRegion().getId().equals("l17")) {
  1486.             if (l < 17) {
  1487.                 e.setCancelled(true);
  1488.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c17");
  1489.             }
  1490.         }
  1491.         else if (e.getRegion().getId().equals("l18")) {
  1492.             if (l < 18) {
  1493.                 e.setCancelled(true);
  1494.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c18");
  1495.             }
  1496.         }
  1497.         else if (e.getRegion().getId().equals("l19")) {
  1498.             if (l < 19) {
  1499.                 e.setCancelled(true);
  1500.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c19");
  1501.             }
  1502.         }
  1503.         else if (e.getRegion().getId().equals("l20")) {
  1504.             if (l < 20) {
  1505.                 e.setCancelled(true);
  1506.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c20");
  1507.             }
  1508.         }
  1509.         else if (e.getRegion().getId().equals("p2-l1")) {
  1510.             if (l >= 25) {
  1511.                 p.teleport(new Location(Bukkit.getWorld("world"), 77.7, 29.0, 1209.2, 93.6f, 0.2f));
  1512.             }
  1513.             else {
  1514.                 e.setCancelled(true);
  1515.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c25");
  1516.             }
  1517.         }
  1518.         else if (e.getRegion().getId().equals("p2-l2")) {
  1519.             if (l >= 27) {
  1520.                 p.teleport(new Location(Bukkit.getWorld("world"), 34.4, 29.0, 1193.3, 117.2f, 0.3f));
  1521.             }
  1522.             else {
  1523.                 e.setCancelled(true);
  1524.                 p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c27");
  1525.             }
  1526.         }
  1527.     }
  1528.    
  1529.     public static void sUpgrade(final Player p) {
  1530.         final ItemStack i2 = p.getInventory().getItemInOffHand();
  1531.         final ItemStack j = p.getInventory().getItemInMainHand();
  1532.         final String s = p.getInventory().getItemInOffHand().getItemMeta().getLore().get(3).toString();
  1533.         final String ss = "§7Прокачка: §8нет";
  1534.         final String pech = p.getInventory().getItemInOffHand().getItemMeta().getDisplayName();
  1535.         if (!s.equals(ss)) {
  1536.             p.sendTitle("§aОшибка", "§eДанный предмет нельзя прокачать!");
  1537.         }
  1538.         else {
  1539.             final String string;
  1540.             final String si = string = p.getInventory().getItemInMainHand().getItemMeta().getLore().get(2).toString();
  1541.             switch (string) {
  1542.                 case "§7Прокачка: §6I": {
  1543.                     if (pech.endsWith("§b [Ⓝ]")) {
  1544.                         psub(pech, p);
  1545.                         UpgradeIS(p, j, i2, 2, si);
  1546.                         break;
  1547.                     }
  1548.                     if (uRandom(100)) {
  1549.                         UpgradeIS(p, j, i2, 2, si);
  1550.                         break;
  1551.                     }
  1552.                     DestroyIS(p, j, i2);
  1553.                     break;
  1554.                 }
  1555.                 case "§7Прокачка: §6II": {
  1556.                     if (pech.endsWith("§b [Ⓝ]")) {
  1557.                         psub(pech, p);
  1558.                         UpgradeIS(p, j, i2, 4, si);
  1559.                         break;
  1560.                     }
  1561.                     if (uRandom(90)) {
  1562.                         UpgradeIS(p, j, i2, 4, si);
  1563.                         break;
  1564.                     }
  1565.                     DestroyIS(p, j, i2);
  1566.                     break;
  1567.                 }
  1568.                 case "§7Прокачка: §6III": {
  1569.                     if (pech.endsWith("§b [Ⓝ]")) {
  1570.                         psub(pech, p);
  1571.                         UpgradeIS(p, j, i2, 8, si);
  1572.                         break;
  1573.                     }
  1574.                     if (uRandom(80)) {
  1575.                         UpgradeIS(p, j, i2, 8, si);
  1576.                         break;
  1577.                     }
  1578.                     DestroyIS(p, j, i2);
  1579.                     break;
  1580.                 }
  1581.                 case "§7Прокачка: §6IV": {
  1582.                     if (pech.endsWith("§b [Ⓝ]")) {
  1583.                         psub(pech, p);
  1584.                         UpgradeIS(p, j, i2, 9, si);
  1585.                         break;
  1586.                     }
  1587.                     if (uRandom(70)) {
  1588.                         UpgradeIS(p, j, i2, 9, si);
  1589.                         break;
  1590.                     }
  1591.                     DestroyIS(p, j, i2);
  1592.                     break;
  1593.                 }
  1594.                 case "§7Прокачка: §6V": {
  1595.                     if (pech.endsWith("§b [Ⓝ]")) {
  1596.                         psub(pech, p);
  1597.                         UpgradeIS(p, j, i2, 11, si);
  1598.                         break;
  1599.                     }
  1600.                     if (uRandom(60)) {
  1601.                         UpgradeIS(p, j, i2, 11, si);
  1602.                         break;
  1603.                     }
  1604.                     DestroyIS(p, j, i2);
  1605.                     break;
  1606.                 }
  1607.                 case "§7Прокачка: §6VI": {
  1608.                     if (pech.endsWith("§b [Ⓝ]")) {
  1609.                         psub(pech, p);
  1610.                         UpgradeIS(p, j, i2, 14, si);
  1611.                         break;
  1612.                     }
  1613.                     if (uRandom(50)) {
  1614.                         UpgradeIS(p, j, i2, 14, si);
  1615.                         break;
  1616.                     }
  1617.                     DestroyIS(p, j, i2);
  1618.                     break;
  1619.                 }
  1620.                 case "§7Прокачка: §6VII": {
  1621.                     if (pech.endsWith("§b [Ⓝ]")) {
  1622.                         psub(pech, p);
  1623.                         UpgradeIS(p, j, i2, 17, si);
  1624.                         break;
  1625.                     }
  1626.                     if (uRandom(40)) {
  1627.                         UpgradeIS(p, j, i2, 17, si);
  1628.                         break;
  1629.                     }
  1630.                     DestroyIS(p, j, i2);
  1631.                     break;
  1632.                 }
  1633.                 case "§7Прокачка: §6VIII": {
  1634.                     if (pech.endsWith("§b [Ⓝ]")) {
  1635.                         psub(pech, p);
  1636.                         UpgradeIS(p, j, i2, 19, si);
  1637.                         break;
  1638.                     }
  1639.                     if (uRandom(30)) {
  1640.                         UpgradeIS(p, j, i2, 19, si);
  1641.                         break;
  1642.                     }
  1643.                     DestroyIS(p, j, i2);
  1644.                     break;
  1645.                 }
  1646.                 case "§7Прокачка: §6IX": {
  1647.                     if (pech.endsWith("§b [Ⓝ]")) {
  1648.                         psub(pech, p);
  1649.                         UpgradeIS(p, j, i2, 22, si);
  1650.                         break;
  1651.                     }
  1652.                     if (uRandom(20)) {
  1653.                         UpgradeIS(p, j, i2, 22, si);
  1654.                         break;
  1655.                     }
  1656.                     DestroyIS(p, j, i2);
  1657.                     break;
  1658.                 }
  1659.                 case "§7Прокачка: §6X": {
  1660.                     if (pech.endsWith("§b [Ⓝ]")) {
  1661.                         psub(pech, p);
  1662.                         UpgradeIS(p, j, i2, 25, si);
  1663.                         break;
  1664.                     }
  1665.                     if (uRandom(10)) {
  1666.                         UpgradeIS(p, j, i2, 25, si);
  1667.                         break;
  1668.                     }
  1669.                     DestroyIS(p, j, i2);
  1670.                     break;
  1671.                 }
  1672.             }
  1673.         }
  1674.     }
  1675.    
  1676.     public static void sUpgradeHP(final Player p) {
  1677.         final ItemStack i2 = p.getInventory().getItemInOffHand();
  1678.         final ItemStack j = p.getInventory().getItemInMainHand();
  1679.         final String s = p.getInventory().getItemInOffHand().getItemMeta().getLore().get(3).toString();
  1680.         final String ss = "§7Прокачка: §9нет";
  1681.         final String pech = p.getInventory().getItemInOffHand().getItemMeta().getDisplayName();
  1682.         if (!s.equals(ss)) {
  1683.             p.sendTitle("§aОшибка", "§eДанный предмет нельзя прокачать!");
  1684.         }
  1685.         else {
  1686.             final String string;
  1687.             final String si = string = p.getInventory().getItemInMainHand().getItemMeta().getLore().get(2).toString();
  1688.             switch (string) {
  1689.                 case "§7Прокачка: §6I": {
  1690.                     if (pech.endsWith("§b [Ⓝ]")) {
  1691.                         psub(pech, p);
  1692.                         UpgradeISHP(p, j, i2, 3, si);
  1693.                         break;
  1694.                     }
  1695.                     if (uRandom(100)) {
  1696.                         UpgradeISHP(p, j, i2, 3, si);
  1697.                         break;
  1698.                     }
  1699.                     DestroyIS(p, j, i2);
  1700.                     break;
  1701.                 }
  1702.                 case "§7Прокачка: §6II": {
  1703.                     if (pech.endsWith("§b [Ⓝ]")) {
  1704.                         psub(pech, p);
  1705.                         UpgradeISHP(p, j, i2, 11, si);
  1706.                         break;
  1707.                     }
  1708.                     if (uRandom(90)) {
  1709.                         UpgradeISHP(p, j, i2, 11, si);
  1710.                         break;
  1711.                     }
  1712.                     DestroyIS(p, j, i2);
  1713.                     break;
  1714.                 }
  1715.                 case "§7Прокачка: §6III": {
  1716.                     if (pech.endsWith("§b [Ⓝ]")) {
  1717.                         psub(pech, p);
  1718.                         UpgradeISHP(p, j, i2, 18, si);
  1719.                         break;
  1720.                     }
  1721.                     if (uRandom(80)) {
  1722.                         UpgradeISHP(p, j, i2, 18, si);
  1723.                         break;
  1724.                     }
  1725.                     DestroyIS(p, j, i2);
  1726.                     break;
  1727.                 }
  1728.                 case "§7Прокачка: §6IV": {
  1729.                     if (pech.endsWith("§b [Ⓝ]")) {
  1730.                         psub(pech, p);
  1731.                         UpgradeISHP(p, j, i2, 21, si);
  1732.                         break;
  1733.                     }
  1734.                     if (uRandom(70)) {
  1735.                         UpgradeISHP(p, j, i2, 21, si);
  1736.                         break;
  1737.                     }
  1738.                     DestroyIS(p, j, i2);
  1739.                     break;
  1740.                 }
  1741.                 case "§7Прокачка: §6V": {
  1742.                     if (pech.endsWith("§b [Ⓝ]")) {
  1743.                         psub(pech, p);
  1744.                         UpgradeISHP(p, j, i2, 29, si);
  1745.                         break;
  1746.                     }
  1747.                     if (uRandom(60)) {
  1748.                         UpgradeISHP(p, j, i2, 29, si);
  1749.                         break;
  1750.                     }
  1751.                     DestroyIS(p, j, i2);
  1752.                     break;
  1753.                 }
  1754.                 case "§7Прокачка: §6VI": {
  1755.                     if (pech.endsWith("§b [Ⓝ]")) {
  1756.                         psub(pech, p);
  1757.                         UpgradeISHP(p, j, i2, 34, si);
  1758.                         break;
  1759.                     }
  1760.                     if (uRandom(50)) {
  1761.                         UpgradeISHP(p, j, i2, 34, si);
  1762.                         break;
  1763.                     }
  1764.                     DestroyIS(p, j, i2);
  1765.                     break;
  1766.                 }
  1767.                 case "§7Прокачка: §6VII": {
  1768.                     if (pech.endsWith("§b [Ⓝ]")) {
  1769.                         psub(pech, p);
  1770.                         UpgradeISHP(p, j, i2, 37, si);
  1771.                         break;
  1772.                     }
  1773.                     if (uRandom(40)) {
  1774.                         UpgradeISHP(p, j, i2, 37, si);
  1775.                         break;
  1776.                     }
  1777.                     DestroyIS(p, j, i2);
  1778.                     break;
  1779.                 }
  1780.                 case "§7Прокачка: §6VIII": {
  1781.                     if (pech.endsWith("§b [Ⓝ]")) {
  1782.                         psub(pech, p);
  1783.                         UpgradeISHP(p, j, i2, 44, si);
  1784.                         break;
  1785.                     }
  1786.                     if (uRandom(30)) {
  1787.                         UpgradeISHP(p, j, i2, 44, si);
  1788.                         break;
  1789.                     }
  1790.                     DestroyIS(p, j, i2);
  1791.                     break;
  1792.                 }
  1793.                 case "§7Прокачка: §6IX": {
  1794.                     if (pech.endsWith("§b [Ⓝ]")) {
  1795.                         psub(pech, p);
  1796.                         UpgradeISHP(p, j, i2, 46, si);
  1797.                         break;
  1798.                     }
  1799.                     if (uRandom(20)) {
  1800.                         UpgradeISHP(p, j, i2, 46, si);
  1801.                         break;
  1802.                     }
  1803.                     DestroyIS(p, j, i2);
  1804.                     break;
  1805.                 }
  1806.                 case "§7Прокачка: §6X": {
  1807.                     if (pech.endsWith("§b [Ⓝ]")) {
  1808.                         psub(pech, p);
  1809.                         UpgradeISHP(p, j, i2, 50, si);
  1810.                         break;
  1811.                     }
  1812.                     if (uRandom(10)) {
  1813.                         UpgradeISHP(p, j, i2, 50, si);
  1814.                         break;
  1815.                     }
  1816.                     DestroyIS(p, j, i2);
  1817.                     break;
  1818.                 }
  1819.             }
  1820.         }
  1821.     }
  1822.    
  1823.     public static void psub(final String s, final Player p) {
  1824.         final String ss = s.substring(0, s.length() - 6);
  1825.         final ItemMeta meta = p.getInventory().getItemInOffHand().getItemMeta();
  1826.         meta.setDisplayName(ss);
  1827.         p.getInventory().getItemInOffHand().setItemMeta(meta);
  1828.     }
  1829.    
  1830.     public static void DestroyIS(final Player p, final ItemStack i, final ItemStack i2) {
  1831.         p.getInventory().setItemInMainHand((ItemStack)null);
  1832.         p.getInventory().setItemInOffHand((ItemStack)null);
  1833.         Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
  1834.             @Override
  1835.             public void run() {
  1836.                 new Scheduler2(p).runTaskTimer((Plugin)Main.m, 0L, 4L);
  1837.             }
  1838.         }, 5L);
  1839.     }
  1840.    
  1841.     public static ItemStack changeLore(final ItemStack item, final int index, final String lore) {
  1842.         final ItemMeta meta = item.getItemMeta();
  1843.         final List<String> lores = new ArrayList<String>(meta.getLore());
  1844.         lores.set(index - 1, lore);
  1845.         meta.setLore((List)lores);
  1846.         item.setItemMeta(meta);
  1847.         return item;
  1848.     }
  1849.    
  1850.     public static void UpgradeIS(final Player p, final ItemStack i, final ItemStack i2, final int damage, final String book) {
  1851.         p.getInventory().setItemInMainHand((ItemStack)null);
  1852.         p.getInventory().setItemInOffHand((ItemStack)null);
  1853.         final String s = i2.getItemMeta().getLore().get(1).toString();
  1854.         changeLore(i2, 2, s + " §6(-" + damage + ")");
  1855.         changeLore(i2, 4, book);
  1856.         final ItemStack irem = attrRemove(i2, "DAMAGE");
  1857.         final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(i2);
  1858.         final NBTTagList attrmod = getAttrList(nms);
  1859.         final NBTTagCompound c = attrmod.get(0);
  1860.         final int dmg = (int)c.getDouble("Amount");
  1861.         final String setdamage = damage + dmg + "";
  1862.         Main.m.antispam.add(p.getName());
  1863.         Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
  1864.             @Override
  1865.             public void run() {
  1866.                 Main.m.antispam.remove(p.getName());
  1867.                 Main.addAttr(p, "DAMAGE", setdamage, "mainhand", irem);
  1868.             }
  1869.         }, 48L);
  1870.         Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
  1871.             @Override
  1872.             public void run() {
  1873.                 new Scheduler(p).runTaskTimer((Plugin)Main.m, 0L, 4L);
  1874.             }
  1875.         }, 1L);
  1876.     }
  1877.    
  1878.     public static void UpgradeISHP(final Player p, final ItemStack i, final ItemStack i2, final int damage, final String book) {
  1879.         p.getInventory().setItemInMainHand((ItemStack)null);
  1880.         p.getInventory().setItemInOffHand((ItemStack)null);
  1881.         final String s = i2.getItemMeta().getLore().get(1).toString();
  1882.         changeLore(i2, 2, s + " §6(+" + damage + ")");
  1883.         changeLore(i2, 4, book);
  1884.         final ItemStack irem = attrRemove(i2, "MAX_HEALTH");
  1885.         final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(i2);
  1886.         final NBTTagList attrmod = getAttrList(nms);
  1887.         final NBTTagCompound c = attrmod.get(0);
  1888.         final int dmg = (int)c.getDouble("Amount");
  1889.         final String setdamage = damage + dmg + "";
  1890.         Main.m.antispam.add(p.getName());
  1891.         Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
  1892.             @Override
  1893.             public void run() {
  1894.                 Main.m.antispam.remove(p.getName());
  1895.                 if (i2.getType() == Material.LEATHER_CHESTPLATE || i2.getType() == Material.IRON_CHESTPLATE || i2.getType() == Material.GOLD_CHESTPLATE) {
  1896.                     Main.addAttr(p, "MAX_HEALTH", setdamage, "chest", irem);
  1897.                 }
  1898.                 else if (i2.getType() == Material.LEATHER_LEGGINGS || i2.getType() == Material.IRON_LEGGINGS || i2.getType() == Material.GOLD_LEGGINGS) {
  1899.                     Main.addAttr(p, "MAX_HEALTH", setdamage, "legs", irem);
  1900.                 }
  1901.                 if (i2.getType() == Material.LEATHER_BOOTS || i2.getType() == Material.IRON_BOOTS || i2.getType() == Material.GOLD_BOOTS) {
  1902.                     Main.addAttr(p, "MAX_HEALTH", setdamage, "feet", irem);
  1903.                 }
  1904.                 if (i2.getType() == Material.SHIELD) {
  1905.                     Main.addAttr(p, "MAX_HEALTH", setdamage, "offhand", irem);
  1906.                 }
  1907.             }
  1908.         }, 48L);
  1909.         Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
  1910.             @Override
  1911.             public void run() {
  1912.                 new Scheduler(p).runTaskTimer((Plugin)Main.m, 0L, 4L);
  1913.             }
  1914.         }, 1L);
  1915.     }
  1916.    
  1917.     public static boolean uRandom(final int chance) {
  1918.         final Random rand = new Random();
  1919.         final int number = rand.nextInt(100) + 1;
  1920.         return number <= chance;
  1921.     }
  1922.    
  1923.     @EventHandler
  1924.     public void onMobDeath(final EntityDeathEvent e) {
  1925.         if (e.getEntity().getKiller() instanceof Player) {
  1926.             final String entity = e.getEntity().getCustomName();
  1927.             final Player p = e.getEntity().getKiller();
  1928.             if (entity == null) {
  1929.                 return;
  1930.             }
  1931.             if (entity.startsWith("§c§lBOSS")) {
  1932.                 Levels.addBoss(p.getName());
  1933.             }
  1934.             if (entity.startsWith("§c§lMEGA")) {
  1935.                 Bukkit.getScheduler().runTaskLater((Plugin)Main.m, () -> {
  1936.                     Levels.addDung(p.getName());
  1937.                     Bukkit.getWorld("world").getBlockAt(94, 87, 107).setType(Material.ENDER_CHEST);
  1938.                     this.playChestAnimation(1);
  1939.                     this.openChest();
  1940.                     return;
  1941.                 }, 60L);
  1942.             }
  1943.             if (entity.startsWith("§c§lDUNGEON")) {
  1944.                 Levels.addDung(p.getName());
  1945.             }
  1946.             if (entity.startsWith("§c§lLAB")) {
  1947.                 Levels.addDung(p.getName());
  1948.             }
  1949.             if (entity.startsWith("§c§lTUTORIAL")) {
  1950.                 p.teleport(new Location(Bukkit.getWorld("world"), 884.5, 53.0, 102.5, -41.6f, 1.8f));
  1951.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm i give " + p.getName() + " xp3drop 15");
  1952.                 Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm i give " + p.getName() + " xp3dropboss 5");
  1953.             }
  1954.             Levels.addMobs(p.getName());
  1955.         }
  1956.     }
  1957.    
  1958.     public static void lvlUP(final String p, final int i) {
  1959.         Mainlvl.addStats(p, i);
  1960.     }
  1961.    
  1962.     public static void BoosterTimer() {
  1963.         Bukkit.getScheduler().runTaskLater((Plugin)Main.m, () -> {
  1964.             Levels.setBoosterNO();
  1965.             Bukkit.broadcastMessage("§cВнимание! Глобальный ускоритель опыта закончился! Продлить можно в §6/donate");
  1966.             Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline booster 1 &r");
  1967.             Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline booster 2 &r");
  1968.         }, 72000L);
  1969.     }
  1970.    
  1971.     public void openChest() {
  1972.         final Location l = new Location(Bukkit.getWorld("world"), 94.5, 87.8, 107.5);
  1973.         final World w = Bukkit.getWorld("world");
  1974.         w.createExplosion(l.getX(), l.getY(), l.getZ(), 1.0f, false, false);
  1975.         final Item sword = w.dropItem(l, addAttrDrop("DAMAGE", "43", "mainhand", ShopItems.ChestItems(1)));
  1976.         final Item shield = w.dropItem(l, addAttrDrop("MAX_HEALTH", "28", "offhand", ShopItems.ChestItems(2)));
  1977.         final Item uphp = w.dropItem(l, ShopItems.ChestItems(3));
  1978.         final Item chestplate = w.dropItem(l, addAttrDrop("MAX_HEALTH", "25", "chest", ShopItems.ChestItems(2)));
  1979.         final Item updmg = w.dropItem(l, ShopItems.ChestItems(5));
  1980.         final Item updmg2 = w.dropItem(l, ShopItems.ChestItems(6));
  1981.         sword.setVelocity(new Vector(1, 0, 0));
  1982.         shield.setVelocity(new Vector(0, 1, 0));
  1983.         uphp.setVelocity(new Vector(0, 0, 1));
  1984.         chestplate.setVelocity(new Vector(-1, 0, 0));
  1985.         updmg.setVelocity(new Vector(0, -1, 0));
  1986.         updmg.setVelocity(new Vector(0, 0, -1));
  1987.         Bukkit.getScheduler().runTaskLater((Plugin)Main.m, () -> this.playChestAnimation(0), 100L);
  1988.         final World world = null;
  1989.         final Location location = null;
  1990.         Bukkit.getScheduler().runTaskLater((Plugin)Main.m, () -> {
  1991.             world.createExplosion(location.getX(), location.getY(), location.getZ(), 1.0f, false, false);
  1992.             Bukkit.getWorld("world").getBlockAt(94, 87, 107).setType(Material.AIR);
  1993.         }, 120L);
  1994.     }
  1995.    
  1996.     private void playChestAnimation(final int state) {
  1997.         ((CraftWorld)Bukkit.getWorld("world")).getHandle().playBlockAction(new BlockPosition(94, 87, 107), CraftMagicNumbers.getBlock(Material.ENDER_CHEST), 1, state);
  1998.     }
  1999.    
  2000.     private void onEffectSpark(final Player p, final Effect e) {
  2001.         p.getLocation().getWorld().playEffect(p.getLocation().add(0.6, 2.0, 0.0), e, 1);
  2002.         p.getLocation().getWorld().playEffect(p.getLocation().add(0.55, 2.0, 0.23), e, 1);
  2003.         p.getLocation().getWorld().playEffect(p.getLocation().add(0.45, 2.0, 0.45), e, 1);
  2004.         p.getLocation().getWorld().playEffect(p.getLocation().add(0.23, 2.0, 0.55), e, 1);
  2005.         p.getLocation().getWorld().playEffect(p.getLocation().add(0.0, 2.0, 0.6), e, 1);
  2006.         p.getLocation().getWorld().playEffect(p.getLocation().add(-0.23, 2.0, 0.55), e, 1);
  2007.         p.getLocation().getWorld().playEffect(p.getLocation().add(-0.45, 2.0, 0.45), e, 1);
  2008.         p.getLocation().getWorld().playEffect(p.getLocation().add(-0.55, 2.0, 0.23), e, 1);
  2009.         p.getLocation().getWorld().playEffect(p.getLocation().add(-0.6, 2.0, 0.0), e, 1);
  2010.         p.getLocation().getWorld().playEffect(p.getLocation().add(-0.55, 2.0, -0.23), e, 1);
  2011.         p.getLocation().getWorld().playEffect(p.getLocation().add(-0.45, 2.0, -0.45), e, 1);
  2012.         p.getLocation().getWorld().playEffect(p.getLocation().add(-0.23, 2.0, -0.55), e, 1);
  2013.         p.getLocation().getWorld().playEffect(p.getLocation().add(0.0, 2.0, -0.6), e, 1);
  2014.         p.getLocation().getWorld().playEffect(p.getLocation().add(0.23, 2.0, -0.55), e, 1);
  2015.         p.getLocation().getWorld().playEffect(p.getLocation().add(0.45, 2.0, -0.45), e, 1);
  2016.         p.getLocation().getWorld().playEffect(p.getLocation().add(0.55, 2.0, -0.23), e, 1);
  2017.     }
  2018.    
  2019.     @EventHandler
  2020.     private void onSposobnosty(final PlayerToggleSneakEvent e) {
  2021.         if (!e.isSneaking()) {
  2022.             return;
  2023.         }
  2024.         final long current = System.currentTimeMillis();
  2025.         final Long previous = this.lastSneak.put(e.getPlayer(), current);
  2026.         if (previous == null) {
  2027.             return;
  2028.         }
  2029.         if (current - previous > 500L) {
  2030.             return;
  2031.         }
  2032.         final Player p = e.getPlayer();
  2033.         final String spo = Levels.getSpo(e.getPlayer().getName());
  2034.         if (spo.equalsIgnoreCase("null")) {
  2035.             return;
  2036.         }
  2037.         if (p.getFoodLevel() == 0) {
  2038.             return;
  2039.         }
  2040.         final int f = p.getFoodLevel();
  2041.         final String s = spo;
  2042.         switch (s) {
  2043.             case "inv": {
  2044.                 if (f >= 2) {
  2045.                     this.onEffectSpark(p, Effect.SMOKE);
  2046.                     p.setFoodLevel(f - 2);
  2047.                     p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 200, 1));
  2048.                     break;
  2049.                 }
  2050.                 break;
  2051.             }
  2052.             case "reg": {
  2053.                 if (f >= 3) {
  2054.                     this.onEffectSpark(p, Effect.HEART);
  2055.                     p.setFoodLevel(f - 3);
  2056.                     p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 1));
  2057.                     break;
  2058.                 }
  2059.                 break;
  2060.             }
  2061.             case "bomba": {
  2062.                 if (f >= 4) {
  2063.                     p.setFoodLevel(f - 4);
  2064.                     this.onEffectSpark(p, Effect.BLAZE_SHOOT);
  2065.                     for (final Entity entity : p.getNearbyEntities(3.0, 3.0, 3.0)) {
  2066.                         if (entity.getType() != EntityType.PLAYER) {
  2067.                             entity.setVelocity(entity.getLocation().getDirection().setY(-1).multiply(-1.2));
  2068.                         }
  2069.                     }
  2070.                     break;
  2071.                 }
  2072.                 break;
  2073.             }
  2074.             case "rivok": {
  2075.                 if (f >= 2) {
  2076.                     p.setFoodLevel(f - 2);
  2077.                     this.onEffectSpark(p, Effect.FIREWORKS_SPARK);
  2078.                     p.setVelocity(p.getLocation().getDirection().multiply(2).setY(-1.5));
  2079.                     break;
  2080.                 }
  2081.                 break;
  2082.             }
  2083.             case "hil": {
  2084.                 if (f >= 5) {
  2085.                     p.setFoodLevel(f - 5);
  2086.                     this.onEffectSpark(p, Effect.PORTAL);
  2087.                     for (final Entity entity : p.getNearbyEntities(5.0, 5.0, 5.0)) {
  2088.                         if (entity.getType() == EntityType.PLAYER) {
  2089.                             final Player pl = (Player)entity;
  2090.                             pl.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 1));
  2091.                         }
  2092.                     }
  2093.                     break;
  2094.                 }
  2095.                 break;
  2096.             }
  2097.         }
  2098.     }
  2099.    
  2100.     @EventHandler
  2101.     public void onEFFECTSWORD(final EntityDamageByEntityEvent e) {
  2102.         final Entity damager = e.getDamager();
  2103.         final LivingEntity entity = (LivingEntity)e.getEntity();
  2104.         if (damager instanceof Player) {
  2105.             final Player p = (Player)damager;
  2106.             if (p.getInventory() == null) {
  2107.                 return;
  2108.             }
  2109.             if (p.getInventory().getItemInMainHand() == null) {
  2110.                 return;
  2111.             }
  2112.             if (p.getInventory().getItemInMainHand().getItemMeta() == null) {
  2113.                 return;
  2114.             }
  2115.             if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName() == null) {
  2116.                 return;
  2117.             }
  2118.             final String item = p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().toString();
  2119.             if (!(entity instanceof Player)) {
  2120.                 if (item.startsWith("§aПаралакс §8[§e14ур§8]")) {
  2121.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 60, 1));
  2122.                 }
  2123.                 if (item.startsWith("§aКсаркс §8[§e15ур§8]")) {
  2124.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 60, 1));
  2125.                 }
  2126.                 if (item.startsWith("§aМаларис §8[§e17ур§8]")) {
  2127.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 1));
  2128.                 }
  2129.                 if (item.startsWith("§aОникс §8[§e25ур§8]")) {
  2130.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 1));
  2131.                 }
  2132.                 if (item.startsWith("§aТоксик §8[§e12ур§8]")) {
  2133.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 60, 1));
  2134.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 60, 1));
  2135.                 }
  2136.                 if (item.startsWith("§aКсар §8[§e15ур§8]")) {
  2137.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 1));
  2138.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 60, 1));
  2139.                 }
  2140.                 if (item.startsWith("§aЭкскалибурc §8[§e10ур§8]")) {
  2141.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 1));
  2142.                 }
  2143.                 if (item.startsWith("§aСайгер §8[§e9ур§8]")) {
  2144.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 1));
  2145.                 }
  2146.                 if (item.startsWith("§aГолден §8[§e20ур§8]")) {
  2147.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 60, 1));
  2148.                 }
  2149.                 if (item.startsWith("§aЗалфир §8[§e10ур§8]")) {
  2150.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 60, 1));
  2151.                 }
  2152.                 if (item.startsWith("§aЛоли §8[§e8ур§8]")) {
  2153.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 60, 1));
  2154.                 }
  2155.                 if (item.startsWith("§aОмега §8[§e27ур§8]")) {
  2156.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 1));
  2157.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
  2158.                 }
  2159.                 if (item.startsWith("§aМеч Крона §8[§e15ур§8]")) {
  2160.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 1));
  2161.                 }
  2162.                 if (item.startsWith("§aЯгура §8[§e15ур§8]")) {
  2163.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
  2164.                 }
  2165.                 if (item.startsWith("§aДемонический клинок §8[§e8ур§8]")) {
  2166.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
  2167.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 60, 1));
  2168.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 1));
  2169.                     entity.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 60, 1));
  2170.                 }
  2171.             }
  2172.         }
  2173.     }
  2174.    
  2175.     public void onChances(final Player p) {
  2176.         if (new Random().nextFloat() < 0.01) {
  2177.             addAttr(p, "DAMAGE", "34", "mainhand", ShopItems.SIDropSword(1));
  2178.         }
  2179.         else if (new Random().nextFloat() < 0.09) {
  2180.             addAttr(p, "DAMAGE", "30", "mainhand", ShopItems.SIDropSword(8));
  2181.         }
  2182.         else if (new Random().nextFloat() < 0.15) {
  2183.             addAttr(p, "DAMAGE", "44", "mainhand", ShopItems.SIDropSword(11));
  2184.         }
  2185.         else if (new Random().nextFloat() < 0.17) {
  2186.             addAttr(p, "DAMAGE", "26", "mainhand", ShopItems.SIDropSword(17));
  2187.         }
  2188.         else if (new Random().nextFloat() < 0.2) {
  2189.             addAttr(p, "DAMAGE", "23", "mainhand", ShopItems.SIDropSword(18));
  2190.         }
  2191.         else if (new Random().nextFloat() < 0.25) {
  2192.             addAttr(p, "DAMAGE", "20", "mainhand", ShopItems.SIDropSword(171));
  2193.         }
  2194.         else if (new Random().nextFloat() < 0.3) {
  2195.             addAttr(p, "DAMAGE", "18", "mainhand", ShopItems.SIDropSword(412));
  2196.         }
  2197.         else if (new Random().nextFloat() < 0.4) {
  2198.             addAttr(p, "DAMAGE", "23", "mainhand", ShopItems.SIDropSword(41));
  2199.         }
  2200.         else if (new Random().nextFloat() < 0.45) {
  2201.             addAttr(p, "DAMAGE", "10", "mainhand", ShopItems.SIDropSword(411));
  2202.         }
  2203.         else if (new Random().nextFloat() < 0.5) {
  2204.             addAttr(p, "DAMAGE", "17", "mainhand", ShopItems.SIDropSword(42));
  2205.         }
  2206.         else if (new Random().nextFloat() < 0.6) {
  2207.             addAttr(p, "DAMAGE", "29", "mainhand", ShopItems.SIDropSword(81));
  2208.         }
  2209.         else if (new Random().nextFloat() < 0.7) {
  2210.             addAttr(p, "DAMAGE", "11", "mainhand", ShopItems.SIDropSword(861));
  2211.         }
  2212.         else if (new Random().nextFloat() < 0.8) {
  2213.             addAttr(p, "DAMAGE", "21", "mainhand", ShopItems.SIDropSword(86));
  2214.         }
  2215.         else if (new Random().nextFloat() < 0.85) {
  2216.             addAttr(p, "DAMAGE", "14", "mainhand", ShopItems.SIDropSword(862));
  2217.         }
  2218.         else if (new Random().nextFloat() < 0.9) {
  2219.             addAttr(p, "DAMAGE", "12", "mainhand", ShopItems.SIDropSword(87));
  2220.         }
  2221.         else if (new Random().nextFloat() < 0.95) {
  2222.             addAttr(p, "DAMAGE", "7", "mainhand", ShopItems.SIDropSword(82));
  2223.         }
  2224.     }
  2225.    
  2226.     public static int getBal(final Player p) {
  2227.         final int coins = Coins.getCoins(p.getName());
  2228.         return coins;
  2229.     }
  2230.    
  2231.     public static boolean sB(final Player p, final int coins) {
  2232.         final int getcoin = getBal(p);
  2233.         if (getcoin >= coins) {
  2234.             Coins.setCoins(p.getName(), getcoin - coins);
  2235.             return true;
  2236.         }
  2237.         return false;
  2238.     }
  2239.    
  2240.     public static void addBal(final Player p, final int coins) {
  2241.         Coins.addCoins(p.getName(), coins);
  2242.     }
  2243.    
  2244.     public static Main getI() {
  2245.         return Main.instance;
  2246.     }
  2247.    
  2248.     public void onSleep(final PlayerBedEnterEvent e) {
  2249.     }
  2250.    
  2251.     @EventHandler
  2252.     public void onSignChange(final SignChangeEvent e) {
  2253.         final Block b = e.getBlock();
  2254.         final Player p = e.getPlayer();
  2255.         if (main.ClanName(p).equals("")) {
  2256.             String input = "";
  2257.             for (final String line : e.getLines()) {
  2258.                 if (line != null && line.length() > 0) {
  2259.                     input += line;
  2260.                 }
  2261.             }
  2262.             if (b.hasMetadata("setName")) {
  2263.                 if (input.length() > 2) {
  2264.                     if (input.length() > 6) {
  2265.                         p.sendMessage("&cНазвание клана слишком длинное!");
  2266.                     }
  2267.                     else {
  2268.                         final String clanname = input;
  2269.                         p.chat("/clan create " + input);
  2270.                         b.setType(Material.AIR);
  2271.                     }
  2272.                 }
  2273.                 else {
  2274.                     p.sendMessage("&cНазвание клана слишком короткое!");
  2275.                     b.setType(Material.AIR);
  2276.                 }
  2277.                 e.setCancelled(true);
  2278.                 b.removeMetadata("setName", (Plugin)getI());
  2279.                 b.setType(Material.AIR);
  2280.             }
  2281.         }
  2282.     }
  2283.    
  2284.     public void randomEvent() {
  2285.         Bukkit.getScheduler().runTaskTimer((Plugin)this, (Runnable)new Runnable() {
  2286.             @Override
  2287.             public void run() {
  2288.                 if (Bukkit.getOnlinePlayers().size() >= 2) {
  2289.                     for (final Player p : Bukkit.getOnlinePlayers()) {
  2290.                         Main.this.onRandomEvent(p);
  2291.                     }
  2292.                 }
  2293.             }
  2294.         }, 36000L, 36000L);
  2295.     }
  2296.    
  2297.     public void onRandomEvent(final Player p) {
  2298.         final Random r = new Random();
  2299.         final int rt = r.nextInt(8) + 1;
  2300.         if (rt == 1) {
  2301.             p.sendTitle("§eВнезапное событие", "§eВсем игрокам начисленно §a200 монет");
  2302.             Main.economy.depositPlayer((OfflinePlayer)p, 200.0);
  2303.         }
  2304.         if (rt == 2) {
  2305.             p.sendTitle("§eВнезапное событие", "§eВсе игроки перемещены на §aспавн!");
  2306.             p.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.5, 118.5, -179.1f, 3.9f));
  2307.             p.setGameMode(GameMode.ADVENTURE);
  2308.         }
  2309.         if (rt == 3) {
  2310.             p.sendTitle("§eВнезапное событие", "§eВсе игроки получают замедление!");
  2311.             p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1200, 1));
  2312.         }
  2313.         if (rt == 4) {
  2314.             p.sendTitle("§eВнезапное событие", "§eВсе игроки ослеплены!");
  2315.             p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1200, 1));
  2316.         }
  2317.         if (rt == 5) {
  2318.             p.sendTitle("§eВнезапное событие", "§eВсе игроки получают ключ от сундука!");
  2319.             Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "case give " + p.getName() + " 1");
  2320.         }
  2321.         if (rt == 6) {
  2322.             p.sendTitle("§eВнезапное событие", "§eВсе игроки получают ускорение!");
  2323.             p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1200, 2));
  2324.         }
  2325.         if (rt == 7) {
  2326.             p.sendTitle("§eВнезапное событие", "§eВсе игроки получают неуязвимость!");
  2327.             p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 2));
  2328.         }
  2329.         if (rt == 8) {
  2330.             p.sendTitle("§eВнезапное событие", "§eВсем игрокам начисленно §a250 монет");
  2331.             Main.economy.depositPlayer((OfflinePlayer)p, 250.0);
  2332.         }
  2333.     }
  2334.    
  2335.     static {
  2336.         Main.boss1 = new ArrayList<Player>();
  2337.         Main.boss2 = new ArrayList<Player>();
  2338.         Main.boss3 = new ArrayList<Player>();
  2339.         Main.inpvp = new ArrayList<String>();
  2340.         Main.arenalab = new ArrayList<Player>();
  2341.         Main.arenalog = new ArrayList<Player>();
  2342.         expclan = new HashMap<String, Integer>();
  2343.         Main.count = 0;
  2344.         Main.login = 0;
  2345.         Main.bosslevels = 0;
  2346.         Main.counts = 0;
  2347.         Main.instance = null;
  2348.         Main.economy = null;
  2349.     }
  2350.    
  2351.     private enum Attributes
  2352.     {
  2353.         DAMAGE(0, "generic.attackDamage"),
  2354.         MOVEMENT_SPEED(2, "generic.movementSpeed"),
  2355.         ATTACK_SPEED(2, "generic.attackSpeed"),
  2356.         KNOCKBACK_RESISTANCE(2, "generic.knockbackResistance"),
  2357.         MAX_HEALTH(0, "generic.maxHealth"),
  2358.         ARMOR(0, "generic.armor"),
  2359.         LUCK(0, "generic.luck");
  2360.        
  2361.         private final int op;
  2362.         private final String name;
  2363.        
  2364.         private Attributes(final int op, final String name) {
  2365.             this.op = op;
  2366.             this.name = name;
  2367.         }
  2368.        
  2369.         private static Attributes get(final String s) {
  2370.             for (final Attributes a : values()) {
  2371.                 if (a.name().toLowerCase().equalsIgnoreCase(s)) {
  2372.                     return a;
  2373.                 }
  2374.             }
  2375.             return null;
  2376.         }
  2377.        
  2378.         private static Attributes getByMCName(final String s) {
  2379.             for (final Attributes a : values()) {
  2380.                 if (a.name.equalsIgnoreCase(s)) {
  2381.                     return a;
  2382.                 }
  2383.             }
  2384.             return null;
  2385.         }
  2386.     }
  2387. }
Advertisement
Add Comment
Please, Sign In to add comment