forked from Upstream/mmocore
Fixes craftitem experience source providing XP when non-stackable is clicked
This commit is contained in:
parent
0749398e35
commit
09ebde5676
@ -11,6 +11,7 @@ import net.Indyuce.mmocore.api.experience.source.type.SpecificExperienceSource;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.manager.profession.ExperienceManager;
|
||||
import net.mmogroup.mmolib.api.MMOLineConfig;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
|
||||
public class CraftItemExperienceSource extends SpecificExperienceSource<Material> {
|
||||
public final Material material;
|
||||
@ -25,9 +26,9 @@ public class CraftItemExperienceSource extends SpecificExperienceSource<Material
|
||||
@Override
|
||||
public ExperienceManager<CraftItemExperienceSource> newManager() {
|
||||
return new ExperienceManager<CraftItemExperienceSource>() {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void a(CraftItemEvent event) {
|
||||
if(event.getAction() == InventoryAction.NOTHING) return;
|
||||
PlayerData data = PlayerData.get((Player) event.getWhoClicked());
|
||||
for (CraftItemExperienceSource source : getSources())
|
||||
if (source.matches(data, event.getInventory().getResult().getType()))
|
||||
@ -36,6 +37,10 @@ public class CraftItemExperienceSource extends SpecificExperienceSource<Material
|
||||
};
|
||||
}
|
||||
|
||||
private void debug(Object s1, Object s2) {
|
||||
System.out.println("[DEBUG] " + s1 + ": " + s2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(PlayerData player, Material obj) {
|
||||
return material == obj && hasRightClass(player);
|
||||
|
Loading…
Reference in New Issue
Block a user