mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-03 06:37:47 +01:00
Fixed MI not saving player data when players dont log off
This commit is contained in:
parent
05e9d89124
commit
8aaf30de0d
@ -95,6 +95,16 @@ public class MMOItems extends LuminePlugin {
|
||||
private VaultSupport vaultSupport;
|
||||
private RPGHandler rpgPlugin;
|
||||
|
||||
/**
|
||||
* Startup issues usually prevent the plugin from loading and just
|
||||
* call {@link #disable()} directly afterwards which prints out
|
||||
* another error log.
|
||||
* <p>
|
||||
* To prevent this, MMOItems stores a field to check if the plugin
|
||||
* has successfully enabled before trying to call {@link #disable()}
|
||||
*/
|
||||
private boolean hasLoadedSuccessfully;
|
||||
|
||||
private static final int MYTHICLIB_COMPATIBILITY_INDEX = 8;
|
||||
|
||||
public MMOItems() { plugin = this; }
|
||||
@ -102,7 +112,6 @@ public class MMOItems extends LuminePlugin {
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
|
||||
// Check if the ML build matches
|
||||
if (MYTHICLIB_COMPATIBILITY_INDEX != MythicLib.MMOITEMS_COMPATIBILITY_INDEX) {
|
||||
getLogger().log(Level.WARNING, "Your versions of MythicLib and MMOItems do not match. Make sure you are using the latest builds of both plugins");
|
||||
@ -312,13 +321,16 @@ public class MMOItems extends LuminePlugin {
|
||||
MMOItemsCommandTreeRoot mmoitemsCommand = new MMOItemsCommandTreeRoot();
|
||||
getCommand("mmoitems").setExecutor(mmoitemsCommand);
|
||||
getCommand("mmoitems").setTabCompleter(mmoitemsCommand);
|
||||
|
||||
// Mark plugin as successfully enabled
|
||||
hasLoadedSuccessfully = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
// Support for early plugin disabling
|
||||
if (!isEnabled())
|
||||
if (!hasLoadedSuccessfully)
|
||||
return;
|
||||
|
||||
// Save player data
|
||||
|
Loading…
Reference in New Issue
Block a user