From 92f5214c91a27e98a214e910b7c2606fe06b88c0 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 17 Mar 2017 19:39:41 -0300 Subject: [PATCH 01/51] Added spring halo particle --- .../mineplex/core/gadget/GadgetManager.java | 2 + .../gadgets/particle/ParticleSpringHalo.java | 63 +++++++++++++++++++ .../core/gadget/types/ParticleGadget.java | 9 ++- .../core/particleeffects/CircleEffect.java | 19 +++++- 4 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index d2acbf740..242017566 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -164,6 +164,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; import mineplex.core.gadget.gadgets.particle.ParticleLegend; +import mineplex.core.gadget.gadgets.particle.ParticleSpringHalo; import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; @@ -447,6 +448,7 @@ public class GadgetManager extends MiniPlugin addGadget(new ParticleFreedom(this)); addGadget(new ParticleChristmasTree(this)); addGadget(new ParticleWingsLove(this)); + addGadget(new ParticleSpringHalo(this)); // Arrow Trails addGadget(new ArrowTrailFrostLord(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java new file mode 100644 index 000000000..c39203a27 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java @@ -0,0 +1,63 @@ +package mineplex.core.gadget.gadgets.particle; + +import java.awt.Color; +import java.time.Month; +import java.time.YearMonth; +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.particleeffects.CircleEffect; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleSpringHalo extends ParticleGadget +{ + + private Map _effects = new HashMap<>(); + + public ParticleSpringHalo(GadgetManager manager) + { + // TODO CHANGE LORE BEFORE RELEASE + super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE), -14, Material.GLASS, (byte) 0, YearMonth.of(2017, Month.APRIL)); + } + + @Override + public void enableCustom(Player player, boolean message) + { + super.enableCustom(player, message); + CircleEffect circleEffect = new CircleEffect(Manager.getPlugin(), player, 0.7d, Color.RED, false); + circleEffect.addRandomColor(Color.YELLOW); + circleEffect.addRandomColor(Color.BLUE); + circleEffect.addRandomColor(Color.GREEN); + circleEffect.setYOffset(2.3d); + circleEffect.start(); + _effects.put(player, circleEffect); + } + + @Override + public void disableCustom(Player player, boolean message) + { + super.disableCustom(player, message); + if (_effects.containsKey(player)) + { + CircleEffect circleEffect = _effects.get(player); + if (circleEffect != null) + { + circleEffect.stop(); + } + } + _effects.remove(player); + } + + @Override + public void playParticle(Player player, UpdateEvent event) + {} + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java index 06af3908b..e04db2a61 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ParticleGadget.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; @@ -28,7 +30,12 @@ public abstract class ParticleGadget extends Gadget public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames) { super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, 1, altNames); - } + } + + public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth, String... altNames) + { + super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, yearMonth, 1, altNames); + } @Override public void enableCustom(Player player, boolean message) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java index 8d1ae23d1..f9ff7b3a3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/CircleEffect.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.List; import org.bukkit.Location; +import org.bukkit.entity.Entity; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; @@ -23,6 +24,7 @@ public class CircleEffect extends Effect private List _randomColors = new ArrayList<>(); private int _maxCircles = -1; private int _totalCircles = 0; + private double _yOffset = 0.0; private static final double RANDOM_COLOR_CHANCE = 0.5; private static final int PARTICLES_PER_CIRCLE = 20; @@ -40,6 +42,14 @@ public class CircleEffect extends Effect _instantly = instantly; } + public CircleEffect(JavaPlugin plugin, Entity entity, double radius, Color color, boolean instantly) + { + super(-1, new EffectLocation(entity), plugin); + _radius = radius; + _color = color; + _instantly = instantly; + } + public void addRandomColor(Color color) { _randomColors.add(color); @@ -50,6 +60,11 @@ public class CircleEffect extends Effect _maxCircles = circles; } + public void setYOffset(double yOffset) + { + _yOffset = yOffset; + } + @Override public void runEffect() { @@ -57,7 +72,7 @@ public class CircleEffect extends Effect { for (int i = 0; i < PARTICLES_PER_CIRCLE; i++) { - Location location = getEffectLocation().getFixedLocation(); + Location location = getEffectLocation().getLocation().add(0, _yOffset, 0); double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; double angle = _steps * increment; Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); @@ -86,7 +101,7 @@ public class CircleEffect extends Effect return; } } - Location location = getEffectLocation().getFixedLocation(); + Location location = getEffectLocation().getLocation().add(0, _yOffset, 0); double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; double angle = _steps * increment; Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); From d8b68e4716d5eaa2a6f3ab73d5aa293276c05fa5 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 17 Mar 2017 20:01:48 -0300 Subject: [PATCH 02/51] Multi colored circle --- .../gadgets/particle/ParticleSpringHalo.java | 12 +-- .../particleeffects/ColoredCircleEffect.java | 94 +++++++++++++++++++ 2 files changed, 99 insertions(+), 7 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java index c39203a27..bc7d54980 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java @@ -14,13 +14,13 @@ import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.particleeffects.CircleEffect; +import mineplex.core.particleeffects.ColoredCircleEffect; import mineplex.core.updater.event.UpdateEvent; public class ParticleSpringHalo extends ParticleGadget { - private Map _effects = new HashMap<>(); + private Map _effects = new HashMap<>(); public ParticleSpringHalo(GadgetManager manager) { @@ -32,10 +32,8 @@ public class ParticleSpringHalo extends ParticleGadget public void enableCustom(Player player, boolean message) { super.enableCustom(player, message); - CircleEffect circleEffect = new CircleEffect(Manager.getPlugin(), player, 0.7d, Color.RED, false); - circleEffect.addRandomColor(Color.YELLOW); - circleEffect.addRandomColor(Color.BLUE); - circleEffect.addRandomColor(Color.GREEN); + ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false, + Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW); circleEffect.setYOffset(2.3d); circleEffect.start(); _effects.put(player, circleEffect); @@ -47,7 +45,7 @@ public class ParticleSpringHalo extends ParticleGadget super.disableCustom(player, message); if (_effects.containsKey(player)) { - CircleEffect circleEffect = _effects.get(player); + ColoredCircleEffect circleEffect = _effects.get(player); if (circleEffect != null) { circleEffect.stop(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java new file mode 100644 index 000000000..2218cba9c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java @@ -0,0 +1,94 @@ +package mineplex.core.particleeffects; + +import java.awt.Color; + +import org.bukkit.Location; +import org.bukkit.entity.Entity; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; + +public class ColoredCircleEffect extends Effect +{ + + private double _radius; + private Color[] _colors; + private int _steps = 0; + private boolean _instantly = true; + private int _maxCircles = -1; + private int _totalCircles = 0; + private double _yOffset = 0.0; + + private static final int PARTICLES_PER_CIRCLE = 20; + + public ColoredCircleEffect(JavaPlugin plugin, Entity entity, double radius, boolean instantly, Color... colors) + { + super(-1, new EffectLocation(entity), plugin); + _radius = radius; + _colors = colors; + _instantly = instantly; + } + + public void setMaxCircles(int circles) + { + _maxCircles = circles; + } + + public void setYOffset(double yOffset) + { + _yOffset = yOffset; + } + + @Override + public void runEffect() + { + if (_instantly) + { + for (int i = 0; i < PARTICLES_PER_CIRCLE; i++) + { + Location location = getEffectLocation().getLocation().add(0, _yOffset, 0); + double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; + double angle = _steps * increment; + Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(getNextColor()), location.add(vector)); + coloredParticle.display(); + _steps++; + } + stop(); + } + else + { + if (_maxCircles != -1) + { + if (_totalCircles >= _maxCircles) + { + stop(); + return; + } + } + Location location = getEffectLocation().getLocation().add(0, _yOffset, 0); + double increment = (2 * Math.PI) / PARTICLES_PER_CIRCLE; + double angle = _steps * increment; + Vector vector = new Vector(Math.cos(angle) * _radius, 0, Math.sin(angle) * _radius); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(getNextColor()), location.add(vector)); + coloredParticle.display(); + _steps++; + if (_steps >= PARTICLES_PER_CIRCLE) + { + _totalCircles++; + _steps = 0; + } + } + } + + private Color getNextColor() + { + int r = UtilMath.random.nextInt(_colors.length - 1); + return _colors[r]; + } + +} From e1d9a568c953146edf245c0657771d719b61a610 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 18 Mar 2017 00:49:12 -0300 Subject: [PATCH 03/51] Added flower as a hat --- .../core/gadget/gadgets/particle/ParticleSpringHalo.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java index bc7d54980..e47574e7e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java @@ -8,11 +8,14 @@ import java.util.Map; import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilText; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.gadget.types.ParticleGadget; import mineplex.core.particleeffects.ColoredCircleEffect; import mineplex.core.updater.event.UpdateEvent; @@ -32,11 +35,14 @@ public class ParticleSpringHalo extends ParticleGadget public void enableCustom(Player player, boolean message) { super.enableCustom(player, message); + Manager.removeGadgetType(player, GadgetType.MORPH, this); + Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET); ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false, Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW); circleEffect.setYOffset(2.3d); circleEffect.start(); _effects.put(player, circleEffect); + player.getEquipment().setHelmet(new ItemStack(Material.RED_ROSE, 1, (byte) 8)); } @Override @@ -52,6 +58,7 @@ public class ParticleSpringHalo extends ParticleGadget } } _effects.remove(player); + player.getInventory().setHelmet(null); } @Override From 75ad5b9d513a93b28209ce016643341e3fd754f1 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 08:23:32 -0300 Subject: [PATCH 04/51] Flowers where player walks --- .../mineplex/core/common/util/UtilBlock.java | 31 ++-- .../mineplex/core/gadget/GadgetManager.java | 2 +- .../gadgets/particle/ParticleSpringHalo.java | 68 -------- .../particle/spring/ParticleSpringHalo.java | 161 ++++++++++++++++++ .../particle/spring/SpringHaloData.java | 34 ++++ 5 files changed, 217 insertions(+), 79 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/SpringHaloData.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 6a43363de..91c93c620 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -7,6 +7,16 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.IBlockData; +import net.minecraft.server.v1_8_R3.Item; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.MinecraftKey; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.TileEntityFlowerPot; +import net.minecraft.server.v1_8_R3.WorldServer; + import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.SkullType; @@ -35,15 +45,6 @@ import com.mojang.authlib.GameProfile; import mineplex.core.common.Pair; import mineplex.core.common.block.MultiBlockUpdaterAgent; import mineplex.core.common.skin.SkinData; -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.Blocks; -import net.minecraft.server.v1_8_R3.IBlockData; -import net.minecraft.server.v1_8_R3.Item; -import net.minecraft.server.v1_8_R3.MathHelper; -import net.minecraft.server.v1_8_R3.MinecraftKey; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.TileEntityFlowerPot; -import net.minecraft.server.v1_8_R3.WorldServer; public class UtilBlock { @@ -394,7 +395,17 @@ public class UtilBlock { return blockUseSet.contains(block); } - + + public static Set getBlocksInRadius(Location loc, double radius) + { + return getInRadius(loc, radius).keySet(); + } + + public static Set getBlocksInRadius(Location loc, double radius, int maxHeight) + { + return getInRadius(loc, radius, maxHeight).keySet(); + } + public static HashMap getInRadius(Location loc, double dR) { return getInRadius(loc, dR, 9999); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 242017566..35ae1e96c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -164,7 +164,7 @@ import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; import mineplex.core.gadget.gadgets.particle.ParticleFairy; import mineplex.core.gadget.gadgets.particle.ParticleFireRings; import mineplex.core.gadget.gadgets.particle.ParticleLegend; -import mineplex.core.gadget.gadgets.particle.ParticleSpringHalo; +import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo; import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java deleted file mode 100644 index e47574e7e..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/ParticleSpringHalo.java +++ /dev/null @@ -1,68 +0,0 @@ -package mineplex.core.gadget.gadgets.particle; - -import java.awt.Color; -import java.time.Month; -import java.time.YearMonth; -import java.util.HashMap; -import java.util.Map; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilText; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.types.GadgetType; -import mineplex.core.gadget.types.OutfitGadget; -import mineplex.core.gadget.types.ParticleGadget; -import mineplex.core.particleeffects.ColoredCircleEffect; -import mineplex.core.updater.event.UpdateEvent; - -public class ParticleSpringHalo extends ParticleGadget -{ - - private Map _effects = new HashMap<>(); - - public ParticleSpringHalo(GadgetManager manager) - { - // TODO CHANGE LORE BEFORE RELEASE - super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE), -14, Material.GLASS, (byte) 0, YearMonth.of(2017, Month.APRIL)); - } - - @Override - public void enableCustom(Player player, boolean message) - { - super.enableCustom(player, message); - Manager.removeGadgetType(player, GadgetType.MORPH, this); - Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET); - ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false, - Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW); - circleEffect.setYOffset(2.3d); - circleEffect.start(); - _effects.put(player, circleEffect); - player.getEquipment().setHelmet(new ItemStack(Material.RED_ROSE, 1, (byte) 8)); - } - - @Override - public void disableCustom(Player player, boolean message) - { - super.disableCustom(player, message); - if (_effects.containsKey(player)) - { - ColoredCircleEffect circleEffect = _effects.get(player); - if (circleEffect != null) - { - circleEffect.stop(); - } - } - _effects.remove(player); - player.getInventory().setHelmet(null); - } - - @Override - public void playParticle(Player player, UpdateEvent event) - {} - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java new file mode 100644 index 000000000..0b995504d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -0,0 +1,161 @@ +package mineplex.core.gadget.gadgets.particle.spring; + +import java.awt.Color; +import java.time.Month; +import java.time.YearMonth; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTime; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.gadget.types.OutfitGadget; +import mineplex.core.gadget.types.ParticleGadget; +import mineplex.core.particleeffects.ColoredCircleEffect; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ParticleSpringHalo extends ParticleGadget +{ + + private Map _effects = new HashMap<>(); + private List _springHaloData = new ArrayList<>(); + private Map> _playerSpringHaloData = new HashMap<>(); + + public ParticleSpringHalo(GadgetManager manager) + { + // TODO CHANGE LORE BEFORE RELEASE + super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE), -14, Material.GLASS, (byte) 0, YearMonth.of(2017, Month.APRIL)); + } + + @Override + public void enableCustom(Player player, boolean message) + { + super.enableCustom(player, message); + Manager.removeGadgetType(player, GadgetType.MORPH, this); + Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET); + ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false, + Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW); + circleEffect.setYOffset(2.3d); + circleEffect.start(); + _effects.put(player, circleEffect); + player.getEquipment().setHelmet(new ItemStack(Material.RED_ROSE, 1, (byte) 8)); + } + + @Override + public void disableCustom(Player player, boolean message) + { + super.disableCustom(player, message); + if (_effects.containsKey(player)) + { + ColoredCircleEffect circleEffect = _effects.get(player); + if (circleEffect != null) + { + circleEffect.stop(); + } + } + _effects.remove(player); + player.getInventory().setHelmet(null); + if (_playerSpringHaloData.containsKey(player)) + { + Iterator iterator = _playerSpringHaloData.get(player).iterator(); + while (iterator.hasNext()) + { + SpringHaloData springHaloData = iterator.next(); + springHaloData.getBlock().setType(Material.AIR); + springHaloData.getBlock().setData((byte) 0); + removeSpringHalo(springHaloData); + } + _playerSpringHaloData.get(player).clear(); + _playerSpringHaloData.remove(player); + } + } + + @Override + public void playParticle(Player player, UpdateEvent event) + { + } + + @EventHandler + public void spawnFlowers(PlayerMoveEvent event) + { + if (!isActive(event.getPlayer())) + return; + + Player player = event.getPlayer(); + + Block block = event.getFrom().getBlock(); + if (block.getType() != Material.AIR) + return; + + if (block.getLocation().subtract(0, 1, 0).getBlock().getType() != Material.GRASS + && block.getLocation().subtract(0, 1, 0).getBlock().getType() != Material.DIRT) + return; + + block.setType(Material.RED_ROSE); + block.setData((byte) UtilMath.random.nextInt(8)); + SpringHaloData springHaloData = new SpringHaloData(player, block, System.currentTimeMillis()); + addFlower(player, springHaloData); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _springHaloData.iterator(); + while (iterator.hasNext()) + { + SpringHaloData springHaloData = iterator.next(); + if (UtilTime.elapsed(springHaloData.getSpawned(), 1500)) + { + springHaloData.getBlock().setType(Material.AIR); + springHaloData.getBlock().setData((byte) 0); + removeSpringHalo(springHaloData); + iterator.remove(); + } + } + } + + private void addFlower(Player player, SpringHaloData springHaloData) + { + _springHaloData.add(springHaloData); + if (_playerSpringHaloData.containsKey(player)) + { + List list = _playerSpringHaloData.get(player); + list.add(springHaloData); + } + else + { + List list = new ArrayList<>(); + list.add(springHaloData); + _playerSpringHaloData.put(player, list); + } + } + + private void removeSpringHalo(SpringHaloData springHaloData) + { + Player player = springHaloData.getPlayer(); + List list = _playerSpringHaloData.get(player); + if (list != null) + { + list.remove(springHaloData); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/SpringHaloData.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/SpringHaloData.java new file mode 100644 index 000000000..c497b99a9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/SpringHaloData.java @@ -0,0 +1,34 @@ +package mineplex.core.gadget.gadgets.particle.spring; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +public class SpringHaloData +{ + + private Player _player; + private Block _block; + private long _spawned; + + public SpringHaloData(Player player, Block block, long spawned) + { + _player = player; + _block = block; + _spawned = spawned; + } + + public Player getPlayer() + { + return _player; + } + + public Block getBlock() + { + return _block; + } + + public long getSpawned() + { + return _spawned; + } +} From afad64bec3126fbc8ddf4ecec5ee40756980b30c Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 08:49:20 -0300 Subject: [PATCH 05/51] Fixed CME --- .../core/gadget/gadgets/particle/spring/ParticleSpringHalo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java index 0b995504d..8aa34525b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -78,7 +78,7 @@ public class ParticleSpringHalo extends ParticleGadget SpringHaloData springHaloData = iterator.next(); springHaloData.getBlock().setType(Material.AIR); springHaloData.getBlock().setData((byte) 0); - removeSpringHalo(springHaloData); + iterator.remove(); } _playerSpringHaloData.get(player).clear(); _playerSpringHaloData.remove(player); From 137220d58fb9d2cab2fad500b149e9f068eec405 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 13 Mar 2017 10:33:23 -0300 Subject: [PATCH 06/51] Custom pets --- .../core/cosmetic/ui/page/PetPage.java | 21 ++- .../ui/page/custompet/CustomPetAge.java | 62 +++++++++ .../ui/page/custompet/CustomPetBase.java | 56 ++++++++ .../mineplex/core/gadget/GadgetManager.java | 4 + .../mineplex/core/pet/custom/CustomPet.java | 124 ++++++++++++++++++ .../core/pet/custom/CustomPetAgeable.java | 25 ++++ .../core/pet/custom/CustomPetEquipment.java | 59 +++++++++ .../core/pet/custom/CustomPetZombie.java | 71 ++++++++++ 8 files changed, 411 insertions(+), 11 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java 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 f7b831eca..d23abb7e8 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 @@ -21,7 +21,6 @@ import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -37,10 +36,10 @@ import mineplex.core.cosmetic.ui.button.PetButton; import mineplex.core.cosmetic.ui.button.RenamePetButton; import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetBase; import mineplex.core.donation.DonationManager; import mineplex.core.pet.PetExtra; import mineplex.core.pet.PetType; -import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.AnvilContainer; import mineplex.core.shop.page.ShopPageBase; @@ -63,7 +62,7 @@ public class PetPage extends ShopPageBase for (PetType pet : pets) { - List itemLore = new ArrayList(); + List itemLore = new ArrayList<>(); itemLore.add(C.cBlack); if (pet.getLore().isPresent()) @@ -232,7 +231,7 @@ public class PetPage extends ShopPageBase slot += 2; } - slot = 49; + slot = 48; for (PetExtra petExtra : PetExtra.values()) { List itemLore = new ArrayList(); @@ -254,14 +253,14 @@ public class PetPage extends ShopPageBase slot++; } + + // Custom pet + addButton(50, new ShopItem(Material.GLASS, C.cGreen + "Custom", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), new CustomPetBase(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player))); + - addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() - { - public void onClick(Player player, ClickType clickType) - { - getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); - } - }); + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player))); } public void purchasePet(final Player player, final PetType petType) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java new file mode 100644 index 000000000..0c7903643 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java @@ -0,0 +1,62 @@ +package mineplex.core.cosmetic.ui.page.custompet; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetAgeable; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetAge extends GadgetPage +{ + + public CustomPetAge(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + // 20 + // 24 + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetAgeable)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetAgeable customPetAgeable = (CustomPetAgeable) customPet; + + addButton(20, new ShopItem(Material.SEEDS, "Baby", 1, false), (player, clickType) -> + { + customPetAgeable.setBaby(true); + getShop().openPageForPlayer(getPlayer(), customPet.createNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + CustomPet.removeCustomPet(player); + }); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java new file mode 100644 index 000000000..dc2019f46 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java @@ -0,0 +1,56 @@ +package mineplex.core.cosmetic.ui.page.custompet; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetBase extends GadgetPage +{ + + public CustomPetBase(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + int slot = 10; + + for (CustomPet.CustomPetType customPetType : CustomPet.CustomPetType.values()) + { + + addButton(slot, new ShopItem(customPetType.getMaterial(), customPetType.getData(), customPetType.getName(), new String[]{}, 1, false, false), (player, clickType) -> + { + CustomPet customPet = CustomPet.getCustomPet(player); + if (customPet == null) + { + customPet = customPetType.getCustomPet(player); + } + getShop().openPageForPlayer(getPlayer(), customPet.createNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + slot++; + + if (slot == 17) + slot += 2; + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + { + getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); + CustomPet.removeCustomPet(player); + }); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index d2acbf740..ce661ae21 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -237,6 +237,7 @@ import mineplex.core.mount.MountManager; import mineplex.core.mount.event.MountActivateEvent; import mineplex.core.packethandler.PacketHandler; import mineplex.core.pet.PetManager; +import mineplex.core.pet.custom.CustomPet; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.treasure.TreasureManager; @@ -1000,6 +1001,9 @@ public class GadgetManager extends MiniPlugin event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); _soulManager.giveSoul(event.getPlayer()); + + // Removes custom pet + CustomPet.removeCustomPet(event.getPlayer()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java new file mode 100644 index 000000000..8636cbfce --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java @@ -0,0 +1,124 @@ +package mineplex.core.pet.custom; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.donation.DonationManager; + +public abstract class CustomPet +{ + + private static Map _customPet = new HashMap<>(); + + protected Player _player; + protected EntityType _entityType; + protected DisguiseBase _disguiseBase; + protected int _step = 0; + private String _name; + + public CustomPet(Player player, EntityType entityType) + { + _player = player; + _entityType = entityType; + _customPet.put(player, this); + } + + public void spawn(Entity entity) + { + // TODO + onSpawn(entity); + } + + public abstract void onSpawn(Entity entity); + + public abstract GadgetPage createNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager); + + public DisguiseBase getDisguiseBase() + { + return _disguiseBase; + } + + public void setName(String name) + { + _name = name; + } + + public String getName() + { + return _name; + } + + public static CustomPet getCustomPet(Player player) + { + if (_customPet.containsKey(player)) + { + return _customPet.get(player); + } + return null; + } + + public static void removeCustomPet(Player player) + { + if (_customPet.containsKey(player)) + { + _customPet.remove(player); + } + } + + public enum CustomPetType + { + ZOMBIE("Zombie", Material.GLASS); + + private String _name; + private Material _material; + private byte _data; + + CustomPetType(String name, Material material, byte data) + { + _name = name; + _material = material; + _data = data; + } + + CustomPetType(String name, Material material) + { + this(name, material, (byte) 0); + } + + public String getName() + { + return _name; + } + + public Material getMaterial() + { + return _material; + } + + public byte getData() + { + return _data; + } + + public CustomPet getCustomPet(Player player) + { + switch (this) + { + case ZOMBIE: + return new CustomPetZombie(player); + default: + return new CustomPetZombie(player); + } + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java new file mode 100644 index 000000000..218bd52f1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java @@ -0,0 +1,25 @@ +package mineplex.core.pet.custom; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public abstract class CustomPetAgeable extends CustomPet +{ + + private boolean _baby = false; + + public CustomPetAgeable(Player player, EntityType entityType) + { + super(player, entityType); + } + + public void setBaby(boolean baby) + { + _baby = baby; + } + + protected boolean isBaby() + { + return _baby; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java new file mode 100644 index 000000000..73bc69fc4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java @@ -0,0 +1,59 @@ +package mineplex.core.pet.custom; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public abstract class CustomPetEquipment extends CustomPetAgeable +{ + + private ItemStack _helmet; + private ItemStack _chestplate; + private ItemStack _leggings; + private ItemStack _boots; + + public CustomPetEquipment(Player player, EntityType entityType) + { + super(player, entityType); + } + + public void setHelmet(ItemStack helmet) + { + _helmet = helmet; + } + + public void setChestplate(ItemStack chestplate) + { + _chestplate = chestplate; + } + + public void setLeggings(ItemStack leggings) + { + _leggings = leggings; + } + + public void setBoots(ItemStack boots) + { + _boots = boots; + } + + public ItemStack getHelmet() + { + return _helmet; + } + + public ItemStack getChestplate() + { + return _chestplate; + } + + public ItemStack getLeggings() + { + return _leggings; + } + + public ItemStack getBoots() + { + return _boots; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java new file mode 100644 index 000000000..669be3c0b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java @@ -0,0 +1,71 @@ +package mineplex.core.pet.custom; + +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetAge; +import mineplex.core.disguise.DisguiseFactory; +import mineplex.core.disguise.disguises.DisguiseZombie; +import mineplex.core.donation.DonationManager; + +public class CustomPetZombie extends CustomPetEquipment +{ + + public CustomPetZombie(Player player) + { + super(player, EntityType.ZOMBIE); + } + + @Override + public void onSpawn(Entity entity) + { + // TODO + _disguiseBase = DisguiseFactory.createDisguise(entity, _entityType); + DisguiseZombie disguiseZombie = (DisguiseZombie) _disguiseBase; + disguiseZombie.setBaby(isBaby()); + if (getHelmet() != null) + { + disguiseZombie.setHelmet(getHelmet()); + } + if (getChestplate() != null) + { + disguiseZombie.setChestplate(getChestplate()); + } + if (getLeggings() != null) + { + disguiseZombie.setLeggings(getLeggings()); + } + if (getBoots() != null) + { + disguiseZombie.setBoots(getBoots()); + } + if (getName() != null) + { + disguiseZombie.setCustomNameVisible(true); + disguiseZombie.setName(getName()); + } + else + { + disguiseZombie.setCustomNameVisible(false); + } + } + + @Override + public GadgetPage createNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager) + { + switch (_step) + { + case 0: + _step++; + return new CustomPetAge(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + default: + _step++; + return new CustomPetAge(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + } + } +} From e297f844e69d66f29037718d614fe19488205d5e Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 13 Mar 2017 10:59:19 -0300 Subject: [PATCH 07/51] Renamed classes --- .../src/mineplex/core/cosmetic/ui/page/PetPage.java | 4 ++-- .../custompet/{CustomPetAge.java => CustomPetAgePage.java} | 4 ++-- .../{CustomPetBase.java => CustomPetBasePage.java} | 4 ++-- .../src/mineplex/core/pet/custom/CustomPetZombie.java | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/{CustomPetAge.java => CustomPetAgePage.java} (88%) rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/{CustomPetBase.java => CustomPetBasePage.java} (88%) 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 d23abb7e8..fae5fe884 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 @@ -36,7 +36,7 @@ import mineplex.core.cosmetic.ui.button.PetButton; import mineplex.core.cosmetic.ui.button.RenamePetButton; import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton; -import mineplex.core.cosmetic.ui.page.custompet.CustomPetBase; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetBasePage; import mineplex.core.donation.DonationManager; import mineplex.core.pet.PetExtra; import mineplex.core.pet.PetType; @@ -256,7 +256,7 @@ public class PetPage extends ShopPageBase // Custom pet addButton(50, new ShopItem(Material.GLASS, C.cGreen + "Custom", new String[]{}, 1, false), (player, clickType) -> - getShop().openPageForPlayer(getPlayer(), new CustomPetBase(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player))); + getShop().openPageForPlayer(getPlayer(), new CustomPetBasePage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player))); addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java similarity index 88% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java index 0c7903643..12d8d1c82 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAge.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java @@ -14,10 +14,10 @@ import mineplex.core.pet.custom.CustomPet; import mineplex.core.pet.custom.CustomPetAgeable; import mineplex.core.shop.item.ShopItem; -public class CustomPetAge extends GadgetPage +public class CustomPetAgePage extends GadgetPage { - public CustomPetAge(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + public CustomPetAgePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) { super(plugin, shop, clientManager, donationManager, name, player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java similarity index 88% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java index dc2019f46..d5906f1d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java @@ -13,10 +13,10 @@ import mineplex.core.donation.DonationManager; import mineplex.core.pet.custom.CustomPet; import mineplex.core.shop.item.ShopItem; -public class CustomPetBase extends GadgetPage +public class CustomPetBasePage extends GadgetPage { - public CustomPetBase(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + public CustomPetBasePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) { super(plugin, shop, clientManager, donationManager, name, player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java index 669be3c0b..4d217109d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java @@ -8,7 +8,7 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; -import mineplex.core.cosmetic.ui.page.custompet.CustomPetAge; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetAgePage; import mineplex.core.disguise.DisguiseFactory; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; @@ -62,10 +62,10 @@ public class CustomPetZombie extends CustomPetEquipment { case 0: _step++; - return new CustomPetAge(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player); default: _step++; - return new CustomPetAge(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player); } } } From 13238eb4ad570b8193677f237b3f5db4e27052d4 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 09:40:11 -0300 Subject: [PATCH 08/51] Added equipment pages --- .../ui/page/custompet/CustomPetBasePage.java | 2 +- .../page/custompet/CustomPetConfirmPage.java | 61 ++++++++++++ .../custompet/{ => age}/CustomPetAgePage.java | 25 +++-- .../equipment/CustomPetBootsPage.java | 89 +++++++++++++++++ .../equipment/CustomPetChestplatePage.java | 88 +++++++++++++++++ .../equipment/CustomPetHelmetPage.java | 88 +++++++++++++++++ .../equipment/CustomPetLeggingsPage.java | 88 +++++++++++++++++ .../custompet/name/CloseCustomPetButton.java | 16 +++ .../custompet/name/CustomPetNamePage.java | 63 ++++++++++++ .../page/custompet/name/CustomPetTagPage.java | 98 +++++++++++++++++++ .../name/SelectCustomPetTagButton.java | 21 ++++ .../zombie/CustomPetZombieTypePage.java | 61 ++++++++++++ .../mineplex/core/pet/custom/CustomPet.java | 49 +++++++++- .../core/pet/custom/CustomPetAgeable.java | 1 + .../core/pet/custom/CustomPetEquipment.java | 5 + .../core/pet/custom/CustomPetZombie.java | 84 +++++++++++++++- 16 files changed, 821 insertions(+), 18 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java rename Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/{ => age}/CustomPetAgePage.java (65%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetBootsPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetChestplatePage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetLeggingsPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CloseCustomPetButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetNamePage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/SelectCustomPetTagButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/zombie/CustomPetZombieTypePage.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java index d5906f1d6..64d55c75c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java @@ -37,7 +37,7 @@ public class CustomPetBasePage extends GadgetPage { customPet = customPetType.getCustomPet(player); } - getShop().openPageForPlayer(getPlayer(), customPet.createNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); }); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java new file mode 100644 index 000000000..73c381bde --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java @@ -0,0 +1,61 @@ +package mineplex.core.cosmetic.ui.page.custompet; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetConfirmPage extends GadgetPage +{ + + public CustomPetConfirmPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + int[] confirm = {19, 20, 21, 28, 29, 30, 37, 38, 39}; + int[] cancel = {23, 24, 25, 32, 33, 34, 41, 42, 43}; + + ShopItem confirmItem = new ShopItem(Material.WOOL, (byte) 5, "Confirm", new String[]{}, 1, false, false); + ShopItem cancelItem = new ShopItem(Material.WOOL, (byte) 14, "Cancel", new String[]{}, 1, false, false); + + for (int aConfirm : confirm) + { + addButton(aConfirm, confirmItem, (player, clickType) -> + { + // TODO + }); + } + + for (int aCancel : cancel) + { + addButton(aCancel, cancelItem, (player, clickType) -> + { + // TODO + }); + } + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/age/CustomPetAgePage.java similarity index 65% rename from Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java rename to Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/age/CustomPetAgePage.java index 12d8d1c82..70feb8529 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetAgePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/age/CustomPetAgePage.java @@ -1,4 +1,4 @@ -package mineplex.core.cosmetic.ui.page.custompet; +package mineplex.core.cosmetic.ui.page.custompet.age; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -8,7 +8,6 @@ import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; -import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.donation.DonationManager; import mineplex.core.pet.custom.CustomPet; import mineplex.core.pet.custom.CustomPetAgeable; @@ -26,8 +25,6 @@ public class CustomPetAgePage extends GadgetPage protected void buildPage() { - // 20 - // 24 CustomPet customPet = CustomPet.getCustomPet(getPlayer()); if (customPet == null) { @@ -45,18 +42,20 @@ public class CustomPetAgePage extends GadgetPage CustomPetAgeable customPetAgeable = (CustomPetAgeable) customPet; - addButton(20, new ShopItem(Material.SEEDS, "Baby", 1, false), (player, clickType) -> - { - customPetAgeable.setBaby(true); - getShop().openPageForPlayer(getPlayer(), customPet.createNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); - }); + addButton(29, new ShopItem(Material.SEEDS, "Baby", 1, false), (player, clickType) -> + { + customPetAgeable.setBaby(true); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + addButton(33, new ShopItem(Material.WHEAT, "Adult", 1, false), (player, clickType) -> + { + customPetAgeable.setBaby(false); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> - { - getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); - CustomPet.removeCustomPet(player); - }); + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetBootsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetBootsPage.java new file mode 100644 index 000000000..edfc55ece --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetBootsPage.java @@ -0,0 +1,89 @@ +package mineplex.core.cosmetic.ui.page.custompet.equipment; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetEquipment; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetBootsPage extends GadgetPage +{ + + public CustomPetBootsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetEquipment)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; + + // Leather helmet + addButton(19, new ShopItem(Material.LEATHER_BOOTS, "Leather", 1, false), (player, clickType) -> + { + // TODO COLORED ARMOR + customPetEquipment.setBoots(new ItemStack(Material.LEATHER_BOOTS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(22, new ShopItem(Material.CHAINMAIL_BOOTS, "Chain", 1, false), (player, clickType) -> + { + customPetEquipment.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(25, new ShopItem(Material.IRON_BOOTS, "Iron", 1, false), (player, clickType) -> + { + customPetEquipment.setBoots(new ItemStack(Material.IRON_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(38, new ShopItem(Material.GOLD_BOOTS, "Gold", 1, false), (player, clickType) -> + { + customPetEquipment.setBoots(new ItemStack(Material.GOLD_BOOTS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) -> + { + customPetEquipment.setBoots(new ItemStack(Material.AIR)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(42, new ShopItem(Material.DIAMOND_BOOTS, "Diamond", 1, false), (player, clickType) -> + { + customPetEquipment.setBoots(new ItemStack(Material.DIAMOND_BOOTS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetChestplatePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetChestplatePage.java new file mode 100644 index 000000000..d9da369f4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetChestplatePage.java @@ -0,0 +1,88 @@ +package mineplex.core.cosmetic.ui.page.custompet.equipment; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetEquipment; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetChestplatePage extends GadgetPage +{ + + public CustomPetChestplatePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetEquipment)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; + + // Leather helmet + addButton(19, new ShopItem(Material.LEATHER_CHESTPLATE, "Leather", 1, false), (player, clickType) -> + { + // TODO COLORED ARMOR + customPetEquipment.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(22, new ShopItem(Material.CHAINMAIL_CHESTPLATE, "Chain", 1, false), (player, clickType) -> + { + customPetEquipment.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(25, new ShopItem(Material.IRON_CHESTPLATE, "Iron", 1, false), (player, clickType) -> + { + customPetEquipment.setChestplate(new ItemStack(Material.IRON_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(38, new ShopItem(Material.GOLD_CHESTPLATE, "Gold", 1, false), (player, clickType) -> + { + customPetEquipment.setChestplate(new ItemStack(Material.GOLD_CHESTPLATE)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) -> + { + customPetEquipment.setChestplate(new ItemStack(Material.AIR)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(42, new ShopItem(Material.DIAMOND_CHESTPLATE, "Diamond", 1, false), (player, clickType) -> + { + customPetEquipment.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java new file mode 100644 index 000000000..dc90f4c9c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java @@ -0,0 +1,88 @@ +package mineplex.core.cosmetic.ui.page.custompet.equipment; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetEquipment; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetHelmetPage extends GadgetPage +{ + + public CustomPetHelmetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetEquipment)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; + + // Leather helmet + addButton(19, new ShopItem(Material.LEATHER_HELMET, "Leather", 1, false), (player, clickType) -> + { + // TODO COLORED ARMOR + customPetEquipment.setHelmet(new ItemStack(Material.LEATHER_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(22, new ShopItem(Material.CHAINMAIL_HELMET, "Chain", 1, false), (player, clickType) -> + { + customPetEquipment.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(25, new ShopItem(Material.IRON_HELMET, "Iron", 1, false), (player, clickType) -> + { + customPetEquipment.setHelmet(new ItemStack(Material.IRON_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(38, new ShopItem(Material.GOLD_HELMET, "Gold", 1, false), (player, clickType) -> + { + customPetEquipment.setHelmet(new ItemStack(Material.GOLD_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) -> + { + customPetEquipment.setHelmet(new ItemStack(Material.AIR)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(42, new ShopItem(Material.DIAMOND_HELMET, "Diamond", 1, false), (player, clickType) -> + { + customPetEquipment.setHelmet(new ItemStack(Material.DIAMOND_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetLeggingsPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetLeggingsPage.java new file mode 100644 index 000000000..eaa0fdf9a --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetLeggingsPage.java @@ -0,0 +1,88 @@ +package mineplex.core.cosmetic.ui.page.custompet.equipment; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetEquipment; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetLeggingsPage extends GadgetPage +{ + + public CustomPetLeggingsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetEquipment)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; + + // Leather helmet + addButton(19, new ShopItem(Material.LEATHER_LEGGINGS, "Leather", 1, false), (player, clickType) -> + { + // TODO COLORED ARMOR + customPetEquipment.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(22, new ShopItem(Material.CHAINMAIL_LEGGINGS, "Chain", 1, false), (player, clickType) -> + { + customPetEquipment.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(25, new ShopItem(Material.IRON_LEGGINGS, "Iron", 1, false), (player, clickType) -> + { + customPetEquipment.setLeggings(new ItemStack(Material.IRON_HELMET)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(38, new ShopItem(Material.GOLD_LEGGINGS, "Gold", 1, false), (player, clickType) -> + { + customPetEquipment.setLeggings(new ItemStack(Material.GOLD_LEGGINGS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) -> + { + customPetEquipment.setLeggings(new ItemStack(Material.AIR)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(42, new ShopItem(Material.DIAMOND_LEGGINGS, "Diamond", 1, false), (player, clickType) -> + { + customPetEquipment.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CloseCustomPetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CloseCustomPetButton.java new file mode 100644 index 000000000..d2bef0f22 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CloseCustomPetButton.java @@ -0,0 +1,16 @@ +package mineplex.core.cosmetic.ui.page.custompet.name; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.shop.item.IButton; + +public class CloseCustomPetButton implements IButton +{ + public void onClick(Player player, ClickType clickType) + { + player.closeInventory(); + CustomPet.removeCustomPet(player); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetNamePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetNamePage.java new file mode 100644 index 000000000..60d71a10d --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetNamePage.java @@ -0,0 +1,63 @@ +package mineplex.core.cosmetic.ui.page.custompet.name; + +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.ChatMessage; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.Items; +import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow; +import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot; + +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.AnvilContainer; + +public class CustomPetNamePage extends GadgetPage +{ + + public CustomPetNamePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + addButton(31, new ShopItem(Material.NAME_TAG, "Name", 1, false), (player, clickType) -> + { + CustomPetTagPage customPetTagPage = new CustomPetTagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Pet Name", getPlayer()); + EntityPlayer entityPlayer = ((CraftPlayer) getPlayer()).getHandle(); + int containerCounter = entityPlayer.nextContainerCounter(); + UtilPlayer.sendPacket(player, new PacketPlayOutOpenWindow(containerCounter, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0]))); + entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, customPetTagPage.getInventory()); + entityPlayer.activeContainer.windowId = containerCounter; + entityPlayer.activeContainer.addSlotListener(entityPlayer); + UtilPlayer.sendPacket(player, new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_8_R3.ItemStack(Items.NAME_TAG))); + + getShop().setCurrentPageForPlayer(getPlayer(), customPetTagPage); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java new file mode 100644 index 000000000..a011d3ece --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java @@ -0,0 +1,98 @@ +package mineplex.core.cosmetic.ui.page.custompet.name; + +import net.minecraft.server.v1_8_R3.ItemStack; +import net.minecraft.server.v1_8_R3.Items; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.shop.page.ShopPageBase; + +public class CustomPetTagPage extends ShopPageBase +{ + private String _tagName = "Pet Name"; + + public CustomPetTagPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player, 3); + + buildPage(); + } + + @Override + protected void buildPage() + { + inventory.setItem(0, new ItemStack(Items.NAME_TAG)); + + getButtonMap().put(0, new CloseCustomPetButton()); + getButtonMap().put(1, new CloseCustomPetButton()); + getButtonMap().put(2, new SelectCustomPetTagButton(this)); + } + + @Override + public void playerClosed() + { + super.playerClosed(); + + getPlayer().setLevel(0); + CustomPet.removeCustomPet(_player); + } + + public void selectTag() + { + CustomPet customPet = CustomPet.getCustomPet(_player); + if (customPet == null) + { + _player.closeInventory(); + CustomPet.removeCustomPet(_player); + return; + } + + _tagName = ChatColor.stripColor(_tagName); + _tagName = _tagName.replaceAll("[^A-Za-z0-9]", ""); + System.out.println("Pet name: " + _tagName + "."); + if (_tagName.length() == 0) + { + UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Supplied pet name contains invalid characters.")); + playDenySound(getPlayer()); + + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + return; + } + + if (_tagName.length() > 16) + { + UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters.")); + playDenySound(getPlayer()); + + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + return; + } + + if (_tagName.toLowerCase().contains("ultra")) + { + UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + _tagName + " is a restricted name.")); + playDenySound(getPlayer()); + + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + return; + } + + customPet.setName(_tagName); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + + } + + public void setTagName(String tagName) + { + _tagName = tagName; + } +} + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/SelectCustomPetTagButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/SelectCustomPetTagButton.java new file mode 100644 index 000000000..c934f7648 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/SelectCustomPetTagButton.java @@ -0,0 +1,21 @@ +package mineplex.core.cosmetic.ui.page.custompet.name; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; + +public class SelectCustomPetTagButton implements IButton +{ + private CustomPetTagPage _page; + + public SelectCustomPetTagButton(CustomPetTagPage page) + { + _page = page; + } + + public void onClick(Player player, ClickType clickType) + { + _page.selectTag(); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/zombie/CustomPetZombieTypePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/zombie/CustomPetZombieTypePage.java new file mode 100644 index 000000000..70f017744 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/zombie/CustomPetZombieTypePage.java @@ -0,0 +1,61 @@ +package mineplex.core.cosmetic.ui.page.custompet.zombie; + +import org.bukkit.Material; +import org.bukkit.entity.Player; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.donation.DonationManager; +import mineplex.core.pet.custom.CustomPet; +import mineplex.core.pet.custom.CustomPetZombie; +import mineplex.core.shop.item.ShopItem; + +public class CustomPetZombieTypePage extends GadgetPage +{ + + public CustomPetZombieTypePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player); + } + + @Override + protected void buildPage() + { + + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); + if (customPet == null) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + if (!(customPet instanceof CustomPetZombie)) + { + CustomPet.removeCustomPet(getPlayer()); + getPlayer().closeInventory(); + return; + } + + CustomPetZombie customPetZombie = (CustomPetZombie) customPet; + + addButton(29, new ShopItem(Material.BARRIER, "Zombie", 1, false), (player, clickType) -> + { + customPetZombie.setVillager(false); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(33, new ShopItem(Material.WHEAT, "Zombie Villager", 1, false), (player, clickType) -> + { + customPetZombie.setVillager(true); + getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); + }); + + addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()))); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java index 8636cbfce..7a6b7feb6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java @@ -1,14 +1,21 @@ package mineplex.core.pet.custom; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; @@ -25,6 +32,7 @@ public abstract class CustomPet protected DisguiseBase _disguiseBase; protected int _step = 0; private String _name; + private List _lines = new ArrayList<>(); public CustomPet(Player player, EntityType entityType) { @@ -41,7 +49,9 @@ public abstract class CustomPet public abstract void onSpawn(Entity entity); - public abstract GadgetPage createNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager); + public abstract GadgetPage getNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager); + + public abstract GadgetPage getPreviousStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager); public DisguiseBase getDisguiseBase() { @@ -58,6 +68,43 @@ public abstract class CustomPet return _name; } + public void addLine(String lineKey, String lineValue) + { + _lines.add(C.cGray + lineKey + ": " + F.name(lineValue)); + } + + public void addLine(String lineKey, String lineValue, int i) + { + _lines.add(i, C.cGray + lineKey + ": " + F.name(lineValue)); + } + + protected void addTypeLine(String type) + { + addLine("Type", type); + } + + public List getLines() + { + return _lines; + } + + public ItemStack getCustomPetDescription() + { + ItemStack itemStack = new ItemStack(Material.PAPER); + ItemMeta meta = itemStack.getItemMeta(); + if (_name != null) + { + meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', _name)); + } + else + { + meta.setDisplayName("Custom Pet"); + } + meta.setLore(_lines); + itemStack.setItemMeta(meta); + return itemStack; + } + public static CustomPet getCustomPet(Player player) { if (_customPet.containsKey(player)) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java index 218bd52f1..5691aba57 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java @@ -16,6 +16,7 @@ public abstract class CustomPetAgeable extends CustomPet public void setBaby(boolean baby) { _baby = baby; + addLine("Age", (baby) ? "Baby" : "Adult"); } protected boolean isBaby() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java index 73bc69fc4..b67211a80 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java @@ -1,5 +1,6 @@ package mineplex.core.pet.custom; +import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -20,21 +21,25 @@ public abstract class CustomPetEquipment extends CustomPetAgeable public void setHelmet(ItemStack helmet) { _helmet = helmet; + addLine("Helmet", (helmet.getType() == Material.AIR) ? "None" : helmet.getItemMeta().getDisplayName()); } public void setChestplate(ItemStack chestplate) { _chestplate = chestplate; + addLine("Chestplate", (chestplate.getType() == Material.AIR) ? "None" : chestplate.getItemMeta().getDisplayName()); } public void setLeggings(ItemStack leggings) { _leggings = leggings; + addLine("Leggings", (leggings.getType() == Material.AIR) ? "None" : leggings.getItemMeta().getDisplayName()); } public void setBoots(ItemStack boots) { _boots = boots; + addLine("Boots", (boots.getType() == Material.AIR) ? "None" : boots.getItemMeta().getDisplayName()); } public ItemStack getHelmet() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java index 4d217109d..0b36d629c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java @@ -1,5 +1,6 @@ package mineplex.core.pet.custom; +import org.bukkit.ChatColor; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -8,7 +9,15 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; -import mineplex.core.cosmetic.ui.page.custompet.CustomPetAgePage; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetBasePage; +import mineplex.core.cosmetic.ui.page.custompet.CustomPetConfirmPage; +import mineplex.core.cosmetic.ui.page.custompet.age.CustomPetAgePage; +import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetBootsPage; +import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetChestplatePage; +import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetHelmetPage; +import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetLeggingsPage; +import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetNamePage; +import mineplex.core.cosmetic.ui.page.custompet.zombie.CustomPetZombieTypePage; import mineplex.core.disguise.DisguiseFactory; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; @@ -16,9 +25,12 @@ import mineplex.core.donation.DonationManager; public class CustomPetZombie extends CustomPetEquipment { + private boolean _villager = false; + public CustomPetZombie(Player player) { super(player, EntityType.ZOMBIE); + addTypeLine("Zombie"); } @Override @@ -47,7 +59,7 @@ public class CustomPetZombie extends CustomPetEquipment if (getName() != null) { disguiseZombie.setCustomNameVisible(true); - disguiseZombie.setName(getName()); + disguiseZombie.setName(ChatColor.translateAlternateColorCodes('&', getName())); } else { @@ -56,16 +68,82 @@ public class CustomPetZombie extends CustomPetEquipment } @Override - public GadgetPage createNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager) + public GadgetPage getNextStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager) { switch (_step) { case 0: + _step++; + return new CustomPetNamePage(plugin, shop, clientManager, donationManager, "Zombie Name", _player); + case 1: _step++; return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + case 2: + _step++; + return new CustomPetHelmetPage(plugin, shop, clientManager, donationManager, "Zombie Helmet", _player); + case 3: + _step++; + return new CustomPetChestplatePage(plugin, shop, clientManager, donationManager, "Zombie Chestplate", _player); + case 4: + _step++; + return new CustomPetLeggingsPage(plugin, shop, clientManager, donationManager, "Zombie Leggings", _player); + case 5: + _step++; + return new CustomPetBootsPage(plugin, shop, clientManager, donationManager, "Zombie Boots", _player); + case 6: + _step++; + return new CustomPetZombieTypePage(plugin, shop, clientManager, donationManager, "Zombie Type", _player); + case 7: + _step++; + return new CustomPetConfirmPage(plugin, shop, clientManager, donationManager, "Confirm", _player); default: _step++; return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player); } } + + @Override + public GadgetPage getPreviousStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager) + { + switch (_step) + { + case 1: + _step--; + return new CustomPetBasePage(plugin, shop, clientManager, donationManager, "Custom Pet", _player); + case 2: + _step--; + return new CustomPetNamePage(plugin, shop, clientManager, donationManager, "Zombie Name", _player); + case 3: + _step--; + return new CustomPetAgePage(plugin, shop, clientManager, donationManager, "Zombie Age", _player); + case 4: + _step--; + return new CustomPetHelmetPage(plugin, shop, clientManager, donationManager, "Zombie Helmet", _player); + case 5: + _step--; + return new CustomPetChestplatePage(plugin, shop, clientManager, donationManager, "Zombie Chestplate", _player); + case 6: + _step--; + return new CustomPetLeggingsPage(plugin, shop, clientManager, donationManager, "Zombie Leggings", _player); + case 7: + _step--; + return new CustomPetBootsPage(plugin, shop, clientManager, donationManager, "Zombie Boots", _player); + case 8: + _step--; + return new CustomPetZombieTypePage(plugin, shop, clientManager, donationManager, "Zombie Type", _player); + default: + _step--; + return new CustomPetBasePage(plugin, shop, clientManager, donationManager, "Custom Pet", _player); + } + } + + public void setVillager(boolean villager) + { + _villager = villager; + } + + public boolean isVillager() + { + return _villager; + } } From f5a85f2a54867a8b7156794e19bf716ffa913882 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 09:57:34 -0300 Subject: [PATCH 09/51] Spawns pet --- .../custompet/ActivateCustomPetButton.java | 27 ++++++++++ .../ui/page/custompet/CustomPetBasePage.java | 6 +++ .../page/custompet/CustomPetConfirmPage.java | 9 ++-- .../src/mineplex/core/pet/PetManager.java | 52 ++++++++++--------- .../mineplex/core/pet/custom/CustomPet.java | 10 +--- .../core/pet/custom/CustomPetZombie.java | 6 +-- 6 files changed, 68 insertions(+), 42 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java new file mode 100644 index 000000000..f0c0a6845 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java @@ -0,0 +1,27 @@ +package mineplex.core.cosmetic.ui.page.custompet; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.cosmetic.ui.page.GadgetPage; +import mineplex.core.cosmetic.ui.page.Menu; +import mineplex.core.pet.PetType; +import mineplex.core.shop.item.IButton; + +public class ActivateCustomPetButton implements IButton +{ + private GadgetPage _page; + + public ActivateCustomPetButton(GadgetPage page) + { + _page = page; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _page.playAcceptSound(player); + _page.getPlugin().getPetManager().addPetOwner(player, PetType.CUSTOM, player.getLocation()); + _page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player)); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java index 64d55c75c..9f86874cd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java @@ -25,6 +25,12 @@ public class CustomPetBasePage extends GadgetPage protected void buildPage() { + // TODO + // EDIT PET + // DISABLE PET + // RENAME PET + // RESET PET + int slot = 10; for (CustomPet.CustomPetType customPetType : CustomPet.CustomPetType.values()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java index 73c381bde..02ee84191 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java @@ -7,6 +7,7 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; +import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.donation.DonationManager; import mineplex.core.pet.custom.CustomPet; @@ -40,17 +41,15 @@ public class CustomPetConfirmPage extends GadgetPage for (int aConfirm : confirm) { - addButton(aConfirm, confirmItem, (player, clickType) -> - { - // TODO - }); + addButton(aConfirm, confirmItem, new ActivateCustomPetButton(this)); } for (int aCancel : cancel) { addButton(aCancel, cancelItem, (player, clickType) -> { - // TODO + player.closeInventory(); + CustomPet.removeCustomPet(player); }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 9eae213a0..cf5dda656 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -22,6 +22,8 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie; import org.bukkit.entity.Ageable; import org.bukkit.entity.Blaze; import org.bukkit.entity.Creature; +import org.bukkit.entity.Creeper; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.PigZombie; import org.bukkit.entity.Player; @@ -54,7 +56,6 @@ import mineplex.core.common.Rank; import mineplex.core.common.shape.ShapeWings; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; @@ -72,6 +73,7 @@ import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.pet.custom.CustomPet; import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.token.ClientPetTokenWrapper; import mineplex.core.updater.UpdateType; @@ -88,11 +90,11 @@ public class PetManager extends MiniClientPlugin private BlockRestore _blockRestore; private Map _activePetOwnerTypes = new HashMap<>(); - private NautHashMap _activePetOwners; - private NautHashMap _failedAttempts; + private Map _activePetOwners; + private Map _failedAttempts; private Map _petOwnerQueue = new HashMap<>(); - private NautHashMap _petRenameQueue = new NautHashMap(); + private Map _petRenameQueue = new HashMap<>(); private DonationManager _donationManager; private CoreClientManager _clientManager; private InventoryManager _inventoryManager; @@ -120,8 +122,8 @@ public class PetManager extends MiniClientPlugin _clientManager = clientManager; _inventoryManager = inventoryManager; - _activePetOwners = new NautHashMap(); - _failedAttempts = new NautHashMap(); + _activePetOwners = new HashMap<>(); + _failedAttempts = new HashMap<>(); } public void addPetOwnerToQueue(String playerName, PetType petType) @@ -169,7 +171,7 @@ public class PetManager extends MiniClientPlugin if (player != null && player.isOnline()) { - Creature activePet = getActivePet(playerName); + Entity activePet = getActivePet(playerName); if (activePet != null) { activePet.setCustomNameVisible(true); @@ -424,7 +426,7 @@ public class PetManager extends MiniClientPlugin UtilEnt.vegetate(pet); } - public Creature getPet(Player player) + public Entity getPet(Player player) { return _activePetOwners.get(player.getName()); } @@ -433,7 +435,7 @@ public class PetManager extends MiniClientPlugin { if (_activePetOwners.containsKey(player.getName())) { - final Creature pet = _activePetOwners.get(player.getName()); + final Entity pet = _activePetOwners.get(player.getName()); //Wither Silverfish if (pet.getPassenger() != null) @@ -494,7 +496,7 @@ public class PetManager extends MiniClientPlugin { String playerName = null; - for (Entry entry : _activePetOwners.entrySet()) + for (Entry entry : _activePetOwners.entrySet()) { if (entry.getValue() == event.getEntity()) playerName = entry.getKey(); @@ -518,28 +520,28 @@ public class PetManager extends MiniClientPlugin public void onUpdate(UpdateEvent event) { - for (Entry entry : _activePetOwners.entrySet()) + for (Entry entry : _activePetOwners.entrySet()) { String playerName = entry.getKey(); - Creature creature = entry.getValue(); + Entity entity = entry.getValue(); if (event.getType() == UpdateType.TICK) { - if (creature instanceof PigZombie) + if (entity instanceof PigZombie) { - UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, creature.getLocation(), 0.2f, 0.0f, 0.2f, 0.0f, 4, ViewDist.NORMAL); - if(event.getTick() % 3 == 0) creature.getWorld().playSound(creature.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); - if(!((CraftPigZombie) creature).getHandle().isSilent()) + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, entity.getLocation(), 0.2f, 0.0f, 0.2f, 0.0f, 4, ViewDist.NORMAL); + if(event.getTick() % 3 == 0) entity.getWorld().playSound(entity.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); + if(!((CraftPigZombie) entity).getHandle().isSilent()) { - ((CraftPigZombie) creature).getHandle().setSilent(true); + ((CraftPigZombie) entity).getHandle().setSilent(true); } } } else if (event.getType() == UpdateType.FAST) { - if (creature instanceof Blaze) + if (entity instanceof Blaze) { - Location loc = creature.getLocation().clone().add(0, .5, 0).add(creature.getLocation().getDirection().multiply(-0.2)); + Location loc = entity.getLocation().clone().add(0, .5, 0).add(entity.getLocation().getDirection().multiply(-0.2)); _grimReaperWings.display(loc); _grimReaperWingsEdge.display(loc); } @@ -548,7 +550,7 @@ public class PetManager extends MiniClientPlugin PetType petType = getActivePetType(playerName); if (petType == PetType.CUPID_PET) { - Location loc = creature.getLocation().clone().add(0, .5, 0).add(creature.getLocation().getDirection().multiply(-0.2)); + Location loc = entity.getLocation().clone().add(0, .5, 0).add(entity.getLocation().getDirection().multiply(-0.2)); _cupidWings.displayColored(loc, Color.PINK); _cupidWingsWhite.displayColored(loc, Color.WHITE); @@ -561,7 +563,7 @@ public class PetManager extends MiniClientPlugin PetType petType = getActivePetType(playerName); if (petType == PetType.CUPID_PET) { - Location loc = creature.getLocation().clone().add(0, .5, 0); + Location loc = entity.getLocation().clone().add(0, .5, 0); UtilParticle.PlayParticle(ParticleType.HEART, loc, 0.25f, 0.25f, 0.25f, 0.25f, 3, ViewDist.NORMAL); } } @@ -581,7 +583,7 @@ public class PetManager extends MiniClientPlugin String playerName = ownerIterator.next(); Player owner = Bukkit.getPlayer(playerName); - Creature pet = _activePetOwners.get(playerName); + Entity pet = _activePetOwners.get(playerName); Location petSpot = pet.getLocation(); Location ownerSpot = owner.getLocation(); xDiff = Math.abs(petSpot.getBlockX() - ownerSpot.getBlockX()); @@ -690,7 +692,7 @@ public class PetManager extends MiniClientPlugin { if (event.getEntity() instanceof Zombie) { - if (_activePetOwners.containsValue((Creature) event.getEntity())) + if (_activePetOwners.containsValue(event.getEntity())) { event.setCancelled(true); } @@ -718,7 +720,7 @@ public class PetManager extends MiniClientPlugin return _activePetOwnerTypes.get(name); } - public Creature getActivePet(String name) + public Entity getActivePet(String name) { return _activePetOwners.get(name); } @@ -734,7 +736,7 @@ public class PetManager extends MiniClientPlugin removePet(player, true); } - public Collection getPets() + public Collection getPets() { return _activePetOwners.values(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java index 7a6b7feb6..4113bb39d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java @@ -16,10 +16,10 @@ import org.bukkit.inventory.meta.ItemMeta; import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEnt; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; -import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.donation.DonationManager; public abstract class CustomPet @@ -29,7 +29,6 @@ public abstract class CustomPet protected Player _player; protected EntityType _entityType; - protected DisguiseBase _disguiseBase; protected int _step = 0; private String _name; private List _lines = new ArrayList<>(); @@ -43,7 +42,7 @@ public abstract class CustomPet public void spawn(Entity entity) { - // TODO + UtilEnt.silence(entity, true); onSpawn(entity); } @@ -53,11 +52,6 @@ public abstract class CustomPet public abstract GadgetPage getPreviousStep(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager); - public DisguiseBase getDisguiseBase() - { - return _disguiseBase; - } - public void setName(String name) { _name = name; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java index 0b36d629c..172474d18 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java @@ -18,7 +18,6 @@ import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetHelmetPage; import mineplex.core.cosmetic.ui.page.custompet.equipment.CustomPetLeggingsPage; import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetNamePage; import mineplex.core.cosmetic.ui.page.custompet.zombie.CustomPetZombieTypePage; -import mineplex.core.disguise.DisguiseFactory; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; @@ -36,10 +35,9 @@ public class CustomPetZombie extends CustomPetEquipment @Override public void onSpawn(Entity entity) { - // TODO - _disguiseBase = DisguiseFactory.createDisguise(entity, _entityType); - DisguiseZombie disguiseZombie = (DisguiseZombie) _disguiseBase; + DisguiseZombie disguiseZombie = new DisguiseZombie(entity); disguiseZombie.setBaby(isBaby()); + disguiseZombie.setVillager(_villager); if (getHelmet() != null) { disguiseZombie.setHelmet(getHelmet()); From df4d0b117b2906600ae5ed62a8511fb2d77eb7c9 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 09:59:38 -0300 Subject: [PATCH 10/51] Possible fix for pet names not showing --- .../src/mineplex/core/pet/PetManager.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index cf5dda656..a694c78f9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -271,7 +271,7 @@ public class PetManager extends MiniClientPlugin //Named Pet if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - //pet.setCustomNameVisible(true); + pet.setCustomNameVisible(true); pet.setCustomName(Get(player).getPets().get(petType)); } @@ -300,9 +300,9 @@ public class PetManager extends MiniClientPlugin DisguiseGuardian disguise = new DisguiseGuardian(pet); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - disguise.setName(Get(player).getPets().get(entityType)); + disguise.setName(Get(player).getPets().get(petType)); disguise.setCustomNameVisible(true); } @@ -317,9 +317,9 @@ public class PetManager extends MiniClientPlugin Zombie zombie = pet.getWorld().spawn(pet.getLocation(), Zombie.class); zombie.setBaby(true); zombie.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomName(Get(player).getPets().get(petType)); zombie.setCustomNameVisible(true); } disguise.getEntity().getBukkitEntity().setPassenger(zombie); @@ -332,9 +332,9 @@ public class PetManager extends MiniClientPlugin disguiseZombie.setChestplate(new ItemStack(Material.BANNER)); disguiseZombie.setHeldItem(new ItemStack(Material.WOOD_HOE)); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - disguiseZombie.setName(Get(player).getPets().get(entityType)); + disguiseZombie.setName(Get(player).getPets().get(petType)); disguiseZombie.setCustomNameVisible(true); } @@ -354,9 +354,9 @@ public class PetManager extends MiniClientPlugin UtilEnt.silence(zombie, true); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomName(Get(player).getPets().get(petType)); zombie.setCustomNameVisible(true); } } @@ -369,9 +369,9 @@ public class PetManager extends MiniClientPlugin disguiseVillager.setBaby(); disguiseVillager.setHeldItem(new ItemStack(Material.BOW)); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - disguiseVillager.setName(Get(player).getPets().get(entityType)); + disguiseVillager.setName(Get(player).getPets().get(petType)); disguiseVillager.setCustomNameVisible(true); } @@ -386,9 +386,9 @@ public class PetManager extends MiniClientPlugin UtilEnt.silence(zombie, true); - if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { - zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomName(Get(player).getPets().get(petType)); zombie.setCustomNameVisible(true); } From defece04a981f5b1e448c5d6586424b7eaa08cb8 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 13:30:51 -0300 Subject: [PATCH 11/51] Fixed some issues changing Creature to Entity --- .../mineplex/core/cosmetic/ui/page/Menu.java | 4 +-- .../equipment/CustomPetHelmetPage.java | 11 +++++++ .../src/mineplex/clanshub/HubManager.java | 17 ++++++----- .../src/mineplex/hub/modules/NewsManager.java | 30 +++++++++++-------- .../game/arcade/managers/GameManager.java | 22 ++++++++------ 5 files changed, 53 insertions(+), 31 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 3152a8fd0..37d7190f4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -6,7 +6,7 @@ import java.util.List; import java.util.Map; import org.bukkit.Material; -import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import mineplex.core.account.CoreClientManager; @@ -142,7 +142,7 @@ public class Menu extends ShopPageBase petMax++; } - Creature petActive = getPlugin().getPetManager().getPet(getPlayer()); + Entity petActive = getPlugin().getPetManager().getPet(getPlayer()); GadgetType type = GadgetType.PARTICLE; String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", VISIBILITY_EVERYWHERE, enabled.get(type)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java index dc90f4c9c..0e26f95a9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java @@ -1,5 +1,6 @@ package mineplex.core.cosmetic.ui.page.custompet.equipment; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -26,21 +27,29 @@ public class CustomPetHelmetPage extends GadgetPage protected void buildPage() { + Bukkit.broadcastMessage("A"); + CustomPet customPet = CustomPet.getCustomPet(getPlayer()); if (customPet == null) { + Bukkit.broadcastMessage("A1"); CustomPet.removeCustomPet(getPlayer()); getPlayer().closeInventory(); return; } + Bukkit.broadcastMessage("B"); + if (!(customPet instanceof CustomPetEquipment)) { + Bukkit.broadcastMessage("B1"); CustomPet.removeCustomPet(getPlayer()); getPlayer().closeInventory(); return; } + Bukkit.broadcastMessage("A"); + CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; // Leather helmet @@ -51,6 +60,8 @@ public class CustomPetHelmetPage extends GadgetPage getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); }); + Bukkit.broadcastMessage("B"); + addButton(22, new ShopItem(Material.CHAINMAIL_HELMET, "Chain", 1, false), (player, clickType) -> { customPetEquipment.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); diff --git a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java index 565300ef3..4ce00640d 100644 --- a/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java +++ b/Plugins/Mineplex.Hub.Clans/src/mineplex/clanshub/HubManager.java @@ -19,9 +19,9 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.entity.Creature; import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -1005,14 +1005,17 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter UtilTextTop.display(text, UtilServer.getPlayers()); //Fix Entity Names - for (Creature pet : _petManager.getPets()) + for (Entity pet : _petManager.getPets()) { - DisguiseBase disguise = _disguiseManager.getDisguise(pet); - - if (disguise instanceof DisguiseWither) + if (pet instanceof LivingEntity) { - ((DisguiseWither) disguise).setName(text); - disguise.resendMetadata(); + DisguiseBase disguise = _disguiseManager.getDisguise((LivingEntity) pet); + + if (disguise instanceof DisguiseWither) + { + ((DisguiseWither) disguise).setName(text); + disguise.resendMetadata(); + } } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 0679e29ba..74febb1a9 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -3,6 +3,14 @@ package mineplex.hub.modules; import java.util.HashMap; import java.util.Iterator; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; + import mineplex.core.MiniPlugin; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -26,13 +34,6 @@ import mineplex.hub.HubManager; import mineplex.hub.HubRepository; import mineplex.hub.HubType; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; - public class NewsManager extends MiniPlugin { public HubManager Manager; @@ -347,14 +348,17 @@ public class NewsManager extends MiniPlugin UtilTextTop.display(text, UtilServer.getPlayers()); //Fix Entity Names - for (Creature pet : Manager.getPetManager().getPets()) + for (Entity pet : Manager.getPetManager().getPets()) { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(pet); - - if (disguise instanceof DisguiseWither) + if (pet instanceof LivingEntity) { - ((DisguiseWither) disguise).setName(text); - disguise.resendMetadata(); + DisguiseBase disguise = Manager.GetDisguise().getDisguise((LivingEntity) pet); + + if (disguise instanceof DisguiseWither) + { + ((DisguiseWither) disguise).setName(text); + disguise.resendMetadata(); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index d87447cc1..6d3c8e18b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -9,7 +9,8 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -94,16 +95,19 @@ public class GameManager implements Listener //Display IP UtilTextTop.displayProgress(text, health, UtilServer.getPlayers()); - for (Creature pet : Manager.getCosmeticManager().getPetManager().getPets()) + for (Entity pet : Manager.getCosmeticManager().getPetManager().getPets()) { - DisguiseBase disguise = Manager.GetDisguise().getDisguise(pet); - - if (disguise instanceof DisguiseWither) + if (pet instanceof LivingEntity) { - ((DisguiseWither) disguise).setName(text); - ((DisguiseLiving) disguise).setHealth((float) Math.max(0.1, - 300 * health)); - disguise.resendMetadata(); + DisguiseBase disguise = Manager.GetDisguise().getDisguise((LivingEntity) pet); + + if (disguise instanceof DisguiseWither) + { + ((DisguiseWither) disguise).setName(text); + ((DisguiseLiving) disguise).setHealth((float) Math.max(0.1, + 300 * health)); + disguise.resendMetadata(); + } } } From 5d2681ec97480598b5f456722751d9c9179d049b Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 14 Mar 2017 16:12:54 -0300 Subject: [PATCH 12/51] Fixed some issues with menus! --- .../core/cosmetic/ui/CosmeticShop.java | 18 +++++++++++++++--- .../ui/page/custompet/CustomPetBasePage.java | 2 +- .../page/custompet/CustomPetConfirmPage.java | 1 - .../equipment/CustomPetHelmetPage.java | 11 ----------- .../page/custompet/name/CustomPetTagPage.java | 3 --- .../src/mineplex/core/pet/PetManager.java | 5 +++++ .../mineplex/core/pet/custom/CustomPet.java | 11 +++++++---- .../core/pet/custom/CustomPetAgeable.java | 6 ++++-- .../core/pet/custom/CustomPetEquipment.java | 6 ++++-- .../core/pet/custom/CustomPetZombie.java | 6 ++++-- 10 files changed, 40 insertions(+), 29 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java index 9c0138469..7a47b9aa2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java @@ -1,17 +1,19 @@ package mineplex.core.cosmetic.ui; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.plugin.messaging.PluginMessageListener; + import mineplex.core.account.CoreClientManager; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.PetTagPage; +import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetTagPage; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; import mineplex.core.shop.ShopBase; import mineplex.core.shop.page.ShopPageBase; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.plugin.messaging.PluginMessageListener; public class CosmeticShop extends ShopBase implements PluginMessageListener { @@ -43,6 +45,16 @@ public class CosmeticShop extends ShopBase implements PluginMes ((PetTagPage) getPlayerPageMap().get(player.getUniqueId())).SetTagName(tagName); } } + + if (getPlayerPageMap().containsKey(player.getUniqueId()) && getPlayerPageMap().get(player.getUniqueId()) instanceof CustomPetTagPage) + { + if (message != null && message.length >= 1) + { + String tagName = new String(message); + + ((CustomPetTagPage) getPlayerPageMap().get(player.getUniqueId())).setTagName(tagName); + } + } } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java index 9f86874cd..8b52b34a8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetBasePage.java @@ -41,7 +41,7 @@ public class CustomPetBasePage extends GadgetPage CustomPet customPet = CustomPet.getCustomPet(player); if (customPet == null) { - customPet = customPetType.getCustomPet(player); + customPet = customPetType.getCustomPet(getPlugin().getPetManager(), player); } getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); }); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java index 02ee84191..965a1d6ef 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/CustomPetConfirmPage.java @@ -7,7 +7,6 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; -import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.donation.DonationManager; import mineplex.core.pet.custom.CustomPet; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java index 0e26f95a9..dc90f4c9c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/equipment/CustomPetHelmetPage.java @@ -1,6 +1,5 @@ package mineplex.core.cosmetic.ui.page.custompet.equipment; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -27,29 +26,21 @@ public class CustomPetHelmetPage extends GadgetPage protected void buildPage() { - Bukkit.broadcastMessage("A"); - CustomPet customPet = CustomPet.getCustomPet(getPlayer()); if (customPet == null) { - Bukkit.broadcastMessage("A1"); CustomPet.removeCustomPet(getPlayer()); getPlayer().closeInventory(); return; } - Bukkit.broadcastMessage("B"); - if (!(customPet instanceof CustomPetEquipment)) { - Bukkit.broadcastMessage("B1"); CustomPet.removeCustomPet(getPlayer()); getPlayer().closeInventory(); return; } - Bukkit.broadcastMessage("A"); - CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet; // Leather helmet @@ -60,8 +51,6 @@ public class CustomPetHelmetPage extends GadgetPage getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager())); }); - Bukkit.broadcastMessage("B"); - addButton(22, new ShopItem(Material.CHAINMAIL_HELMET, "Chain", 1, false), (player, clickType) -> { customPetEquipment.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java index a011d3ece..774ecf2d0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/name/CustomPetTagPage.java @@ -40,9 +40,6 @@ public class CustomPetTagPage extends ShopPageBase return _creatureModule; } + public DisguiseManager getDisguiseManager() + { + return _disguiseManager; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java index 4113bb39d..d46290c2f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPet.java @@ -21,20 +21,23 @@ import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.donation.DonationManager; +import mineplex.core.pet.PetManager; public abstract class CustomPet { private static Map _customPet = new HashMap<>(); + protected PetManager _petManager; protected Player _player; protected EntityType _entityType; protected int _step = 0; private String _name; private List _lines = new ArrayList<>(); - public CustomPet(Player player, EntityType entityType) + public CustomPet(PetManager petManager, Player player, EntityType entityType) { + _petManager = petManager; _player = player; _entityType = entityType; _customPet.put(player, this); @@ -151,14 +154,14 @@ public abstract class CustomPet return _data; } - public CustomPet getCustomPet(Player player) + public CustomPet getCustomPet(PetManager petManager, Player player) { switch (this) { case ZOMBIE: - return new CustomPetZombie(player); + return new CustomPetZombie(petManager, player); default: - return new CustomPetZombie(player); + return new CustomPetZombie(petManager, player); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java index 5691aba57..9744b784b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetAgeable.java @@ -3,14 +3,16 @@ package mineplex.core.pet.custom; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import mineplex.core.pet.PetManager; + public abstract class CustomPetAgeable extends CustomPet { private boolean _baby = false; - public CustomPetAgeable(Player player, EntityType entityType) + public CustomPetAgeable(PetManager petManager, Player player, EntityType entityType) { - super(player, entityType); + super(petManager, player, entityType); } public void setBaby(boolean baby) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java index b67211a80..60ea7224b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetEquipment.java @@ -5,6 +5,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import mineplex.core.pet.PetManager; + public abstract class CustomPetEquipment extends CustomPetAgeable { @@ -13,9 +15,9 @@ public abstract class CustomPetEquipment extends CustomPetAgeable private ItemStack _leggings; private ItemStack _boots; - public CustomPetEquipment(Player player, EntityType entityType) + public CustomPetEquipment(PetManager petManager, Player player, EntityType entityType) { - super(player, entityType); + super(petManager, player, entityType); } public void setHelmet(ItemStack helmet) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java index 172474d18..b45c57f6d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/custom/CustomPetZombie.java @@ -20,15 +20,16 @@ import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetNamePage; import mineplex.core.cosmetic.ui.page.custompet.zombie.CustomPetZombieTypePage; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; +import mineplex.core.pet.PetManager; public class CustomPetZombie extends CustomPetEquipment { private boolean _villager = false; - public CustomPetZombie(Player player) + public CustomPetZombie(PetManager petManager, Player player) { - super(player, EntityType.ZOMBIE); + super(petManager, player, EntityType.ZOMBIE); addTypeLine("Zombie"); } @@ -63,6 +64,7 @@ public class CustomPetZombie extends CustomPetEquipment { disguiseZombie.setCustomNameVisible(false); } + _petManager.getDisguiseManager().disguise(disguiseZombie); } @Override From 5ad0bdcab14142daeb21c0e369c9cf274cdd7ec5 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 16:29:30 -0300 Subject: [PATCH 13/51] Added Spring Arrow Trail, added Spring Death Effect, moved each gadget to it's own package, added Spring Double Jump --- .../mineplex/core/gadget/GadgetManager.java | 4 +- .../{ => halloween}/ArrowTrailHalloween.java | 2 +- .../arrowtrail/spring/ArrowTrailSpring.java | 74 +++++++++++++ .../gadgets/death/spring/DeathSpring.java | 104 ++++++++++++++++++ .../{ => halloween}/DoubleJumpHalloween.java | 2 +- .../doublejump/spring/DoubleJumpSpring.java | 77 +++++++++++++ .../mineplex/core/reward/RewardManager.java | 4 +- 7 files changed, 261 insertions(+), 6 deletions(-) rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/{ => halloween}/ArrowTrailHalloween.java (96%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/{ => halloween}/DoubleJumpHalloween.java (97%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index ce661ae21..2a02225d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -45,7 +45,7 @@ import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.PlayerToggleSwimEvent; import mineplex.core.gadget.event.TauntCommandEvent; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; +import mineplex.core.gadget.gadgets.arrowtrail.halloween.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; @@ -73,7 +73,7 @@ import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.titan.DeathTitan; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween; +import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/halloween/ArrowTrailHalloween.java similarity index 96% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/halloween/ArrowTrailHalloween.java index bd5b62563..112f272ad 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/halloween/ArrowTrailHalloween.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.arrowtrail; +package mineplex.core.gadget.gadgets.arrowtrail.halloween; import java.awt.Color; import java.util.HashMap; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java new file mode 100644 index 000000000..48bf64a9e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java @@ -0,0 +1,74 @@ +package mineplex.core.gadget.gadgets.arrowtrail.spring; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Item; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ArrowEffectGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class ArrowTrailSpring extends ArrowEffectGadget +{ + + private List _items = new ArrayList<>(); + + public ArrowTrailSpring(GadgetManager manager) + { + // TODO NAME, LORE AND ICON + super(manager, "Flower Arrows", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), + -9, Material.GLASS, (byte) 0); + } + + @Override + public void doTrail(Arrow arrow) + { + Item sunflower = arrow.getWorld().dropItem(arrow.getLocation(), new ItemStack(Material.DOUBLE_PLANT)); + _items.add(sunflower); + } + + @Override + public void doHitEffect(Arrow arrow) + { + + } + + @EventHandler + public void onPickup(PlayerPickupItemEvent event) + { + if (_items.contains(event.getItem())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void removeFlowers(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _items.iterator(); + while (iterator.hasNext()) + { + Item item = iterator.next(); + if (item.getTicksLived() >= 20) + { + item.remove(); + iterator.remove(); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java new file mode 100644 index 000000000..bfdb922b4 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java @@ -0,0 +1,104 @@ +package mineplex.core.gadget.gadgets.death.spring; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.util.Vector; + +import mineplex.core.blood.BloodEvent; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DeathEffectGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class DeathSpring extends DeathEffectGadget +{ + + private List _items = new ArrayList<>(); + + public DeathSpring(GadgetManager manager) + { + // TODO NAME, LORE AND ICON + super(manager, "Flower Bouquet", + UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), + -3, + Material.INK_SACK, (byte)1); + } + + @Override + public void onBlood(Player player, BloodEvent event) + { + event.setCancelled(true); + + final Location location = event.getLocation(); + while (location.getBlock().getType() != Material.AIR + && location.clone().add(0, 1, 0).getBlock().getType() != Material.AIR) + { + location.add(0, 1, 0); + } + + location.getBlock().setType(Material.DOUBLE_PLANT); + location.getBlock().setData((byte) 4); + + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + location.getBlock().setType(Material.AIR); + + // Creates red rose explosion + for (int i = 50; i < 60; i++) + { + Item rose = location.getWorld().dropItem(location.add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.RED_ROSE, (byte) 0, 1, " " + i)); + _items.add(rose); + + Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d)); + UtilAction.velocity(rose, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false); + + } + } + }, 60L); + } + + @EventHandler + public void onPickup(PlayerPickupItemEvent event) + { + if (_items.contains(event.getItem())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void removeFlowers(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _items.iterator(); + while (iterator.hasNext()) + { + Item item = iterator.next(); + if (item.getTicksLived() >= 20) + { + item.remove(); + iterator.remove(); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/halloween/DoubleJumpHalloween.java similarity index 97% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/halloween/DoubleJumpHalloween.java index 0f2cc13e8..10155afbd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/halloween/DoubleJumpHalloween.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.doublejump; +package mineplex.core.gadget.gadgets.doublejump.halloween; import java.awt.Color; import java.util.HashMap; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java new file mode 100644 index 000000000..64e2647e6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java @@ -0,0 +1,77 @@ +package mineplex.core.gadget.gadgets.doublejump.spring; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Material; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilText; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class DoubleJumpSpring extends DoubleJumpEffectGadget +{ + + private List _items = new ArrayList<>(); + + public DoubleJumpSpring(GadgetManager manager) + { + // TODO NAME LORE ICON + super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), -9, + Material.GLASS, (byte) 0); + } + + @Override + public void doEffect(Player player) + { + for (int i = 50; i < 60; i++) + { + Item sunflower = player.getWorld().dropItem(player.getLocation().add(0.5, 1.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.DOUBLE_PLANT, (byte) 0, 1, " " + i)); + _items.add(sunflower); + + Vector vel = new Vector(Math.sin(i * 9/5d), 0, Math.cos(i * 9/5d)); + UtilAction.velocity(sunflower, vel, Math.abs(Math.sin(i * 12/3000d)), false, 0, 0.2 + Math.abs(Math.cos(i * 12/3000d))*0.6, 1, false); + + } + } + + @EventHandler + public void onPickup(PlayerPickupItemEvent event) + { + if (_items.contains(event.getItem())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void removeFlowers(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator iterator = _items.iterator(); + while (iterator.hasNext()) + { + Item item = iterator.next(); + if (item.getTicksLived() >= 20) + { + item.remove(); + iterator.remove(); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 855d747d7..dc4551670 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -15,7 +15,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.banner.CountryFlag; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; +import mineplex.core.gadget.gadgets.arrowtrail.halloween.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; @@ -40,7 +40,7 @@ import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; -import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween; +import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; From 16f02d5bd4844ef8c51fa997b48e22e042752896 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 16:38:31 -0300 Subject: [PATCH 14/51] Added killer bunny pet --- .../src/mineplex/core/pet/PetManager.java | 14 ++++++++++++-- .../src/mineplex/core/pet/PetType.java | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 10c656ca2..1e208d98a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -22,7 +22,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie; import org.bukkit.entity.Ageable; import org.bukkit.entity.Blaze; import org.bukkit.entity.Creature; -import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.PigZombie; @@ -67,13 +66,13 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseGuardian; +import mineplex.core.disguise.disguises.DisguiseRabbit; import mineplex.core.disguise.disguises.DisguiseVillager; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.donation.DonationManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.pet.custom.CustomPet; import mineplex.core.pet.repository.PetRepository; import mineplex.core.pet.repository.token.ClientPetTokenWrapper; import mineplex.core.updater.UpdateType; @@ -412,6 +411,17 @@ public class PetManager extends MiniClientPlugin zombie.getEquipment().setLeggings(ItemStackFactory.Instance.createColoredLeatherArmor(2, org.bukkit.Color.fromRGB(0, 153, 0))); zombie.getEquipment().setBoots(ItemStackFactory.Instance.createColoredLeatherArmor(3, org.bukkit.Color.fromRGB(0, 153, 0))); } + else if (petType.equals(PetType.KILLER_BUNNY)) + { + Zombie zombie = (Zombie) pet; + UtilEnt.silence(zombie, true); + + DisguiseRabbit disguiseRabbit = new DisguiseRabbit(zombie); + + Rabbit rabbit = (Rabbit) disguiseRabbit.getEntity().getBukkitEntity(); + rabbit.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY); + _disguiseManager.disguise(disguiseRabbit); + } _activePetOwnerTypes.put(player.getName(), petType); _activePetOwners.put(player.getName(), pet); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index e5453d7fe..6995910ec 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -33,7 +33,8 @@ public enum PetType GINGERBREAD_MAN("Gingerbread Man", EntityType.ZOMBIE, -16, "Looks like you can catch him after all."), CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), 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)), - LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()) + LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()), + KILLER_BUNNY("Killer Bunny", EntityType.ZOMBIE, -19, "Placeholder") // 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 540a0189b4e49781f39c7ca5fd5ae21496696f48 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 16:49:20 -0300 Subject: [PATCH 15/51] Added lore and icon for Flower Arrow --- .../gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java index 48bf64a9e..a6e4b1321 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java @@ -26,9 +26,8 @@ public class ArrowTrailSpring extends ArrowEffectGadget public ArrowTrailSpring(GadgetManager manager) { - // TODO NAME, LORE AND ICON - super(manager, "Flower Arrows", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), - -9, Material.GLASS, (byte) 0); + super(manager, "Flower Arrows", UtilText.splitLineToArray(C.cGray + "Send the power of Spring flying at your foes!", LineFormat.LORE), + -9, Material.YELLOW_FLOWER, (byte) 0); } @Override From 33b933f465787aa3459b84b7ce9c186f926d85c2 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 16:50:44 -0300 Subject: [PATCH 16/51] Added lore and icon for Flower Power --- .../gadget/gadgets/doublejump/spring/DoubleJumpSpring.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java index 64e2647e6..f5563bba6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java @@ -29,8 +29,8 @@ public class DoubleJumpSpring extends DoubleJumpEffectGadget public DoubleJumpSpring(GadgetManager manager) { // TODO NAME LORE ICON - super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), -9, - Material.GLASS, (byte) 0); + super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Be like a bouncing bee and pollinate everywhere you go!", LineFormat.LORE), -9, + Material.YELLOW_FLOWER, (byte) 0); } @Override From 8f7f52e222b81c9a1790b21c5691633473ff90c7 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 16:52:27 -0300 Subject: [PATCH 17/51] Added lore and icon for Funeral Bouquet and corrected the price for spring items --- .../gadgets/arrowtrail/spring/ArrowTrailSpring.java | 2 +- .../core/gadget/gadgets/death/spring/DeathSpring.java | 8 ++++---- .../gadgets/doublejump/spring/DoubleJumpSpring.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java index a6e4b1321..c335ce062 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/spring/ArrowTrailSpring.java @@ -27,7 +27,7 @@ public class ArrowTrailSpring extends ArrowEffectGadget public ArrowTrailSpring(GadgetManager manager) { super(manager, "Flower Arrows", UtilText.splitLineToArray(C.cGray + "Send the power of Spring flying at your foes!", LineFormat.LORE), - -9, Material.YELLOW_FLOWER, (byte) 0); + -19, Material.YELLOW_FLOWER, (byte) 0); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java index bfdb922b4..31b7bbf94 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java @@ -32,10 +32,10 @@ public class DeathSpring extends DeathEffectGadget public DeathSpring(GadgetManager manager) { // TODO NAME, LORE AND ICON - super(manager, "Flower Bouquet", - UtilText.splitLineToArray(C.cGray + "Placeholder", LineFormat.LORE), - -3, - Material.INK_SACK, (byte)1); + super(manager, "Funeral Bouquet", + UtilText.splitLineToArray(C.cGray + "Leave a rose to pay respects", LineFormat.LORE), + -19, + Material.RED_ROSE, (byte) 0); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java index f5563bba6..63dabdaf9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/spring/DoubleJumpSpring.java @@ -29,7 +29,7 @@ public class DoubleJumpSpring extends DoubleJumpEffectGadget public DoubleJumpSpring(GadgetManager manager) { // TODO NAME LORE ICON - super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Be like a bouncing bee and pollinate everywhere you go!", LineFormat.LORE), -9, + super(manager, "Flower Power", UtilText.splitLineToArray(C.cGray + "Be like a bouncing bee and pollinate everywhere you go!", LineFormat.LORE), -19, Material.YELLOW_FLOWER, (byte) 0); } From d55690f9047a3608a65506d819d6cdb1f913e7bd Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 20 Mar 2017 19:22:50 -0300 Subject: [PATCH 18/51] Changed colors --- .../particle/spring/ParticleSpringHalo.java | 13 +++++-- .../particleeffects/ColoredCircleEffect.java | 36 ++++++++++++++++--- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java index 8aa34525b..4b24315ca 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -1,6 +1,5 @@ package mineplex.core.gadget.gadgets.particle.spring; -import java.awt.Color; import java.time.Month; import java.time.YearMonth; import java.util.ArrayList; @@ -18,6 +17,8 @@ import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.RGBData; +import mineplex.core.common.util.UtilColor; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilTime; @@ -48,8 +49,14 @@ public class ParticleSpringHalo extends ParticleGadget super.enableCustom(player, message); Manager.removeGadgetType(player, GadgetType.MORPH, this); Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET); - ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false, - Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW); + ColoredCircleEffect circleEffect = new ColoredCircleEffect(Manager.getPlugin(), player, 0.7d, false); + RGBData colorA = UtilColor.hexToRgb(0x5a92ed); + RGBData colorB = UtilColor.hexToRgb(0xdb5aed); + RGBData colorC = UtilColor.hexToRgb(0xd2cdf2); + RGBData colorD = UtilColor.hexToRgb(0x7c6df2); + RGBData colorE = UtilColor.hexToRgb(0xedeb97); + RGBData colorF = UtilColor.hexToRgb(0xeac07c); + circleEffect.addColors(colorA, colorB, colorC, colorD, colorE, colorF); circleEffect.setYOffset(2.3d); circleEffect.start(); _effects.put(player, circleEffect); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java index 2218cba9c..51851e40b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/ColoredCircleEffect.java @@ -1,12 +1,16 @@ package mineplex.core.particleeffects; import java.awt.Color; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; +import mineplex.core.common.util.RGBData; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.particles.ColoredParticle; @@ -16,7 +20,7 @@ public class ColoredCircleEffect extends Effect { private double _radius; - private Color[] _colors; + private List _colors; private int _steps = 0; private boolean _instantly = true; private int _maxCircles = -1; @@ -29,8 +33,9 @@ public class ColoredCircleEffect extends Effect { super(-1, new EffectLocation(entity), plugin); _radius = radius; - _colors = colors; + _colors = new ArrayList<>(); _instantly = instantly; + Collections.addAll(_colors, colors); } public void setMaxCircles(int circles) @@ -43,6 +48,29 @@ public class ColoredCircleEffect extends Effect _yOffset = yOffset; } + public void addColor(Color color) + { + _colors.add(color); + } + + public void addColors(Color... colors) + { + Collections.addAll(_colors, colors); + } + + public void addColor(RGBData rgbData) + { + _colors.add(new Color(rgbData.getFullRed(), rgbData.getFullGreen(), rgbData.getFullBlue())); + } + + public void addColors(RGBData... rgbDatas) + { + for (RGBData rgbData : rgbDatas) + { + addColor(rgbData); + } + } + @Override public void runEffect() { @@ -87,8 +115,8 @@ public class ColoredCircleEffect extends Effect private Color getNextColor() { - int r = UtilMath.random.nextInt(_colors.length - 1); - return _colors[r]; + int r = UtilMath.random.nextInt(_colors.size()); + return _colors.get(r); } } From 47b88b7734560bccc33c995928a65c3f6025017b Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 22 Mar 2017 14:37:42 -0300 Subject: [PATCH 19/51] Added Spring set, added awkward bunny morph, added items to menus --- .../mineplex/core/gadget/GadgetManager.java | 10 +++ .../gadgets/morph/MorphAwkwardRabbit.java | 68 +++++++++++++++++++ .../mineplex/core/gadget/set/SetSpring.java | 23 +++++++ .../tracks/standard/HolidayCheerTrack.java | 2 + 4 files changed, 103 insertions(+) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index b7d46fd03..37b574468 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -55,6 +55,7 @@ import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; +import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring; import mineplex.core.gadget.gadgets.arrowtrail.titan.ArrowTrailTitan; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; @@ -70,6 +71,7 @@ import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; import mineplex.core.gadget.gadgets.death.music.DeathMusic; import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; +import mineplex.core.gadget.gadgets.death.spring.DeathSpring; import mineplex.core.gadget.gadgets.death.titan.DeathTitan; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; @@ -83,6 +85,7 @@ import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; +import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring; import mineplex.core.gadget.gadgets.doublejump.titan.DoubleJumpTitan; import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; @@ -113,6 +116,7 @@ import mineplex.core.gadget.gadgets.item.ItemPaintbrush; import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.gadgets.item.ItemTNT; +import mineplex.core.gadget.gadgets.morph.MorphAwkwardRabbit; import mineplex.core.gadget.gadgets.morph.MorphBat; import mineplex.core.gadget.gadgets.morph.MorphBlaze; import mineplex.core.gadget.gadgets.morph.MorphBlock; @@ -207,6 +211,7 @@ import mineplex.core.gadget.set.SetHowlingWinds; import mineplex.core.gadget.set.SetMusic; import mineplex.core.gadget.set.SetParty; import mineplex.core.gadget.set.SetShadow; +import mineplex.core.gadget.set.SetSpring; import mineplex.core.gadget.set.SetTitan; import mineplex.core.gadget.set.SetVampire; import mineplex.core.gadget.set.SetWisdom; @@ -338,6 +343,7 @@ public class GadgetManager extends MiniPlugin addSet(new SetVampire(this)); addSet(new SetMusic(this)); addSet(new SetFreedom(this)); + addSet(new SetSpring(this)); } private void createGadgets() @@ -424,6 +430,7 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphDinnerbone(this)); addGadget(new MorphLoveDoctor(this)); addGadget(new MorphGoldPot(this)); + addGadget(new MorphAwkwardRabbit(this)); // Particles addGadget(new ParticleFoot(this)); @@ -465,6 +472,7 @@ public class GadgetManager extends MiniPlugin addGadget(new ArrowTrailMusic(this)); addGadget(new ArrowTrailFreedom(this)); addGadget(new ArrowTrailHalloween(this)); + addGadget(new ArrowTrailSpring(this)); // Death Effect addGadget(new DeathFrostLord(this)); @@ -480,6 +488,7 @@ public class GadgetManager extends MiniPlugin addGadget(new DeathMusic(this)); addGadget(new DeathFreedom(this)); addGadget(new DeathPresentDanger(this)); + addGadget(new DeathSpring(this)); // Double Jump addGadget(new DoubleJumpFrostLord(this)); @@ -495,6 +504,7 @@ public class GadgetManager extends MiniPlugin addGadget(new DoubleJumpMusic(this)); addGadget(new DoubleJumpFreedom(this)); addGadget(new DoubleJumpHalloween(this)); + addGadget(new DoubleJumpSpring(this)); // Hat for (HatType hatType : HatType.values()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java new file mode 100644 index 000000000..ed09b4a54 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -0,0 +1,68 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MorphAwkwardRabbit extends MorphGadget +{ + + private Map _skeletons = new HashMap<>(); + + public MorphAwkwardRabbit(GadgetManager manager) + { + super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits"}, LineFormat.LORE), + -19, Material.GLASS, (byte) 0); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + Skeleton dinnerbone = player.getWorld().spawn(player.getLocation(), Skeleton.class); + dinnerbone.setCustomName("Dinnerbone"); + dinnerbone.setCustomNameVisible(false); + + _skeletons.put(player, dinnerbone); + + DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player); + UtilMorph.disguise(player, disguiseSkeleton, Manager); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + } + + @EventHandler + public void teleportSkeletons(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Map.Entry entry : _skeletons.entrySet()) + { + Player player = entry.getKey(); + Entity entity = entry.getValue(); + entity.teleport(player.getLocation().clone().add(0, 0.3, 0)); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java new file mode 100644 index 000000000..ea2f26dbe --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java @@ -0,0 +1,23 @@ +package mineplex.core.gadget.set; + +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring; +import mineplex.core.gadget.gadgets.death.spring.DeathSpring; +import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring; +import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo; +import mineplex.core.gadget.types.GadgetSet; + +public class SetSpring extends GadgetSet +{ + + public SetSpring(GadgetManager manager) + { + // TODO LORE + super(manager, "Spring", "Double Holiday Points while active", + manager.getGadget(ArrowTrailSpring.class), + manager.getGadget(DeathSpring.class), + manager.getGadget(DoubleJumpSpring.class), + manager.getGadget(ParticleSpringHalo.class)); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java index ecfc2ba3c..5f5b40058 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titles/tracks/standard/HolidayCheerTrack.java @@ -22,6 +22,7 @@ import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.set.SetCupidsLove; import mineplex.core.gadget.set.SetFreedom; import mineplex.core.gadget.set.SetFrostLord; +import mineplex.core.gadget.set.SetSpring; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetSet; import mineplex.core.titles.tracks.Track; @@ -56,6 +57,7 @@ public class HolidayCheerTrack extends Track HOLIDAY_SETS.add(SetFreedom.class); HOLIDAY_SETS.add(SetCupidsLove.class); HOLIDAY_SETS.add(SetFrostLord.class); + HOLIDAY_SETS.add(SetSpring.class); } private final GadgetManager _gadgetManager = Managers.require(GadgetManager.class); From 5464a74d2cae08548b7684c25bdb5a87127e78ae Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 24 Mar 2017 14:17:15 -0300 Subject: [PATCH 20/51] Added spring chest --- .../mineplex/core/reward/RewardManager.java | 14 ++++++++ .../src/mineplex/core/reward/RewardPool.java | 1 + .../src/mineplex/core/reward/RewardType.java | 1 + .../mineplex/core/treasure/TreasureStyle.java | 7 ++++ .../mineplex/core/treasure/TreasureType.java | 4 ++- .../core/treasure/gui/TreasurePage.java | 36 ++++++++++++++++++- 6 files changed, 61 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index dc4551670..2aa0f309e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -25,6 +25,7 @@ import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm; import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic; import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti; import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow; +import mineplex.core.gadget.gadgets.arrowtrail.spring.ArrowTrailSpring; import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood; import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant; import mineplex.core.gadget.gadgets.balloons.BalloonType; @@ -38,6 +39,7 @@ import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm; import mineplex.core.gadget.gadgets.death.music.DeathMusic; import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; +import mineplex.core.gadget.gadgets.death.spring.DeathSpring; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; import mineplex.core.gadget.gadgets.doublejump.halloween.DoubleJumpHalloween; @@ -50,6 +52,7 @@ import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm; import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic; import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker; import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow; +import mineplex.core.gadget.gadgets.doublejump.spring.DoubleJumpSpring; import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; @@ -115,6 +118,7 @@ import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain; import mineplex.core.gadget.gadgets.particle.music.ParticleMusic; import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; +import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt; @@ -599,6 +603,11 @@ public class RewardManager addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksChestplate.class), rarity, 50); addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksLeggings.class), rarity, 50); addGadget(Type.STPATRICKS, getGadget(OutfitStPatricksBoots.class), rarity, 50); + + // SPRING + addGadget(Type.SPRING, getGadget(ArrowTrailSpring.class), rarity, 100); + addGadget(Type.SPRING, getGadget(DeathSpring.class), rarity, 100); + addGadget(Type.SPRING, getGadget(DoubleJumpSpring.class), rarity, 100); } public void addLegendary() @@ -856,6 +865,11 @@ public class RewardManager addPetReward(Type.STPATRICKS, PetType.LEPRECHAUN, rarity, 30); addMount(Type.STPATRICKS, getMount(MountStPatricksHorse.class), rarity, 30); + + // SPRING + addGadget(Type.SPRING, getGadget(ParticleSpringHalo.class), rarity, 100); + + addPetReward(Type.SPRING, PetType.KILLER_BUNNY, rarity, 50); } public UnknownPackageReward addMount(Type type, Mount mount, RewardRarity rarity, int weight) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index 623552350..50b237313 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -65,6 +65,7 @@ public class RewardPool MINESTRIKE(true, 2), LOVECHEST(false, 1), STPATRICKS(false, 1), + SPRING(false, 1), CARL_SPINNER(true); private boolean _useDuplicates; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index 33381f37e..3442977b6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -22,6 +22,7 @@ public enum RewardType LOVE_CHEST( 0, 6, 18, 0), VALENTINES_GIFT( 0, 7, 20, 20), ST_PATRICKS( 0, 6, 18, 0), + SPRING( 0, 6, 18, 0), SPINNER_FILLER( 0.1, 1, 4, 20), SPINNER_REAL( 0.000001, 0.05, 0.4, 5); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java index b29622c3d..581ce9b47 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java @@ -97,6 +97,13 @@ public enum TreasureStyle ParticleType.HAPPY_VILLAGER, Sound.VILLAGER_YES, Sound.VILLAGER_YES + ), + SPRING( + ParticleType.RED_DUST, + ParticleType.RED_DUST, + ParticleType.RED_DUST, + Sound.STEP_GRASS, + Sound.STEP_GRASS ); private ParticleType _secondaryParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index c81c578c6..a9d3bf5c1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -34,7 +34,9 @@ public enum TreasureType LOVE_CHEST(C.cRed + "Love Treasure", "Love Chest", "LoveChest", RewardType.LOVE_CHEST, Material.CHEST, TreasureStyle.LOVECHEST, RewardPool.Type.LOVECHEST, true, 20000), - ST_PATRICKS(C.cGreen + "St Patrick's Treasure", "St Patricks Chest", "StPatricksChest", RewardType.ST_PATRICKS, Material.CHEST, TreasureStyle.STPATRICKS,RewardPool.Type.STPATRICKS, true, 20000); + ST_PATRICKS(C.cGreen + "St Patrick's Treasure", "St Patricks Chest", "StPatricksChest", RewardType.ST_PATRICKS, Material.CHEST, TreasureStyle.STPATRICKS,RewardPool.Type.STPATRICKS, true, 20000), + + SPRING(C.cGreen + "Spring Treasure", "Spring Chest", "SpringChest", RewardType.SPRING, Material.CHEST, TreasureStyle.SPRING, RewardPool.Type.SPRING, true, 20000); private final String _name; private final RewardType _rewardType; 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 ac82b4b25..030e3dc1d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -138,6 +138,7 @@ public class TreasurePage extends ShopPageBase int minestrikeCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MINESTRIKE.getItemName()); int loveCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.LOVE_CHEST.getItemName()); int stpatricksCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ST_PATRICKS.getItemName()); + int springCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.SPRING.getItemName()); boolean availableChristmas = false; boolean availableFreedom = false; @@ -147,6 +148,7 @@ public class TreasurePage extends ShopPageBase boolean availableGingerbread = false; boolean availableLove = false; boolean availableStPatricks = new File("../../update/files/EnableStPatricksChest.dat").exists(); + boolean availableSpring = new File("../../update/files/EnableSpringChest.dat").exists(); List shardLore = new ArrayList<>(); shardLore.add(" "); @@ -427,12 +429,36 @@ public class TreasurePage extends ShopPageBase } else { - stpatricksLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.LOVE_CHEST.getPurchasePrice() + " Treasure Shards"); + stpatricksLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.ST_PATRICKS.getPurchasePrice() + " Treasure Shards"); stpatricksLore.add(" "); stpatricksLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); } } + List springLore = Lists.newArrayList(); + springLore.add(" "); + springLore.add(F.value("Spring Chests Owned", "" + springCount)); + springLore.add(" "); + springLore.addAll(UtilText.splitLines(new String[]{C.cGray + "Spring is here! Find 6 limited edition Spring Cosmetics in the Spring Chest! Only available for a limited time. Guaranteed no Duplicate items!"}, LineFormat.LORE)); + springLore.add(" "); + if (springCount > 0) + { + springLore.add(C.cGreen + "Click to Open!"); + } + else + { + if (!availableSpring) + { + springLore.add(C.cRed + "This item is no longer available"); + } + else + { + springLore.add(ChatColor.RESET + "Click to craft for " + C.cAqua + TreasureType.SPRING.getPurchasePrice() + " Treasure Shards"); + springLore.add(" "); + springLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop"); + } + } + ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); // Normal chests @@ -452,6 +478,7 @@ public class TreasurePage extends ShopPageBase ItemStack gingerbread = SkinData.GINGERBREAD.getSkull(C.cRedB + "Gingerbread" + C.cGreenB + " Treasure", gingerbreadLore); ItemStack lovechest = new ShopItem(Material.WOOL, (byte) 6, C.cRedB + "Love Chest", lovechestLore.toArray(new String[0]), 0, false, false); ItemStack stpatricks = SkinData.LEPRECHAUN.getSkull(C.cGreenB + "St Patrick's Treasure", stpatricksLore); + ItemStack spring = new ShopItem(Material.DOUBLE_PLANT, (byte) 4, C.cGreenB + "Spring Treasure", springLore.toArray(new String[0]), 1, false, false); // Adds shard item addItem(49, shards); @@ -475,6 +502,7 @@ public class TreasurePage extends ShopPageBase TreasurePageItem gingerbreadTreasureItem = new TreasurePageItem(gingerbread, gingerbreadCount, TreasureType.GINGERBREAD); TreasurePageItem loveChestItem = new TreasurePageItem(lovechest, loveCount, TreasureType.LOVE_CHEST); TreasurePageItem stPatricksItem = new TreasurePageItem(stpatricks, stpatricksCount, TreasureType.ST_PATRICKS); + TreasurePageItem springItem = new TreasurePageItem(spring, springCount, TreasureType.SPRING); _normalTreasures.add(oldTreasureItem); _normalTreasures.add(ancientTreasureItem); @@ -483,6 +511,12 @@ public class TreasurePage extends ShopPageBase _normalTreasures.add(omegaTreasureItem); _normalTreasures.add(minestrikeTreasureItem); + + if (availableSpring) + _specialTreasures.add(springItem); + else + _seasonalTreasures.add(springItem); + if (availableStPatricks) _specialTreasures.add(stPatricksItem); else From 8a7f221bc62da4d206f5e1b3ffbc49367f83c661 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 24 Mar 2017 14:20:10 -0300 Subject: [PATCH 21/51] Added spring chest to cust server --- .../customerSupport/CustomerSupport.java | 11 ++++++++++ .../salespackage/SalesPackageManager.java | 5 ++++- .../salespackages/SpringChest.java | 21 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/SpringChest.java diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index c5b819fcf..d735896a8 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -167,6 +167,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int minestrikeChestsReceived = 0; int loveChestsReceived = 0; int stPatricksChestReceived = 0; + int springChestsReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -330,6 +331,16 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable stPatricksChestReceived += 1; } } + if (transaction.SalesPackageName.startsWith("Spring Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 4) + springChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[3]); + else if (transaction.SalesPackageName.split(" ").length == 3) + springChestsReceived += 1; + } + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { if (transaction.Coins == 0 && transaction.Gems == 0) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index c1809951d..2f8d3f15f 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -39,6 +39,7 @@ import mineplex.staffServer.salespackage.salespackages.Pet; import mineplex.staffServer.salespackage.salespackages.PowerPlayClub; import mineplex.staffServer.salespackage.salespackages.RuneAmplifier; import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; +import mineplex.staffServer.salespackage.salespackages.SpringChest; import mineplex.staffServer.salespackage.salespackages.StPatricksChest; import mineplex.staffServer.salespackage.salespackages.ThankfulChest; import mineplex.staffServer.salespackage.salespackages.TrickOrTreatChest; @@ -102,6 +103,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new MinestrikeChest(this)); AddSalesPackage(new LoveChest(this)); AddSalesPackage(new StPatricksChest(this)); + AddSalesPackage(new SpringChest(this)); AddSalesPackage(new TrickOrTreatChest(this)); AddSalesPackage(new ThankfulChest(this)); @@ -173,7 +175,8 @@ public class SalesPackageManager extends MiniPlugin coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest - || salesPackage instanceof ThankfulChest || salesPackage instanceof GingerbreadChest || salesPackage instanceof MinestrikeChest || salesPackage instanceof LoveChest || salesPackage instanceof StPatricksChest) + || salesPackage instanceof ThankfulChest || salesPackage instanceof GingerbreadChest || salesPackage instanceof MinestrikeChest || salesPackage instanceof LoveChest || salesPackage instanceof StPatricksChest + || salesPackage instanceof SpringChest) { chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/SpringChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/SpringChest.java new file mode 100644 index 000000000..181fe34e6 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/SpringChest.java @@ -0,0 +1,21 @@ +package mineplex.staffServer.salespackage.salespackages; + +import org.bukkit.entity.Player; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class SpringChest extends SalesPackageBase +{ + public SpringChest(SalesPackageManager manager) + { + super(manager, "1 Spring Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Spring Chest", "Give 1 Spring Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} + From 6875287b6d2333248335a8efe4e874a442dfd799 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 24 Mar 2017 16:52:37 -0300 Subject: [PATCH 22/51] Changed pets to Entities instead of Creatures --- .../custompet/ActivateCustomPetButton.java | 6 +-- .../mineplex/core/pet/FlyingPetManager.java | 6 +-- .../src/mineplex/core/pet/PetManager.java | 48 +++++++++---------- .../src/mineplex/core/pet/PetType.java | 2 +- 4 files changed, 28 insertions(+), 34 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java index f0c0a6845..7a090129e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/custompet/ActivateCustomPetButton.java @@ -4,8 +4,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import mineplex.core.cosmetic.ui.page.GadgetPage; -import mineplex.core.cosmetic.ui.page.Menu; -import mineplex.core.pet.PetType; import mineplex.core.shop.item.IButton; public class ActivateCustomPetButton implements IButton @@ -20,8 +18,8 @@ public class ActivateCustomPetButton implements IButton @Override public void onClick(Player player, ClickType clickType) { - _page.playAcceptSound(player); + /*_page.playAcceptSound(player); _page.getPlugin().getPetManager().addPetOwner(player, PetType.CUSTOM, player.getLocation()); - _page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player)); + _page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));*/ } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java index 1779e723c..c144a93ab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/FlyingPetManager.java @@ -1,7 +1,7 @@ package mineplex.core.pet; import org.bukkit.Location; -import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -17,13 +17,13 @@ public class FlyingPetManager */ private Player _player; - private Creature _pet; + private Entity _pet; private Location _grimReaperLoc, _target; private Vector _direction; private double _speed; private long _idleTime; - public FlyingPetManager(Player player, Creature pet) + public FlyingPetManager(Player player, Entity pet) { _player = player; _pet = pet; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 1e208d98a..1f68bed86 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -66,7 +66,6 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseGuardian; -import mineplex.core.disguise.disguises.DisguiseRabbit; import mineplex.core.disguise.disguises.DisguiseVillager; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.disguise.disguises.DisguiseZombie; @@ -98,8 +97,8 @@ public class PetManager extends MiniClientPlugin private CoreClientManager _clientManager; private InventoryManager _inventoryManager; - private Map _flyingPets = new HashMap<>(); - private Map _trueLovePets = new HashMap<>(); + private Map _flyingPets = new HashMap<>(); + private Map _trueLovePets = new HashMap<>(); private ShapeWings _grimReaperWings = 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 _grimReaperWingsEdge = 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); @@ -214,7 +213,7 @@ public class PetManager extends MiniClientPlugin return; } - Creature pet; + Entity pet; EntityType entityType = petType.getEntityType(); //Wither Spawn @@ -222,7 +221,7 @@ public class PetManager extends MiniClientPlugin { _creatureModule.SetForce(true); - pet = (Creature) location.getWorld().spawnEntity(location, EntityType.SILVERFISH); + pet = location.getWorld().spawnEntity(location, EntityType.SILVERFISH); UtilEnt.silence(pet, true); DisguiseWither witherDisguise = new DisguiseWither(pet); @@ -259,12 +258,12 @@ public class PetManager extends MiniClientPlugin } } } - pet = (Creature)_creatureModule.SpawnEntity(location, petType.getEntityType()); + pet = _creatureModule.SpawnEntity(location, petType.getEntityType()); } //Default Spawn else { - pet = (Creature)_creatureModule.SpawnEntity(location, petType.getEntityType()); + pet = _creatureModule.SpawnEntity(location, petType.getEntityType()); } //Named Pet @@ -276,16 +275,18 @@ public class PetManager extends MiniClientPlugin if (petType.equals(PetType.ZOMBIE)) { - ((Zombie) pet).setBaby(true); - pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); - pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); + Zombie zombie = (Zombie) pet; + zombie.setBaby(true); + zombie.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); + zombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); UtilEnt.silence(pet, true); } if (pet instanceof PigZombie) { - ((PigZombie)pet).setBaby(true); - pet.getEquipment().setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short)0, (byte) 1)); - pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); + PigZombie pigZombie = (PigZombie) pet; + pigZombie.setBaby(true); + pigZombie.getEquipment().setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short)0, (byte) 1)); + pigZombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); } else if (pet instanceof Villager) { @@ -294,10 +295,11 @@ public class PetManager extends MiniClientPlugin } else if (pet instanceof Skeleton) { - pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); //stop burning + Skeleton skeleton = (Skeleton) pet; + skeleton.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); //stop burning UtilEnt.silence(pet, true); - DisguiseGuardian disguise = new DisguiseGuardian(pet); + DisguiseGuardian disguise = new DisguiseGuardian(skeleton); if (Get(player).getPets().get(petType) != null && Get(player).getPets().get(petType).length() > 0) { @@ -413,14 +415,8 @@ public class PetManager extends MiniClientPlugin } else if (petType.equals(PetType.KILLER_BUNNY)) { - Zombie zombie = (Zombie) pet; - UtilEnt.silence(zombie, true); - - DisguiseRabbit disguiseRabbit = new DisguiseRabbit(zombie); - - Rabbit rabbit = (Rabbit) disguiseRabbit.getEntity().getBukkitEntity(); + Rabbit rabbit = (Rabbit) pet; rabbit.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY); - _disguiseManager.disguise(disguiseRabbit); } _activePetOwnerTypes.put(player.getName(), petType); @@ -669,7 +665,7 @@ public class PetManager extends MiniClientPlugin @EventHandler public void grimReaperFly(UpdateEvent event) { - for (Entry entry : _flyingPets.entrySet()) + for (Entry entry : _flyingPets.entrySet()) { FlyingPetManager flyingPetManager = entry.getValue(); flyingPetManager.update(); @@ -682,11 +678,11 @@ public class PetManager extends MiniClientPlugin if (event.getType() != UpdateType.FASTEST) return; - Iterator> iterator = _trueLovePets.entrySet().iterator(); + Iterator> iterator = _trueLovePets.entrySet().iterator(); while (iterator.hasNext()) { - Entry entry = iterator.next(); - Creature zombie = entry.getKey(); + Entry entry = iterator.next(); + Entity 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.update(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index 6995910ec..ee15e57ac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -34,7 +34,7 @@ public enum PetType CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), 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)), LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()), - KILLER_BUNNY("Killer Bunny", EntityType.ZOMBIE, -19, "Placeholder") + KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "Placeholder") // 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 bff837ca9bd3a30f3fbe0f74a5fc7ceabb840400 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 25 Mar 2017 18:36:12 -0300 Subject: [PATCH 23/51] Fixed morph and possible fix for balloons, added lore and icon for particle effect --- .../mineplex/core/common/skin/SkinData.java | 2 + .../cupidslove/ArrowTrailCupid.java | 1 - .../gadgets/death/spring/DeathSpring.java | 1 - .../gadgets/morph/MorphAwkwardRabbit.java | 94 ++++++++++++++----- .../core/gadget/types/BalloonGadget.java | 14 +++ .../core/gadget/util/BalloonData.java | 6 ++ .../src/mineplex/core/pet/PetManager.java | 2 +- .../src/mineplex/core/pet/PetType.java | 2 +- .../animation/BlockChangeAnimation.java | 46 +++++++++ 9 files changed, 143 insertions(+), 25 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index 3e4c49575..55d6fd4ab 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -65,6 +65,8 @@ public class SkinData public final static SkinData GINGERBREAD = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODAxOTk5MjM0NTUsInByb2ZpbGVJZCI6IjRjOGQ1NjllZWZlMTRkOGE4YzJmMmM4ODA3ODA3ODRmIiwicHJvZmlsZU5hbWUiOiJHaW5nZXJicmVhZE1hbiIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzAyM2IxZGQ5MWQyYjM2Y2FkZTU2NjVjM2Y3ODk3ZmNiOGRlMWFlNjE5YTRlOTYxODU2MzdiMTliZGNmZjQ3In19fQ==", "lND5lQCzd5DKdn+ps82zn55hrSDr12bBLFoSbxetOj7MaYAuHCkJPQQOXdcMh3TLLSgxmQzEWkIHSUo760/2Qfd2uDDOTVfZZqiFjiOwDQ7YQjkokqNaC3U9gEq+LBJ+IgEkwaCsluXYMIK0Wvqx1DFa82pg8bSYGczJfTw/1kQsUUTpmao6ChZw3yrHTPow38onD95f9i6yVcnhSpPfM/JTQuL4N6Jdcql6VRJNSvCHJvEgh6R2p0w7DJhEGIzkFaF3lPdBqw+Mm97fBPvznscd4s6gpH07gUl/T+vlyHyRBLm85Pgm70r4MQ+c/nGOQOXzFMNpO8RIot/uhd7t3bvSi6yFzZQm7P9QLCLm/0C84x0sCugjeN/hVA347FWnuRPcya5xPzlpTWAW7pCjheAz0mvnPUMYT6Wp4CJx6bPdePnaiLFSeK8EyQIU9IUQJgXqMA3cOwqMBdh/0r71fTInPdgXsVxabmGbCgIuK3A2hSgxpcZv9412T0NIJYSTi0s2B3dyAaZJrdF5wa1hIr8au63SWFJww3GEEOF5YObEyVvKj2yS40iaHaRrfn1DeALT0eD0oN1zzK66FKbFuDmZmm4Thel9gKt+QcnR2uHlFLEBUogpIXyeC8zca7SOppANloOpO4mBbf22dXBJogenVd425JWaXOHJ6NVqIBw="); public final static SkinData LOVE_DOCTOR = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODQ0MzM1MjQxMjAsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iY2RiZTM2OTM1NGZjMzUxY2RhNGRmY2Y2OWM0MzY3ODcwYjI4ZWE3NDUzYWVjM2IzMjgyM2YyMWMzNTJlNTUifX19", "KD0NsKFlS+9/JpPQdT0Lq2jo942WeHpFevJPR3T9JO/5NVmNprupsWuTgepw14iHoax8/xyP8S4XksYq8hJ30e+gRKXVReqtq4l8JetXJILI7JTL6EHj/Flg4t0O6ASIm3Hr+w86IKrPb0NwHTjHJHvbf0r7k3E/TMLbq0/c7Xgi+JgC0uQd+wIPZhQe92P3O7eGH858X0vsxG0FVzgnEAlHVLmqBCwqxMU5CsBp0JCTVIbtp+JNmveCsfLagP6mi39rUudbueXJQgqLv7H7Zw+ZNINLLaKPNVO6Od8sX3c+CSUQ+Bm9bakYr628k/z0krTdNpLG7OGXWoT3XShW6HXB/z7o7hpuDXJW7HdyvmWv9GVyWLm2USNe7/3Ugs2zWZI1f+t6t+V3EVr3T+nR4zpY/ISdlTsLtV/Daebr0v/V0YlaM0UaASzz16ob3p1cfao7C7BZwKqOBKoSyHpnuLhd70wOtNrhhPDU9dWQBC/l6uojcMJ9lQMsxFmHj4JFqJYl7p/UXnq1vnYBo1P3A//IGl4gL1Hv8U0I14LT77/AMYH57mItgD0/VnE4bvPIFML/4cX7L9qpdLoOAAyfa5P9cAfzhUnVnRRLM016MpGtvY8SfbZ68Of1Xjz/dZ9/fBEcObXPHGX2QNuJRFiWJjRVKjO7ok0qfiVUEmuZr6I="); public final static SkinData LEPRECHAUN = new SkinData("eyJ0aW1lc3RhbXAiOjE0ODc4NzI5Mjg1ODIsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS80ZTBkZjZhZGNiNzkzMzM5ZjFhOGNkM2E0ZGQ2ZThjNGQ2ZWFjYmU5NWMzZDA5OTI4NDMyMWFiZGI5MTgwOSJ9fX0=", "cyIYHTdzvVBOyYoiJZTvNS8Et5pzqBNxuz6GQspE2lBkW2Bj82JNv5oczsf3oxYAG4zxdb96G8+7UKBmoJdvx0x6UD7Dk0dnKrwpXfOhe+jRxtwMGMsdYCb8URWaoIoeKpxdCmAtjgV6FI8zDy2Yzi+MF4O9e4VqH0tMBoD2/CZScQwNEzc4YXf2M2fglKn9uK2+xrgLV+XS+SNdIn7BRiNlQf96u6N2G0lO+eb09LbIfIgAgfnyLiARccWa+VNo6gwlCFyRMnwOlgqxL5XA5Um4kkx2ZReRRCDFQ4NV5eLBktLd5wpECyOuY7v7S3zLqwbhwG47gS8hnXqmtHG5RW0RUQZEryg638Cw7hwr2k09iStfok8WeZUIJ+fuUWgdArvbtN36a2pCXyFdqzp+E8xzSF4E9SQv0K+1lNj+w4L58dh8pddeKK8m5bpjINj4xZ6nf7reWYQAX/imVNYTXTW8JqYnF+++xViBwmfeeM3PmEg+wyTduh+M25nyhGcqn5l+UyQ9aMzzdNs2aEdx12fOm1sOFXjHrHWeo6ciEm7sY1SDjiJ99VVXuGHCJWBtxq/B+c+vC/Cj8itEYOetwe5NKrgI99pZjG+KiRr4L0n8/NA3Px7SbKUUpHse80pNMjGfFW4pAOyFXJaKHrObWT2iL2AnTe+yfdY4sf/JZT4="); + public final static SkinData BUGS_BUNNY = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTA0NzE5MDU2MTgsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84MmUyMjRkMGJkZGJmNjRiODIzMmUxNWRhNGRkN2NjN2NiYTYzM2NiODkyMTFhYjVjNDRhODU0ZjM1NDhlZWRiIn19fQ==", "QtM7YGNpqGcTnlUCTtQsQIEc8VGvL8cxWzAvN4LjYZrY4Fv15ysEVSPWPmRL/FJTRyUFCrJFO/0miVbuIEsGyUnsgHJAr9qkeyMvfD3+pZtKU1FkS58VNQkL/YaPDms7XPy1BPNo+ynQnVevdVCNDOvs2244Px3UljtuReBteKqL8QGMR1K6FFCQuKKvcvYsljdM8RV91r2yuT9UDxnzMRghWyRZuthvCeGL85g1LQxCnzJ0NUqIqCDrTWa8jeuncLnmRooKZYGsQjCAVOSFRk4KytD+fv8xgNK2igqBgVcqAINl5IjrFt7yyPQ2FVBbshETsjewusa6eZSBoy1Lc17G7bcndoOdwGMuztLjHPMzxFpIV1RkbZrngjcSTE/IQdSw79NlzMOEMKjE/34M7xcSnSZA1xwW33g+/xq+pNbqcXu85e7VXkziWDhHREp9ITT4YjrVdrss1yfYBzZgRmmLyaMpVmVsecKB9adpuZkhGzKIVrQHDGYEHoqoRnsRGJREdZQPxaSWp4+DSxpV/0oJXJWDz+XFztbcVbBcjBOD9kpFP0s+R5t1WA2B+jsf9J3LdsUUDbBiWikBwbAXKhHxTWWKv6OZLZovhgvGnW2lXQsHglEKuD7jE/mnFj4SF2qRO2N37AUjaG8AGQtTVhxW5JneIiBA0dbKIk06yoY="); + public final static SkinData SLENDERMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0OTA0NzUyNzk4NTUsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9hMWNkOTI5OTFmYTRjZGQ2MGVlZDNhZTM3ZmI5NWRmZjFkNWNkOGNiZmYwYWFjMzE4MmQ0ODU2NDU5NTIzYyJ9fX0=", "OVqWFLCekyZcdGli6kPBKNh8/VYPhKZGNqlAvSOKc3RLgh4pIkI6TDPr/Y+VQdhz1wZozARFYSeoDJJJ4nZTi7gi3rVPG2rL1ZnKo7so5hdT8caEzSTRmgwPKzo03ZhEEsW9AEJo9mpiUxGSJdBlgEb9UgodpYFW1IjRC09CcBUqzRWP8QGZTSFSN5x9emQ97DyiFmt0NFWubHCKHdb7CExhchPRtbahL3hOEzPY8/Y+Irl9OZjx7jONE7O/sYItCuZoXc3FaTgCV0riiXHCgH2eA54s5TQVWumtp3FU7VIcKR6pm/o61+GusvqhNgdFNk9XSHWMUyp+HNU0R8sConZQN/eaVx9laJmUUb4zNZ7hX/hLYV+r9LFU1NXOeIZWJPShD+bYfZgEorIpD+EAL4BHht/f5e6a1IZUDBWb001PFibby2t9WWjoDVKz4McbxZ2Xui7EHKFG1K3biPibhWx6fvnOeJ2xW6UDIZcD+TCXwlW/knkFt44Xpyv3oNHk3UNkyrQgghd6qkc3gZHxP8PQCNvKIyK1I+pHR6JMZvSStp7ZQRDpvsvIUyOJvq+7Bs7lFYs8hcJHMzEB+8PYlH2k7P7iLuA6ZYFUmvOW1LLq0+hvxK96ZdNEsJdmMkVVTZBRw7vsZ4GPbkdp2cMOFH2lHcQj80xKqVbd43IqFDA="); // Comments this out for now, so it doesn't load the player profile // A better way to do this would check for the properties when getting the skull or the skin diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java index 813147704..c10562f6d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/cupidslove/ArrowTrailCupid.java @@ -27,7 +27,6 @@ public class ArrowTrailCupid extends ArrowEffectGadget @Override public void doTrail(Arrow arrow) { - arrow.setCritical(false); Vector color = arrow.getTicksLived()%2 == 0? UtilColor.colorToVector(Color.RED) : UtilColor.colorToVector(Color.fromRGB(16738740)); UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, arrow.getLocation(), color, 1, 0, ViewDist.LONG); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java index 31b7bbf94..ca75793ba 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java @@ -31,7 +31,6 @@ public class DeathSpring extends DeathEffectGadget public DeathSpring(GadgetManager manager) { - // TODO NAME, LORE AND ICON super(manager, "Funeral Bouquet", UtilText.splitLineToArray(C.cGray + "Leave a rose to pay respects", LineFormat.LORE), -19, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java index ed09b4a54..762fff510 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -4,44 +4,81 @@ import java.util.HashMap; import java.util.Map; import org.bukkit.Material; -import org.bukkit.entity.Entity; +import org.bukkit.entity.Bat; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Slime; import org.bukkit.event.EventHandler; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.spigotmc.event.entity.EntityDismountEvent; +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.UtilEnt; import mineplex.core.common.util.UtilText; -import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.utils.UtilGameProfile; public class MorphAwkwardRabbit extends MorphGadget { - private Map _skeletons = new HashMap<>(); + private Map _skeletons = new HashMap<>(); + private Map _slimes = new HashMap<>(); + private Map _bats = new HashMap<>(); public MorphAwkwardRabbit(GadgetManager manager) { - super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits"}, LineFormat.LORE), - -19, Material.GLASS, (byte) 0); + super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits."}, LineFormat.LORE), + -19, Material.SKULL_ITEM, (byte) 0); } @Override public void enableCustom(Player player, boolean message) { applyArmor(player, message); - Skeleton dinnerbone = player.getWorld().spawn(player.getLocation(), Skeleton.class); - dinnerbone.setCustomName("Dinnerbone"); - dinnerbone.setCustomNameVisible(false); - _skeletons.put(player, dinnerbone); + Manager.getPetManager().getCreatureModule().SetForce(true); - DisguiseSkeleton disguiseSkeleton = new DisguiseSkeleton(player); - UtilMorph.disguise(player, disguiseSkeleton, Manager); + Slime slime = player.getWorld().spawn(player.getLocation(), Slime.class); + UtilEnt.silence(slime, true); + slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); + slime.setSize(-1); + + Skeleton skeleton = player.getWorld().spawn(player.getLocation(), Skeleton.class); + UtilEnt.silence(skeleton, true); + skeleton.setCustomName("Dinnerbone"); + skeleton.setCustomNameVisible(false); + skeleton.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 1, false, false)); + skeleton.getEquipment().setHelmet(SkinData.SLENDERMAN.getSkull()); + + Bat bat = player.getWorld().spawn(player.getLocation(), Bat.class); + UtilEnt.silence(bat, true); + bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); + + Manager.getPetManager().getCreatureModule().SetForce(false); + + GameProfile gameProfile = UtilGameProfile.getGameProfile(player); + gameProfile.getProperties().clear(); + gameProfile.getProperties().put("textures", SkinData.BUGS_BUNNY.getProperty()); + + DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile); + disguisePlayer.showInTabList(true, 0); + UtilMorph.disguise(player, disguisePlayer, Manager); + + _skeletons.put(player, skeleton); + _slimes.put(player, slime); + _bats.put(player, bat); + + skeleton.setPassenger(bat); + slime.setPassenger(skeleton); + disguisePlayer.getEntity().getBukkitEntity().setPassenger(slime); } @Override @@ -49,19 +86,34 @@ public class MorphAwkwardRabbit extends MorphGadget { removeArmor(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); + _skeletons.get(player).remove(); + _slimes.get(player).remove(); + _bats.get(player).remove(); } @EventHandler - public void teleportSkeletons(UpdateEvent event) + public void dismount(EntityDismountEvent event) { - if (event.getType() != UpdateType.TICK) - return; - - for (Map.Entry entry : _skeletons.entrySet()) + if (event.getDismounted() instanceof Skeleton) { - Player player = entry.getKey(); - Entity entity = entry.getValue(); - entity.teleport(player.getLocation().clone().add(0, 0.3, 0)); + if (_skeletons.containsValue(event.getDismounted())) + { + event.setCancelled(true); + } + } + if (event.getDismounted() instanceof Slime) + { + if (_slimes.containsValue(event.getDismounted())) + { + event.setCancelled(true); + } + } + if (event.getDismounted() instanceof Bat) + { + if (_bats.containsValue(event.getDismounted())) + { + event.setCancelled(true); + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java index 4a5ad6f60..feb632597 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/BalloonGadget.java @@ -10,6 +10,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerTeleportEvent; import mineplex.core.common.util.F; @@ -114,6 +115,19 @@ public abstract class BalloonGadget extends Gadget { Map.Entry> entry = iterator.next(); for (BalloonData balloonData : entry.getValue().values()) + { + balloonData.teleport(); + } + } + } + + @EventHandler + public void onPlayerMove(PlayerMoveEvent event) + { + if (PLAYER_BALLOONS.containsKey(event.getPlayer().getUniqueId())) + { + Map balloons = PLAYER_BALLOONS.get(event.getPlayer().getUniqueId()); + for (BalloonData balloonData : balloons.values()) { balloonData.update(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java index fe81e2d15..8ac58de85 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/util/BalloonData.java @@ -50,6 +50,12 @@ public class BalloonData ((LivingEntity) _balloon).setLeashHolder(_player); } + public void teleport() + { + _balloon.teleport(_balloonLoc); + _balloon.setVelocity(new Vector(0, 3, 0)); + } + public void update() { if (_leash == null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 1f68bed86..3e1cbaf4f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -309,7 +309,7 @@ public class PetManager extends MiniClientPlugin _disguiseManager.disguise(disguise); } - else if (pet instanceof Rabbit) + else if (petType.equals(PetType.RABBIT)) { UtilEnt.silence(pet, true); DisguiseChicken disguise = new DisguiseChicken(pet); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java index ee15e57ac..d92a14687 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -34,7 +34,7 @@ public enum PetType CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), 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)), LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()), - KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "Placeholder") + KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Eater Bunny's less talked about brother Devin was a bit less fun to hang out with.") // 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/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index f2629eb1f..54585d493 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.animation; +import java.util.ArrayList; import java.util.List; import org.bukkit.Material; @@ -7,8 +8,10 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Skull; +import mineplex.core.common.MaterialData; import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; @@ -99,6 +102,10 @@ public class BlockChangeAnimation extends Animation mat = Material.WOOL; data = 13; } + else if (getTreasure().getTreasureType() == TreasureType.SPRING) + { + mat = Material.GRASS; + } else continue; @@ -151,6 +158,11 @@ public class BlockChangeAnimation extends Animation mat = Material.GOLD_BLOCK; data = 0; } + else if (getTreasure().getTreasureType() == TreasureType.SPRING) + { + mat = Material.DIRT; + data = 2; + } else continue; @@ -245,6 +257,40 @@ public class BlockChangeAnimation extends Animation } } } + else if (getTreasure().getTreasureType() == TreasureType.SPRING) + { + List materials = new ArrayList<>(); + materials.add(MaterialData.of(Material.LONG_GRASS, (byte) 1)); + materials.add(MaterialData.of(Material.LONG_GRASS, (byte) 2)); + materials.add(MaterialData.of(Material.DEAD_BUSH, (byte) 0)); + materials.add(MaterialData.of(Material.YELLOW_FLOWER, (byte) 0)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 0)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 1)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 2)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 3)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 4)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 5)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 6)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 7)); + materials.add(MaterialData.of(Material.RED_ROSE, (byte) 8)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 0)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 1)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 2)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 3)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 4)); + materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 5)); + for (Block c : _chests) + { + if (c.equals(b)) + { + int r = UtilMath.random.nextInt(materials.size()); + MaterialData materialData = materials.get(r); + _blockInfoList.add(new BlockInfo(b)); + b.setType(materialData.getMaterial()); + b.setData(materialData.getData()); + } + } + } } } From 3837d9fbda4fe9a884ba885069bd6f14b37c5676 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 25 Mar 2017 18:38:43 -0300 Subject: [PATCH 24/51] This should have been added in the last commit... --- .../gadget/gadgets/particle/spring/ParticleSpringHalo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java index 4b24315ca..ecc285418 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -39,8 +39,8 @@ public class ParticleSpringHalo extends ParticleGadget public ParticleSpringHalo(GadgetManager manager) { - // TODO CHANGE LORE BEFORE RELEASE - super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE), -14, Material.GLASS, (byte) 0, YearMonth.of(2017, Month.APRIL)); + super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Spring is everywhere, if you look hard enough."}, LineFormat.LORE), + -14, Material.YELLOW_FLOWER, (byte) 0, YearMonth.of(2017, Month.APRIL)); } @Override From 32bb2515f7325a15a3094fa4191332166e224187 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sun, 26 Mar 2017 01:26:43 -0300 Subject: [PATCH 25/51] Changed height of skeleton --- .../mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java index 762fff510..c636beaad 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -49,7 +49,7 @@ public class MorphAwkwardRabbit extends MorphGadget Slime slime = player.getWorld().spawn(player.getLocation(), Slime.class); UtilEnt.silence(slime, true); slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); - slime.setSize(-1); + slime.setSize(-2); Skeleton skeleton = player.getWorld().spawn(player.getLocation(), Skeleton.class); UtilEnt.silence(skeleton, true); From 3c241c48bc7769c3c3600c11cdf2546a6ec6f4e8 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 27 Mar 2017 17:26:18 -0300 Subject: [PATCH 26/51] Changed rabbit morph to spawn holograms --- .../gadgets/morph/MorphAwkwardRabbit.java | 76 +++---------------- 1 file changed, 9 insertions(+), 67 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java index c636beaad..217d2513e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -1,24 +1,15 @@ package mineplex.core.gadget.gadgets.morph; -import java.util.HashMap; -import java.util.Map; - import org.bukkit.Material; -import org.bukkit.entity.Bat; import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton; -import org.bukkit.entity.Slime; import org.bukkit.event.EventHandler; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.spigotmc.event.entity.EntityDismountEvent; +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.UtilEnt; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; @@ -29,10 +20,6 @@ import mineplex.core.utils.UtilGameProfile; public class MorphAwkwardRabbit extends MorphGadget { - private Map _skeletons = new HashMap<>(); - private Map _slimes = new HashMap<>(); - private Map _bats = new HashMap<>(); - public MorphAwkwardRabbit(GadgetManager manager) { super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits."}, LineFormat.LORE), @@ -44,26 +31,6 @@ public class MorphAwkwardRabbit extends MorphGadget { applyArmor(player, message); - Manager.getPetManager().getCreatureModule().SetForce(true); - - Slime slime = player.getWorld().spawn(player.getLocation(), Slime.class); - UtilEnt.silence(slime, true); - slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); - slime.setSize(-2); - - Skeleton skeleton = player.getWorld().spawn(player.getLocation(), Skeleton.class); - UtilEnt.silence(skeleton, true); - skeleton.setCustomName("Dinnerbone"); - skeleton.setCustomNameVisible(false); - skeleton.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 1, false, false)); - skeleton.getEquipment().setHelmet(SkinData.SLENDERMAN.getSkull()); - - Bat bat = player.getWorld().spawn(player.getLocation(), Bat.class); - UtilEnt.silence(bat, true); - bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false)); - - Manager.getPetManager().getCreatureModule().SetForce(false); - GameProfile gameProfile = UtilGameProfile.getGameProfile(player); gameProfile.getProperties().clear(); gameProfile.getProperties().put("textures", SkinData.BUGS_BUNNY.getProperty()); @@ -71,14 +38,6 @@ public class MorphAwkwardRabbit extends MorphGadget DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile); disguisePlayer.showInTabList(true, 0); UtilMorph.disguise(player, disguisePlayer, Manager); - - _skeletons.put(player, skeleton); - _slimes.put(player, slime); - _bats.put(player, bat); - - skeleton.setPassenger(bat); - slime.setPassenger(skeleton); - disguisePlayer.getEntity().getBukkitEntity().setPassenger(slime); } @Override @@ -86,35 +45,18 @@ public class MorphAwkwardRabbit extends MorphGadget { removeArmor(player); UtilMorph.undisguise(player, Manager.getDisguiseManager()); - _skeletons.get(player).remove(); - _slimes.get(player).remove(); - _bats.get(player).remove(); } @EventHandler - public void dismount(EntityDismountEvent event) + public void spawnHolograms(PlayerToggleSneakEvent event) { - if (event.getDismounted() instanceof Skeleton) - { - if (_skeletons.containsValue(event.getDismounted())) - { - event.setCancelled(true); - } - } - if (event.getDismounted() instanceof Slime) - { - if (_slimes.containsValue(event.getDismounted())) - { - event.setCancelled(true); - } - } - if (event.getDismounted() instanceof Bat) - { - if (_bats.containsValue(event.getDismounted())) - { - event.setCancelled(true); - } - } + if (!isActive(event.getPlayer())) + return; + + if (event.isSneaking()) + return; + + } } From 8da2431415b8047478cbc36e1a85bc6c144d2970 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 27 Mar 2017 22:39:50 -0300 Subject: [PATCH 27/51] Added bugs bunny quotes --- .../gadgets/morph/MorphAwkwardRabbit.java | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java index 217d2513e..65a5e3b02 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -1,5 +1,10 @@ package mineplex.core.gadget.gadgets.morph; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -10,20 +15,32 @@ 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.UtilMath; import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.hologram.Hologram; import mineplex.core.utils.UtilGameProfile; public class MorphAwkwardRabbit extends MorphGadget { + private List _quotes = new ArrayList<>(); + public MorphAwkwardRabbit(GadgetManager manager) { super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits."}, LineFormat.LORE), -19, Material.SKULL_ITEM, (byte) 0); + _quotes.addAll(Arrays.asList( + "Eh, what's up, doc?", + "That's all, folks.", + "Gee, ain't I a stinker?", + "Carrots are devine...", + "I know this defies the\n law of gravity,\n but I never studied law!", + "I don’t ask questions,\n I just have fun", + "Hey, just a minute you!\n Them’s fightin’ words!")); } @Override @@ -56,7 +73,24 @@ public class MorphAwkwardRabbit extends MorphGadget if (event.isSneaking()) return; - + Location randomLoc = event.getPlayer().getLocation().clone(); + int[] rPos = new int[]{-2, -1, 0, 1, 2}; + int rX = rPos[UtilMath.random.nextInt(rPos.length)], rZ = rPos[UtilMath.random.nextInt(rPos.length)]; + + randomLoc.add(rX, 1, rZ); + + String quote = _quotes.get(UtilMath.random.nextInt(_quotes.size())); + Hologram hologram; + if (quote.contains("*nl*")) + { + String[] lines = quote.split("\n"); + hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, 2000, lines); + } + else + { + hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, 2000, quote); + } + hologram.start(); } } From ae2768d35486a2aa6c75de58e209d7ba71896141 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 27 Mar 2017 23:58:01 -0300 Subject: [PATCH 28/51] Changed name, lore, icon and cooldown --- .../gadgets/morph/MorphAwkwardRabbit.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java index 65a5e3b02..dc2b7446b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphAwkwardRabbit.java @@ -22,6 +22,7 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.hologram.Hologram; +import mineplex.core.recharge.Recharge; import mineplex.core.utils.UtilGameProfile; public class MorphAwkwardRabbit extends MorphGadget @@ -29,9 +30,13 @@ public class MorphAwkwardRabbit extends MorphGadget private List _quotes = new ArrayList<>(); + private static final long COOLDOWN = 10000; + private static final long HOLOGRAM_TIME = 3000; + public MorphAwkwardRabbit(GadgetManager manager) { - super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits."}, LineFormat.LORE), + super(manager, "Wascally Wabbit Morph", + UtilText.splitLinesToArray(new String[]{C.cGray + "Be absolutely silent my friends we are searching for rabbits currently!"}, LineFormat.LORE), -19, Material.SKULL_ITEM, (byte) 0); _quotes.addAll(Arrays.asList( "Eh, what's up, doc?", @@ -41,6 +46,7 @@ public class MorphAwkwardRabbit extends MorphGadget "I know this defies the\n law of gravity,\n but I never studied law!", "I don’t ask questions,\n I just have fun", "Hey, just a minute you!\n Them’s fightin’ words!")); + setDisplayItem(SkinData.BUGS_BUNNY.getSkull()); } @Override @@ -73,6 +79,9 @@ public class MorphAwkwardRabbit extends MorphGadget if (event.isSneaking()) return; + if (!Recharge.Instance.use(event.getPlayer(), getName(), COOLDOWN, true, false, "Cosmetics")) + return; + Location randomLoc = event.getPlayer().getLocation().clone(); int[] rPos = new int[]{-2, -1, 0, 1, 2}; int rX = rPos[UtilMath.random.nextInt(rPos.length)], rZ = rPos[UtilMath.random.nextInt(rPos.length)]; @@ -81,14 +90,14 @@ public class MorphAwkwardRabbit extends MorphGadget String quote = _quotes.get(UtilMath.random.nextInt(_quotes.size())); Hologram hologram; - if (quote.contains("*nl*")) + if (quote.contains("\n")) { String[] lines = quote.split("\n"); - hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, 2000, lines); + hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, HOLOGRAM_TIME, lines); } else { - hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, 2000, quote); + hologram = new Hologram(Manager.getHologramManager(), randomLoc, true, HOLOGRAM_TIME, quote); } hologram.start(); } From 88db9c2913401af9d6bb33698c97c2b8cfe9aae4 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 28 Mar 2017 17:26:50 -0300 Subject: [PATCH 29/51] Added Bugs Bunny to spring chest --- .../Mineplex.Core/src/mineplex/core/reward/RewardManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 2aa0f309e..fb9891e27 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -70,6 +70,7 @@ import mineplex.core.gadget.gadgets.item.ItemPaintballGun; import mineplex.core.gadget.gadgets.item.ItemPartyPopper; import mineplex.core.gadget.gadgets.item.ItemSnowball; import mineplex.core.gadget.gadgets.item.ItemTNT; +import mineplex.core.gadget.gadgets.morph.MorphAwkwardRabbit; import mineplex.core.gadget.gadgets.morph.MorphBat; import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphBunny; @@ -868,6 +869,7 @@ public class RewardManager // SPRING addGadget(Type.SPRING, getGadget(ParticleSpringHalo.class), rarity, 100); + addGadget(Type.SPRING, getGadget(MorphAwkwardRabbit.class), rarity, 25); addPetReward(Type.SPRING, PetType.KILLER_BUNNY, rarity, 50); } From 3bc4125b76f100e7c70767265e046944c11261e2 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 15:47:02 -0300 Subject: [PATCH 30/51] Removed custom pet from this update --- .../src/mineplex/core/cosmetic/ui/page/PetPage.java | 7 +++---- 1 file changed, 3 insertions(+), 4 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 fae5fe884..3501af878 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 @@ -36,7 +36,6 @@ import mineplex.core.cosmetic.ui.button.PetButton; import mineplex.core.cosmetic.ui.button.RenamePetButton; import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton; -import mineplex.core.cosmetic.ui.page.custompet.CustomPetBasePage; import mineplex.core.donation.DonationManager; import mineplex.core.pet.PetExtra; import mineplex.core.pet.PetType; @@ -231,7 +230,7 @@ public class PetPage extends ShopPageBase slot += 2; } - slot = 48; + slot = 49; for (PetExtra petExtra : PetExtra.values()) { List itemLore = new ArrayList(); @@ -255,8 +254,8 @@ public class PetPage extends ShopPageBase } // Custom pet - addButton(50, new ShopItem(Material.GLASS, C.cGreen + "Custom", new String[]{}, 1, false), (player, clickType) -> - getShop().openPageForPlayer(getPlayer(), new CustomPetBasePage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player))); + /*addButton(50, new ShopItem(Material.GLASS, C.cGreen + "Custom", new String[]{}, 1, false), (player, clickType) -> + getShop().openPageForPlayer(getPlayer(), new CustomPetBasePage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Custom Pet", player)));*/ addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> From a7be020c9db281d538c72d5e9a99e8caf7e70e74 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 17:23:43 -0300 Subject: [PATCH 31/51] Locked rabbit as adult --- Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 3e1cbaf4f..47c79138d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -416,6 +416,7 @@ public class PetManager extends MiniClientPlugin else if (petType.equals(PetType.KILLER_BUNNY)) { Rabbit rabbit = (Rabbit) pet; + rabbit.setAdult(); rabbit.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY); } From 83d141eddc4a357c96867fe3b938501fe51c72ba Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 17:25:16 -0300 Subject: [PATCH 32/51] Changed price of Spring Halo particle --- .../gadget/gadgets/particle/spring/ParticleSpringHalo.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java index ecc285418..713df4199 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -1,7 +1,5 @@ package mineplex.core.gadget.gadgets.particle.spring; -import java.time.Month; -import java.time.YearMonth; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -40,7 +38,7 @@ public class ParticleSpringHalo extends ParticleGadget public ParticleSpringHalo(GadgetManager manager) { super(manager, "Spring Halo", UtilText.splitLinesToArray(new String[]{C.cGray + "Spring is everywhere, if you look hard enough."}, LineFormat.LORE), - -14, Material.YELLOW_FLOWER, (byte) 0, YearMonth.of(2017, Month.APRIL)); + -19, Material.YELLOW_FLOWER, (byte) 0); } @Override From 957004f97a47d9463787b6194dad824fb830a8d7 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 17:28:11 -0300 Subject: [PATCH 33/51] Added 'Found in X' lore --- .../src/mineplex/core/cosmetic/ui/page/GadgetPage.java | 5 +++++ .../src/mineplex/core/cosmetic/ui/page/PetPage.java | 5 +++++ 2 files changed, 10 insertions(+) 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 713429dc6..3d8aedbb7 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 @@ -180,6 +180,11 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in St Patrick's Chests"); } + else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -19) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Spring Chests"); + } //Rank Unlocks else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10) 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 3501af878..e7bf684cb 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 @@ -116,6 +116,11 @@ public class PetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in St Patrick's Chests"); } + else if (pet.getPrice() == -19) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Spring Chests"); + } else if (pet.getPrice() == -14) { itemLore.add(C.cBlack); From 424e0fe0a44f145156dc7dd2703da81dc7a49386 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 17:29:45 -0300 Subject: [PATCH 34/51] Fixed spring chests being purchasable even if locked or if player had all the items --- .../mineplex/core/treasure/gui/BuyChestButton.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 087374d5d..cdcdb4055 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -83,6 +83,19 @@ public class BuyChestButton implements IButton return; } } + if (_chestType == TreasureType.SPRING) + { + if (!new File("../../update/files/EnableSpringChest.dat").exists()) + { + player.sendMessage(F.main("Treasure", "That chest is no longer available for purchase!")); + return; + } + if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) + { + player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); + return; + } + } if (_chestType == TreasureType.FREEDOM || _chestType == TreasureType.HAUNTED) { if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player)) From 2c09bb584aa66573a1dc21ae374b4aeb54ba0687 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 17:33:02 -0300 Subject: [PATCH 35/51] Fixed Spring Set lore --- .../Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java index ea2f26dbe..77727b480 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/set/SetSpring.java @@ -13,7 +13,7 @@ public class SetSpring extends GadgetSet public SetSpring(GadgetManager manager) { // TODO LORE - super(manager, "Spring", "Double Holiday Points while active", + super(manager, "Spring", "2x Holiday Points while active (Titles)", manager.getGadget(ArrowTrailSpring.class), manager.getGadget(DeathSpring.class), manager.getGadget(DoubleJumpSpring.class), From cb5b0a3c83513454364673950c221c82c16ddf61 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 18:00:47 -0300 Subject: [PATCH 36/51] Changed the icon of the death effect --- .../mineplex/core/gadget/gadgets/death/spring/DeathSpring.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java index ca75793ba..eb15f5986 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/death/spring/DeathSpring.java @@ -34,7 +34,7 @@ public class DeathSpring extends DeathEffectGadget super(manager, "Funeral Bouquet", UtilText.splitLineToArray(C.cGray + "Leave a rose to pay respects", LineFormat.LORE), -19, - Material.RED_ROSE, (byte) 0); + Material.YELLOW_FLOWER, (byte) 0); } @Override From 27d7226712a094f90b576e5815419fd2184440ab Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 4 Apr 2017 22:58:43 -0300 Subject: [PATCH 37/51] Fixed flowers dropping after chest is opened --- .../animation/BlockChangeAnimation.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index 54585d493..8dc08b025 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -3,10 +3,15 @@ package mineplex.core.treasure.animation; import java.util.ArrayList; import java.util.List; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Skull; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockPhysicsEvent; import mineplex.core.common.MaterialData; import mineplex.core.common.skin.SkinData; @@ -16,7 +21,7 @@ import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; -public class BlockChangeAnimation extends Animation +public class BlockChangeAnimation extends Animation implements Listener { private static final int MAX_RADIUS = 4; @@ -31,6 +36,7 @@ public class BlockChangeAnimation extends Animation _currentRadius = 0; _blockInfoList = blockInfoList; _chests = chests; + Bukkit.getPluginManager().registerEvents(this, treasure.getTreasureManager().getPlugin()); } @Override @@ -302,7 +308,7 @@ public class BlockChangeAnimation extends Animation @Override protected void onFinish() { - + HandlerList.unregisterAll(this); } private byte getDirection(Block block) @@ -344,4 +350,18 @@ public class BlockChangeAnimation extends Animation return BlockFace.SOUTH; } } + + @EventHandler + public void onFlowerDrop(BlockPhysicsEvent event) + { + for (Block block : _chests) + { + if (event.getBlock().equals(block)) + { + event.setCancelled(true); + event.getBlock().setType(Material.AIR); + return; + } + } + } } From 888c26c12df75ddbce1f3cc568e25ae0f59ba109 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 5 Apr 2017 18:51:21 -0300 Subject: [PATCH 38/51] Changed icon of bunny pet --- 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 d92a14687..3f54bc966 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -34,7 +34,7 @@ public enum PetType CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), 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)), LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()), - KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Eater Bunny's less talked about brother Devin was a bit less fun to hang out with.") + KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Eater Bunny's less talked about brother Devin was a bit less fun to hang out with.", Material.RABBIT_FOOT, (byte) 0) // 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 45e3223962c907ebbacbd14967896a3060745268 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 14:02:30 -0300 Subject: [PATCH 39/51] Added effects to chets opening and changed flowers to leaves so they don't drop any items when removed --- .../src/mineplex/core/treasure/Treasure.java | 9 ++ .../animation/BlockChangeAnimation.java | 50 ++--------- .../animation/ChestSpawnAnimation.java | 89 +++++++++++++++++-- .../animation/TreasureRemoveAnimation.java | 40 +++++++++ 4 files changed, 139 insertions(+), 49 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index f1e489390..cb408fd84 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -224,6 +224,15 @@ public class Treasure block.getLocation().add(.5 + rX, .7, .5 + rZ)); coloredParticle.display(); } + else if (_treasureType == TreasureType.SPRING) + { + int r = (int) (Math.random() * 2); + double rX = Math.random() * 2 - 1, rZ = Math.random() * 2 - 1; + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.RED : Color.YELLOW), + block.getLocation().add(.5 + rX, .7, .5 + rZ)); + coloredParticle.display(); + } else { UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index 8dc08b025..066f34b48 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -3,15 +3,10 @@ package mineplex.core.treasure.animation; import java.util.ArrayList; import java.util.List; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Skull; -import org.bukkit.event.EventHandler; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockPhysicsEvent; import mineplex.core.common.MaterialData; import mineplex.core.common.skin.SkinData; @@ -21,7 +16,7 @@ import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; -public class BlockChangeAnimation extends Animation implements Listener +public class BlockChangeAnimation extends Animation { private static final int MAX_RADIUS = 4; @@ -36,7 +31,6 @@ public class BlockChangeAnimation extends Animation implements Listener _currentRadius = 0; _blockInfoList = blockInfoList; _chests = chests; - Bukkit.getPluginManager().registerEvents(this, treasure.getTreasureManager().getPlugin()); } @Override @@ -266,32 +260,19 @@ public class BlockChangeAnimation extends Animation implements Listener else if (getTreasure().getTreasureType() == TreasureType.SPRING) { List materials = new ArrayList<>(); - materials.add(MaterialData.of(Material.LONG_GRASS, (byte) 1)); - materials.add(MaterialData.of(Material.LONG_GRASS, (byte) 2)); - materials.add(MaterialData.of(Material.DEAD_BUSH, (byte) 0)); - materials.add(MaterialData.of(Material.YELLOW_FLOWER, (byte) 0)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 0)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 1)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 2)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 3)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 4)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 5)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 6)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 7)); - materials.add(MaterialData.of(Material.RED_ROSE, (byte) 8)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 0)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 1)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 2)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 3)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 4)); - materials.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 5)); + materials.add(MaterialData.of(Material.LEAVES, (byte) 0)); + materials.add(MaterialData.of(Material.LEAVES, (byte) 1)); + materials.add(MaterialData.of(Material.LEAVES, (byte) 2)); + materials.add(MaterialData.of(Material.LEAVES, (byte) 3)); + materials.add(MaterialData.of(Material.LEAVES_2, (byte) 0)); + materials.add(MaterialData.of(Material.LEAVES_2, (byte) 1)); for (Block c : _chests) { if (c.equals(b)) { + _blockInfoList.add(new BlockInfo(b)); int r = UtilMath.random.nextInt(materials.size()); MaterialData materialData = materials.get(r); - _blockInfoList.add(new BlockInfo(b)); b.setType(materialData.getMaterial()); b.setData(materialData.getData()); } @@ -308,7 +289,6 @@ public class BlockChangeAnimation extends Animation implements Listener @Override protected void onFinish() { - HandlerList.unregisterAll(this); } private byte getDirection(Block block) @@ -350,18 +330,4 @@ public class BlockChangeAnimation extends Animation implements Listener return BlockFace.SOUTH; } } - - @EventHandler - public void onFlowerDrop(BlockPhysicsEvent event) - { - for (Block block : _chests) - { - if (event.getBlock().equals(block)) - { - event.setCancelled(true); - event.getBlock().setType(Material.AIR); - return; - } - } - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index 80eab149e..5a4378a48 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -1,22 +1,32 @@ package mineplex.core.treasure.animation; import java.awt.Color; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.MathHelper; +import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; +import org.bukkit.entity.Item; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; import com.google.common.collect.Lists; import mineplex.core.Managers; +import mineplex.core.common.MaterialData; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; @@ -30,13 +40,14 @@ import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseBat; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.particleeffects.BabyFireworkEffect; import mineplex.core.particleeffects.CircleEffect; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; -public class ChestSpawnAnimation extends Animation +public class ChestSpawnAnimation extends Animation implements Listener { private static final int ANIMATION_DURATION = 80; @@ -47,6 +58,8 @@ public class ChestSpawnAnimation extends Animation private Location _particleLocation; private Vector _particleDirection; + private Location _openingCenter; + private List _chestBlockInfo; private double _radialOffset; @@ -58,6 +71,8 @@ public class ChestSpawnAnimation extends Animation private int _currentHauntedColor = 0; private List _bats = Lists.newArrayList(); + private List _flowers = new ArrayList<>(); + private List _droppedFlowers = new ArrayList<>(); public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) { @@ -83,8 +98,10 @@ public class ChestSpawnAnimation extends Animation _centerLocation = block.getLocation().clone().add(0.5, 0.5, 0.5); _chestBlockInfo = chestBlockInfo; - _particleLocation = openingCenter.getLocation().add(0.5, 4, 0.5); - + _particleLocation = openingCenter.getLocation().clone().add(0.5, 4, 0.5); + + _openingCenter = openingCenter.getLocation(); + _particleDirection = UtilAlg.getTrajectory(_particleLocation, _centerLocation); _particleDirection.multiply(UtilMath.offset(_particleLocation, _centerLocation) / (double)ANIMATION_DURATION); @@ -103,6 +120,8 @@ public class ChestSpawnAnimation extends Animation _radialOffset = radialOffset; _javaPlugin = javaPlugin; + + Bukkit.getPluginManager().registerEvents(this, javaPlugin); } @Override @@ -112,7 +131,18 @@ public class ChestSpawnAnimation extends Animation //Move Particle Forwards _particleLocation.add(_particleDirection); - + + Iterator droppedFlowersIterator = _droppedFlowers.iterator(); + while (droppedFlowersIterator.hasNext()) + { + Item flower = droppedFlowersIterator.next(); + if (flower.getTicksLived() >= 20) + { + flower.remove(); + droppedFlowersIterator.remove(); + } + } + //Play Particles if (getTreasure().getTreasureType() == TreasureType.OLD || getTreasure().getTreasureType() == TreasureType.LOVE_CHEST) { @@ -246,10 +276,20 @@ public class ChestSpawnAnimation extends Animation doBats(true, _centerLocation.clone().add(0, 6, 0), _bats); } } - else if (getTreasure().getTreasureType() == TreasureType.ST_PATRICKS) + else if (getTreasure().getTreasureType() == TreasureType.SPRING) { - Location location = _centerLocation.clone().add(0, 5, 0); + if (getTicks() % 5 == 0) + { + if (_flowers.size() == 0) + generateFlowerList(); + int r = UtilMath.random.nextInt(_flowers.size()); + MaterialData materialData = _flowers.get(r); + Item flower = _openingCenter.getWorld().dropItem(_openingCenter.clone().add(0.5, 0, 0.5), ItemStackFactory.Instance.CreateStack(materialData.getMaterial(), materialData.getData(), 1, "Flower" + getTicks())); + Vector vel = new Vector(_openingCenter.getX() - _centerLocation.getX(), 0, _openingCenter.getZ() - _centerLocation.getZ()); + UtilAction.velocity(flower, vel, 0.1, false, 0, 0.2 + 1 * 0.4, 1, false); + _droppedFlowers.add(flower); + } } //Spawn Chest @@ -338,7 +378,12 @@ public class ChestSpawnAnimation extends Animation @Override protected void onFinish() { - + HandlerList.unregisterAll(this); + for (Item item : _droppedFlowers) + { + item.remove(); + } + _droppedFlowers.clear(); } private void doBats(boolean initial, Location center, List bats) @@ -372,4 +417,34 @@ public class ChestSpawnAnimation extends Animation } } } + + private void generateFlowerList() + { + _flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 1)); + _flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 2)); + _flowers.add(MaterialData.of(Material.DEAD_BUSH, (byte) 0)); + _flowers.add(MaterialData.of(Material.YELLOW_FLOWER, (byte) 0)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 0)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 1)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 2)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 3)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 4)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 5)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 6)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 7)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 8)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 0)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 1)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 2)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 3)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 4)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 5)); + } + + @EventHandler + public void onPickup(PlayerPickupItemEvent event) + { + if (_droppedFlowers.contains(event.getItem())) + event.setCancelled(true); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java index c0ada9705..21bbad471 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/TreasureRemoveAnimation.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.animation; +import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -9,7 +10,9 @@ import org.bukkit.entity.Item; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; +import mineplex.core.common.MaterialData; import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilMath; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.treasure.BlockInfo; import mineplex.core.treasure.Treasure; @@ -20,6 +23,7 @@ public class TreasureRemoveAnimation extends Animation private Random _random = new Random(); private List _otherChests; private int _count = 0; + private List _flowers = new ArrayList<>(); public TreasureRemoveAnimation(Treasure treasure, List otherChests) { @@ -42,6 +46,19 @@ public class TreasureRemoveAnimation extends Animation dropItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_NUGGET, (byte) 0, 1, "DroppedNugget" + _count), info); _count++; } + else if (getTreasure().getTreasureType() == TreasureType.SPRING) + { + // Drops random flower + if (_flowers.size() == 0) + generateFlowerList(); + + int r = UtilMath.random.nextInt(_flowers.size()); + MaterialData materialData = _flowers.get(r); + dropItem(ItemStackFactory.Instance.CreateStack(materialData.getMaterial(), materialData.getData(), 1, "Flower" + _count), info); + _count++; + info.getBlock().setType(Material.AIR); + info.getBlock().setData((byte) 0); + } } else { @@ -60,6 +77,29 @@ public class TreasureRemoveAnimation extends Animation getTreasure().getTreasureManager().addItem(item); } + private void generateFlowerList() + { + _flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 1)); + _flowers.add(MaterialData.of(Material.LONG_GRASS, (byte) 2)); + _flowers.add(MaterialData.of(Material.DEAD_BUSH, (byte) 0)); + _flowers.add(MaterialData.of(Material.YELLOW_FLOWER, (byte) 0)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 0)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 1)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 2)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 3)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 4)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 5)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 6)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 7)); + _flowers.add(MaterialData.of(Material.RED_ROSE, (byte) 8)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 0)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 1)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 2)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 3)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 4)); + _flowers.add(MaterialData.of(Material.DOUBLE_PLANT, (byte) 5)); + } + @Override protected void onFinish() { From 6a668004e072a8761ffd1df54f69179fc1572a4c Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 14:06:44 -0300 Subject: [PATCH 40/51] Added game start event to core, to be called inside arcade and handled inside core --- .../core/arcadeevents/CoreGameStartEvent.java | 33 +++++++++++++++++++ .../taunts => arcadeevents}/GameType.java | 2 +- .../core/gadget/event/TauntCommandEvent.java | 2 +- .../gadget/gadgets/taunts/EternalTaunt.java | 1 + .../core/gadget/types/TauntGadget.java | 2 +- .../game/arcade/command/TauntCommand.java | 2 +- 6 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java rename Plugins/Mineplex.Core/src/mineplex/core/{gadget/gadgets/taunts => arcadeevents}/GameType.java (95%) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java new file mode 100644 index 000000000..c9ca0757c --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java @@ -0,0 +1,33 @@ +package mineplex.core.arcadeevents; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CoreGameStartEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private GameType _gameType; + + public CoreGameStartEvent(GameType gameType) + { + _gameType = gameType; + } + + public GameType getGameType() + { + return _gameType; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/GameType.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java similarity index 95% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/GameType.java rename to Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java index a0fe9230b..2bd7e1ed4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/GameType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.taunts; +package mineplex.core.arcadeevents; public enum GameType { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java index e803d54e2..00ef321e2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java @@ -5,7 +5,7 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import mineplex.core.common.util.UtilTime; -import mineplex.core.gadget.gadgets.taunts.GameType; +import mineplex.core.arcadeevents.GameType; public class TauntCommandEvent extends Event { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java index 53e6a7793..f7fa1d10f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java @@ -18,6 +18,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.util.Vector; +import mineplex.core.arcadeevents.GameType; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java index 0cca83b9f..85074ed29 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.gadgets.taunts.GameType; +import mineplex.core.arcadeevents.GameType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java index bc17eb83d..cd3a1a3ff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java @@ -9,7 +9,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.gadget.event.TauntCommandEvent; -import mineplex.core.gadget.gadgets.taunts.GameType; +import mineplex.core.arcadeevents.GameType; import mineplex.minecraft.game.core.combat.CombatManager; import nautilus.game.arcade.ArcadeManager; From 30215aea40a495f7d66b701000cbae9615419f9c Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 14:08:12 -0300 Subject: [PATCH 41/51] Added docs --- .../mineplex/core/arcadeevents/CoreGameStartEvent.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java index c9ca0757c..4564bb3e8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java @@ -3,6 +3,11 @@ package mineplex.core.arcadeevents; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +/** + * This event is called when a game starts in arcade + * It's called inside Arcade and handled inside Core, + * so we can track game events in core + */ public class CoreGameStartEvent extends Event { @@ -10,6 +15,9 @@ public class CoreGameStartEvent extends Event private GameType _gameType; + /** + * @param gameType the type of the game + */ public CoreGameStartEvent(GameType gameType) { _gameType = gameType; From b441dc5edf197c621c85de858a0421ebc1f846e3 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 14:12:23 -0300 Subject: [PATCH 42/51] Calls event when arcade game starts --- .../src/nautilus/game/arcade/game/Game.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index c9f13d3ef..89181251c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -13,9 +13,9 @@ import java.util.Optional; import java.util.Set; import java.util.UUID; -import mineplex.core.lifetimes.Lifetimed; -import mineplex.core.lifetimes.ListenerComponent; -import mineplex.core.lifetimes.PhasedLifetime; +import net.minecraft.server.v1_8_R3.EntityItem; +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; + import org.apache.commons.lang3.tuple.Triple; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -33,7 +33,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.ItemSpawnEvent; @@ -51,6 +50,7 @@ import com.mojang.authlib.GameProfile; import mineplex.core.Managers; import mineplex.core.antihack.AntiHack; +import mineplex.core.arcadeevents.CoreGameStartEvent; import mineplex.core.command.CommandCenter; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -67,8 +67,10 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.elo.EloPlayer; import mineplex.core.elo.EloTeam; -import mineplex.core.gadget.types.GadgetType; import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.lifetimes.Lifetimed; +import mineplex.core.lifetimes.ListenerComponent; +import mineplex.core.lifetimes.PhasedLifetime; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketInfo; import mineplex.core.updater.UpdateType; @@ -89,7 +91,6 @@ import nautilus.game.arcade.game.games.build.Build; import nautilus.game.arcade.game.games.draw.Draw; import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import nautilus.game.arcade.game.modules.Module; -import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.kit.ChampionsKit; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -110,8 +111,6 @@ import nautilus.game.arcade.stats.StatTracker; import nautilus.game.arcade.stats.WinStatTracker; import nautilus.game.arcade.wineffect.WinEffectManager; import nautilus.game.arcade.world.WorldData; -import net.minecraft.server.v1_8_R3.EntityItem; -import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; public abstract class Game extends ListenerComponent implements Lifetimed { @@ -746,6 +745,13 @@ public abstract class Game extends ListenerComponent implements Lifetimed UtilServer.getServer().getPluginManager().callEvent(stateEvent); System.out.println(GetName() + " state set to " + state.toString()); + + if (state.equals(GameState.Prepare)) + { + mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());; + CoreGameStartEvent coreGameStartEvent = new CoreGameStartEvent(gameType); + UtilServer.getServer().getPluginManager().callEvent(coreGameStartEvent); + } } public void SetStateTime(long time) From 8bcb5bc94859bf91e9fbb44e91a6d286fa7abf97 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 14:13:53 -0300 Subject: [PATCH 43/51] Added event to be called when game stops --- .../core/arcadeevents/CoreGameStopEvent.java | 41 +++++++++++++++++++ .../src/nautilus/game/arcade/game/Game.java | 9 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java new file mode 100644 index 000000000..2548d055e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java @@ -0,0 +1,41 @@ +package mineplex.core.arcadeevents; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +/** + * This event is called when a game stops in arcade + * It's called inside Arcade and handled inside Core, + * so we can track game events in core + */ +public class CoreGameStopEvent extends Event +{ + + private static final HandlerList handlers = new HandlerList(); + + private GameType _gameType; + + /** + * @param gameType the type of the game + */ + public CoreGameStopEvent(GameType gameType) + { + _gameType = gameType; + } + + public GameType getGameType() + { + return _gameType; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 89181251c..8b49df9d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -51,6 +51,7 @@ import com.mojang.authlib.GameProfile; import mineplex.core.Managers; import mineplex.core.antihack.AntiHack; import mineplex.core.arcadeevents.CoreGameStartEvent; +import mineplex.core.arcadeevents.CoreGameStopEvent; import mineplex.core.command.CommandCenter; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -745,13 +746,19 @@ public abstract class Game extends ListenerComponent implements Lifetimed UtilServer.getServer().getPluginManager().callEvent(stateEvent); System.out.println(GetName() + " state set to " + state.toString()); - + if (state.equals(GameState.Prepare)) { mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());; CoreGameStartEvent coreGameStartEvent = new CoreGameStartEvent(gameType); UtilServer.getServer().getPluginManager().callEvent(coreGameStartEvent); } + else if (state.equals(GameState.End)) + { + mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());; + CoreGameStopEvent coreGameStopEvent = new CoreGameStopEvent(gameType); + UtilServer.getServer().getPluginManager().callEvent(coreGameStopEvent); + } } public void SetStateTime(long time) From e4fc53d5cef9893b1ebb00f8828fa40606e5d044 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Fri, 7 Apr 2017 17:46:53 -0300 Subject: [PATCH 44/51] Removed flower trail from games --- .../particle/spring/ParticleSpringHalo.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java index 713df4199..cab1f0ac1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/spring/ParticleSpringHalo.java @@ -13,6 +13,8 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.arcadeevents.CoreGameStartEvent; +import mineplex.core.arcadeevents.CoreGameStopEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.RGBData; @@ -34,6 +36,7 @@ public class ParticleSpringHalo extends ParticleGadget private Map _effects = new HashMap<>(); private List _springHaloData = new ArrayList<>(); private Map> _playerSpringHaloData = new HashMap<>(); + private boolean _enableTrail = true; public ParticleSpringHalo(GadgetManager manager) { @@ -101,6 +104,9 @@ public class ParticleSpringHalo extends ParticleGadget if (!isActive(event.getPlayer())) return; + if (!_enableTrail) + return; + Player player = event.getPlayer(); Block block = event.getFrom().getBlock(); @@ -163,4 +169,16 @@ public class ParticleSpringHalo extends ParticleGadget } } + @EventHandler + public void onGameStart(CoreGameStartEvent event) + { + _enableTrail = false; + } + + @EventHandler + public void onGameEnd(CoreGameStopEvent event) + { + _enableTrail = true; + } + } From 1f0a22eb9424a8ef2783a10a511be7ee3e426792 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 8 Apr 2017 22:58:14 -0300 Subject: [PATCH 45/51] Stops balloons from 'growing up' --- .../mineplex/core/gadget/gadgets/balloons/BalloonItem.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java index be3382dc6..8f4530c2b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java @@ -58,6 +58,7 @@ public class BalloonItem extends BalloonGadget { Zombie zombie = player.getWorld().spawn(player.getLocation(), Zombie.class); zombie.setBaby(true); + ((Ageable) zombie).setAgeLock(true); UtilEnt.vegetate(zombie); UtilEnt.silence(zombie, true); addEntity(player, zombie); @@ -68,7 +69,10 @@ public class BalloonItem extends BalloonGadget Entity entity = player.getWorld().spawnEntity(player.getLocation(), _balloonType.getEntityType()); if (_balloonType.isBaby() && entity instanceof Ageable) + { ((Ageable) entity).setBaby(); + ((Ageable) entity).setAgeLock(true); + } UtilEnt.vegetate(entity); UtilEnt.silence(entity, true); addEntity(player, entity); From 6f1c06218284ecb8e92a2cbda3ff2491ed884a71 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 8 Apr 2017 23:06:55 -0300 Subject: [PATCH 46/51] Removed GameType, using GameDisplay instead --- .../core/arcadeevents/CoreGameStartEvent.java | 14 ++-- .../core/arcadeevents/CoreGameStopEvent.java | 14 ++-- .../mineplex/core/arcadeevents/GameType.java | 84 ------------------- .../core/gadget/event/TauntCommandEvent.java | 12 +-- .../gadget/gadgets/taunts/EternalTaunt.java | 4 +- .../core/gadget/types/TauntGadget.java | 10 +-- .../game/arcade/command/TauntCommand.java | 14 +--- .../src/nautilus/game/arcade/game/Game.java | 6 +- 8 files changed, 35 insertions(+), 123 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java index 4564bb3e8..2a6fd4fc6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStartEvent.java @@ -3,6 +3,8 @@ package mineplex.core.arcadeevents; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import mineplex.core.game.GameDisplay; + /** * This event is called when a game starts in arcade * It's called inside Arcade and handled inside Core, @@ -13,19 +15,19 @@ public class CoreGameStartEvent extends Event private static final HandlerList handlers = new HandlerList(); - private GameType _gameType; + private GameDisplay _gameDisplay; /** - * @param gameType the type of the game + * @param gameDisplay the type of the game */ - public CoreGameStartEvent(GameType gameType) + public CoreGameStartEvent(GameDisplay gameDisplay) { - _gameType = gameType; + _gameDisplay = gameDisplay; } - public GameType getGameType() + public GameDisplay getGameDisplay() { - return _gameType; + return _gameDisplay; } public HandlerList getHandlers() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java index 2548d055e..6c4729ca5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/CoreGameStopEvent.java @@ -3,6 +3,8 @@ package mineplex.core.arcadeevents; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import mineplex.core.game.GameDisplay; + /** * This event is called when a game stops in arcade * It's called inside Arcade and handled inside Core, @@ -13,19 +15,19 @@ public class CoreGameStopEvent extends Event private static final HandlerList handlers = new HandlerList(); - private GameType _gameType; + private GameDisplay _gameDisplay; /** - * @param gameType the type of the game + * @param gameDisplay the type of the game */ - public CoreGameStopEvent(GameType gameType) + public CoreGameStopEvent(GameDisplay gameDisplay) { - _gameType = gameType; + _gameDisplay = gameDisplay; } - public GameType getGameType() + public GameDisplay getGameDisplay() { - return _gameType; + return _gameDisplay; } public HandlerList getHandlers() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java b/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java deleted file mode 100644 index 2bd7e1ed4..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/arcadeevents/GameType.java +++ /dev/null @@ -1,84 +0,0 @@ -package mineplex.core.arcadeevents; - -public enum GameType -{ - - BACONBRAWL, - BARBARIANS, - BASKETBALL, - BOSSBATTLES, - BRIDGE, - CASTLESIEGE, - CHAMPIONSCTF, - CHAMPIONSDOMINATE, - CHAMPIONSTDM, - CHRISTMAS, - DEATHTAG, - DRAGONESCAPE, - DRAGONESCAPETEAMS, - DRAGONRIDERS, - DRAGONS, - DRAGONSTEAMS, - DRAW, - ELYTRARINGS, - EVOLUTION, - GRAVITY, - HALLOWEEN, - HALLOWEEN2016, - HIDESEEK, - HOLEINTHEWALL, - HORSE, - LOBBERS, - MICRO, - MILKCOW, - MINESTRIKE, - BAWKBAWKBATTLES, - MINECRAFTLEAGUE, - OLDMINEWARE, - PAINTBALL, - QUIVER, - QUIVERPAYLOAD, - QUIVERTEAMS, - RUNNER, - SEARCHANDDESTROY, - SHEEP, - TYPEWARS, - SMASH, - SMASHDOMINATION, - SMASHTEAMS, - SNAKE, - SNEAKYASSASSINS, - SNOWFIGHT, - SPEEDBUILDERS, - SPLEEF, - SPLEEFTEAMS, - SQUIDSHOOTER, - STACKER, - SURVIVALGAMES, - SURVIVALGAMESTEAMS, - TUG, - TURFWARS, - UHC, - UHCSOLO, - UHCSOLOSPEED, - UHCTEAMSSPEED, - WITHERASSAULT, - WIZARDS, - ZOMBIESURVIVAL, - BUILD, - BUILDMAVERICKS, - CARDS, - SKYWARS, - SKYWARSTEAMS, - MONSTERMAZE, - MONSTERLEAGUE, - GLADIATORS, - SKYFALL, - SKYFALLTEAMS, - BOUNCYBALLS, - VALENTINES, - EVENT, - BRAWL, - NONE - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java index 00ef321e2..ef6624b46 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/event/TauntCommandEvent.java @@ -5,7 +5,7 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import mineplex.core.common.util.UtilTime; -import mineplex.core.arcadeevents.GameType; +import mineplex.core.game.GameDisplay; public class TauntCommandEvent extends Event { @@ -18,16 +18,16 @@ public class TauntCommandEvent extends Event private boolean _spectator; private long _lastPvp; private TauntState _state = TauntState.NONE; - private GameType _gameType; + private GameDisplay _gameDisplay; - public TauntCommandEvent(Player player, boolean gameInProgress, boolean alive, boolean spectator, long lastPvp, GameType gameType) + public TauntCommandEvent(Player player, boolean gameInProgress, boolean alive, boolean spectator, long lastPvp, GameDisplay gameDisplay) { _player = player; _gameInProgress = gameInProgress; _alive = alive; _spectator = spectator; _lastPvp = lastPvp; - _gameType = gameType; + _gameDisplay = gameDisplay; } public Player getPlayer() @@ -60,9 +60,9 @@ public class TauntCommandEvent extends Event return _state; } - public GameType getGameType() + public GameDisplay getGameDisplay() { - return _gameType; + return _gameDisplay; } public void setState(TauntState state) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java index f7fa1d10f..103efacd2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/taunts/EternalTaunt.java @@ -18,7 +18,6 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.util.Vector; -import mineplex.core.arcadeevents.GameType; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -31,6 +30,7 @@ import mineplex.core.events.EnableArcadeSpawnEvent; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.TauntGadget; +import mineplex.core.game.GameDisplay; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; @@ -54,7 +54,7 @@ public class EternalTaunt extends TauntGadget setPvpCooldown(PVP_COOLDOWN); setShouldPlay(true); setEventType(UpdateType.FAST); - addDisabledGames(GameType.SMASH, GameType.SMASHTEAMS, GameType.SMASHDOMINATION); + addDisabledGames(GameDisplay.Smash, GameDisplay.SmashTeams, GameDisplay.SmashDomination); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java index 85074ed29..991a7425b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/TauntGadget.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import mineplex.core.gadget.GadgetManager; -import mineplex.core.arcadeevents.GameType; +import mineplex.core.game.GameDisplay; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -32,7 +32,7 @@ public abstract class TauntGadget extends Gadget /** Sets when the taunt will run, if set above */ private UpdateType _updateType = UpdateType.TICK; /** List of games where this item is disabled */ - private List _disabledGames = new ArrayList<>(); + private List _disabledGames = new ArrayList<>(); /** The ticks that passed since the player started the effect */ private Map _ticksPerPlayer = new HashMap<>(); @@ -119,7 +119,7 @@ public abstract class TauntGadget extends Gadget _updateType = updateType; } - public void addDisabledGames(GameType... disabledGames) + public void addDisabledGames(GameDisplay... disabledGames) { _disabledGames.addAll(Arrays.asList(disabledGames)); } @@ -129,9 +129,9 @@ public abstract class TauntGadget extends Gadget return _canPlayWithPvp; } - public boolean isGameDisabled(GameType gameType) + public boolean isGameDisabled(GameDisplay gameDisplay) { - return _disabledGames.contains(gameType); + return _disabledGames.contains(gameDisplay); } public long getPvpCooldown() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java index cd3a1a3ff..af64ce746 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/TauntCommand.java @@ -7,9 +7,8 @@ import mineplex.core.Managers; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTime; import mineplex.core.gadget.event.TauntCommandEvent; -import mineplex.core.arcadeevents.GameType; +import mineplex.core.game.GameDisplay; import mineplex.minecraft.game.core.combat.CombatManager; import nautilus.game.arcade.ArcadeManager; @@ -29,21 +28,16 @@ public class TauntCommand extends CommandBase @Override public void Execute(Player player, String[] args) { - boolean pvp = false; CombatManager combatManager = Managers.get(CombatManager.class); - if (combatManager != null) - { - pvp = UtilTime.elapsed(combatManager.Get(player).GetLastCombatEngaged(), 5000 * 60); - } Game game = _arcadeManager.GetGame(); - GameType gameType = GameType.NONE; + GameDisplay gameDisplay = null; if (game != null) { - gameType = GameType.valueOf(game.GetType().toString().toUpperCase()); + gameDisplay = game.GetType().getDisplay(); } TauntCommandEvent event = new TauntCommandEvent(player, _arcadeManager.isGameInProgress(), _arcadeManager.GetGame().IsAlive(player), UtilPlayer.isSpectator(player), combatManager.Get(player).GetLastCombatEngaged(), - gameType); + gameDisplay); Bukkit.getPluginManager().callEvent(event); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 8b49df9d8..076e12136 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -749,14 +749,12 @@ public abstract class Game extends ListenerComponent implements Lifetimed if (state.equals(GameState.Prepare)) { - mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());; - CoreGameStartEvent coreGameStartEvent = new CoreGameStartEvent(gameType); + CoreGameStartEvent coreGameStartEvent = new CoreGameStartEvent(GetType().getDisplay()); UtilServer.getServer().getPluginManager().callEvent(coreGameStartEvent); } else if (state.equals(GameState.End)) { - mineplex.core.arcadeevents.GameType gameType = mineplex.core.arcadeevents.GameType.valueOf(GetType().toString().toUpperCase());; - CoreGameStopEvent coreGameStopEvent = new CoreGameStopEvent(gameType); + CoreGameStopEvent coreGameStopEvent = new CoreGameStopEvent(GetType().getDisplay()); UtilServer.getServer().getPluginManager().callEvent(coreGameStopEvent); } } From de46f2db70f4883043ad3bbeef5c200b1d2eeabf Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 8 Apr 2017 23:09:10 -0300 Subject: [PATCH 47/51] Should have been added in the last commit --- .../Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 37b574468..7d454b5cd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1381,7 +1381,7 @@ public class GadgetManager extends MiniPlugin if (!event.isGameInProgress() && event.getState().equals(TauntCommandEvent.TauntState.NONE)) event.setState(TauntCommandEvent.TauntState.NOT_IN_GAME); - if (taunt.isGameDisabled(event.getGameType()) && event.getState().equals(TauntCommandEvent.TauntState.NONE)) + if (taunt.isGameDisabled(event.getGameDisplay()) && event.getState().equals(TauntCommandEvent.TauntState.NONE)) event.setState(TauntCommandEvent.TauntState.GAME_DISABLED); if (!event.isAlive() && event.getState().equals(TauntCommandEvent.TauntState.NONE)) From 7db5805f166cea05b7944e900b43a91bf2a4f2e2 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 8 Apr 2017 23:11:41 -0300 Subject: [PATCH 48/51] Fixed lenght --- .../mineplex/staffServer/customerSupport/CustomerSupport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index d735896a8..17cc91293 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -335,9 +335,9 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable { if (transaction.Coins == 0 && transaction.Gems == 0) { - if (transaction.SalesPackageName.split(" ").length == 4) + if (transaction.SalesPackageName.split(" ").length == 3) springChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[3]); - else if (transaction.SalesPackageName.split(" ").length == 3) + else if (transaction.SalesPackageName.split(" ").length == 2) springChestsReceived += 1; } } From 4388a7f70e1330521f73179bf2a70cb8dbe7c4de Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 8 Apr 2017 23:17:39 -0300 Subject: [PATCH 49/51] Changed lenght (missed one thing) --- .../mineplex/staffServer/customerSupport/CustomerSupport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 17cc91293..9bb7990de 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -336,7 +336,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable if (transaction.Coins == 0 && transaction.Gems == 0) { if (transaction.SalesPackageName.split(" ").length == 3) - springChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[3]); + springChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); else if (transaction.SalesPackageName.split(" ").length == 2) springChestsReceived += 1; } From 0a51bcd60714112a8243d66ee37813616d6bbf06 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 11 Apr 2017 16:10:59 -0300 Subject: [PATCH 50/51] Easter, not eater --- 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 3f54bc966..6503db11e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetType.java @@ -34,7 +34,7 @@ public enum PetType CUPID_PET("Cupid", EntityType.ZOMBIE, -17, "Sometimes you need a little extra help finding true Love. Why not have Cupid help you out?", Material.BOW, (byte) 0), 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)), LEPRECHAUN("Leprechaun", EntityType.ZOMBIE, -18, "Apparently this little guy lost his Pot of Gold in the war.", SkinData.LEPRECHAUN.getSkull()), - KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Eater Bunny's less talked about brother Devin was a bit less fun to hang out with.", Material.RABBIT_FOOT, (byte) 0) + KILLER_BUNNY("Killer Bunny", EntityType.RABBIT, -19, "The Easter Bunny's less talked about brother Devin was a bit less fun to hang out with.", Material.RABBIT_FOOT, (byte) 0) // 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 b511546b363c1f58b214dedf6885eca6f841f02e Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Tue, 11 Apr 2017 22:44:56 -0300 Subject: [PATCH 51/51] Removed age lock from zombie --- .../src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java index 8f4530c2b..67ea7e618 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/balloons/BalloonItem.java @@ -58,7 +58,6 @@ public class BalloonItem extends BalloonGadget { Zombie zombie = player.getWorld().spawn(player.getLocation(), Zombie.class); zombie.setBaby(true); - ((Ageable) zombie).setAgeLock(true); UtilEnt.vegetate(zombie); UtilEnt.silence(zombie, true); addEntity(player, zombie);