mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
Fixed non native RPG plugin compatibility
This commit is contained in:
parent
dc404e312d
commit
2e0568c7b7
@ -236,7 +236,7 @@ public class MMOItems extends JavaPlugin {
|
||||
findRpgPlugin();
|
||||
|
||||
// compatibility with /reload
|
||||
Bukkit.getOnlinePlayers().forEach(player -> PlayerData.load(player));
|
||||
Bukkit.getScheduler().runTask(this, () -> Bukkit.getOnlinePlayers().forEach(player -> PlayerData.load(player)));
|
||||
|
||||
// advanced recipes
|
||||
getLogger().log(Level.INFO, "Loading recipes, please wait...");
|
||||
@ -314,11 +314,11 @@ public class MMOItems extends JavaPlugin {
|
||||
Validate.notNull(handler, "RPGHandler cannot be null");
|
||||
|
||||
// unregister events from current rpgPlugin instance
|
||||
if (rpgPlugin != null && rpgPlugin instanceof Listener)
|
||||
if (rpgPlugin != null && rpgPlugin instanceof Listener && isEnabled())
|
||||
HandlerList.unregisterAll((Listener) rpgPlugin);
|
||||
|
||||
rpgPlugin = handler;
|
||||
if (handler instanceof Listener)
|
||||
if (handler instanceof Listener && isEnabled())
|
||||
Bukkit.getPluginManager().registerEvents((Listener) handler, this);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler
|
||||
public void loadPlayerData(PlayerJoinEvent event) {
|
||||
PlayerData.load(event.getPlayer());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user