mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-30 01:13:38 +01:00
Debug by removing skills from SkillSlots when the skills gets locked.Done by creating a Listener for ItemLockedEvent.
This commit is contained in:
parent
b62b0e89e9
commit
fc5b34a352
@ -47,6 +47,7 @@ public class MMOCoreBukkit {
|
|||||||
Bukkit.getPluginManager().registerEvents(new FishingListener(), plugin);
|
Bukkit.getPluginManager().registerEvents(new FishingListener(), plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(new PlayerCollectStats(), plugin);
|
Bukkit.getPluginManager().registerEvents(new PlayerCollectStats(), plugin);
|
||||||
Bukkit.getPluginManager().registerEvents(new PlayerPressKeyListener(), plugin);
|
Bukkit.getPluginManager().registerEvents(new PlayerPressKeyListener(), plugin);
|
||||||
|
Bukkit.getPluginManager().registerEvents(new SkillLockingListener(),plugin);
|
||||||
// Bukkit.getPluginManager().registerEvents(new ClassTriggers(), plugin);
|
// Bukkit.getPluginManager().registerEvents(new ClassTriggers(), plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package net.Indyuce.mmocore.listener;
|
||||||
|
|
||||||
|
import io.lumine.mythic.lib.api.event.unlocking.ItemLockedEvent;
|
||||||
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
public class SkillLockingListener implements Listener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unbind the skill from boundSkills when it becomes locked.
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onSkillLock(ItemLockedEvent event) {
|
||||||
|
if (event.getItemTypeId().equals("skill")) {
|
||||||
|
PlayerData playerData = PlayerData.get(event.getData().getUniqueId());
|
||||||
|
playerData.mapBoundSkills()
|
||||||
|
.forEach((slot, skillId) -> {
|
||||||
|
if (skillId.equalsIgnoreCase(event.getItemId()))
|
||||||
|
playerData.unbindSkill(slot);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user