Merge branch 'development'

This commit is contained in:
Brianna 2020-05-01 05:40:45 -04:00
commit edcfd1b4f6
6 changed files with 192 additions and 214 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId> <artifactId>skyblock</artifactId>
<version>2.2.19</version> <version>2.2.11</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>
<defaultGoal>clean install</defaultGoal> <defaultGoal>clean install</defaultGoal>

View File

@ -685,7 +685,8 @@ public class IslandManager {
banManager.createIsland(island.getOwnerUUID()); banManager.createIsland(island.getOwnerUUID());
} }
Bukkit.getServer().getPluginManager().callEvent(new IslandLoadEvent(island.getAPIWrapper())); Bukkit.getScheduler().runTask(skyblock, () ->
Bukkit.getServer().getPluginManager().callEvent(new IslandLoadEvent(island.getAPIWrapper())));
return island; return island;
} }

View File

@ -265,40 +265,7 @@ public class Block implements Listener {
if (event.getBlock().getType() == CompatibleMaterial.END_PORTAL_FRAME.getMaterial() if (event.getBlock().getType() == CompatibleMaterial.END_PORTAL_FRAME.getMaterial()
&& event.getPlayer().getItemInHand().getType() == CompatibleMaterial.ENDER_EYE.getMaterial()) return; && event.getPlayer().getItemInHand().getType() == CompatibleMaterial.ENDER_EYE.getMaterial()) return;
// Fix a bug in Paper 1.8.8 when using ViaVersion on a 1.12.2 client. updateLevel(island, blockLoc);
// BUG: Player can infinitely increase their level by placing a block at their
// feet.
// It doesn't take the block away but still increments the level.
// This doesn't happen in Spigot, but does happen in PaperSpigot due to a
// BlockPlaceEvent being incorrectly fired.
// The solution is to wait a tick to make sure that the block was actually
// placed.
// This shouldn't cause any issues besides the task number being increased
// insanely fast.
Bukkit.getScheduler().runTask(skyblock, () -> {
CompatibleMaterial material = CompatibleMaterial.getMaterial(block.getType());
if (material == null || material == CompatibleMaterial.AIR) return;
if (material == CompatibleMaterial.SPAWNER) {
if (Bukkit.getPluginManager().isPluginEnabled("EpicSpawners") || Bukkit.getPluginManager().isPluginEnabled("WildStacker"))
return;
CompatibleSpawners spawner = CompatibleSpawners.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
if (spawner != null)
material = CompatibleMaterial.getBlockMaterial(spawner.getMaterial());
}
long materialAmount = 0;
IslandLevel level = island.getLevel();
if (level.hasMaterial(material.name())) {
materialAmount = level.getMaterialAmount(material.name());
}
level.setMaterialAmount(material.name(), materialAmount + 1);
});
} }
@EventHandler @EventHandler
@ -363,6 +330,7 @@ public class Block implements Listener {
toBlockState.setData(genState.getData()); toBlockState.setData(genState.getData());
toBlockState.setType(genState.getType()); toBlockState.setType(genState.getType());
toBlockState.update(); toBlockState.update();
updateLevel(island, genState.getLocation());
return; return;
} }
} }
@ -588,6 +556,7 @@ public class Block implements Listener {
state.setType(genState.getType()); state.setType(genState.getType());
if (NMSUtil.getVersionNumber() < 13) state.setData(genState.getData()); if (NMSUtil.getVersionNumber() < 13) state.setData(genState.getData());
updateLevel(island, genState.getLocation());
return; return;
} }
} }
@ -672,4 +641,41 @@ public class Block implements Listener {
event.setCancelled(true); event.setCancelled(true);
} }
private void updateLevel(Island island, Location location) {
// Fix a bug in Paper 1.8.8 when using ViaVersion on a 1.12.2 client.
// BUG: Player can infinitely increase their level by placing a block at their
// feet.
// It doesn't take the block away but still increments the level.
// This doesn't happen in Spigot, but does happen in PaperSpigot due to a
// BlockPlaceEvent being incorrectly fired.
// The solution is to wait a tick to make sure that the block was actually
// placed.
// This shouldn't cause any issues besides the task number being increased
// insanely fast.
Bukkit.getScheduler().runTask(skyblock, () -> {
org.bukkit.block.Block block = location.getBlock();
CompatibleMaterial material = CompatibleMaterial.getMaterial(block);
if (material == null || material == CompatibleMaterial.AIR) return;
if (material == CompatibleMaterial.SPAWNER) {
if (Bukkit.getPluginManager().isPluginEnabled("EpicSpawners") || Bukkit.getPluginManager().isPluginEnabled("WildStacker"))
return;
CompatibleSpawners spawner = CompatibleSpawners.getSpawner(((CreatureSpawner) block.getState()).getSpawnedType());
if (spawner != null)
material = CompatibleMaterial.getBlockMaterial(spawner.getMaterial());
}
long materialAmount = 0;
IslandLevel level = island.getLevel();
if (level.hasMaterial(material.name()))
materialAmount = level.getMaterialAmount(material.name());
level.setMaterialAmount(material.name(), materialAmount + 1);
});
}
} }

View File

@ -1,52 +1,32 @@
package com.songoda.skyblock.listeners; package com.songoda.skyblock.listeners;
import java.io.File;
import java.lang.reflect.Method;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.config.FileManager.Config;
import com.songoda.skyblock.island.*;
import com.songoda.skyblock.limit.impl.EntityLimitaton;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.utils.world.entity.EntityUtil;
import com.songoda.skyblock.world.WorldManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Donkey;
import org.bukkit.entity.ElderGuardian;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Evoker;
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Hanging;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Illager;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Llama;
import org.bukkit.entity.Mule;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.entity.Ravager; import org.bukkit.entity.*;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.*;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityTameEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause; import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause;
@ -58,24 +38,9 @@ import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import com.songoda.skyblock.SkyBlock; import java.io.File;
import com.songoda.skyblock.config.FileManager; import java.lang.reflect.Method;
import com.songoda.skyblock.config.FileManager.Config; import java.util.*;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandEnvironment;
import com.songoda.skyblock.island.IslandLevel;
import com.songoda.skyblock.island.IslandManager;
import com.songoda.skyblock.island.IslandRole;
import com.songoda.skyblock.island.IslandWorld;
import com.songoda.skyblock.limit.impl.EntityLimitaton;
import com.songoda.skyblock.message.MessageManager;
import com.songoda.skyblock.sound.SoundManager;
import com.songoda.skyblock.stackable.StackableManager;
import com.songoda.skyblock.upgrade.Upgrade;
import com.songoda.skyblock.utils.version.NMSUtil;
import com.songoda.skyblock.utils.world.LocationUtil;
import com.songoda.skyblock.utils.world.entity.EntityUtil;
import com.songoda.skyblock.world.WorldManager;
public class Entity implements Listener { public class Entity implements Listener {
@ -169,23 +134,23 @@ public class Entity implements Listener {
messageManager.sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")) messageManager.sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Settings.Permission.Message")); .getFileConfiguration().getString("Island.Settings.Permission.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} }
} else { } else {
// Check if it's a monster and player has the permission to damage the entity // Check if it's a monster and player has the permission to damage the entity
// If // If
// If it's not a monster or the player has the permission // If it's not a monster or the player has the permission
if (EntityUtil.isMonster(entity.getType()) && islandManager.hasPermission(player, entity.getLocation(), "MonsterHurting")) { if (EntityUtil.isMonster(entity.getType()) && islandManager.hasPermission(player, entity.getLocation(), "MonsterHurting")) {
// Player has permission to damage the entity // Player has permission to damage the entity
return; return;
} }
// Either the entity is not a monster or the player doesn't have permission so whe check if he has permission to damage mobs // Either the entity is not a monster or the player doesn't have permission so whe check if he has permission to damage mobs
if (!islandManager.hasPermission(player, entity.getLocation(), "MobHurting")) { if (!islandManager.hasPermission(player, entity.getLocation(), "MobHurting")) {
event.setCancelled(true); event.setCancelled(true);
messageManager.sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")) messageManager.sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Settings.Permission.Message")); .getFileConfiguration().getString("Island.Settings.Permission.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
return; return;
} }
@ -217,20 +182,20 @@ public class Entity implements Listener {
event.setCancelled(true); event.setCancelled(true);
} }
} else { } else {
// Check if it's a monster and player has the permission to damage the entity // Check if it's a monster and player has the permission to damage the entity
// If // If
// If it's not a monster or the player has the permission // If it's not a monster or the player has the permission
if (EntityUtil.isMonster(entity.getType()) && islandManager.hasPermission(player, entity.getLocation(), "MonsterHurting")) { if (EntityUtil.isMonster(entity.getType()) && islandManager.hasPermission(player, entity.getLocation(), "MonsterHurting")) {
// Player has permission to damage the entity // Player has permission to damage the entity
return; return;
} }
// Either the entity is not a monster or the player doesn't have permission so whe check if he has permission to damage mobs // Either the entity is not a monster or the player doesn't have permission so whe check if he has permission to damage mobs
if (!islandManager.hasPermission(player, entity.getLocation(), "MobHurting")) { if (!islandManager.hasPermission(player, entity.getLocation(), "MobHurting")) {
event.setCancelled(true); event.setCancelled(true);
messageManager.sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")) messageManager.sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Settings.Permission.Message")); .getFileConfiguration().getString("Island.Settings.Permission.Message"));
soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); soundManager.playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
return; return;
} }
@ -289,14 +254,14 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player, skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration() skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
.getString("Island.Settings.Permission.Message")); .getString("Island.Settings.Permission.Message"));
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} }
} }
} }
/** /**
* Checks that an entity is not targeting another entity on different islands. * Checks that an entity is not targeting another entity on different islands.
* *
* @author LimeGlass * @author LimeGlass
*/ */
@EventHandler @EventHandler
@ -334,7 +299,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")) skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.getFileConfiguration().getString("Island.Settings.Permission.Message")); .getFileConfiguration().getString("Island.Settings.Permission.Message"));
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} }
if (NMSUtil.getVersionNumber() != 8) return; if (NMSUtil.getVersionNumber() != 8) return;
@ -362,7 +327,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player, skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration() skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
.getString("Island.Settings.Permission.Message")); .getString("Island.Settings.Permission.Message"));
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} }
} }
} }
@ -399,7 +364,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player, skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration() skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
.getString("Island.Settings.Permission.Message")); .getString("Island.Settings.Permission.Message"));
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} }
} }
} }
@ -420,7 +385,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player, skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration() skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
.getString("Island.Settings.Permission.Message")); .getString("Island.Settings.Permission.Message"));
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} }
} }
} }
@ -441,7 +406,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player, skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration() skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
.getString("Island.Settings.Permission.Message")); .getString("Island.Settings.Permission.Message"));
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} }
} }
} }
@ -461,7 +426,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player, skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration() skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).getFileConfiguration()
.getString("Island.Settings.Permission.Message")); .getString("Island.Settings.Permission.Message"));
skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F); skyblock.getSoundManager().playSound(player, CompatibleSound.ENTITY_VILLAGER_NO.getSound(), 1.0F, 1.0F);
} }
} }
} }
@ -495,9 +460,9 @@ public class Entity implements Listener {
// nothing // nothing
if ((LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0, 1, 0)) if ((LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0, 1, 0))
|| LocationUtil.isLocationLocation(block.getLocation(), || LocationUtil.isLocationLocation(block.getLocation(),
island.getLocation(world, IslandEnvironment.Visitor).clone().subtract(0, 1, 0))) island.getLocation(world, IslandEnvironment.Visitor).clone().subtract(0, 1, 0)))
&& skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration() && skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration()
.getBoolean("Island.Spawn.Protection")) { .getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -559,7 +524,8 @@ public class Entity implements Listener {
} }
if (event.getTo() != null && event.getTo() != Material.AIR) { if (event.getTo() != null && event.getTo() != Material.AIR) {
materials = CompatibleMaterial.getBlockMaterial(event.getTo());; materials = CompatibleMaterial.getBlockMaterial(event.getTo());
;
if (materials != null) { if (materials != null) {
long materialAmount = 0; long materialAmount = 0;
@ -639,15 +605,16 @@ public class Entity implements Listener {
} }
if (NMSUtil.getVersionNumber() > 9) { if (NMSUtil.getVersionNumber() > 9) {
if (livingEntity instanceof Donkey || livingEntity instanceof Mule || livingEntity instanceof ElderGuardian) return; if (livingEntity instanceof Donkey || livingEntity instanceof Mule || livingEntity instanceof ElderGuardian)
return;
} }
if (NMSUtil.getVersionNumber() > 10) { if (NMSUtil.getVersionNumber() > 10) {
if (livingEntity instanceof Evoker) return; if (livingEntity instanceof Evoker) return;
} }
if (NMSUtil.getVersionNumber() > 11) { if (NMSUtil.getVersionNumber() > 11) {
if (livingEntity instanceof Llama) return; if (livingEntity instanceof Llama) return;
} }
if (NMSUtil.getVersionNumber() > 13) { if (NMSUtil.getVersionNumber() > 13) {
@ -686,7 +653,8 @@ public class Entity implements Listener {
} }
for (ItemStack is : event.getDrops()) for (ItemStack is : event.getDrops())
if (!dontMultiply.contains(is)) livingEntity.getWorld().dropItemNaturally(livingEntity.getLocation(), is); if (!dontMultiply.contains(is))
livingEntity.getWorld().dropItemNaturally(livingEntity.getLocation(), is);
} }
} }
} }
@ -730,7 +698,8 @@ public class Entity implements Listener {
public void onCreatureSpawn(CreatureSpawnEvent event) { public void onCreatureSpawn(CreatureSpawnEvent event) {
LivingEntity entity = event.getEntity(); LivingEntity entity = event.getEntity();
if (entity instanceof ArmorStand) return; if (entity instanceof ArmorStand) return;
if (entity.hasMetadata("SkyBlock")) return; // if (entity.hasMetadata("SkyBlock")) return;
// Doesn't appear this is ever set by our plugin and it is extremely intensive.
Location entityLocation = entity.getLocation(); Location entityLocation = entity.getLocation();

View File

@ -36,115 +36,117 @@ public class Join implements Listener {
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
Player player = event.getPlayer();
ScoreboardManager scoreboardManager = skyblock.getScoreboardManager(); ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
PlayerDataManager playerDataManager = skyblock.getPlayerDataManager(); PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
UserCacheManager userCacheManager = skyblock.getUserCacheManager(); UserCacheManager userCacheManager = skyblock.getUserCacheManager();
CooldownManager cooldownManager = skyblock.getCooldownManager(); CooldownManager cooldownManager = skyblock.getCooldownManager();
IslandManager islandManager = skyblock.getIslandManager(); IslandManager islandManager = skyblock.getIslandManager();
FileManager fileManager = skyblock.getFileManager(); FileManager fileManager = skyblock.getFileManager();
userCacheManager.addUser(player.getUniqueId(), player.getName()); userCacheManager.addUser(player.getUniqueId(), player.getName());
userCacheManager.saveAsync(); userCacheManager.saveAsync();
try {
Island island = islandManager.loadIsland(player);
boolean teleportedToIsland = false;
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Join.Spawn")) {
LocationUtil.teleportPlayerToSpawn(player);
} else if (configLoad.getBoolean("Island.Join.Island") && island != null) {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
player.setFallDistance(0.0F);
teleportedToIsland = true;
}
if (!teleportedToIsland) {
islandManager.loadPlayer(player);
}
} catch (Exception e) {
e.printStackTrace();
}
playerDataManager.loadPlayerData(player);
if (playerDataManager.hasPlayerData(player)) {
String[] playerTexture;
try { try {
Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player); Island island = islandManager.loadIsland(player);
Method getProfileMethod = entityPlayer.getClass().getMethod("getProfile"); boolean teleportedToIsland = false;
GameProfile gameProfile = (GameProfile) getProfileMethod.invoke(entityPlayer);
Property property = gameProfile.getProperties().get("textures").iterator().next(); Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
playerTexture = new String[] { property.getSignature(), property.getValue() }; FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getBoolean("Island.Join.Spawn")) {
LocationUtil.teleportPlayerToSpawn(player);
} else if (configLoad.getBoolean("Island.Join.Island") && island != null) {
player.teleport(island.getLocation(IslandWorld.Normal, IslandEnvironment.Main));
player.setFallDistance(0.0F);
teleportedToIsland = true;
}
if (!teleportedToIsland) {
islandManager.loadPlayer(player);
}
} catch (Exception e) { } catch (Exception e) {
playerTexture = new String[] { e.printStackTrace();
"K9P4tCIENYbNpDuEuuY0shs1x7iIvwXi4jUUVsATJfwsAIZGS+9OZ5T2HB0tWBoxRvZNi73Vr+syRdvTLUWPusVXIg+2fhXmQoaNEtnQvQVGQpjdQP0TkZtYG8PbvRxE6Z75ddq+DVx/65OSNHLWIB/D+Rg4vINh4ukXNYttn9QvauDHh1aW7/IkIb1Bc0tLcQyqxZQ3mdglxJfgIerqnlA++Lt7TxaLdag4y1NhdZyd3OhklF5B0+B9zw/qP8QCzsZU7VzJIcds1+wDWKiMUO7+60OSrIwgE9FPamxOQDFoDvz5BOULQEeNx7iFMB+eBYsapCXpZx0zf1bduppBUbbVC9wVhto/J4tc0iNyUq06/esHUUB5MHzdJ0Y6IZJAD/xIw15OLCUH2ntvs8V9/cy5/n8u3JqPUM2zhUGeQ2p9FubUGk4Q928L56l3omRpKV+5QYTrvF+AxFkuj2hcfGQG3VE2iYZO6omXe7nRPpbJlHkMKhE8Xvd1HP4PKpgivSkHBoZ92QEUAmRzZydJkp8CNomQrZJf+MtPiNsl/Q5RQM+8CQThg3+4uWptUfP5dDFWOgTnMdA0nIODyrjpp+bvIJnsohraIKJ7ZDnj4tIp4ObTNKDFC/8j8JHz4VCrtr45mbnzvB2DcK8EIB3JYT7ElJTHnc5BKMyLy5SKzuw=",
"eyJ0aW1lc3RhbXAiOjE1MjkyNTg0MTE4NDksInByb2ZpbGVJZCI6Ijg2NjdiYTcxYjg1YTQwMDRhZjU0NDU3YTk3MzRlZWQ3IiwicHJvZmlsZU5hbWUiOiJTdGV2ZSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGMxYzc3Y2U4ZTU0OTI1YWI1ODEyNTQ0NmVjNTNiMGNkZDNkMGNhM2RiMjczZWI5MDhkNTQ4Mjc4N2VmNDAxNiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc2N2Q0ODMyNWVhNTMyNDU2MTQwNmI4YzgyYWJiZDRlMjc1NWYxMTE1M2NkODVhYjA1NDVjYzIifX19" };
} }
PlayerData playerData = playerDataManager.getPlayerData(player);
playerData.setTexture(playerTexture[0], playerTexture[1]);
playerData.save();
} else {
playerDataManager.createPlayerData(player);
playerDataManager.loadPlayerData(player); playerDataManager.loadPlayerData(player);
}
playerDataManager.storeIsland(player); if (playerDataManager.hasPlayerData(player)) {
String[] playerTexture;
cooldownManager.addCooldownPlayer(CooldownType.Biome, cooldownManager.loadCooldownPlayer(CooldownType.Biome, player)); try {
cooldownManager.addCooldownPlayer(CooldownType.Creation, cooldownManager.loadCooldownPlayer(CooldownType.Creation, player)); Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player);
Method getProfileMethod = entityPlayer.getClass().getMethod("getProfile");
GameProfile gameProfile = (GameProfile) getProfileMethod.invoke(entityPlayer);
Property property = gameProfile.getProperties().get("textures").iterator().next();
playerTexture = new String[]{property.getSignature(), property.getValue()};
} catch (Exception e) {
playerTexture = new String[]{
"K9P4tCIENYbNpDuEuuY0shs1x7iIvwXi4jUUVsATJfwsAIZGS+9OZ5T2HB0tWBoxRvZNi73Vr+syRdvTLUWPusVXIg+2fhXmQoaNEtnQvQVGQpjdQP0TkZtYG8PbvRxE6Z75ddq+DVx/65OSNHLWIB/D+Rg4vINh4ukXNYttn9QvauDHh1aW7/IkIb1Bc0tLcQyqxZQ3mdglxJfgIerqnlA++Lt7TxaLdag4y1NhdZyd3OhklF5B0+B9zw/qP8QCzsZU7VzJIcds1+wDWKiMUO7+60OSrIwgE9FPamxOQDFoDvz5BOULQEeNx7iFMB+eBYsapCXpZx0zf1bduppBUbbVC9wVhto/J4tc0iNyUq06/esHUUB5MHzdJ0Y6IZJAD/xIw15OLCUH2ntvs8V9/cy5/n8u3JqPUM2zhUGeQ2p9FubUGk4Q928L56l3omRpKV+5QYTrvF+AxFkuj2hcfGQG3VE2iYZO6omXe7nRPpbJlHkMKhE8Xvd1HP4PKpgivSkHBoZ92QEUAmRzZydJkp8CNomQrZJf+MtPiNsl/Q5RQM+8CQThg3+4uWptUfP5dDFWOgTnMdA0nIODyrjpp+bvIJnsohraIKJ7ZDnj4tIp4ObTNKDFC/8j8JHz4VCrtr45mbnzvB2DcK8EIB3JYT7ElJTHnc5BKMyLy5SKzuw=",
"eyJ0aW1lc3RhbXAiOjE1MjkyNTg0MTE4NDksInByb2ZpbGVJZCI6Ijg2NjdiYTcxYjg1YTQwMDRhZjU0NDU3YTk3MzRlZWQ3IiwicHJvZmlsZU5hbWUiOiJTdGV2ZSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGMxYzc3Y2U4ZTU0OTI1YWI1ODEyNTQ0NmVjNTNiMGNkZDNkMGNhM2RiMjczZWI5MDhkNTQ4Mjc4N2VmNDAxNiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc2N2Q0ODMyNWVhNTMyNDU2MTQwNmI4YzgyYWJiZDRlMjc1NWYxMTE1M2NkODVhYjA1NDVjYzIifX19"};
}
if (scoreboardManager != null) { PlayerData playerData = playerDataManager.getPlayerData(player);
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml")); playerData.setTexture(playerTexture[0], playerTexture[1]);
Scoreboard scoreboard = new Scoreboard(skyblock, player); playerData.save();
Island island = islandManager.getIsland(player); } else {
playerDataManager.createPlayerData(player);
playerDataManager.loadPlayerData(player);
}
if (island != null) { playerDataManager.storeIsland(player);
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID());
cooldownManager.addCooldownPlayer(CooldownType.Levelling, cooldownManager.loadCooldownPlayer(CooldownType.Levelling, offlinePlayer)); cooldownManager.addCooldownPlayer(CooldownType.Biome, cooldownManager.loadCooldownPlayer(CooldownType.Biome, player));
cooldownManager.addCooldownPlayer(CooldownType.Ownership, cooldownManager.loadCooldownPlayer(CooldownType.Ownership, offlinePlayer)); cooldownManager.addCooldownPlayer(CooldownType.Creation, cooldownManager.loadCooldownPlayer(CooldownType.Creation, player));
if (island.getRole(IslandRole.Member).size() == 0 && island.getRole(IslandRole.Operator).size() == 0) { if (scoreboardManager != null) {
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname"))); Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
Scoreboard scoreboard = new Scoreboard(skyblock, player);
Island island = islandManager.getIsland(player);
if (islandManager.getVisitorsAtIsland(island).size() == 0) { if (island != null) {
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Empty.Displaylines")); OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID());
cooldownManager.addCooldownPlayer(CooldownType.Levelling, cooldownManager.loadCooldownPlayer(CooldownType.Levelling, offlinePlayer));
cooldownManager.addCooldownPlayer(CooldownType.Ownership, cooldownManager.loadCooldownPlayer(CooldownType.Ownership, offlinePlayer));
if (island.getRole(IslandRole.Member).size() == 0 && island.getRole(IslandRole.Operator).size() == 0) {
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Island.Solo.Displayname")));
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
} else {
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Occupied.Displaylines"));
}
} else { } else {
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Occupied.Displaylines")); scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Island.Team.Displayname")));
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Empty.Displaylines"));
} else {
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
}
} }
} else { } else {
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Island.Team.Displayname"))); scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines"));
if (islandManager.getVisitorsAtIsland(island).size() == 0) {
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Empty.Displaylines"));
} else {
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Team.Occupied.Displaylines"));
}
} }
} else {
scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname"))); scoreboard.run();
scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines")); scoreboardManager.storeScoreboard(player, scoreboard);
} }
scoreboard.run(); Island island = islandManager.getIslandPlayerAt(player);
scoreboardManager.storeScoreboard(player, scoreboard); if (island != null) {
} islandManager.updateBorder(island);
islandManager.updateFlight(player);
}
Island island = islandManager.getIslandPlayerAt(player); // Load Challenge
if (island != null) { SkyBlock.getInstance().getFabledChallenge().getPlayerManager().loadPlayer(player.getUniqueId());
islandManager.updateBorder(island); });
islandManager.updateFlight(player);
}
// Load Challenge
SkyBlock.getInstance().getFabledChallenge().getPlayerManager().loadPlayer(player.getUniqueId());
} }
} }

View File

@ -100,7 +100,7 @@ public class Portal implements Listener {
case Owner: case Owner:
case Member: case Member:
case Coop: case Coop:
spawnEnvironment = IslandEnvironment.Island; spawnEnvironment = IslandEnvironment.Main;
break; break;
default: default: