diff --git a/src/main/scala/io/izzel/taboolib/common/event/PlayerLoadedEvent.java b/src/main/scala/io/izzel/taboolib/common/event/PlayerLoadedEvent.java deleted file mode 100644 index 2d9bc5c..0000000 --- a/src/main/scala/io/izzel/taboolib/common/event/PlayerLoadedEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -package io.izzel.taboolib.common.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -public class PlayerLoadedEvent extends Event { - - private static final HandlerList handlers = new HandlerList(); - private Player player; - - public PlayerLoadedEvent(Player player) { - super(true); - this.player = player; - } - - public static HandlerList getHandlerList() { - return handlers; - } - - public Player getPlayer() { - return this.player; - } - - @Override - public HandlerList getHandlers() { - return handlers; - } -} diff --git a/src/main/scala/io/izzel/taboolib/common/plugin/InternalPluginBridge.java b/src/main/scala/io/izzel/taboolib/common/plugin/InternalPluginBridge.java index ead8c4b..61748f7 100644 --- a/src/main/scala/io/izzel/taboolib/common/plugin/InternalPluginBridge.java +++ b/src/main/scala/io/izzel/taboolib/common/plugin/InternalPluginBridge.java @@ -5,6 +5,7 @@ import io.izzel.taboolib.module.lite.SimpleVersionControl; import org.bukkit.Location; import org.bukkit.OfflinePlayer; import org.bukkit.World; +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import java.util.Collection; @@ -66,4 +67,6 @@ public abstract class InternalPluginBridge { abstract public boolean worldguardHooked(); abstract public Map taboolibTLocaleSerialize(Object in); + + abstract public FileConfiguration taboolibGetPlayerData(OfflinePlayer player); } diff --git a/src/main/scala/io/izzel/taboolib/common/plugin/bridge/BridgeImpl.java b/src/main/scala/io/izzel/taboolib/common/plugin/bridge/BridgeImpl.java index 36256e3..1730961 100644 --- a/src/main/scala/io/izzel/taboolib/common/plugin/bridge/BridgeImpl.java +++ b/src/main/scala/io/izzel/taboolib/common/plugin/bridge/BridgeImpl.java @@ -9,6 +9,7 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion; import io.izzel.taboolib.common.plugin.InternalPluginBridge; import io.izzel.taboolib.util.Reflection; import me.clip.placeholderapi.PlaceholderAPI; +import me.skymc.taboolib.database.PlayerDataManager; import me.skymc.taboolib.sound.SoundPack; import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.permission.Permission; @@ -16,6 +17,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.OfflinePlayer; import org.bukkit.World; +import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.plugin.RegisteredServiceProvider; @@ -41,7 +43,8 @@ public class BridgeImpl extends InternalPluginBridge { if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) { if (!WorldGuardPlugin.inst().getDescription().getVersion().startsWith("7")) { try { - getRegionManager = Reflection.getMethod(WorldGuardPlugin.class, "worldguardRegionManager", World.class); + getRegionManager = WorldGuardPlugin.class.getDeclaredMethod("getRegionManager", World.class); + getRegionManager.setAccessible(true); } catch (NoSuchMethodException e) { e.printStackTrace(); } @@ -197,4 +200,9 @@ public class BridgeImpl extends InternalPluginBridge { return ((com.ilummc.tlib.resources.TLocaleSerialize) in).serialize(); } } + + @Override + public FileConfiguration taboolibGetPlayerData(OfflinePlayer player) { + return PlayerDataManager.getPlayerData(player); + } } \ No newline at end of file diff --git a/src/main/scala/io/izzel/taboolib/module/db/local/LocalPlayer.java b/src/main/scala/io/izzel/taboolib/module/db/local/LocalPlayer.java index 50489d7..2c36da7 100644 --- a/src/main/scala/io/izzel/taboolib/module/db/local/LocalPlayer.java +++ b/src/main/scala/io/izzel/taboolib/module/db/local/LocalPlayer.java @@ -5,7 +5,6 @@ import io.izzel.taboolib.TabooLib; import io.izzel.taboolib.TabooLibAPI; import io.izzel.taboolib.module.inject.TSchedule; import io.izzel.taboolib.util.Files; -import me.skymc.taboolib.database.PlayerDataManager; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.configuration.file.FileConfiguration; @@ -24,7 +23,7 @@ public class LocalPlayer { private static Map files = Maps.newConcurrentMap(); public static FileConfiguration get(OfflinePlayer player) { - return TabooLibAPI.isOriginLoaded() ? PlayerDataManager.getPlayerData(player) : files.computeIfAbsent(toName(player), n -> Files.load(toFile(n))); + return TabooLibAPI.isOriginLoaded() ? TabooLibAPI.getPluginBridge().taboolibGetPlayerData(player) : files.computeIfAbsent(toName(player), n -> Files.load(toFile(n))); } @TSchedule(delay = 20 * 30, period = 20 * 30, async = true)