mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-28 05:25:21 +01:00
Update to BentoBox 1.2.0
In BentoBox 1.2 hooks are enabled before addons.
This commit is contained in:
parent
c304dba5e3
commit
86b51df412
@ -40,9 +40,8 @@ public class ChallengesAddon extends Addon {
|
||||
|
||||
/**
|
||||
* VaultHook that process economy.
|
||||
* todo: because of BentoBox limitations.
|
||||
*/
|
||||
private Optional<VaultHook> vaultHook = null;
|
||||
private VaultHook vaultHook;
|
||||
|
||||
/**
|
||||
* Level addon.
|
||||
@ -132,19 +131,18 @@ public class ChallengesAddon extends Addon {
|
||||
this.levelAddon = (Level) level.get();
|
||||
}
|
||||
|
||||
// BentoBox limitation. Cannot check hooks, as HookManager is created after loading addons.
|
||||
// Optional<VaultHook> vault = this.getPlugin().getVault();
|
||||
//
|
||||
// if (!vault.isPresent() || !vault.get().hook())
|
||||
// {
|
||||
// this.vaultHook = null;
|
||||
// this.logWarning("Economy plugin not found so money options will not work!");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.economyProvided = true;
|
||||
// this.vaultHook = vault.get();
|
||||
// }
|
||||
Optional<VaultHook> vault = this.getPlugin().getVault();
|
||||
|
||||
if (!vault.isPresent() || !vault.get().hook())
|
||||
{
|
||||
this.vaultHook = null;
|
||||
this.logWarning("Economy plugin not found so money options will not work!");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.economyProvided = true;
|
||||
this.vaultHook = vault.get();
|
||||
}
|
||||
|
||||
// Register the reset listener
|
||||
this.registerListener(new ResetListener(this));
|
||||
@ -247,12 +245,6 @@ public class ChallengesAddon extends Addon {
|
||||
*/
|
||||
public boolean isEconomyProvided()
|
||||
{
|
||||
if (!this.economyProvided && this.getPlugin().getVault().isPresent() && this.vaultHook == null)
|
||||
{
|
||||
this.vaultHook = this.getPlugin().getVault();
|
||||
this.economyProvided = this.vaultHook.get().hook();
|
||||
}
|
||||
|
||||
return this.economyProvided;
|
||||
}
|
||||
|
||||
@ -264,7 +256,7 @@ public class ChallengesAddon extends Addon {
|
||||
*/
|
||||
public VaultHook getEconomyProvider()
|
||||
{
|
||||
return vaultHook.orElseGet(null);
|
||||
return vaultHook;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user