|
@EventHandler |
|
public void onJoin(PlayerJoinEvent e) { |
|
this.getServer().dispatchCommand(this.getServer().getConsoleSender(), "tp " + e.getPlayer().getName() + " 0 100 0"); |
|
Inventory inv = e.getPlayer().getInventory(); |
|
inv.setItem(8, ItemUtil.createItem(Material.BARRIER, "§cВыйти")); |
|
inv.setItem(1, ItemUtil.createItem(Material.COMMAND_MINECART, "§aВыбор кита", "§ayа свой вкус")); |
|
int nick = e.getPlayer().getName().length(); |
|
e.getPlayer().setDisplayName(ChatColor.RED + e.getPlayer().getName()); |
|
e.getPlayer().setPlayerListName("§c§k" + nick); |
|
this.board = Bukkit.getScoreboardManager().getMainScoreboard(); |
|
this.obj = this.board.registerNewObjective(e.getPlayer().getName(), "dummy"); |
|
final Score players1 = this.obj.getScore("Players " + this.getServer().getOnlinePlayers().size()); |
|
(new BukkitRunnable() { |
|
int i; |
|
|
|
public void run() { |
|
++this.i; |
|
if (this.i == 20) { |
|
SpeedUltraHardcore4.this.getServer().dispatchCommand(SpeedUltraHardcore4.this.getServer().getConsoleSender(), "tell @a " + this.i); |
|
players1.setScore(2); |
|
SpeedUltraHardcore4.this.obj.setDisplayName("§6" + ChatColor.BOLD + "UHC"); |
|
this.cancel(); |
|
} |
|
|
|
} |
|
}).runTaskTimer(this, 20L, 1L); |
|
this.obj.setDisplaySlot(DisplaySlot.SIDEBAR); |
|
e.setJoinMessage(ChatColor.BOLD + "§eИгрок " + e.getPlayer().getName() + "§l§eПрисоединился§r§c(" + this.getServer().getOnlinePlayers().size() + "/" + this.getServer().getMaxPlayers() + ")"); |
|
} |
|
|
|
@EventHandler |
|
public void onleave(PlayerQuitEvent e) { |
|
this.getServer().dispatchCommand(this.getServer().getConsoleSender(), "scoreboard objectives remove " + e.getPlayer().getName()); |
|
e.setQuitMessage("§e§lИгрок " + e.getPlayer().getName() + "§e§lВышел§r§c(" + this.getServer().getOnlinePlayers().size() + "/" + this.getServer().getMaxPlayers()); |
|
e.getPlayer().getInventory().clear(); |
|
} |
|
|
|
public void onDisable() { |
|
this.getServer().getPluginManager().disablePlugin(this); |
|
} |
|
|
|
@EventHandler |
|
public void oniteract(PlayerInteractEvent e) { |
|
if (e.getAction() == Action.RIGHT_CLICK_AIR && e.getItem().getType() == Material.BARRIER) { |
|
e.getPlayer().getInventory().clear(); |
|
e.getPlayer().kickPlayer(""); |
|
e.setCancelled(true); |
|
} |
|
|
|
} |
|
|
|
@EventHandler |
|
public void onKit(PlayerInteractEvent e) { |
|
Player p = e.getPlayer(); |
|
if (e.getAction().equals(Action.RIGHT_CLICK_AIR) && e.getPlayer().getItemInHand().getType() == Material.COMMAND_MINECART) { |
|
OpenGUI(p); |
|
} |
|
|
|
} |
|
|
|
public static void OpenGUI(Player p) { |
|
Inventory kits = Bukkit.createInventory((InventoryHolder)null, 27, "§cВыбор кита"); |
|
ItemStack Sa = ItemUtil.createItem(Material.STONE_PICKAXE, "§bStone age", "§cПокачто так"); |
|
kits.setItem(1, Sa); |
|
kits.setItem(25, ItemUtil.createItem(Material.BARRIER, "§cвийти")); |
|
p.openInventory(kits); |
|
} |
|
|
|
@EventHandler |
|
public void INVS(InventoryClickEvent e) { |
|
Player p = (Player)e.getWhoClicked(); |
|
if (e.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY && e.getInventory().getName().equalsIgnoreCase("§cВыбор кита")) { |
|
e.setCancelled(true); |
|
if (e.getCurrentItem().getType() == Material.BARRIER) { |
|
p.closeInventory(); |
|
} |
|
} |
|
|
|
} |
|
|
|
@EventHandler |
|
public void onKill(EntityDeathEvent e) { |
|
if (e.getEntityType() == EntityType.PLAYER) { |
|
e.getDrops().add(ItemUtil.createItem(Material.GOLDEN_APPLE, "§6§lЗолотая голова")); |
|
e.setDroppedExp(100); |
|
double x = e.getEntity().getLocation().getX(); |
|
double ys = e.getEntity().getLocation().getY(); |
|
double y = ys + 10.0D; |
|
double z = e.getEntity().getLocation().getZ(); |
|
this.getServer().dispatchCommand(this.getServer().getConsoleSender(), "summon LightningBolt " + e.getEntity().getLocation().getX() + " " + y + 10 + " " + e.getEntity().getLocation().getZ()); |
|
this.getServer().broadcastMessage("§l§cИгрок " + e.getEntity().getKiller().getName() + " убил игрока " + e.getEntity().getName()); |
|
} |
|
|
|
} |
|
|
|
@EventHandler |
|
public void onHead(PlayerInteractEvent e) { |
|
if (e.getAction() == Action.RIGHT_CLICK_AIR && e.getItem().getItemMeta().getDisplayName().equalsIgnoreCase("§6§lЗолотая голова")) { |
|
this.getServer().dispatchCommand(this.getServer().getConsoleSender(), "effect " + e.getPlayer().getName() + " minecraft:speed 10 1 true"); |
|
} |
|
|
|
} |