Decrease Drunkeness on Death

This commit is contained in:
Sn0wStorm 2013-09-07 19:27:46 +02:00
parent dcf92cf074
commit 080bcf2d76
2 changed files with 11 additions and 3 deletions

View File

@ -427,7 +427,7 @@ public class BPlayer {
if (type.isInstant()) {
type.createEffect(0, duration - 1).apply(player);
} else {
int amplifier = brew.getQuality() / 3;
int amplifier = brew.getQuality() / 4;
duration /= type.getDurationModifier();
type.createEffect(duration * 20, amplifier).apply(player);
}

View File

@ -135,10 +135,18 @@ public class PlayerListener implements Listener {
}
}
// Player has died! He should no longer be drunk
// Player has died! Decrease Drunkeness by 20
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event) {
BPlayer.players.remove(event.getPlayer().getName());
String playerName = event.getPlayer().getName();
BPlayer bPlayer = BPlayer.get(playerName);
if (bPlayer != null) {
if (bPlayer.getDrunkeness() > 20) {
bPlayer.setData(bPlayer.getDrunkeness() - 20, 0);
} else {
BPlayer.players.remove(playerName);
}
}
}
// player walks while drunk, push him around!