Merge pull request #32 in MIN/mineplex from Alex_MILKCOW to master
* commit 'cc24bb78d3968c0c364164fb43e19724007e3833': Fixed Cows being able to fly if they had the Rabbit Farmer kit Fixed new classes not appearing in repository Milk The Cow: New Gameplay Feature - When a cow charges a farmer, any milk in their bucket will be lost
This commit is contained in:
commit
0ff7cee229
@ -4,6 +4,33 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkRemoveEvent.RemoveType;
|
||||
import nautilus.game.arcade.game.games.milkcow.kits.KitCow;
|
||||
import nautilus.game.arcade.game.games.milkcow.kits.KitFarmerJump;
|
||||
import nautilus.game.arcade.game.games.milkcow.kits.KitSturdyFarmhand;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.NullKit;
|
||||
import net.minecraft.server.v1_7_R4.EntityCreature;
|
||||
import net.minecraft.server.v1_7_R4.Navigation;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -25,31 +52,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.milkcow.kits.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.NullKit;
|
||||
import net.minecraft.server.v1_7_R4.EntityCreature;
|
||||
import net.minecraft.server.v1_7_R4.Navigation;
|
||||
|
||||
public class MilkCow extends SoloGame
|
||||
{
|
||||
private GameTeam _farmers;
|
||||
@ -73,6 +75,7 @@ public class MilkCow extends SoloGame
|
||||
new Kit[]
|
||||
{
|
||||
new KitFarmerJump(manager),
|
||||
new KitSturdyFarmhand(manager),
|
||||
new NullKit(manager),
|
||||
new KitCow(manager),
|
||||
},
|
||||
@ -112,7 +115,7 @@ public class MilkCow extends SoloGame
|
||||
{
|
||||
if (team.GetColor() == ChatColor.RED)
|
||||
{
|
||||
if (kit.GetName().contains("Farmer"))
|
||||
if (kit.GetName().contains("Farm"))
|
||||
team.GetRestrictedKits().add(kit);
|
||||
}
|
||||
else
|
||||
@ -288,13 +291,17 @@ public class MilkCow extends SoloGame
|
||||
SetPlayerTeam(player, _cows, true);
|
||||
|
||||
//Kit
|
||||
Kit newKit = GetKits()[2];
|
||||
Kit newKit = GetKits()[3];
|
||||
|
||||
SetKit(player, newKit, false);
|
||||
newKit.ApplyKit(player);
|
||||
|
||||
//Refresh
|
||||
VisibilityManager.Instance.refreshPlayerToAll(player);
|
||||
|
||||
//Turn off flight
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
|
||||
if (forced)
|
||||
{
|
||||
@ -345,7 +352,9 @@ public class MilkCow extends SoloGame
|
||||
@EventHandler
|
||||
public void LoseMilk(PlayerDeathEvent event)
|
||||
{
|
||||
SetScore(event.getEntity(), Math.max(0, GetScore(event.getEntity()) - 5));
|
||||
MilkRemoveEvent e = new MilkRemoveEvent(event.getEntity(), 5, RemoveType.DEATH);
|
||||
Bukkit.getPluginManager().callEvent(e);
|
||||
SetScore(event.getEntity(), Math.max(0, GetScore(event.getEntity()) - e.GetMilk()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -0,0 +1,56 @@
|
||||
package nautilus.game.arcade.game.games.milkcow;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class MilkRemoveEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Player _player;
|
||||
private int _milk;
|
||||
private RemoveType _cause;
|
||||
|
||||
public MilkRemoveEvent(Player player, int milk, RemoveType cause)
|
||||
{
|
||||
_player = player;
|
||||
_milk = milk;
|
||||
_cause = cause;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Player GetPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public int GetMilk()
|
||||
{
|
||||
return _milk;
|
||||
}
|
||||
|
||||
public RemoveType GetCause()
|
||||
{
|
||||
return _cause;
|
||||
}
|
||||
|
||||
public void SetMilk(int milk)
|
||||
{
|
||||
_milk = milk;
|
||||
}
|
||||
|
||||
public static enum RemoveType
|
||||
{
|
||||
FLING, DEATH;
|
||||
}
|
||||
|
||||
}
|
@ -33,7 +33,7 @@ public class KitCow extends AbbreviatedKit
|
||||
new PerkKnockbackMultiplier(4),
|
||||
new PerkCharge(),
|
||||
new PerkCowBomb(),
|
||||
new PerkSeismicCow(),
|
||||
new PerkSeismicCow("Body Slam"),
|
||||
},
|
||||
EntityType.COW,
|
||||
null);
|
||||
@ -67,7 +67,7 @@ public class KitCow extends AbbreviatedKit
|
||||
new String[]
|
||||
{
|
||||
ChatColor.RESET + "Charge with great power, flinging",
|
||||
ChatColor.RESET + "filthy farmers out of your way!",
|
||||
ChatColor.RESET + "filthy farmers out of your way, making them drop the milk in their buckets!",
|
||||
}));
|
||||
|
||||
//Disguise
|
||||
|
@ -0,0 +1,51 @@
|
||||
package nautilus.game.arcade.game.games.milkcow.kits;
|
||||
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkIronSkin;
|
||||
import nautilus.game.arcade.kit.perks.PerkNoSpillMilk;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitSturdyFarmhand extends Kit
|
||||
{
|
||||
public KitSturdyFarmhand(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Sturdy Farmhand", KitAvailability.Gem, 2000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Been working on the ranch so long, even a charging bull can't faze him!"
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkNoSpillMilk(manager),
|
||||
new PerkIronSkin(2),
|
||||
},
|
||||
|
||||
EntityType.ZOMBIE,
|
||||
new ItemStack(Material.IRON_SPADE));
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void FireItemResist(UpdateEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET));
|
||||
}
|
||||
}
|
@ -2,23 +2,29 @@ package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkRemoveEvent;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkRemoveEvent.RemoveType;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkCharge extends Perk
|
||||
{
|
||||
public PerkCharge()
|
||||
@ -74,6 +80,19 @@ public class PerkCharge extends Perk
|
||||
|
||||
//Sound
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 0.75f, 1f);
|
||||
|
||||
if (cur instanceof Player)
|
||||
{
|
||||
MilkRemoveEvent e = new MilkRemoveEvent((Player)cur, 1, RemoveType.FLING);
|
||||
Bukkit.getPluginManager().callEvent(e);
|
||||
ItemStack bucket = e.GetPlayer().getInventory().getItem(0);
|
||||
if ((bucket.getType() == Material.MILK_BUCKET) && e.GetMilk() >= 0)
|
||||
{
|
||||
bucket.setType(Material.BUCKET);
|
||||
e.GetPlayer().getInventory().setItem(0, bucket);
|
||||
}
|
||||
UtilInv.Update(e.GetPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkRemoveEvent;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkRemoveEvent.RemoveType;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class PerkNoSpillMilk extends Perk
|
||||
{
|
||||
|
||||
public PerkNoSpillMilk(ArcadeManager manager)
|
||||
{
|
||||
super("Steady Hands", new String[]
|
||||
{
|
||||
C.cGray + "Lose less milk when you die",
|
||||
C.cGray + "Don't lose your bucket of milk when cows run into you",
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLoseMilk(MilkRemoveEvent event)
|
||||
{
|
||||
Player player = event.GetPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (event.GetCause() == RemoveType.DEATH)
|
||||
{
|
||||
if (event.GetMilk() > 3)
|
||||
event.SetMilk(3);
|
||||
}
|
||||
|
||||
if (event.GetCause() == RemoveType.FLING)
|
||||
{
|
||||
event.SetMilk(-1);
|
||||
}
|
||||
}
|
||||
}
|
@ -32,6 +32,14 @@ public class PerkSeismicCow extends Perk
|
||||
{
|
||||
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
|
||||
|
||||
public PerkSeismicCow(String displayName)
|
||||
{
|
||||
super(displayName, new String[]
|
||||
{
|
||||
C.cYellow + "Right-Click" + C.cGray + " with Shovel to " + C.cGreen + "Seismic Slam"
|
||||
});
|
||||
}
|
||||
|
||||
public PerkSeismicCow()
|
||||
{
|
||||
super("Seismic Slam", new String[]
|
||||
|
Loading…
Reference in New Issue
Block a user