Debug profession & chance stat

This commit is contained in:
Ka0rX 2022-07-25 16:39:38 +02:00
parent b5825c370a
commit dc2efdea99
4 changed files with 11 additions and 9 deletions

View File

@ -284,8 +284,9 @@ public class MMOCore extends JavaPlugin {
getLogger().log(Level.WARNING, "Could not load hotbar swapping: " + exception.getMessage());
}
if (getConfig().getBoolean("prevent-spawner-xp"))
if (getConfig().getBoolean("prevent-spawner-xp")) {
Bukkit.getPluginManager().registerEvents(new NoSpawnerEXP(), this);
}
if (getConfig().getBoolean("death-exp-loss.enabled"))
Bukkit.getPluginManager().registerEvents(new DeathExperienceLoss(), this);

View File

@ -1,6 +1,5 @@
package net.Indyuce.mmocore.experience.source;
import com.guillaumevdn.questcreator.lib.event.PlayerKillEntityEvent;
import io.lumine.mythic.lib.api.MMOLineConfig;
import io.lumine.mythic.lib.api.event.PlayerKillEntityEvent;
import net.Indyuce.mmocore.MMOCore;
@ -33,12 +32,12 @@ public class KillMobExperienceSource extends SpecificExperienceSource<Entity> {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void a(PlayerKillEntityEvent event) {
Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> {
if (event.getKilled().isDead() && !event.getKilled().getPersistentDataContainer().has(new NamespacedKey(MMOCore.plugin,"spawner_spawned"),PersistentDataType.STRING)) {
if (event.getTarget().isDead() && !event.getTarget().getPersistentDataContainer().has(new NamespacedKey(MMOCore.plugin,"spawner_spawned"),PersistentDataType.STRING)) {
PlayerData data = PlayerData.get(event.getPlayer());
for (KillMobExperienceSource source : getSources())
if (source.matches(data, event.getKilled()))
source.giveExperience(data, 1, MMOCoreUtils.getCenterLocation(event.getKilled()));
if (source.matches(data, event.getTarget()))
source.giveExperience(data, 1, MMOCoreUtils.getCenterLocation(event.getTarget()));
}
}, 2);
}

View File

@ -1,6 +1,7 @@
package net.Indyuce.mmocore.listener.option;
import net.Indyuce.mmocore.MMOCore;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -11,9 +12,9 @@ import org.bukkit.persistence.PersistentDataType;
public class NoSpawnerEXP implements Listener {
@EventHandler
public void a(CreatureSpawnEvent event) {
if(event.getSpawnReason() == SpawnReason.SPAWNER)
public void onSpawn(CreatureSpawnEvent event) {
if(event.getSpawnReason() == SpawnReason.SPAWNER) {
event.getEntity().getPersistentDataContainer().set(new NamespacedKey(MMOCore.plugin,"spawner_spawned"), PersistentDataType.STRING,"true");
event.getEntity().setMetadata("spawner_spawned", new FixedMetadataValue(MMOCore.plugin, true));
}
}
}

View File

@ -219,9 +219,10 @@ ability-targeting-options:
# Prevent heals/buffs UNLESS the player is in your party/guild
cant-heal-neutrals: false
# Prevents mobs spawned from spawners from giving XP points.
# Prevents mobs spawned from spawners from giving MMO XP points.
prevent-spawner-xp: true
# Timer for combat log to expire (in seconds)
combat-log:
timer: 10