Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onMobSpawn(CreatureSpawnEvent e) {
- String mobworld = e.getEntity().getWorld().getName();
- List<String> world1 = main.getConfig().getStringList("Enabled-Worlds");
- for (String world2 : world1) {
- if (e.getSpawnReason().equals(SpawnReason.NATURAL)) {
- if (mobworld.equalsIgnoreCase(world2)) {
- e.setCancelled(true);
- } else {}
- }
- }
- }
- public Location loc;
- @EventHandler
- public void onPlayerKillMod(EntityDeathEvent e) {
- e.getDrops().clear();
- e.setDroppedExp(0);
- }
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onPlayerDeath(PlayerDeathEvent e){
- Player p = e.getEntity().getPlayer();
- if (config.getString("Players." + p.getName() + ".Arena") == null) {
- } else {
- try {
- config.load(file);
- } catch (IOException | InvalidConfigurationException e2) {
- e2.printStackTrace();
- }
- e.setDeathMessage("");
- p.sendMessage("§6You left the arena §c" + config.getString("Players." + p.getName() + ".Arena"));
- p.sendMessage("§cGame Ended! Results:");
- p.sendMessage("§7§m+-----------------+");
- p.sendMessage("§6 Points:");
- p.sendMessage(" §a+ " + config.getInt("Players." + p.getName() + ".Last-Game-Points"));
- p.sendMessage(" ");
- p.sendMessage("§6 Total Points:");
- p.sendMessage(" §a " + config.getInt("Players." + p.getName() + ".Total-Points"));
- p.sendMessage("§7§m+-----------------+");
- p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1020, 1000));
- p.removePotionEffect(PotionEffectType.CONFUSION);
- p.playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 1);
- World world = Bukkit.getWorld(config.getString("Lobby.World"));
- double x = config.getDouble("Lobby.X");
- x = x + 0.5;
- double y = config.getDouble("Lobby.Y");
- double z = config.getDouble("Lobby.Z");
- z = z + 0.5;
- int yaw = config.getInt("Lobby.Yaw");
- int pitch = config.getInt("Lobby.Pitch");
- for (Entity entity : p.getWorld().getLivingEntities()) {
- if (entity.getName().equalsIgnoreCase("§cArena: §6" + config.getString("Players." + p.getName() + ".Arena"))) {
- double x1 = entity.getLocation().getBlockX();
- double y1 = entity.getLocation().getBlockY();
- y1 = y1 + 100;
- double z1 = entity.getLocation().getBlockZ();
- entity.teleport(new Location(entity.getWorld(), x1, y1, z1));
- }
- }
- try {
- config.load(file);
- } catch (IOException | InvalidConfigurationException e1) {
- e1.printStackTrace();
- }
- p.teleport(new Location(world, x, y, z, yaw , pitch));
- p.getInventory().clear();
- p.getInventory().setHelmet(null);
- p.getInventory().setChestplate(null);
- p.getInventory().setLeggings(null);
- p.getInventory().setBoots(null);
- int total = config.getInt("Players." + p.getName() + ".Total-Points");
- int toAdd = config.getInt("Players." + p.getName() + ".Last-Game-Points");
- config.set("Players." + p.getName() + ".Total-Points", total + toAdd);
- config.set("Players." + p.getName() + ".Last-Game-Points", 0);
- p.getWorld().playSound(p.getLocation(), Sound.PORTAL_TRAVEL, 1, 1);
- config.set("Players." + p.getName() + ".Arena", null);
- try {
- config.save(file);
- } catch (IOException e2) {
- e2.printStackTrace();
- }
- try {
- config.load(file);
- } catch (IOException | InvalidConfigurationException e1) {
- e1.printStackTrace();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement