summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-10-09 20:59:06 +0200
committersnowleo <schneeleo@gmail.com>2011-10-09 20:59:06 +0200
commit3496df6468ebdf5479693721255e3294e8cf1673 (patch)
tree2f6d7ca99627e887dad29684e562d0d0e3f692ff
parentac794bb2b7cdbc9dca1b7e4f4aafa77eacb6d750 (diff)
downloadEssentials-3496df6468ebdf5479693721255e3294e8cf1673.tar
Essentials-3496df6468ebdf5479693721255e3294e8cf1673.tar.gz
Essentials-3496df6468ebdf5479693721255e3294e8cf1673.tar.lz
Essentials-3496df6468ebdf5479693721255e3294e8cf1673.tar.xz
Essentials-3496df6468ebdf5479693721255e3294e8cf1673.zip
Allow to disable the death messages of minecraft
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java16
-rw-r--r--Essentials/src/com/earth2me/essentials/ISettings.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java6
-rw-r--r--Essentials/src/config.yml3
4 files changed, 22 insertions, 5 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
index f5d6cec48..083fa1687 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
@@ -9,6 +9,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityListener;
import org.bukkit.event.entity.FoodLevelChangeEvent;
+import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
@@ -69,24 +70,29 @@ public class EssentialsEntityListener extends EntityListener
}
@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"))
{
user.setLastLocation();
user.sendMessage(Util.i18n("backAfterDeath"));
}
+ if (!ess.getSettings().areDeathMessagesEnabled())
+ {
+ pdevent.setDeathMessage("");
+ }
}
}
@Override
public void onFoodLevelChange(FoodLevelChangeEvent event)
- {
+ {
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
- {
+ {
//TODO: Remove the following line, when we're happy to remove backwards compatability with 1185.
event.setFoodLevel(20);
event.setCancelled(true);
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index 54d1b1495..d058d892a 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -132,4 +132,6 @@ public interface ISettings extends IConf
long getAutoAfkKick();
boolean getFreezeAfkPlayers();
+
+ boolean areDeathMessagesEnabled();
}
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index d6a649786..9d11d675b 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -523,4 +523,10 @@ public class Settings implements ISettings
{
return config.getBoolean("freeze-afk-players", false);
}
+
+ @Override
+ public boolean areDeathMessagesEnabled()
+ {
+ return config.getBoolean("death-messages", true);
+ }
}
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 61cb7aefa..b5ad0d95a 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -238,6 +238,9 @@ auto-afk-kick: -1
# The player has to use the command /afk to leave the afk mode.
freeze-afk-players: false
+# You can disable the death messages of minecraft here
+death-messages: true
+
############################################################
# +------------------------------------------------------+ #
# | EssentialsHome | #