Fix LocalPlayer & WorldGuardHook
This commit is contained in:
parent
8172dbc3d9
commit
89218727a2
@ -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;
|
||||
}
|
||||
}
|
@ -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<String, Object> taboolibTLocaleSerialize(Object in);
|
||||
|
||||
abstract public FileConfiguration taboolibGetPlayerData(OfflinePlayer player);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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<String, FileConfiguration> 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)
|
||||
|
Loading…
Reference in New Issue
Block a user