mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-22 18:26:08 +01:00
Fix island upgrades persisting after leaving island
This commit is contained in:
parent
2234462424
commit
761e94bfd8
@ -1,5 +1,18 @@
|
||||
package me.goodandevil.skyblock.listeners;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import me.goodandevil.skyblock.SkyBlock;
|
||||
import me.goodandevil.skyblock.api.event.player.PlayerIslandEnterEvent;
|
||||
import me.goodandevil.skyblock.api.event.player.PlayerIslandExitEvent;
|
||||
@ -17,17 +30,6 @@ import me.goodandevil.skyblock.utils.version.NMSUtil;
|
||||
import me.goodandevil.skyblock.utils.version.Sounds;
|
||||
import me.goodandevil.skyblock.visit.Visit;
|
||||
import me.goodandevil.skyblock.world.WorldManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Teleport implements Listener {
|
||||
|
||||
@ -50,8 +52,15 @@ public class Teleport implements Listener {
|
||||
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
// Needs to be called after the teleport occurs otherwise the player location hasn't updated yet
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
islandManager.removeUpgrades(player, false);
|
||||
}
|
||||
}.runTaskLater(SkyBlock.getInstance(), 1);
|
||||
|
||||
islandManager.removeUpgrades(player, false);
|
||||
islandManager.loadPlayer(player);
|
||||
|
||||
if (worldManager.isIslandWorld(player.getWorld())) {
|
||||
@ -82,7 +91,7 @@ public class Teleport implements Listener {
|
||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||
|
||||
Island island = islandManager.getIslandAtLocation(event.getTo());
|
||||
|
||||
|
||||
if (island != null) {
|
||||
islandManager.giveUpgrades(player, island);
|
||||
islandManager.giveFly(player, island);
|
||||
|
Loading…
Reference in New Issue
Block a user