2424import com .sk89q .worldedit .bukkit .WorldEditPlugin ;
2525import de .leonhard .storage .Yaml ;
2626import de .leonhard .storage .sections .FlatFileSection ;
27+ import de .tr7zw .nbtapi .plugin .NBTAPI ;
2728import lombok .Getter ;
2829import lombok .Setter ;
2930import me .minebuilders .clearlag .Clearlag ;
5253import org .maxgamer .quickshop .api .compatibility .CompatibilityManager ;
5354import org .maxgamer .quickshop .api .database .DatabaseHelper ;
5455import org .maxgamer .quickshop .api .economy .AbstractEconomy ;
55- import org .maxgamer .quickshop .api .economy .EconomyCore ;
5656import org .maxgamer .quickshop .api .economy .EconomyType ;
5757import org .maxgamer .quickshop .api .event .QSReloadEvent ;
5858import org .maxgamer .quickshop .api .integration .IntegrateStage ;
@@ -256,6 +256,9 @@ public class QuickShop extends JavaPlugin implements QuickShopAPI {
256256 private ShopPurger shopPurger ;
257257 @ Getter
258258 private final TpsWatcher tpsWatcher = new TpsWatcher ();
259+ @ Getter
260+ @ Nullable
261+ private NBTAPI nbtapi = null ;
259262
260263 /**
261264 * Use for mock bukkit
@@ -371,6 +374,17 @@ private void load3rdParty() {
371374 }
372375 }
373376 }
377+ if (getConfiguration ().getBoolean ("plugin.NBTAPI" )) {
378+ this .nbtapi = (NBTAPI ) Bukkit .getPluginManager ().getPlugin ("NBTAPI" );
379+ if (this .nbtapi != null ) {
380+ if (!this .nbtapi .isCompatible ()) {
381+ getLogger ().warning ("NBTAPI plugin failed to loading, QuickShop NBTAPI support module has been disabled. Try update NBTAPI version to resolve the issue. (" + nbtapi .getDescription ().getVersion () + ")" );
382+ this .nbtapi = null ;
383+ } else {
384+ getLogger ().info ("Successfully loaded NBTAPI support!" );
385+ }
386+ }
387+ }
374388 Bukkit .getPluginManager ().registerEvents (this .compatibilityTool , this );
375389 compatibilityTool .searchAndRegisterPlugins ();
376390 if (this .display ) {
@@ -422,13 +436,12 @@ private void load3rdParty() {
422436 public boolean loadEcon () {
423437 try {
424438 // EconomyCore core = new Economy_Vault();
425- EconomyCore core = null ;
426439 switch (EconomyType .fromID (getConfiguration ().getInt ("economy-type" ))) {
427440 case UNKNOWN :
428441 setupBootError (new BootError (this .getLogger (), "Can't load the Economy provider, invaild value in config.yml." ), true );
429442 return false ;
430443 case VAULT :
431- core = new Economy_Vault (this );
444+ economy = new Economy_Vault (this );
432445 Util .debugLog ("Now using the Vault economy system." );
433446 if (getConfiguration ().getOrDefault ("tax" , 0.0d ) > 0 ) {
434447 try {
@@ -440,7 +453,7 @@ public boolean loadEcon() {
440453 } else {
441454 tax = Bukkit .getOfflinePlayer (Objects .requireNonNull (taxAccount ));
442455 }
443- Economy_Vault vault = (Economy_Vault ) core ;
456+ Economy_Vault vault = (Economy_Vault ) economy ;
444457 if (vault .isValid ()) {
445458 if (!Objects .requireNonNull (vault .getVault ()).hasAccount (tax )) {
446459 try {
@@ -466,21 +479,21 @@ public boolean loadEcon() {
466479 }
467480 break ;
468481 case GEMS_ECONOMY :
469- core = new Economy_GemsEconomy (this );
482+ economy = new Economy_GemsEconomy (this );
470483 Util .debugLog ("Now using the GemsEconomy economy system." );
471484 break ;
472485 case TNE :
473- core = new Economy_TNE (this );
486+ economy = new Economy_TNE (this );
474487 Util .debugLog ("Now using the TNE economy system." );
475488 break ;
476489 default :
477490 Util .debugLog ("No any economy provider selected." );
478491 break ;
479492 }
480- if (core == null ) {
493+ if (economy == null ) {
481494 return false ;
482495 }
483- if (!core .isValid ()) {
496+ if (!economy .isValid ()) {
484497 setupBootError (BuiltInSolution .econError (), false );
485498 return false ;
486499 }
0 commit comments