Farmers lose 5 milk when dying.

This commit is contained in:
Chiss 2013-09-15 14:21:10 +10:00
parent 6b5373c20c
commit 6f03c57c22

View File

@ -17,6 +17,7 @@ import org.bukkit.entity.Pig;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Villager; import org.bukkit.entity.Villager;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent; import org.bukkit.event.player.PlayerItemConsumeEvent;
@ -75,11 +76,13 @@ public class MilkCow extends SoloGame
new String[] new String[]
{ {
"Each Farmer must gather milk.", "Farmers get 1 point for drinking milk.",
"Drink 15 buckets of milk to win!", "You lose 5 points for dying!",
"", "",
"Cow must stop his herd from being milked.", "Cows get 1 point for killing farmers.",
"Kill all the farmers to win!" "Defend your herd to stop farmers!",
"",
"First player to 15 points wins!"
}); });
this.CompassEnabled = true; this.CompassEnabled = true;
@ -330,6 +333,12 @@ public class MilkCow extends SoloGame
this.AddGems(event.getPlayer(), 0.5, "Milk Drunk", true); this.AddGems(event.getPlayer(), 0.5, "Milk Drunk", true);
} }
@EventHandler
public void LoseMilk(PlayerDeathEvent event)
{
SetScore(event.getEntity(), Math.max(0, GetScore(event.getEntity()) - 5));
}
@EventHandler @EventHandler
public void KillFarmer(CombatDeathEvent event) public void KillFarmer(CombatDeathEvent event)
{ {