3838import com .Ben12345rocks .AdvancedCore .ServerHandle .SpigotHandle ;
3939import com .Ben12345rocks .AdvancedCore .TimeChecker .TimeChecker ;
4040import com .Ben12345rocks .AdvancedCore .UserManager .UserManager ;
41+ import com .Ben12345rocks .AdvancedCore .Util .Effects .FireworkHandler ;
4142import com .Ben12345rocks .AdvancedCore .Util .Javascript .JavascriptPlaceholderRequest ;
4243import com .Ben12345rocks .AdvancedCore .Util .Logger .Logger ;
4344import com .Ben12345rocks .AdvancedCore .Util .Misc .StringUtils ;
@@ -89,34 +90,17 @@ public static AdvancedCoreHook getInstance() {
8990 private String buildTime = "" ;
9091 private int maxMysqlSize = -1 ;
9192 private boolean autoKillInvs = true ;
92-
93- public boolean isAutoKillInvs () {
94- return autoKillInvs ;
95- }
96-
97- public void setAutoKillInvs (boolean autoKillInvs ) {
98- this .autoKillInvs = autoKillInvs ;
99- }
100-
101- public int getMaxMysqlSize () {
102- return maxMysqlSize ;
103- }
104-
105- public void setMaxMysqlSize (int maxMysqlSize ) {
106- this .maxMysqlSize = maxMysqlSize ;
107- }
93+ private String prevPageTxt = "&aPrevious Page" ;
94+ private String nextPageTxt = "&aNext Page" ;
10895
10996 private HashMap <String , Object > javascriptEngine = new HashMap <String , Object >();
11097
11198 /** The econ. */
11299 private Economy econ = null ;
113100
114101 private Permission perms ;
115- private boolean alternateUUIDLookUp ;
116102
117- public void setAlternateUUIDLookUp (boolean alternateUUIDLookUp ) {
118- this .alternateUUIDLookUp = alternateUUIDLookUp ;
119- }
103+ private boolean alternateUUIDLookUp ;
120104
121105 private AdvancedCoreHook () {
122106 }
@@ -268,13 +252,21 @@ public Logger getLogger() {
268252 return logger ;
269253 }
270254
255+ public int getMaxMysqlSize () {
256+ return maxMysqlSize ;
257+ }
258+
271259 /**
272260 * @return the mysql
273261 */
274262 public MySQL getMysql () {
275263 return mysql ;
276264 }
277265
266+ public String getNextPageTxt () {
267+ return nextPageTxt ;
268+ }
269+
278270 public String getPermPrefix () {
279271 return permPrefix ;
280272 }
@@ -287,6 +279,10 @@ public JavaPlugin getPlugin() {
287279 return plugin ;
288280 }
289281
282+ public String getPrevPageTxt () {
283+ return prevPageTxt ;
284+ }
285+
290286 /**
291287 * @return the resourceId
292288 */
@@ -326,6 +322,10 @@ public UserManager getUserManager() {
326322 return UserManager .getInstance ();
327323 }
328324
325+ public ConcurrentHashMap <String , String > getUuids () {
326+ return uuids ;
327+ }
328+
329329 /**
330330 * @return the version
331331 */
@@ -361,13 +361,21 @@ private YamlConfiguration getVersionFile() {
361361 return null ;
362362 }
363363
364+ public boolean isAlternateUUIDLookUp () {
365+ return alternateUUIDLookUp ;
366+ }
367+
364368 /**
365369 * @return the autoDownload
366370 */
367371 public boolean isAutoDownload () {
368372 return autoDownload ;
369373 }
370374
375+ public boolean isAutoKillInvs () {
376+ return autoKillInvs ;
377+ }
378+
371379 public synchronized boolean isCheckOnWorldChange () {
372380 return checkOnWorldChange ;
373381 }
@@ -478,6 +486,7 @@ public void loadEconomy() {
478486
479487 public void loadEvents () {
480488 Bukkit .getPluginManager ().registerEvents (new PlayerJoinEvent (plugin ), plugin );
489+ Bukkit .getPluginManager ().registerEvents (FireworkHandler .getInstance (), plugin );
481490 if (checkOnWorldChange ) {
482491 Bukkit .getPluginManager ().registerEvents (new WorldChangeEvent (plugin ), plugin );
483492 }
@@ -493,6 +502,11 @@ private void loadHandle() {
493502 debug ("Detected using craftbukkit" );
494503 plugin .getLogger ().info ("Detected server running craftbukkit. It is recommended to use spigot instead" );
495504 }
505+ if (Bukkit .getOnlineMode ()) {
506+ debug ("Server in online mode" );
507+ } else {
508+ debug ("Server in offline mode" );
509+ }
496510 }
497511
498512 /**
@@ -505,7 +519,6 @@ public void loadHook(JavaPlugin plugin) {
505519 this .plugin = plugin ;
506520 loadUUIDs ();
507521 permPrefix = plugin .getName ();
508- loadUserAPI (UserStorage .SQLITE );
509522 checkPlaceHolderAPI ();
510523 loadHandle ();
511524 loadEconomy ();
@@ -521,29 +534,6 @@ public void loadHook(JavaPlugin plugin) {
521534 debug ("Using AdvancedCore '" + getVersion () + "' built on '" + getTime () + "'" );
522535 }
523536
524- public ConcurrentHashMap <String , String > getUuids () {
525- return uuids ;
526- }
527-
528- private void loadUUIDs () {
529- uuids = new ConcurrentHashMap <String , String >();
530- Bukkit .getScheduler ().runTaskAsynchronously (plugin , new Runnable () {
531-
532- @ Override
533- public void run () {
534- for (String uuid : UserManager .getInstance ().getAllUUIDs ()) {
535- User user = UserManager .getInstance ().getUser (new UUID (uuid ));
536- String name = user .getData ().getString ("PlayerName" );
537- if (uuids .containsKey (name )) {
538- debug ("Duplicate uuid? " + uuid + " : " + name + " Other key: " + uuids .get (name ));
539- }
540- uuids .put (name , uuid );
541- }
542- debug ("Loaded uuids in the background" );
543- }
544- });
545- }
546-
547537 /**
548538 * Load logger
549539 */
@@ -578,6 +568,25 @@ public void loadUserAPI(UserStorage storageType) {
578568 }
579569 }
580570
571+ private void loadUUIDs () {
572+ uuids = new ConcurrentHashMap <String , String >();
573+ Bukkit .getScheduler ().runTaskAsynchronously (plugin , new Runnable () {
574+
575+ @ Override
576+ public void run () {
577+ for (String uuid : UserManager .getInstance ().getAllUUIDs ()) {
578+ User user = UserManager .getInstance ().getUser (new UUID (uuid ));
579+ String name = user .getData ().getString ("PlayerName" );
580+ if (uuids .containsKey (name )) {
581+ debug ("Duplicate uuid? " + uuid + " : " + name + " Other key: " + uuids .get (name ));
582+ }
583+ uuids .put (name , uuid );
584+ }
585+ debug ("Loaded uuids in the background" );
586+ }
587+ });
588+ }
589+
581590 public void loadValueRequestInputCommands () {
582591 try {
583592 final Field bukkitCommandMap = Bukkit .getServer ().getClass ().getDeclaredField ("commandMap" );
@@ -623,6 +632,10 @@ public void run(Runnable run) {
623632 com .Ben12345rocks .AdvancedCore .Thread .Thread .getInstance ().run (run );
624633 }
625634
635+ public void setAlternateUUIDLookUp (boolean alternateUUIDLookUp ) {
636+ this .alternateUUIDLookUp = alternateUUIDLookUp ;
637+ }
638+
626639 /**
627640 * @param autoDownload
628641 * the autoDownload to set
@@ -631,6 +644,10 @@ public void setAutoDownload(boolean autoDownload) {
631644 this .autoDownload = autoDownload ;
632645 }
633646
647+ public void setAutoKillInvs (boolean autoKillInvs ) {
648+ this .autoKillInvs = autoKillInvs ;
649+ }
650+
634651 public synchronized void setCheckOnWorldChange (boolean checkOnWorldChange ) {
635652 this .checkOnWorldChange = checkOnWorldChange ;
636653 }
@@ -691,6 +708,10 @@ public void setLogDebugToFile(boolean logDebugToFile) {
691708 this .logDebugToFile = logDebugToFile ;
692709 }
693710
711+ public void setMaxMysqlSize (int maxMysqlSize ) {
712+ this .maxMysqlSize = maxMysqlSize ;
713+ }
714+
694715 /**
695716 * @param mysql
696717 * the mysql to set
@@ -703,6 +724,10 @@ public void setMysql(MySQL mysql) {
703724 this .mysql = mysql ;
704725 }
705726
727+ public void setNextPageTxt (String nextPageTxt ) {
728+ this .nextPageTxt = nextPageTxt ;
729+ }
730+
706731 public void setPermPrefix (String permPrefix ) {
707732 this .permPrefix = permPrefix ;
708733 }
@@ -715,6 +740,10 @@ public void setPreloadUsers(boolean preloadUsers) {
715740 this .preloadUsers = preloadUsers ;
716741 }
717742
743+ public void setPrevPageTxt (String prevPageTxt ) {
744+ this .prevPageTxt = prevPageTxt ;
745+ }
746+
718747 /**
719748 * @param resourceId
720749 * the resourceId to set
@@ -733,6 +762,7 @@ public void setSendScoreboards(boolean sendScoreboards) {
733762
734763 public void setStorageType (UserStorage storageType ) {
735764 this .storageType = storageType ;
765+ loadUserAPI (storageType );
736766 }
737767
738768 /**
@@ -765,8 +795,4 @@ private boolean setupPermissions() {
765795 public void update () {
766796 TimeChecker .getInstance ().update ();
767797 }
768-
769- public boolean isAlternateUUIDLookUp () {
770- return alternateUUIDLookUp ;
771- }
772798}
0 commit comments