mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-01-08 07:27:41 +01:00
Fixed an issue with citizens
This commit is contained in:
parent
ab177461d4
commit
966ef01b36
@ -1,23 +1,25 @@
|
||||
package net.Indyuce.mmocore.listener.option;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.ConfigMessage;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.ConfigMessage;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
|
||||
public class DeathExperienceLoss implements Listener {
|
||||
private final double loss = MMOCore.plugin.getConfig().getDouble("death-exp-loss.percent") / 100;
|
||||
private final double loss = MMOCore.plugin.getConfig().getDouble("death-exp-loss.percent") / 100;
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void a(PlayerDeathEvent event) {
|
||||
PlayerData data = PlayerData.get(event.getEntity());
|
||||
int loss = (int) (data.getExperience() * this.loss);
|
||||
data.setExperience(data.getExperience() - loss);
|
||||
if(data.isOnline())
|
||||
new ConfigMessage("death-exp-loss").addPlaceholders("loss", "" + loss).send(data.getPlayer());
|
||||
}
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void a(PlayerDeathEvent event) {
|
||||
if (!PlayerData.has(event.getEntity()))
|
||||
return;
|
||||
|
||||
PlayerData data = PlayerData.get(event.getEntity());
|
||||
int loss = (int) (data.getExperience() * this.loss);
|
||||
data.setExperience(data.getExperience() - loss);
|
||||
if (data.isOnline())
|
||||
new ConfigMessage("death-exp-loss").addPlaceholders("loss", "" + loss).send(data.getPlayer());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user