forked from Upstream/mmocore
'now-in-combat' and 'leave-combat' can now be empty.
This commit is contained in:
parent
36bfa5df68
commit
58a0e87f82
@ -5,16 +5,20 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.PlayerCombatEvent;
|
||||
import net.Indyuce.mmocore.manager.ConfigManager;
|
||||
|
||||
public class CombatRunnable extends BukkitRunnable {
|
||||
private final PlayerData player;
|
||||
|
||||
private long lastHit = System.currentTimeMillis();
|
||||
private ConfigManager config;
|
||||
|
||||
public CombatRunnable(PlayerData player) {
|
||||
this.player = player;
|
||||
|
||||
player.getPlayer().sendMessage(MMOCore.plugin.configManager.getSimpleMessage("now-in-combat"));
|
||||
config = MMOCore.plugin.configManager;
|
||||
|
||||
if(!config.getSimpleMessage("now-in-combat").isEmpty()) player.getPlayer().sendMessage(config.getSimpleMessage("now-in-combat"));
|
||||
Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, true));
|
||||
runTaskTimer(MMOCore.plugin, 20, 20);
|
||||
}
|
||||
@ -27,7 +31,7 @@ public class CombatRunnable extends BukkitRunnable {
|
||||
public void run() {
|
||||
if (lastHit + 10000 < System.currentTimeMillis()) {
|
||||
Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, false));
|
||||
player.getPlayer().sendMessage(MMOCore.plugin.configManager.getSimpleMessage("leave-combat"));
|
||||
if(!config.getSimpleMessage("leave-combat").isEmpty()) player.getPlayer().sendMessage(config.getSimpleMessage("leave-combat"));
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user