From 8c11f2c4cb4caab1991f2452842a14021bdb2e32 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 14 Jan 2017 18:57:40 -0200 Subject: [PATCH 01/22] Added True Love Pet --- .../src/mineplex/core/pet/PetManager.java | 48 +++++++++- .../src/mineplex/core/pet/PetType.java | 20 ++++ .../src/mineplex/core/pet/TrueLoveData.java | 92 +++++++++++++++++++ 3 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index c88da63c7..e98d43fd5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -96,6 +96,7 @@ public class PetManager extends MiniClientPlugin private InventoryManager _inventoryManager; private Map _flyingPets = new HashMap<>(); + private Map _trueLovePets = new HashMap<>(); private ShapeWings _wings = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); private ShapeWings _wingsEdge = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); @@ -347,6 +348,24 @@ public class PetManager extends MiniClientPlugin zombie.setCustomNameVisible(true); } } + else if (petType.equals(PetType.TRUE_LOVE_PET)) + { + Zombie zombie = (Zombie) pet; + zombie.setBaby(true); + + UtilEnt.silence(zombie, true); + + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + { + zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomNameVisible(true); + } + + // Spawns villager + Villager villager = _creatureModule.SpawnEntity(zombie.getLocation(), Villager.class); + villager.setBaby(); + _trueLovePets.put(zombie, new TrueLoveData(player, zombie, villager)); + } _activePetOwnerTypes.put(player.getName(), petType); _activePetOwners.put(player.getName(), pet); @@ -381,6 +400,12 @@ public class PetManager extends MiniClientPlugin _flyingPets.remove(pet); } + if (_trueLovePets.containsKey(pet)) + { + _trueLovePets.get(pet).remove(); + _trueLovePets.remove(pet); + } + pet.remove(); if (removeOwner) @@ -465,7 +490,6 @@ public class PetManager extends MiniClientPlugin if (event.getType() == UpdateType.FAST) _wings.display(loc); if (event.getType() == UpdateType.FAST) _wingsEdge.display(loc); - } } @@ -566,6 +590,28 @@ public class PetManager extends MiniClientPlugin } } + @EventHandler + public void trueLovePetWalk(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator> iterator = _trueLovePets.entrySet().iterator(); + while (iterator.hasNext()) + { + Entry entry = iterator.next(); + TrueLoveData trueLoveData = entry.getValue(); + if (trueLoveData.updateVillager()) + { + trueLoveData.setStartZombie(true); + } + else + { + trueLoveData.updateZombie(); + } + } + } + /** * Blocks zombie pets catching fire * @param event diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index 6c06165d4..97be50a10 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -1,5 +1,7 @@ package mineplex.core.pet; +import java.time.Month; +import java.time.YearMonth; import java.util.Optional; import org.bukkit.Material; @@ -27,6 +29,7 @@ public enum PetType RABBIT("Baby Zombie", EntityType.RABBIT, -9, "They're so cute - until a pack of them chases down your family and eats them."), BLAZE("Grim Reaper", EntityType.BLAZE, -8, "Aww isn't he so cute with his little wings and little scythe?"), GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."), + TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Placeholder", Material.GLASS, YearMonth.of(2012, Month.FEBRUARY)) // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") @@ -37,6 +40,7 @@ public enum PetType private final Optional _lore; private final Material _material; private final byte _data; + private YearMonth _yearMonth; PetType(String name, EntityType entityType, int price) { @@ -68,6 +72,17 @@ public enum PetType _data = data; } + PetType(String name, EntityType entityType, int price, String lore, Material material, YearMonth yearMonth) + { + this(name, entityType, price, lore, material, (byte) 0, yearMonth); + } + + PetType(String name, EntityType entityType, int price, String lore, Material material, byte data, YearMonth yearMonth) + { + this(name, entityType, price, lore, material, data); + _yearMonth = yearMonth; + } + public String getName() { return _name; @@ -98,6 +113,11 @@ public enum PetType return _data; } + public YearMonth getYearMonth() + { + return _yearMonth; + } + public PetSalesPackage toSalesPackage(String tagName) { return new PetSalesPackage(this, tagName); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java new file mode 100644 index 000000000..29ae4b87f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java @@ -0,0 +1,92 @@ +package mineplex.core.pet; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.entity.Villager; +import org.bukkit.entity.Zombie; +import org.bukkit.util.Vector; + +import mineplex.core.common.animation.AnimationPoint; +import mineplex.core.common.animation.AnimatorEntity; +import mineplex.core.common.util.UtilServer; + +public class TrueLoveData +{ + + private Player _player; + private Zombie _zombie; + private Villager _villager; + private AnimatorEntity _animatorZombie; + private AnimatorEntity _animatorVillager; + private boolean _startZombie = false; + + private static final int POINTS = 12; + private static final double Z_OFFSET = 0.75; + + public TrueLoveData(Player player, Zombie zombie, Villager villager) + { + _player = player; + _zombie = zombie; + _villager = villager; + } + + public boolean updateVillager() + { + if (_animatorVillager == null || !_animatorVillager.isRunning()) + { + Location start = _player.getLocation().clone(); + start.add(0, 0, Z_OFFSET); + start.setDirection(new Vector(1, 0, 0)); + + _villager.teleport(start); + _animatorVillager = new AnimatorEntity(UtilServer.getPlugin(), _villager); + + int i = 0; + for (double rad = 0; rad < Math.PI * 2; rad += Math.PI / POINTS) + { + i++; + double sin = Math.sin(rad) * 3; + double cos = Math.cos(rad) * 3; + _animatorVillager.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos - Z_OFFSET), new Vector(cos, 0, -sin))); + } + _animatorVillager.start(start); + return true; + } + return false; + } + + public void updateZombie() + { + if ((_animatorZombie == null || !_animatorZombie.isRunning()) && _startZombie) + { + Location start = _player.getLocation().clone(); + start.add(0, 0, Z_OFFSET); + start.setDirection(new Vector(1, 0, 0)); + + _zombie.teleport(start); + _animatorZombie = new AnimatorEntity(UtilServer.getPlugin(), _zombie); + + int i = 0; + for (double rad = 0; rad < Math.PI * 2; rad += Math.PI / POINTS) + { + i++; + double sin = Math.sin(rad) * 3; + double cos = Math.cos(rad) * 3; + _animatorZombie.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos - Z_OFFSET), new Vector(cos, 0, -sin))); + } + _animatorZombie.start(start); + _startZombie = false; + } + } + + public void setStartZombie(boolean startZombie) + { + _startZombie = startZombie; + } + + public void remove() + { + _villager.remove(); + } + +} From 2976eab5bf0ad4b969c044119dd9cb6bd0f2dc15 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 14 Jan 2017 20:06:12 -0200 Subject: [PATCH 02/22] Added particles --- .../commands/UnlockCosmeticsCommand.java | 2 +- .../src/mineplex/core/pet/PetManager.java | 12 +++---- .../src/mineplex/core/pet/TrueLoveData.java | 34 ++++++++++--------- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java index 1381fe628..d18f05207 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java @@ -22,7 +22,7 @@ public class UnlockCosmeticsCommand extends CommandBase public UnlockCosmeticsCommand(GadgetManager plugin) { - super(plugin, Rank.JNR_DEV, "unlockCosmetics"); + super(plugin, Rank.SNR_MODERATOR, "unlockCosmetics"); _plugin = plugin; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index e98d43fd5..aa5cef0f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -600,15 +600,11 @@ public class PetManager extends MiniClientPlugin while (iterator.hasNext()) { Entry entry = iterator.next(); + Creature zombie = entry.getKey(); + UtilParticle.PlayParticle(ParticleType.HEART, zombie.getLocation().add(0, 0.25, 0), 0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL); TrueLoveData trueLoveData = entry.getValue(); - if (trueLoveData.updateVillager()) - { - trueLoveData.setStartZombie(true); - } - else - { - trueLoveData.updateZombie(); - } + trueLoveData.updateVillager(); + trueLoveData.updateZombie(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java index 29ae4b87f..41b3be766 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java @@ -18,10 +18,9 @@ public class TrueLoveData private Villager _villager; private AnimatorEntity _animatorZombie; private AnimatorEntity _animatorVillager; - private boolean _startZombie = false; + private int _step = 0; private static final int POINTS = 12; - private static final double Z_OFFSET = 0.75; public TrueLoveData(Player player, Zombie zombie, Villager villager) { @@ -30,12 +29,11 @@ public class TrueLoveData _villager = villager; } - public boolean updateVillager() + public void updateVillager() { if (_animatorVillager == null || !_animatorVillager.isRunning()) { Location start = _player.getLocation().clone(); - start.add(0, 0, Z_OFFSET); start.setDirection(new Vector(1, 0, 0)); _villager.teleport(start); @@ -47,20 +45,30 @@ public class TrueLoveData i++; double sin = Math.sin(rad) * 3; double cos = Math.cos(rad) * 3; - _animatorVillager.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos - Z_OFFSET), new Vector(cos, 0, -sin))); + _animatorVillager.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos), new Vector(cos, 0, -sin))); } _animatorVillager.start(start); - return true; } - return false; } public void updateZombie() { - if ((_animatorZombie == null || !_animatorZombie.isRunning()) && _startZombie) + if (_animatorZombie != null) + { + if (_animatorZombie.isRunning()) + { + return; + } + } + if (_step > 3) + { + _step++; + return; + } + _step = 0; + if (_animatorZombie == null || !_animatorZombie.isRunning()) { Location start = _player.getLocation().clone(); - start.add(0, 0, Z_OFFSET); start.setDirection(new Vector(1, 0, 0)); _zombie.teleport(start); @@ -72,18 +80,12 @@ public class TrueLoveData i++; double sin = Math.sin(rad) * 3; double cos = Math.cos(rad) * 3; - _animatorZombie.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos - Z_OFFSET), new Vector(cos, 0, -sin))); + _animatorZombie.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos), new Vector(cos, 0, -sin))); } _animatorZombie.start(start); - _startZombie = false; } } - public void setStartZombie(boolean startZombie) - { - _startZombie = startZombie; - } - public void remove() { _villager.remove(); From 6c75f6e7dc7e39259ff00813087506bf2ba12d0e Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 14 Jan 2017 23:12:31 -0200 Subject: [PATCH 03/22] Showing correct icon for pets --- .../src/mineplex/core/cosmetic/ui/page/PetPage.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index cf903bc21..a1603b8c4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -154,8 +154,8 @@ public class PetPage extends ShopPageBase { itemLore.add(C.cBlack); itemLore.add(C.cGreen + "Click to Disable"); - - addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getEntityType().getTypeId(), + + addButton(slot, new ShopItem(pet.getMaterial(), pet.getData(), pet.getName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager())); @@ -185,7 +185,7 @@ public class PetPage extends ShopPageBase } }*/ - addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getEntityType().getTypeId(), + addButton(slot, new ShopItem(pet.getMaterial(), pet.getData(), pet.getName() + " (" + C.cWhite + petName + C.cGreen + ")", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this)); //addButton(slot, new ShopItem(petItem, false, false), iButton); From 2398fbc8c9f90a6cb292d05e5619d8303d188392 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 14 Jan 2017 23:15:41 -0200 Subject: [PATCH 04/22] Added correct ppc lore --- .../core/cosmetic/ui/page/PetPage.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index a1603b8c4..f916b9b7d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -1,10 +1,14 @@ 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.Collections; import java.util.Comparator; import java.util.List; +import java.util.Locale; import net.minecraft.server.v1_8_R3.Blocks; import net.minecraft.server.v1_8_R3.ChatMessage; @@ -110,12 +114,18 @@ public class PetPage extends ShopPageBase else if (pet.getPrice() == -14) { itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Power Play Club"); - } - else if (pet.getPrice() == -14) - { - itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Power Play Club"); + YearMonth yearMonth = pet.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 + "Bonus Item Unlocked with Power Play Club"); + } } //Rank Unlocks From 3d49eb21812691eecbe50f39253eaa63d0e8afe6 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 14 Jan 2017 23:21:49 -0200 Subject: [PATCH 05/22] Better way to handle the circle points --- .../src/mineplex/core/pet/PetManager.java | 3 +-- .../src/mineplex/core/pet/TrueLoveData.java | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index aa5cef0f9..0d9bb26b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -603,8 +603,7 @@ public class PetManager extends MiniClientPlugin Creature zombie = entry.getKey(); UtilParticle.PlayParticle(ParticleType.HEART, zombie.getLocation().add(0, 0.25, 0), 0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL); TrueLoveData trueLoveData = entry.getValue(); - trueLoveData.updateVillager(); - trueLoveData.updateZombie(); + trueLoveData.update(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java index 41b3be766..0befceedf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java @@ -1,14 +1,11 @@ package mineplex.core.pet; -import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; -import mineplex.core.common.animation.AnimationPoint; import mineplex.core.common.animation.AnimatorEntity; -import mineplex.core.common.util.UtilServer; public class TrueLoveData { @@ -21,6 +18,7 @@ public class TrueLoveData private int _step = 0; private static final int POINTS = 12; + private static final float RADIUS = 0.75F; public TrueLoveData(Player player, Zombie zombie, Villager villager) { @@ -29,7 +27,7 @@ public class TrueLoveData _villager = villager; } - public void updateVillager() + /*public void updateVillager() { if (_animatorVillager == null || !_animatorVillager.isRunning()) { @@ -84,6 +82,20 @@ public class TrueLoveData } _animatorZombie.start(start); } + }*/ + + public void update() + { + double increment = (2 * Math.PI) / POINTS; + // Villager + double angle = _step * increment; + Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); + _villager.teleport(_player.getLocation().clone().add(vector)); + // Zombie + angle = (_step - 5) * increment; + vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); + _zombie.teleport(_player.getLocation().clone().add(vector)); + _step++; } public void remove() From 6e399b10db75260dc79ea9ef171a2aaa87657f8d Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 14 Jan 2017 23:27:02 -0200 Subject: [PATCH 06/22] Increased radius --- Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java index 0befceedf..5bad97c0c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java @@ -18,7 +18,7 @@ public class TrueLoveData private int _step = 0; private static final int POINTS = 12; - private static final float RADIUS = 0.75F; + private static final float RADIUS = 1.75F; public TrueLoveData(Player player, Zombie zombie, Villager villager) { From 46552428a42f1ef19d79e02d59f13c398447d29f Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 14 Jan 2017 23:55:24 -0200 Subject: [PATCH 07/22] Make them slower --- .../src/mineplex/core/pet/PetManager.java | 2 +- .../src/mineplex/core/pet/PetType.java | 2 +- .../src/mineplex/core/pet/TrueLoveData.java | 65 +------------------ 3 files changed, 5 insertions(+), 64 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 0d9bb26b4..0a9592e7d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -593,7 +593,7 @@ public class PetManager extends MiniClientPlugin @EventHandler public void trueLovePetWalk(UpdateEvent event) { - if (event.getType() != UpdateType.TICK) + if (event.getType() != UpdateType.FASTEST) return; Iterator> iterator = _trueLovePets.entrySet().iterator(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index 97be50a10..28a8adc4e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -29,7 +29,7 @@ public enum PetType RABBIT("Baby Zombie", EntityType.RABBIT, -9, "They're so cute - until a pack of them chases down your family and eats them."), BLAZE("Grim Reaper", EntityType.BLAZE, -8, "Aww isn't he so cute with his little wings and little scythe?"), GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."), - TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Placeholder", Material.GLASS, YearMonth.of(2012, Month.FEBRUARY)) + TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2012, Month.FEBRUARY)) // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java index 5bad97c0c..bedd9b58c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java @@ -5,16 +5,12 @@ import org.bukkit.entity.Villager; import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; -import mineplex.core.common.animation.AnimatorEntity; - public class TrueLoveData { private Player _player; private Zombie _zombie; private Villager _villager; - private AnimatorEntity _animatorZombie; - private AnimatorEntity _animatorVillager; private int _step = 0; private static final int POINTS = 12; @@ -27,63 +23,6 @@ public class TrueLoveData _villager = villager; } - /*public void updateVillager() - { - if (_animatorVillager == null || !_animatorVillager.isRunning()) - { - Location start = _player.getLocation().clone(); - start.setDirection(new Vector(1, 0, 0)); - - _villager.teleport(start); - _animatorVillager = new AnimatorEntity(UtilServer.getPlugin(), _villager); - - int i = 0; - for (double rad = 0; rad < Math.PI * 2; rad += Math.PI / POINTS) - { - i++; - double sin = Math.sin(rad) * 3; - double cos = Math.cos(rad) * 3; - _animatorVillager.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos), new Vector(cos, 0, -sin))); - } - _animatorVillager.start(start); - } - } - - public void updateZombie() - { - if (_animatorZombie != null) - { - if (_animatorZombie.isRunning()) - { - return; - } - } - if (_step > 3) - { - _step++; - return; - } - _step = 0; - if (_animatorZombie == null || !_animatorZombie.isRunning()) - { - Location start = _player.getLocation().clone(); - start.setDirection(new Vector(1, 0, 0)); - - _zombie.teleport(start); - _animatorZombie = new AnimatorEntity(UtilServer.getPlugin(), _zombie); - - int i = 0; - for (double rad = 0; rad < Math.PI * 2; rad += Math.PI / POINTS) - { - i++; - double sin = Math.sin(rad) * 3; - double cos = Math.cos(rad) * 3; - _animatorZombie.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos), new Vector(cos, 0, -sin))); - } - _animatorZombie.start(start); - } - }*/ - public void update() { double increment = (2 * Math.PI) / POINTS; @@ -91,10 +30,12 @@ public class TrueLoveData double angle = _step * increment; Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); _villager.teleport(_player.getLocation().clone().add(vector)); + _villager.getLocation().setDirection(_player.getLocation().toVector()); // Zombie - angle = (_step - 5) * increment; + angle = (_step - 3) * increment; vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); _zombie.teleport(_player.getLocation().clone().add(vector)); + _zombie.getLocation().setDirection(_villager.getLocation().toVector()); _step++; } From 7600cd6e04bf5e9e1fe91640467ce053e11aaca8 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sun, 15 Jan 2017 00:07:48 -0200 Subject: [PATCH 08/22] Added enderman gun --- .../gadget/gadgets/gamemodifiers/minestrike/MineStrikeSkin.java | 2 +- .../Mineplex.Core/src/mineplex/core/reward/RewardManager.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/MineStrikeSkin.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/MineStrikeSkin.java index 98b2b25bf..af30e790e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/MineStrikeSkin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/gamemodifiers/minestrike/MineStrikeSkin.java @@ -19,7 +19,7 @@ public enum MineStrikeSkin P2000_Fire_Elemental( "P2000", "P2000 Fire Elemental", Material.INK_SACK, (byte) 6), FAMAS_Pulse( "FAMAS", "FAMAS Pulse", Material.CLAY_BALL, (byte) 0), M4A4_Howl( "M4A4", "M4A4 Howl", Material.INK_SACK, (byte) 11), - //M4A4_Enderman( "M4A4", "Enderman M4", ) + M4A4_Enderman( "M4A4", "Enderman M4", Material.COAL, (byte) 0), Steyr_AUG_Torque( "Steyr AUG", "Steyr AUG Torque", Material.BLAZE_ROD, (byte) 0), Glock_18_Fade( "Glock 18", "Glock 18 Fade", Material.INK_SACK, (byte) 9), Galil_AR_Eco( "Galil AR", "Galil AR Eco", Material.INK_SACK, (byte) 10), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index dcf425ea8..d5a2681b1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -613,6 +613,7 @@ public class RewardManager addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.AWP_Asiimov, rarity, 100, 5000); addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.FAMAS_Pulse, rarity, 100, 5000); addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.XM1014_Pig_Gun, rarity, 10, 7500); + addMineStrikeSkin(Type.MINESTRIKE, MineStrikeSkin.M4A4_Enderman, rarity, 10, 7500); //WINTER From 9e4f756fe8d5e93bb6a2b6ce170773c3245368ab Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sun, 15 Jan 2017 02:46:44 -0200 Subject: [PATCH 09/22] Even better way of making pet circle around you --- .../core/common/animation/Animator.java | 60 ++++++++++++++ .../src/mineplex/core/pet/TrueLoveData.java | 83 ++++++++++++++++++- 2 files changed, 141 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java index 335f327a4..a18be0a5e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/animation/Animator.java @@ -6,6 +6,7 @@ import java.util.PriorityQueue; import java.util.Set; import org.bukkit.Location; +import org.bukkit.entity.Entity; import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; @@ -130,6 +131,65 @@ public abstract class Animator }.runTaskTimer(_plugin, 0, 1); } + public void start(Entity entity) + { + if(isRunning()) return; + + _queue.clear(); + _queue.addAll(_points); + + if(_queue.isEmpty()) return; + + _baseLoc = entity.getLocation().clone(); + _next = _queue.peek(); + _prev = new AnimationPoint(0, _next.getMove().clone(), _next.getDirection().clone()); + + _task = new BukkitRunnable() + { + public void run() + { + _tick++; + + if(_next.getTick() < _tick) + { + _queue.remove(); + _prev = _next; + _next = _queue.peek(); + } + + if(_queue.isEmpty()) + { + if(_repeat) + { + Location clone = _baseLoc.clone(); + stop(); + start(clone); + } + else + { + finish(_baseLoc); + stop(); + } + return; + } + + Location prev = _baseLoc.clone().add(_prev.getMove()); + Location next = _baseLoc.clone().add(_next.getMove()); + prev.setDirection(_prev.getDirection()); + + double diff = ((double)_tick-_prev.getTick())/(_next.getTick()-_prev.getTick()); + if(!Double.isFinite(diff)) diff = 0; + prev.add(next.clone().subtract(prev).toVector().multiply(diff)); + + Vector dirDiff = _next.getDirection().subtract(prev.getDirection()); + dirDiff.multiply(diff); + prev.setDirection(prev.getDirection().add(dirDiff)); + + tick(prev); + } + }.runTaskTimer(_plugin, 0, 1); + } + public boolean isRunning() { return _task != null; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java index bedd9b58c..961bd2fdb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java @@ -1,10 +1,13 @@ package mineplex.core.pet; +import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; +import mineplex.core.common.animation.AnimatorEntity; + public class TrueLoveData { @@ -12,6 +15,8 @@ public class TrueLoveData private Zombie _zombie; private Villager _villager; private int _step = 0; + private AnimatorEntity _animatorVillager; + private AnimatorEntity _animatorZombie; private static final int POINTS = 12; private static final float RADIUS = 1.75F; @@ -23,19 +28,93 @@ public class TrueLoveData _villager = villager; } + /*public void updateVillager() + { + if (_animatorVillager == null || !_animatorVillager.isRunning()) + { + Location start = _player.getLocation().clone(); + start.setDirection(new Vector(1, 0, 0)); + + _villager.teleport(start); + _animatorVillager = new AnimatorEntity(UtilServer.getPlugin(), _villager); + + int i = 0; + for (double rad = 0; rad < Math.PI * 2; rad += Math.PI / POINTS) + { + i++; + double sin = Math.sin(rad) * 3; + double cos = Math.cos(rad) * 3; + _animatorVillager.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos), new Vector(cos, 0, -sin))); + } + _animatorVillager.start(_player); + } + } + + public void updateZombie() + { + if (_animatorZombie != null) + { + if (_animatorZombie.isRunning()) + { + return; + } + } + if (_step > 15) + { + _step++; + return; + } + _step = 0; + if (_animatorZombie == null || !_animatorZombie.isRunning()) + { + Location start = _player.getLocation().clone(); + start.setDirection(new Vector(1, 0, 0)); + + _zombie.teleport(start); + _animatorZombie = new AnimatorEntity(UtilServer.getPlugin(), _zombie); + + int i = 0; + for (double rad = 0; rad < Math.PI * 2; rad += Math.PI / POINTS) + { + i++; + double sin = Math.sin(rad) * 3; + double cos = Math.cos(rad) * 3; + _animatorZombie.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos), new Vector(cos, 0, -sin))); + } + _animatorZombie.start(_player); + } + }*/ + public void update() { double increment = (2 * Math.PI) / POINTS; + // Villager double angle = _step * increment; Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); + _villager.setVelocity(new Vector(0,0,0)); _villager.teleport(_player.getLocation().clone().add(vector)); - _villager.getLocation().setDirection(_player.getLocation().toVector()); + // Make villager look at right location + angle = (_step + 1) * increment; + vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); + Location targetLoc = _player.getLocation().clone().add(vector); + Vector directionBetweenLocs = targetLoc.toVector().subtract(_villager.getEyeLocation().toVector()); + Location villagerLoc = _villager.getLocation().setDirection(directionBetweenLocs); + _villager.teleport(villagerLoc); + // Zombie angle = (_step - 3) * increment; vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); + _zombie.setVelocity(new Vector(0, 0, 0)); _zombie.teleport(_player.getLocation().clone().add(vector)); - _zombie.getLocation().setDirection(_villager.getLocation().toVector()); + // Make zombie look at right location + angle = (_step - 2) * increment; + vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); + targetLoc = _player.getLocation().clone().add(vector); + directionBetweenLocs = targetLoc.toVector().subtract(_zombie.getEyeLocation().toVector()); + Location zombieLoc = _zombie.getLocation().setDirection(directionBetweenLocs); + _zombie.teleport(zombieLoc); + _step++; } From c571736def6b55b43171236003d2602a917fcc34 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 16 Jan 2017 01:57:42 -0200 Subject: [PATCH 10/22] Silent villager --- .../src/mineplex/core/pet/PetManager.java | 1 + .../src/mineplex/core/pet/TrueLoveData.java | 57 ------------------- .../powerplayclub/PowerPlayClubRewards.java | 1 + 3 files changed, 2 insertions(+), 57 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 0a9592e7d..bdb3a86b4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -364,6 +364,7 @@ public class PetManager extends MiniClientPlugin // Spawns villager Villager villager = _creatureModule.SpawnEntity(zombie.getLocation(), Villager.class); villager.setBaby(); + UtilEnt.silence(villager, true); _trueLovePets.put(zombie, new TrueLoveData(player, zombie, villager)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java index 961bd2fdb..7c2bd6d08 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java @@ -28,63 +28,6 @@ public class TrueLoveData _villager = villager; } - /*public void updateVillager() - { - if (_animatorVillager == null || !_animatorVillager.isRunning()) - { - Location start = _player.getLocation().clone(); - start.setDirection(new Vector(1, 0, 0)); - - _villager.teleport(start); - _animatorVillager = new AnimatorEntity(UtilServer.getPlugin(), _villager); - - int i = 0; - for (double rad = 0; rad < Math.PI * 2; rad += Math.PI / POINTS) - { - i++; - double sin = Math.sin(rad) * 3; - double cos = Math.cos(rad) * 3; - _animatorVillager.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos), new Vector(cos, 0, -sin))); - } - _animatorVillager.start(_player); - } - } - - public void updateZombie() - { - if (_animatorZombie != null) - { - if (_animatorZombie.isRunning()) - { - return; - } - } - if (_step > 15) - { - _step++; - return; - } - _step = 0; - if (_animatorZombie == null || !_animatorZombie.isRunning()) - { - Location start = _player.getLocation().clone(); - start.setDirection(new Vector(1, 0, 0)); - - _zombie.teleport(start); - _animatorZombie = new AnimatorEntity(UtilServer.getPlugin(), _zombie); - - int i = 0; - for (double rad = 0; rad < Math.PI * 2; rad += Math.PI / POINTS) - { - i++; - double sin = Math.sin(rad) * 3; - double cos = Math.cos(rad) * 3; - _animatorZombie.addPoint(new AnimationPoint(2 * i, new Vector(sin, 0, cos), new Vector(cos, 0, -sin))); - } - _animatorZombie.start(_player); - } - }*/ - public void update() { double increment = (2 * Math.PI) / POINTS; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java index 83be22557..0c10c7307 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java @@ -32,6 +32,7 @@ public class PowerPlayClubRewards .put(YearMonth.of(2016, Month.NOVEMBER), new PowerPlayClubItem("Turkey Morph", SkinData.TURKEY.getSkull())) .put(YearMonth.of(2016, Month.DECEMBER), new PowerPlayClubItem("Santa Morph", SkinData.SANTA.getSkull())) .put(YearMonth.of(2017, Month.JANUARY), new PowerPlayClubItem("Over Easy Morph", new ItemStack(Material.EGG))) + .put(YearMonth.of(2017, Month.FEBRUARY), new PowerPlayClubItem("True Love Pet", new ItemStack(Material.APPLE))) .build(); public static class PowerPlayClubItem From ebfd6e5cc533e026c75532f7aa73354238e3248e Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 16 Jan 2017 04:19:57 -0200 Subject: [PATCH 11/22] Use correct way for adding pets to ppc --- .../mineplex/core/bonuses/BonusManager.java | 2 - .../core/gadget/gadgets/hat/HatItem.java | 12 ------ .../src/mineplex/core/pet/PetManager.java | 10 +++++ .../src/mineplex/core/pet/TrueLoveData.java | 5 +-- .../PowerPlayClubRepository.java | 23 ++++++++-- .../powerplayclub/PowerPlayClubRewards.java | 25 ++++++++++- .../event/PowerPlayRewardPetEvent.java | 42 +++++++++++++++++++ 7 files changed, 96 insertions(+), 23 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/event/PowerPlayRewardPetEvent.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 89e22420e..82598f8a4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -7,8 +7,6 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; -import java.util.LinkedList; -import java.util.Queue; import java.util.TimeZone; import java.util.UUID; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java index daea695eb..186e19d8a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatItem.java @@ -2,8 +2,6 @@ package mineplex.core.gadget.gadgets.hat; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.HatGadget; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; public class HatItem extends HatGadget { @@ -13,14 +11,4 @@ public class HatItem extends HatGadget super(manager, hatType); } - public HatItem(GadgetManager manager, String name, String[] desc, int cost, Material material, byte data) - { - super(manager, name, desc, cost, new ItemStack(material, 1, data)); - } - - public HatItem(GadgetManager manager, String name, String[] desc, int cost, String playerName) - { - super(manager, name, desc, cost, playerName); - } - } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index bdb3a86b4..a25e154d8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -72,6 +72,7 @@ import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.token.ClientPetTokenWrapper; +import mineplex.core.powerplayclub.event.PowerPlayRewardPetEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -623,6 +624,15 @@ public class PetManager extends MiniClientPlugin } } } + + @EventHandler + public void onPowerPlayRewardPet(PowerPlayRewardPetEvent event) + { + Player player = event.getPlayer(); + PetType petType = event.getPetType(); + if (!Get(player).getPets().containsKey(petType)) + Get(player).getPets().put(petType, petType.getName()); + } @Override protected PetClient addPlayer(UUID uuid) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java index 7c2bd6d08..eee0487e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/TrueLoveData.java @@ -6,8 +6,6 @@ import org.bukkit.entity.Villager; import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; -import mineplex.core.common.animation.AnimatorEntity; - public class TrueLoveData { @@ -15,8 +13,6 @@ public class TrueLoveData private Zombie _zombie; private Villager _villager; private int _step = 0; - private AnimatorEntity _animatorVillager; - private AnimatorEntity _animatorZombie; private static final int POINTS = 12; private static final float RADIUS = 1.75F; @@ -64,6 +60,7 @@ public class TrueLoveData public void remove() { _villager.remove(); + _zombie.remove(); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java index 746960add..df3370a71 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java @@ -9,10 +9,8 @@ import java.time.LocalDate; import java.time.YearMonth; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; @@ -28,6 +26,7 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.account.ILoginProcessor; import mineplex.core.donation.DonationManager; +import mineplex.core.powerplayclub.event.PowerPlayRewardPetEvent; import mineplex.serverdata.database.DBPool; public class PowerPlayClubRepository implements Listener { @@ -104,9 +103,25 @@ public class PowerPlayClubRepository implements Listener { Player player = event.getPlayer(); PowerPlayData cached = getCachedData(player); - PowerPlayClubRewards.rewardsForMonths(cached.getUsableCosmeticMonths()).stream() + + List list = PowerPlayClubRewards.rewardsForMonths(cached.getUsableCosmeticMonths()); + + for (PowerPlayClubRewards.PowerPlayClubItem item : list) + { + if (item.isPet()) + { + PowerPlayRewardPetEvent ppcRewardPetEvent = new PowerPlayRewardPetEvent(player, item.getPetType()); + Bukkit.getPluginManager().callEvent(ppcRewardPetEvent); + } + else + { + _donationManager.Get(player).addOwnedUnknownSalesPackage(item.getPrize()); + } + } + + /*PowerPlayClubRewards.rewardsForMonths(cached.getUsableCosmeticMonths()).stream() .map(PowerPlayClubRewards.PowerPlayClubItem::getPrize) - .forEach(_donationManager.Get(player)::addOwnedUnknownSalesPackage); + .forEach(_donationManager.Get(player)::addOwnedUnknownSalesPackage);*/ // Gives Metal Man for anyone subscribed if (cached.getUsableCosmeticMonths().size() > 0) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java index 0c10c7307..6cfdf4347 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java @@ -20,6 +20,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.data.Item; +import mineplex.core.pet.PetType; public class PowerPlayClubRewards { @@ -32,18 +33,30 @@ public class PowerPlayClubRewards .put(YearMonth.of(2016, Month.NOVEMBER), new PowerPlayClubItem("Turkey Morph", SkinData.TURKEY.getSkull())) .put(YearMonth.of(2016, Month.DECEMBER), new PowerPlayClubItem("Santa Morph", SkinData.SANTA.getSkull())) .put(YearMonth.of(2017, Month.JANUARY), new PowerPlayClubItem("Over Easy Morph", new ItemStack(Material.EGG))) - .put(YearMonth.of(2017, Month.FEBRUARY), new PowerPlayClubItem("True Love Pet", new ItemStack(Material.APPLE))) + .put(YearMonth.of(2017, Month.FEBRUARY), new PowerPlayClubItem(PetType.TRUE_LOVE_PET, new ItemStack(Material.APPLE))) .build(); public static class PowerPlayClubItem { private final String _prize; private final ItemStack _display; + private final boolean _isPet; + private final PetType _petType; PowerPlayClubItem(String prize, ItemStack display) { _prize = prize; _display = display; + _isPet = false; + _petType = null; + } + + PowerPlayClubItem(PetType prize, ItemStack display) + { + _prize = prize.getName(); + _display = display; + _isPet = true; + _petType = prize; } public String getPrize() @@ -55,6 +68,16 @@ public class PowerPlayClubRewards { return _display; } + + public boolean isPet() + { + return _isPet; + } + + public PetType getPetType() + { + return _petType; + } } public static List rewardsForMonths(Set months) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/event/PowerPlayRewardPetEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/event/PowerPlayRewardPetEvent.java new file mode 100644 index 000000000..5f6f657fe --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/event/PowerPlayRewardPetEvent.java @@ -0,0 +1,42 @@ +package mineplex.core.powerplayclub.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import mineplex.core.pet.PetType; + +public class PowerPlayRewardPetEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private final Player _player; + private final PetType _petType; + + public PowerPlayRewardPetEvent(Player player, PetType petType) + { + _player = player; + _petType = petType; + } + + public Player getPlayer() + { + return _player; + } + + public PetType getPetType() + { + return _petType; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} From cdd1e6398947a4dda9ad2206bc5bedae2a234f10 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 17 Jan 2017 06:30:47 -0200 Subject: [PATCH 12/22] Ops, are we back in time? Fixed lore saying 2012 instead of 2017 --- Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index 28a8adc4e..e9584308d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -29,7 +29,7 @@ public enum PetType RABBIT("Baby Zombie", EntityType.RABBIT, -9, "They're so cute - until a pack of them chases down your family and eats them."), BLAZE("Grim Reaper", EntityType.BLAZE, -8, "Aww isn't he so cute with his little wings and little scythe?"), GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."), - TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2012, Month.FEBRUARY)) + TRUE_LOVE_PET("True Love", EntityType.ZOMBIE, -14, "Sometimes love means chasing the person of your dreams until you catch them.", Material.APPLE, YearMonth.of(2017, Month.FEBRUARY)) // TODO CHECK IF LOBBY IS 1.9+ // Not in this update //SHULKER("Shulker Pet", EntityType.BAT, 0, "Is it a turtle or an alien? Either way its shot can be really UPLIFTING.") From 76b356f73ccfe0b87d6737a2c50df705cee6f42d Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 17 Jan 2017 19:24:27 -0200 Subject: [PATCH 13/22] Removed gingerbread chest --- .../core/treasure/gui/TreasurePage.java | 53 ++++++++++++++----- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index 7600bf9f7..19025af83 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -137,6 +137,13 @@ public class TreasurePage extends ShopPageBase int gingerbreadCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.GINGERBREAD.getItemName()); int minestrikeCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MINESTRIKE.getItemName()); + boolean availableChristmas = false; + boolean availableFreedom = false; + boolean availableHaunted = false; + boolean availableTrick = false; + boolean availableThank = false; + boolean availableGingerbread = false; + List shardLore = new ArrayList<>(); shardLore.add(" "); shardLore.add(C.cGray + "This seems like it might come in"); @@ -296,8 +303,7 @@ public class TreasurePage extends ShopPageBase } else { - boolean available = new File("../../update/files/EnableTrickOrTreat.dat").exists(); - if (!available) + if (!availableTrick) { trickLore.add(C.cRed + "This item is no longer available!"); } @@ -323,8 +329,7 @@ public class TreasurePage extends ShopPageBase } else { - boolean available = new File("../../update/files/EnableThankful.dat").exists(); - if (!available) + if (!availableThank) { thankLore.add(C.cRed + "This item is no longer available!"); } @@ -351,9 +356,7 @@ public class TreasurePage extends ShopPageBase } else { - gingerbreadLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + "20000 Treasure Shards"); - gingerbreadLore.add(" "); - gingerbreadLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + gingerbreadLore.add(C.cRed + "This item is no longer available!"); } List minestrikeLore = Lists.newArrayList(); @@ -424,13 +427,37 @@ public class TreasurePage extends ShopPageBase _normalTreasures.add(omegaTreasureItem); _normalTreasures.add(minestrikeTreasureItem); - _seasonalTreasures.add(winterTreasureItem); - _seasonalTreasures.add(freedomTreasureItem); - _seasonalTreasures.add(hauntedTreasureItem); - _seasonalTreasures.add(trickTreasureItem); - _seasonalTreasures.add(thankTreasureItem); - _specialTreasures.add(gingerbreadTreasureItem); + + if (availableChristmas) + _specialTreasures.add(winterTreasureItem); + else + _seasonalTreasures.add(winterTreasureItem); + + if (availableFreedom) + _specialTreasures.add(freedomTreasureItem); + else + _seasonalTreasures.add(freedomTreasureItem); + + if (availableHaunted) + _specialTreasures.add(hauntedTreasureItem); + else + _seasonalTreasures.add(hauntedTreasureItem); + + if (availableTrick) + _specialTreasures.add(trickTreasureItem); + else + _seasonalTreasures.add(trickTreasureItem); + + if (availableThank) + _specialTreasures.add(thankTreasureItem); + else + _seasonalTreasures.add(thankTreasureItem); + + if (availableGingerbread) + _specialTreasures.add(gingerbreadTreasureItem); + else + _seasonalTreasures.add(gingerbreadTreasureItem); } private void buildFirstPage() From 27aa682727feb79359a86d78165fa6db2a992b2a Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 17 Jan 2017 20:20:17 -0200 Subject: [PATCH 14/22] Stops players from purchasing the chest --- .../src/mineplex/core/treasure/gui/BuyChestButton.java | 8 ++++++++ .../src/mineplex/core/treasure/gui/TreasurePage.java | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index c12c434fb..236145462 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -65,6 +65,14 @@ public class BuyChestButton implements IButton return; } } + if (_chestType == TreasureType.GINGERBREAD) + { + if (!new File("../../update/files/EnableThankful.dat").exists()) + { + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; + } + } if (_chestType == TreasureType.FREEDOM || _chestType == TreasureType.HAUNTED) { if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index 19025af83..12e3a69f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -1,6 +1,5 @@ package mineplex.core.treasure.gui; -import java.io.File; import java.util.ArrayList; import java.util.List; From 75ede7f82335e4a24d204720ee8eddad523b0f25 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 17 Jan 2017 20:21:37 -0200 Subject: [PATCH 15/22] Fixed present danger display item --- .../core/gadget/gadgets/death/christmas/DeathPresentDanger.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java index 4d3ce92f7..e8db5ed6a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/christmas/DeathPresentDanger.java @@ -35,6 +35,7 @@ public class DeathPresentDanger extends DeathEffectGadget UtilText.splitLineToArray(C.cGray + "Leave behind a little gift for your enemies.", LineFormat.LORE), -16, Material.INK_SACK, (byte)1); + setDisplayItem(SkinData.PRESENT.getSkull()); } @Override From 65cc1b598dda9fcdcf8aaaa5df523ba5dc6f3cca Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 17 Jan 2017 21:08:38 -0200 Subject: [PATCH 16/22] Change Flame Rings icon Fixed issue with buy chest button --- .../gadget/gadgets/particle/ParticleFireRings.java | 10 ++++------ .../src/mineplex/core/treasure/gui/BuyChestButton.java | 7 ++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java index de25c0f7a..0a2298be6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleFireRings.java @@ -1,22 +1,20 @@ package mineplex.core.gadget.gadgets.particle; -import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.ParticleGadget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.gadget.GadgetManager; public class ParticleFireRings extends ParticleGadget { @@ -25,7 +23,7 @@ public class ParticleFireRings extends ParticleGadget { super(manager, "Flame Rings", UtilText.splitLineToArray(C.cGray + "Forged from the blazing rods of 1000 Blazes by the infamous Nether King.", LineFormat.LORE), - -2, Material.BLAZE_POWDER, (byte) 0); + -2, Material.BLAZE_ROD, (byte) 0); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index 236145462..f75a6f05b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -67,11 +67,8 @@ public class BuyChestButton implements IButton } if (_chestType == TreasureType.GINGERBREAD) { - if (!new File("../../update/files/EnableThankful.dat").exists()) - { - player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); - return; - } + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; } if (_chestType == TreasureType.FREEDOM || _chestType == TreasureType.HAUNTED) { From 419c4b1053677234f87531194551e5ea6c90124d Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 18 Jan 2017 00:52:36 -0200 Subject: [PATCH 17/22] Revered changes to chest page --- .../core/treasure/gui/TreasurePage.java | 51 ++++--------------- 1 file changed, 11 insertions(+), 40 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index 12e3a69f9..9f15e54cc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.gui; +import java.io.File; import java.util.ArrayList; import java.util.List; @@ -136,13 +137,6 @@ public class TreasurePage extends ShopPageBase int gingerbreadCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.GINGERBREAD.getItemName()); int minestrikeCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MINESTRIKE.getItemName()); - boolean availableChristmas = false; - boolean availableFreedom = false; - boolean availableHaunted = false; - boolean availableTrick = false; - boolean availableThank = false; - boolean availableGingerbread = false; - List shardLore = new ArrayList<>(); shardLore.add(" "); shardLore.add(C.cGray + "This seems like it might come in"); @@ -302,7 +296,8 @@ public class TreasurePage extends ShopPageBase } else { - if (!availableTrick) + boolean available = new File("../../update/files/EnableTrickOrTreat.dat").exists(); + if (!available) { trickLore.add(C.cRed + "This item is no longer available!"); } @@ -328,7 +323,8 @@ public class TreasurePage extends ShopPageBase } else { - if (!availableThank) + boolean available = new File("../../update/files/EnableThankful.dat").exists(); + if (!available) { thankLore.add(C.cRed + "This item is no longer available!"); } @@ -426,37 +422,12 @@ public class TreasurePage extends ShopPageBase _normalTreasures.add(omegaTreasureItem); _normalTreasures.add(minestrikeTreasureItem); - - - if (availableChristmas) - _specialTreasures.add(winterTreasureItem); - else - _seasonalTreasures.add(winterTreasureItem); - - if (availableFreedom) - _specialTreasures.add(freedomTreasureItem); - else - _seasonalTreasures.add(freedomTreasureItem); - - if (availableHaunted) - _specialTreasures.add(hauntedTreasureItem); - else - _seasonalTreasures.add(hauntedTreasureItem); - - if (availableTrick) - _specialTreasures.add(trickTreasureItem); - else - _seasonalTreasures.add(trickTreasureItem); - - if (availableThank) - _specialTreasures.add(thankTreasureItem); - else - _seasonalTreasures.add(thankTreasureItem); - - if (availableGingerbread) - _specialTreasures.add(gingerbreadTreasureItem); - else - _seasonalTreasures.add(gingerbreadTreasureItem); + _seasonalTreasures.add(winterTreasureItem); + _seasonalTreasures.add(freedomTreasureItem); + _seasonalTreasures.add(hauntedTreasureItem); + _seasonalTreasures.add(trickTreasureItem); + _seasonalTreasures.add(thankTreasureItem); + _seasonalTreasures.add(gingerbreadTreasureItem); } private void buildFirstPage() From 6ba1901490ecd57b4641cf788fd0fff2f1444180 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 18 Jan 2017 01:07:50 -0200 Subject: [PATCH 18/22] Revert "Revered changes to chest page" This reverts commit 419c4b1053677234f87531194551e5ea6c90124d. --- .../core/treasure/gui/TreasurePage.java | 51 +++++++++++++++---- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index 9f15e54cc..12e3a69f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -1,6 +1,5 @@ package mineplex.core.treasure.gui; -import java.io.File; import java.util.ArrayList; import java.util.List; @@ -137,6 +136,13 @@ public class TreasurePage extends ShopPageBase int gingerbreadCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.GINGERBREAD.getItemName()); int minestrikeCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MINESTRIKE.getItemName()); + boolean availableChristmas = false; + boolean availableFreedom = false; + boolean availableHaunted = false; + boolean availableTrick = false; + boolean availableThank = false; + boolean availableGingerbread = false; + List shardLore = new ArrayList<>(); shardLore.add(" "); shardLore.add(C.cGray + "This seems like it might come in"); @@ -296,8 +302,7 @@ public class TreasurePage extends ShopPageBase } else { - boolean available = new File("../../update/files/EnableTrickOrTreat.dat").exists(); - if (!available) + if (!availableTrick) { trickLore.add(C.cRed + "This item is no longer available!"); } @@ -323,8 +328,7 @@ public class TreasurePage extends ShopPageBase } else { - boolean available = new File("../../update/files/EnableThankful.dat").exists(); - if (!available) + if (!availableThank) { thankLore.add(C.cRed + "This item is no longer available!"); } @@ -422,12 +426,37 @@ public class TreasurePage extends ShopPageBase _normalTreasures.add(omegaTreasureItem); _normalTreasures.add(minestrikeTreasureItem); - _seasonalTreasures.add(winterTreasureItem); - _seasonalTreasures.add(freedomTreasureItem); - _seasonalTreasures.add(hauntedTreasureItem); - _seasonalTreasures.add(trickTreasureItem); - _seasonalTreasures.add(thankTreasureItem); - _seasonalTreasures.add(gingerbreadTreasureItem); + + + if (availableChristmas) + _specialTreasures.add(winterTreasureItem); + else + _seasonalTreasures.add(winterTreasureItem); + + if (availableFreedom) + _specialTreasures.add(freedomTreasureItem); + else + _seasonalTreasures.add(freedomTreasureItem); + + if (availableHaunted) + _specialTreasures.add(hauntedTreasureItem); + else + _seasonalTreasures.add(hauntedTreasureItem); + + if (availableTrick) + _specialTreasures.add(trickTreasureItem); + else + _seasonalTreasures.add(trickTreasureItem); + + if (availableThank) + _specialTreasures.add(thankTreasureItem); + else + _seasonalTreasures.add(thankTreasureItem); + + if (availableGingerbread) + _specialTreasures.add(gingerbreadTreasureItem); + else + _seasonalTreasures.add(gingerbreadTreasureItem); } private void buildFirstPage() From f93794f14d7ec0f4c6ff024e898bf81912ded35b Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 18 Jan 2017 20:31:35 -0200 Subject: [PATCH 19/22] Removed permissions for snr mods to use unlock cosmetics --- .../mineplex/core/gadget/commands/UnlockCosmeticsCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java index d18f05207..1381fe628 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java @@ -22,7 +22,7 @@ public class UnlockCosmeticsCommand extends CommandBase public UnlockCosmeticsCommand(GadgetManager plugin) { - super(plugin, Rank.SNR_MODERATOR, "unlockCosmetics"); + super(plugin, Rank.JNR_DEV, "unlockCosmetics"); _plugin = plugin; } From 20efc234fa547a3981f627c92b1d5e3db2e4f26d Mon Sep 17 00:00:00 2001 From: cnr Date: Wed, 25 Jan 2017 20:33:25 -0600 Subject: [PATCH 20/22] Allow YT to use /disguise --- .../mineplex/core/disguise/playerdisguise/DisguiseCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java index 1974687a7..dfe3d6fb2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/playerdisguise/DisguiseCommand.java @@ -11,7 +11,7 @@ public class DisguiseCommand extends CommandBase implemen { DisguiseCommand(PlayerDisguiseManager plugin) { - super(plugin, Rank.ADMIN, new Rank[]{Rank.YOUTUBE, Rank.TWITCH}, "disguise"); + super(plugin, Rank.ADMIN, new Rank[]{Rank.YOUTUBE_SMALL, Rank.YOUTUBE, Rank.TWITCH}, "disguise"); } @Override From 70948b696766deade22eef904180a791e85af30e Mon Sep 17 00:00:00 2001 From: cnr Date: Wed, 25 Jan 2017 21:10:32 -0600 Subject: [PATCH 21/22] Refactor PowerPlayClubItem instead of using an event --- .../gui/buttons/PowerPlayClubButton.java | 9 +- .../src/mineplex/core/pet/PetManager.java | 10 --- .../PowerPlayClubRepository.java | 18 +--- .../powerplayclub/PowerPlayClubRewards.java | 88 +++++++++++-------- .../event/PowerPlayRewardPetEvent.java | 42 --------- 5 files changed, 56 insertions(+), 111 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/event/PowerPlayRewardPetEvent.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java index 2d231cdd3..67b1ae492 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java @@ -21,7 +21,6 @@ import mineplex.core.bonuses.BonusManager; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.donation.DonationManager; import mineplex.core.gui.GuiItem; import mineplex.core.inventory.InventoryManager; import mineplex.core.powerplayclub.PowerPlayClubRepository; @@ -36,16 +35,12 @@ public class PowerPlayClubButton implements GuiItem private Player _player; private PowerPlayClubRepository _powerPlayClubRepository; private InventoryManager _inventoryManager; - private DonationManager _donationManager; - private BonusManager _bonusManager; public PowerPlayClubButton(Player player, BonusManager manager) { _player = player; - _bonusManager = manager; _powerPlayClubRepository = manager.getPowerPlayClubRepository(); _inventoryManager = manager.getInventoryManager(); - _donationManager = manager.getDonationManager(); } @Override @@ -132,7 +127,7 @@ public class PowerPlayClubButton implements GuiItem itemName = C.cRedB + "Power Play Club"; lore.add(C.cYellow + YearMonth.now().getMonth().getDisplayName(TextStyle.FULL, Locale.US) + "'s Cosmetic"); - lore.add(C.cWhite + " " + PowerPlayClubRewards.rewards().get(YearMonth.now()).getPrize()); + lore.add(C.cWhite + " " + PowerPlayClubRewards.rewards().get(YearMonth.now()).getPrizeName()); lore.add(" "); lore.addAll(buildOtherRewardsLore(1)); lore.add(C.cRed + "Get Power Play Club months at"); @@ -152,7 +147,7 @@ public class PowerPlayClubButton implements GuiItem .forEach(entry -> { YearMonth yearMonth = entry.getKey(); - lore.add(C.cWhite + " " + entry.getValue().getPrize() + " " + C.cGold + yearMonth.getMonth().getDisplayName(TextStyle.SHORT, Locale.US) + " " + yearMonth.getYear()); + lore.add(C.cWhite + " " + entry.getValue().getPrizeName() + " " + C.cGold + yearMonth.getMonth().getDisplayName(TextStyle.SHORT, Locale.US) + " " + yearMonth.getYear()); }); lore.add(" "); return lore; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index a25e154d8..e9c7ff2e4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -72,7 +72,6 @@ import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.token.ClientPetTokenWrapper; -import mineplex.core.powerplayclub.event.PowerPlayRewardPetEvent; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -625,15 +624,6 @@ public class PetManager extends MiniClientPlugin } } - @EventHandler - public void onPowerPlayRewardPet(PowerPlayRewardPetEvent event) - { - Player player = event.getPlayer(); - PetType petType = event.getPetType(); - if (!Get(player).getPets().containsKey(petType)) - Get(player).getPets().put(petType, petType.getName()); - } - @Override protected PetClient addPlayer(UUID uuid) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java index df3370a71..e28b0509f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java @@ -26,7 +26,6 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.account.ILoginProcessor; import mineplex.core.donation.DonationManager; -import mineplex.core.powerplayclub.event.PowerPlayRewardPetEvent; import mineplex.serverdata.database.DBPool; public class PowerPlayClubRepository implements Listener { @@ -106,22 +105,7 @@ public class PowerPlayClubRepository implements Listener { List list = PowerPlayClubRewards.rewardsForMonths(cached.getUsableCosmeticMonths()); - for (PowerPlayClubRewards.PowerPlayClubItem item : list) - { - if (item.isPet()) - { - PowerPlayRewardPetEvent ppcRewardPetEvent = new PowerPlayRewardPetEvent(player, item.getPetType()); - Bukkit.getPluginManager().callEvent(ppcRewardPetEvent); - } - else - { - _donationManager.Get(player).addOwnedUnknownSalesPackage(item.getPrize()); - } - } - - /*PowerPlayClubRewards.rewardsForMonths(cached.getUsableCosmeticMonths()).stream() - .map(PowerPlayClubRewards.PowerPlayClubItem::getPrize) - .forEach(_donationManager.Get(player)::addOwnedUnknownSalesPackage);*/ + PowerPlayClubRewards.rewardsForMonths(cached.getUsableCosmeticMonths()).forEach(item -> item.reward(player)); // Gives Metal Man for anyone subscribed if (cached.getUsableCosmeticMonths().size() > 0) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java index 6cfdf4347..cf4367873 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java @@ -8,18 +8,19 @@ import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; -import org.bukkit.Material; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; import com.google.common.collect.ImmutableMap; -import mineplex.core.common.skin.SkinData; +import mineplex.core.Managers; import mineplex.core.common.util.BukkitFuture; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.data.Item; +import mineplex.core.pet.PetClient; +import mineplex.core.pet.PetManager; import mineplex.core.pet.PetType; public class PowerPlayClubRewards @@ -28,55 +29,72 @@ public class PowerPlayClubRewards public static final int CHESTS_PER_MONTH = 1; private static final Map rewards = ImmutableMap.builder() - .put(YearMonth.of(2016, Month.SEPTEMBER), new PowerPlayClubItem("Squid Morph", new ItemStack(Material.INK_SACK))) - .put(YearMonth.of(2016, Month.OCTOBER), new PowerPlayClubItem("Witch Morph", SkinData.WITCH.getSkull())) - .put(YearMonth.of(2016, Month.NOVEMBER), new PowerPlayClubItem("Turkey Morph", SkinData.TURKEY.getSkull())) - .put(YearMonth.of(2016, Month.DECEMBER), new PowerPlayClubItem("Santa Morph", SkinData.SANTA.getSkull())) - .put(YearMonth.of(2017, Month.JANUARY), new PowerPlayClubItem("Over Easy Morph", new ItemStack(Material.EGG))) - .put(YearMonth.of(2017, Month.FEBRUARY), new PowerPlayClubItem(PetType.TRUE_LOVE_PET, new ItemStack(Material.APPLE))) + .put(YearMonth.of(2016, Month.SEPTEMBER), new UnknownSalesPackageItem("Squid Morph")) + .put(YearMonth.of(2016, Month.OCTOBER), new UnknownSalesPackageItem("Witch Morph")) + .put(YearMonth.of(2016, Month.NOVEMBER), new UnknownSalesPackageItem("Turkey Morph")) + .put(YearMonth.of(2016, Month.DECEMBER), new UnknownSalesPackageItem("Santa Morph")) + .put(YearMonth.of(2017, Month.JANUARY), new UnknownSalesPackageItem("Over Easy Morph")) + .put(YearMonth.of(2017, Month.FEBRUARY), new PetItem(PetType.TRUE_LOVE_PET)) .build(); - public static class PowerPlayClubItem + public interface PowerPlayClubItem { - private final String _prize; - private final ItemStack _display; - private final boolean _isPet; - private final PetType _petType; + // The name of the Power Play Club prize to be shown as lore in Carl's GUI + String getPrizeName(); + // Give the player this reward + void reward(Player player); + } - PowerPlayClubItem(String prize, ItemStack display) + private static class UnknownSalesPackageItem implements PowerPlayClubItem + { + private static final DonationManager _donationManager = Managers.require(DonationManager.class); + private final String _name; + + UnknownSalesPackageItem(String name) { - _prize = prize; - _display = display; - _isPet = false; - _petType = null; + _name = name; } - PowerPlayClubItem(PetType prize, ItemStack display) + @Override + public String getPrizeName() { - _prize = prize.getName(); - _display = display; - _isPet = true; - _petType = prize; + return _name; } - public String getPrize() + @Override + public void reward(Player player) { - return _prize; + _donationManager.Get(player).addOwnedUnknownSalesPackage(_name); + } + } + + private static class PetItem implements PowerPlayClubItem + { + private final PetType _type; + + PetItem(PetType type) + { + _type = type; } - public ItemStack getDisplay() + @Override + public String getPrizeName() { - return _display; + return _type.getName() + " Pet"; } - public boolean isPet() + @Override + public void reward(Player player) { - return _isPet; - } - - public PetType getPetType() - { - return _petType; + PetManager petManager = Managers.get(PetManager.class); + if (petManager != null) + { + PetClient client = petManager.Get(player); + if (!client.getPets().containsKey(_type)) + { + client.getPets().put(_type, _type.getName()); + } + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/event/PowerPlayRewardPetEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/event/PowerPlayRewardPetEvent.java deleted file mode 100644 index 5f6f657fe..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/event/PowerPlayRewardPetEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -package mineplex.core.powerplayclub.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -import mineplex.core.pet.PetType; - -public class PowerPlayRewardPetEvent extends Event -{ - - private static final HandlerList handlers = new HandlerList(); - - private final Player _player; - private final PetType _petType; - - public PowerPlayRewardPetEvent(Player player, PetType petType) - { - _player = player; - _petType = petType; - } - - public Player getPlayer() - { - return _player; - } - - public PetType getPetType() - { - return _petType; - } - - public HandlerList getHandlers() - { - return handlers; - } - - public static HandlerList getHandlerList() - { - return handlers; - } -} From 741d0914bace8bdb45a240564bb9ad961444d86b Mon Sep 17 00:00:00 2001 From: Alexander Meech Date: Fri, 20 Jan 2017 03:21:06 -0500 Subject: [PATCH 22/22] Change premium rank hover descriptions --- .../src/mineplex/core/common/Rank.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index 53a2ba498..2f3556b26 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -32,11 +32,11 @@ public enum Rank TWITCH("Twitch", "tw", ChatColor.DARK_PURPLE, "A Twitch streamer who often features \nMineplex in their streams."), //Player - ETERNAL("Eternal", "et", ChatColor.DARK_AQUA, true, "???"), - TITAN("Titan", "t", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nPurchase Titan at www.mineplex.com/shop"), - LEGEND("Legend", "l", ChatColor.GREEN, true, "Mineplex's third premium rank. \n\nPurchase Legend at www.mineplex.com/shop"), - HERO("Hero", "h", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nPurchase Hero at www.mineplex.com/shop"), - ULTRA("Ultra", "u", ChatColor.AQUA, true, "Mineplex's first premium rank. \n\nPurchase Ultra at www.mineplex.com/shop"), + ETERNAL("Eternal", "et", ChatColor.DARK_AQUA, true, "Fantastic and magical, no one \nexcept the time lords truly understand \nthe power of this rank.\n\nThe fifth purchasable rank at Mineplex.com/shop"), + TITAN("Titan", "t", ChatColor.RED, true, "Ancient myths spoke of a gigantic being \nwith immense power... \n\nThe fourth purchasable rank at Mineplex.com/shop"), + LEGEND("Legend", "l", ChatColor.GREEN, true, "Years they have told stories of this rank, \nonly for the legends to be true. \n\nThe third purchasable rank at Mineplex.com/shop"), + HERO("Hero", "h", ChatColor.LIGHT_PURPLE, true, "There are many stories of a \nvaliant Hero who was brave enough to \ntame the most fearsome dragon in the land. \n\nThe second purchasable rank at Mineplex.com/shop"), + ULTRA("Ultra", "u", ChatColor.AQUA, true, "A first step into the stories of the mist. \nOnly those brave enough may enter. \n\nThe first purchasable rank at Mineplex.com/shop"), ALL("", "", ChatColor.WHITE, null); private ChatColor _color;