mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-23 02:35:25 +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 {
|
||||
|
||||
@ -51,7 +53,14 @@ public class Teleport implements Listener {
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
islandManager.removeUpgrades(player, false);
|
||||
// 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.loadPlayer(player);
|
||||
|
||||
if (worldManager.isIslandWorld(player.getWorld())) {
|
||||
|
Loading…
Reference in New Issue
Block a user