Fixes for the Witch Morph
This commit is contained in:
parent
1475243d8a
commit
0797f90d3b
@ -5,6 +5,7 @@ import java.util.function.Predicate;
|
||||
|
||||
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
|
||||
import mineplex.core.gadget.gadgets.morph.swim.SwimManager;
|
||||
import mineplex.core.treasure.TreasureManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -206,6 +207,7 @@ public class GadgetManager extends MiniPlugin
|
||||
private final HologramManager _hologramManager;
|
||||
private final OutfitWindUpSuitBoosterManager _boosterManager;
|
||||
private final IncognitoManager _incognitoManager;
|
||||
private TreasureManager _treasureManager;
|
||||
|
||||
private NautHashMap<GadgetType, List<Gadget>> _gadgets;
|
||||
|
||||
@ -1153,4 +1155,14 @@ public class GadgetManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setTreasureManager(TreasureManager treasureManager)
|
||||
{
|
||||
_treasureManager = treasureManager;
|
||||
}
|
||||
|
||||
public TreasureManager getTreasureManager()
|
||||
{
|
||||
return _treasureManager;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class MorphMetalMan extends MorphGadget
|
||||
public MorphMetalMan(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Metal Man Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "This powerful suit forged of metal makes the wearer strong enough to even battle the gods",
|
||||
C.cWhite + "Left-click to shoot laser beam"}, LineFormat.LORE),
|
||||
"", C.cWhite + "Left-click to shoot laser beam"}, LineFormat.LORE),
|
||||
0, Material.IRON_INGOT, (byte) 0);
|
||||
}
|
||||
|
||||
@ -67,7 +67,10 @@ public class MorphMetalMan extends MorphGadget
|
||||
if (!UtilEvent.isAction(event, UtilEvent.ActionType.L))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, getName(), 5000, false, false, "Cosmetics"))
|
||||
if (player.getItemInHand().getType() != Material.AIR)
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, getName(), 5000, true, false, "Cosmetics"))
|
||||
return;
|
||||
|
||||
// Creates colored laser
|
||||
@ -113,7 +116,7 @@ public class MorphMetalMan extends MorphGadget
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerColors.put(uuid, 0);
|
||||
_playerColors.put(uuid, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,15 @@
|
||||
package mineplex.core.gadget.gadgets.morph;
|
||||
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.disguise.disguises.DisguiseWitch;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -23,7 +22,7 @@ public class MorphWitch extends MorphGadget
|
||||
|
||||
public MorphWitch(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Witch Morph", UtilText.splitLinesToArray(new String[]{"Press sneak to summon your trusty bat and start brewing"}, LineFormat.LORE), 0, Material.SKULL_ITEM, (byte) 3);
|
||||
super(manager, "Witch Morph", UtilText.splitLinesToArray(new String[]{C.cWhite + "Press sneak to summon your trusty bat and start brewing"}, LineFormat.LORE), 0, Material.SKULL_ITEM, (byte) 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -57,6 +56,15 @@ public class MorphWitch extends MorphGadget
|
||||
public void onSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
WitchEffectManager witchEffectManager = WitchEffectManager.getManager(event.getPlayer());
|
||||
|
||||
if (!Recharge.Instance.usable(event.getPlayer(), "Witch Cauldron", true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.isSneaking())
|
||||
return;
|
||||
|
||||
if (witchEffectManager != null)
|
||||
{
|
||||
if (witchEffectManager.hasStarted())
|
||||
@ -72,9 +80,7 @@ public class MorphWitch extends MorphGadget
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(event.getPlayer(), "Witch Cauldron", 15000, true, false, "Cosmetics"))
|
||||
return;
|
||||
|
||||
// Checks if there is a block under the cauldron
|
||||
Location cauldronLocation = event.getPlayer().getLocation().clone().add(event.getPlayer().getLocation().getDirection());
|
||||
cauldronLocation.add(0, 1, 0);
|
||||
if(cauldronLocation.getBlock().getType() != Material.AIR)
|
||||
@ -82,6 +88,45 @@ public class MorphWitch extends MorphGadget
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Checks if player is opening a treasure chest/close to a treasure area
|
||||
if (Manager.getTreasureManager() != null)
|
||||
{
|
||||
if (Manager.getTreasureManager().isOpening(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Checks if the player is close to a cactus
|
||||
for (int x = -3; x < 3; x++)
|
||||
{
|
||||
for (int z = -3; z < 3; z++)
|
||||
{
|
||||
Location possibleCactus = cauldronLocation.clone().add(x, 0, z);
|
||||
if (possibleCactus.getBlock().getType() == Material.CACTUS)
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Checks if the player is in a Soccer area
|
||||
GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(event.getPlayer(), this, cauldronLocation.clone().subtract(0, 1, 0));
|
||||
gadgetSelectLocationEvent.setShowMessage(true);
|
||||
Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent);
|
||||
|
||||
if (gadgetSelectLocationEvent.isCancelled())
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(event.getPlayer(), "Witch Cauldron", 15000, true, false, "Cosmetics"))
|
||||
return;
|
||||
|
||||
WitchEffectManager newManager = new WitchEffectManager(event.getPlayer(), cauldronLocation);
|
||||
newManager.start();
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ public class MetalManEffect extends Effect
|
||||
// Creates the explosion and knockback players
|
||||
Location loc = _fixedLoc;
|
||||
loc.getWorld().createExplosion(loc, 0f);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, loc, 3f, 3f, 3f, 0, 32, UtilParticle.ViewDist.MAX, UtilServer.getPlayers());
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(loc, 12d);
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.EXPLODE, loc, 3f, 3f, 3f, 0, 32, UtilParticle.ViewDist.MAX, UtilServer.getPlayers());
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(loc, 5d);
|
||||
for (Player ent : players.keySet())
|
||||
{
|
||||
if (_gadget.Manager.collideEvent(_player, _gadget, ent))
|
||||
|
@ -1,6 +1,5 @@
|
||||
package mineplex.core.treasure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
@ -63,6 +62,8 @@ public class TreasureManager extends MiniPlugin
|
||||
{
|
||||
_plugin.getServer().getPluginManager().registerEvents(treasureLocation, _plugin);
|
||||
}
|
||||
|
||||
gadgetManager.setTreasureManager(this);
|
||||
}
|
||||
|
||||
private Block[] setup(Block chestBlock)
|
||||
@ -145,4 +146,9 @@ public class TreasureManager extends MiniPlugin
|
||||
{
|
||||
return _clientManager;
|
||||
}
|
||||
|
||||
public List<TreasureLocation> getTreasureLocations()
|
||||
{
|
||||
return _treasureLocations;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user