Enable MountChicken with some small modifications and add it to Thankful Chest

This commit is contained in:
AlexTheCoder 2016-11-22 21:40:34 -05:00 committed by Shaun Bennett
parent cfa5512141
commit c028edb064
4 changed files with 33 additions and 12 deletions

View File

@ -108,6 +108,11 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Haunted Chests"); itemLore.add(C.cBlue + "Found in Haunted Chests");
} }
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -15)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Thankful Treasure");
}
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -14) else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -14)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);

View File

@ -25,6 +25,7 @@ import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.mount.types.MountBabyReindeer; import mineplex.core.mount.types.MountBabyReindeer;
import mineplex.core.mount.types.MountCart; import mineplex.core.mount.types.MountCart;
import mineplex.core.mount.types.MountChicken;
import mineplex.core.mount.types.MountDragon; import mineplex.core.mount.types.MountDragon;
import mineplex.core.mount.types.MountFreedomHorse; import mineplex.core.mount.types.MountFreedomHorse;
import mineplex.core.mount.types.MountFrost; import mineplex.core.mount.types.MountFrost;
@ -77,7 +78,7 @@ public class MountManager extends MiniPlugin
_types.add(new MountFreedomHorse(this)); _types.add(new MountFreedomHorse(this));
_types.add(new MountNightmareSteed(this)); _types.add(new MountNightmareSteed(this));
// Hidden in this update // Hidden in this update
//_types.add(new MountChicken(this)); _types.add(new MountChicken(this));
//_types.add(new MountSheep(this)); //_types.add(new MountSheep(this));
} }

View File

@ -1,10 +1,6 @@
package mineplex.core.mount.types; package mineplex.core.mount.types;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.time.Month;
import java.time.YearMonth;
import net.minecraft.server.v1_8_R3.EntityLiving;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -12,9 +8,12 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerAnimationType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
@ -29,6 +28,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.utils.UtilVariant; import mineplex.core.utils.UtilVariant;
import net.minecraft.server.v1_8_R3.EntityLiving;
public class MountChicken extends HorseMount public class MountChicken extends HorseMount
{ {
@ -40,13 +40,15 @@ public class MountChicken extends HorseMount
super(manager, "Chicken Mount", super(manager, "Chicken Mount",
UtilText.splitLinesToArray(new String[] UtilText.splitLinesToArray(new String[]
{ {
"This isn't flying! It is falling with style." C.cGray + "This isn't flying! It is falling with style.",
C.cRed + " ",
C.cWhite + "Left Click to Bawk"
}, LineFormat.LORE), }, LineFormat.LORE),
Material.FEATHER, (byte) 0, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR, YearMonth.of(2017, Month.JANUARY)); Material.FEATHER, (byte) 0, -15, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR);
try try
{ {
_jumpField = EntityLiving.class.getDeclaredField("aY"); _jumpField = EntityLiving.class.getDeclaredField("aY");
_jumpField.setAccessible(false); _jumpField.setAccessible(true);
} catch (NoSuchFieldException e) } catch (NoSuchFieldException e)
{ {
e.printStackTrace(); e.printStackTrace();
@ -96,6 +98,18 @@ public class MountChicken extends HorseMount
UtilEnt.silence(horse, true); UtilEnt.silence(horse, true);
} }
@EventHandler
public void onOrderQuack(PlayerAnimationEvent event)
{
if (getActive().containsKey(event.getPlayer()) && event.getAnimationType() == PlayerAnimationType.ARM_SWING)
{
if (Recharge.Instance.use(event.getPlayer(), "Chicken Bawk", 500, false, false))
{
event.getPlayer().getWorld().playSound(getActive().get(event.getPlayer()).getEntity().getEyeLocation(), Sound.CHICKEN_IDLE, .4F, 1.0F);
}
}
}
@EventHandler @EventHandler
public void jump(UpdateEvent event) public void jump(UpdateEvent event)
{ {
@ -145,5 +159,4 @@ public class MountChicken extends HorseMount
} }
} }
} }
} }

View File

@ -119,6 +119,7 @@ import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.Mount; import mineplex.core.mount.Mount;
import mineplex.core.mount.types.MountBabyReindeer; import mineplex.core.mount.types.MountBabyReindeer;
import mineplex.core.mount.types.MountCart; import mineplex.core.mount.types.MountCart;
import mineplex.core.mount.types.MountChicken;
import mineplex.core.mount.types.MountFreedomHorse; import mineplex.core.mount.types.MountFreedomHorse;
import mineplex.core.mount.types.MountFrost; import mineplex.core.mount.types.MountFrost;
import mineplex.core.mount.types.MountMule; import mineplex.core.mount.types.MountMule;
@ -632,6 +633,7 @@ public class RewardManager
addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.MYTHICAL, 1, 3, rarity, 50, 0)); addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.MYTHICAL, 1, 3, rarity, 50, 0));
addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 30, 0)); addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 30, 0));
addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 30, 0)); addReward(Type.THANKFUL, new ChestReward(_inventoryManager, TreasureType.ILLUMINATED, 1, 1, rarity, 30, 0));
addMount(Type.THANKFUL, getMount(MountChicken.class), rarity, 5);
addPetReward(Type.THANKFUL, PetType.VILLAGER, rarity, 10); addPetReward(Type.THANKFUL, PetType.VILLAGER, rarity, 10);
addPetReward(Type.THANKFUL, PetType.PIG_ZOMBIE, rarity, 10); addPetReward(Type.THANKFUL, PetType.PIG_ZOMBIE, rarity, 10);
} }