mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-12-04 14:03:24 +01:00
Fix database and loading when using bungeecord
This commit is contained in:
parent
ff8660731f
commit
be6c0b49cb
@ -207,7 +207,7 @@ public boolean isBungeeCordModeEnabled()
|
||||
{
|
||||
logger.warning("You have BungeeCord enabled, but it looks like you have not enabled it in your spigot.yml! You probably should check your configuration.");
|
||||
}
|
||||
else if(!useBungee && spigotUsesBungee && getDatabaseType().equals("mysql"))
|
||||
else if(!useBungee && spigotUsesBungee && getDatabaseType() == DatabaseType.MYSQL)
|
||||
{
|
||||
logger.warning("Your server is running behind a BungeeCord server. If you are using the plugin on more than one server please make sure to also enable the 'UseBungeeCord' config option.");
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public void close()
|
||||
backend.setAsyncSave(false);
|
||||
unCacheStrategy.close();
|
||||
cache.getCachedPlayers().forEach(player -> {
|
||||
Backpack bp = ((Backpack) player.getBackpack());
|
||||
Backpack bp = player.getBackpack();
|
||||
if(bp != null) bp.closeAll();
|
||||
}); //TODO change when multi-page backpacks are added
|
||||
cache.close();
|
||||
@ -151,17 +151,19 @@ private void loadPlayer(final @NotNull MinepacksPlayerData player)
|
||||
backend.loadPlayer(player);
|
||||
|
||||
player.notifyOnLoad(p -> {
|
||||
if(bungeeCordMode)
|
||||
if(!bungeeCordMode)
|
||||
{
|
||||
//TODO delayed backpack loading
|
||||
}
|
||||
else
|
||||
{
|
||||
backend.loadBackpack(player);
|
||||
loadBackpack(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void loadBackpack(final @NotNull MinepacksPlayerData player)
|
||||
{
|
||||
player.setBackpackLoadingRequested(true);
|
||||
backend.loadPlayer(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLoginEvent(final @NotNull PlayerJoinEvent event)
|
||||
{
|
||||
|
@ -54,6 +54,7 @@ public class MinepacksPlayerData implements MinepacksPlayerExtended, ICacheableP
|
||||
private ItemConfig backpackStyle = null;
|
||||
@Getter private Backpack backpack = null;
|
||||
@Getter private long cooldown = 0;
|
||||
@Getter @Setter private boolean backpackLoadingRequested = false;
|
||||
|
||||
@Getter @Setter private Object databaseKey = null;
|
||||
private final Queue<Callback<at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack>> backpackLoadedQueue = new ConcurrentLinkedQueue<>();
|
||||
@ -212,7 +213,11 @@ public boolean isBackpackLoaded()
|
||||
public void getBackpack(final @NotNull Callback<at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack> callback)
|
||||
{
|
||||
if(isBackpackLoaded()) callback.onResult(backpack);
|
||||
else backpackLoadedQueue.add(callback);
|
||||
else
|
||||
{
|
||||
if(!backpackLoadingRequested) Minepacks.getInstance().getDatabase().loadBackpack(this);
|
||||
backpackLoadedQueue.add(callback);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,7 +162,7 @@ private void checkOldDataFolder()
|
||||
if(oldPluginFolder.exists() && !oldPluginFolder.renameTo(getDataFolder()))
|
||||
{
|
||||
getLogger().warning("Failed to rename the plugins data-folder.\n" +
|
||||
"Please rename the \"MinePacks\" folder to \"Minepacks\" and restart the server, to move your data from Minepacks V1.X to Minepacks V2.X!");
|
||||
"Please rename the \"MinePacks\" folder to \"Minepacks\" and restart the server, to move your data from Minepacks V1.X to Minepacks V2.X!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user