started moving to pure adventure

This commit is contained in:
PiggyPiglet
2021-07-07 15:37:35 +08:00
parent dd7751332f
commit d7a4acc2f5
3 changed files with 74 additions and 86 deletions

View File

@@ -75,7 +75,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
private final LocalExpansionManager localExpansionManager = new LocalExpansionManager(this);
@NotNull
private final CloudExpansionManager cloudExpansionManager = new CloudExpansionManager(this);
@NotNull
private BukkitAudiences adventure;
/**
@@ -143,7 +143,7 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
setupMetrics();
setupExpansions();
this.adventure = BukkitAudiences.create(this);
adventure = BukkitAudiences.create(this);
if (config.isCloudEnabled()) {
getCloudExpansionManager().load();
@@ -163,6 +163,9 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
Bukkit.getScheduler().cancelTasks(this);
adventure.close();
adventure = null;
instance = null;
}
@@ -191,11 +194,12 @@ public final class PlaceholderAPIPlugin extends JavaPlugin {
}
@NotNull
public BukkitAudiences adventure() {
if(this.adventure == null) {
public BukkitAudiences getAdventure() {
if(adventure == null) {
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
}
return this.adventure;
return adventure;
}
/**