mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2025-02-11 00:21:19 +01:00
Decrease Drunkeness on Death
This commit is contained in:
parent
dcf92cf074
commit
080bcf2d76
@ -427,7 +427,7 @@ public class BPlayer {
|
|||||||
if (type.isInstant()) {
|
if (type.isInstant()) {
|
||||||
type.createEffect(0, duration - 1).apply(player);
|
type.createEffect(0, duration - 1).apply(player);
|
||||||
} else {
|
} else {
|
||||||
int amplifier = brew.getQuality() / 3;
|
int amplifier = brew.getQuality() / 4;
|
||||||
duration /= type.getDurationModifier();
|
duration /= type.getDurationModifier();
|
||||||
type.createEffect(duration * 20, amplifier).apply(player);
|
type.createEffect(duration * 20, amplifier).apply(player);
|
||||||
}
|
}
|
||||||
|
@ -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
|
@EventHandler
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
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!
|
// player walks while drunk, push him around!
|
||||||
|
Loading…
Reference in New Issue
Block a user