mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-26 20:26:34 +01:00
Placeholders now properly reload with '/papi reload'
This commit is contained in:
parent
130a3437a6
commit
868ec061c9
@ -3,6 +3,7 @@ package me.goodandevil.skyblock.placeholder;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.clip.placeholderapi.events.ExpansionUnregisterEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -18,13 +19,16 @@ import me.goodandevil.skyblock.leaderboard.LeaderboardManager;
|
|||||||
import me.goodandevil.skyblock.utils.NumberUtil;
|
import me.goodandevil.skyblock.utils.NumberUtil;
|
||||||
import me.goodandevil.skyblock.utils.player.OfflinePlayer;
|
import me.goodandevil.skyblock.utils.player.OfflinePlayer;
|
||||||
import me.goodandevil.skyblock.visit.Visit;
|
import me.goodandevil.skyblock.visit.Visit;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
public class EZPlaceholder extends PlaceholderExpansion {
|
public class EZPlaceholder extends PlaceholderExpansion implements Listener {
|
||||||
|
|
||||||
private final SkyBlock skyblock;
|
private final SkyBlock skyblock;
|
||||||
|
|
||||||
public EZPlaceholder(SkyBlock skyblock) {
|
public EZPlaceholder(SkyBlock skyblock) {
|
||||||
this.skyblock = skyblock;
|
this.skyblock = skyblock;
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, skyblock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIdentifier() {
|
public String getIdentifier() {
|
||||||
@ -113,4 +117,14 @@ public class EZPlaceholder extends PlaceholderExpansion {
|
|||||||
|
|
||||||
return placeholderManager.getPlaceholder(player, "fabledskyblock_" + identifier);
|
return placeholderManager.getPlaceholder(player, "fabledskyblock_" + identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If a player uses '/papi reload' then we need to reload this expansion
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onExpansionUnregister(ExpansionUnregisterEvent event) {
|
||||||
|
if (event.getExpansion() instanceof EZPlaceholder) {
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(skyblock, this::register, 20L);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,10 +72,10 @@ public class PlaceholderManager {
|
|||||||
if (placeholder.equalsIgnoreCase("fabledskyblock_island_exists")) {
|
if (placeholder.equalsIgnoreCase("fabledskyblock_island_exists")) {
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
return ChatColor.translateAlternateColorCodes('&',
|
return ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Placeholder.fabledskyblock_island_exists.False.Message"));
|
configLoad.getString("Placeholder.fabledskyblock_island_exists.Not-exists.Message"));
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.translateAlternateColorCodes('&',
|
return ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Placeholder.fabledskyblock_island_exists.True.Message"));
|
configLoad.getString("Placeholder.fabledskyblock_island_exists.Exists.Message"));
|
||||||
}
|
}
|
||||||
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_size")) {
|
} else if (placeholder.equalsIgnoreCase("fabledskyblock_island_size")) {
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
|
@ -1091,9 +1091,9 @@ Placeholder:
|
|||||||
Non-empty:
|
Non-empty:
|
||||||
Message: "&f[%position] %player [%votes]"
|
Message: "&f[%position] %player [%votes]"
|
||||||
fabledskyblock_island_exists:
|
fabledskyblock_island_exists:
|
||||||
True:
|
Exists:
|
||||||
Message: "&atrue"
|
Message: "&atrue"
|
||||||
False:
|
Not-exists:
|
||||||
Message: "&cfalse"
|
Message: "&cfalse"
|
||||||
fabledskyblock_island_size:
|
fabledskyblock_island_size:
|
||||||
Empty:
|
Empty:
|
||||||
|
Loading…
Reference in New Issue
Block a user