mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-01-03 05:47:33 +01:00
Placeholder optimizations.
This commit is contained in:
parent
d111263297
commit
279e8bf65c
@ -60,7 +60,6 @@ public class EpicBosses extends SongodaPlugin implements IReloadable {
|
||||
private BossHookManager bossHookManager;
|
||||
|
||||
private AutoSpawnManager autoSpawnManager;
|
||||
private PlaceholderManager placeholderManager;
|
||||
|
||||
private MinionMechanicManager minionMechanicManager;
|
||||
private MinionEntityContainer minionEntityContainer;
|
||||
@ -135,10 +134,8 @@ public class EpicBosses extends SongodaPlugin implements IReloadable {
|
||||
|
||||
this.autoSpawnManager = new AutoSpawnManager(this);
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
this.placeholderManager = new PlaceholderManager(this);
|
||||
this.placeholderManager.register();
|
||||
}
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI"))
|
||||
new PlaceholderManager(this).register();
|
||||
|
||||
createFiles();
|
||||
reloadFiles();
|
||||
@ -198,6 +195,11 @@ public class EpicBosses extends SongodaPlugin implements IReloadable {
|
||||
|
||||
this.autoSpawnManager.startIntervalSystems();
|
||||
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||
System.out.println("hiiiit");
|
||||
new PlaceholderManager(this).register();
|
||||
}
|
||||
|
||||
ServerUtils.get().logDebug("Loaded all fields and managers, saved messages and plugin is initialized and ready to go. (took " + (System.currentTimeMillis() - beginMs) + "ms).");
|
||||
}
|
||||
|
||||
@ -349,10 +351,6 @@ public class EpicBosses extends SongodaPlugin implements IReloadable {
|
||||
return this.autoSpawnManager;
|
||||
}
|
||||
|
||||
public PlaceholderManager getPlaceholderManager() {
|
||||
return this.placeholderManager;
|
||||
}
|
||||
|
||||
public MinionMechanicManager getMinionMechanicManager() {
|
||||
return this.minionMechanicManager;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.OfflinePlayer;
|
||||
|
||||
public class PlaceholderManager extends PlaceholderExpansion {
|
||||
|
||||
private AutoSpawnManager autoSpawnManager;
|
||||
private final AutoSpawnManager autoSpawnManager;
|
||||
|
||||
public PlaceholderManager(EpicBosses plugin) {
|
||||
this.autoSpawnManager = plugin.getAutoSpawnManager();
|
||||
@ -24,10 +24,14 @@ public class PlaceholderManager extends PlaceholderExpansion {
|
||||
ActiveIntervalAutoSpawnHolder intervalAutoSpawnHolder = (ActiveIntervalAutoSpawnHolder) autoSpawnHolder;
|
||||
long duration = (long) (intervalAutoSpawnHolder.getRemainingMs() / 1000D);
|
||||
|
||||
String formattedIdentifier = intervalAutoSpawnHolder.getIntervalSpawnElement().getPlaceholder() + "_formatted";
|
||||
String placeHolder = intervalAutoSpawnHolder.getIntervalSpawnElement().getPlaceholder()
|
||||
.replace("{", "")
|
||||
.replace("}", "");
|
||||
|
||||
String formattedIdentifier = placeHolder + "_formatted";
|
||||
if (identifier.equalsIgnoreCase(formattedIdentifier)) {
|
||||
return this.getTimeFormatted(duration);
|
||||
} else if (identifier.equals(intervalAutoSpawnHolder.getIntervalSpawnElement().getPlaceholder())) {
|
||||
} else if (identifier.equals(placeHolder)) {
|
||||
return String.valueOf((int) (intervalAutoSpawnHolder.getRemainingMs() / 1000D));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user