Remove Drunkeness on Death

This commit is contained in:
Sn0wStorm 2013-09-06 00:22:39 +02:00
parent c691fea1ee
commit dcf92cf074
3 changed files with 16 additions and 4 deletions

View File

@ -42,7 +42,8 @@ public class BRecipe {
if (mat != null) {
this.ingredients.put(Material.matchMaterial(ingredParts[0]), P.p.parseInt(ingredParts[1]));
} else {
P.p.errorLog("Unknown Material: " + ingredParts[0]);
P.p.errorLog("Unbekanntes Material: " + ingredParts[0]);
this.ingredients = null;
return;
}
} else {

View File

@ -165,7 +165,7 @@ public class P extends JavaPlugin {
if (recipe.isValid()) {
BIngredients.recipes.add(recipe);
} else {
errorLog("Recipe with id: '" + recipeId + "' failed to load!");
errorLog("Laden des Rezeptes mit id: '" + recipeId + "' fehlgeschlagen!");
}
}
}
@ -175,8 +175,12 @@ public class P extends JavaPlugin {
if (configSection != null) {
for (String ingredient : configSection.getKeys(false)) {
Material mat = Material.matchMaterial(ingredient);
BIngredients.cookedNames.put(mat, (configSection.getString(ingredient, null)));
BIngredients.possibleIngredients.add(mat);
if (mat != null) {
BIngredients.cookedNames.put(mat, (configSection.getString(ingredient, null)));
BIngredients.possibleIngredients.add(mat);
} else {
errorLog("Unbekanntes Material: " + ingredient);
}
}
}

View File

@ -3,6 +3,7 @@ package com.dre.brewery.listeners;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerLoginEvent;
@ -134,6 +135,12 @@ public class PlayerListener implements Listener {
}
}
// Player has died! He should no longer be drunk
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event) {
BPlayer.players.remove(event.getPlayer().getName());
}
// player walks while drunk, push him around!
@EventHandler(priority = EventPriority.LOW)
public void onPlayerMove(PlayerMoveEvent event) {