diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 5ea66bd15..bd55b33f0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -1,8 +1,12 @@ package mineplex.core.cosmetic.ui.page; +import java.time.Month; +import java.time.YearMonth; +import java.time.format.TextStyle; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -15,8 +19,10 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; import mineplex.core.common.util.banner.CountryFlag; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; @@ -149,7 +155,18 @@ public class GadgetPage extends ShopPageBase else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -14) { itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Power Play Club"); + YearMonth yearMonth = gadget.getYearMonth(); + if (yearMonth != null) + { + int year = yearMonth.getYear(); + Month month = yearMonth.getMonth(); + String monthName = month.getDisplayName(TextStyle.FULL, Locale.US); + itemLore.addAll(UtilText.splitLine(C.cBlue + "Monthly Power Play Club Reward for " + monthName + " " + year, LineFormat.LORE)); + } + else + { + itemLore.add(C.cBlue + "Found in Power Play Club"); + } } //Rank Unlocks diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index 821a325aa..86638709d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -1,8 +1,12 @@ package mineplex.core.cosmetic.ui.page; +import java.time.Month; +import java.time.YearMonth; +import java.time.format.TextStyle; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -11,6 +15,8 @@ import org.bukkit.event.inventory.ClickType; import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.button.MountButton; @@ -105,7 +111,18 @@ public class MountPage extends ShopPageBase else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -14) { itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Power Play Club"); + YearMonth yearMonth = mount.getYearMonth(); + if (yearMonth != null) + { + int year = yearMonth.getYear(); + Month month = yearMonth.getMonth(); + String monthName = month.getDisplayName(TextStyle.FULL, Locale.US); + itemLore.addAll(UtilText.splitLine(C.cBlue + "Monthly Power Play Club Reward for " + monthName + " " + year, LineFormat.LORE)); + } + else + { + itemLore.add(C.cBlue + "Found in Power Play Club"); + } } //Rank Unlocks diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index e0c1d4bcc..419576874 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -37,7 +37,6 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.commands.AmmoCommand; import mineplex.core.gadget.commands.LockCosmeticsCommand; -import mineplex.core.gadget.commands.ReindeerTestCommand; import mineplex.core.gadget.commands.UnlockCosmeticsCommand; import mineplex.core.gadget.event.GadgetChangeEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent; @@ -117,7 +116,6 @@ import mineplex.core.gadget.gadgets.morph.MorphEnderman; import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; import mineplex.core.gadget.gadgets.morph.MorphPig; import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; -import mineplex.core.gadget.gadgets.morph.MorphSleigh; import mineplex.core.gadget.gadgets.morph.MorphSlime; import mineplex.core.gadget.gadgets.morph.MorphSnowman; import mineplex.core.gadget.gadgets.morph.MorphSquid; @@ -139,10 +137,6 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoots; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitChestplate; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitHelmet; -import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitLeggings; import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; @@ -188,7 +182,6 @@ import mineplex.core.gadget.set.SetVampire; import mineplex.core.gadget.set.SetWisdom; import mineplex.core.gadget.set.suits.SetRaveSuit; import mineplex.core.gadget.set.suits.SetSpaceSuit; -import mineplex.core.gadget.set.suits.SetWindUpSuit; import mineplex.core.gadget.types.ArrowEffectGadget; import mineplex.core.gadget.types.DeathEffectGadget; import mineplex.core.gadget.types.DoubleJumpEffectGadget; @@ -283,7 +276,6 @@ public class GadgetManager extends MiniPlugin addCommand(new UnlockCosmeticsCommand(this)); addCommand(new LockCosmeticsCommand(this)); addCommand(new AmmoCommand(this)); - addCommand(new ReindeerTestCommand(this)); } private void createSets() @@ -296,7 +288,8 @@ public class GadgetManager extends MiniPlugin //Costumes addSet(new SetRaveSuit(this)); addSet(new SetSpaceSuit(this)); - addSet(new SetWindUpSuit(this)); + // Hidden in this update + //addSet(new SetWindUpSuit(this)); addSet(new SetParty(this)); addSet(new SetCupidsLove(this)); addSet(new SetEmerald(this)); @@ -342,10 +335,11 @@ public class GadgetManager extends MiniPlugin addGadget(new OutfitSpaceSuitLeggings(this)); addGadget(new OutfitSpaceSuitBoots(this)); - addGadget(new OutfitWindUpSuitHelmet(this)); + // Hidden in this update + /*addGadget(new OutfitWindUpSuitHelmet(this)); addGadget(new OutfitWindUpSuitChestplate(this)); addGadget(new OutfitWindUpSuitLeggings(this)); - addGadget(new OutfitWindUpSuitBoots(this)); + addGadget(new OutfitWindUpSuitBoots(this));*/ addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0)); @@ -372,11 +366,11 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphSquid(this)); addGadget(new MorphWitch(this)); addGadget(new MorphGrimReaper(this)); - // Not being added in this update! - //addGadget(new MorphMetalMan(this)); addGadget(new MorphTurkey(this)); - addGadget(new MorphSleigh(this)); - + // Hidden in this update + //addGadget(new MorphSleigh(this)); + //addGadget(new MorphMetalMan(this)); + // Particles addGadget(new ParticleFoot(this)); addGadget(new ParticleFireRings(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java index dcc94efa8..9f6bb794c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSleigh.java @@ -2,6 +2,8 @@ package mineplex.core.gadget.gadgets.morph; import java.io.File; import java.io.IOException; +import java.time.Month; +import java.time.YearMonth; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -34,8 +36,9 @@ import mineplex.core.updater.event.UpdateEvent; public class MorphSleigh extends MorphGadget { - // TODO JAVADOCS + LIMIT AMOUNT OF SLEIGHS - + /** + * Directions of the Sleigh, with the correct coord for the player to be teleported and the schematic name + */ public enum SleighDirection { NORTH("SleighMorphNorth.schematic", 0.5, 4.5), @@ -80,7 +83,7 @@ public class MorphSleigh extends MorphGadget public MorphSleigh(GadgetManager manager) { - super(manager, "Sleigh Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), -14, Material.STAINED_CLAY, (byte) 14); + super(manager, "Sleigh Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), -14, Material.STAINED_CLAY, (byte) 14, YearMonth.of(2016, Month.DECEMBER)); // Loads sleigh schematics for (SleighDirection sleighDirection : SleighDirection.values()) { @@ -117,6 +120,11 @@ public class MorphSleigh extends MorphGadget } } + /** + * Activates the sleigh effect when left-clicking + * This will be changed in the next releases + * @param event + */ @EventHandler public void activateSleigh(PlayerInteractEvent event) { @@ -166,6 +174,10 @@ public class MorphSleigh extends MorphGadget _sleighs.put(player, sleigh); } + /** + * Stops player from leaving the sleigh if it's activte + * @param event + */ @EventHandler public void onLeaveVehicle(VehicleExitEvent event) { @@ -179,6 +191,10 @@ public class MorphSleigh extends MorphGadget } } + /** + * Creates positions in the hub map + * TODO add arcade positions + */ private void buildPositions() { _positions.add(new SleighPosition(-11, 143, -30, SleighDirection.SOUTH, -9.5, 145.5, -28.5)); @@ -192,6 +208,10 @@ public class MorphSleigh extends MorphGadget _positions.add(new SleighPosition(136, 116, 85, SleighDirection.WEST, 140.5, 118.5, 86.5)); } + /** + * Removes sleighs if they run out of time, or moves them if they still have time + * @param event + */ @EventHandler public void onUpdate(UpdateEvent event) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java index 487ee3db1..b7a4fba03 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java @@ -1,5 +1,8 @@ package mineplex.core.gadget.gadgets.morph; +import java.time.Month; +import java.time.YearMonth; + import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; @@ -43,7 +46,7 @@ public class MorphSquid extends MorphGadget implements IThrown C.cWhite + "Swim to enable Fast Swimming", C.cWhite + "Sneak to shoot a fish above you" }, LineFormat.LORE), - -14, Material.INK_SACK, (byte) 0); + -14, Material.INK_SACK, (byte) 0, YearMonth.of(2016, Month.SEPTEMBER)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java index 323603fc4..6fc6a2f90 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTurkey.java @@ -1,5 +1,8 @@ package mineplex.core.gadget.gadgets.morph; +import java.time.Month; +import java.time.YearMonth; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -9,6 +12,7 @@ import org.bukkit.event.player.PlayerToggleSneakEvent; import com.mojang.authlib.GameProfile; import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguisePlayer; @@ -22,8 +26,13 @@ public class MorphTurkey extends MorphGadget public MorphTurkey(GadgetManager manager) { - super(manager, "Turkey Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, - LineFormat.LORE), 0, Material.GLASS, (byte) 0); + super(manager, "Turkey Morph", UtilText.splitLinesToArray(new String[] + { + C.cGray + "Gobble, Gobble, please don't stuff me!", + C.blankLine, + C.cWhite + "Sneak to gobble." + }, + LineFormat.LORE), -14, Material.COOKED_CHICKEN, (byte) 0, YearMonth.of(2016, Month.NOVEMBER)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java index e35a4b7e5..d394b3e87 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java @@ -1,5 +1,8 @@ package mineplex.core.gadget.gadgets.morph; +import java.time.Month; +import java.time.YearMonth; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -31,7 +34,7 @@ public class MorphWitch extends MorphGadget super(manager, "Witch Morph", UtilText.splitLinesToArray(new String[]{ C.cWhite + "Press sneak to summon your trusty bat and start brewing" }, LineFormat.LORE), - -14, Material.SKULL_ITEM, (byte) 3); + -14, Material.SKULL_ITEM, (byte) 3, YearMonth.of(2016, Month.OCTOBER)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java index 95b0c1092..07a32faaf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/Sleigh.java @@ -16,6 +16,9 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; import mineplex.core.gadget.gadgets.morph.MorphSleigh; +/** + * Creates the sleigh effect for the Sleigh Morph + */ public class Sleigh { @@ -41,6 +44,9 @@ public class Sleigh (sleighPosition.getDirection() == MorphSleigh.SleighDirection.WEST) ? 90f : -90f; } + /** + * Starts the sleigh effect + */ public void startEffect() { _originalLocation = _player.getLocation().clone(); @@ -55,6 +61,9 @@ public class Sleigh } } + /** + * Stops the sleigh effect + */ public void stopEffect() { restoreBlocks(); @@ -63,6 +72,13 @@ public class Sleigh _sleighPosition.setUsed(false); } + /** + * Pastes the schematic for the sleigh + * @param origin The location where the sleigh schematic will be placed + * @param playerX The X coord where player will be teleported + * @param playerZ The Z coord where player will be teleported + * @throws IOException + */ private void pasteSchematic(Location origin, int playerX, int playerZ) throws IOException { restoreBlocks(); @@ -97,6 +113,10 @@ public class Sleigh _arrow.setPassenger(_player); } + /** + * Updates sleigh to look like its moving + * @return true if the sleigh was moved, false if the time is over (3 seconds) + */ public boolean update() { _moves++; @@ -135,11 +155,17 @@ public class Sleigh return true; } + /** + * Plays sleigh sound to the player + */ public void playSound() { _player.playSound(_player.getLocation(), Sound.ORB_PICKUP, 1f, 1f); } + /** + * Restores the blocks that were changed from pasting the schematic + */ private void restoreBlocks() { for (Map.Entry entry : _oldBlockMaterials.entrySet()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java deleted file mode 100644 index c7ac99a3f..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighBlock.java +++ /dev/null @@ -1,53 +0,0 @@ -package mineplex.core.gadget.gadgets.morph.managers.sleigh; - -import org.bukkit.Material; - -public class SleighBlock -{ - - private int _x, _y, _z; - private Material _material; - private byte _data; - private boolean _middle; - - public SleighBlock(int x, int y, int z, Material material, int data, boolean middle) - { - _x = x; - _y = y; - _z = z; - _material = material; - _data = (byte) data; - _middle = middle; - } - - public int getX() - { - return _x; - } - - public int getY() - { - return _y; - } - - public int getZ() - { - return _z; - } - - public Material getMaterial() - { - return _material; - } - - public byte getData() - { - return _data; - } - - public boolean isMiddle() - { - return _middle; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java index bc44ea9c7..f8d76bd3d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighPosition.java @@ -2,6 +2,9 @@ package mineplex.core.gadget.gadgets.morph.managers.sleigh; import mineplex.core.gadget.gadgets.morph.MorphSleigh; +/** + * Handles positions from Sleigh and player, and the direction of the sleigh and player + */ public class SleighPosition { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java deleted file mode 100644 index 413a5ad53..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/sleigh/SleighReindeer.java +++ /dev/null @@ -1,170 +0,0 @@ -package mineplex.core.gadget.gadgets.morph.managers.sleigh; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Horse; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.EulerAngle; - -import mineplex.core.common.util.UtilEnt; - -public class SleighReindeer -{ - - private enum AntlerPosition - { - SOUTH(0.4, 0.2, 0.6, 0.7, 4.0, 2.0), - NORTH(-0.3, -0.25, -0.5, -0.6, 4.0, 2.0); - - private double _xA, _xB, _zA, _zB, _angleA, _angleB; - - AntlerPosition(double xA, double xB, double zA, double zB, double angleA, double angleB) - { - _xA = xA; - _xB = xB; - _zA = zA; - _zB = zB; - _angleA = angleA; - _angleB = angleB; - } - - public double getxA() - { - return _xA; - } - - public double getxB() - { - return _xB; - } - - public double getzA() - { - return _zA; - } - - public double getzB() - { - return _zB; - } - - public double getAngleA() - { - return _angleA; - } - - public double getAngleB() - { - return _angleB; - } - } - - private Location _location; - private int _yaw; - private Horse _horse; - private Arrow _base; - private ArmorStand _hornA; - private ArmorStand _hornB; - - public SleighReindeer(Location location, int yaw) - { - _location = location; - _yaw = yaw; - } - - public void spawn() - { - _location.setYaw(_yaw); - _base = _location.getWorld().spawn(_location.clone().subtract(0, 1.5, 0), Arrow.class); - UtilEnt.Vegetate(_base, true); - UtilEnt.ghost(_base, true, true); - - _horse = _location.getWorld().spawn(_location, Horse.class); - _horse.setStyle(Horse.Style.NONE); - _horse.setColor(Horse.Color.CREAMY); - _horse.setVariant(Horse.Variant.HORSE); - _horse.setCustomName("Rudolph"); - _horse.setCustomNameVisible(true); - - //_base.setPassenger(_horse); - - createAntlers(); - } - - public void remove() - { - _horse.remove(); - _base.remove(); - } - - public void move(int x, int z) - { - _horse.eject(); - _base.remove(); - _base = _location.getWorld().spawn(_location.clone().subtract(0, 1.5, 0).add(x, 0, z), Arrow.class); - UtilEnt.Vegetate(_base, true); - UtilEnt.ghost(_base, true, true); - Location horseLocation = _location.clone().subtract(0, 0.5, 0).add(x, 0, z); - horseLocation.setYaw(_yaw); - _horse.teleport(horseLocation); - //_base.setPassenger(_horse); - UtilEnt.Vegetate(_horse, true); - UtilEnt.ghost(_horse, true, false); - _hornA.remove(); - _hornB.remove(); - createAntlers(); - } - - private void createAntlers() - { - AntlerPosition antlerPosition = AntlerPosition.SOUTH; - - switch (_yaw) - { - case 0: - antlerPosition = AntlerPosition.SOUTH; - break; - case 180: - antlerPosition = AntlerPosition.NORTH; - } - - /*Location hornALoc = _horse.getLocation().clone().add(.4, 1, .6); - Location hornBLoc = _horse.getLocation().clone().add(.2, 1, .7); - - ArmorStand hornA = hornALoc.getWorld().spawn(hornALoc, ArmorStand.class); - hornA.setVisible(false); - hornA.setGravity(false); - hornA.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); - hornA.setRightArmPose(new EulerAngle(0, 4, 0)); - - ArmorStand hornB = hornBLoc.getWorld().spawn(hornBLoc, ArmorStand.class); - hornB.setVisible(false); - hornB.setGravity(false); - hornB.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); - hornB.setRightArmPose(new EulerAngle(0, 2, 0)); - - _hornA = hornA; - _hornB = hornB;*/ - - Location hornALoc = _horse.getLocation().clone().add(antlerPosition.getxA(), 1, antlerPosition.getzA()); - Location hornBLoc = _horse.getLocation().clone().add(antlerPosition.getxB(), 1, antlerPosition.getzB()); - - ArmorStand hornA = hornALoc.getWorld().spawn(hornALoc, ArmorStand.class); - hornA.setVisible(false); - hornA.setGravity(false); - hornA.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); - hornA.setRightArmPose(new EulerAngle(0, antlerPosition.getAngleA(), 0)); - - ArmorStand hornB = hornBLoc.getWorld().spawn(hornBLoc, ArmorStand.class); - hornB.setVisible(false); - hornB.setGravity(false); - hornB.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH)); - hornB.setRightArmPose(new EulerAngle(0, antlerPosition.getAngleB(), 0)); - - _hornA = hornA; - _hornB = hornB; - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java index ba38e4d5f..a39d7b46b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.types; +import java.time.YearMonth; import java.util.HashSet; import org.bukkit.Bukkit; @@ -31,19 +32,43 @@ public abstract class Gadget extends SalesPackageBase implements Listener private String[] _alternativePackageNames; private boolean _free; + + private YearMonth _yearMonth = null; public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data) { this(manager, gadgetType, name, desc, cost, mat, data, 1); } + + public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth) + { + this(manager, gadgetType, name, desc, cost, mat, data, yearMonth, 1); + } + + public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, int quantity, String... alternativesalepackageNames) + { + super(name, mat, data, desc, cost, quantity); + + _gadgetType = gadgetType; + KnownPackage = false; + _free = false; + + _alternativePackageNames = alternativesalepackageNames; + if(_alternativePackageNames == null) { _alternativePackageNames = new String[0]; } + + Manager = manager; + + Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin()); + } - public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, int quantity, String... alternativesalepackageNames) + public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth, int quantity, String... alternativesalepackageNames) { super(name, mat, data, desc, cost, quantity); _gadgetType = gadgetType; KnownPackage = false; _free = false; + _yearMonth = yearMonth; _alternativePackageNames = alternativesalepackageNames; if(_alternativePackageNames == null) { _alternativePackageNames = new String[0]; } @@ -83,6 +108,11 @@ public abstract class Gadget extends SalesPackageBase implements Listener { return _active.contains(player); } + + public YearMonth getYearMonth() + { + return _yearMonth; + } @EventHandler public void onPlayerQuit(PlayerQuitEvent event) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java index 335f9d0ff..ff08e8152 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MorphGadget.java @@ -1,5 +1,7 @@ package mineplex.core.gadget.types; +import java.time.YearMonth; + import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -15,6 +17,11 @@ public abstract class MorphGadget extends Gadget { super(manager, GadgetType.MORPH, name, desc, cost, mat, data); } + + public MorphGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth) + { + super(manager, GadgetType.MORPH, name, desc, cost, mat, data, yearMonth); + } public void applyArmor(Player player, boolean message) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java index 232084feb..05a85e24d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/HorseMount.java @@ -1,26 +1,28 @@ package mineplex.core.mount; +import java.time.YearMonth; import java.util.Iterator; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.NavigationAbstract; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; +import org.bukkit.entity.Horse; +import org.bukkit.entity.Horse.Color; +import org.bukkit.entity.Horse.Style; +import org.bukkit.entity.Horse.Variant; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.NavigationAbstract; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; -import org.bukkit.entity.Horse.Variant; -import org.bukkit.entity.Horse; -import org.bukkit.entity.Player; -import org.bukkit.entity.Horse.Color; -import org.bukkit.entity.Horse.Style; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; public class HorseMount extends Mount> { @@ -29,7 +31,7 @@ public class HorseMount extends Mount> protected Variant _variant; protected double _jump; protected Material _armor; - + public HorseMount(MountManager manager, String name, String[] desc, Material displayMaterial, byte displayData, int cost, Color color, Style style, Variant variant, double jump, Material armor) { super (manager, name, displayMaterial, displayData, desc, cost); @@ -41,6 +43,18 @@ public class HorseMount extends Mount> _jump = jump; _armor = armor; } + + public HorseMount(MountManager manager, String name, String[] desc, Material displayMaterial, byte displayData, int cost, Color color, Style style, Variant variant, double jump, Material armor, YearMonth yearMonth) + { + super (manager, name, displayMaterial, displayData, desc, cost, yearMonth); + KnownPackage = false; + + _color = color; + _style = style; + _variant = variant; + _jump = jump; + _armor = armor; + } @EventHandler public void UpdateHorse(UpdateEvent event) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java index 9735c3a20..a978fd69f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/Mount.java @@ -1,10 +1,9 @@ package mineplex.core.mount; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.mount.event.MountActivateEvent; -import mineplex.core.shop.item.SalesPackageBase; +import java.time.YearMonth; +import java.util.HashMap; +import java.util.HashSet; + import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Entity; @@ -14,8 +13,11 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; -import java.util.HashMap; -import java.util.HashSet; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.mount.event.MountActivateEvent; +import mineplex.core.shop.item.SalesPackageBase; public abstract class Mount extends SalesPackageBase implements Listener { @@ -23,6 +25,8 @@ public abstract class Mount extends SalesPackageBase implem protected HashMap _active = new HashMap(); public MountManager Manager; + + private YearMonth _yearMonth = null; public Mount(MountManager manager, String name, Material material, byte displayData, String[] description, int coins) { @@ -33,6 +37,17 @@ public abstract class Mount extends SalesPackageBase implem Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin()); } + public Mount(MountManager manager, String name, Material material, byte displayData, String[] description, int coins, YearMonth yearMonth) + { + super(name, material, displayData, description, coins); + + Manager = manager; + + _yearMonth = yearMonth; + + Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin()); + } + public final void enable(Player player) { MountActivateEvent gadgetEvent = new MountActivateEvent(player, this); @@ -99,4 +114,9 @@ public abstract class Mount extends SalesPackageBase implem } return null; } + + public YearMonth getYearMonth() + { + return _yearMonth; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 238082e40..bbd78a15e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -25,7 +25,6 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.mount.types.MountBabyReindeer; import mineplex.core.mount.types.MountCart; -import mineplex.core.mount.types.MountChicken; import mineplex.core.mount.types.MountDragon; import mineplex.core.mount.types.MountFreedomHorse; import mineplex.core.mount.types.MountFrost; @@ -77,7 +76,8 @@ public class MountManager extends MiniPlugin _types.add(new MountValentinesSheep(this)); _types.add(new MountFreedomHorse(this)); _types.add(new MountNightmareSteed(this)); - _types.add(new MountChicken(this)); + // Hidden in this update + //_types.add(new MountChicken(this)); //_types.add(new MountSheep(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java index b5d1a2df2..1d87ed989 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountChicken.java @@ -1,6 +1,8 @@ package mineplex.core.mount.types; import java.lang.reflect.Field; +import java.time.Month; +import java.time.YearMonth; import java.util.Map; import net.minecraft.server.v1_8_R3.EntityLiving; @@ -36,9 +38,9 @@ public class MountChicken extends HorseMount super(manager, "Chicken Mount", UtilText.splitLinesToArray(new String[] { - "Placeholder" + "This isn't flying! It is falling with style." }, LineFormat.LORE), - Material.GLASS, (byte) 0, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR); + Material.FEATHER, (byte) 0, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR, YearMonth.of(2017, Month.JANUARY)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index a21248956..7bf4ec023 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -348,7 +348,6 @@ public class TreasureLocation implements Listener { if (_currentTreasure.getPlayer().equals(player)) { - event.setCancelled(true); return; } double toDistanceFromCenter = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5).distanceSquared(event.getTo());