mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-01-23 09:41:23 +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;
|
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.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
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 {
|
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)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void a(PlayerDeathEvent event) {
|
public void a(PlayerDeathEvent event) {
|
||||||
PlayerData data = PlayerData.get(event.getEntity());
|
if (!PlayerData.has(event.getEntity()))
|
||||||
int loss = (int) (data.getExperience() * this.loss);
|
return;
|
||||||
data.setExperience(data.getExperience() - loss);
|
|
||||||
if(data.isOnline())
|
PlayerData data = PlayerData.get(event.getEntity());
|
||||||
new ConfigMessage("death-exp-loss").addPlaceholders("loss", "" + loss).send(data.getPlayer());
|
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