Fixed item repair exp dupe glitch

This commit is contained in:
Jules 2023-11-25 15:07:09 +01:00
parent 22744b181b
commit c211c05a67
2 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmocore.experience.source;
import io.lumine.mythic.lib.UtilityMethods;
import io.lumine.mythic.lib.api.MMOLineConfig;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData;
@ -21,7 +22,7 @@ public class PlayExperienceSource extends SpecificExperienceSource {
/**
* Experience source giving the specified amount of xp to all the players online each second in certain world bounds.
* If no bounds are given, it will give the xp to every player online. You can also specifiy if the player
* If no bounds are given, it will give the xp to every player online. You can also specify if the player
* has to be inCombat or not to get the xp.
*/
public PlayExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) {
@ -71,13 +72,12 @@ public class PlayExperienceSource extends SpecificExperienceSource {
@Override
public void run() {
Bukkit.getOnlinePlayers().forEach((player) -> {
if (!player.hasMetadata("NPC")) {
Bukkit.getOnlinePlayers().forEach(player -> {
if (UtilityMethods.isRealPlayer(player)) {
PlayerData playerData = PlayerData.get(player);
for (PlayExperienceSource source : getSources()) {
for (PlayExperienceSource source : getSources())
if (source.matchesParameter(playerData, null))
giveExperience(playerData, 1, null);
}
}
});
}

View File

@ -48,7 +48,7 @@ public class RepairItemExperienceSource extends ExperienceSource<ItemStack> {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void a(InventoryClickEvent event) {
if (event.getInventory() == null || event.getInventory().getType() != InventoryType.ANVIL || event.getSlot() != 2)
if (event.getInventory() == null || event.getInventory().getType() != InventoryType.ANVIL || event.getRawSlot() != 2)
return;
// Check if there's exp associated to it