mirror of
https://github.com/LordBoos/boosCooldowns.git
synced 2024-11-23 11:05:44 +01:00
fixed warmup stuck on death while warming up
This commit is contained in:
parent
22e152d78d
commit
d2fd5f03e9
@ -55,6 +55,9 @@ public class boosConfigManager {
|
||||
conf.setProperty(
|
||||
"commands.options.message_warmup_cancelled_by_sneak",
|
||||
"&6Warm-ups have been cancelled due to sneaking.&f");
|
||||
conf.setProperty(
|
||||
"commands.options.message_warmup_cancelled_by_death",
|
||||
"&6Warm-ups have been cancelled due to death.&f");
|
||||
conf.setProperty("commands.options.message_cooldown",
|
||||
"&6Wait&e &seconds& &unit&&6 before you can use command&e &command& &6again.&f");
|
||||
conf.setProperty("commands.options.message_warmup",
|
||||
@ -185,4 +188,10 @@ public class boosConfigManager {
|
||||
"&6Warm-ups have been cancelled due to sprinting.&f");
|
||||
}
|
||||
|
||||
public static String getWarmUpCancelledByDeathMessage() {
|
||||
return conf.getString(
|
||||
"commands.options.message_warmup_cancelled_by_death",
|
||||
"&6Warm-ups have been cancelled due to death.&f");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -145,6 +145,8 @@ public class boosCoolDown extends JavaPlugin {
|
||||
private void registerEvents(){
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener,
|
||||
Event.Priority.Lowest, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DEATH, playerListener,
|
||||
Event.Priority.Normal, this);
|
||||
if (boosConfigManager.getCancelWarmUpOnDamage()) {
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener,
|
||||
Event.Priority.Normal, this);
|
||||
|
@ -3,6 +3,7 @@ package cz.boosik.boosCooldown;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
|
||||
import util.boosChat;
|
||||
@ -15,7 +16,7 @@ public class boosCoolDownEntityListener extends EntityListener {
|
||||
plugin = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@ -47,4 +48,20 @@ public class boosCoolDownEntityListener extends EntityListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
if (entity != null && entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
if (player != null) {
|
||||
if (boosWarmUpManager.hasWarmUps(player)) {
|
||||
boosChat.sendMessageToPlayer(player, boosConfigManager
|
||||
.getWarmUpCancelledByDeathMessage());
|
||||
boosWarmUpManager.cancelWarmUps(player);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user