Huge improvement on the Cosmetic System
This commit is contained in:
parent
19c65560c5
commit
8e327e86b4
@ -1,6 +1,5 @@
|
||||
package mineplex.core.cosmetic;
|
||||
|
||||
import mineplex.core.punish.Punish;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -34,8 +33,8 @@ import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.treasure.TreasureManager;
|
||||
import mineplex.core.twofactor.TwoFactorAuth;
|
||||
|
||||
@ -44,7 +43,6 @@ public class CosmeticManager extends MiniPlugin
|
||||
private final TwoFactorAuth _twofactor = Managers.require(TwoFactorAuth.class);
|
||||
private final InventoryManager _inventoryManager;
|
||||
private final GadgetManager _gadgetManager;
|
||||
private final MountManager _mountManager;
|
||||
private final PetManager _petManager;
|
||||
private final TreasureManager _treasureManager;
|
||||
private final BoosterManager _boosterManager;
|
||||
@ -56,15 +54,13 @@ public class CosmeticManager extends MiniPlugin
|
||||
private int _interfaceSlot = 4;
|
||||
|
||||
public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager,
|
||||
InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager,
|
||||
PetManager petManager, TreasureManager treasureManager, BoosterManager boosterManager,
|
||||
Punish punish)
|
||||
InventoryManager inventoryManager, GadgetManager gadgetManager, PetManager petManager,
|
||||
TreasureManager treasureManager, BoosterManager boosterManager, Punish punish)
|
||||
{
|
||||
super("Cosmetic Manager", plugin);
|
||||
|
||||
_inventoryManager = inventoryManager;
|
||||
_gadgetManager = gadgetManager;
|
||||
_mountManager = mountManager;
|
||||
_petManager = petManager;
|
||||
_treasureManager = treasureManager;
|
||||
_boosterManager = boosterManager;
|
||||
@ -184,11 +180,6 @@ public class CosmeticManager extends MiniPlugin
|
||||
return _gadgetManager;
|
||||
}
|
||||
|
||||
public MountManager getMountManager()
|
||||
{
|
||||
return _mountManager;
|
||||
}
|
||||
|
||||
public PetManager getPetManager()
|
||||
{
|
||||
return _petManager;
|
||||
@ -225,7 +216,6 @@ public class CosmeticManager extends MiniPlugin
|
||||
public void disableItemsForGame()
|
||||
{
|
||||
_gadgetManager.disableAll();
|
||||
_mountManager.DisableAll();
|
||||
_petManager.disableAll();
|
||||
}
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
package mineplex.core.cosmetic.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class ActivateGemBoosterEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _player;
|
||||
|
||||
private boolean _cancelled = false;
|
||||
|
||||
public ActivateGemBoosterEvent(Player player)
|
||||
{
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel)
|
||||
{
|
||||
_cancelled = cancel;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package mineplex.core.cosmetic.event;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class SlackCosmeticEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private String _message;
|
||||
private String _player;
|
||||
|
||||
public SlackCosmeticEvent(String message)
|
||||
{
|
||||
_message = message;
|
||||
_player = null;
|
||||
}
|
||||
|
||||
public SlackCosmeticEvent(String message, String player)
|
||||
{
|
||||
_message = message;
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return _message;
|
||||
}
|
||||
|
||||
public String getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -7,6 +7,7 @@ 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.ItemGadgetPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.PetTagPage;
|
||||
import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetTagPage;
|
||||
@ -60,6 +61,6 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
|
||||
@EventHandler
|
||||
public void itemGadgetEmptyAmmo(ItemGadgetOutOfAmmoEvent event)
|
||||
{
|
||||
new GadgetPage(getPlugin(), this, getClientManager(), getDonationManager(), "Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget());
|
||||
new ItemGadgetPage(getPlugin(), this, getClientManager(), getDonationManager(), "Item Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget());
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.cosmetic.ui.page.MountPage;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.shop.confirmation.ConfirmationPage;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
public class MountButton implements IButton
|
||||
{
|
||||
private Mount<?> _mount;
|
||||
private MountPage _page;
|
||||
|
||||
public MountButton(Mount<?> mount, MountPage page)
|
||||
{
|
||||
_mount = mount;
|
||||
_page = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(final Player player, ClickType clickType)
|
||||
{
|
||||
_page.getShop().openPageForPlayer(player, new ConfirmationPage<>(player, _page, new SalesPackageProcessor(player, GlobalCurrency.TREASURE_SHARD, _mount, _page.getDonationManager(), () ->
|
||||
{
|
||||
_page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.getName(), 1);
|
||||
_page.refresh();
|
||||
}), _mount.buildIcon()));
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.activate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class ActivateGadgetButton implements IButton
|
||||
{
|
||||
private Gadget _gadget;
|
||||
private GadgetPage _page;
|
||||
|
||||
public ActivateGadgetButton(Gadget gadget, GadgetPage page)
|
||||
{
|
||||
_gadget = gadget;
|
||||
_page = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
if (clickType.isLeftClick())
|
||||
_page.activateGadget(player, _gadget);
|
||||
else if (clickType.isRightClick())
|
||||
_page.handleRightClick(player, _gadget);
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.activate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.MountPage;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class ActivateMountButton implements IButton
|
||||
{
|
||||
private Mount<?> _mount;
|
||||
private MountPage _page;
|
||||
|
||||
public ActivateMountButton(Mount<?> mount, MountPage page)
|
||||
{
|
||||
_mount = mount;
|
||||
_page = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_page.playAcceptSound(player);
|
||||
_mount.enable(player);
|
||||
_page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.deactivate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class DeactivateGadgetButton implements IButton
|
||||
{
|
||||
private Gadget _gadget;
|
||||
private GadgetPage _page;
|
||||
|
||||
public DeactivateGadgetButton(Gadget gadget, GadgetPage page)
|
||||
{
|
||||
_gadget = gadget;
|
||||
_page = page;
|
||||
}
|
||||
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
if (clickType.isLeftClick())
|
||||
_page.deactivateGadget(player, _gadget);
|
||||
else if (clickType.isRightClick())
|
||||
_page.handleRightClick(player, _gadget);
|
||||
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.deactivate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.mount.Mount;
|
||||
|
||||
public class DeactivateMountButton implements IButton
|
||||
{
|
||||
private Mount<?> _mount;
|
||||
private ShopPageBase<?,?> _page;
|
||||
|
||||
public DeactivateMountButton(Mount<?> mount, ShopPageBase<?,?> page)
|
||||
{
|
||||
_mount = mount;
|
||||
_page = page;
|
||||
}
|
||||
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_page.playAcceptSound(player);
|
||||
_mount.disable(player);
|
||||
_page.refresh();
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.ArrowTrailPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenArrowTrails extends OpenPageButton
|
||||
{
|
||||
public OpenArrowTrails(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new ArrowTrailPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Arrow Trails", player));
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.BalloonsPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenBalloons extends OpenPageButton
|
||||
{
|
||||
|
||||
public OpenBalloons(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new BalloonsPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Balloons", player));
|
||||
}
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.DeathEffectPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenDeathAnimations extends OpenPageButton
|
||||
{
|
||||
|
||||
public OpenDeathAnimations(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new DeathEffectPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Death Animations", player));
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.DoubleJumpPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenDoubleJump extends OpenPageButton
|
||||
{
|
||||
public OpenDoubleJump(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new DoubleJumpPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Double Jump Effects", player));
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.FlagPage;
|
||||
import mineplex.core.cosmetic.ui.page.HatPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author J Teissler
|
||||
* @date 6/26/17
|
||||
*/
|
||||
public class OpenFlags extends OpenPageButton
|
||||
{
|
||||
public OpenFlags(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new FlagPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Flags - 1", player));
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenGadgets extends OpenPageButton
|
||||
{
|
||||
|
||||
public OpenGadgets(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new GadgetPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Gadgets", player));
|
||||
}
|
||||
}
|
@ -4,14 +4,25 @@ import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.gamemodifiers.GameCosmeticsPage;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
public class OpenGameModifiers extends OpenPageButton
|
||||
{
|
||||
|
||||
public OpenGameModifiers(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
if (clickType.isLeftClick())
|
||||
{
|
||||
leftClick(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
|
@ -1,21 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.HatPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenHats extends OpenPageButton
|
||||
{
|
||||
public OpenHats(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new HatPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Hats", player));
|
||||
}
|
||||
}
|
@ -5,9 +5,9 @@ import org.bukkit.entity.Player;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenMusic extends OpenPageButton
|
||||
public class OpenItems extends OpenPageButton
|
||||
{
|
||||
public OpenMusic(Menu menu, Gadget active)
|
||||
public OpenItems(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
@ -15,6 +15,6 @@ public class OpenMusic extends OpenPageButton
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().openMusic(player);
|
||||
getMenu().openItems(player);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.KitSelectorPage;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenKitSelector extends OpenPageButton
|
||||
{
|
||||
public OpenKitSelector(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new KitSelectorPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Rank Selector Particles", player));
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.MorphPage;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class OpenMorphs extends OpenPageButton
|
||||
{
|
||||
|
||||
public OpenMorphs(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new MorphPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Morphs", player));
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.MountPage;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class OpenMounts implements IButton
|
||||
{
|
||||
private Menu _menu;
|
||||
private Mount<?> _active;
|
||||
|
||||
public OpenMounts(Menu menu, Mount<?> active)
|
||||
{
|
||||
_menu = menu;
|
||||
_active = active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
if (clickType.isLeftClick())
|
||||
_menu.getShop().openPageForPlayer(player, new MountPage(_menu.getPlugin(), _menu.getShop(), _menu.getClientManager(), _menu.getDonationManager(), "Mounts", player));
|
||||
else
|
||||
{
|
||||
if (_active != null)
|
||||
{
|
||||
_menu.playAcceptSound(player);
|
||||
_active.disable(player);
|
||||
_menu.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.ParticlePage;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenParticles extends OpenPageButton
|
||||
{
|
||||
public OpenParticles(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new ParticlePage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Particles", player));
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.TauntPage;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenTaunts extends OpenPageButton
|
||||
{
|
||||
public OpenTaunts(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new TauntPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Taunts", player));
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.WinEffectPage;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenWinEffect extends OpenPageButton
|
||||
{
|
||||
public OpenWinEffect(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new WinEffectPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Win Effects", player));
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class ArrowTrailPage extends GadgetPage
|
||||
{
|
||||
|
||||
public ArrowTrailPage(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 (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ARROW_TRAIL))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ARROW_TRAIL) == gadget)
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class BalloonsPage extends GadgetPage
|
||||
{
|
||||
|
||||
public BalloonsPage(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 (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.BALLOON))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (gadget.isActive(getPlayer()))
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -24,6 +24,7 @@ import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class CostumePage extends GadgetPage
|
||||
{
|
||||
|
||||
public CostumePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
@ -37,17 +38,19 @@ public class CostumePage extends GadgetPage
|
||||
|
||||
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME))
|
||||
{
|
||||
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -1)
|
||||
if (gadget.isHidden())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
OutfitGadget outfitGadget = ((OutfitGadget) gadget);
|
||||
|
||||
int offset;
|
||||
|
||||
if (gadget instanceof OutfitRaveSuit) offset = 0;
|
||||
else if (gadget instanceof OutfitSpaceSuit) offset = 1;
|
||||
else if (gadget instanceof OutfitFreezeSuit) offset = 2;
|
||||
else if (gadget instanceof OutfitStPatricksSuit) offset = 3;
|
||||
if (gadget instanceof OutfitRaveSuit) offset = 0;
|
||||
else if (gadget instanceof OutfitSpaceSuit) offset = 1;
|
||||
else if (gadget instanceof OutfitFreezeSuit) offset = 2;
|
||||
else if (gadget instanceof OutfitStPatricksSuit) offset = 3;
|
||||
else offset = 4;
|
||||
|
||||
slot = offset + 1 + 18; //1 buffer to left, 18 = 2 lines down
|
||||
@ -62,38 +65,32 @@ public class CostumePage extends GadgetPage
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (gadget.isActive(getPlayer()))
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
}
|
||||
|
||||
addButton(8, new ShopItem(Material.TNT, C.cRed + C.Bold + "Remove all Clothing", new String[]{}, 1, false), new IButton()
|
||||
addButton(8, new ShopItem(Material.TNT, C.cRedB + "Remove all Clothing", new String[0], 1, false), (player, clickType) ->
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
boolean gadgetDisabled = false;
|
||||
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME))
|
||||
{
|
||||
if (gadget.isActive(player))
|
||||
{
|
||||
gadgetDisabled = true;
|
||||
gadget.disable(player);
|
||||
}
|
||||
}
|
||||
boolean gadgetDisabled = false;
|
||||
|
||||
if (gadgetDisabled)
|
||||
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME))
|
||||
{
|
||||
if (gadget.isActive(player))
|
||||
{
|
||||
buildPage();
|
||||
player.playSound(player.getEyeLocation(), Sound.SPLASH, 1, 1);
|
||||
gadgetDisabled = true;
|
||||
gadget.disable(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (gadgetDisabled)
|
||||
{
|
||||
buildPage();
|
||||
player.playSound(player.getEyeLocation(), Sound.SPLASH, 1, 1);
|
||||
}
|
||||
});
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
addBackButton();
|
||||
}
|
||||
|
||||
public void activateGadget(Player player, Gadget gadget)
|
||||
|
@ -1,57 +0,0 @@
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class DeathEffectPage extends GadgetPage
|
||||
{
|
||||
|
||||
public DeathEffectPage(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 (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DEATH))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DEATH) == gadget)
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class DoubleJumpPage extends GadgetPage
|
||||
{
|
||||
|
||||
public DoubleJumpPage(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 (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DOUBLE_JUMP))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DOUBLE_JUMP) == gadget)
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FlagPage extends GadgetPage
|
||||
{
|
||||
private int _page;
|
||||
|
||||
public FlagPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
|
||||
Player player)
|
||||
{
|
||||
this(plugin, shop, clientManager, donationManager, name, player, 0);
|
||||
}
|
||||
|
||||
public FlagPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
|
||||
Player player, int page)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player, false);
|
||||
_page = page;
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
// chose a beginning slot
|
||||
int slot = 10;
|
||||
|
||||
// grab all flags
|
||||
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.FLAG);
|
||||
|
||||
if(list != null)
|
||||
{
|
||||
int size = list.size();
|
||||
int limit = (_page + 1) * 28;
|
||||
|
||||
// loop through the flags for a specific page
|
||||
for (int i = _page * 28; i < limit && i < size; ++i)
|
||||
{
|
||||
Gadget gadget = list.get(i);
|
||||
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.FLAG) == gadget)
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
// back arrow
|
||||
if (size > 28)
|
||||
{
|
||||
if (_page > 0)
|
||||
{
|
||||
addButton(45, new ShopItem(Material.ARROW, C.cGreen + "◀ Previous Page (" + C.cWhite + _page + C.cGreen + ")", new String[]{}, 1, false),
|
||||
(player, clickType) ->
|
||||
{
|
||||
FlagPage page = new FlagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Flags - " + (_page), player, _page - 1);
|
||||
getShop().openPageForPlayer(player, page);
|
||||
});
|
||||
}
|
||||
|
||||
// next arrow
|
||||
if (_page < (size - 1) / 28)
|
||||
{
|
||||
addButton(53, new ShopItem(Material.ARROW, C.cGreen + "(" + C.cWhite + (_page + 2) + C.cGreen + ") Next Page ►", new String[]{}, 1, false),
|
||||
(player, clickType) ->
|
||||
{
|
||||
FlagPage page = new FlagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Flags - " + (_page + 2), player, _page + 1);
|
||||
getShop().openPageForPlayer(player, page);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ import java.util.Locale;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
@ -23,68 +22,107 @@ import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.cosmetic.ui.button.GadgetButton;
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetSet;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.HatGadget;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.shop.confirmation.ConfirmationPage;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
|
||||
public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
|
||||
private static final int ELEMENTS_PER_PAGE = 28;
|
||||
|
||||
private final GadgetType _gadgetType;
|
||||
|
||||
private int _page;
|
||||
|
||||
public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
this(plugin, shop, clientManager, donationManager, name, player, true);
|
||||
this(plugin, shop, clientManager, donationManager, name, player, null);
|
||||
}
|
||||
|
||||
public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, boolean build)
|
||||
public GadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, GadgetType gadgetType)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player, 54);
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
|
||||
if (build)
|
||||
{
|
||||
buildPage();
|
||||
}
|
||||
_gadgetType = gadgetType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
int slot = 10;
|
||||
List<Gadget> gadgets = getGadgetsToDisplay();
|
||||
|
||||
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ITEM))
|
||||
if (gadgets == null)
|
||||
{
|
||||
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -3)
|
||||
return;
|
||||
}
|
||||
|
||||
int slot = 10;
|
||||
int startIndex = _page * ELEMENTS_PER_PAGE;
|
||||
int endIndex = startIndex + ELEMENTS_PER_PAGE;
|
||||
|
||||
gadgets = gadgets.subList(startIndex, Math.min(endIndex, gadgets.size()));
|
||||
|
||||
for (Gadget gadget : gadgets)
|
||||
{
|
||||
if (gadget.isHidden())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getDisplayName()) > 0)
|
||||
if (gadget.isActive(getPlayer()))
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
if (++slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||
if (_page != 0)
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
addButton(45, new ShopItem(Material.ARROW, C.cGreen + "Previous Page", new String[0], 1, false), (player, clickType) ->
|
||||
{
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
|
||||
}
|
||||
});
|
||||
_page--;
|
||||
refresh();
|
||||
});
|
||||
}
|
||||
if (endIndex <= gadgets.size())
|
||||
{
|
||||
addButton(53, new ShopItem(Material.ARROW, C.cGreen + "Next Page", new String[0], 1, false), (player, clickType) ->
|
||||
{
|
||||
_page++;
|
||||
refresh();
|
||||
});
|
||||
}
|
||||
|
||||
addBackButton();
|
||||
}
|
||||
|
||||
protected List<Gadget> getGadgetsToDisplay()
|
||||
{
|
||||
return getPlugin().getGadgetManager().getGadgets(_gadgetType);
|
||||
}
|
||||
|
||||
protected void addBackButton()
|
||||
{
|
||||
addBackButton(4);
|
||||
}
|
||||
|
||||
protected void addBackButton(int slot)
|
||||
{
|
||||
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)));
|
||||
}
|
||||
|
||||
protected void addGadget(Gadget gadget, int slot)
|
||||
@ -94,274 +132,178 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
protected void addGadget(Gadget gadget, int slot, boolean locked)
|
||||
{
|
||||
|
||||
List<String> itemLore = new ArrayList<String>();
|
||||
boolean owns = gadget.ownsGadget(getPlayer());
|
||||
int shardCost = gadget.getCost(GlobalCurrency.TREASURE_SHARD);
|
||||
List<String> itemLore = new ArrayList<>();
|
||||
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.addAll(Arrays.asList(gadget.getDescription()));
|
||||
|
||||
if (gadget.getSet() != null)
|
||||
GadgetSet set = gadget.getSet();
|
||||
if (set != null)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cWhite + gadget.getSet().getName() + " Set");
|
||||
itemLore.add(C.cWhite + set.getName() + " Set");
|
||||
|
||||
//Elements
|
||||
for (Gadget cur : gadget.getSet().getGadgets())
|
||||
itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen : C.cDRed) + "▪ " + (cur.isActive(getPlayer()) ? C.cGreen : C.cGray) + cur.getName());
|
||||
{
|
||||
itemLore.add(" " + (cur.ownsGadget(getPlayer()) ? C.cDGreen : C.cDRed) + "▪ " + (cur.isActive(getPlayer()) ? C.cGreen : C.cGray) + cur.getName());
|
||||
}
|
||||
|
||||
itemLore.add(C.cBlack);
|
||||
|
||||
//Bonus
|
||||
itemLore.add(C.cWhite + gadget.getSet().getName() + " Set Bonus");
|
||||
for (String bonus : gadget.getSet().getBonus())
|
||||
itemLore.add(" " + (gadget.getSet().isActive(getPlayer()) ? C.cGreen : C.cGray) + bonus);
|
||||
itemLore.add(C.cWhite + set.getName() + " Set Bonus");
|
||||
for (String bonus : set.getBonus())
|
||||
{
|
||||
itemLore.add(" " + (set.isActive(getPlayer()) ? C.cGreen : C.cGray) + bonus);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gadget.ownsGadget(getPlayer()) || locked)
|
||||
if (!owns || locked)
|
||||
{
|
||||
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -1)
|
||||
int displayedShardCost = shardCost;
|
||||
|
||||
if (displayedShardCost > 0)
|
||||
{
|
||||
//Nothing
|
||||
}
|
||||
//Chest Unlocks
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -2 || gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Treasure Chests");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -3)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -4)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -5)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -6)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Valentines Gifts");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -7)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Purchased from shop.mineplex.com");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -8)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Freedom Chests");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -9)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Haunted Chests");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -14)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
YearMonth yearMonth = gadget.getYearMonth();
|
||||
if (yearMonth != null)
|
||||
{
|
||||
int year = yearMonth.getYear();
|
||||
Month month = yearMonth.getMonth();
|
||||
String monthName = month.getDisplayName(TextStyle.FULL, Locale.US);
|
||||
itemLore.addAll(UtilText.splitLine(C.cBlue + "Monthly Power Play Club Reward for " + monthName + " " + year, LineFormat.LORE));
|
||||
}
|
||||
else
|
||||
{
|
||||
itemLore.add(C.cBlue + "Bonus Item Unlocked with Power Play Club");
|
||||
}
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -16)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Gingerbread Chests");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -17)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Love Chests");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -18)
|
||||
{
|
||||
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");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -20)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in HOG Chests");
|
||||
displayedShardCost = CostConstants.FOUND_IN_TREASURE_CHESTS;
|
||||
}
|
||||
|
||||
//Rank Unlocks
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10)
|
||||
switch (displayedShardCost)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -11)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -12)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -13)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cRed + "Unlocked with Titan Rank");
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -15)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cDAqua + "Unlocked with Eternal Rank");
|
||||
|
||||
// Nothing
|
||||
case CostConstants.NO_LORE:
|
||||
break;
|
||||
|
||||
// Chests
|
||||
case CostConstants.FOUND_IN_TREASURE_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Treasure Chests");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_WINTER_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_HALLOWEEN_PUMPKIN_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_EASTER_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_VALENTINES_GIFTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Valentines Gifts");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_FREEDOM_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Freedom Chests");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_HAUNTED_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Haunted Chests");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_GINGERBREAD_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Gingerbread Chests");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_LOVE_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Love Chests");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_ST_PATRICKS_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in St Patrick's Chests");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_SPRING_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Spring Chests");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_MOBA_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in HOG Chests");
|
||||
break;
|
||||
|
||||
case CostConstants.FOUND_IN_THANKFUL_CHESTS:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Thankful Treasure");
|
||||
break;
|
||||
|
||||
// Ranks
|
||||
case CostConstants.UNLOCKED_WITH_ULTRA:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
|
||||
break;
|
||||
|
||||
case CostConstants.UNLOCKED_WITH_HERO:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
|
||||
break;
|
||||
|
||||
case CostConstants.UNLOCKED_WITH_LEGEND:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
|
||||
break;
|
||||
|
||||
case CostConstants.UNLOCKED_WITH_TITAN:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cRed + "Unlocked with Titan Rank");
|
||||
break;
|
||||
|
||||
case CostConstants.UNLOCKED_WITH_ETERNAL:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cDAqua + "Unlocked with Eternal Rank");
|
||||
break;
|
||||
|
||||
// Special
|
||||
case CostConstants.POWERPLAY_BONUS:
|
||||
itemLore.add(C.cBlack);
|
||||
|
||||
YearMonth yearMonth = gadget.getYearMonth();
|
||||
if (yearMonth != null)
|
||||
{
|
||||
int year = yearMonth.getYear();
|
||||
Month month = yearMonth.getMonth();
|
||||
String monthName = month.getDisplayName(TextStyle.FULL, Locale.US);
|
||||
itemLore.addAll(UtilText.splitLine(C.cBlue + "Monthly Power Play Club Reward for " + monthName + " " + year, LineFormat.LORE));
|
||||
}
|
||||
else
|
||||
{
|
||||
itemLore.add(C.cBlue + "Bonus Item Unlocked with Power Play Club");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case CostConstants.PURCHASED_FROM_STORE:
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Purchased from mineplex.com/shop");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Special case for item gadgets!
|
||||
if (gadget instanceof ItemGadget)
|
||||
{
|
||||
ItemGadget itemGadget = (ItemGadget)gadget;
|
||||
addCustomLore(gadget, itemLore);
|
||||
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getName()));
|
||||
|
||||
// boolean canAffordAmmo = true;
|
||||
// if (itemGadget.getAmmo().getCost(GlobalCurrency.Coins) > 0)
|
||||
// {
|
||||
// itemLore.add(C.cBlack);
|
||||
// itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().getDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().getCost(GlobalCurrency.Coins) + " Coins");
|
||||
//
|
||||
// if (getDonationManager().Get(getPlayer().getName()).getBalance(GlobalCurrency.Coins) >= itemGadget.getAmmo().getCost(GlobalCurrency.Coins))
|
||||
// {
|
||||
// itemLore.add(C.cGreen + "Right-Click To Purchase");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// itemLore.add(C.cRed + "Not Enough Treasure Shards.");
|
||||
// canAffordAmmo = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (itemGadget.hasAmmo(getPlayer()))
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Left-Click to Enable");
|
||||
|
||||
addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new ActivateGadgetButton(gadget, this));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(gadget instanceof HatGadget)
|
||||
{
|
||||
ItemStack item = ((HatGadget)gadget).getHelmetItem();
|
||||
|
||||
ItemMeta im = item.getItemMeta();
|
||||
im.setDisplayName(C.cGreen + C.Bold + gadget.getName());
|
||||
|
||||
if (gadget.ownsGadget(getPlayer()) && !locked)
|
||||
{
|
||||
if (gadget.getActive().contains(getPlayer()))
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Disable");
|
||||
|
||||
im.setLore(itemLore);
|
||||
item.setItemMeta(im);
|
||||
addButton(slot, new ShopItem(item, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Enable");
|
||||
|
||||
im.setLore(itemLore);
|
||||
item.setItemMeta(im);
|
||||
addButton(slot, new ShopItem(item, false, false).hideInfo(), new ActivateGadgetButton(gadget, this));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(GlobalCurrency.TREASURE_SHARD) + " Treasure Shards");
|
||||
}
|
||||
|
||||
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD) >= gadget.getCost(GlobalCurrency.TREASURE_SHARD))
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(GlobalCurrency.TREASURE_SHARD) + " Treasure Shards");
|
||||
}
|
||||
|
||||
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD) >= gadget.getCost(GlobalCurrency.TREASURE_SHARD))
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Purchase");
|
||||
|
||||
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this));
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cRed + "Not enough Treasure Shards.");
|
||||
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
|
||||
}
|
||||
else
|
||||
{
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Standard
|
||||
if (gadget.ownsGadget(getPlayer()) && !locked)
|
||||
if (owns && !locked)
|
||||
{
|
||||
ItemStack gadgetItemStack;
|
||||
/*if (gadget instanceof MorphWitch)
|
||||
{
|
||||
gadgetItemStack = ((MorphWitch) gadget).getWitchItem();
|
||||
}
|
||||
else if (gadget instanceof DeathPresentDanger)
|
||||
{
|
||||
gadgetItemStack = SkinData.PRESENT.getSkull();
|
||||
}
|
||||
else
|
||||
{
|
||||
gadgetItemStack = new ItemStack(gadget.getDisplayMaterial(), 1, gadget.getDisplayData());
|
||||
}
|
||||
|
||||
if (gadget instanceof OutfitFreezeSuit && !(gadget instanceof OutfitFreezeSuitHelmet))
|
||||
{
|
||||
LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) gadgetItemStack.getItemMeta();
|
||||
leatherArmorMeta.setColor(Color.fromRGB(129, 212, 250));
|
||||
gadgetItemStack.setItemMeta(leatherArmorMeta);
|
||||
}*/
|
||||
if (gadget.hasDisplayItem())
|
||||
{
|
||||
gadgetItemStack = gadget.getDisplayItem();
|
||||
@ -372,86 +314,68 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
}
|
||||
|
||||
ItemMeta meta = gadgetItemStack.getItemMeta();
|
||||
meta.setDisplayName(C.cGreen + C.Bold + gadget.getName());
|
||||
if (gadget.getActive().contains(getPlayer()))
|
||||
meta.setDisplayName(C.cGreenB + gadget.getName());
|
||||
itemLore.add(C.cBlack);
|
||||
|
||||
if (gadget.isActive(getPlayer()))
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Disable");
|
||||
|
||||
meta.setLore(itemLore);
|
||||
gadgetItemStack.setItemMeta(meta);
|
||||
|
||||
addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this));
|
||||
itemLore.add(C.cGreen + "Left-Click to Disable");
|
||||
}
|
||||
else
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Enable");
|
||||
itemLore.add(C.cGreen + "Left-Click to Enable");
|
||||
}
|
||||
|
||||
meta.setLore(itemLore);
|
||||
gadgetItemStack.setItemMeta(meta);
|
||||
meta.setLore(itemLore);
|
||||
gadgetItemStack.setItemMeta(meta);
|
||||
|
||||
/*if (gadget instanceof MorphStray)
|
||||
addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), (player, clickType) ->
|
||||
{
|
||||
if (clickType.isRightClick())
|
||||
{
|
||||
gadgetItemStack = UtilItem.getVersionSpecificItem(_player, UtilPlayer.PlayerVersion._1_9, gadgetItemStack);
|
||||
}*/
|
||||
|
||||
IButton iButton = new ActivateGadgetButton(gadget, this);
|
||||
|
||||
/*if (gadgetItemStack.getData().getItemType().equals(Material.BARRIER))
|
||||
{
|
||||
iButton = null;
|
||||
handleRightClick(player, gadget);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Does not set the item stack yet
|
||||
//gadgetItemStack.setType(Material.getMaterial(440));
|
||||
}*/
|
||||
|
||||
|
||||
addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), iButton);
|
||||
}
|
||||
toggleGadget(player, gadget);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
|
||||
if (shardCost > 0)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(GlobalCurrency.TREASURE_SHARD) + " Treasure Shards");
|
||||
}
|
||||
|
||||
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD) >= gadget.getCost(GlobalCurrency.TREASURE_SHARD))
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Purchase");
|
||||
if (getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD) >= shardCost)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Purchase");
|
||||
|
||||
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this));
|
||||
}
|
||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cRed + "Not enough Treasure Shards.");
|
||||
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cRed + "Not enough Treasure Shards.");
|
||||
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void addCustomLore(Gadget gadget, List<String> lore)
|
||||
{
|
||||
}
|
||||
|
||||
public void purchaseGadget(final Player player, final Gadget gadget)
|
||||
{
|
||||
//Dont allow purchase!
|
||||
if (gadget instanceof ItemGadget)
|
||||
{
|
||||
ItemGadget itemGadget = (ItemGadget)gadget;
|
||||
|
||||
if (itemGadget.getAmmo().getCost(GlobalCurrency.TREASURE_SHARD) < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
getShop().openPageForPlayer(
|
||||
getPlayer(),
|
||||
new ConfirmationPage<>(
|
||||
@ -460,11 +384,11 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
new SalesPackageProcessor(
|
||||
player,
|
||||
GlobalCurrency.TREASURE_SHARD,
|
||||
(gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget),
|
||||
gadget,
|
||||
getDonationManager(),
|
||||
() ->
|
||||
{
|
||||
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity()));
|
||||
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getName(), gadget.getQuantity());
|
||||
refresh();
|
||||
}
|
||||
),
|
||||
@ -473,41 +397,39 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
);
|
||||
}
|
||||
|
||||
public void toggleGadget(Player player, Gadget gadget)
|
||||
{
|
||||
if (gadget.isActive(player))
|
||||
{
|
||||
deactivateGadget(player, gadget);
|
||||
}
|
||||
else
|
||||
{
|
||||
activateGadget(player, gadget);
|
||||
}
|
||||
}
|
||||
|
||||
public void activateGadget(Player player, Gadget gadget)
|
||||
{
|
||||
// if (gadget instanceof ItemGadget)
|
||||
// {
|
||||
// if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.getName()) <= 0)
|
||||
// {
|
||||
// purchaseGadget(player, gadget);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
playAcceptSound(player);
|
||||
gadget.enable(player);
|
||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget,
|
||||
GadgetChangeEvent.GadgetState.ENABLED);
|
||||
UtilServer.getPluginManager().callEvent(gadgetChangeEvent);
|
||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget, GadgetChangeEvent.GadgetState.ENABLED);
|
||||
UtilServer.CallEvent(gadgetChangeEvent);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void handleRightClick(Player player, Gadget gadget)
|
||||
{
|
||||
// if (gadget instanceof ItemGadget)
|
||||
// {
|
||||
// purchaseGadget(player, gadget);
|
||||
// }
|
||||
player.sendMessage("Preview?");
|
||||
}
|
||||
|
||||
public void deactivateGadget(Player player, Gadget gadget)
|
||||
{
|
||||
playAcceptSound(player);
|
||||
gadget.disable(player);
|
||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget,
|
||||
GadgetChangeEvent.GadgetState.DISABLED);
|
||||
UtilServer.getPluginManager().callEvent(gadgetChangeEvent);
|
||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget, GadgetChangeEvent.GadgetState.DISABLED);
|
||||
UtilServer.CallEvent(gadgetChangeEvent);
|
||||
refresh();
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class HatPage extends GadgetPage
|
||||
{
|
||||
|
||||
|
||||
public HatPage(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;
|
||||
|
||||
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.HAT);
|
||||
if(list != null)
|
||||
for (Gadget gadget : list)
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.HAT) == gadget)
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.shop.confirmation.ConfirmationPage;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
|
||||
public class ItemGadgetPage extends GadgetPage
|
||||
{
|
||||
|
||||
public ItemGadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player, GadgetType.ITEM);
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addCustomLore(Gadget gadget, List<String> lore)
|
||||
{
|
||||
lore.add(C.cBlack);
|
||||
lore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purchaseGadget(Player player, Gadget gadget)
|
||||
{
|
||||
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemGadget itemGadget = (ItemGadget) gadget;
|
||||
|
||||
if (itemGadget.getAmmo() != null && itemGadget.getAmmo().getCost(GlobalCurrency.TREASURE_SHARD) <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
getShop().openPageForPlayer(
|
||||
getPlayer(),
|
||||
new ConfirmationPage<>(
|
||||
player,
|
||||
this,
|
||||
new SalesPackageProcessor(
|
||||
player,
|
||||
GlobalCurrency.TREASURE_SHARD,
|
||||
itemGadget.getAmmo(),
|
||||
getDonationManager(),
|
||||
() ->
|
||||
{
|
||||
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), itemGadget.getAmmo().getName(), itemGadget.getAmmo().getQuantity());
|
||||
refresh();
|
||||
}
|
||||
),
|
||||
gadget.buildIcon()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class KitSelectorPage extends GadgetPage
|
||||
{
|
||||
public KitSelectorPage(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 (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.KIT_SELECTOR))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.KIT_SELECTOR) == gadget)
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,50 +1,41 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mineplex.core.common.util.banner.CountryFlag;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenFlags;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BannerMeta;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.banner.CountryFlag;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenArrowTrails;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenBalloons;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenCostumes;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenDeathAnimations;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenDoubleJump;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenGadgets;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenGameModifiers;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenHats;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenMorphs;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenMounts;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenMusic;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenParticles;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenItems;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenPets;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenKitSelector;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenTaunts;
|
||||
import mineplex.core.cosmetic.ui.button.open.OpenWinEffect;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||
import mineplex.core.gadget.event.GadgetChangeEvent.GadgetState;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.pet.PetType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BannerMeta;
|
||||
|
||||
public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
@ -53,10 +44,13 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
private static final String VISIBILITY_EVERYWHERE = "Visible Everywhere";
|
||||
private static final String VISIBILITY_GAMES = "Visible in Games";
|
||||
private static final String VISIBILITY_GAME_HUB = "Visible in Game Lobbies";
|
||||
private static final ItemStack PANE = new ItemBuilder(Material.STAINED_GLASS_PANE, (byte) 3)
|
||||
.setTitle(C.cBlack)
|
||||
.build();
|
||||
|
||||
public Menu(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Inventory", player);
|
||||
super(plugin, shop, clientManager, donationManager, "Cosmetics", player);
|
||||
|
||||
buildPage();
|
||||
}
|
||||
@ -67,7 +61,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
// Treasure Shards
|
||||
int treasureShards = getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD);
|
||||
|
||||
List<String> shardLore = new ArrayList<String>();
|
||||
List<String> shardLore = new ArrayList<>();
|
||||
shardLore.add(" ");
|
||||
shardLore.add(C.cGray + "These seem like they might come in");
|
||||
shardLore.add(C.cGray + "handy. Maybe I should collect more!");
|
||||
@ -92,24 +86,10 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
int flagSlot = 34;
|
||||
int morphSlot = 25;
|
||||
int costumeSlot = 16;
|
||||
int powerPlaySlot = 40;
|
||||
|
||||
addItem(shardSlot, shards);
|
||||
|
||||
ItemStack pane = new ItemBuilder(Material.STAINED_GLASS_PANE).setData((byte)15).setTitle(C.cBlack).build();
|
||||
for (int i = 0; i <= 45; i += 9) addItem(i, pane.clone());
|
||||
for (int i = 8; i <= 53; i += 9) addItem(i, pane.clone());
|
||||
for (int i = 37; i <= 43; ++i) addItem(i, pane.clone());
|
||||
for (int i = 2; i <= 6; ++i) addItem(i, pane.clone());
|
||||
for (int i = 11; i <= 29; i += 9) addItem(i, pane.clone());
|
||||
for (int i = 15; i <= 33; i += 9) addItem(i, pane.clone());
|
||||
addItem(12, pane.clone());
|
||||
addItem(14, pane.clone());
|
||||
addItem(30, pane.clone());
|
||||
addItem(32, pane.clone());
|
||||
addItem(46, pane.clone());
|
||||
addItem(52, pane.clone());
|
||||
|
||||
|
||||
EnumMap<GadgetType, Integer> ownedCount = new EnumMap<>(GadgetType.class);
|
||||
EnumMap<GadgetType, Integer> maxCount = new EnumMap<>(GadgetType.class);
|
||||
EnumMap<GadgetType, Gadget> enabled = new EnumMap<>(GadgetType.class);
|
||||
@ -137,19 +117,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
if(gadget != null) enabled.put(type, gadget);
|
||||
}
|
||||
|
||||
int mountOwned = 0;
|
||||
int mountMax = 0;
|
||||
Mount<?> mountActive = getPlugin().getMountManager().getActive(getPlayer());
|
||||
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
|
||||
{
|
||||
if (getDonationManager().Get(getPlayer()).ownsUnknownSalesPackage(mount.getName()))
|
||||
{
|
||||
mountOwned++;
|
||||
}
|
||||
|
||||
mountMax++;
|
||||
}
|
||||
|
||||
int petOwned = 0;
|
||||
int petMax = 0;
|
||||
for (PetType type : PetType.values())
|
||||
@ -166,37 +133,38 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
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));
|
||||
addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this, enabled.get(type)));
|
||||
addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(particleSlot);
|
||||
|
||||
type = GadgetType.ARROW_TRAIL;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", VISIBILITY_GAMES, enabled.get(type));
|
||||
addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Effects", lore, 1, false), new OpenArrowTrails(this, enabled.get(type)));
|
||||
addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Effects", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(arrowSlot);
|
||||
|
||||
type = GadgetType.DOUBLE_JUMP;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", VISIBILITY_EVERYWHERE, enabled.get(type));
|
||||
addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this, enabled.get(type)));
|
||||
addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(jumpSlot);
|
||||
|
||||
type = GadgetType.DEATH;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", VISIBILITY_GAMES, enabled.get(type));
|
||||
addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this, enabled.get(type)));
|
||||
addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(deathSlot);
|
||||
|
||||
type = GadgetType.ITEM;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", VISIBILITY_HUB, enabled.get(type));
|
||||
addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type)));
|
||||
addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenItems(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(gadgetSlot);
|
||||
|
||||
type = GadgetType.MORPH;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Have you ever wanted to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", VISIBILITY_HUB, enabled.get(type));
|
||||
addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type)));
|
||||
addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(morphSlot);
|
||||
|
||||
lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", VISIBILITY_HUB, mountActive == null ? null : mountActive.getName(), false);
|
||||
addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this, mountActive));
|
||||
if (mountActive != null) addGlow(mountSlot);
|
||||
type = GadgetType.MOUNT;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Why walk when you can ride? Summon fancy mounts to help you move in style.", VISIBILITY_HUB, enabled.get(type));
|
||||
addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(mountSlot);
|
||||
|
||||
lore = getLore(petOwned, petMax, "Life on a server can get lonely sometimes. Summon an adorable pet to follow you around and cheer you up!", VISIBILITY_HUB, petActive == null ? null : petActive.getCustomName(), false);
|
||||
addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this));
|
||||
@ -204,7 +172,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
type = GadgetType.HAT;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the others.", VISIBILITY_HUB, enabled.get(type));
|
||||
addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type)));
|
||||
addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(hatSlot);
|
||||
|
||||
type = GadgetType.COSTUME;
|
||||
@ -215,38 +183,37 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
type = GadgetType.MUSIC_DISC;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", VISIBILITY_HUB, enabled.get(type));
|
||||
addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type)));
|
||||
addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(musicSlot);
|
||||
|
||||
type = GadgetType.TAUNT;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Taunt your enemies or just show off. Use /taunt to have a good time!", VISIBILITY_GAMES, enabled.get(type));
|
||||
addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", lore, 1, false), new OpenTaunts(this, enabled.get(type)));
|
||||
addButton(tauntSlot, new ShopItem(Material.NAME_TAG, "Taunts", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(tauntSlot);
|
||||
|
||||
type = GadgetType.WIN_EFFECT;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awesome effects is even more fun!", VISIBILITY_GAMES, enabled.get(type));
|
||||
addButton(winEffectSlot, new ShopItem(Material.CAKE, "Win Effects", lore, 1, false), new OpenWinEffect(this, enabled.get(type)));
|
||||
addButton(winEffectSlot, new ShopItem(Material.CAKE, "Win Effects", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(winEffectSlot);
|
||||
|
||||
|
||||
type = GadgetType.GAME_MODIFIER;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetics which are exclusive to the game you are playing!", VISIBILITY_GAMES, enabled.get(type));
|
||||
addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Cosmetics", lore, 1, false), new OpenGameModifiers(this, enabled.get(type)));
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetics which are exclusive to the game you are playing!", VISIBILITY_GAMES, null);
|
||||
addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Cosmetics", lore, 1, false), new OpenGameModifiers(this, null));
|
||||
if (enabled.containsKey(type)) addGlow(gameModifierSlot);
|
||||
|
||||
type = GadgetType.BALLOON;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Balloons are collectibles that you can float above your head as you wander the lobby. You can have up to 10 balloons in your hand at one time.", VISIBILITY_HUB, enabled.get(type));
|
||||
addButton(balloonsSlot, new ShopItem(Material.LEASH, "Balloons", lore, 1, false), new OpenBalloons(this, enabled.get(type)));
|
||||
addButton(balloonsSlot, new ShopItem(Material.LEASH, "Balloons", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(balloonsSlot);
|
||||
|
||||
type = GadgetType.KIT_SELECTOR;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Click here to select different particles to indicate which kit you have selected!", VISIBILITY_GAME_HUB, enabled.get(type));
|
||||
addButton(kitSelectorSlot, new ShopItem(Material.LEVER, "Kit Selector Particles", lore, 1, false), new OpenKitSelector(this, enabled.get(type)));
|
||||
addButton(kitSelectorSlot, new ShopItem(Material.LEVER, "Kit Selector Particles", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(kitSelectorSlot);
|
||||
|
||||
type = GadgetType.FLAG;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Show off your country's flag!", VISIBILITY_HUB, enabled.get(type));
|
||||
addButton(flagSlot, new ShopItem(Material.BANNER, "Flags", lore, 1, false), new OpenFlags(this, enabled.get(type)));
|
||||
addButton(flagSlot, new ShopItem(Material.BANNER, "Flags", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(flagSlot);
|
||||
|
||||
// Copy over banner design
|
||||
@ -256,6 +223,35 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
meta.setPatterns(banner.getPatterns());
|
||||
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
getItem(flagSlot).setItemMeta(meta);
|
||||
|
||||
List<Gadget> powerPlayGadgets = getPlugin().getGadgetManager().getPowerPlayGadgets();
|
||||
int ownedPowerPlay = 0;
|
||||
int maxPowerPlay = powerPlayGadgets.size();
|
||||
for (Gadget gadget : powerPlayGadgets)
|
||||
{
|
||||
if (gadget.ownsGadget(getPlayer()))
|
||||
{
|
||||
ownedPowerPlay++;
|
||||
}
|
||||
}
|
||||
|
||||
lore = getLore(ownedPowerPlay, maxPowerPlay, "View all of the Power Play Club Rewards!", VISIBILITY_EVERYWHERE, null);
|
||||
addButton(powerPlaySlot, new ShopItem(Material.DIAMOND, "Power Play Club Rewards", lore, 1, false), (player, clickType) ->
|
||||
{
|
||||
if (clickType.isLeftClick())
|
||||
{
|
||||
GadgetPage page = new PowerPlayClubPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer());
|
||||
getShop().openPageForPlayer(player, page);
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < getSize(); i++)
|
||||
{
|
||||
if (getItem(i) == null)
|
||||
{
|
||||
setItem(i, PANE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled)
|
||||
@ -314,13 +310,42 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
}
|
||||
}
|
||||
|
||||
private IButton generateButton(GadgetType type, Gadget active)
|
||||
{
|
||||
return (player, clickType) ->
|
||||
{
|
||||
if (active != null && clickType.isRightClick())
|
||||
{
|
||||
playAcceptSound(player);
|
||||
active.disable(player);
|
||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, active, GadgetState.DISABLED);
|
||||
UtilServer.CallEvent(gadgetChangeEvent);
|
||||
refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
GadgetPage page = new GadgetPage(
|
||||
getPlugin(),
|
||||
getShop(),
|
||||
getClientManager(),
|
||||
getDonationManager(),
|
||||
type.getCategoryType(),
|
||||
player,
|
||||
type
|
||||
);
|
||||
page.buildPage();
|
||||
|
||||
getShop().openPageForPlayer(player, page);
|
||||
};
|
||||
}
|
||||
|
||||
public void openCostumes(Player player)
|
||||
{
|
||||
getShop().openPageForPlayer(player, new CostumePage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Costumes", player));
|
||||
}
|
||||
|
||||
public void openMusic(Player player)
|
||||
public void openItems(Player player)
|
||||
{
|
||||
getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player));
|
||||
getShop().openPageForPlayer(player, new ItemGadgetPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Item Gadgets", player));
|
||||
}
|
||||
}
|
||||
|
@ -1,78 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.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;
|
||||
|
||||
public class MorphPage extends GadgetPage
|
||||
{
|
||||
|
||||
private static final int ELEMENTS_PER_PAGE = 28;
|
||||
|
||||
private int _page;
|
||||
|
||||
public MorphPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
int startIndex = _page * ELEMENTS_PER_PAGE;
|
||||
int endIndex = startIndex + ELEMENTS_PER_PAGE;
|
||||
List<Gadget> gadgets = getPlugin().getGadgetManager().getGadgets(GadgetType.MORPH);
|
||||
|
||||
gadgets = gadgets.subList(startIndex, Math.min(endIndex, gadgets.size()));
|
||||
|
||||
int slot = 10;
|
||||
Gadget active = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH);
|
||||
|
||||
for (Gadget gadget : gadgets)
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (active != null && active.equals(gadget) && !(gadget instanceof MorphBlock))
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
if (++slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (_page != 0)
|
||||
{
|
||||
addButton(45, new ShopItem(Material.ARROW, C.cGreen + "Previous Page", new String[0], 1, false), (player, clickType) ->
|
||||
{
|
||||
clearPage();
|
||||
_page--;
|
||||
buildPage();
|
||||
});
|
||||
}
|
||||
if (endIndex <= gadgets.size())
|
||||
{
|
||||
addButton(53, new ShopItem(Material.ARROW, C.cGreen + "Next Page", new String[0], 1, false), (player, clickType) ->
|
||||
{
|
||||
clearPage();
|
||||
_page++;
|
||||
buildPage();
|
||||
});
|
||||
}
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)));
|
||||
}
|
||||
}
|
@ -1,209 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.time.Month;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.TextStyle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.cosmetic.ui.button.MountButton;
|
||||
import mineplex.core.cosmetic.ui.button.activate.ActivateMountButton;
|
||||
import mineplex.core.cosmetic.ui.button.deactivate.DeactivateMountButton;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
|
||||
public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player, 54);
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
protected void buildPage()
|
||||
{
|
||||
int slot = 10;
|
||||
|
||||
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
|
||||
{
|
||||
addMount(mount, slot);
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void addMount(Mount<?> mount, int slot)
|
||||
{
|
||||
List<String> itemLore = new ArrayList<String>();
|
||||
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.addAll(Arrays.asList(mount.getDescription()));
|
||||
|
||||
if (!getDonationManager().Get(getPlayer()).ownsUnknownSalesPackage(mount.getName()))
|
||||
{
|
||||
if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -1)
|
||||
{
|
||||
//Nothing
|
||||
}
|
||||
//Chest Unlocks
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -2 || mount.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Treasure Chests");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -3)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -4)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -5)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -6)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Valentines Holiday Treasure");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -7)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Freedom Chests");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -9)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Haunted Chests");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -15)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in Thankful Treasure");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -18)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cBlue + "Found in St Patrick's Chests");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -14)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
YearMonth yearMonth = mount.getYearMonth();
|
||||
if (yearMonth != null)
|
||||
{
|
||||
int year = yearMonth.getYear();
|
||||
Month month = yearMonth.getMonth();
|
||||
String monthName = month.getDisplayName(TextStyle.FULL, Locale.US);
|
||||
itemLore.addAll(UtilText.splitLine(C.cBlue + "Monthly Power Play Club Reward for " + monthName + " " + year, LineFormat.LORE));
|
||||
}
|
||||
else
|
||||
{
|
||||
itemLore.add(C.cBlue + "Found in Power Play Club");
|
||||
}
|
||||
}
|
||||
|
||||
//Rank Unlocks
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -10)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -11)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -12)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -13)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cRed + "Unlocked with Titan Rank");
|
||||
}
|
||||
}
|
||||
|
||||
if (getDonationManager().Get(getPlayer()).ownsUnknownSalesPackage(mount.getName()))
|
||||
{
|
||||
if (mount.getActive().containsKey(getPlayer()))
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Disable");
|
||||
|
||||
addButton(slot, new ShopItem(mount.getDisplayMaterial(), mount.getDisplayData(), mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this));
|
||||
}
|
||||
else
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Enable");
|
||||
|
||||
addButton(slot, new ShopItem(mount.getDisplayMaterial(), mount.getDisplayData(), mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mount.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.getCost(GlobalCurrency.TREASURE_SHARD) + " Treasure Shards");
|
||||
}
|
||||
|
||||
if (mount.getCost(GlobalCurrency.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD) >= mount.getCost(GlobalCurrency.TREASURE_SHARD))
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Purchase");
|
||||
|
||||
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this));
|
||||
}
|
||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cRed + "Not enough Treasure Shards.");
|
||||
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class MusicPage extends GadgetPage
|
||||
{
|
||||
public MusicPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
}
|
||||
|
||||
protected void buildPage()
|
||||
{
|
||||
int slot = 10;
|
||||
|
||||
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MUSIC_DISC))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activateGadget(Player player, Gadget gadget)
|
||||
{
|
||||
super.activateGadget(player, gadget);
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class ParticlePage extends GadgetPage
|
||||
{
|
||||
public ParticlePage(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 (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.PARTICLE))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.PARTICLE) == gadget)
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class PowerPlayClubPage extends GadgetPage
|
||||
{
|
||||
|
||||
PowerPlayClubPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Power Play Club Rewards", player);
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Gadget> getGadgetsToDisplay()
|
||||
{
|
||||
return getPlugin().getGadgetManager().getPowerPlayGadgets();
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class TauntPage extends GadgetPage
|
||||
{
|
||||
|
||||
|
||||
public TauntPage(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;
|
||||
|
||||
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.TAUNT);
|
||||
if(list != null)
|
||||
for (Gadget gadget : list)
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.TAUNT) == gadget)
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
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.wineffect.rankrooms.WinEffectRankBased;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class WinEffectPage extends GadgetPage
|
||||
{
|
||||
|
||||
public WinEffectPage(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 (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WIN_EFFECT))
|
||||
{
|
||||
if (gadget instanceof WinEffectRankBased)
|
||||
{
|
||||
WinEffectRankBased rankBased = (WinEffectRankBased) gadget;
|
||||
if (getClientManager().Get(getPlayer()).GetRank().has(rankBased.getRank()))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
addGadget(gadget, slot, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
}
|
||||
|
||||
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WIN_EFFECT) == gadget)
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot % 9 == 8)
|
||||
{
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -25,7 +25,7 @@ public class GameCosmeticCategoryPage extends GadgetPage
|
||||
|
||||
public GameCosmeticCategoryPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, GameCosmeticType type, List<GameCosmeticCategory> categories)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, type.getName(), player, false);
|
||||
super(plugin, shop, clientManager, donationManager, type.getName(), player, null);
|
||||
|
||||
_categories = categories;
|
||||
|
||||
@ -71,7 +71,7 @@ public class GameCosmeticCategoryPage extends GadgetPage
|
||||
}
|
||||
});
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), new GameCosmeticsPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)));
|
||||
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), new GameCosmeticsPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class GameCosmeticGadgetPage extends GadgetPage
|
||||
|
||||
public GameCosmeticGadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, GameCosmeticCategoryPage previousMenu, GameCosmeticCategory category)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player, false);
|
||||
super(plugin, shop, clientManager, donationManager, name, player, null);
|
||||
|
||||
_previousMenu = previousMenu;
|
||||
_category = category;
|
||||
@ -43,6 +43,6 @@ public class GameCosmeticGadgetPage extends GadgetPage
|
||||
}
|
||||
}
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
|
||||
addButton(4, new ShopItem(Material.BED, C.cGreen + " Go Back", new String[]{}, 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,17 @@
|
||||
package mineplex.core.cosmetic.ui.page.gamemodifiers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilUI;
|
||||
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.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticManager;
|
||||
@ -14,13 +19,6 @@ import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticType;
|
||||
import mineplex.core.gadget.types.GameModifierGadget;
|
||||
import mineplex.core.game.GameDisplay;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class GameCosmeticsPage extends GadgetPage
|
||||
{
|
||||
@ -28,6 +26,8 @@ public class GameCosmeticsPage extends GadgetPage
|
||||
public GameCosmeticsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Game Cosmetics", player);
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -69,7 +69,7 @@ public class GameCosmeticsPage extends GadgetPage
|
||||
addButton(slots[index++], builder.build(), (player, clickType) -> getShop().openPageForPlayer(player, new GameCosmeticCategoryPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), player, entry.getKey(), entry.getValue())));
|
||||
}
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)));
|
||||
addBackButton();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class HeroSkinCategoryPage extends GadgetPage
|
||||
|
||||
public HeroSkinCategoryPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, GameCosmeticCategoryPage previousMenu)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player, false);
|
||||
super(plugin, shop, clientManager, donationManager, name, player, null);
|
||||
|
||||
_previousMenu = previousMenu;
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class HeroSkinGadgetPage extends GadgetPage
|
||||
|
||||
HeroSkinGadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, GadgetPage previousMenu, List<HeroSkinGadgetData> gadgetData)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player, false);
|
||||
super(plugin, shop, clientManager, donationManager, name, player, null);
|
||||
|
||||
_previousMenu = previousMenu;
|
||||
_gadgetData = gadgetData;
|
||||
|
@ -25,12 +25,9 @@ public class DisguiseBlock extends DisguiseBase
|
||||
_blockData = blockData;
|
||||
}
|
||||
|
||||
public DisguiseBlock(Entity entity, Material material, byte data)
|
||||
public DisguiseBlock(Entity entity, Material material, int data)
|
||||
{
|
||||
super(EntityType.FALLING_BLOCK, entity);
|
||||
|
||||
_blockId = material.getId();
|
||||
_blockData = (int) data;
|
||||
this(entity, material.getId(), data);
|
||||
}
|
||||
|
||||
public int GetBlockId()
|
||||
|
@ -23,13 +23,11 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
@ -105,11 +103,11 @@ import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GemHuntersMountGadg
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GemHuntersMountType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.moba.skins.HeroSkinGadget;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.moba.emblems.EmblemGadget;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.moba.emblems.EmblemType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.moba.shopmorph.ShopMorphGadget;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.moba.shopmorph.ShopMorphType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.moba.skins.HeroSkinGadget;
|
||||
import mineplex.core.gadget.gadgets.hat.HatItem;
|
||||
import mineplex.core.gadget.gadgets.hat.HatType;
|
||||
import mineplex.core.gadget.gadgets.item.ItemBatGun;
|
||||
@ -175,6 +173,23 @@ import mineplex.core.gadget.gadgets.morph.moba.MorphDevon;
|
||||
import mineplex.core.gadget.gadgets.morph.moba.MorphHattori;
|
||||
import mineplex.core.gadget.gadgets.morph.moba.MorphLarissa;
|
||||
import mineplex.core.gadget.gadgets.morph.moba.MorphRowena;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountBabyReindeer;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountCake;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountCart;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountChicken;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountDragon;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountFreedomHorse;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountFrost;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountLoveTrain;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountMule;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountNightmareSteed;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountSlime;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountSpider;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountStPatricksHorse;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountTitan;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountUndead;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountValentinesSheep;
|
||||
import mineplex.core.gadget.gadgets.mount.types.MountZombie;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
|
||||
import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitBoots;
|
||||
import mineplex.core.gadget.gadgets.outfit.freezesuit.OutfitFreezeSuitChestplate;
|
||||
@ -239,7 +254,6 @@ import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectTornado;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectWinterWarfare;
|
||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.WinEffectRankBased;
|
||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankEternal;
|
||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankHero;
|
||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankLegend;
|
||||
@ -288,8 +302,6 @@ import mineplex.core.incognito.IncognitoManager;
|
||||
import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
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;
|
||||
@ -299,6 +311,7 @@ import mineplex.core.treasure.TreasureManager;
|
||||
|
||||
public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
|
||||
private final CoreClientManager _clientManager;
|
||||
private final DonationManager _donationManager;
|
||||
private final InventoryManager _inventoryManager;
|
||||
@ -308,7 +321,6 @@ public class GadgetManager extends MiniPlugin
|
||||
private final BlockRestore _blockRestore;
|
||||
private final ProjectileManager _projectileManager;
|
||||
private final AchievementManager _achievementManager;
|
||||
private final MountManager _mountManager;
|
||||
private final PacketHandler _packetManager;
|
||||
private final HologramManager _hologramManager;
|
||||
private final OutfitWindUpSuitBoosterManager _boosterManager;
|
||||
@ -319,8 +331,8 @@ public class GadgetManager extends MiniPlugin
|
||||
private CastleManager _castleManager;
|
||||
|
||||
private Map<GadgetType, List<Gadget>> _gadgets;
|
||||
private List<Gadget> _powerPlayGadgets;
|
||||
private Map<SingleParticleKitSelector.SingleParticleSelectors, Gadget> _singleParticleSelectors;
|
||||
private List<WinEffectRankBased> _rankBasedWinEffects;
|
||||
|
||||
private final Map<Player, Long> _lastMove = new HashMap<>();
|
||||
private final Map<Player, Map<GadgetType, Gadget>> _playerActiveGadgetMap = new HashMap<>();
|
||||
@ -335,12 +347,12 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
private Set<Entity> _gadgetCollideWhitelist = new HashSet<>();
|
||||
|
||||
public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager,
|
||||
MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager,
|
||||
DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager,
|
||||
public GadgetManager(CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager,
|
||||
PetManager petManager, PreferencesManager preferencesManager, DisguiseManager disguiseManager,
|
||||
BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager,
|
||||
PacketHandler packetHandler, HologramManager hologramManager, IncognitoManager incognitoManager, CastleManager castleManager)
|
||||
{
|
||||
super("Gadget Manager", plugin);
|
||||
super("Gadget");
|
||||
|
||||
_clientManager = clientManager;
|
||||
_donationManager = donationManager;
|
||||
@ -352,7 +364,6 @@ public class GadgetManager extends MiniPlugin
|
||||
_projectileManager = projectileManager;
|
||||
_achievementManager = achievementManager;
|
||||
_packetManager = packetHandler;
|
||||
_mountManager = mountManager;
|
||||
_hologramManager = hologramManager;
|
||||
_userGadgetPersistence = new UserGadgetPersistence(this);
|
||||
_boosterManager = new OutfitWindUpSuitBoosterManager(this);
|
||||
@ -404,8 +415,8 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
private void createGadgets()
|
||||
{
|
||||
_gadgets = new HashMap<>();
|
||||
_rankBasedWinEffects = new ArrayList<>();
|
||||
_gadgets = new HashMap<>(200);
|
||||
_powerPlayGadgets = new ArrayList<>();
|
||||
_singleParticleSelectors = new HashMap<>();
|
||||
|
||||
// Items
|
||||
@ -501,6 +512,25 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new MorphLarissa(this));
|
||||
addGadget(new MorphBiff(this));
|
||||
|
||||
// Mounts
|
||||
addGadget(new MountUndead(this));
|
||||
addGadget(new MountFrost(this));
|
||||
addGadget(new MountMule(this));
|
||||
addGadget(new MountDragon(this));
|
||||
addGadget(new MountSlime(this));
|
||||
addGadget(new MountCart(this));
|
||||
addGadget(new MountSpider(this));
|
||||
addGadget(new MountZombie(this));
|
||||
addGadget(new MountTitan(this));
|
||||
addGadget(new MountBabyReindeer(this));
|
||||
addGadget(new MountValentinesSheep(this));
|
||||
addGadget(new MountFreedomHorse(this));
|
||||
addGadget(new MountNightmareSteed(this));
|
||||
addGadget(new MountChicken(this));
|
||||
addGadget(new MountCake(this));
|
||||
addGadget(new MountLoveTrain(this));
|
||||
addGadget(new MountStPatricksHorse(this));
|
||||
|
||||
// Particles
|
||||
addGadget(new ParticleFoot(this));
|
||||
addGadget(new ParticleEmerald(this));
|
||||
@ -802,9 +832,31 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
for (GadgetType gadgetType : GadgetType.values())
|
||||
{
|
||||
if (!_gadgets.containsKey(gadgetType))
|
||||
_gadgets.put(gadgetType, new ArrayList<>());
|
||||
_gadgets.putIfAbsent(gadgetType, new ArrayList<>());
|
||||
}
|
||||
|
||||
for (Gadget gadget : getAllGadgets())
|
||||
{
|
||||
if (gadget.getYearMonth() != null)
|
||||
{
|
||||
_powerPlayGadgets.add(gadget);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort Power Play Gadgets in order of addition
|
||||
_powerPlayGadgets.sort((o1, o2) ->
|
||||
{
|
||||
if (o1.getYearMonth().isAfter(o2.getYearMonth()))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (o1.getYearMonth().equals(o2.getYearMonth()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
});
|
||||
}
|
||||
|
||||
public <T extends Gadget> T getGadget(Class<T> c)
|
||||
@ -846,12 +898,11 @@ public class GadgetManager extends MiniPlugin
|
||||
public void addGadget(Gadget gadget)
|
||||
{
|
||||
if (!_gadgets.containsKey(gadget.getGadgetType()))
|
||||
{
|
||||
_gadgets.put(gadget.getGadgetType(), new ArrayList<>());
|
||||
}
|
||||
|
||||
_gadgets.get(gadget.getGadgetType()).add(gadget);
|
||||
|
||||
if (gadget instanceof WinEffectRankBased)
|
||||
_rankBasedWinEffects.add((WinEffectRankBased) gadget);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -879,6 +930,11 @@ public class GadgetManager extends MiniPlugin
|
||||
return gadgets;
|
||||
}
|
||||
|
||||
public List<Gadget> getPowerPlayGadgets()
|
||||
{
|
||||
return _powerPlayGadgets;
|
||||
}
|
||||
|
||||
public Gadget getGadget(String name, GadgetType gadgetType)
|
||||
{
|
||||
List<Gadget> gadgets = getGadgets(gadgetType);
|
||||
@ -952,18 +1008,6 @@ public class GadgetManager extends MiniPlugin
|
||||
return null;
|
||||
}
|
||||
|
||||
public WinEffectRankBased getRankBasedWinEffect(WinEffectRankBased.WinEffectType winEffectType, Rank rank)
|
||||
{
|
||||
for (WinEffectRankBased winEffectRankBased : _rankBasedWinEffects)
|
||||
{
|
||||
if (winEffectRankBased.getWinEffectType().equals(winEffectType) && winEffectRankBased.getRank().equals(rank))
|
||||
{
|
||||
return winEffectRankBased;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SingleParticleKitSelector getSingleParticleKitSelector(SingleParticleKitSelector.SingleParticleSelectors singleParticleSelectors)
|
||||
{
|
||||
return (SingleParticleKitSelector) _singleParticleSelectors.get(singleParticleSelectors);
|
||||
@ -1137,11 +1181,6 @@ public class GadgetManager extends MiniPlugin
|
||||
return _boosterManager;
|
||||
}
|
||||
|
||||
public MountManager getMountManager()
|
||||
{
|
||||
return _mountManager;
|
||||
}
|
||||
|
||||
public boolean collideEvent(Player shooter, Gadget gadget, Entity other)
|
||||
{
|
||||
GadgetCollideEntityEvent collideEvent = new GadgetCollideEntityEvent(shooter, gadget, other);
|
||||
@ -1333,17 +1372,9 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
_gadgetsEnabled = enabled;
|
||||
disableAll();
|
||||
_mountManager.DisableAll();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMountActivate(MountActivateEvent event)
|
||||
{
|
||||
if (!_gadgetsEnabled)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void chissMeow(PlayerToggleSneakEvent event)
|
||||
{
|
||||
@ -1375,7 +1406,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
if (event.getGadget() instanceof MorphDinnerbone)
|
||||
{
|
||||
if (_mountManager.getActive(player) != null)
|
||||
if (getActive(player, GadgetType.MOUNT) != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
UtilPlayer.message(player, F.main("Cosmetics", "You cannot morph into " + event.getGadget().getName() + " with an active mount!"));
|
||||
@ -1398,6 +1429,7 @@ public class GadgetManager extends MiniPlugin
|
||||
case ITEM:
|
||||
case MORPH:
|
||||
case BALLOON:
|
||||
case MOUNT:
|
||||
return;
|
||||
case COSTUME:
|
||||
OutfitGadget outfitGadget = (OutfitGadget) gadget;
|
||||
|
@ -13,7 +13,6 @@ import mineplex.core.donation.Donor;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.pet.PetType;
|
||||
|
||||
public class LockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
@ -60,7 +59,6 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
{
|
||||
removeCosmetics(type, caller);
|
||||
}
|
||||
removeMounts(caller);
|
||||
removePets(caller);
|
||||
return;
|
||||
}
|
||||
@ -90,26 +88,6 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
UtilPlayer.message(caller, F.main("Lock Cosmetics", "Removed " + removed + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", removed) + "!"));
|
||||
}
|
||||
|
||||
private void removeMounts(Player caller)
|
||||
{
|
||||
Donor donor = _plugin.getDonationManager().Get(caller);
|
||||
int removed = 0;
|
||||
for (Mount<?> mount : _plugin.getMountManager().getMounts())
|
||||
{
|
||||
if (donor.ownsUnknownSalesPackage(mount.getName()))
|
||||
{
|
||||
donor.removeAllOwnedUnknownSalesPackages(mount.getName());
|
||||
removed++;
|
||||
}
|
||||
else if (mount.hasMount(caller))
|
||||
{
|
||||
donor.removeAllOwnedUnknownSalesPackages(mount.getName());
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Lock Cosmetics", "Removed " + removed + UtilText.plural(" Mount", removed) + "!"));
|
||||
}
|
||||
|
||||
private void removePets(Player caller)
|
||||
{
|
||||
int removed = 0;
|
||||
|
@ -1,81 +0,0 @@
|
||||
package mineplex.core.gadget.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord;
|
||||
import mineplex.core.gadget.gadgets.death.DeathCandyCane;
|
||||
import mineplex.core.gadget.gadgets.death.DeathFrostLord;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord;
|
||||
import mineplex.core.gadget.gadgets.hat.HatType;
|
||||
import mineplex.core.gadget.gadgets.item.ItemCoal;
|
||||
import mineplex.core.gadget.gadgets.item.ItemFreezeCannon;
|
||||
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
|
||||
import mineplex.core.gadget.gadgets.item.ItemSnowball;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphSnowman;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleFrostLord;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.mount.Mount;
|
||||
|
||||
public class LockInfusedCommand extends CommandBase<GadgetManager>
|
||||
{
|
||||
|
||||
private GadgetManager _manager;
|
||||
|
||||
public LockInfusedCommand(GadgetManager manager)
|
||||
{
|
||||
super(manager, Rank.JNR_DEV, "lockinfused");
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player player, String args[])
|
||||
{
|
||||
// Hats
|
||||
List<HatType> types = Arrays.asList(HatType.PRESENT, HatType.SNOWMAN, HatType.SANTA, HatType.GRINCH);
|
||||
|
||||
// Mounts
|
||||
Mount<?> mount = _manager.getMountManager().getMount("Baby Reindeer");
|
||||
|
||||
// Others
|
||||
List<Gadget> infusedItems = new ArrayList<>();
|
||||
infusedItems.add(_manager.getGadget(ItemCoal.class));
|
||||
infusedItems.add(_manager.getGadget(ItemFreezeCannon.class));
|
||||
infusedItems.add(_manager.getGadget(ItemPartyPopper.class));
|
||||
infusedItems.add(_manager.getGadget(ItemSnowball.class));
|
||||
infusedItems.add(_manager.getGadget(ArrowTrailCandyCane.class));
|
||||
infusedItems.add(_manager.getGadget(DoubleJumpCandyCane.class));
|
||||
infusedItems.add(_manager.getGadget(DeathCandyCane.class));
|
||||
infusedItems.add(_manager.getGadget(ArrowTrailFrostLord.class));
|
||||
infusedItems.add(_manager.getGadget(DeathFrostLord.class));
|
||||
infusedItems.add(_manager.getGadget(DoubleJumpFrostLord.class));
|
||||
infusedItems.add(_manager.getGadget(MorphSnowman.class));
|
||||
infusedItems.add(_manager.getGadget(ParticleFrostLord.class));
|
||||
|
||||
for (HatType hatType : types)
|
||||
{
|
||||
infusedItems.add(_manager.getHatGadget(hatType));
|
||||
}
|
||||
|
||||
for (Gadget gadget : infusedItems)
|
||||
{
|
||||
_manager.getDonationManager().Get(player).removeAllOwnedUnknownSalesPackages(gadget.getName());
|
||||
for (String possibleName : gadget.getAlternativePackageNames())
|
||||
{
|
||||
_manager.getDonationManager().Get(player).removeAllOwnedUnknownSalesPackages(possibleName);
|
||||
}
|
||||
}
|
||||
|
||||
_manager.getDonationManager().Get(player).removeAllOwnedUnknownSalesPackages(mount.getName());
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -13,35 +13,35 @@ import mineplex.core.donation.Donor;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.gadget.gadgets.mount.Mount;
|
||||
import mineplex.core.pet.PetType;
|
||||
|
||||
public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
{
|
||||
|
||||
private GadgetManager _plugin;
|
||||
private GadgetManager _plugin;
|
||||
|
||||
public UnlockCosmeticsCommand(GadgetManager plugin)
|
||||
{
|
||||
super(plugin, Rank.SNR_MODERATOR, "unlockCosmetics");
|
||||
_plugin = plugin;
|
||||
}
|
||||
public UnlockCosmeticsCommand(GadgetManager plugin)
|
||||
{
|
||||
super(plugin, Rank.SNR_MODERATOR, "unlockCosmetics");
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (!UtilServer.isTestServer())
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (!UtilServer.isTestServer())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "This command requires a test server!"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Adds all cosmetic types
|
||||
if (args.length == 0)
|
||||
{
|
||||
addCosmetics(null, caller);
|
||||
}
|
||||
else if (args.length >= 1)
|
||||
// Adds all cosmetic types
|
||||
if (args.length == 0)
|
||||
{
|
||||
addCosmetics(null, caller);
|
||||
}
|
||||
else if (args.length >= 1)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("all"))
|
||||
{
|
||||
@ -69,7 +69,7 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
}
|
||||
}
|
||||
|
||||
private void addCosmetics(GadgetType gadgetType, Player caller)
|
||||
private void addCosmetics(GadgetType gadgetType, Player caller)
|
||||
{
|
||||
if (gadgetType == null)
|
||||
{
|
||||
@ -77,7 +77,6 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
{
|
||||
addCosmetics(type, caller);
|
||||
}
|
||||
addMounts(caller);
|
||||
addPets(caller);
|
||||
return;
|
||||
}
|
||||
@ -85,51 +84,33 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
int added = 0;
|
||||
for (Gadget gadget : _plugin.getGadgets(gadgetType))
|
||||
{
|
||||
if (gadget != null)
|
||||
if (gadget.isHidden())
|
||||
{
|
||||
boolean hasGadget = false;
|
||||
int i;
|
||||
String[] names = new String[gadget.getAlternativePackageNames().length + 1];
|
||||
for (i = 0; i < gadget.getAlternativePackageNames().length; i++)
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean hasGadget = false;
|
||||
int i;
|
||||
String[] names = new String[gadget.getAlternativePackageNames().length + 1];
|
||||
for (i = 0; i < gadget.getAlternativePackageNames().length; i++)
|
||||
{
|
||||
names[i] = gadget.getAlternativePackageNames()[i];
|
||||
}
|
||||
names[i++] = gadget.getName();
|
||||
for (String name : names)
|
||||
{
|
||||
if (donor.ownsUnknownSalesPackage(name))
|
||||
{
|
||||
names[i] = gadget.getAlternativePackageNames()[i];
|
||||
}
|
||||
names[i++] = gadget.getName();
|
||||
for (String name : names)
|
||||
{
|
||||
if (donor.ownsUnknownSalesPackage(name))
|
||||
{
|
||||
hasGadget = true;
|
||||
}
|
||||
}
|
||||
if (!hasGadget)
|
||||
{
|
||||
donor.addOwnedUnknownSalesPackage(gadget.getName());
|
||||
added++;
|
||||
hasGadget = true;
|
||||
}
|
||||
}
|
||||
if (!hasGadget)
|
||||
{
|
||||
donor.addOwnedUnknownSalesPackage(gadget.getName());
|
||||
added++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added " + added + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", added) + "!"));
|
||||
}
|
||||
|
||||
private void addMounts(Player caller)
|
||||
{
|
||||
Donor donor = _plugin.getDonationManager().Get(caller);
|
||||
int added = 0;
|
||||
for (Mount<?> mount : _plugin.getMountManager().getMounts())
|
||||
{
|
||||
if (!donor.ownsUnknownSalesPackage(mount.getName()))
|
||||
{
|
||||
donor.addOwnedUnknownSalesPackage(mount.getName());
|
||||
added++;
|
||||
}
|
||||
else if (!mount.hasMount(caller))
|
||||
{
|
||||
donor.addOwnedUnknownSalesPackage(mount.getName());
|
||||
added++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added " + added + UtilText.plural(" mount", added) + "!"));
|
||||
}
|
||||
|
||||
private void addPets(Player caller)
|
||||
|
@ -10,6 +10,7 @@ import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.Ammo;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
|
||||
public class ItemDuelingSword extends ItemGadget
|
||||
@ -20,9 +21,11 @@ public class ItemDuelingSword extends ItemGadget
|
||||
{
|
||||
C.cGreen + "Activated in King of the Hill",
|
||||
},
|
||||
-3,
|
||||
CostConstants.NO_LORE,
|
||||
Material.GOLD_SWORD, (byte)0,
|
||||
1000, new Ammo("Dueling Sword", "10 Swords", Material.WOOD_SWORD, (byte)0, new String[] { C.cWhite + "10 Swords to duel with" }, 1000, 10), true);
|
||||
|
||||
setHidden(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,16 +1,11 @@
|
||||
package mineplex.core.gadget.gadgets.item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
@ -23,14 +18,12 @@ import org.bukkit.util.Vector;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetBlockEvent;
|
||||
import mineplex.core.gadget.gadgets.Ammo;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -38,7 +31,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class ItemPaintballGun extends ItemGadget
|
||||
{
|
||||
private HashSet<Projectile> _balls = new HashSet<Projectile>();
|
||||
private Set<Projectile> _balls = new HashSet<>();
|
||||
|
||||
public ItemPaintballGun(GadgetManager manager)
|
||||
{
|
||||
@ -65,12 +58,17 @@ public class ItemPaintballGun extends ItemGadget
|
||||
@EventHandler
|
||||
public void Paint(ProjectileHitEvent event)
|
||||
{
|
||||
Projectile projectile = event.getEntity();
|
||||
|
||||
if (!_balls.remove(event.getEntity()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc = event.getEntity().getLocation();
|
||||
projectile.remove();
|
||||
|
||||
Vector vec = event.getEntity().getVelocity().normalize().multiply(0.05);
|
||||
Location loc = projectile.getLocation();
|
||||
Vector vec = projectile.getVelocity().normalize().multiply(0.05);
|
||||
|
||||
if (vec.length() > 0)
|
||||
{
|
||||
@ -91,24 +89,24 @@ public class ItemPaintballGun extends ItemGadget
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Teleport(PlayerTeleportEvent event)
|
||||
public void enderPearlTeleport(PlayerTeleportEvent event)
|
||||
{
|
||||
if (event.getCause() == TeleportCause.ENDER_PEARL)
|
||||
event.setCancelled(true);
|
||||
if (event.getCause() != TeleportCause.ENDER_PEARL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cleanupBalls(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
for (Iterator<Projectile> ballIterator = _balls.iterator(); ballIterator.hasNext();)
|
||||
{
|
||||
Projectile ball = ballIterator.next();
|
||||
|
||||
if (ball.isDead() || !ball.isValid())
|
||||
ballIterator.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
_balls.removeIf(ball -> ball.isDead() || !ball.isValid());
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.Ammo;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -44,9 +45,11 @@ public class ItemPaintbrush extends ItemGadget
|
||||
{
|
||||
super(manager, "Paintbrush",
|
||||
UtilText.splitLineToArray(C.cWhite + "Unleash your inner Bob Ross! Happy little trees!", LineFormat.LORE),
|
||||
-3,
|
||||
CostConstants.NO_LORE,
|
||||
Material.WOOD_SWORD, (byte)0,
|
||||
200, new Ammo("Paint", "100 Pixels", Material.INK_SACK, (byte)0, new String[] { C.cWhite + "100 Pixels worth of Paint!" }, 500, 100));
|
||||
|
||||
setHidden(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,6 +35,7 @@ public class ItemSnowball extends ItemGadget
|
||||
}
|
||||
, -3, 1));
|
||||
|
||||
setHidden(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -216,7 +216,9 @@ public class MorphBobRoss extends MorphGadget
|
||||
C.cWhite + "to change paint colors.",
|
||||
"",
|
||||
C.cGreen + "Crouch " + C.cWhite + "to say a Bob Ross quote."
|
||||
}, LineFormat.LORE), -14, Material.PAINTING, (byte) 0, YearMonth.of(2017, Month.JUNE));
|
||||
}, LineFormat.LORE), -14, Material.PAINTING, (byte) 0);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2017, Month.JUNE));
|
||||
|
||||
_holograms = holograms;
|
||||
}
|
||||
|
@ -67,9 +67,11 @@ public class MorphDinnerbone extends MorphGadget implements IPacketHandler
|
||||
super(manager, "Over Easy Morph", UtilText.splitLinesToArray(new String[]{
|
||||
C.cGray + "This morph lets you walk around on your head. But be careful, all the blood might go to your head!",
|
||||
}, LineFormat.LORE),
|
||||
-14, Material.EGG, (byte) 0, YearMonth.of(2017, Month.JANUARY));
|
||||
-14, Material.EGG, (byte) 0);
|
||||
|
||||
Managers.require(PacketHandler.class).addPacketHandler(this, PacketHandler.ListenerPriority.LOW, PacketPlayOutNamedEntitySpawn.class, PacketPlayOutEntityDestroy.class);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2017, Month.JANUARY));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,7 +70,9 @@ public class MorphFreedomFighter extends MorphGadget
|
||||
C.cGray + "Fight for your freedom from tyranny and oppressors!",
|
||||
"",
|
||||
C.cGreen + "Hold sneak" + C.cWhite + " to plant a flag of freedom!",
|
||||
}, LineFormat.LORE), -14, Material.CHAINMAIL_CHESTPLATE, (byte) 0, YearMonth.of(2017, Month.JULY));
|
||||
}, LineFormat.LORE), -14, Material.CHAINMAIL_CHESTPLATE, (byte) 0);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2017, Month.JULY));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,9 @@ public class MorphGoldPot extends MorphGadget
|
||||
C.cWhite + "Stand still to hide in place and fill up with treasure. Players who find you will earn a reward!",
|
||||
}, LineFormat.LORE),
|
||||
-14,
|
||||
Material.CAULDRON_ITEM, (byte) 0, YearMonth.of(2017, Month.MARCH));
|
||||
Material.CAULDRON_ITEM, (byte) 0);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2017, Month.MARCH));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,7 +61,9 @@ public class MorphMelonHead extends MorphGadget
|
||||
C.cGray + "Tag other players to build your melon army!",
|
||||
"",
|
||||
C.cGreen + "Left click" + C.cWhite + " players to turn their heads to fruit."
|
||||
}, LineFormat.LORE), -14, Material.MELON, (byte) 0, YearMonth.of(2017, Month.AUGUST));
|
||||
}, LineFormat.LORE), -14, Material.MELON, (byte) 0);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2017, Month.AUGUST));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,9 @@ public class MorphSanta extends MorphGadget
|
||||
C.cWhite + "Left click to deliver a random gift for players who have been Naughty or Nice!",
|
||||
"",
|
||||
C.cRedB + "WARNING: " + ChatColor.RESET + "Delivering a gift uses shards!"
|
||||
}, LineFormat.LORE), -14, Material.STAINED_CLAY, (byte) 14, YearMonth.of(2016, Month.DECEMBER));
|
||||
}, LineFormat.LORE), -14, Material.STAINED_CLAY, (byte) 14);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2016, Month.DECEMBER));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +46,9 @@ public class MorphSquid extends MorphGadget implements IThrown
|
||||
C.cWhite + "Swim to enable Fast Swimming",
|
||||
C.cWhite + "Sneak to shoot a fish above you"
|
||||
}, LineFormat.LORE),
|
||||
-14, Material.INK_SACK, (byte) 0, YearMonth.of(2016, Month.SEPTEMBER));
|
||||
-14, Material.INK_SACK, (byte) 0);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2016, Month.SEPTEMBER));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +32,9 @@ public class MorphTurkey extends MorphGadget
|
||||
C.blankLine,
|
||||
C.cWhite + "Sneak to gobble."
|
||||
},
|
||||
LineFormat.LORE), -14, Material.COOKED_CHICKEN, (byte) 0, YearMonth.of(2016, Month.NOVEMBER));
|
||||
LineFormat.LORE), -14, Material.COOKED_CHICKEN, (byte) 0);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2016, Month.NOVEMBER));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,7 +34,10 @@ public class MorphWitch extends MorphGadget
|
||||
super(manager, "Witch Morph", UtilText.splitLinesToArray(new String[]{
|
||||
C.cWhite + "Press sneak to summon your trusty bat and start brewing"
|
||||
}, LineFormat.LORE),
|
||||
-14, Material.SKULL_ITEM, (byte) 3, YearMonth.of(2016, Month.OCTOBER));
|
||||
-14, Material.GLASS, (byte) 0);
|
||||
|
||||
setDisplayItem(SkinData.WITCH.getSkull());
|
||||
setPPCYearMonth(YearMonth.of(2016, Month.OCTOBER));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,12 +34,12 @@ import mineplex.core.disguise.disguises.DisguiseBase;
|
||||
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||
import mineplex.core.gadget.gadgets.mount.DragonMount;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.inventory.ClientItem;
|
||||
import mineplex.core.inventory.data.Item;
|
||||
import mineplex.core.mount.DragonMount;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.mount.types.MountDragon;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -63,11 +63,11 @@ public class MorphWither extends MorphGadget
|
||||
@Override
|
||||
public void enableCustom(final Player player, boolean message)
|
||||
{
|
||||
Mount<?> mount = Manager.getMountManager().getActive(player);
|
||||
if (mount instanceof DragonMount)
|
||||
Gadget mount = Manager.getActive(player, GadgetType.MOUNT);
|
||||
if (mount != null && mount instanceof DragonMount)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gadget", "You cannot enable the " + F.elem(mount.getName()) + " and the " + F.elem(getName()) + " at the same time"));
|
||||
Manager.getMountManager().DeregisterAll(player);
|
||||
Manager.removeActive(player, mount);
|
||||
}
|
||||
this.applyArmor(player, message);
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
package mineplex.core.mount;
|
||||
package mineplex.core.gadget.gadgets.mount;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon;
|
||||
@ -15,35 +14,28 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
||||
public class DragonData extends MountData
|
||||
{
|
||||
DragonMount Host;
|
||||
|
||||
public EnderDragon Dragon;
|
||||
|
||||
public Entity TargetEntity = null;
|
||||
|
||||
public Location Location = null;
|
||||
|
||||
public float Pitch = 0;
|
||||
public Vector Velocity = new Vector(0,0,0);
|
||||
public Vector Velocity = new Vector(0, 0, 0);
|
||||
|
||||
public Chicken Chicken;
|
||||
|
||||
public DragonData(DragonMount dragonMount, Player rider)
|
||||
{
|
||||
super(rider);
|
||||
Host = dragonMount;
|
||||
|
||||
Velocity = rider.getLocation().getDirection().setY(0).normalize();
|
||||
Pitch = UtilAlg.GetPitch(rider.getLocation().getDirection());
|
||||
|
||||
Location = rider.getLocation();
|
||||
|
||||
|
||||
//Spawn Dragon
|
||||
Dragon = rider.getWorld().spawn(rider.getLocation(), EnderDragon.class);
|
||||
UtilEnt.vegetate(Dragon);
|
||||
@ -52,24 +44,17 @@ public class DragonData extends MountData
|
||||
rider.getWorld().playSound(rider.getLocation(), Sound.ENDERDRAGON_GROWL, 20f, 1f);
|
||||
|
||||
Chicken = rider.getWorld().spawn(rider.getLocation(), Chicken.class);
|
||||
Chicken.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 1));
|
||||
Chicken.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1));
|
||||
Dragon.setPassenger(Chicken);
|
||||
|
||||
Chicken.setPassenger(getOwner());
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(Host.Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Chicken.setPassenger(getOwner());
|
||||
}
|
||||
}, 10L);
|
||||
UtilServer.runSyncLater(() -> Chicken.setPassenger(getOwner()), 10);
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
getOwner().eject();
|
||||
((CraftEnderDragon)Dragon).getHandle().setTargetBlock(GetTarget().getBlockX(), GetTarget().getBlockY(), GetTarget().getBlockZ());
|
||||
((CraftEnderDragon) Dragon).getHandle().setTargetBlock(GetTarget().getBlockX(), GetTarget().getBlockY(), GetTarget().getBlockZ());
|
||||
}
|
||||
|
||||
public Location GetTarget()
|
||||
@ -80,9 +65,6 @@ public class DragonData extends MountData
|
||||
@Override
|
||||
public List<Entity> getEntityParts()
|
||||
{
|
||||
List<Entity> list = new ArrayList<Entity>();
|
||||
list.add(Dragon);
|
||||
list.add(Chicken);
|
||||
return list;
|
||||
return Arrays.asList(Dragon, Chicken);
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package mineplex.core.gadget.gadgets.mount;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphWither;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
|
||||
public class DragonMount extends Mount<DragonData>
|
||||
{
|
||||
|
||||
public DragonMount(GadgetManager manager, String name, String[] desc, int cost, Material material, byte materialData)
|
||||
{
|
||||
super(manager, name, desc, cost, material, materialData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableCustom(Player player, boolean message)
|
||||
{
|
||||
Gadget morph = Manager.getActive(player, GadgetType.MORPH);
|
||||
|
||||
if (morph instanceof MorphWither)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gadget", "You cannot enable the " + F.elem(getName()) + " and the " + F.elem(morph.getName()) + " at the same time"));
|
||||
morph.disable(player, true);
|
||||
}
|
||||
|
||||
super.enableCustom(player, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DragonData spawnMount(Player player)
|
||||
{
|
||||
DragonData dragonData = new DragonData(this, player);
|
||||
//Set max health to 1 so player doesn't see a bunch of mount hearts flashing when NewsManager changes the health
|
||||
dragonData.Dragon.setMaxHealth(1.0);
|
||||
dragonData.Dragon.setHealth(1.0);
|
||||
|
||||
return dragonData;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package mineplex.core.gadget.gadgets.mount;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.utils.UtilVariant;
|
||||
|
||||
public class HorseMount extends Mount<SingleEntityMountData<Horse>>
|
||||
{
|
||||
|
||||
protected static Field JUMP_FIELD;
|
||||
|
||||
static
|
||||
{
|
||||
try
|
||||
{
|
||||
JUMP_FIELD = EntityLiving.class.getDeclaredField("aY");
|
||||
JUMP_FIELD.setAccessible(true);
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static final int MIN_OFFSET_SQUARED = 16;
|
||||
private static final int MAX_OFFSET_SQUARED = 400;
|
||||
|
||||
protected final Color _color;
|
||||
protected final Style _style;
|
||||
protected final Variant _variant;
|
||||
protected final double _jump;
|
||||
protected final Material _armor;
|
||||
|
||||
public HorseMount(GadgetManager manager, String name, String[] desc, int cost, Material material, byte materialData, Color color, Style style, Variant variant, double jump, Material armor)
|
||||
{
|
||||
super(manager, name, desc, cost, material, materialData);
|
||||
|
||||
_color = color;
|
||||
_style = style;
|
||||
_variant = variant;
|
||||
_jump = jump;
|
||||
_armor = armor;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateHorse(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<Player> activeIterator = _active.keySet().iterator();
|
||||
|
||||
while (activeIterator.hasNext())
|
||||
{
|
||||
Player player = activeIterator.next();
|
||||
Horse horse = _active.get(player).getEntity();
|
||||
|
||||
//Invalid (dead)
|
||||
if (!horse.isValid())
|
||||
{
|
||||
horse.remove();
|
||||
activeIterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
//Move
|
||||
double dist = UtilMath.offsetSquared(player, horse);
|
||||
|
||||
if (dist > MAX_OFFSET_SQUARED)
|
||||
{
|
||||
horse.teleport(player);
|
||||
}
|
||||
else if (dist > MIN_OFFSET_SQUARED)
|
||||
{
|
||||
UtilEnt.CreatureMove(horse, player.getLocation().add(0, 0.5, 0), 1.5F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleEntityMountData<Horse> spawnMount(Player player)
|
||||
{
|
||||
Horse horse = UtilVariant.spawnHorse(player.getLocation(), _variant);
|
||||
horse.setAdult();
|
||||
horse.setAgeLock(true);
|
||||
horse.setColor(_color);
|
||||
horse.setStyle(_style);
|
||||
horse.setOwner(player);
|
||||
horse.setMaxDomestication(1);
|
||||
horse.setJumpStrength(_jump);
|
||||
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
|
||||
|
||||
if (horse.getVariant() == Variant.MULE)
|
||||
{
|
||||
horse.setCarryingChest(true);
|
||||
}
|
||||
|
||||
if (_armor != null)
|
||||
{
|
||||
horse.getInventory().setArmor(new ItemStack(_armor));
|
||||
}
|
||||
|
||||
horse.setCustomName(player.getName() + "'s " + getName());
|
||||
horse.setCustomNameVisible(true);
|
||||
|
||||
return new SingleEntityMountData<>(player, horse);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPassenger(Player player, Entity clicked, PlayerInteractEntityEvent event)
|
||||
{
|
||||
event.setCancelled(false);
|
||||
}
|
||||
}
|
@ -0,0 +1,242 @@
|
||||
package mineplex.core.gadget.gadgets.mount;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public abstract class Mount<T extends MountData> extends Gadget
|
||||
{
|
||||
|
||||
protected final Map<Player, T> _active = new HashMap<>();
|
||||
|
||||
protected boolean BouncyCollisions = false;
|
||||
|
||||
public Mount(GadgetManager manager, String name, String[] description, int cost, Material material, byte displayData)
|
||||
{
|
||||
super(manager, GadgetType.MOUNT, name, description, cost, material, displayData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableCustom(Player player, boolean message)
|
||||
{
|
||||
player.leaveVehicle();
|
||||
player.eject();
|
||||
Manager.removeGadgetType(player, getGadgetType(), this);
|
||||
T data = spawnMount(player);
|
||||
_active.put(player, data);
|
||||
|
||||
for (Entity entity : data.getEntityParts())
|
||||
{
|
||||
UtilEnt.addFlag(entity, UtilEnt.FLAG_ENTITY_COMPONENT);
|
||||
}
|
||||
|
||||
if (message)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Manager.getName(), "You spawned " + F.elem(getName()) + "."));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
Manager.removeActive(player, this);
|
||||
MountData data = _active.remove(player);
|
||||
|
||||
for (Entity entity : data.getEntityParts())
|
||||
{
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
if (message)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Manager.getName(), "You despawned " + F.elem(getName()) + "."));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(Player player)
|
||||
{
|
||||
return _active.containsKey(player);
|
||||
}
|
||||
|
||||
public abstract T spawnMount(Player player);
|
||||
|
||||
@EventHandler
|
||||
public void updateBounce(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK || !BouncyCollisions)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Collide
|
||||
for (T data : getActiveMounts().values())
|
||||
{
|
||||
List<Entity> parts = data.getEntityParts();
|
||||
|
||||
if (parts == null || parts.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Entity head = parts.get(0);
|
||||
|
||||
if (head == null || !(head.getPassenger() instanceof Player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player player = (Player) head.getPassenger();
|
||||
|
||||
if (!Recharge.Instance.usable(player, getName() + " Collide"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (T otherData : getActiveMounts().values())
|
||||
{
|
||||
List<Entity> otherParts = otherData.getEntityParts();
|
||||
|
||||
if (otherParts == null || otherParts.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Entity otherHead = otherParts.get(0);
|
||||
|
||||
if (otherHead.equals(head) || otherHead.getPassenger() == null || !(otherHead.getPassenger() instanceof Player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player otherPlayer = (Player) otherHead.getPassenger();
|
||||
|
||||
if (!Recharge.Instance.usable(otherPlayer, getName() + " Collide"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//Collide
|
||||
if (UtilMath.offsetSquared(head, otherHead) > 4)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Recharge.Instance.useForce(player, getName() + " Collide", 500);
|
||||
Recharge.Instance.useForce(otherPlayer, getName() + " Collide", 500);
|
||||
|
||||
Vector direction = UtilAlg.getTrajectory(otherHead, head);
|
||||
|
||||
for (Entity part : parts)
|
||||
{
|
||||
UtilAction.velocity(part, direction, 1.2, false, 0, 0.8, 10, true);
|
||||
}
|
||||
|
||||
direction.multiply(-1);
|
||||
|
||||
for (Entity part : otherParts)
|
||||
{
|
||||
UtilAction.velocity(part, direction, 1.2, false, 0, 0.8, 10, true);
|
||||
}
|
||||
|
||||
otherHead.getWorld().playSound(otherHead.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interactMount(PlayerInteractEntityEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Entity clicked = event.getRightClicked();
|
||||
T data = getMountData(clicked);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
List<Entity> parts = data.getEntityParts();
|
||||
boolean first = true;
|
||||
|
||||
for (Entity entity : parts)
|
||||
{
|
||||
if (entity.equals(clicked) && shouldRide(player, data, first))
|
||||
{
|
||||
player.leaveVehicle();
|
||||
player.eject();
|
||||
|
||||
setPassenger(player, clicked, event);
|
||||
return;
|
||||
}
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
player.sendMessage(F.main(Manager.getName(), "This is not your mount!"));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void target(EntityDamageEvent event)
|
||||
{
|
||||
for (T data : _active.values())
|
||||
{
|
||||
if (data.isPartOfMount(event.getEntity()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean shouldRide(Player player, T data, boolean head)
|
||||
{
|
||||
return data.ownsMount(player);
|
||||
}
|
||||
|
||||
protected void setPassenger(Player player, Entity clicked, PlayerInteractEntityEvent event)
|
||||
{
|
||||
clicked.setPassenger(player);
|
||||
}
|
||||
|
||||
protected T getMountData(Entity ent)
|
||||
{
|
||||
for (T data : getActiveMounts().values())
|
||||
{
|
||||
if (data.isPartOfMount(ent))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final Map<Player, T> getActiveMounts()
|
||||
{
|
||||
return _active;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.mount;
|
||||
package mineplex.core.gadget.gadgets.mount;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package mineplex.core.mount;
|
||||
package mineplex.core.gadget.gadgets.mount;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -20,9 +20,7 @@ public class SingleEntityMountData<T extends Entity> extends MountData
|
||||
@Override
|
||||
public List<Entity> getEntityParts()
|
||||
{
|
||||
List<Entity> list = new ArrayList<Entity>();
|
||||
list.add(Entity);
|
||||
return list;
|
||||
return Collections.singletonList(Entity);
|
||||
}
|
||||
|
||||
public T getEntity()
|
||||
@ -30,6 +28,4 @@ public class SingleEntityMountData<T extends Entity> extends MountData
|
||||
return Entity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.mount.types;
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -9,19 +9,19 @@ import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.HorseJumpEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.SingleEntityMountData;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -29,64 +29,72 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
public class MountBabyReindeer extends HorseMount
|
||||
{
|
||||
|
||||
public MountBabyReindeer(MountManager manager)
|
||||
public MountBabyReindeer(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Baby Reindeer",
|
||||
super(manager,
|
||||
"Baby Reindeer",
|
||||
UtilText.splitLineToArray(C.cGray + "One of Santa's baby reindeers. He's still learning how to fly...", LineFormat.LORE),
|
||||
Material.GOLDEN_CARROT, (byte) 0, -3, Color.CREAMY, Style.WHITEFIELD, Variant.HORSE, 0, null);
|
||||
CostConstants.FOUND_IN_WINTER_CHESTS,
|
||||
Material.GOLDEN_CARROT,
|
||||
(byte) 0,
|
||||
Color.CREAMY,
|
||||
Style.WHITEFIELD,
|
||||
Variant.HORSE,
|
||||
0,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableCustom(Player player) {
|
||||
super.enableCustom(player);
|
||||
Horse horse = getActive().get(player).getEntity();
|
||||
public SingleEntityMountData<Horse> spawnMount(Player player)
|
||||
{
|
||||
SingleEntityMountData<Horse> data = super.spawnMount(player);
|
||||
Horse horse = data.getEntity();
|
||||
|
||||
horse.setBaby();
|
||||
horse.setMaxHealth(20);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldRide(Player player, SingleEntityMountData<Horse> data, boolean head)
|
||||
{
|
||||
return data.ownsMount(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void fly(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.TICK) return;
|
||||
if (event.getType() != UpdateType.TICK) return;
|
||||
|
||||
for(SingleEntityMountData<Horse> horse : getActive().values())
|
||||
for (SingleEntityMountData<Horse> horse : getActiveMounts().values())
|
||||
{
|
||||
if(horse.getEntity().getPassenger() != horse.getOwner()) continue;
|
||||
if (horse.getEntity().getPassenger() != horse.getOwner()) continue;
|
||||
|
||||
if(Recharge.Instance.usable(horse.getOwner(), "Reindeer Fly")) continue;
|
||||
if (Recharge.Instance.usable(horse.getOwner(), "Reindeer Fly")) continue;
|
||||
|
||||
horse.getEntity().setVelocity(horse.getOwner().getLocation().getDirection().normalize().add(new Vector(0,0.4,0)));
|
||||
horse.getEntity().setVelocity(horse.getOwner().getLocation().getDirection().normalize().add(new Vector(0, 0.4, 0)));
|
||||
|
||||
horse.getEntity().getWorld().playSound(horse.getEntity().getLocation(), Sound.HORSE_BREATHE, 0.3f, 0.5f);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, horse.getEntity().getLocation(), 0.2f,0.0f,0.2f, 0.0f, 10, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, horse.getEntity().getLocation(), 0.2f, 0.0f, 0.2f, 0.0f, 10, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClick(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if(!isActive(event.getPlayer())) return;
|
||||
SingleEntityMountData<Horse>data = getMountData(event.getRightClicked());
|
||||
if(data == null) return;
|
||||
if(data.getOwner() != event.getPlayer()) return;
|
||||
data.getEntity().setPassenger(data.getOwner());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJump(HorseJumpEvent event)
|
||||
{
|
||||
SingleEntityMountData<Horse> data = getMountData(event.getEntity());
|
||||
if(data == null) return;
|
||||
if (data == null) return;
|
||||
|
||||
event.setCancelled(true);
|
||||
if(UtilEnt.isGrounded(event.getEntity()))
|
||||
if (UtilEnt.isGrounded(event.getEntity()))
|
||||
{
|
||||
if(Recharge.Instance.use(data.getOwner(), "Reindeer Fly", 1000, false, false))
|
||||
if (Recharge.Instance.use(data.getOwner(), "Reindeer Fly", 1000, false, false))
|
||||
{
|
||||
event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.HORSE_ANGRY, 1f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.DisguiseBlock;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
|
||||
public class MountCake extends HorseMount
|
||||
{
|
||||
|
||||
public MountCake(GadgetManager manager)
|
||||
{
|
||||
super(manager,
|
||||
"Cake Mount",
|
||||
UtilText.splitLineToArray(C.cGray + "The Lie.", LineFormat.LORE),
|
||||
CostConstants.FOUND_IN_THANKFUL_CHESTS,
|
||||
Material.CAKE,
|
||||
(byte) 0,
|
||||
Horse.Color.BLACK,
|
||||
Horse.Style.NONE,
|
||||
Horse.Variant.HORSE,
|
||||
2,
|
||||
null
|
||||
);
|
||||
|
||||
BouncyCollisions = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleEntityMountData<Horse> spawnMount(Player player)
|
||||
{
|
||||
SingleEntityMountData<Horse> data = super.spawnMount(player);
|
||||
Horse horse = data.getEntity();
|
||||
|
||||
UtilEnt.silence(horse, true);
|
||||
|
||||
DisguiseBlock block = new DisguiseBlock(horse, Material.CAKE_BLOCK, 0);
|
||||
Manager.getDisguiseManager().disguise(block);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.Mount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountCart extends Mount<SingleEntityMountData<Minecart>>
|
||||
{
|
||||
|
||||
public MountCart(GadgetManager manager)
|
||||
{
|
||||
super(manager,
|
||||
"Minecart",
|
||||
UtilText.splitLineToArray(C.cGray + "Cruise around town in your shiny new Minecart RX Turbo!", LineFormat.LORE),
|
||||
15000,
|
||||
Material.MINECART,
|
||||
(byte)0
|
||||
);
|
||||
|
||||
BouncyCollisions = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleEntityMountData<Minecart> spawnMount(Player player)
|
||||
{
|
||||
return new SingleEntityMountData<>(player, player.getWorld().spawn(player.getLocation().add(0, 2, 0), Minecart.class));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateMovement(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Bounce
|
||||
for (SingleEntityMountData<Minecart> cartData : getActiveMounts().values())
|
||||
{
|
||||
Minecart cart = cartData.getEntity();
|
||||
|
||||
if (cart.getPassenger() == null || !(cart.getPassenger() instanceof Player) || !UtilEnt.isGrounded(cart))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player player = (Player) cart.getPassenger();
|
||||
UtilAction.velocity(cart, UtilAlg.getTrajectory2d(player.getEyeLocation(), UtilPlayer.getTargetLocation(player, 5)), 1.4, true, 0, 0, 1, false);
|
||||
|
||||
if (Math.random() > 0.8)
|
||||
{
|
||||
cart.getWorld().playSound(cart.getLocation(), Sound.MINECART_BASE, 0.05f, 2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cancelBreak(VehicleDamageEvent event)
|
||||
{
|
||||
for (SingleEntityMountData<Minecart> data : getActiveMounts().values())
|
||||
{
|
||||
if (data.getEntity().equals(event.getVehicle()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationType;
|
||||
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.UtilEnt;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountChicken extends HorseMount
|
||||
{
|
||||
|
||||
public MountChicken(GadgetManager manager)
|
||||
{
|
||||
super(manager,
|
||||
"Chicken Mount",
|
||||
UtilText.splitLinesToArray(new String[]
|
||||
{
|
||||
C.cGray + "This isn't flying! It is falling with style.",
|
||||
C.cRed + " ",
|
||||
C.cWhite + "Left Click to Bawk"
|
||||
}, LineFormat.LORE),
|
||||
CostConstants.FOUND_IN_THANKFUL_CHESTS,
|
||||
Material.FEATHER,
|
||||
(byte) 0,
|
||||
Color.BLACK,
|
||||
Style.NONE,
|
||||
Variant.HORSE,
|
||||
2,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleEntityMountData<Horse> spawnMount(Player player)
|
||||
{
|
||||
SingleEntityMountData<Horse> data = super.spawnMount(player);
|
||||
Horse horse = data.getEntity();
|
||||
|
||||
UtilEnt.silence(horse, true);
|
||||
|
||||
DisguiseChicken chicken = new DisguiseChicken(horse);
|
||||
chicken.setName(player.getName() + "'s Chicken Mount");
|
||||
chicken.setCustomNameVisible(true);
|
||||
Manager.getDisguiseManager().disguise(chicken);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onOrderQuack(PlayerAnimationEvent event)
|
||||
{
|
||||
if (getActiveMounts().containsKey(event.getPlayer()) && event.getAnimationType() == PlayerAnimationType.ARM_SWING)
|
||||
{
|
||||
if (Recharge.Instance.use(event.getPlayer(), "Chicken Bawk", 500, false, false))
|
||||
{
|
||||
event.getPlayer().getWorld().playSound(getActiveMounts().get(event.getPlayer()).getEntity().getEyeLocation(), Sound.CHICKEN_IDLE, .4F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void jump(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : getActiveMounts().keySet())
|
||||
{
|
||||
final Horse horse = getActiveMounts().get(player).getEntity();
|
||||
|
||||
// Slows down falling
|
||||
if (!horse.isOnGround() && horse.getVelocity().getY() < 0)
|
||||
{
|
||||
Vector velocity = horse.getVelocity();
|
||||
velocity.setY(velocity.getY() * 0.6);
|
||||
horse.setVelocity(velocity);
|
||||
}
|
||||
|
||||
if (horse.getPassenger() == null || !horse.getPassenger().equals(player) || !UtilEnt.isGrounded(horse) || !Recharge.Instance.use(player, "Chicken Mount Jump", 100, false, false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
boolean isJumping = JUMP_FIELD.getBoolean(((CraftPlayer) player).getHandle());
|
||||
|
||||
if (!isJumping)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//Not jumping anymore
|
||||
((CraftPlayer) player).getHandle().i(false);
|
||||
|
||||
//Velocity
|
||||
UtilAction.velocity(horse, 1.4, 0.38, .8, true);
|
||||
|
||||
//Sound
|
||||
player.playSound(horse.getLocation(), Sound.CHICKEN_IDLE, .4F, 1.0F);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,49 +1,52 @@
|
||||
package mineplex.core.mount.types;
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.mount.DragonData;
|
||||
import mineplex.core.mount.DragonMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.DragonData;
|
||||
import mineplex.core.gadget.gadgets.mount.DragonMount;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountDragon extends DragonMount
|
||||
{
|
||||
public MountDragon(MountManager manager)
|
||||
|
||||
public MountDragon(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Ethereal Dragon",
|
||||
super(manager,
|
||||
"Ethereal Dragon",
|
||||
UtilText.splitLineToArray(C.cGray + "From the distant Ether Realm, this prized dragon is said to only obey true Heroes!", LineFormat.LORE),
|
||||
CostConstants.UNLOCKED_WITH_HERO,
|
||||
Material.DRAGON_EGG,
|
||||
(byte)0,
|
||||
-11);
|
||||
(byte) 0
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Trail(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
for (DragonData data : getActive().values())
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, data.Dragon.getLocation().add(0, 1, 0),
|
||||
1f, 1f, 1f, 0f, 20,
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (DragonData data : getActiveMounts().values())
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, data.Dragon.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0f, 20, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,16 +54,21 @@ public class MountDragon extends DragonMount
|
||||
public void DragonLocation(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (DragonData data : getActive().values())
|
||||
data.Move();
|
||||
|
||||
HashSet<Player> toRemove = new HashSet<Player>();
|
||||
|
||||
for (Player player : getActive().keySet())
|
||||
{
|
||||
DragonData data = getActive().get(player);
|
||||
return;
|
||||
}
|
||||
|
||||
for (DragonData data : getActiveMounts().values())
|
||||
{
|
||||
data.Move();
|
||||
}
|
||||
|
||||
Set<Player> toRemove = new HashSet<>();
|
||||
|
||||
for (Player player : getActiveMounts().keySet())
|
||||
{
|
||||
DragonData data = getActiveMounts().get(player);
|
||||
|
||||
if (data == null)
|
||||
{
|
||||
toRemove.add(player);
|
||||
@ -71,34 +79,31 @@ public class MountDragon extends DragonMount
|
||||
{
|
||||
data.Dragon.remove();
|
||||
toRemove.add(player);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (Player player : toRemove)
|
||||
{
|
||||
disable(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void DragonTargetCancel(EntityTargetEvent event)
|
||||
{
|
||||
if (getActive().containsValue(event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetName(String news)
|
||||
{
|
||||
for (DragonData dragon : getActive().values())
|
||||
for (DragonData dragon : getActiveMounts().values())
|
||||
dragon.Dragon.setCustomName(news);
|
||||
}
|
||||
|
||||
public void setHealthPercent(double healthPercent)
|
||||
{
|
||||
for (DragonData dragon : getActive().values())
|
||||
for (DragonData dragon : getActiveMounts().values())
|
||||
{
|
||||
double health = healthPercent * dragon.Dragon.getMaxHealth();
|
||||
if (health <= 0.0)
|
||||
{
|
||||
health = 0.001;
|
||||
}
|
||||
|
||||
dragon.Dragon.setHealth(health);
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.HorseJumpEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.particleeffects.FreedomTrailEffect;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
|
||||
public class MountFreedomHorse extends HorseMount
|
||||
{
|
||||
|
||||
private final Map<SingleEntityMountData<Horse>, FreedomTrailEffect> _trailMap = new HashMap<>();
|
||||
|
||||
public MountFreedomHorse(GadgetManager manager)
|
||||
{
|
||||
super(manager,
|
||||
"Freedom Mount",
|
||||
UtilText.splitLineToArray(UtilText.colorWords("The British might be coming, but with this impressive mount you have nothing to fear.",
|
||||
ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE),
|
||||
CostConstants.FOUND_IN_FREEDOM_CHESTS,
|
||||
Material.FIREWORK,
|
||||
(byte) 0,
|
||||
Color.WHITE,
|
||||
Style.WHITE,
|
||||
Variant.HORSE,
|
||||
1,
|
||||
null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleEntityMountData<Horse> spawnMount(Player player)
|
||||
{
|
||||
SingleEntityMountData<Horse> data = super.spawnMount(player);
|
||||
Horse horse = data.getEntity();
|
||||
|
||||
data.getEntity().getInventory().setArmor(new ItemStack(Material.DIAMOND_BARDING));
|
||||
|
||||
FreedomTrailEffect effect = new FreedomTrailEffect(horse, Manager.getPlugin());
|
||||
effect.start();
|
||||
_trailMap.put(data, effect);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
_trailMap.entrySet().removeIf(entry ->
|
||||
{
|
||||
if (entry.getKey().ownsMount(player))
|
||||
{
|
||||
entry.getValue().stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
super.disableCustom(player, message);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void horseJump(HorseJumpEvent event)
|
||||
{
|
||||
for (SingleEntityMountData<Horse> horseData : _trailMap.keySet())
|
||||
{
|
||||
if (horseData.getEntity().equals(event.getEntity()))
|
||||
{
|
||||
if (!Recharge.Instance.use(horseData.getOwner(), getName(), 2500, false, false, "Cosmetics"))
|
||||
{
|
||||
event.setPower(0f);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
_trailMap.get(horseData).setJumping(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountFrost extends HorseMount
|
||||
{
|
||||
public MountFrost(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Glacial Steed",
|
||||
UtilText.splitLineToArray(C.cGray + "Born in the North Pole, it leaves a trail of frost as it moves!", LineFormat.LORE),
|
||||
15000,
|
||||
Material.SNOW_BALL,
|
||||
(byte) 0,
|
||||
Color.WHITE,
|
||||
Style.WHITE,
|
||||
Variant.HORSE,
|
||||
1,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void trail(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (SingleEntityMountData<Horse> horseData : getActiveMounts().values())
|
||||
{
|
||||
Horse horse = horseData.getEntity();
|
||||
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0.1f, 4, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguiseBlock;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountLoveTrain extends HorseMount
|
||||
{
|
||||
|
||||
public MountLoveTrain(GadgetManager manager)
|
||||
{
|
||||
super(manager,
|
||||
"Love Train",
|
||||
UtilText.splitLineToArray(C.cGray + "Woo Woo! All aboard!", LineFormat.LORE),
|
||||
CostConstants.FOUND_IN_LOVE_CHESTS,
|
||||
Material.WOOL,
|
||||
(byte) 6,
|
||||
Color.BLACK,
|
||||
Style.NONE,
|
||||
Variant.HORSE,
|
||||
2,
|
||||
null
|
||||
);
|
||||
|
||||
BouncyCollisions = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleEntityMountData<Horse> spawnMount(Player player)
|
||||
{
|
||||
SingleEntityMountData<Horse> data = super.spawnMount(player);
|
||||
Horse horse = data.getEntity();
|
||||
|
||||
UtilEnt.silence(horse, true);
|
||||
|
||||
DisguiseBlock block = new DisguiseBlock(horse, Material.BARRIER, 0);
|
||||
Manager.getDisguiseManager().disguise(block);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void updateBounce(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (SingleEntityMountData<Horse> data : getActiveMounts().values())
|
||||
{
|
||||
Horse horse = data.getEntity();
|
||||
UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.HEART, horse.getLocation(), 0.25f, 0.25f, 0.25f, 0.5f, 3, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
super.updateBounce(event);
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package mineplex.core.mount.types;
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
@ -9,18 +8,24 @@ import org.bukkit.entity.Horse.Variant;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
|
||||
public class MountMule extends HorseMount
|
||||
{
|
||||
public MountMule(MountManager manager)
|
||||
public MountMule(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Mount Mule",
|
||||
super(manager,
|
||||
"Mount Mule",
|
||||
UtilText.splitLineToArray(C.cGray + "Your very own trusty pack mule!", LineFormat.LORE),
|
||||
Material.HAY_BLOCK,
|
||||
(byte)0,
|
||||
3000,
|
||||
Color.BLACK, Style.BLACK_DOTS, Variant.MULE, 1.0, null);
|
||||
Material.HAY_BLOCK,
|
||||
(byte) 0,
|
||||
Color.BLACK,
|
||||
Style.BLACK_DOTS,
|
||||
Variant.MULE,
|
||||
1,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
package mineplex.core.mount.types;
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -10,6 +9,8 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -20,27 +21,40 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.particles.ColoredParticle;
|
||||
import mineplex.core.common.util.particles.DustSpellColor;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountNightmareSteed extends HorseMount
|
||||
{
|
||||
|
||||
private boolean _foot = false;
|
||||
private HashMap<Location, Long> _steps = new HashMap<>();
|
||||
private static final DustSpellColor COLOUR = new DustSpellColor(Color.BLACK);
|
||||
|
||||
public MountNightmareSteed(MountManager manager)
|
||||
private boolean _foot = false;
|
||||
private final Map<Location, Long> _steps = new HashMap<>();
|
||||
|
||||
public MountNightmareSteed(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Nightmare Steed", UtilText.splitLineToArray(C.cGray + "The Nightmare Steed comes in the darkness of night, the fires of the underworld still trailing from its hooves.", LineFormat.LORE),
|
||||
Material.WOOL, (byte) 15, -9, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 1, null);
|
||||
super(manager,
|
||||
"Nightmare Steed",
|
||||
UtilText.splitLineToArray(C.cGray + "The Nightmare Steed comes in the darkness of night, the fires of the underworld still trailing from its hooves.", LineFormat.LORE),
|
||||
CostConstants.FOUND_IN_HAUNTED_CHESTS,
|
||||
Material.WOOL,
|
||||
(byte) 15,
|
||||
Horse.Color.BLACK,
|
||||
Style.NONE,
|
||||
Variant.HORSE,
|
||||
1,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -48,27 +62,29 @@ public class MountNightmareSteed extends HorseMount
|
||||
{
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
{
|
||||
for (SingleEntityMountData<Horse> singleEntityMountData : getActive().values())
|
||||
for (SingleEntityMountData<Horse> singleEntityMountData : getActiveMounts().values())
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.FOOTSTEP,
|
||||
singleEntityMountData.getEntity().getLocation(), 0f, 0f, 0f, 0f, 1, UtilParticle.ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.FOOTSTEP, singleEntityMountData.getEntity().getLocation(), 0f, 0f, 0f, 0f, 1, UtilParticle.ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
for (SingleEntityMountData<Horse> singleEntityMountData : getActive().values())
|
||||
{
|
||||
Entity entity = singleEntityMountData.getEntity();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getType() != UpdateType.FASTEST) return;
|
||||
for (SingleEntityMountData<Horse> data : getActiveMounts().values())
|
||||
{
|
||||
Entity entity = data.getEntity();
|
||||
|
||||
_foot = !_foot;
|
||||
|
||||
cleanSteps();
|
||||
|
||||
if (!UtilEnt.isGrounded(entity)) return;
|
||||
if (!UtilEnt.isGrounded(entity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector offset;
|
||||
|
||||
@ -87,44 +103,42 @@ public class MountNightmareSteed extends HorseMount
|
||||
|
||||
Location loc = entity.getLocation().add(offset.multiply(0.2));
|
||||
|
||||
if (nearStep(loc)) return;
|
||||
|
||||
if (!UtilBlock.solid(loc.getBlock().getRelative(BlockFace.DOWN))) return;
|
||||
if (nearStep(loc))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!UtilBlock.solid(loc.getBlock().getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_steps.put(loc, System.currentTimeMillis());
|
||||
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.FOOTSTEP, loc, 0f, 0f, 0f, 0, 1, UtilParticle.ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.FOOTSTEP, loc, 0f, 0f, 0f, 0, 1, ViewDist.NORMAL);
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Location randLoc = UtilAlg.getRandomLocation(singleEntityMountData.getEntity().getLocation().clone().add(0, 1, 0), 1d);
|
||||
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
|
||||
new DustSpellColor(Color.BLACK), randLoc);
|
||||
Location randLoc = UtilAlg.getRandomLocation(data.getEntity().getLocation().clone().add(0, 1, 0), 1d);
|
||||
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, COLOUR, randLoc);
|
||||
coloredParticle.display(2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanSteps()
|
||||
private void cleanSteps()
|
||||
{
|
||||
if (_steps.isEmpty()) return;
|
||||
|
||||
Iterator<Map.Entry<Location, Long>> stepIterator = _steps.entrySet().iterator();
|
||||
|
||||
while (stepIterator.hasNext())
|
||||
{
|
||||
Map.Entry<Location, Long> entry = stepIterator.next();
|
||||
|
||||
if (UtilTime.elapsed(entry.getValue(), 10000)) stepIterator.remove();
|
||||
}
|
||||
_steps.entrySet().removeIf(entry -> UtilTime.elapsed(entry.getValue(), 10000));
|
||||
}
|
||||
|
||||
public boolean nearStep(Location loc)
|
||||
private boolean nearStep(Location loc)
|
||||
{
|
||||
for (Location other : _steps.keySet())
|
||||
{
|
||||
if (UtilMath.offset(loc, other) < 0.3) return true;
|
||||
if (UtilMath.offset(loc, other) < 0.3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
@ -0,0 +1,93 @@
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.event.EventHandler;
|
||||
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.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.Mount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountSlime extends Mount<SingleEntityMountData<Slime>>
|
||||
{
|
||||
|
||||
public MountSlime(GadgetManager manager)
|
||||
{
|
||||
super(manager,
|
||||
"Slime Mount",
|
||||
UtilText.splitLineToArray(C.cGray + "Bounce around on your very own slime friend!", LineFormat.LORE),
|
||||
15000,
|
||||
Material.SLIME_BALL,
|
||||
(byte) 0
|
||||
);
|
||||
|
||||
BouncyCollisions = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleEntityMountData<Slime> spawnMount(Player player)
|
||||
{
|
||||
Slime slime = player.getWorld().spawn(player.getLocation(), Slime.class);
|
||||
slime.setSize(2);
|
||||
slime.setCustomName(player.getName() + "'s " + getName());
|
||||
slime.setCustomNameVisible(true);
|
||||
UtilEnt.removeTargetSelectors(slime);
|
||||
|
||||
return new SingleEntityMountData<>(player, slime);
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void updateBounce(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Bounce
|
||||
for (SingleEntityMountData<Slime> slimeData : getActiveMounts().values())
|
||||
{
|
||||
Slime slime = slimeData.getEntity();
|
||||
|
||||
if (slime.getPassenger() == null)
|
||||
{
|
||||
UtilEnt.setFakeHead(slime, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!UtilEnt.isGrounded(slime) || !(slime.getPassenger() instanceof Player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player player = (Player) slime.getPassenger();
|
||||
|
||||
if (!Recharge.Instance.use(player, getName(), 200, false, false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Vector dir = slime.getPassenger().getLocation().getDirection();
|
||||
|
||||
UtilAction.velocity(slime, dir, 1, true, 0, 0.4, 1, true);
|
||||
UtilEnt.CreatureForceLook(slime, 0, UtilAlg.GetYaw(dir));
|
||||
|
||||
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
|
||||
}
|
||||
|
||||
super.updateBounce(event);
|
||||
}
|
||||
}
|
@ -0,0 +1,184 @@
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
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.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountSpider extends HorseMount
|
||||
{
|
||||
|
||||
public MountSpider(GadgetManager manager)
|
||||
{
|
||||
super(manager,
|
||||
"Spider Mount",
|
||||
UtilText.splitLinesToArray(new String[]
|
||||
{
|
||||
C.cGray + "Why ride a horse when you can ride a cute and cuddly spider!",
|
||||
C.blankLine,
|
||||
"#" + C.cWhite + "Look Up to use Wall Climb",
|
||||
"#" + C.cWhite + "Jump to use Leap",
|
||||
"",
|
||||
C.cBlue + "Only buyable during Halloween 2015"
|
||||
}, LineFormat.LORE),
|
||||
CostConstants.NO_LORE,
|
||||
Material.WEB,
|
||||
(byte) 0,
|
||||
Color.BLACK,
|
||||
Style.NONE,
|
||||
Variant.HORSE,
|
||||
2,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleEntityMountData<Horse> spawnMount(Player player)
|
||||
{
|
||||
SingleEntityMountData<Horse> data = super.spawnMount(player);
|
||||
Horse horse = data.getEntity();
|
||||
|
||||
UtilEnt.silence(horse, true);
|
||||
|
||||
DisguiseSpider spider = new DisguiseSpider(horse);
|
||||
spider.setName(player.getName() + "'s Spider Mount");
|
||||
spider.setCustomNameVisible(true);
|
||||
Manager.getDisguiseManager().disguise(spider);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void sounds(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : getActiveMounts().keySet())
|
||||
{
|
||||
Horse horse = getActiveMounts().get(player).getEntity();
|
||||
|
||||
if (!Recharge.Instance.use(player, "Spider Mount Sounds", (1000 * UtilMath.r(3)) + 500, false, false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//Moving
|
||||
if (horse.getVelocity().length() != 0 && UtilEnt.isGrounded(horse))
|
||||
{
|
||||
horse.getWorld().playSound(horse.getLocation(), Sound.SPIDER_WALK, .4F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void wallClimb(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entry<Player, SingleEntityMountData<Horse>> entry : getActiveMounts().entrySet())
|
||||
{
|
||||
Player player = entry.getKey();
|
||||
Horse horse = entry.getValue().getEntity();
|
||||
|
||||
if (!horse.getPassenger().equals(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//If player is looking up
|
||||
if (player.getEyeLocation().getPitch() > -45)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Vector direction = new Vector(horse.getVelocity().getX(), 0.2, horse.getVelocity().getZ());
|
||||
for (Block block : UtilBlock.getSurrounding(horse.getLocation().getBlock(), true))
|
||||
{
|
||||
if (UtilBlock.airFoliage(block) || block.isLiquid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
UtilAction.velocity(horse, direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void jump(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : getActiveMounts().keySet())
|
||||
{
|
||||
final Horse horse = getActiveMounts().get(player).getEntity();
|
||||
|
||||
if (!horse.getPassenger().equals(player) || !UtilEnt.isGrounded(horse))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, "Spider Mount Jump", 100, false, false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
boolean isJumping = JUMP_FIELD.getBoolean(((CraftPlayer) player).getHandle());
|
||||
|
||||
if (!isJumping)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//Not jumping anymore
|
||||
((CraftPlayer) player).getHandle().i(false);
|
||||
|
||||
//Velocity
|
||||
UtilAction.velocity(horse, 1.4, 0.38, .8, true);
|
||||
|
||||
//Sound
|
||||
player.playSound(horse.getLocation(), Sound.SPIDER_IDLE, .4F, 1.0F);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.HorseJumpEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
|
||||
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.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.particleeffects.RainbowTrailEffect;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountStPatricksHorse extends HorseMount
|
||||
{
|
||||
|
||||
private final HashSet<Item> _items = new HashSet<>();
|
||||
private final Map<SingleEntityMountData<Horse>, RainbowTrailEffect> _trailMap = new HashMap<>();
|
||||
|
||||
public MountStPatricksHorse(GadgetManager manager)
|
||||
{
|
||||
super(manager,
|
||||
"Rainbow Horse",
|
||||
UtilText.splitLineToArray(C.cGray + "You know the cow that jumped over the moon? Total show off.", LineFormat.LORE),
|
||||
CostConstants.FOUND_IN_ST_PATRICKS_CHESTS,
|
||||
Material.CAULDRON_ITEM,
|
||||
(byte) 0,
|
||||
Color.WHITE,
|
||||
Style.WHITE,
|
||||
Variant.HORSE,
|
||||
1,
|
||||
Material.GOLD_BARDING
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleEntityMountData<Horse> spawnMount(Player player)
|
||||
{
|
||||
SingleEntityMountData<Horse> data = super.spawnMount(player);
|
||||
Horse horse = data.getEntity();
|
||||
|
||||
RainbowTrailEffect effect = new RainbowTrailEffect(horse, Manager.getPlugin(), _items);
|
||||
effect.start();
|
||||
_trailMap.put(data, effect);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
_trailMap.entrySet().removeIf(entry ->
|
||||
{
|
||||
if (entry.getKey().ownsMount(player))
|
||||
{
|
||||
entry.getValue().stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
super.disableCustom(player, message);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void horseJump(HorseJumpEvent event)
|
||||
{
|
||||
for (SingleEntityMountData<Horse> horseData : _trailMap.keySet())
|
||||
{
|
||||
if (horseData.getEntity().equals(event.getEntity()) && Recharge.Instance.use(horseData.getOwner(), getName(), 2500, false, false, "Cosmetics"))
|
||||
{
|
||||
_trailMap.get(horseData).setJumping(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemPickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (_items.contains(event.getItem()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cleanItems();
|
||||
}
|
||||
|
||||
private void cleanItems()
|
||||
{
|
||||
Iterator<Item> iterator = _items.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Item item = iterator.next();
|
||||
|
||||
if (item.getTicksLived() >= 20)
|
||||
{
|
||||
item.remove();
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
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.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.Mount;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountTitan extends Mount<MountTitanData>
|
||||
{
|
||||
|
||||
public MountTitan(GadgetManager manager)
|
||||
{
|
||||
super(manager,
|
||||
"Molten Snake",
|
||||
UtilText.splitLineToArray(C.cGray + "Deep under the earths surface, there exists a mythical species of Molten Snakes. This one will serve you eternally.", LineFormat.LORE),
|
||||
CostConstants.UNLOCKED_WITH_TITAN,
|
||||
Material.MAGMA_CREAM,
|
||||
(byte) 0
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MountTitanData spawnMount(Player player)
|
||||
{
|
||||
return new MountTitanData(player, getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableCustom(Player player, boolean message)
|
||||
{
|
||||
if (getActiveMounts().size() >= 3)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(Manager.getName(), "The maximum amount of simultaneous " + F.elem(getName()) + " in this lobby has been reached."));
|
||||
return;
|
||||
}
|
||||
|
||||
super.enableCustom(player, message);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (MountTitanData data : _active.values())
|
||||
{
|
||||
data.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldRide(Player player, MountTitanData data, boolean head)
|
||||
{
|
||||
if (data.ownsMount(player))
|
||||
{
|
||||
data.getHead().setPassenger(player);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void titanOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().hasRank(event.getPlayer(), Rank.TITAN))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer()).addOwnedUnknownSalesPackage(getName());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
|
||||
|
||||
package mineplex.core.mount.types;
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -19,14 +17,14 @@ import org.bukkit.util.Vector;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.mount.MountData;
|
||||
import mineplex.core.gadget.gadgets.mount.MountData;
|
||||
|
||||
public class MountTitanData extends MountData
|
||||
{
|
||||
|
||||
private Slime _head;
|
||||
|
||||
private ArrayList<ArmorStand> _nodes;
|
||||
private List<ArmorStand> _nodes;
|
||||
|
||||
public MountTitanData(Player player, String name)
|
||||
{
|
||||
@ -37,9 +35,9 @@ public class MountTitanData extends MountData
|
||||
loc.setYaw(0);
|
||||
|
||||
//Nodes
|
||||
_nodes = new ArrayList<ArmorStand>();
|
||||
_nodes = new ArrayList<>();
|
||||
|
||||
for (int i=0 ; i<20 ; i++)
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
ArmorStand node = loc.getWorld().spawn(loc, ArmorStand.class);
|
||||
|
||||
@ -57,15 +55,9 @@ public class MountTitanData extends MountData
|
||||
//Head
|
||||
_head = player.getWorld().spawn(loc, MagmaCube.class);
|
||||
_head.setSize(2);
|
||||
UtilEnt.ghost(_head, true, false);
|
||||
|
||||
_head.setCustomName(player.getName() + "'s " + name);
|
||||
}
|
||||
|
||||
public void mount(Player player, Entity entity)
|
||||
{
|
||||
if (_head.equals(entity) || _nodes.contains(entity))
|
||||
_head.setPassenger(player);
|
||||
_head.setCustomNameVisible(true);
|
||||
UtilEnt.ghost(_head, true, false);
|
||||
}
|
||||
|
||||
public void update()
|
||||
@ -73,28 +65,28 @@ public class MountTitanData extends MountData
|
||||
//Head
|
||||
if (_head.getPassenger() != null)
|
||||
{
|
||||
Vector dir = _head.getPassenger().getLocation().getDirection().multiply(0.8).add(new Vector(0,0.2,0));
|
||||
Vector dir = _head.getPassenger().getLocation().getDirection().multiply(0.8).add(new Vector(0, 0.2, 0));
|
||||
_head.setVelocity(dir);
|
||||
UtilEnt.CreatureLook(_head, dir);
|
||||
}
|
||||
|
||||
Location infront = _head.getLocation().add(0, -1.5, 0);
|
||||
Location inFront = _head.getLocation().add(0, -1.5, 0);
|
||||
|
||||
//Move
|
||||
for (int i=0 ; i<20 ; i++)
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
ArmorStand node = _nodes.get(i);
|
||||
|
||||
Location old = node.getLocation();
|
||||
|
||||
infront.setPitch(node.getLocation().getPitch());
|
||||
infront.setYaw(node.getLocation().getYaw());
|
||||
inFront.setPitch(node.getLocation().getPitch());
|
||||
inFront.setYaw(node.getLocation().getYaw());
|
||||
|
||||
//Move
|
||||
if (i == 0)
|
||||
node.teleport(infront);
|
||||
else if (UtilMath.offset(node.getLocation(), infront) > 0.6)
|
||||
node.teleport(infront.add(UtilAlg.getTrajectory(infront, node.getLocation()).multiply(0.6)));
|
||||
node.teleport(inFront);
|
||||
else if (UtilMath.offset(node.getLocation(), inFront) > 0.6)
|
||||
node.teleport(inFront.add(UtilAlg.getTrajectory(inFront, node.getLocation()).multiply(0.6)));
|
||||
|
||||
//Rotation
|
||||
Vector vector = UtilAlg.getTrajectory(old, node.getLocation());
|
||||
@ -104,46 +96,41 @@ public class MountTitanData extends MountData
|
||||
Math.toRadians(UtilAlg.GetYaw(vector)),
|
||||
0));
|
||||
|
||||
infront = node.getLocation();
|
||||
inFront = node.getLocation();
|
||||
}
|
||||
|
||||
|
||||
//Shuffle In
|
||||
if (_head.getPassenger() == null)
|
||||
{
|
||||
for (int i=_nodes.size()-1 ; i>=0 ; i--)
|
||||
for (int i = _nodes.size() - 1; i >= 0; i--)
|
||||
{
|
||||
ArmorStand node = _nodes.get(i);
|
||||
|
||||
if (i>0)
|
||||
infront = _nodes.get(i-1).getLocation();
|
||||
if (i > 0)
|
||||
inFront = _nodes.get(i - 1).getLocation();
|
||||
else
|
||||
infront = _head.getLocation().add(0, -1.5, 0);
|
||||
inFront = _head.getLocation().add(0, -1.5, 0);
|
||||
|
||||
infront.setPitch(node.getLocation().getPitch());
|
||||
infront.setYaw(node.getLocation().getYaw());
|
||||
inFront.setPitch(node.getLocation().getPitch());
|
||||
inFront.setYaw(node.getLocation().getYaw());
|
||||
|
||||
node.teleport(infront);
|
||||
node.teleport(inFront);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void clean()
|
||||
public Slime getHead()
|
||||
{
|
||||
_head.remove();
|
||||
|
||||
for (ArmorStand stand : _nodes)
|
||||
stand.remove();
|
||||
return _head;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> getEntityParts()
|
||||
{
|
||||
List<Entity> entities = new ArrayList<Entity>();
|
||||
entities.addAll(_nodes);
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
entities.add(_head);
|
||||
entities.addAll(_nodes);
|
||||
return entities;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.mount.types;
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse;
|
||||
@ -10,45 +10,53 @@ import org.bukkit.event.EventHandler;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.SingleEntityMountData;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountUndead extends HorseMount
|
||||
{
|
||||
public MountUndead(MountManager manager)
|
||||
|
||||
public MountUndead(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Infernal Horror",
|
||||
super(manager,
|
||||
"Infernal Horror",
|
||||
UtilText.splitLineToArray(C.cGray + "The most ghastly horse in existance, from the pits of the Nether.", LineFormat.LORE),
|
||||
Material.BONE,
|
||||
(byte)0,
|
||||
20000,
|
||||
Color.BLACK, Style.BLACK_DOTS, Variant.SKELETON_HORSE, 0.8, null);
|
||||
Material.BONE,
|
||||
(byte) 0,
|
||||
Color.BLACK,
|
||||
Style.BLACK_DOTS,
|
||||
Variant.SKELETON_HORSE,
|
||||
0.8,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Trail(UpdateEvent event)
|
||||
public void trail(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
for (SingleEntityMountData<Horse> horseData : getActive().values())
|
||||
{
|
||||
for (SingleEntityMountData<Horse> horseData : getActiveMounts().values())
|
||||
{
|
||||
Horse horse = horseData.getEntity();
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, horse.getLocation().add(0, 1, 0),
|
||||
0.25f, 0.25f, 0.25f, 0, 2,ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, horse.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 2, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.FAST)
|
||||
for (SingleEntityMountData<Horse> horseData : getActive().values())
|
||||
else if (event.getType() == UpdateType.FAST)
|
||||
{
|
||||
for (SingleEntityMountData<Horse> horseData : getActiveMounts().values())
|
||||
{
|
||||
Horse horse = horseData.getEntity();
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LAVA, horse.getLocation().add(0, 1, 0),
|
||||
0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LAVA, horse.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
package mineplex.core.mount.types;
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
@ -16,32 +19,37 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||
import mineplex.core.disguise.disguises.DisguiseSheep;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.gadgets.mount.SingleEntityMountData;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountValentinesSheep extends HorseMount
|
||||
{
|
||||
/**
|
||||
* Created by: Mysticate
|
||||
* Timestamp: February 4, 2016
|
||||
*/
|
||||
|
||||
public MountValentinesSheep(MountManager manager)
|
||||
public MountValentinesSheep(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Loving Sheeples",
|
||||
super(manager,
|
||||
"Loving Sheeples",
|
||||
UtilText.splitLineToArray(C.cGray + "This symbol of love will live on with you forever! Mainly because we couldn't attach the cupid wings to it. I guess duct tape can't fix everything!", LineFormat.LORE),
|
||||
Material.WOOL, (byte) 6, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 1.0, null);
|
||||
CostConstants.NO_LORE,
|
||||
Material.WOOL,
|
||||
(byte) 6,
|
||||
Color.BLACK,
|
||||
Style.NONE,
|
||||
Variant.HORSE,
|
||||
1,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableCustom(Player player)
|
||||
public SingleEntityMountData<Horse> spawnMount(Player player)
|
||||
{
|
||||
super.enableCustom(player);
|
||||
|
||||
Horse horse = getActive().get(player).getEntity();
|
||||
SingleEntityMountData<Horse> data = super.spawnMount(player);
|
||||
Horse horse = data.getEntity();
|
||||
|
||||
UtilEnt.silence(horse, true);
|
||||
|
||||
@ -49,15 +57,24 @@ public class MountValentinesSheep extends HorseMount
|
||||
disguise.setColor(DyeColor.PINK);
|
||||
|
||||
Manager.getDisguiseManager().disguise(disguise);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void doAnimations(UpdateEvent event)
|
||||
{
|
||||
for (SingleEntityMountData<Horse> ent : getActive().values())
|
||||
if (event.getType() != UpdateType.FASTEST || event.getType() != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (SingleEntityMountData<Horse> ent : getActiveMounts().values())
|
||||
{
|
||||
if (!ent.getEntity().isValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.FASTEST)
|
||||
{
|
||||
@ -70,7 +87,7 @@ public class MountValentinesSheep extends HorseMount
|
||||
}
|
||||
else if (event.getType() == UpdateType.FAST)
|
||||
{
|
||||
DisguiseBase disguise = Manager.getDisguiseManager().getDisguise(ent.getEntity());
|
||||
DisguiseBase disguise = Manager.getDisguiseManager().getActiveDisguise(ent.getEntity());
|
||||
|
||||
if (disguise instanceof DisguiseSheep)
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.mount.types;
|
||||
package mineplex.core.gadget.gadgets.mount.types;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
@ -8,12 +8,14 @@ import org.bukkit.entity.Horse.Variant;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.mount.HorseMount;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
|
||||
public class MountZombie extends HorseMount
|
||||
{
|
||||
public MountZombie(MountManager manager)
|
||||
|
||||
public MountZombie(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Decrepit Warhorse",
|
||||
UtilText.splitLinesToArray(new String[]{
|
||||
@ -22,9 +24,14 @@ public class MountZombie extends HorseMount
|
||||
C.cBlue + "Earned by defeating the Pumpkin King",
|
||||
C.cBlue + "in the 2015 Halloween Horror Event."
|
||||
}, LineFormat.LORE),
|
||||
CostConstants.NO_LORE,
|
||||
Material.ROTTEN_FLESH,
|
||||
(byte)0,
|
||||
-1,
|
||||
Color.BLACK, Style.BLACK_DOTS, Variant.UNDEAD_HORSE, 0.8, null);
|
||||
Color.BLACK,
|
||||
Style.BLACK_DOTS,
|
||||
Variant.UNDEAD_HORSE,
|
||||
0.8,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
@ -36,6 +36,8 @@ public class OutfitTeam extends OutfitGadget
|
||||
int cost, ArmorSlot slot, Material mat, byte data)
|
||||
{
|
||||
super(manager, name, new String[] {ChatColor.RESET + "Team up with other players!", ChatColor.RESET + "Equip by typing;", ChatColor.RESET + C.cGreen + "/team <red/yellow/green/blue>"}, cost, slot, mat, data);
|
||||
|
||||
setHidden(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,9 @@ public class ParticleWingsBee extends ParticleGadget
|
||||
{
|
||||
super(manager, "Bumblebee's Wings",
|
||||
UtilText.splitLineToArray(C.cGray + "Float like a butterfly and sting like a bee with these new spring wings!", LineFormat.LORE),
|
||||
-14, Material.WOOL, (byte) 4, YearMonth.of(2017, Month.APRIL));
|
||||
-14, Material.WOOL, (byte) 4);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2017, Month.APRIL));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,11 +31,12 @@ import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||
import mineplex.core.gadget.gadgets.particle.king.types.King;
|
||||
import mineplex.core.gadget.gadgets.particle.king.types.Peasant;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
import mineplex.core.pet.event.PetSpawnEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -671,16 +672,17 @@ public class CastleManager extends MiniPlugin
|
||||
|
||||
/**
|
||||
* Stops players from using mounts inside the castle
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onMount(MountActivateEvent event)
|
||||
public void onMount(GadgetEnableEvent event)
|
||||
{
|
||||
if (!isHub())
|
||||
return;
|
||||
|
||||
if (isInsideCastle(event.getPlayer().getLocation()))
|
||||
if (event.getGadget().getGadgetType() == GadgetType.MOUNT && isInsideCastle(event.getPlayer().getLocation()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -39,7 +39,10 @@ public class ParticleKing extends ParticleGadget
|
||||
C.cWhite + "The King with the biggest Kingdom will own the Castle in our Lobby."
|
||||
}, LineFormat.LORE),
|
||||
-14,
|
||||
Material.GOLD_HELMET, (byte) 0, YearMonth.of(2017, Month.MAY));
|
||||
Material.GOLD_HELMET, (byte) 0);
|
||||
|
||||
setPPCYearMonth(YearMonth.of(2017, Month.MAY));
|
||||
|
||||
_castleManager = castleManager;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package mineplex.core.gadget.gadgets.wineffect.rankrooms;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.WinEffectGadget;
|
||||
@ -14,67 +13,23 @@ import mineplex.core.gadget.types.WinEffectGadget;
|
||||
public abstract class WinEffectRankBased extends WinEffectGadget
|
||||
{
|
||||
|
||||
private Rank _rank;
|
||||
private WinEffectType _winEffectType;
|
||||
private final Rank _rank;
|
||||
|
||||
/**
|
||||
* @param manager The gadget manager
|
||||
* @param rank The rank needed for the win room
|
||||
* @param winEffectType The win effect type, used to display in menus
|
||||
* @param alternativeSalepackageNames
|
||||
*/
|
||||
public WinEffectRankBased(GadgetManager manager, String name, String[] lore, Material material, byte data, Rank rank, WinEffectType winEffectType, String... alternativeSalepackageNames)
|
||||
public WinEffectRankBased(GadgetManager manager, String name, String[] lore, Material material, byte data, int cost, Rank rank, String... alternativeSalepackageNames)
|
||||
{
|
||||
super(manager, name, lore, -1, material, data, true, alternativeSalepackageNames);
|
||||
super(manager, name, lore, cost, material, data, true, alternativeSalepackageNames);
|
||||
_rank = rank;
|
||||
_winEffectType = winEffectType;
|
||||
_schematicName = winEffectType.getSchematic().replace("%r%", rank.getRawTag());
|
||||
_schematicName = "WinRank" + _rank.getRawTag();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ownsGadget(Player player)
|
||||
{
|
||||
return Manager.getClientManager().hasRank(player, _rank);
|
||||
}
|
||||
|
||||
public Rank getRank()
|
||||
{
|
||||
return _rank;
|
||||
}
|
||||
|
||||
public WinEffectType getWinEffectType()
|
||||
{
|
||||
return _winEffectType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the highest possible rank for the player
|
||||
* @param player The player
|
||||
* @return The highest rank for that player or null if GadgetManager isn't loaded
|
||||
*/
|
||||
public static Rank getHighestRankForPlayer(Player player)
|
||||
{
|
||||
GadgetManager gadgetManager = Managers.get(GadgetManager.class);
|
||||
if (gadgetManager != null)
|
||||
{
|
||||
Rank rank = gadgetManager.getClientManager().Get(player).GetRank();
|
||||
if (rank.has(Rank.ETERNAL))
|
||||
return Rank.ETERNAL;
|
||||
else
|
||||
return rank;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public enum WinEffectType
|
||||
{
|
||||
RANK_WIN_EFFECT("WinRank%r%");
|
||||
|
||||
private String _schematic;
|
||||
|
||||
WinEffectType(String schematic)
|
||||
{
|
||||
_schematic = schematic;
|
||||
}
|
||||
|
||||
public String getSchematic()
|
||||
{
|
||||
return _schematic;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.WinEffectRankBased;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -41,7 +42,7 @@ public class WinEffectRankEternal extends WinEffectRankBased
|
||||
{
|
||||
super(manager, "Eternal Win Effect",
|
||||
UtilText.splitLinesToArray(new String[]{C.cGray + "GWEN is ALWAYS watching."}, LineFormat.LORE),
|
||||
Material.PRISMARINE_SHARD, (byte) 0, Rank.ETERNAL, WinEffectType.RANK_WIN_EFFECT);
|
||||
Material.PRISMARINE_SHARD, (byte) 0, CostConstants.UNLOCKED_WITH_ETERNAL, Rank.ETERNAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.WinEffectRankBased;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -41,7 +42,7 @@ public class WinEffectRankHero extends WinEffectRankBased
|
||||
{
|
||||
super(manager, "Hero Win Effect",
|
||||
UtilText.splitLinesToArray(new String[]{C.cGray + "To become a True Hero you must first defeat the Dragon."}, LineFormat.LORE),
|
||||
Material.DRAGON_EGG, (byte) 0, Rank.HERO, WinEffectType.RANK_WIN_EFFECT);
|
||||
Material.DRAGON_EGG, (byte) 0, CostConstants.UNLOCKED_WITH_HERO, Rank.HERO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.WinEffectRankBased;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -41,7 +42,7 @@ public class WinEffectRankLegend extends WinEffectRankBased
|
||||
{
|
||||
super(manager, "Legend Win Effect",
|
||||
UtilText.splitLinesToArray(new String[]{C.cGray + "Can you weather this Withering Assault?"}, LineFormat.LORE),
|
||||
Material.SKULL_ITEM, (byte) 1, Rank.LEGEND, WinEffectType.RANK_WIN_EFFECT);
|
||||
Material.SKULL_ITEM, (byte) 1, CostConstants.UNLOCKED_WITH_LEGEND, Rank.LEGEND);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.WinEffectRankBased;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -38,7 +39,7 @@ public class WinEffectRankTitan extends WinEffectRankBased
|
||||
{
|
||||
super(manager, "Titan Win Effect",
|
||||
UtilText.splitLinesToArray(new String[]{C.cGray + "Legend has it that the Titans were so powerful they towered over even the gods."}, LineFormat.LORE),
|
||||
Material.ROTTEN_FLESH, (byte) 0, Rank.TITAN, WinEffectType.RANK_WIN_EFFECT);
|
||||
Material.ROTTEN_FLESH, (byte) 0, CostConstants.UNLOCKED_WITH_TITAN, Rank.TITAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.WinEffectRankBased;
|
||||
import mineplex.core.gadget.util.CostConstants;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -38,7 +39,7 @@ public class WinEffectRankUltra extends WinEffectRankBased
|
||||
public WinEffectRankUltra(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Ultra Win Effect", UtilText.splitLinesToArray(new String[]{C.cGray + "Always check behind you."}, LineFormat.LORE),
|
||||
Material.SKULL_ITEM, (byte) 4, Rank.ULTRA, WinEffectType.RANK_WIN_EFFECT);
|
||||
Material.SKULL_ITEM, (byte) 4, CostConstants.UNLOCKED_WITH_ULTRA, Rank.ULTRA);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user