Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.bukkit.plugin.java.*;
- import net.milkbowl.vault.economy.*;
- import ru.meedway.corerpg.menu.location.*;
- import org.bukkit.scheduler.*;
- import org.bukkit.command.*;
- import ru.meedway.corerpg.menu.vilshop.*;
- import org.bukkit.potion.*;
- import org.bukkit.event.*;
- import org.bukkit.plugin.*;
- import es.darkhorizon.dev.*;
- import mw.TravoQur.caseq.*;
- import org.bukkit.scoreboard.*;
- import org.bukkit.scoreboard.Scoreboard;
- import de.Keyle.MyPet.*;
- import de.Keyle.MyPet.api.entity.*;
- import java.text.*;
- import org.bukkit.inventory.*;
- import org.bukkit.inventory.ItemStack;
- import com.mewin.WGRegionEvents.events.*;
- import org.bukkit.configuration.file.*;
- import ru.meedway.warnrpg.*;
- import org.bukkit.craftbukkit.v1_12_R1.entity.*;
- import java.lang.reflect.*;
- import org.bukkit.craftbukkit.v1_12_R1.inventory.*;
- import java.io.*;
- import org.bukkit.*;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.inventory.meta.*;
- import java.util.*;
- import ru.meedway.lvltop.*;
- import org.bukkit.util.*;
- import org.bukkit.util.Vector;
- import org.bukkit.craftbukkit.v1_12_R1.*;
- import net.minecraft.server.v1_12_R1.*;
- import org.bukkit.craftbukkit.v1_12_R1.util.*;
- import org.bukkit.event.entity.*;
- import org.bukkit.entity.*;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.Item;
- import mw.donate.lyamour.*;
- import org.bukkit.event.player.*;
- import org.bukkit.event.block.*;
- import org.bukkit.block.*;
- import org.bukkit.block.Block;
- public class Main extends JavaPlugin implements Listener
- {
- public ArrayList<String> inportal;
- private final Map<Player, Long> lastSneak;
- HashMap<Integer, String> point;
- HashMap<Integer, String> bos;
- ArrayList<Player> list;
- public static ArrayList<Player> boss1;
- public static ArrayList<Player> boss2;
- public static ArrayList<Player> boss3;
- public static ArrayList<String> inpvp;
- public static ArrayList<Player> arenalab;
- public static ArrayList<Player> arenalog;
- Set<String> antispam;
- boolean b1;
- private static final HashMap<String, Integer> expclan;
- public static String kit;
- public static int count;
- public static int login;
- public static int bosslevels;
- public static int counts;
- private static Main plugin;
- public static Main instance;
- public static Main m;
- public static FileConfiguration c;
- public static Economy economy;
- public Main() {
- this.inportal = new ArrayList<String>();
- this.lastSneak = new HashMap<Player, Long>();
- this.point = new HashMap<Integer, String>();
- this.bos = new HashMap<Integer, String>();
- this.list = new ArrayList<Player>();
- this.antispam = new HashSet<String>();
- this.b1 = false;
- }
- public static Main getPlugin() {
- return Main.plugin;
- }
- public static Main getInstance() {
- return Main.instance;
- }
- public void onEnable() {
- Main.plugin = this;
- (Main.m = this).setupEconomy();
- Main.c = this.getConfig();
- Main.c.options().copyDefaults(true);
- Bukkit.getPluginManager().registerEvents((Listener)new ExpDrop(), (Plugin)this);
- Bukkit.getPluginManager().registerEvents((Listener)new ChatEvents(), (Plugin)this);
- Bukkit.getPluginManager().registerEvents((Listener)new KeepInventory(), (Plugin)this);
- Bukkit.getPluginManager().registerEvents((Listener)new ShopMenuClick(), (Plugin)this);
- Bukkit.getPluginManager().registerEvents((Listener)new LocationClick(), (Plugin)this);
- Bukkit.getPluginManager().registerEvents((Listener)new VilClick(), (Plugin)this);
- Bukkit.getPluginManager().registerEvents((Listener)new Inv(), (Plugin)this);
- Bukkit.getPluginManager().registerEvents((Listener)new Utils(), (Plugin)this);
- Bukkit.getPluginManager().registerEvents((Listener)this, (Plugin)this);
- this.saveConfig();
- new BukkitRunnable() {
- public void run() {
- Main.refresh();
- Main.refresh2();
- Main.this.refreshclan();
- Main.this.removepoint();
- Main.this.randomEvent();
- }
- }.runTaskLater((Plugin)this, 60L);
- }
- public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
- if (cmd.getName().equalsIgnoreCase("levels")) {
- final Player p = (Player)sender;
- if (p.hasPermission("meedway.admin") && args.length > 0) {
- if (args[0].equalsIgnoreCase("get")) {
- final String a = args[1];
- sender.sendMessage("§6:" + Levels.getXP(a));
- }
- if (args[0].equalsIgnoreCase("set")) {
- final String a = args[1];
- final String b = args[2];
- final int c = Integer.parseInt(b);
- Levels.setXP(a, c);
- this.saveConfig();
- }
- if (args[0].equalsIgnoreCase("add")) {
- final String a = args[1];
- final String b = args[2];
- final int c = Integer.parseInt(b);
- Levels.addXP(a, c);
- this.saveConfig();
- }
- if (args[0].equalsIgnoreCase("npc")) {
- spawnVillagers();
- }
- if (args[0].equalsIgnoreCase("chest")) {
- this.openChest();
- }
- if (args[0].equalsIgnoreCase("s")) {
- ShopMenu.onSPO(p);
- }
- if (args[0].equalsIgnoreCase("p")) {
- ShopMenu.onPIT(p);
- }
- if (args[0].equalsIgnoreCase("chances")) {
- this.onChances(p);
- }
- if (args[0].equalsIgnoreCase("g")) {
- p.sendMessage("" + p.getFoodLevel());
- }
- if (args[0].equalsIgnoreCase("size")) {
- final int size = this.bos.size();
- p.sendMessage("" + size);
- }
- if (args[0].equalsIgnoreCase("clan")) {
- SignsUtil.setSign(p, "setName");
- }
- if (args[0].equalsIgnoreCase("random")) {
- this.onRandomEvent(p);
- }
- if (args[0].equalsIgnoreCase("addcoins")) {
- final String a = args[1];
- final String b = args[2];
- Integer.parseInt(b);
- }
- if (args[0].equalsIgnoreCase("getcoins")) {
- final String s = args[1];
- }
- if (args[0].equalsIgnoreCase("getplayerinfo")) {
- ShopMenu.onPlayerInfo(p, p);
- }
- if (args[0].equalsIgnoreCase("setvil")) {
- VilItem.onLoadItem();
- }
- if (args[0].equalsIgnoreCase("getvil")) {
- VilMenu.onMenu(p);
- }
- }
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("kit")) {
- final Player p = (Player)sender;
- if (Cooldown.hasCooldown(p.getName(), "kit")) {
- final long time = Cooldown.getCooldown(p.getName(), "kit") / 1000L / 60L / 60L;
- final int timeformat = (int)time;
- p.sendMessage("§aДля повторного получения, ожидайте " + timeformat + "§a час(ов)");
- }
- else {
- onKit(p);
- Cooldown.setCooldown(p.getName(), 86400000L, "kit");
- }
- return false;
- }
- if (cmd.getName().equalsIgnoreCase("shop")) {
- final Player p = (Player)sender;
- p.sendMessage("§7▸ §aВзаимодействуйте с НПС на спавне для открытия меню торговца!");
- return false;
- }
- if (cmd.getName().equalsIgnoreCase("donate")) {
- final Player p = (Player)sender;
- if (p.getWorld().equals(Bukkit.getWorld("world"))) {
- ShopMenu.onDonate(p);
- }
- else {
- p.sendMessage("§7▸ §aЭта команда работает только в РПГ мире!");
- }
- return false;
- }
- if (cmd.getName().equalsIgnoreCase("store-money")) {
- if (Bukkit.getConsoleSender() == sender && args.length > 0) {
- if (args[0].equalsIgnoreCase("get")) {
- final String s2 = args[1];
- }
- if (args[0].equalsIgnoreCase("add")) {
- final String a2 = args[1];
- final String b2 = args[2];
- final int c2 = Integer.parseInt(b2);
- Main.economy.depositPlayer((OfflinePlayer)Bukkit.getPlayer(a2), (double)c2);
- }
- }
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("spawn")) {
- final Player p = (Player)sender;
- p.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.5, 118.5, -179.1f, 3.9f));
- p.setGameMode(GameMode.ADVENTURE);
- return false;
- }
- if (cmd.getName().equalsIgnoreCase("help")) {
- final Player p = (Player)sender;
- p.sendMessage("§eПомощь по командам:");
- p.sendMessage("§e/money send Ник 10 - передать монеты");
- p.sendMessage("§e/coins send Ник 10 - передать коины");
- p.sendMessage("§e/spawn - переместится на спавн");
- }
- else if (cmd.getName().equalsIgnoreCase("skyblock")) {
- final Player p = (Player)sender;
- p.teleport(new Location(Bukkit.getWorld("world"), -1317.0, 90.5, 112.0, 178.9f, 88.9f));
- }
- else if (cmd.getName().equalsIgnoreCase("youtube")) {
- final Player p = (Player)sender;
- p.sendMessage("§aСсылка на ютуб канал THIS : §ehttps://www.youtube.com/channel/UCKK20mhGEkWQZ0aiWMa3AYQ");
- }
- else if (cmd.getName().equalsIgnoreCase("vk")) {
- final Player p = (Player)sender;
- p.sendMessage("§aСсылка на вк группу: §ehttp://vk.com/meedway");
- }
- else if (cmd.getName().equalsIgnoreCase("discord")) {
- final Player p = (Player)sender;
- p.sendMessage("§aСсылка на дискорд: §ehttps://discord.gg/jcbsZs2");
- }
- else if (cmd.getName().equalsIgnoreCase("pvp")) {
- final Player p = (Player)sender;
- p.sendTitle("§aВы на пвп врене!", "§bВ данной локации вещи не выпадают!");
- p.sendMessage("§aВы перемещены на локацию с ПВП ареной, на которой отсутсвует выпадение вещей!");
- p.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.5, 118.5, -179.1f, 3.9f));
- }
- else if (cmd.getName().equalsIgnoreCase("this")) {
- final Player p = (Player)sender;
- final boolean bonus = Levels.getBonusYT(p.getName());
- if (!bonus) {
- Levels.setBonusYT(p.getName());
- Bukkit.broadcastMessage("§aК нам зашел §e" + p.getName() + "§a новый подписчик канала §6THIS §c(/youtube)");
- p.sendMessage("§7▸ Бонус подписчику:");
- p.sendMessage("§a+ §e300 монет!");
- p.sendMessage("§a+ §bБесплатный набор: Нагрудник, Поножи, Ботинки, Оружие.");
- Main.economy.depositPlayer(p.getName(), 300.0);
- addAttr(p, "DAMAGE", "2", "mainhand", ShopItems.SISworld(1, false));
- addAttr(p, "MAX_HEALTH", "1", "chest", ShopItems.SIChestPlate(1, false));
- addAttr(p, "MAX_HEALTH", "1", "legs", ShopItems.SIPonoji(1, false));
- addAttr(p, "MAX_HEALTH", "0", "feet", ShopItems.SIBoots(1, false));
- Levels.addSub();
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline lastsub 2 &aПоследний подписчик: &6" + p.getName());
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline lastsub 3 &aВсего зашло: &6" + Levels.getSub() + " &aподписчиков");
- }
- else {
- p.sendMessage("§7▸ §cБонусный набор уже выдан!");
- }
- return false;
- }
- if (cmd.getName().equalsIgnoreCase("bilet")) {
- if (Bukkit.getConsoleSender() == sender && args.length > 0) {
- if (args[0].equalsIgnoreCase("get")) {
- final String s3 = args[1];
- }
- if (args[0].equalsIgnoreCase("on")) {
- final String a2 = args[1];
- final String b2 = args[2];
- final int c2 = Integer.parseInt(b2);
- this.onBulet(a2, c2);
- }
- }
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("admincase")) {
- if (Bukkit.getConsoleSender() == sender && args[0].equalsIgnoreCase("addcoins")) {
- final String a2 = args[1];
- final String b2 = args[2];
- Integer.parseInt(b2);
- }
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("adminreload")) {
- if (Bukkit.getConsoleSender() == sender) {
- Utils.onTimerReload("§cВнимание ПЕРЕЗАГРУЗКА", "§cЧерез 60 секунд сервер отключится", 0, false);
- Utils.onTimerReload("§cВнимание ПЕРЕЗАГРУЗКА", "§cЧерез 30 секунд сервер отключится", 30, false);
- Utils.onTimerReload("§cВнимание ПЕРЕЗАГРУЗКА", "§cЧерез 5 секунд сервер отключится", 55, false);
- }
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("tainik")) {
- if (Bukkit.getConsoleSender() == sender && args.length > 0 && args[0].equalsIgnoreCase("give")) {
- final String a2 = args[1];
- final Player p2 = Bukkit.getPlayer(a2);
- this.onChances(p2);
- }
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("tutorial")) {
- if (Bukkit.getConsoleSender() == sender && args.length > 0 && args[0].equalsIgnoreCase("on")) {
- final String a2 = args[1];
- final Player p2 = Bukkit.getPlayer(a2);
- p2.teleport(new Location(Bukkit.getWorld("world"), 852.5, 54.0, 97.5, -98.9f, 9.6f));
- p2.sendTitle("§aОбучение начато!", "§eСледуйте указаниям...");
- }
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("sys-tutorial")) {
- if (Bukkit.getConsoleSender() == sender && args.length > 0 && args[0].equalsIgnoreCase("on")) {
- final String a2 = args[1];
- final Player p2 = Bukkit.getPlayer(a2);
- ShopMenu.onTutorial(p2);
- }
- return true;
- }
- return false;
- }
- public static void onTutorials(final Player p) {
- p.teleport(new Location(Bukkit.getWorld("world"), 852.5, 54.0, 97.5, -98.9f, 9.6f));
- p.sendTitle("§aОбучение начато!", "§eСледуйте указаниям...");
- }
- public void onBulet(final String player, final int c) {
- final Player p = Bukkit.getPlayer(player);
- p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 10, 5));
- p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 10, 5));
- p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 10, 10, true, false));
- p.sendTitle("§aБилет принят!", "§сПристегните ремни, отправляемся!");
- p.teleport(new Location(Bukkit.getWorld("world"), 48.5, 86.0, 103.5, 180.0f, -2.6f));
- final Player player2 = null;
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, () -> {
- if (c == 1) {
- player2.sendTitle("§aВнимание, высадка!", "§eПункт назначения: §cСпавн");
- player2.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.5, 118.5, -179.1f, 3.9f));
- }
- if (c == 2) {
- player2.sendTitle("§aВнимание, высадка!", "§eПункт назначения: §cСмертельный лабиринт");
- this.onBrand2(player2);
- }
- if (c == 3) {
- player2.sendTitle("§aВнимание, высадка!", "§eПункт назначения: §cМистический лабиринт");
- this.onBrand1(player2);
- }
- }, 60L);
- }
- public void onBrand1(final Player p) {
- final Random r = new Random();
- final int rt = r.nextInt(8) + 1;
- if (rt == 1) {
- p.teleport(new Location(Bukkit.getWorld("world"), -900.5, 61.5, 128.5, 1.2f, 6.0f));
- }
- if (rt == 2) {
- p.teleport(new Location(Bukkit.getWorld("world"), -898.5, 61.5, 118.5, -87.3f, 2.7f));
- }
- if (rt == 3) {
- p.teleport(new Location(Bukkit.getWorld("world"), -898.5, 61.5, 116.5, -177.3f, 0.8f));
- }
- if (rt == 4) {
- p.teleport(new Location(Bukkit.getWorld("world"), -906.5, 61.5, 118.5, -179.7f, 1.6f));
- }
- if (rt == 5) {
- p.teleport(new Location(Bukkit.getWorld("world"), -960.5, 61.5, 34.5, 91.0f, 1.9f));
- }
- if (rt == 6) {
- p.teleport(new Location(Bukkit.getWorld("world"), -956.5, 61.5, 42.5, 0.9f, 2.0f));
- }
- if (rt == 7) {
- p.teleport(new Location(Bukkit.getWorld("world"), -948.5, 61.5, 42.5, -91.8f, 2.3f));
- }
- if (rt == 8) {
- p.teleport(new Location(Bukkit.getWorld("world"), -972.5, 61.5, 58.5, 89.4f, 1.5f));
- }
- }
- public void onBrand2(final Player p) {
- final Random r = new Random();
- final int rt = r.nextInt(8) + 1;
- if (rt == 1) {
- p.teleport(new Location(Bukkit.getWorld("world"), -900.5, 81.5, 128.5, 1.2f, 6.0f));
- }
- if (rt == 2) {
- p.teleport(new Location(Bukkit.getWorld("world"), -898.5, 81.5, 118.5, -87.3f, 2.7f));
- }
- if (rt == 3) {
- p.teleport(new Location(Bukkit.getWorld("world"), -898.5, 81.5, 116.5, -177.3f, 0.8f));
- }
- if (rt == 4) {
- p.teleport(new Location(Bukkit.getWorld("world"), -906.5, 81.5, 118.5, -179.7f, 1.6f));
- }
- if (rt == 5) {
- p.teleport(new Location(Bukkit.getWorld("world"), -960.5, 81.5, 34.5, 91.0f, 1.9f));
- }
- if (rt == 6) {
- p.teleport(new Location(Bukkit.getWorld("world"), -956.5, 81.5, 42.5, 0.9f, 2.0f));
- }
- if (rt == 7) {
- p.teleport(new Location(Bukkit.getWorld("world"), -948.5, 81.5, 42.5, -91.8f, 2.3f));
- }
- if (rt == 8) {
- p.teleport(new Location(Bukkit.getWorld("world"), -972.5, 81.5, 58.5, 89.4f, 1.5f));
- }
- }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void AsyncPlayerChatEvent(final AsyncPlayerChatEvent event) {
- if (!event.getMessage().toLowerCase().contains("!level!")) {
- event.setFormat(event.getFormat().replace("!level!", "§8[§b" + Levels.getXP(event.getPlayer().getName()) + "§8]"));
- }
- }
- public static void onKit(final Player p) {
- final Random r = new Random();
- final int rt = r.nextInt(12) + 1;
- if (rt == 1) {
- ot(p, true, 100, 0);
- }
- if (rt == 2) {
- ot(p, true, 200, 0);
- }
- if (rt == 3) {
- ot(p, true, 300, 0);
- }
- if (rt == 4) {
- ot(p, true, 400, 0);
- }
- if (rt == 5) {
- ot(p, true, 500, 0);
- }
- if (rt == 6) {
- ot(p, true, 600, 0);
- }
- if (rt == 7) {
- ot(p, true, 700, 0);
- }
- if (rt == 8) {
- ot(p, true, 800, 0);
- }
- if (rt == 9) {
- ot(p, true, 900, 0);
- }
- if (rt == 10) {
- ot(p, true, 1000, 0);
- }
- if (rt == 11) {
- ot(p, true, 1100, 0);
- }
- if (rt == 12) {
- ot(p, true, 1200, 0);
- }
- if (rt == 13) {
- ot(p, false, 0, 3);
- }
- }
- public static void ot(final Player p, final boolean c, final int money, final int coins) {
- if (c) {
- p.sendTitle("§aПоздравляю", "§eВы получили:§c " + money + " монет");
- Bukkit.broadcastMessage("§a[Награда дня] §e" + p.getName() + " получил ежедневную награду §c" + money + " монет!§e");
- Main.economy.depositPlayer(p.getName(), (double)money);
- }
- else {
- p.sendTitle("§aПоздравляю", "§eВы получили:§c " + coins + " коина");
- Bukkit.broadcastMessage("§a[Награда дня] §e" + p.getName() + " получил ежедневную награду §c" + coins + " коинов§e!");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "geco give " + p.getName() + " coins 3");
- }
- }
- private boolean setupEconomy() {
- final RegisteredServiceProvider economyProvider = this.getServer().getServicesManager().getRegistration((Class)Economy.class);
- if (economyProvider != null) {
- Main.economy = (Economy)economyProvider.getProvider();
- }
- return Main.economy != null;
- }
- public static void createBoard(final Player player) {
- final Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
- final Objective objective = scoreboard.registerNewObjective("stats", "dummy");
- setScore(objective, player);
- setPrefix(scoreboard);
- player.setScoreboard(scoreboard);
- }
- public static void refresh() {
- new BukkitRunnable() {
- public void run() {
- for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
- final Scoreboard scoreboard = player.getScoreboard();
- if (scoreboard == null) {
- Main.createBoard(player);
- }
- else {
- scoreboard.getObjective("stats").unregister();
- final Objective objective = scoreboard.registerNewObjective("stats", "dummy");
- Main.setScore(objective, player);
- player.setScoreboard(scoreboard);
- }
- }
- }
- }.runTaskTimerAsynchronously((Plugin)Main.m, 0L, 80L);
- }
- public static void refresh2() {
- new BukkitRunnable() {
- public void run() {
- Main.updatePrefix();
- Main.onEffectArhont();
- }
- }.runTaskTimerAsynchronously((Plugin)Main.m, 0L, 81L);
- }
- public static void onEffectArhont() {
- for (final Player p : Bukkit.getOnlinePlayers()) {
- if (Levels.getArhont(p.getName())) {
- p.getLocation().getWorld().playEffect(p.getLocation().add(0.0, 2.0, 0.0), Effect.HAPPY_VILLAGER, 1);
- }
- }
- }
- public static void setPrefix(final Scoreboard scoreboard) {
- for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
- final String string = "#" + player.getName();
- String preo;
- if (string.length() > 16) {
- preo = string.substring(0, 16);
- }
- else {
- preo = string;
- }
- String prefix;
- String suffix;
- if (player.getName().equalsIgnoreCase("TravoQur")) {
- prefix = "§fY§cT§e| §c";
- suffix = " §e" + main.clanGetTag(player) + " §4" + main.ClanName(player).replaceAll("&", "§");
- }
- else if (player.toString().equalsIgnoreCase(main.ClanOwner(player))) {
- prefix = "§c" + Levels.getLevel(player.getName()) + "ур §e| §6";
- suffix = " §6" + main.clanGetTag(player) + " " + main.ClanName(player).replaceAll("&", "§");
- }
- else {
- prefix = "§c" + Levels.getLevel(player.getName()) + "ур §e| §c";
- suffix = " §e" + main.clanGetTag(player) + " " + main.ClanName(player).replaceAll("&", "§");
- }
- Team team = scoreboard.getTeam(preo);
- if (team == null) {
- team = scoreboard.registerNewTeam(preo);
- team.addPlayer((OfflinePlayer)player);
- team.setPrefix(prefix);
- team.setSuffix(suffix);
- }
- else {
- team.addEntry(player.getName());
- }
- }
- }
- public static void updatePrefix() {
- for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
- for (final Team team : player.getScoreboard().getTeams()) {
- team.unregister();
- }
- }
- for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
- setPrefix(player.getScoreboard());
- }
- }
- public static void setScore(final Objective objective, final Player player) {
- final int level = Levels.getLevel(player.getName());
- final int getl = Levels.getl[level];
- final int getEXP = Levels.getXP(player.getName());
- final int getc = main.getclvl[level];
- final int coins = getBal(player);
- final int key = ConfigBox.getKey(player);
- final String nuznoexp = formatValue((float)getl);
- final String estexp = formatValue((float)getEXP);
- final String cx = formatValue((float)main.ClanEXP(player));
- final String cn = formatValue((float)getc);
- objective.setDisplaySlot(DisplaySlot.SIDEBAR);
- objective.setDisplayName("§e§lMeedWay.RU");
- objective.getScore(" ").setScore(13);
- objective.getScore("§fУровень: §a" + scorelevel(player)).setScore(12);
- objective.getScore("§fОпыт: §e" + estexp + "§7/§e" + nuznoexp).setScore(11);
- objective.getScore(" ").setScore(10);
- objective.getScore("§fКлан: §e" + main.ClanName(player).replaceAll("&", "§")).setScore(9);
- objective.getScore("§fОпыт клана: §b" + cx + "§7/§b" + cn).setScore(8);
- objective.getScore(" ").setScore(7);
- objective.getScore("§fКоины: §6" + coins).setScore(6);
- objective.getScore("§fМонеты: §a" + Main.economy.getBalance((OfflinePlayer)player)).setScore(5);
- objective.getScore("§fКлючи: §b" + key).setScore(4);
- objective.getScore(" ").setScore(3);
- objective.getScore(pet(player)).setScore(2);
- objective.getScore(" ").setScore(1);
- objective.getScore("§6vk.com/meedway").setScore(0);
- }
- public static String scorelevel(final Player p) {
- final int level = Levels.getLevel(p.getName());
- if (level == 27) {
- return level + "§c (MAX)";
- }
- return level + "";
- }
- public static String pet(final Player p) {
- if (MyPetApi.getPlugin().getPlayerManager().getMyPetPlayer(p) == null) {
- return "§7Питомец: §cне приручен";
- }
- final MyPet pit = MyPetApi.getPlugin().getPlayerManager().getMyPetPlayer(p).getMyPet();
- if (pit != null) {
- final int exp = (int)pit.getExperience().getExp();
- return "§fПитомец: §e" + pit.getExperience().getLevel() + "ур §a(" + exp + "/" + pit.getExperience().getExpByLevel(pit.getExperience().getLevel() + 1) + ")";
- }
- return "§7Питомец: §cне приручен";
- }
- public static String formatValue(float value) {
- final String[] arr = { "", "k", "M", "T", "B", "C", "E" };
- int index;
- for (index = 0; value / 1000.0f >= 1.0f; value /= 1000.0f, ++index) {}
- final DecimalFormat decimalFormat = new DecimalFormat("#.##");
- return String.format("%s%s", decimalFormat.format(value), arr[index]);
- }
- public int RandInt() {
- final int i = 0;
- final Random r = new Random();
- final int rt = r.nextInt(3) + 1;
- if (rt == 1) {
- return 1;
- }
- if (rt == 2) {
- return 2;
- }
- if (rt == 3) {
- return 3;
- }
- return 1;
- }
- @EventHandler(priority = EventPriority.NORMAL)
- public void onNeedPoint(final RegionEnterEvent e) {
- final Player p = e.getPlayer();
- final int bossgame = Main.boss1.size();
- if (e.getRegion().getId().equals("bos")) {
- if (bossgame == 0) {
- this.inportal.add(p.getName());
- final int sizep = this.inportal.size();
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline bos 3 &eИгроков: " + sizep + "/3");
- if (sizep >= 3) {
- final int l = this.RandInt();
- }
- }
- else {
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline bos 3 &cИдет сражение с монстром!");
- }
- }
- if (e.getRegion().getId().equals("pvp")) {
- Main.inpvp.add(p.getName());
- }
- if (e.getRegion().getId().equals("boss1")) {
- Main.boss1.add(p);
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm mobs spawn BossGET1 1 world,-122,68,95");
- }
- if (e.getRegion().getId().equals("boss2")) {
- Main.boss1.add(p);
- for (int i = 1; i <= 2; ++i) {
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm mobs spawn BossGET2 1 world,-71,76,-137");
- }
- }
- if (e.getRegion().getId().equals("boss3")) {
- Main.boss1.add(p);
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm mobs spawn BossGET3 1 world,159,63,22");
- }
- if (e.getRegion().getId().equals("tutorpoint")) {
- p.teleport(new Location(Bukkit.getWorld("world"), 852.5, 52.0, 142.5, 91.2f, 3.0f));
- addAttr(p, "DAMAGE", "10", "mainhand", ShopItems.SISworld(6, false));
- p.getInventory().addItem(new ItemStack[] { ShopItems.SIBOOK(1, false) });
- }
- if (e.getRegion().getId().equals("tutorend")) {
- p.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.5, 118.5, -179.1f, 3.9f));
- p.sendTitle("§aОбучение пройдено!", "§eОстальное найдете в: §c/help");
- }
- if (e.getRegion().getId().equals("arenalab")) {
- final int a = Main.arenalab.size();
- if (a == 0) {
- Main.arenalab.add(p);
- for (int is = 1; is <= 2; ++is) {
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm mobs spawn BossLab 1 world,140,50,1640");
- }
- }
- }
- if (e.getRegion().getId().equals("arenalog")) {
- final int a = Main.arenalog.size();
- if (a == 0) {
- Main.arenalog.add(p);
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm mobs spawn BossLog 1 world,-931,94,82");
- }
- }
- if (!main.ClanName(p).equals("")) {
- if (e.getRegion().getId().equals("1")) {
- if (this.point.get(0) != main.ClanName(p)) {
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 1 2 &cЗахвачена кланом: §e" + main.ClanName(p) + "");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "ad say 276 global &b&lЗимний замок &bзахвачен кланом: §e" + main.ClanName(p) + "");
- this.point.replace(0, main.ClanName(p));
- }
- }
- else if (e.getRegion().getId().equals("2")) {
- if (this.point.get(1) != main.ClanName(p)) {
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 2 2 &cЗахвачена кланом: §e" + main.ClanName(p) + "");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "ad say 276 global &a&lКоварное поселение &aзахвачено кланом: §e" + main.ClanName(p) + "");
- this.point.replace(1, main.ClanName(p));
- }
- }
- else if (e.getRegion().getId().equals("3")) {
- if (this.point.get(2) != main.ClanName(p)) {
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 3 2 &cЗахвачена кланом: §e" + main.ClanName(p) + "");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "ad say 276 global &4&lПиратский корабль &4захвачен кланом: §e" + main.ClanName(p) + "");
- this.point.replace(2, main.ClanName(p));
- }
- }
- else if (e.getRegion().getId().equals("4") && this.point.get(3) != main.ClanName(p)) {
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 4 2 &cЗахвачена кланом: §e" + main.ClanName(p) + "");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "ad say 276 global &e&lМирное поселение &aзахвачено кланом: §e" + main.ClanName(p) + "");
- this.point.replace(3, main.ClanName(p));
- }
- }
- }
- @EventHandler(priority = EventPriority.NORMAL)
- public void noNeedPoint(final RegionLeaveEvent e) {
- final Player p = e.getPlayer();
- if (e.getRegion().getId().equals("bos")) {
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
- @Override
- public void run() {
- Main.this.inportal.remove(p.getName());
- final int i = Main.this.inportal.size();
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline bos 3 &eИгроков: " + i + "/3");
- }
- }, 5L);
- }
- if (e.getRegion().getId().equals("boss1")) {
- Main.boss1.remove(p);
- }
- if (e.getRegion().getId().equals("boss2")) {
- Main.boss1.remove(p);
- }
- if (e.getRegion().getId().equals("boss3")) {
- Main.boss1.remove(p);
- }
- if (e.getRegion().getId().equals("pvp")) {
- Main.inpvp.remove(p.getName());
- }
- if (e.getRegion().getId().equals("arenalab")) {
- Main.arenalab.remove(p);
- }
- if (e.getRegion().getId().equals("arenalog")) {
- Main.arenalog.remove(p);
- }
- }
- public void removepoint() {
- new BukkitRunnable() {
- public void run() {
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 1 2 &cГотова к захвату!");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 2 2 &cГотова к захвату!");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 3 2 &cГотова к захвату!");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline 4 2 &cГотова к захвату!");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline bos 3 &eИгроков: 0/3");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline booster 1 &r");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline booster 2 &r");
- Main.spawnVillagers();
- Levels.setBoosterNO();
- Main.this.point.put(0, null);
- Main.this.point.put(1, null);
- Main.this.point.put(2, null);
- Main.this.point.put(3, null);
- }
- }.runTaskLater((Plugin)this, 300L);
- }
- public void refreshclan() {
- new BukkitRunnable() {
- public void run() {
- if (Main.this.point.get(0) != null) {
- final String clan = Main.this.point.get(0).toString();
- for (final Player p : Bukkit.getOnlinePlayers()) {
- if (main.ClanName(p).equals(clan)) {
- final int cl = main.ClanLVLint(p);
- p.sendMessage("§7▸ За удержание §bЗимнего замка §7начисленно: §b+1 опыт клана §7и §e" + (cl + 1) + " монет(ы)");
- Main.economy.depositPlayer(p.getName(), (double)(cl + 1));
- }
- }
- main.ClanSetEXP(clan);
- }
- if (Main.this.point.get(1) != null) {
- final String clan = Main.this.point.get(1).toString();
- for (final Player p : Bukkit.getOnlinePlayers()) {
- if (main.ClanName(p).equals(clan)) {
- final int cl = main.ClanLVLint(p);
- p.sendMessage("§7▸ За удержание §aКоварного поселения §7начисленно: §b+1 опыт клана §7и §e" + (cl + 1) + " монет(ы)");
- Main.economy.depositPlayer(p.getName(), (double)(cl + 1));
- }
- }
- main.ClanSetEXP(clan);
- }
- if (Main.this.point.get(2) != null) {
- final String clan = Main.this.point.get(2).toString();
- for (final Player p : Bukkit.getOnlinePlayers()) {
- if (main.ClanName(p).equals(clan)) {
- final int cl = main.ClanLVLint(p);
- p.sendMessage("§7▸ За удержание §cПиратского корабля §7начисленно: §b+1 опыт клана §7и §e" + (cl + 1) + " монет(ы)");
- Main.economy.depositPlayer(p.getName(), (double)(cl + 1));
- }
- }
- main.ClanSetEXP(clan);
- }
- if (Main.this.point.get(3) != null) {
- final String clan = Main.this.point.get(3).toString();
- for (final Player p : Bukkit.getOnlinePlayers()) {
- if (main.ClanName(p).equals(clan)) {
- final int cl = main.ClanLVLint(p);
- p.sendMessage("§7▸ За удержание §eМирной деревни §7начисленно: §b+1 опыт клана §7и §e" + (cl + 1) + " монет(ы)");
- Main.economy.depositPlayer(p.getName(), (double)(cl + 3));
- }
- }
- main.ClanSetEXP(clan);
- }
- }
- }.runTaskTimerAsynchronously((Plugin)Main.m, 0L, 2400L);
- }
- public static void spawnVillagers() {
- Location loc = new Location(Bukkit.getWorld("world"), 94.5, 87.0, 101.5, 1.0f, 0.0f);
- final Evoker king = (Evoker)loc.getWorld().spawnEntity(loc, EntityType.EVOKER);
- king.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
- king.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
- king.setCustomNameVisible(true);
- king.setCustomName("§eНачать игру");
- king.setCollidable(false);
- king.setAI(false);
- king.resetMaxHealth();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "gamerule sendCommandFeedback false");
- loc = new Location(Bukkit.getWorld("world"), 91.5, 87.0, 101.5, 1.0f, 0.0f);
- Villager king2 = (Villager)loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
- king2.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
- king2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
- king2.setCustomNameVisible(true);
- king2.setCustomName("§bСпособности");
- king2.setCollidable(false);
- king2.setAI(false);
- king2.resetMaxHealth();
- loc = new Location(Bukkit.getWorld("world"), 99.5, 87.0, 97.5, 1.0f, 0.0f);
- king2 = (Villager)loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
- king2.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
- king2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
- king2.setCustomNameVisible(true);
- king2.setCustomName("§bКланы/Деревни");
- king2.setCollidable(false);
- king2.setAI(false);
- king2.resetMaxHealth();
- loc = new Location(Bukkit.getWorld("world"), 107.5, 87.0, 107.5, 90.0f, 0.0f);
- king2 = (Villager)loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
- king2.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
- king2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
- king2.setCustomNameVisible(true);
- king2.setCustomName("§eТорговец");
- king2.setCollidable(false);
- king2.setAI(false);
- king2.resetMaxHealth();
- loc = new Location(Bukkit.getWorld("world"), 899.5, 55.0, 112.5, 94.1f, 8.0f);
- king2 = (Villager)loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
- king2.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
- king2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
- king2.setCustomNameVisible(true);
- king2.setCustomName("§eТорговец");
- king2.setCollidable(false);
- king2.setAI(false);
- king2.resetMaxHealth();
- loc = new Location(Bukkit.getWorld("world"), 107.5, 87.0, 97.5, 49.2f, -2.0f);
- king2 = (Villager)loc.getWorld().spawnEntity(loc, EntityType.VILLAGER);
- king2.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
- king2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
- king2.setCustomNameVisible(true);
- king2.setCustomName("§eКвестер");
- king2.setCollidable(false);
- king2.setAI(false);
- king2.resetMaxHealth();
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "gamerule sendCommandFeedback false");
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "gamerule announceadvancements false");
- Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "gamerule doWeatherCycle false");
- loc = new Location(Bukkit.getWorld("world"), 107.5, 87.0, 99.5, 49.2f, -2.0f);
- final Sheep king3 = (Sheep)loc.getWorld().spawnEntity(loc, EntityType.SHEEP);
- king3.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
- king3.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
- king3.setCustomNameVisible(true);
- king3.setCustomName("§eНаграда дня");
- king3.setCollidable(false);
- king3.setAI(false);
- king3.resetMaxHealth();
- loc = new Location(Bukkit.getWorld("world"), 65.5, 87.0, 102.5, -83.7f, -5.4f);
- final Pig king4 = (Pig)loc.getWorld().spawnEntity(loc, EntityType.PIG);
- king4.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
- king4.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
- king4.setCustomNameVisible(true);
- king4.setCustomName("§bБилетер");
- king4.setCollidable(false);
- king4.setAI(false);
- king4.resetMaxHealth();
- loc = new Location(Bukkit.getWorld("world"), 82.5, 88.5, 112.5, 179.7f, 8.0f);
- final Wolf king5 = (Wolf)loc.getWorld().spawnEntity(loc, EntityType.WOLF);
- king5.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 999999999, 10, true, false));
- king5.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999999, 5, true, false));
- king5.setCustomNameVisible(true);
- king5.setCustomName("§cБоевые питомцы");
- king5.setCollidable(false);
- king5.setAI(false);
- king5.resetMaxHealth();
- }
- @EventHandler
- public void onPlayerInteractEntity(final PlayerInteractEntityEvent e) {
- if (!(e.getRightClicked() instanceof Evoker) && !(e.getRightClicked() instanceof Villager) && !(e.getRightClicked() instanceof Sheep) && !(e.getRightClicked() instanceof Pig) && !(e.getRightClicked() instanceof Wolf)) {
- return;
- }
- final Entity ent = e.getRightClicked();
- if (ent instanceof Evoker) {
- final Player p = e.getPlayer();
- if (ent.getCustomName() == null) {
- return;
- }
- if (ent.getCustomName().equalsIgnoreCase("§eНачать игру")) {
- e.setCancelled(true);
- ShopMenu.onLocaion(p);
- }
- }
- if (ent instanceof Villager) {
- final Player p = e.getPlayer();
- if (ent.getCustomName() == null) {
- return;
- }
- if (ent.getCustomName().equalsIgnoreCase("§bКланы/Деревни")) {
- e.setCancelled(true);
- p.chat("/clan open");
- }
- else if (ent.getCustomName().equalsIgnoreCase("§eТорговец")) {
- e.setCancelled(true);
- ShopMenu.onMainMenu(p);
- }
- else if (ent.getCustomName().equalsIgnoreCase("§eКвестер")) {
- e.setCancelled(true);
- ShopMenu.onQuests(p);
- }
- else if (ent.getCustomName().equalsIgnoreCase("§bСпособности")) {
- ShopMenu.onSPO(p);
- e.setCancelled(true);
- }
- }
- if (ent instanceof Sheep) {
- final Player p = e.getPlayer();
- if (ent.getCustomName() == null) {
- return;
- }
- if (ent.getCustomName().equalsIgnoreCase("§eНаграда дня")) {
- ShopMenu.onNagrada(p);
- e.setCancelled(true);
- }
- }
- if (ent instanceof Pig) {
- final Player p = e.getPlayer();
- if (ent.getCustomName() == null) {
- return;
- }
- if (ent.getCustomName().equalsIgnoreCase("§bБилетер")) {
- ShopMenu.onBilet(p);
- e.setCancelled(true);
- }
- }
- if (ent instanceof Wolf) {
- final Player p = e.getPlayer();
- if (ent.getCustomName() == null) {
- return;
- }
- if (ent.getCustomName().equalsIgnoreCase("§cБоевые питомцы")) {
- ShopMenu.onPIT(p);
- e.setCancelled(true);
- }
- }
- }
- @EventHandler
- public void playerChat(final AsyncPlayerChatEvent event) {
- final File s = new File(Bukkit.getServer().getPluginManager().getPlugin("Clans").getDataFolder(), "settings.yml");
- final FileConfiguration sfile = (FileConfiguration)YamlConfiguration.loadConfiguration(s);
- final Player p = event.getPlayer();
- final int l = Levels.getLevel(p.getName());
- final String pl = p.getName();
- if (!main.ClanChatBoolean(p)) {
- event.setCancelled(true);
- for (final Player player : Bukkit.getOnlinePlayers()) {
- player.sendMessage("§c" + l + "ур §e[" + main.ClanName(p) + "§e] §c" + pl + "§e : §7" + event.getMessage());
- }
- }
- else {
- event.setCancelled(true);
- final String clan = main.ClanName(p);
- for (final Player player2 : Bukkit.getOnlinePlayers()) {
- if (main.ClanName(player2).equals(clan)) {
- player2.sendMessage(sfile.getString("clan_chat.format").replaceAll("&", "§").replaceAll("%clan%", clan).replaceAll("%player%", p.getName()).replaceAll("%message%", event.getMessage()));
- }
- }
- }
- }
- @EventHandler
- public void onPlayerQuit(final PlayerQuitEvent e) {
- e.setQuitMessage((String)null);
- final Player p = e.getPlayer();
- this.lastSneak.remove(p);
- final ActionBar actionbar = new ActionBar("§c- §a" + p.getName() + " §eвышел с сервера");
- final int online = Bukkit.getOnlinePlayers().size();
- for (final Player pl : Bukkit.getOnlinePlayers()) {
- actionbar.sendToPlayer(pl);
- this.createTabInfo(pl, Levels.getTab(1) + online + Levels.getTab(2), Levels.getTab(3));
- }
- }
- @EventHandler
- public void onPlayerKick(final PlayerKickEvent event) {
- final Player p = event.getPlayer();
- final ActionBar actionbar = new ActionBar("§c- §a" + p.getName() + " §eвышел с сервера");
- final int online = Bukkit.getOnlinePlayers().size();
- for (final Player pl : Bukkit.getOnlinePlayers()) {
- actionbar.sendToPlayer(pl);
- this.createTabInfo(pl, Levels.getTab(1) + online + Levels.getTab(2), Levels.getTab(3));
- }
- event.setLeaveMessage((String)null);
- try {
- if (p.isBanned()) {
- event.setLeaveMessage((String)null);
- }
- }
- catch (NullPointerException e1) {
- event.setLeaveMessage((String)null);
- }
- }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onLoginEvent(final PlayerLoginEvent e) {
- final Player player = e.getPlayer();
- final String name = player.getName().toLowerCase();
- if (player == null) {
- return;
- }
- if (name.length() > 16 || name.length() < 3) {
- e.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Придумайте другой ник, от 3 до 16 символов");
- return;
- }
- if (!player.getName().matches("[a-zA-Z0-9_]*") || name.equalsIgnoreCase("Player")) {
- e.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Некоретный ник, разрешенные символы a-z A-Z 0-9 _");
- }
- }
- @EventHandler
- public void changeworld(final PlayerChangedWorldEvent e) {
- final World w = e.getPlayer().getLocation().getWorld();
- final Player p = e.getPlayer();
- if (w == Bukkit.getWorld("world")) {
- p.setGameMode(GameMode.ADVENTURE);
- }
- else if (w == Bukkit.getWorld("world_skyblock")) {
- p.setGameMode(GameMode.SURVIVAL);
- }
- }
- @EventHandler
- public void onPlayerJoin(final PlayerJoinEvent event) {
- event.setJoinMessage((String)null);
- final Player p = event.getPlayer();
- p.setGameMode(GameMode.ADVENTURE);
- final String name = p.getName();
- createBoard(p);
- new SchedulerLogin(p).runTaskTimer((Plugin)this, 0L, 5L);
- if (WarnRPG.statichasGameOver(p)) {
- p.teleport(new Location(Bukkit.getWorld("world"), 1053.5, 64.5, 325.5, 179.5f, 8.7f));
- }
- else {
- p.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.0, 118.5, -179.1f, 3.9f));
- }
- final ActionBar actionbar = new ActionBar("§c+ §a" + p.getName() + " §eзашел на сервер");
- final int online = Bukkit.getOnlinePlayers().size();
- for (final Player pl : Bukkit.getOnlinePlayers()) {
- actionbar.sendToPlayer(pl);
- this.createTabInfo(pl, Levels.getTab(1) + online + Levels.getTab(2), Levels.getTab(3));
- }
- if (!p.hasPlayedBefore()) {
- Bukkit.getScheduler().runTaskLater((Plugin)this, () -> ShopMenu.onTutorial(p), 140L);
- addAttr(p, "DAMAGE", "1", "mainhand", ShopItems.SISworld(0, false));
- }
- }
- public void onLoginMsg(final Player p) {
- p.getWorld().playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f);
- p.sendMessage(" §e§lСинхронизация");
- p.sendMessage(" ");
- p.sendMessage("§aОбновление от 13.07.19");
- p.sendMessage("§7- Шифт + ПКМ по игроку, просмотреть информацию");
- p.sendMessage("§7- В магазин добавлена печать нерушимости и стойкости");
- p.sendMessage(" ");
- }
- public void createTabInfo(final Player p, final String header, final String footer) {
- final CraftPlayer craftplayer = (CraftPlayer)p;
- final PlayerConnection connection = craftplayer.getHandle().playerConnection;
- final IChatBaseComponent headerJSON = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + header + "\"}");
- final IChatBaseComponent footerJSON = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + footer + "\"}");
- final PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
- try {
- final Field headerField = packet.getClass().getDeclaredField("a");
- headerField.setAccessible(true);
- headerField.set(packet, headerJSON);
- headerField.setAccessible(!headerField.isAccessible());
- final Field footerField = packet.getClass().getDeclaredField("b");
- footerField.setAccessible(true);
- footerField.set(packet, footerJSON);
- footerField.setAccessible(!footerField.isAccessible());
- }
- catch (Exception ex) {}
- connection.sendPacket((Packet)packet);
- }
- public void onDisable() {
- this.saveConfig();
- this.saveConfigs((YamlConfiguration)Main.c);
- }
- static NBTTagList getAttrList(final net.minecraft.server.v1_12_R1.ItemStack stack) {
- if (stack.getTag() == null) {
- stack.setTag(new NBTTagCompound());
- }
- final NBTTagList attrmod;
- if ((attrmod = stack.getTag().getList("AttributeModifiers", 10)) == null) {
- stack.getTag().set("AttributeModifiers", (NBTBase)new NBTTagList());
- }
- return stack.getTag().getList("AttributeModifiers", 10);
- }
- static void addAttr(final Player player, final String name, final String num, final String mesto, final ItemStack item) {
- int op = -1;
- final Attributes a = get(name);
- if (a == null) {
- player.sendMessage("\"§4" + name + "\" is not a valid attribute type.");
- return;
- }
- double amount = 0.0;
- try {
- amount = Double.parseDouble(num);
- }
- catch (NumberFormatException nfe) {
- player.sendMessage("\"§4" + num + "\" is not a valid number.");
- return;
- }
- final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
- final NBTTagList attrmod = getAttrList(nms);
- for (int i = 0; i < attrmod.size(); ++i) {
- final NBTTagCompound c = attrmod.get(i);
- if (c.getString("Name").equals(name)) {
- player.sendMessage("§4An attribute with the name \"§f" + name + "\"§4 already exists!");
- return;
- }
- }
- final NBTTagCompound c = new NBTTagCompound();
- c.set("Name", (NBTBase)new NBTTagString(name));
- c.set("AttributeName", (NBTBase)new NBTTagString(a.name));
- c.set("Amount", (NBTBase)new NBTTagDouble(amount));
- if (op == -1) {
- op = a.op;
- }
- c.set("Operation", (NBTBase)new NBTTagInt(op));
- final UUID randUUID = UUID.randomUUID();
- c.set("UUIDMost", (NBTBase)new NBTTagLong(randUUID.getMostSignificantBits()));
- c.set("UUIDLeast", (NBTBase)new NBTTagLong(randUUID.getLeastSignificantBits()));
- c.set("Slot", (NBTBase)new NBTTagString(mesto.toLowerCase()));
- attrmod.add((NBTBase)c);
- nms.getTag().set("AttributeModifiers", (NBTBase)attrmod);
- final CraftItemStack i2 = CraftItemStack.asCraftMirror(nms);
- player.getInventory().addItem(new ItemStack[] { (ItemStack)i2 });
- }
- public static ItemStack addAttrDrop(final String name, final String num, final String mesto, final ItemStack item) {
- int op = -1;
- final Attributes a = get(name);
- double amount = 0.0;
- try {
- amount = Double.parseDouble(num);
- }
- catch (NumberFormatException ex) {}
- final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
- final NBTTagList attrmod = getAttrList(nms);
- for (int i = 0; i < attrmod.size(); ++i) {
- final NBTTagCompound c = attrmod.get(i);
- if (c.getString("Name").equals(name)) {}
- }
- final NBTTagCompound c = new NBTTagCompound();
- c.set("Name", (NBTBase)new NBTTagString(name));
- c.set("AttributeName", (NBTBase)new NBTTagString(a.name));
- c.set("Amount", (NBTBase)new NBTTagDouble(amount));
- if (op == -1) {
- op = a.op;
- }
- c.set("Operation", (NBTBase)new NBTTagInt(op));
- final UUID randUUID = UUID.randomUUID();
- c.set("UUIDMost", (NBTBase)new NBTTagLong(randUUID.getMostSignificantBits()));
- c.set("UUIDLeast", (NBTBase)new NBTTagLong(randUUID.getLeastSignificantBits()));
- c.set("Slot", (NBTBase)new NBTTagString(mesto.toLowerCase()));
- attrmod.add((NBTBase)c);
- nms.getTag().set("AttributeModifiers", (NBTBase)attrmod);
- final CraftItemStack i2 = CraftItemStack.asCraftMirror(nms);
- return (ItemStack)i2;
- }
- static ItemStack attrRemove(final ItemStack item, final String string) {
- final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
- final NBTTagList attrmod = getAttrList(nms);
- final NBTTagList nlist = new NBTTagList();
- boolean r = false;
- for (int i = 0; i < attrmod.size(); ++i) {
- final NBTTagCompound c = attrmod.get(i);
- if (!c.getString("Name").equals(string)) {
- nlist.add((NBTBase)attrmod.get(i));
- }
- else {
- r = true;
- }
- }
- nms.getTag().set("AttributeModifiers", (NBTBase)nlist);
- final CraftItemStack i2 = CraftItemStack.asCraftMirror(nms);
- return (ItemStack)i2;
- }
- static int attrList(final Player player, final String[] args) {
- final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(player.getInventory().getItemInMainHand());
- final NBTTagList attrmod = getAttrList(nms);
- if (attrmod.size() == 0) {
- return 0;
- }
- for (int i = 0; i < attrmod.size(); ++i) {
- final NBTTagCompound c = attrmod.get(i);
- player.sendMessage(i + "");
- player.sendMessage("§e" + getByMCName(c.getString("AttributeName")) + ", " + c.getDouble("Amount"));
- }
- return 0;
- }
- private static void listOptions(final Player player) {
- final ArrayList<String> options = new ArrayList<String>();
- options.add("mainhand");
- options.add("offhand");
- options.add("feet");
- options.add("legs");
- options.add("chest");
- options.add("head");
- final StringBuilder sb = new StringBuilder();
- for (final String s : options) {
- if (sb.length() > 0) {
- sb.append(", ");
- }
- sb.append(s);
- }
- player.sendMessage("§2Supported options: ");
- player.sendMessage("§e" + sb.toString());
- }
- static void attrListAll(final Player player, final String[] args) {
- player.sendMessage("§2Supported attribute types: ");
- final StringBuilder sb = new StringBuilder();
- for (final Attributes s : Attributes.values()) {
- if (sb.length() > 0) {
- sb.append(", ");
- }
- sb.append(s);
- }
- player.sendMessage("§e" + sb.toString());
- }
- public void saveConfigs(final YamlConfiguration c) {
- try {
- c.save(new File(this.getDataFolder(), "config.yml"));
- }
- catch (IOException ex) {}
- }
- @EventHandler
- public void onIntercactDG(final PlayerInteractEvent e) {
- final Player p = e.getPlayer();
- final ItemStack hand = p.getInventory().getItemInMainHand();
- final ItemStack hand2 = p.getInventory().getItemInOffHand();
- 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Прокачка для брони"))) {
- final boolean spamhas = this.antispam.contains(p.getName());
- if (!spamhas) {
- if (hand.getItemMeta().getDisplayName().equals("§cПрокачка для оружия")) {
- if (p.getInventory().getItemInOffHand().getType() != Material.AIR) {
- ShopMenu.YesUpgrade(p);
- }
- e.setCancelled(true);
- }
- else if (hand.getItemMeta().getDisplayName().equals("§aПрокачка для брони")) {
- if (p.getInventory().getItemInOffHand().getType() != Material.AIR) {
- ShopMenu.YesUpgradeHP(p);
- }
- e.setCancelled(true);
- }
- }
- else {
- p.sendMessage("§7▸ §cВы уже прокачиваете предмет! Дождитесь завершение прокачки!");
- }
- }
- }
- @EventHandler
- public void onClick(final PlayerInteractEvent e) {
- final Player p = e.getPlayer();
- final ItemStack i = p.getItemInHand();
- if (e.getClickedBlock() == null) {
- return;
- }
- if (e.getClickedBlock().getType() == null) {
- return;
- }
- if (e.getAction() == null) {
- return;
- }
- if (i == null) {
- return;
- }
- if (e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getType() == Material.ENCHANTMENT_TABLE) {
- p.chat("/bag");
- e.setCancelled(true);
- }
- if (e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getType() == Material.ANVIL) {
- p.sendTitle("§cНедостаточно навыков", "§cК сожалению вы не Кузнец");
- e.setCancelled(true);
- }
- }
- @EventHandler
- public void onRightClick(final PlayerInteractEntityEvent e) {
- final Entity entity = e.getRightClicked();
- if (entity.getType().equals((Object)EntityType.PLAYER)) {
- final Player ep = (Player)e.getRightClicked();
- final Player p = e.getPlayer();
- if (p.isSneaking()) {
- ShopMenu.onPlayerInfo(p, ep);
- }
- }
- }
- @EventHandler(priority = EventPriority.NORMAL)
- public void onJoinNewLocation(final RegionEnterEvent e) {
- final Player p = e.getPlayer();
- final int l = Levels.getLevel(p.getName());
- if (e.getRegion().getId().equals("l2")) {
- if (l < 2) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c2");
- }
- }
- else if (e.getRegion().getId().equals("l3")) {
- if (l < 3) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c3");
- }
- }
- else if (e.getRegion().getId().equals("l4")) {
- if (l < 4) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c4");
- }
- }
- else if (e.getRegion().getId().equals("l5")) {
- if (l < 5) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c5");
- }
- }
- else if (e.getRegion().getId().equals("l6")) {
- if (l < 6) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c6");
- }
- }
- else if (e.getRegion().getId().equals("l7")) {
- if (l < 7) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c7");
- }
- }
- else if (e.getRegion().getId().equals("l8")) {
- if (l < 8) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c8");
- }
- }
- else if (e.getRegion().getId().equals("l9")) {
- if (l < 9) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c9");
- }
- }
- else if (e.getRegion().getId().equals("l10")) {
- if (l < 10) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c10");
- }
- }
- else if (e.getRegion().getId().equals("l11")) {
- if (l < 11) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c11");
- }
- }
- else if (e.getRegion().getId().equals("l12")) {
- if (l < 12) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c12");
- }
- }
- else if (e.getRegion().getId().equals("l13")) {
- if (l < 13) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c13");
- }
- }
- else if (e.getRegion().getId().equals("l14")) {
- if (l < 14) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c14");
- }
- }
- else if (e.getRegion().getId().equals("l15")) {
- if (l < 15) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c15");
- }
- }
- else if (e.getRegion().getId().equals("l16")) {
- if (l < 16) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c16");
- }
- }
- else if (e.getRegion().getId().equals("l17")) {
- if (l < 17) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c17");
- }
- }
- else if (e.getRegion().getId().equals("l18")) {
- if (l < 18) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c18");
- }
- }
- else if (e.getRegion().getId().equals("l19")) {
- if (l < 19) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c19");
- }
- }
- else if (e.getRegion().getId().equals("l20")) {
- if (l < 20) {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c20");
- }
- }
- else if (e.getRegion().getId().equals("p2-l1")) {
- if (l >= 25) {
- p.teleport(new Location(Bukkit.getWorld("world"), 77.7, 29.0, 1209.2, 93.6f, 0.2f));
- }
- else {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c25");
- }
- }
- else if (e.getRegion().getId().equals("p2-l2")) {
- if (l >= 27) {
- p.teleport(new Location(Bukkit.getWorld("world"), 34.4, 29.0, 1193.3, 117.2f, 0.3f));
- }
- else {
- e.setCancelled(true);
- p.sendTitle("§cДоступ закрыт", "§eДостигните уровня: §c27");
- }
- }
- }
- public static void sUpgrade(final Player p) {
- final ItemStack i2 = p.getInventory().getItemInOffHand();
- final ItemStack j = p.getInventory().getItemInMainHand();
- final String s = p.getInventory().getItemInOffHand().getItemMeta().getLore().get(3).toString();
- final String ss = "§7Прокачка: §8нет";
- final String pech = p.getInventory().getItemInOffHand().getItemMeta().getDisplayName();
- if (!s.equals(ss)) {
- p.sendTitle("§aОшибка", "§eДанный предмет нельзя прокачать!");
- }
- else {
- final String string;
- final String si = string = p.getInventory().getItemInMainHand().getItemMeta().getLore().get(2).toString();
- switch (string) {
- case "§7Прокачка: §6I": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeIS(p, j, i2, 2, si);
- break;
- }
- if (uRandom(100)) {
- UpgradeIS(p, j, i2, 2, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6II": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeIS(p, j, i2, 4, si);
- break;
- }
- if (uRandom(90)) {
- UpgradeIS(p, j, i2, 4, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6III": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeIS(p, j, i2, 8, si);
- break;
- }
- if (uRandom(80)) {
- UpgradeIS(p, j, i2, 8, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6IV": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeIS(p, j, i2, 9, si);
- break;
- }
- if (uRandom(70)) {
- UpgradeIS(p, j, i2, 9, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6V": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeIS(p, j, i2, 11, si);
- break;
- }
- if (uRandom(60)) {
- UpgradeIS(p, j, i2, 11, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6VI": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeIS(p, j, i2, 14, si);
- break;
- }
- if (uRandom(50)) {
- UpgradeIS(p, j, i2, 14, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6VII": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeIS(p, j, i2, 17, si);
- break;
- }
- if (uRandom(40)) {
- UpgradeIS(p, j, i2, 17, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6VIII": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeIS(p, j, i2, 19, si);
- break;
- }
- if (uRandom(30)) {
- UpgradeIS(p, j, i2, 19, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6IX": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeIS(p, j, i2, 22, si);
- break;
- }
- if (uRandom(20)) {
- UpgradeIS(p, j, i2, 22, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6X": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeIS(p, j, i2, 25, si);
- break;
- }
- if (uRandom(10)) {
- UpgradeIS(p, j, i2, 25, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- }
- }
- }
- public static void sUpgradeHP(final Player p) {
- final ItemStack i2 = p.getInventory().getItemInOffHand();
- final ItemStack j = p.getInventory().getItemInMainHand();
- final String s = p.getInventory().getItemInOffHand().getItemMeta().getLore().get(3).toString();
- final String ss = "§7Прокачка: §9нет";
- final String pech = p.getInventory().getItemInOffHand().getItemMeta().getDisplayName();
- if (!s.equals(ss)) {
- p.sendTitle("§aОшибка", "§eДанный предмет нельзя прокачать!");
- }
- else {
- final String string;
- final String si = string = p.getInventory().getItemInMainHand().getItemMeta().getLore().get(2).toString();
- switch (string) {
- case "§7Прокачка: §6I": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeISHP(p, j, i2, 3, si);
- break;
- }
- if (uRandom(100)) {
- UpgradeISHP(p, j, i2, 3, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6II": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeISHP(p, j, i2, 11, si);
- break;
- }
- if (uRandom(90)) {
- UpgradeISHP(p, j, i2, 11, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6III": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeISHP(p, j, i2, 18, si);
- break;
- }
- if (uRandom(80)) {
- UpgradeISHP(p, j, i2, 18, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6IV": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeISHP(p, j, i2, 21, si);
- break;
- }
- if (uRandom(70)) {
- UpgradeISHP(p, j, i2, 21, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6V": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeISHP(p, j, i2, 29, si);
- break;
- }
- if (uRandom(60)) {
- UpgradeISHP(p, j, i2, 29, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6VI": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeISHP(p, j, i2, 34, si);
- break;
- }
- if (uRandom(50)) {
- UpgradeISHP(p, j, i2, 34, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6VII": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeISHP(p, j, i2, 37, si);
- break;
- }
- if (uRandom(40)) {
- UpgradeISHP(p, j, i2, 37, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6VIII": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeISHP(p, j, i2, 44, si);
- break;
- }
- if (uRandom(30)) {
- UpgradeISHP(p, j, i2, 44, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6IX": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeISHP(p, j, i2, 46, si);
- break;
- }
- if (uRandom(20)) {
- UpgradeISHP(p, j, i2, 46, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- case "§7Прокачка: §6X": {
- if (pech.endsWith("§b [Ⓝ]")) {
- psub(pech, p);
- UpgradeISHP(p, j, i2, 50, si);
- break;
- }
- if (uRandom(10)) {
- UpgradeISHP(p, j, i2, 50, si);
- break;
- }
- DestroyIS(p, j, i2);
- break;
- }
- }
- }
- }
- public static void psub(final String s, final Player p) {
- final String ss = s.substring(0, s.length() - 6);
- final ItemMeta meta = p.getInventory().getItemInOffHand().getItemMeta();
- meta.setDisplayName(ss);
- p.getInventory().getItemInOffHand().setItemMeta(meta);
- }
- public static void DestroyIS(final Player p, final ItemStack i, final ItemStack i2) {
- p.getInventory().setItemInMainHand((ItemStack)null);
- p.getInventory().setItemInOffHand((ItemStack)null);
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
- @Override
- public void run() {
- new Scheduler2(p).runTaskTimer((Plugin)Main.m, 0L, 4L);
- }
- }, 5L);
- }
- public static ItemStack changeLore(final ItemStack item, final int index, final String lore) {
- final ItemMeta meta = item.getItemMeta();
- final List<String> lores = new ArrayList<String>(meta.getLore());
- lores.set(index - 1, lore);
- meta.setLore((List)lores);
- item.setItemMeta(meta);
- return item;
- }
- public static void UpgradeIS(final Player p, final ItemStack i, final ItemStack i2, final int damage, final String book) {
- p.getInventory().setItemInMainHand((ItemStack)null);
- p.getInventory().setItemInOffHand((ItemStack)null);
- final String s = i2.getItemMeta().getLore().get(1).toString();
- changeLore(i2, 2, s + " §6(-" + damage + ")");
- changeLore(i2, 4, book);
- final ItemStack irem = attrRemove(i2, "DAMAGE");
- final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(i2);
- final NBTTagList attrmod = getAttrList(nms);
- final NBTTagCompound c = attrmod.get(0);
- final int dmg = (int)c.getDouble("Amount");
- final String setdamage = damage + dmg + "";
- Main.m.antispam.add(p.getName());
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
- @Override
- public void run() {
- Main.m.antispam.remove(p.getName());
- Main.addAttr(p, "DAMAGE", setdamage, "mainhand", irem);
- }
- }, 48L);
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
- @Override
- public void run() {
- new Scheduler(p).runTaskTimer((Plugin)Main.m, 0L, 4L);
- }
- }, 1L);
- }
- public static void UpgradeISHP(final Player p, final ItemStack i, final ItemStack i2, final int damage, final String book) {
- p.getInventory().setItemInMainHand((ItemStack)null);
- p.getInventory().setItemInOffHand((ItemStack)null);
- final String s = i2.getItemMeta().getLore().get(1).toString();
- changeLore(i2, 2, s + " §6(+" + damage + ")");
- changeLore(i2, 4, book);
- final ItemStack irem = attrRemove(i2, "MAX_HEALTH");
- final net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(i2);
- final NBTTagList attrmod = getAttrList(nms);
- final NBTTagCompound c = attrmod.get(0);
- final int dmg = (int)c.getDouble("Amount");
- final String setdamage = damage + dmg + "";
- Main.m.antispam.add(p.getName());
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
- @Override
- public void run() {
- Main.m.antispam.remove(p.getName());
- if (i2.getType() == Material.LEATHER_CHESTPLATE || i2.getType() == Material.IRON_CHESTPLATE || i2.getType() == Material.GOLD_CHESTPLATE) {
- Main.addAttr(p, "MAX_HEALTH", setdamage, "chest", irem);
- }
- else if (i2.getType() == Material.LEATHER_LEGGINGS || i2.getType() == Material.IRON_LEGGINGS || i2.getType() == Material.GOLD_LEGGINGS) {
- Main.addAttr(p, "MAX_HEALTH", setdamage, "legs", irem);
- }
- if (i2.getType() == Material.LEATHER_BOOTS || i2.getType() == Material.IRON_BOOTS || i2.getType() == Material.GOLD_BOOTS) {
- Main.addAttr(p, "MAX_HEALTH", setdamage, "feet", irem);
- }
- if (i2.getType() == Material.SHIELD) {
- Main.addAttr(p, "MAX_HEALTH", setdamage, "offhand", irem);
- }
- }
- }, 48L);
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, (Runnable)new Runnable() {
- @Override
- public void run() {
- new Scheduler(p).runTaskTimer((Plugin)Main.m, 0L, 4L);
- }
- }, 1L);
- }
- public static boolean uRandom(final int chance) {
- final Random rand = new Random();
- final int number = rand.nextInt(100) + 1;
- return number <= chance;
- }
- @EventHandler
- public void onMobDeath(final EntityDeathEvent e) {
- if (e.getEntity().getKiller() instanceof Player) {
- final String entity = e.getEntity().getCustomName();
- final Player p = e.getEntity().getKiller();
- if (entity == null) {
- return;
- }
- if (entity.startsWith("§c§lBOSS")) {
- Levels.addBoss(p.getName());
- }
- if (entity.startsWith("§c§lMEGA")) {
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, () -> {
- Levels.addDung(p.getName());
- Bukkit.getWorld("world").getBlockAt(94, 87, 107).setType(Material.ENDER_CHEST);
- this.playChestAnimation(1);
- this.openChest();
- return;
- }, 60L);
- }
- if (entity.startsWith("§c§lDUNGEON")) {
- Levels.addDung(p.getName());
- }
- if (entity.startsWith("§c§lLAB")) {
- Levels.addDung(p.getName());
- }
- if (entity.startsWith("§c§lTUTORIAL")) {
- p.teleport(new Location(Bukkit.getWorld("world"), 884.5, 53.0, 102.5, -41.6f, 1.8f));
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm i give " + p.getName() + " xp3drop 15");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mm i give " + p.getName() + " xp3dropboss 5");
- }
- Levels.addMobs(p.getName());
- }
- }
- public static void lvlUP(final String p, final int i) {
- Mainlvl.addStats(p, i);
- }
- public static void BoosterTimer() {
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, () -> {
- Levels.setBoosterNO();
- Bukkit.broadcastMessage("§cВнимание! Глобальный ускоритель опыта закончился! Продлить можно в §6/donate");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline booster 1 &r");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "hd setline booster 2 &r");
- }, 72000L);
- }
- public void openChest() {
- final Location l = new Location(Bukkit.getWorld("world"), 94.5, 87.8, 107.5);
- final World w = Bukkit.getWorld("world");
- w.createExplosion(l.getX(), l.getY(), l.getZ(), 1.0f, false, false);
- final Item sword = w.dropItem(l, addAttrDrop("DAMAGE", "43", "mainhand", ShopItems.ChestItems(1)));
- final Item shield = w.dropItem(l, addAttrDrop("MAX_HEALTH", "28", "offhand", ShopItems.ChestItems(2)));
- final Item uphp = w.dropItem(l, ShopItems.ChestItems(3));
- final Item chestplate = w.dropItem(l, addAttrDrop("MAX_HEALTH", "25", "chest", ShopItems.ChestItems(2)));
- final Item updmg = w.dropItem(l, ShopItems.ChestItems(5));
- final Item updmg2 = w.dropItem(l, ShopItems.ChestItems(6));
- sword.setVelocity(new Vector(1, 0, 0));
- shield.setVelocity(new Vector(0, 1, 0));
- uphp.setVelocity(new Vector(0, 0, 1));
- chestplate.setVelocity(new Vector(-1, 0, 0));
- updmg.setVelocity(new Vector(0, -1, 0));
- updmg.setVelocity(new Vector(0, 0, -1));
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, () -> this.playChestAnimation(0), 100L);
- final World world = null;
- final Location location = null;
- Bukkit.getScheduler().runTaskLater((Plugin)Main.m, () -> {
- world.createExplosion(location.getX(), location.getY(), location.getZ(), 1.0f, false, false);
- Bukkit.getWorld("world").getBlockAt(94, 87, 107).setType(Material.AIR);
- }, 120L);
- }
- private void playChestAnimation(final int state) {
- ((CraftWorld)Bukkit.getWorld("world")).getHandle().playBlockAction(new BlockPosition(94, 87, 107), CraftMagicNumbers.getBlock(Material.ENDER_CHEST), 1, state);
- }
- private void onEffectSpark(final Player p, final Effect e) {
- p.getLocation().getWorld().playEffect(p.getLocation().add(0.6, 2.0, 0.0), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(0.55, 2.0, 0.23), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(0.45, 2.0, 0.45), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(0.23, 2.0, 0.55), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(0.0, 2.0, 0.6), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(-0.23, 2.0, 0.55), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(-0.45, 2.0, 0.45), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(-0.55, 2.0, 0.23), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(-0.6, 2.0, 0.0), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(-0.55, 2.0, -0.23), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(-0.45, 2.0, -0.45), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(-0.23, 2.0, -0.55), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(0.0, 2.0, -0.6), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(0.23, 2.0, -0.55), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(0.45, 2.0, -0.45), e, 1);
- p.getLocation().getWorld().playEffect(p.getLocation().add(0.55, 2.0, -0.23), e, 1);
- }
- @EventHandler
- private void onSposobnosty(final PlayerToggleSneakEvent e) {
- if (!e.isSneaking()) {
- return;
- }
- final long current = System.currentTimeMillis();
- final Long previous = this.lastSneak.put(e.getPlayer(), current);
- if (previous == null) {
- return;
- }
- if (current - previous > 500L) {
- return;
- }
- final Player p = e.getPlayer();
- final String spo = Levels.getSpo(e.getPlayer().getName());
- if (spo.equalsIgnoreCase("null")) {
- return;
- }
- if (p.getFoodLevel() == 0) {
- return;
- }
- final int f = p.getFoodLevel();
- final String s = spo;
- switch (s) {
- case "inv": {
- if (f >= 2) {
- this.onEffectSpark(p, Effect.SMOKE);
- p.setFoodLevel(f - 2);
- p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 200, 1));
- break;
- }
- break;
- }
- case "reg": {
- if (f >= 3) {
- this.onEffectSpark(p, Effect.HEART);
- p.setFoodLevel(f - 3);
- p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 1));
- break;
- }
- break;
- }
- case "bomba": {
- if (f >= 4) {
- p.setFoodLevel(f - 4);
- this.onEffectSpark(p, Effect.BLAZE_SHOOT);
- for (final Entity entity : p.getNearbyEntities(3.0, 3.0, 3.0)) {
- if (entity.getType() != EntityType.PLAYER) {
- entity.setVelocity(entity.getLocation().getDirection().setY(-1).multiply(-1.2));
- }
- }
- break;
- }
- break;
- }
- case "rivok": {
- if (f >= 2) {
- p.setFoodLevel(f - 2);
- this.onEffectSpark(p, Effect.FIREWORKS_SPARK);
- p.setVelocity(p.getLocation().getDirection().multiply(2).setY(-1.5));
- break;
- }
- break;
- }
- case "hil": {
- if (f >= 5) {
- p.setFoodLevel(f - 5);
- this.onEffectSpark(p, Effect.PORTAL);
- for (final Entity entity : p.getNearbyEntities(5.0, 5.0, 5.0)) {
- if (entity.getType() == EntityType.PLAYER) {
- final Player pl = (Player)entity;
- pl.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 1));
- }
- }
- break;
- }
- break;
- }
- }
- }
- @EventHandler
- public void onEFFECTSWORD(final EntityDamageByEntityEvent e) {
- final Entity damager = e.getDamager();
- final LivingEntity entity = (LivingEntity)e.getEntity();
- if (damager instanceof Player) {
- final Player p = (Player)damager;
- if (p.getInventory() == null) {
- return;
- }
- if (p.getInventory().getItemInMainHand() == null) {
- return;
- }
- if (p.getInventory().getItemInMainHand().getItemMeta() == null) {
- return;
- }
- if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName() == null) {
- return;
- }
- final String item = p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().toString();
- if (!(entity instanceof Player)) {
- if (item.startsWith("§aПаралакс §8[§e14ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 60, 1));
- }
- if (item.startsWith("§aКсаркс §8[§e15ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 60, 1));
- }
- if (item.startsWith("§aМаларис §8[§e17ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 1));
- }
- if (item.startsWith("§aОникс §8[§e25ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 1));
- }
- if (item.startsWith("§aТоксик §8[§e12ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 60, 1));
- entity.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 60, 1));
- }
- if (item.startsWith("§aКсар §8[§e15ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 1));
- entity.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 60, 1));
- }
- if (item.startsWith("§aЭкскалибурc §8[§e10ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 1));
- }
- if (item.startsWith("§aСайгер §8[§e9ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 1));
- }
- if (item.startsWith("§aГолден §8[§e20ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 60, 1));
- }
- if (item.startsWith("§aЗалфир §8[§e10ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 60, 1));
- }
- if (item.startsWith("§aЛоли §8[§e8ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 60, 1));
- }
- if (item.startsWith("§aОмега §8[§e27ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 1));
- entity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
- }
- if (item.startsWith("§aМеч Крона §8[§e15ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 1));
- }
- if (item.startsWith("§aЯгура §8[§e15ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
- }
- if (item.startsWith("§aДемонический клинок §8[§e8ур§8]")) {
- entity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
- entity.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 60, 1));
- entity.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 1));
- entity.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 60, 1));
- }
- }
- }
- }
- public void onChances(final Player p) {
- if (new Random().nextFloat() < 0.01) {
- addAttr(p, "DAMAGE", "34", "mainhand", ShopItems.SIDropSword(1));
- }
- else if (new Random().nextFloat() < 0.09) {
- addAttr(p, "DAMAGE", "30", "mainhand", ShopItems.SIDropSword(8));
- }
- else if (new Random().nextFloat() < 0.15) {
- addAttr(p, "DAMAGE", "44", "mainhand", ShopItems.SIDropSword(11));
- }
- else if (new Random().nextFloat() < 0.17) {
- addAttr(p, "DAMAGE", "26", "mainhand", ShopItems.SIDropSword(17));
- }
- else if (new Random().nextFloat() < 0.2) {
- addAttr(p, "DAMAGE", "23", "mainhand", ShopItems.SIDropSword(18));
- }
- else if (new Random().nextFloat() < 0.25) {
- addAttr(p, "DAMAGE", "20", "mainhand", ShopItems.SIDropSword(171));
- }
- else if (new Random().nextFloat() < 0.3) {
- addAttr(p, "DAMAGE", "18", "mainhand", ShopItems.SIDropSword(412));
- }
- else if (new Random().nextFloat() < 0.4) {
- addAttr(p, "DAMAGE", "23", "mainhand", ShopItems.SIDropSword(41));
- }
- else if (new Random().nextFloat() < 0.45) {
- addAttr(p, "DAMAGE", "10", "mainhand", ShopItems.SIDropSword(411));
- }
- else if (new Random().nextFloat() < 0.5) {
- addAttr(p, "DAMAGE", "17", "mainhand", ShopItems.SIDropSword(42));
- }
- else if (new Random().nextFloat() < 0.6) {
- addAttr(p, "DAMAGE", "29", "mainhand", ShopItems.SIDropSword(81));
- }
- else if (new Random().nextFloat() < 0.7) {
- addAttr(p, "DAMAGE", "11", "mainhand", ShopItems.SIDropSword(861));
- }
- else if (new Random().nextFloat() < 0.8) {
- addAttr(p, "DAMAGE", "21", "mainhand", ShopItems.SIDropSword(86));
- }
- else if (new Random().nextFloat() < 0.85) {
- addAttr(p, "DAMAGE", "14", "mainhand", ShopItems.SIDropSword(862));
- }
- else if (new Random().nextFloat() < 0.9) {
- addAttr(p, "DAMAGE", "12", "mainhand", ShopItems.SIDropSword(87));
- }
- else if (new Random().nextFloat() < 0.95) {
- addAttr(p, "DAMAGE", "7", "mainhand", ShopItems.SIDropSword(82));
- }
- }
- public static int getBal(final Player p) {
- final int coins = Coins.getCoins(p.getName());
- return coins;
- }
- public static boolean sB(final Player p, final int coins) {
- final int getcoin = getBal(p);
- if (getcoin >= coins) {
- Coins.setCoins(p.getName(), getcoin - coins);
- return true;
- }
- return false;
- }
- public static void addBal(final Player p, final int coins) {
- Coins.addCoins(p.getName(), coins);
- }
- public static Main getI() {
- return Main.instance;
- }
- public void onSleep(final PlayerBedEnterEvent e) {
- }
- @EventHandler
- public void onSignChange(final SignChangeEvent e) {
- final Block b = e.getBlock();
- final Player p = e.getPlayer();
- if (main.ClanName(p).equals("")) {
- String input = "";
- for (final String line : e.getLines()) {
- if (line != null && line.length() > 0) {
- input += line;
- }
- }
- if (b.hasMetadata("setName")) {
- if (input.length() > 2) {
- if (input.length() > 6) {
- p.sendMessage("&cНазвание клана слишком длинное!");
- }
- else {
- final String clanname = input;
- p.chat("/clan create " + input);
- b.setType(Material.AIR);
- }
- }
- else {
- p.sendMessage("&cНазвание клана слишком короткое!");
- b.setType(Material.AIR);
- }
- e.setCancelled(true);
- b.removeMetadata("setName", (Plugin)getI());
- b.setType(Material.AIR);
- }
- }
- }
- public void randomEvent() {
- Bukkit.getScheduler().runTaskTimer((Plugin)this, (Runnable)new Runnable() {
- @Override
- public void run() {
- if (Bukkit.getOnlinePlayers().size() >= 2) {
- for (final Player p : Bukkit.getOnlinePlayers()) {
- Main.this.onRandomEvent(p);
- }
- }
- }
- }, 36000L, 36000L);
- }
- public void onRandomEvent(final Player p) {
- final Random r = new Random();
- final int rt = r.nextInt(8) + 1;
- if (rt == 1) {
- p.sendTitle("§eВнезапное событие", "§eВсем игрокам начисленно §a200 монет");
- Main.economy.depositPlayer((OfflinePlayer)p, 200.0);
- }
- if (rt == 2) {
- p.sendTitle("§eВнезапное событие", "§eВсе игроки перемещены на §aспавн!");
- p.teleport(new Location(Bukkit.getWorld("world"), 94.5, 88.5, 118.5, -179.1f, 3.9f));
- p.setGameMode(GameMode.ADVENTURE);
- }
- if (rt == 3) {
- p.sendTitle("§eВнезапное событие", "§eВсе игроки получают замедление!");
- p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1200, 1));
- }
- if (rt == 4) {
- p.sendTitle("§eВнезапное событие", "§eВсе игроки ослеплены!");
- p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1200, 1));
- }
- if (rt == 5) {
- p.sendTitle("§eВнезапное событие", "§eВсе игроки получают ключ от сундука!");
- Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "case give " + p.getName() + " 1");
- }
- if (rt == 6) {
- p.sendTitle("§eВнезапное событие", "§eВсе игроки получают ускорение!");
- p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1200, 2));
- }
- if (rt == 7) {
- p.sendTitle("§eВнезапное событие", "§eВсе игроки получают неуязвимость!");
- p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 2));
- }
- if (rt == 8) {
- p.sendTitle("§eВнезапное событие", "§eВсем игрокам начисленно §a250 монет");
- Main.economy.depositPlayer((OfflinePlayer)p, 250.0);
- }
- }
- static {
- Main.boss1 = new ArrayList<Player>();
- Main.boss2 = new ArrayList<Player>();
- Main.boss3 = new ArrayList<Player>();
- Main.inpvp = new ArrayList<String>();
- Main.arenalab = new ArrayList<Player>();
- Main.arenalog = new ArrayList<Player>();
- expclan = new HashMap<String, Integer>();
- Main.count = 0;
- Main.login = 0;
- Main.bosslevels = 0;
- Main.counts = 0;
- Main.instance = null;
- Main.economy = null;
- }
- private enum Attributes
- {
- DAMAGE(0, "generic.attackDamage"),
- MOVEMENT_SPEED(2, "generic.movementSpeed"),
- ATTACK_SPEED(2, "generic.attackSpeed"),
- KNOCKBACK_RESISTANCE(2, "generic.knockbackResistance"),
- MAX_HEALTH(0, "generic.maxHealth"),
- ARMOR(0, "generic.armor"),
- LUCK(0, "generic.luck");
- private final int op;
- private final String name;
- private Attributes(final int op, final String name) {
- this.op = op;
- this.name = name;
- }
- private static Attributes get(final String s) {
- for (final Attributes a : values()) {
- if (a.name().toLowerCase().equalsIgnoreCase(s)) {
- return a;
- }
- }
- return null;
- }
- private static Attributes getByMCName(final String s) {
- for (final Attributes a : values()) {
- if (a.name.equalsIgnoreCase(s)) {
- return a;
- }
- }
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment