mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-27 03:28:30 +01:00
Allow to disable the death messages of minecraft
This commit is contained in:
parent
ac794bb2b7
commit
3496df6468
@ -9,6 +9,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
|||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityListener;
|
import org.bukkit.event.entity.EntityListener;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
@ -69,16 +70,21 @@ public class EssentialsEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityDeath(EntityDeathEvent event)
|
public void onEntityDeath(final EntityDeathEvent event)
|
||||||
{
|
{
|
||||||
if (event.getEntity() instanceof Player)
|
if (event instanceof PlayerDeathEvent)
|
||||||
{
|
{
|
||||||
User user = ess.getUser(event.getEntity());
|
final PlayerDeathEvent pdevent = (PlayerDeathEvent)event;
|
||||||
|
final User user = ess.getUser(pdevent.getEntity());
|
||||||
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
|
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
|
||||||
{
|
{
|
||||||
user.setLastLocation();
|
user.setLastLocation();
|
||||||
user.sendMessage(Util.i18n("backAfterDeath"));
|
user.sendMessage(Util.i18n("backAfterDeath"));
|
||||||
}
|
}
|
||||||
|
if (!ess.getSettings().areDeathMessagesEnabled())
|
||||||
|
{
|
||||||
|
pdevent.setDeathMessage("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,4 +132,6 @@ public interface ISettings extends IConf
|
|||||||
long getAutoAfkKick();
|
long getAutoAfkKick();
|
||||||
|
|
||||||
boolean getFreezeAfkPlayers();
|
boolean getFreezeAfkPlayers();
|
||||||
|
|
||||||
|
boolean areDeathMessagesEnabled();
|
||||||
}
|
}
|
||||||
|
@ -523,4 +523,10 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return config.getBoolean("freeze-afk-players", false);
|
return config.getBoolean("freeze-afk-players", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean areDeathMessagesEnabled()
|
||||||
|
{
|
||||||
|
return config.getBoolean("death-messages", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,9 @@ auto-afk-kick: -1
|
|||||||
# The player has to use the command /afk to leave the afk mode.
|
# The player has to use the command /afk to leave the afk mode.
|
||||||
freeze-afk-players: false
|
freeze-afk-players: false
|
||||||
|
|
||||||
|
# You can disable the death messages of minecraft here
|
||||||
|
death-messages: true
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
# | EssentialsHome | #
|
# | EssentialsHome | #
|
||||||
|
Loading…
Reference in New Issue
Block a user