diff --git a/pom.xml b/pom.xml
index 951df6eb..df201865 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
com.songoda
skyblock
- 2.2.19
+ 2.2.11
jar
clean install
diff --git a/src/main/java/com/songoda/skyblock/island/IslandManager.java b/src/main/java/com/songoda/skyblock/island/IslandManager.java
index 78a76a6b..77efb555 100644
--- a/src/main/java/com/songoda/skyblock/island/IslandManager.java
+++ b/src/main/java/com/songoda/skyblock/island/IslandManager.java
@@ -685,7 +685,8 @@ public class IslandManager {
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;
}
diff --git a/src/main/java/com/songoda/skyblock/listeners/Block.java b/src/main/java/com/songoda/skyblock/listeners/Block.java
index c81b3112..c911cc1c 100644
--- a/src/main/java/com/songoda/skyblock/listeners/Block.java
+++ b/src/main/java/com/songoda/skyblock/listeners/Block.java
@@ -265,40 +265,7 @@ public class Block implements Listener {
if (event.getBlock().getType() == CompatibleMaterial.END_PORTAL_FRAME.getMaterial()
&& 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.
- // 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);
- });
+ updateLevel(island, blockLoc);
}
@EventHandler
@@ -363,6 +330,7 @@ public class Block implements Listener {
toBlockState.setData(genState.getData());
toBlockState.setType(genState.getType());
toBlockState.update();
+ updateLevel(island, genState.getLocation());
return;
}
}
@@ -588,6 +556,7 @@ public class Block implements Listener {
state.setType(genState.getType());
if (NMSUtil.getVersionNumber() < 13) state.setData(genState.getData());
+ updateLevel(island, genState.getLocation());
return;
}
}
@@ -672,4 +641,41 @@ public class Block implements Listener {
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);
+ });
+ }
+
}
diff --git a/src/main/java/com/songoda/skyblock/listeners/Entity.java b/src/main/java/com/songoda/skyblock/listeners/Entity.java
index f48f62fc..dc75f684 100644
--- a/src/main/java/com/songoda/skyblock/listeners/Entity.java
+++ b/src/main/java/com/songoda/skyblock/listeners/Entity.java
@@ -1,52 +1,32 @@
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.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.Location;
import org.bukkit.Material;
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.Ravager;
-import org.bukkit.entity.TNTPrimed;
+import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
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.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.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.HangingBreakEvent;
import org.bukkit.event.hanging.HangingBreakEvent.RemoveCause;
@@ -58,24 +38,9 @@ import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
-import com.songoda.skyblock.SkyBlock;
-import com.songoda.skyblock.config.FileManager;
-import com.songoda.skyblock.config.FileManager.Config;
-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;
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.*;
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"))
.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 {
- // Check if it's a monster and player has the permission to damage the entity
- // If
- // If it's not a monster or the player has the permission
- if (EntityUtil.isMonster(entity.getType()) && islandManager.hasPermission(player, entity.getLocation(), "MonsterHurting")) {
- // Player has permission to damage the entity
- 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
- if (!islandManager.hasPermission(player, entity.getLocation(), "MobHurting")) {
+ // Check if it's a monster and player has the permission to damage the entity
+ // If
+ // If it's not a monster or the player has the permission
+ if (EntityUtil.isMonster(entity.getType()) && islandManager.hasPermission(player, entity.getLocation(), "MonsterHurting")) {
+ // Player has permission to damage the entity
+ 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
+ if (!islandManager.hasPermission(player, entity.getLocation(), "MobHurting")) {
event.setCancelled(true);
messageManager.sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.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;
}
@@ -217,20 +182,20 @@ public class Entity implements Listener {
event.setCancelled(true);
}
} else {
- // Check if it's a monster and player has the permission to damage the entity
- // If
- // If it's not a monster or the player has the permission
- if (EntityUtil.isMonster(entity.getType()) && islandManager.hasPermission(player, entity.getLocation(), "MonsterHurting")) {
- // Player has permission to damage the entity
- 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
+ // Check if it's a monster and player has the permission to damage the entity
+ // If
+ // If it's not a monster or the player has the permission
+ if (EntityUtil.isMonster(entity.getType()) && islandManager.hasPermission(player, entity.getLocation(), "MonsterHurting")) {
+ // Player has permission to damage the entity
+ 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
if (!islandManager.hasPermission(player, entity.getLocation(), "MobHurting")) {
event.setCancelled(true);
messageManager.sendMessage(player, fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.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;
}
@@ -289,14 +254,14 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).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);
}
}
}
/**
* Checks that an entity is not targeting another entity on different islands.
- *
+ *
* @author LimeGlass
*/
@EventHandler
@@ -334,7 +299,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player, skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml"))
.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;
@@ -362,7 +327,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).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);
}
}
}
@@ -399,7 +364,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).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);
}
}
}
@@ -420,7 +385,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).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);
}
}
}
@@ -441,7 +406,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).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);
}
}
}
@@ -461,7 +426,7 @@ public class Entity implements Listener {
skyblock.getMessageManager().sendMessage(player,
skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "language.yml")).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);
}
}
}
@@ -495,9 +460,9 @@ public class Entity implements Listener {
// nothing
if ((LocationUtil.isLocationLocation(block.getLocation(), island.getLocation(world, IslandEnvironment.Main).clone().subtract(0, 1, 0))
|| 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()
- .getBoolean("Island.Spawn.Protection")) {
+ .getBoolean("Island.Spawn.Protection")) {
event.setCancelled(true);
return;
}
@@ -559,7 +524,8 @@ public class Entity implements Listener {
}
if (event.getTo() != null && event.getTo() != Material.AIR) {
- materials = CompatibleMaterial.getBlockMaterial(event.getTo());;
+ materials = CompatibleMaterial.getBlockMaterial(event.getTo());
+ ;
if (materials != null) {
long materialAmount = 0;
@@ -639,15 +605,16 @@ public class Entity implements Listener {
}
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 (livingEntity instanceof Evoker) return;
}
-
+
if (NMSUtil.getVersionNumber() > 11) {
- if (livingEntity instanceof Llama) return;
+ if (livingEntity instanceof Llama) return;
}
if (NMSUtil.getVersionNumber() > 13) {
@@ -686,7 +653,8 @@ public class Entity implements Listener {
}
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) {
LivingEntity entity = event.getEntity();
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();
diff --git a/src/main/java/com/songoda/skyblock/listeners/Join.java b/src/main/java/com/songoda/skyblock/listeners/Join.java
index c028ab7e..1b47536c 100644
--- a/src/main/java/com/songoda/skyblock/listeners/Join.java
+++ b/src/main/java/com/songoda/skyblock/listeners/Join.java
@@ -36,115 +36,117 @@ public class Join implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
- Player player = event.getPlayer();
+ Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
+ Player player = event.getPlayer();
- ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
- PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
- UserCacheManager userCacheManager = skyblock.getUserCacheManager();
- CooldownManager cooldownManager = skyblock.getCooldownManager();
- IslandManager islandManager = skyblock.getIslandManager();
- FileManager fileManager = skyblock.getFileManager();
+ ScoreboardManager scoreboardManager = skyblock.getScoreboardManager();
+ PlayerDataManager playerDataManager = skyblock.getPlayerDataManager();
+ UserCacheManager userCacheManager = skyblock.getUserCacheManager();
+ CooldownManager cooldownManager = skyblock.getCooldownManager();
+ IslandManager islandManager = skyblock.getIslandManager();
+ FileManager fileManager = skyblock.getFileManager();
- userCacheManager.addUser(player.getUniqueId(), player.getName());
- 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;
+ userCacheManager.addUser(player.getUniqueId(), player.getName());
+ userCacheManager.saveAsync();
try {
- 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() };
+ 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) {
- 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" };
+ e.printStackTrace();
}
- PlayerData playerData = playerDataManager.getPlayerData(player);
- playerData.setTexture(playerTexture[0], playerTexture[1]);
- playerData.save();
- } else {
- playerDataManager.createPlayerData(player);
playerDataManager.loadPlayerData(player);
- }
- playerDataManager.storeIsland(player);
+ if (playerDataManager.hasPlayerData(player)) {
+ String[] playerTexture;
- cooldownManager.addCooldownPlayer(CooldownType.Biome, cooldownManager.loadCooldownPlayer(CooldownType.Biome, player));
- cooldownManager.addCooldownPlayer(CooldownType.Creation, cooldownManager.loadCooldownPlayer(CooldownType.Creation, player));
+ try {
+ 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) {
- Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
- Scoreboard scoreboard = new Scoreboard(skyblock, player);
- Island island = islandManager.getIsland(player);
+ PlayerData playerData = playerDataManager.getPlayerData(player);
+ playerData.setTexture(playerTexture[0], playerTexture[1]);
+ playerData.save();
+ } else {
+ playerDataManager.createPlayerData(player);
+ playerDataManager.loadPlayerData(player);
+ }
- if (island != null) {
- OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(island.getOwnerUUID());
+ playerDataManager.storeIsland(player);
- cooldownManager.addCooldownPlayer(CooldownType.Levelling, cooldownManager.loadCooldownPlayer(CooldownType.Levelling, offlinePlayer));
- cooldownManager.addCooldownPlayer(CooldownType.Ownership, cooldownManager.loadCooldownPlayer(CooldownType.Ownership, offlinePlayer));
+ cooldownManager.addCooldownPlayer(CooldownType.Biome, cooldownManager.loadCooldownPlayer(CooldownType.Biome, player));
+ cooldownManager.addCooldownPlayer(CooldownType.Creation, cooldownManager.loadCooldownPlayer(CooldownType.Creation, player));
- 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 (scoreboardManager != null) {
+ 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) {
- scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Island.Solo.Empty.Displaylines"));
+ if (island != null) {
+ 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 {
- 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 {
- 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"));
- }
-
+ scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
+ scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines"));
}
- } else {
- scoreboard.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getFileConfiguration().getString("Scoreboard.Tutorial.Displayname")));
- scoreboard.setDisplayList(config.getFileConfiguration().getStringList("Scoreboard.Tutorial.Displaylines"));
+
+ scoreboard.run();
+ scoreboardManager.storeScoreboard(player, scoreboard);
}
- scoreboard.run();
- scoreboardManager.storeScoreboard(player, scoreboard);
- }
+ Island island = islandManager.getIslandPlayerAt(player);
+ if (island != null) {
+ islandManager.updateBorder(island);
+ islandManager.updateFlight(player);
+ }
- Island island = islandManager.getIslandPlayerAt(player);
- if (island != null) {
- islandManager.updateBorder(island);
- islandManager.updateFlight(player);
- }
-
- // Load Challenge
- SkyBlock.getInstance().getFabledChallenge().getPlayerManager().loadPlayer(player.getUniqueId());
+ // Load Challenge
+ SkyBlock.getInstance().getFabledChallenge().getPlayerManager().loadPlayer(player.getUniqueId());
+ });
}
}
diff --git a/src/main/java/com/songoda/skyblock/listeners/Portal.java b/src/main/java/com/songoda/skyblock/listeners/Portal.java
index 60342edd..8c94659d 100644
--- a/src/main/java/com/songoda/skyblock/listeners/Portal.java
+++ b/src/main/java/com/songoda/skyblock/listeners/Portal.java
@@ -100,7 +100,7 @@ public class Portal implements Listener {
case Owner:
case Member:
case Coop:
- spawnEnvironment = IslandEnvironment.Island;
+ spawnEnvironment = IslandEnvironment.Main;
break;
default: