Cosmetics Bug Fixes (#229)

* 	Fixes for the Block Morph

* Fixes for the Witch Morph

* Fixed memory leak on ArrowTrailHalloween, thanks to Sam, again
This commit is contained in:
LCastr0 2016-10-05 18:16:25 -03:00 committed by Shaun Bennett
parent dae3c60247
commit 876d35b482
5 changed files with 48 additions and 27 deletions

View File

@ -18,7 +18,6 @@ import mineplex.core.cosmetic.ui.button.activate.ActivateGadgetButton;
import mineplex.core.cosmetic.ui.button.deactivate.DeactivateGadgetButton;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetChangeEvent;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.gadgets.morph.MorphWitch;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
@ -76,11 +75,6 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
protected void addGadget(Gadget gadget, int slot)
{
if (gadget instanceof MorphBlock)
{
if (getPlayer().getPassenger() != null)
return;
}
List<String> itemLore = new ArrayList<String>();

View File

@ -1,18 +1,18 @@
package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
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.donation.DonationManager;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class MorphPage extends GadgetPage
{
@ -31,7 +31,8 @@ public class MorphPage extends GadgetPage
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget)
addGlow(slot);
if (!(gadget instanceof MorphBlock))
addGlow(slot);
slot++;

View File

@ -50,7 +50,10 @@ public class ArrowTrailHalloween extends ArrowEffectGadget
@Override
public void doHitEffect(Arrow arrow)
{
if (_arrowColors.containsKey(arrow))
{
_arrowColors.remove(arrow);
}
}
}

View File

@ -1,14 +1,5 @@
package mineplex.core.gadget.gadgets.morph;
import mineplex.core.common.skin.SkinData;
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;
@ -17,6 +8,20 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
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;
public class MorphWitch extends MorphGadget
{
@ -97,6 +102,14 @@ public class MorphWitch extends MorphGadget
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
return;
}
for (Location blockLocation : Manager.getTreasureManager().getBlockLocations())
{
if (blockLocation.distanceSquared(cauldronLocation) <= 25)
{
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

View File

@ -2,7 +2,14 @@ package mineplex.core.treasure;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.collect.Lists;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.blockrestore.BlockRestore;
@ -18,11 +25,6 @@ import mineplex.core.reward.RewardPool;
import mineplex.core.reward.RewardType;
import mineplex.core.stats.StatsManager;
import mineplex.core.status.ServerStatusManager;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;
/**
* Created by Shaun on 8/27/2014.
@ -36,6 +38,7 @@ public class TreasureManager extends MiniPlugin
private HologramManager _hologramManager;
private StatsManager _statsManager;
private List<TreasureLocation> _treasureLocations;
private List<Location> _blockLocations;
public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, GadgetManager gadgetManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager, RewardManager rewardManager)
{
@ -49,11 +52,13 @@ public class TreasureManager extends MiniPlugin
_rewardManager = rewardManager;
_treasureLocations = Lists.newArrayList();
_blockLocations = Lists.newArrayList();
for(Location location : LocationConstants.CHEST_LOCATIONS)
{
Location resetLocation = LocationConstants.getResetLocation(location);
Block[] blocks = setup(location.getBlock());
_blockLocations.add(location);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, location.getBlock(), blocks, resetLocation, _hologramManager, gadgetManager, statusManager));
}
@ -151,4 +156,9 @@ public class TreasureManager extends MiniPlugin
{
return _treasureLocations;
}
public List<Location> getBlockLocations()
{
return _blockLocations;
}
}