Addef fix for dinnerbone morph not opening menus

This commit is contained in:
LCastr0 2016-12-20 17:16:42 -02:00
parent fd223935c7
commit df2b0c7e99
2 changed files with 42 additions and 10 deletions

View File

@ -1,5 +1,21 @@
package mineplex.core.cosmetic;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.boosters.BoosterManager;
@ -10,6 +26,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.morph.MorphDinnerbone;
import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
@ -18,15 +35,6 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.mount.MountManager;
import mineplex.core.pet.PetManager;
import mineplex.core.treasure.TreasureManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class CosmeticManager extends MiniPlugin
{
@ -138,6 +146,30 @@ public class CosmeticManager extends MiniPlugin
}
}
// Allows player to open cosmetic shop while carrying armor stand
// Also calls PlayerInteractEvent to open other menus
@EventHandler
public void openShop(PlayerInteractAtEntityEvent event)
{
if (!_showInterface)
return;
Player player = event.getPlayer();
if (!(_gadgetManager.getActive(player, GadgetType.MORPH) instanceof MorphDinnerbone))
return;
if (!event.getRightClicked().getType().equals(EntityType.ARMOR_STAND))
return;
Block block = event.getRightClicked().getLocation().getBlock();
Action action = Action.RIGHT_CLICK_AIR;
BlockFace blockFace = BlockFace.SOUTH;
ItemStack item = player.getItemInHand();
PlayerInteractEvent playerInteractEvent = new PlayerInteractEvent(player, action, item, block, blockFace);
Bukkit.getPluginManager().callEvent(playerInteractEvent);
}
public GadgetManager getGadgetManager()
{
return _gadgetManager;

View File

@ -62,7 +62,7 @@ public class MorphDinnerbone extends MorphGadget
DisguisePlayer disguisePlayer = new DisguisePlayer(player, requestedProfile);
disguisePlayer.setSendSkinDataToSelf(false);
disguisePlayer.setReplaceOriginalName(false, 5);
disguisePlayer.setReplaceOriginalName(false, 500);
disguisePlayer.showInTabList(true, 0);
UtilMorph.disguise(player, disguisePlayer, Manager);
};