Finish everything

This commit is contained in:
Sam 2017-09-08 11:10:24 +01:00
parent 8670f13879
commit 7b1245077f
32 changed files with 543 additions and 231 deletions

View File

@ -69,12 +69,6 @@ public class CosmeticManager extends MiniPlugin
_shop = new CosmeticShop(this, clientManager, donationManager, _moduleName);
}
/*@Override
public void addCommands()
{
addCommand(new CosmeticsSlackCommand(this));
}*/
public void showInterface(boolean showInterface)
{
boolean changed = _showInterface == showInterface;

View File

@ -3,10 +3,8 @@ package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.Sound;
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.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
@ -17,9 +15,7 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuit;
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksSuit;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class CostumePage extends GadgetPage
@ -92,21 +88,4 @@ public class CostumePage extends GadgetPage
addBackButton();
}
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);
buildPage();
}
}

View File

@ -122,15 +122,10 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
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)));
addButton(slot, 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)
{
addGadget(gadget, slot, false);
}
protected void addGadget(Gadget gadget, int slot, boolean locked)
{
boolean owns = gadget.ownsGadget(getPlayer());
int shardCost = gadget.getCost(GlobalCurrency.TREASURE_SHARD);
@ -161,7 +156,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
}
if (!owns || locked)
if (!owns)
{
int displayedShardCost = shardCost;
@ -300,7 +295,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
addCustomLore(gadget, itemLore);
if (owns && !locked)
if (owns)
{
ItemStack gadgetItemStack;
@ -421,7 +416,6 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void handleRightClick(Player player, Gadget gadget)
{
player.sendMessage("Preview?");
}
public void deactivateGadget(Player player, Gadget gadget)

View File

@ -36,11 +36,6 @@ public class ItemGadgetPage extends GadgetPage
@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)

View File

@ -1,5 +1,11 @@
package mineplex.core.cosmetic.ui.page.gamemodifiers;
import java.util.ArrayList;
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;
@ -7,10 +13,8 @@ import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
import mineplex.core.gadget.types.GameModifierGadget;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.ShopItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public class GameCosmeticGadgetPage extends GadgetPage
{
@ -31,18 +35,14 @@ public class GameCosmeticGadgetPage extends GadgetPage
@Override
protected void buildPage()
{
int slot = 10;
super.buildPage();
for (GameModifierGadget gadget : _category.getGadgets())
{
addGadget(gadget, slot);
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[]{}, 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
}
if (++slot % 9 == 8)
{
slot += 2;
}
}
addButton(4, new ShopItem(Material.BED, C.cGreen + " Go Back", new String[]{}, 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
@Override
protected List<Gadget> getGadgetsToDisplay()
{
return new ArrayList<>(_category.getGadgets());
}
}

View File

@ -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, null);
super(plugin, shop, clientManager, donationManager, name, player);
_previousMenu = previousMenu;
@ -99,6 +99,6 @@ public class HeroSkinCategoryPage extends GadgetPage
addButton(slots[index++], itemStack, (player, clickType) -> getShop().openPageForPlayer(player, new HeroSkinGadgetPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), name, getPlayer(), this, gadgetDataList)));
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
}
}

View File

@ -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, null);
super(plugin, shop, clientManager, donationManager, name, player);
_previousMenu = previousMenu;
_gadgetData = gadgetData;
@ -45,6 +45,6 @@ public class HeroSkinGadgetPage extends GadgetPage
}
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), _previousMenu));
}
}

View File

@ -44,8 +44,10 @@ import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.commands.AmmoCommand;
import mineplex.core.gadget.commands.LockCosmeticsCommand;
import mineplex.core.gadget.commands.TestUnlockCommand;
import mineplex.core.gadget.commands.UnlockCosmeticsCommand;
import mineplex.core.gadget.event.GadgetChangeEvent;
import mineplex.core.gadget.event.GadgetChangeEvent.GadgetState;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
@ -422,7 +424,8 @@ public class GadgetManager extends MiniPlugin
{
PermissionGroup.QA.setPermission(Perm.LOCK_COSMETICS_COMMAND, true, true);
PermissionGroup.QA.setPermission(Perm.UNLOCK_COSMETICS_COMMAND, true, true);
} else
}
else
{
PermissionGroup.ADMIN.setPermission(Perm.LOCK_COSMETICS_COMMAND, true, true);
PermissionGroup.ADMIN.setPermission(Perm.UNLOCK_COSMETICS_COMMAND, true, true);
@ -435,6 +438,7 @@ public class GadgetManager extends MiniPlugin
addCommand(new UnlockCosmeticsCommand(this));
addCommand(new LockCosmeticsCommand(this));
addCommand(new AmmoCommand(this));
addCommand(new TestUnlockCommand(this));
}
private void createSets()
@ -1475,55 +1479,10 @@ public class GadgetManager extends MiniPlugin
private void saveGadget(GadgetChangeEvent event)
{
Gadget gadget = event.getGadget();
if (gadget != null)
{
String value = "disabled", key;
GadgetType gadgetType = gadget.getGadgetType();
switch (gadgetType)
{
case MUSIC_DISC:
case ITEM:
case MORPH:
case BALLOON:
case MOUNT:
return;
case COSTUME:
OutfitGadget outfitGadget = (OutfitGadget) gadget;
key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
{
value = outfitGadget.getName();
}
break;
case GAME_MODIFIER:
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
GameCosmeticCategory category = gameModifierGadget.getCategory();
if (category.isAllowingMultiple())
{
key = gameModifierGadget.getName();
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
{
value = "enabled";
}
}
else
{
key = "active" + category.getType().getName().replace(" ", "");
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
{
value = gameModifierGadget.getName();
}
}
break;
default:
key = gadgetType.getDatabaseKey();
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
{
value = gadget.getName();
}
}
_userGadgetPersistence.save(event.getPlayer(), key, value);
_userGadgetPersistence.save(event.getPlayer(), gadget, event.getGadgetState() == GadgetState.ENABLED);
}
}

View File

@ -15,14 +15,11 @@ import mineplex.core.pet.PetType;
public class LockCosmeticsCommand extends CommandBase<GadgetManager>
{
private GadgetManager _plugin;
public LockCosmeticsCommand(GadgetManager plugin)
{
super(plugin, GadgetManager.Perm.LOCK_COSMETICS_COMMAND, "lockCosmetics");
_plugin = plugin;
}
}
@Override
public void Execute(Player caller, String[] args)
@ -38,7 +35,7 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
if (player != null)
{
removeCosmetics(null, player);
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Removed all the cosmetics to " + F.name(player.getName()) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Removed all the cosmetics to " + F.name(player.getName()) + "!"));
}
}
}
@ -54,9 +51,9 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
removePets(caller);
return;
}
Donor donor = _plugin.getDonationManager().Get(caller);
Donor donor = Plugin.getDonationManager().Get(caller);
int removed = 0;
for (Gadget gadget : _plugin.getGadgets(gadgetType))
for (Gadget gadget : Plugin.getGadgets(gadgetType))
{
if (gadget != null)
{
@ -77,7 +74,7 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
}
}
}
UtilPlayer.message(caller, F.main("Lock Cosmetics", "Removed " + removed + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", removed) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Removed " + removed + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", removed) + "!"));
}
private void removePets(Player caller)
@ -85,11 +82,11 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
int removed = 0;
for (PetType pet : PetType.values())
{
if (_plugin.getPetManager().Get(caller).getPets().remove(pet) != null)
if (Plugin.getPetManager().Get(caller).getPets().remove(pet) != null)
{
removed++;
}
}
UtilPlayer.message(caller, F.main("Lock Cosmetics", "Removed " + removed + UtilText.plural(" pet", removed) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Removed " + removed + UtilText.plural(" pet", removed) + "!"));
}
}

View File

@ -17,13 +17,9 @@ import mineplex.core.pet.PetType;
public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
{
private GadgetManager _plugin;
public UnlockCosmeticsCommand(GadgetManager plugin)
{
super(plugin, GadgetManager.Perm.UNLOCK_COSMETICS_COMMAND, "unlockCosmetics");
_plugin = plugin;
}
@Override
@ -43,7 +39,7 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
if (player != null)
{
addCosmetics(null, player);
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added all the cosmetics to " + F.name(player.getName()) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Added all the cosmetics to " + F.name(player.getName()) + "!"));
}
}
}
@ -55,7 +51,7 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
if (player != null)
{
addCosmetics(null, player);
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added all the cosmetics to " + F.name(player.getName()) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Added all the cosmetics to " + F.name(player.getName()) + "!"));
}
}
}
@ -73,9 +69,9 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
addPets(caller);
return;
}
Donor donor = _plugin.getDonationManager().Get(caller);
Donor donor = Plugin.getDonationManager().Get(caller);
int added = 0;
for (Gadget gadget : _plugin.getGadgets(gadgetType))
for (Gadget gadget : Plugin.getGadgets(gadgetType))
{
if (gadget.isHidden())
{
@ -103,7 +99,7 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
added++;
}
}
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added " + added + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", added) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Added " + added + F.elem(" " + gadgetType.getCategoryType()) + UtilText.plural(" item", added) + "!"));
}
private void addPets(Player caller)
@ -111,12 +107,12 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
int added = 0;
for (PetType pet : PetType.values())
{
if (!_plugin.getPetManager().Get(caller).getPets().containsKey(pet))
if (!Plugin.getPetManager().Get(caller).getPets().containsKey(pet))
{
_plugin.getPetManager().Get(caller).getPets().put(pet, pet.getName());
Plugin.getPetManager().Get(caller).getPets().put(pet, pet.getName());
added++;
}
}
UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added " + added + UtilText.plural(" pet", added) + "!"));
UtilPlayer.message(caller, F.main(Plugin.getName(), "Added " + added + UtilText.plural(" pet", added) + "!"));
}
}

View File

@ -12,12 +12,13 @@ public class GemHuntersMountGadget extends GameModifierGadget
private final GemHuntersMountType _type;
// An alternative package name of "Clans " + name is due to mounts from the store originally just for clans beingavailablee on more platforms.
public GemHuntersMountGadget(GadgetManager manager, GameCosmeticCategory category, GemHuntersMountType type)
{
super(manager, category, type.getName() + " Mount", new String[] {
super(manager, category, type.getName(), new String[]{
C.cGray + "Changed your active Mount",
C.cGray + "in " + F.greenElem("Gem Hunters") + " to " + type.getName() + ".",
}, CostConstants.PURCHASED_FROM_STORE, type.getMaterial(), type.getMaterialData());
}, CostConstants.PURCHASED_FROM_STORE, type.getMaterial(), type.getMaterialData(), "Clans " + type.getName());
_type = type;
}

View File

@ -1,26 +1,235 @@
package mineplex.core.gadget.gadgets.gamemodifiers.gemhunters;
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 mineplex.core.Managers;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.disguise.disguises.DisguiseSheep;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.utils.UtilVariant;
public enum GemHuntersMountType
{
DONKEY("Donkey", Material.CHEST)
INFERNAL_HORROR("Infernal Horror Mount Skin", Material.BONE)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
return UtilVariant.spawnHorse(location, Variant.SKELETON_HORSE);
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.FLAME, horse.getLocation().add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0, 2, ViewDist.NORMAL);
}
},
GLACIAL_STEED("Glacial Steed Mount Skin", Material.SNOW_BALL)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
horse.setColor(Color.WHITE);
horse.setStyle(Style.WHITE);
return horse;
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0.1F, 4, ViewDist.NORMAL);
}
},
ZOMBIE_HORSE("Zombie Horse Mount Skin", Material.ROTTEN_FLESH)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
return UtilVariant.spawnHorse(location, Variant.UNDEAD_HORSE);
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.FOOTSTEP, horse.getLocation(), null, 0, 1, ViewDist.NORMAL);
}
},
RAINBOW_SHEEP("Rainbow Sheep Mount Skin", Material.WOOL, 14)
{
private DisguiseManager _disguise = Managers.get(DisguiseManager.class);
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
manager.disguise(new DisguiseSheep(horse));
return horse;
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
DisguiseBase base = _disguise.getActiveDisguise(horse);
if (base == null || !(base instanceof DisguiseSheep))
{
return;
}
DisguiseSheep sheep = (DisguiseSheep) base;
int mod = horse.getTicksLived() % 4;
if (mod == 0) sheep.setColor(DyeColor.RED);
else if (mod == 1) sheep.setColor(DyeColor.YELLOW);
else if (mod == 2) sheep.setColor(DyeColor.GREEN);
else if (mod == 3) sheep.setColor(DyeColor.BLUE);
}
},
ROYAL_STEED("Royal Steed Mount Skin", Material.GOLD_BARDING)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
horse.setColor(Color.WHITE);
horse.setStyle(Style.WHITE);
return horse;
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.BLOCK_DUST.getParticle(Material.GOLD_BLOCK, 0), horse.getLocation().add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0, 3, ViewDist.NORMAL);
}
},
ROYAL_GUARD_STEED("Royal Guard Steed Mount Skin", Material.DIAMOND_BARDING)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
horse.setColor(Color.WHITE);
horse.setStyle(Style.WHITE);
return horse;
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.BLOCK_DUST.getParticle(Material.IRON_BLOCK, 0), horse.getLocation().add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0, 3, ViewDist.NORMAL);
}
},
KNIGHT_STEED("Knight Steed Mount Skin", Material.DIAMOND_BARDING)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
horse.setColor(Color.GRAY);
horse.setStyle(Style.NONE);
return horse;
}
@Override
public void onUpdate(UpdateEvent event, Horse horse)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.APPLE, 0), horse.getLocation().add(0, 1, 0), 0.25F, 0.25F, 0.25F, 0, 3, ViewDist.NORMAL);
}
},
COW("Cow Mount Skin", Material.MILK_BUCKET)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
manager.disguise(new DisguiseCow(horse));
return horse;
}
},
SHEEP("Sheep Mount Skin", Material.WOOL)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
Horse horse = UtilVariant.spawnHorse(location, Variant.HORSE);
manager.disguise(new DisguiseSheep(horse));
return horse;
}
},
TRUSTY_MULE("Trusty Mule Mount Skin", Material.APPLE)
{
@Override
public Horse spawn(Location location, DisguiseManager manager)
{
return UtilVariant.spawnHorse(location, Variant.DONKEY);
}
},
};
;
private final String _name;
private final Material _material;

View File

@ -33,7 +33,7 @@ public enum EmblemType
public String getName()
{
return _name;
return _name + " Emblem";
}
public String getSchematic()

View File

@ -109,7 +109,7 @@ public enum ShopMorphType
public String getName()
{
return _name;
return _name + " Shop Skin";
}
public Material getMaterial()

View File

@ -68,7 +68,7 @@ public class HeroSkinGadget extends GameModifierGadget
public HeroSkinGadget(GadgetManager manager, GameCosmeticCategory category, HeroSkinGadgetData skinData, int cost)
{
super(manager, category, skinData.getName(), new String[]{C.cGray + "Rarity: " + skinData.getRarity().getColor() + skinData.getRarity().getName(), "", C.cGray + ChatColor.translateAlternateColorCodes('&', skinData.getDescription())}, cost, Material.GLASS, (byte) 0);
super(manager, category, skinData.getName() + " (" + skinData.getHero() + ")", new String[]{C.cGray + "Rarity: " + skinData.getRarity().getColor() + skinData.getRarity().getName(), "", C.cGray + ChatColor.translateAlternateColorCodes('&', skinData.getDescription())}, cost, Material.GLASS, (byte) 0);
setDisplayItem(skinData.getSkinData().getSkull());
skinData.setGadget(this);

View File

@ -41,12 +41,6 @@ public class ItemEtherealPearl extends ItemGadget
500, new Ammo("Ethereal Pearl", "50 Pearls", Material.ENDER_PEARL, (byte)0, new String[] { C.cWhite + "50 Pearls to get around with!" }, 500, 50));
}
@Override
public void disableCustom(Player player, boolean message)
{
super.disableCustom(player, message);
}
@Override
public void ActivateCustom(Player player)
{

View File

@ -14,6 +14,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
@ -70,6 +71,6 @@ public class ItemFirework extends ItemGadget
UtilFirework.launchFirework(loc,
FireworkEffect.builder().flicker(Math.random() > 0.5).withColor(color).with(type).trail(Math.random() > 0.5).build(),
new Vector(0,0,0), 0 + (int)(Math.random()*3));
new Vector(0,0,0), UtilMath.r(3) + 1);
}
}

View File

@ -155,7 +155,8 @@ public abstract class Mount<T extends MountData> extends Gadget
UtilAction.velocity(part, direction, 1.2, false, 0, 0.8, 10, true);
}
direction.multiply(-1);
direction.setX(-direction.getX());
direction.setZ(-direction.getZ());
for (Entity part : otherParts)
{

View File

@ -1,19 +1,15 @@
package mineplex.core.gadget.persistence;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.*;
import org.bukkit.entity.Player;
import mineplex.core.common.util.BukkitFuture;
import mineplex.core.common.util.F;
import mineplex.core.database.PlayerKeyValueRepository;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GameModifierGadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.GameModifierGadget;
import mineplex.core.gadget.types.OutfitGadget;
import org.bukkit.entity.Player;
public class UserGadgetPersistence
{
@ -24,19 +20,22 @@ public class UserGadgetPersistence
public UserGadgetPersistence(GadgetManager manager)
{
_manager = manager;
_repository = new PlayerKeyValueRepository<>("gadgets", PreparedStatement::setString, ResultSet::getString);
_repository = new PlayerKeyValueRepository<>("gadgets", String.class);
}
public void load(Player player)
{
_repository.getAll(player.getUniqueId()).thenCompose(BukkitFuture.accept(values -> {
_repository.getAll(player.getUniqueId()).thenCompose(BukkitFuture.accept(values ->
{
if (player.isOnline())
{
boolean enabledGadget = false;
for (Gadget gadget : _manager.getAllGadgets())
{
if (!gadget.ownsGadget(player))
{
continue;
}
GadgetType gadgetType = gadget.getGadgetType();
switch (gadgetType)
{
@ -54,7 +53,6 @@ public class UserGadgetPersistence
if (values.get(key).equals(gadget.getName()))
{
gadget.enable(player, false);
enabledGadget = true;
}
break;
case GAME_MODIFIER:
@ -68,48 +66,95 @@ public class UserGadgetPersistence
if (values.get(gadget.getName()).equals("enabled"))
{
gadget.enable(player, false);
enabledGadget = true;
}
}
else
{
String dataKey = "active" + category.getType().getName().replace(" ", "");
if (!values.containsKey(dataKey))
key = "active" + category.getType().getName().replace(" ", "") + category.getCategoryName().replace(" ", "");
if (!values.containsKey(key))
continue;
if (values.get(dataKey).equals(gadget.getName()))
if (values.get(key).equals(gadget.getName()))
{
gadget.enable(player, false);
enabledGadget = true;
}
}
break;
default:
if (!values.containsKey(gadgetType.getDatabaseKey()))
{
continue;
}
if (values.get(gadgetType.getDatabaseKey()).equals(gadget.getName()))
{
gadget.enable(player, false);
enabledGadget = true;
}
break;
}
}
if (enabledGadget)
{
player.sendMessage(F.main("Cosmetics", "You enabled all your previously enabled cosmetics!"));
}
}
}));
}
public void save(Player player, Map<String, String> values)
public void save(Player player, Gadget gadget, boolean enabled)
{
_repository.putAll(player.getUniqueId(), values);
}
String value = "disabled", key;
GadgetType gadgetType = gadget.getGadgetType();
public void save(Player player, String key, String value)
{
_repository.put(player.getUniqueId(), key, value);
switch (gadgetType)
{
case MUSIC_DISC:
case ITEM:
case MORPH:
case BALLOON:
case MOUNT:
return;
case COSTUME:
OutfitGadget outfitGadget = (OutfitGadget) gadget;
key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
if (enabled)
{
value = outfitGadget.getName();
}
break;
case GAME_MODIFIER:
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
GameCosmeticCategory category = gameModifierGadget.getCategory();
if (category.isAllowingMultiple())
{
key = gameModifierGadget.getName();
if (enabled)
{
value = "enabled";
}
}
else
{
key = "active" + category.getType().getName().replace(" ", "") + category.getCategoryName().replace(" ", "");
if (enabled)
{
value = gameModifierGadget.getName();
}
}
break;
default:
key = gadgetType.getDatabaseKey();
if (enabled)
{
value = gadget.getName();
}
}
if (!enabled)
{
_repository.remove(player.getUniqueId(), key);
}
else
{
_repository.put(player.getUniqueId(), key, value);
}
}
}

View File

@ -13,9 +13,9 @@ public class GameModifierGadget extends Gadget
private final GameCosmeticCategory _category;
public GameModifierGadget(GadgetManager manager, GameCosmeticCategory category, String name, String[] desc, int cost, Material mat, byte data)
public GameModifierGadget(GadgetManager manager, GameCosmeticCategory category, String name, String[] desc, int cost, Material mat, byte data, String... alternativePackageNames)
{
super(manager, GadgetType.GAME_MODIFIER, name, desc, cost, mat, data);
super(manager, GadgetType.GAME_MODIFIER, name, desc, cost, mat, data, 1, alternativePackageNames);
_category = category;
}

View File

@ -33,7 +33,8 @@ public class CastleSiegeTesterTrack extends Track
"7b133339-2e02-48ef-9dd4-692415933dc5", // Kreshyy
"4e941b23-6e36-48cb-97c4-24f56ea128c1", // DooDooBug25
"0a4b6d83-8eb0-46aa-bc0f-9b7f04046d52", // Livicus
"4f8f5380-ffe1-418d-97a4-0737c6edf352" // Hils
"4f8f5380-ffe1-418d-97a4-0737c6edf352", // Hils
"e873e1c7-8e7d-4489-84e1-74b86e1b4ba7" // Dutty
);
public CastleSiegeTesterTrack()

View File

@ -92,16 +92,17 @@ public class Moba extends TeamGame
}
private static final String[] ITEM_IMAGES =
{
"Anath_the_Burnt.png",
"Bardolf.png",
"Biff.png",
"Dana.png",
"Devon.png",
"Hattori.png",
"Larissa.png",
"Rowena.png"
};
{
"Ivy.png",
"Anath_the_Burnt.png",
"Bardolf.png",
"Biff.png",
"Dana.png",
"Devon.png",
"Hattori.png",
"Larissa.png",
"Rowena.png"
};
private final HeroKit[] _kits;

View File

@ -0,0 +1,73 @@
package nautilus.game.arcade.game.games.moba.buff.buffs;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.events.EntityVelocityChangeEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
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.UtilTextMiddle;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.Buff;
import nautilus.game.arcade.game.games.moba.kit.HeroSkillUseEvent;
public class BuffCrippled extends Buff<Player>
{
public BuffCrippled(Moba host, Player entity, long duration)
{
super(host, entity, duration);
}
@Override
public void onApply()
{
_entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (_duration / 50D), 1));
UtilTextMiddle.display("", C.cRed + "Crippled", 10, 20, 10, (Player) _entity);
}
@Override
public void onExpire()
{
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
{
return;
}
UtilParticle.PlayParticleToAll(ParticleType.PORTAL, _entity.getLocation().add(0, 1, 0), 0.5F, 0.2F, 0.5F, 0.1F, 5, ViewDist.LONG);
}
@EventHandler
public void velocityApply(EntityVelocityChangeEvent event)
{
if (event.getEntity().equals(_entity))
{
event.setCancelled(true);
}
}
@EventHandler
public void useMovementSkill(HeroSkillUseEvent event)
{
Player player = event.getPlayer();
if (player.equals(_entity) && event.getSkill().isSneakActivate())
{
player.sendMessage(F.main("Game", "You cannot use movement abilities while " + F.name("Crippled") + "."));
event.setCancelled(true);
}
}
}

View File

@ -1,7 +1,13 @@
package nautilus.game.arcade.game.games.moba.buff.buffs;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.events.EntityVelocityChangeEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
@ -9,12 +15,10 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.Buff;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import nautilus.game.arcade.game.games.moba.kit.HeroSkillUseEvent;
public class BuffRooting extends Buff<Player>
{
@ -28,6 +32,7 @@ public class BuffRooting extends Buff<Player>
public void onApply()
{
UtilAction.zeroVelocity(_entity);
_entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 3));
UtilTextMiddle.display("", C.cRed + "Rooted", 10, 20, 10, (Player) _entity);
}
@ -45,7 +50,7 @@ public class BuffRooting extends Buff<Player>
return;
}
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, _entity.getLocation().add(0, 0.5, 0), 0.5F, 0.2F, 0.5F, 0.1F, 5, ViewDist.LONG);
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, _entity.getLocation().add(0, 1, 0), 0.5F, 0.2F, 0.5F, 0.1F, 3, ViewDist.LONG);
}
@EventHandler
@ -58,21 +63,14 @@ public class BuffRooting extends Buff<Player>
}
@EventHandler
public void move(PlayerMoveEvent event)
public void useMovementSkill(HeroSkillUseEvent event)
{
if (!event.getPlayer().equals(_entity))
Player player = event.getPlayer();
if (player.equals(_entity) && event.getSkill().isSneakActivate())
{
return;
player.sendMessage(F.main("Game", "You cannot use movement abilities while " + F.name("Rooted") + "."));
event.setCancelled(true);
}
Location from = event.getFrom();
Location to = event.getTo();
if (from.getX() == to.getX() && from.getZ() == to.getZ())
{
return;
}
event.setTo(from);
}
}

View File

@ -188,12 +188,12 @@ public class HeroSkill extends Perk
if (itemStack.isSimilar(_item))
{
if (_dropItemActivate && !Recharge.Instance.use(player, "Ultimate", _cooldown, false, false))
if (_dropItemActivate && !Recharge.Instance.use(player, "Ultimate", _cooldown - 250, false, false))
{
return false;
}
return true;
return !callEvent(player);
}
return false;
@ -209,13 +209,20 @@ public class HeroSkill extends Perk
Player player = event.getPlayer();
ItemStack itemStack = player.getInventory().getItem(_slot);
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || itemStack == null)
if (!hasPerk(player) || UtilPlayer.isSpectator(player) || itemStack == null || !itemStack.isSimilar(_item))
{
return false;
}
return itemStack.isSimilar(_item);
return !callEvent(player);
}
private boolean callEvent(Player player)
{
HeroSkillUseEvent event = new HeroSkillUseEvent(player, this);
UtilServer.CallEvent(event);
return event.isCancelled();
}
@EventHandler
@ -411,4 +418,9 @@ public class HeroSkill extends Perk
{
return _lastSkill.containsKey(player.getUniqueId());
}
public boolean isSneakActivate()
{
return _sneakActivate;
}
}

View File

@ -0,0 +1,51 @@
package nautilus.game.arcade.game.games.moba.kit;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class HeroSkillUseEvent extends PlayerEvent implements Cancellable
{
private static final HandlerList _handlers = new HandlerList();
private HeroSkill _skill;
private boolean _cancelled;
public HeroSkillUseEvent(Player who, HeroSkill skill)
{
super(who);
_skill = skill;
}
public HeroSkill getSkill()
{
return _skill;
}
@Override
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
@Override
public boolean isCancelled()
{
return _cancelled;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -29,7 +29,7 @@ import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.moba.Moba;
import nautilus.game.arcade.game.games.moba.buff.BuffManager;
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffRooting;
import nautilus.game.arcade.game.games.moba.buff.buffs.BuffCrippled;
import nautilus.game.arcade.game.games.moba.kit.HeroSkill;
public class SkillBoxingRing extends HeroSkill
@ -68,10 +68,6 @@ public class SkillBoxingRing extends HeroSkill
Player player = event.getPlayer();
Location location = player.getLocation().subtract(0, 1, 0);
byte colour = (byte) (Manager.GetGame().GetTeam(player).GetColor() == ChatColor.RED ? 14 : 11);
// // Double Plants work by the bottom block having a data value, in this case 4, the top part of the plant has
// // a data value of 8, this tells the client to render the top of the part of the block located below itself.
// byte bottomFlower = 4;
// byte topFlower = 8;
location.getWorld().playEffect(location, Effect.STEP_SOUND, Material.STAINED_CLAY, colour);
@ -80,10 +76,6 @@ public class SkillBoxingRing extends HeroSkill
Manager.GetBlockRestore().add(block, Material.STAINED_CLAY.getId(), colour, DURATION + UtilMath.rRange(-500, 500));
}
// for (Block block : getSquareBlocks(location, BLOCK_RADIUS, true))
// {
// Manager.GetBlockRestore().add(block, Material.GRASS.getId(), (byte) 0, DURATION + 500 + UtilMath.r(250));
// }
location.add(0, 1, 0);
@ -91,9 +83,6 @@ public class SkillBoxingRing extends HeroSkill
{
Manager.GetBlockRestore().add(block, Material.RED_ROSE.getId(), (byte) 0, DURATION + UtilMath.r(500));
block.getWorld().playEffect(block.getLocation().add(0.5, 0.5, 0.5), Effect.STEP_SOUND, Material.RED_ROSE);
// long duration = DURATION + UtilMath.r(250);
// Manager.GetBlockRestore().add(block, Material.DOUBLE_PLANT.getId(), bottomFlower, duration);
// Manager.GetBlockRestore().add(block, Material.DOUBLE_PLANT.getId(), topFlower, duration);
}
_data.add(new BoxingRingData(player));
@ -134,7 +123,7 @@ public class SkillBoxingRing extends HeroSkill
}
else if (Recharge.Instance.use(nearby, GetName() + " Rooting", 2000, false, false))
{
buffManager.apply(new BuffRooting(host, nearby, DEBUFF_DURATION));
buffManager.apply(new BuffCrippled(host, nearby, DEBUFF_DURATION));
}
else if (Recharge.Instance.use(nearby, GetName() + " Damage", 900, false, false))
{

View File

@ -57,7 +57,8 @@ public class SkillFloralLeap extends HeroSkill
new DustSpellColor(Color.MAGENTA)
};
private static final long DURATION = TimeUnit.SECONDS.toMillis(5);
private static final int BLOCK_RADIUS = 5;
private static final int DAMAGE_RADIUS = 5;
private static final int BLOCK_RADIUS = 3;
private static final PotionEffect DEBUFF = new PotionEffect(PotionEffectType.SLOW, 50, 2, false, false);
private static final int DAMAGE = 2;
@ -143,7 +144,7 @@ public class SkillFloralLeap extends HeroSkill
data.LastDamage = System.currentTimeMillis();
for (LivingEntity nearby : UtilEnt.getInRadius(data.Center, BLOCK_RADIUS).keySet())
for (LivingEntity nearby : UtilEnt.getInRadius(data.Center, DAMAGE_RADIUS).keySet())
{
if (isTeamDamage(player, nearby))
{

View File

@ -35,7 +35,7 @@ public class SkillHook extends HeroSkill
"and pulling them towards you."
};
private static final ItemStack SKILL_ITEM = new ItemStack(Material.VINE);
private static final int RANGE = 7;
private static final int RANGE = 9;
private static final int DAMAGE_PLAYER = 4;
private static final int DAMAGE_MINION = 6;
private static final PotionEffect DEBUFF = new PotionEffect(PotionEffectType.SLOW, 60, 2, false, false);
@ -82,7 +82,7 @@ public class SkillHook extends HeroSkill
return true;
}
for (int i = 0; i < 4; i++)
for (int i = 0; i < 10; i++)
{
if (leash.update())
{
@ -91,7 +91,7 @@ public class SkillHook extends HeroSkill
if (data.Target == null)
{
for (LivingEntity nearby : UtilEnt.getInRadius(leash.getLastLocation().subtract(0, 1.2, 0), 1).keySet())
for (LivingEntity nearby : UtilEnt.getInRadius(leash.getLastLocation().subtract(0, 1.2, 0), 2).keySet())
{
if (isTeamDamage(player, nearby))
{
@ -101,6 +101,7 @@ public class SkillHook extends HeroSkill
if (nearby instanceof Player)
{
data.Target = (Player) nearby;
nearby.addPotionEffect(DEBUFF);
UtilAction.zeroVelocity(nearby);
Manager.GetDamage().NewDamageEvent(nearby, player, null, DamageCause.CUSTOM, DAMAGE_PLAYER, false, false, false, player.getName(), GetName());
}
@ -122,7 +123,6 @@ public class SkillHook extends HeroSkill
if (UtilMath.offset2dSquared(target.getLocation(), player.getLocation()) < 4)
{
UtilAction.zeroVelocity(target);
target.addPotionEffect(DEBUFF);
return true;
}

View File

@ -82,7 +82,7 @@ public class MobaProgression implements Listener
_host.getArcadeManager().GetStatsManager().setStat(caller, _host.GetName() + "." + role.getName() + ".ExpEarned", exp);
caller.sendMessage(F.main("Debug", "Set your " + role.getChatColor() + role.getName() + C.cGray + " level to " + F.elem(getLevel(exp) + 1) + "."));
});
host.registerDebugCommand("unlockhero", Perm.DEBUG_UNLOCK_HERO_COMMAND, (caller, args) ->
host.registerDebugCommand("unlockhero", Perm.DEBUG_UNLOCK_HERO_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
Donor donor = _host.getArcadeManager().GetDonation().Get(caller);
String input = args[0];
@ -97,7 +97,7 @@ public class MobaProgression implements Listener
}
}
});
host.registerDebugCommand("lockhero", Perm.DEBUG_LOCK_HERO_COMMAND, (caller, args) ->
host.registerDebugCommand("lockhero", Perm.DEBUG_LOCK_HERO_COMMAND, PermissionGroup.DEV, (caller, args) ->
{
Donor donor = _host.getArcadeManager().GetDonation().Get(caller);
String input = args[0];

View File

@ -9,7 +9,6 @@ import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -20,6 +19,7 @@ import org.bukkit.util.Vector;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
@ -90,11 +90,13 @@ public class MobaUnlockAnimation implements Listener
_player.teleport(_toTeleport);
_npcEntity = _npc.getWorld().spawn(_npc, ArmorStand.class);
GameProfile profile = new GameProfile(UUID.randomUUID(), _kit.GetName());
GameProfile profile = new GameProfile(UUID.randomUUID(), SkinData.getUnusedSkullName());
profile.getProperties().clear();
profile.getProperties().put("textures", _kit.getSkinData().getProperty());
DisguisePlayer disguise = new DisguisePlayer(_npcEntity, profile);
disguise.getHologram()
.setText(_kit.getRole().getChatColor() + C.Bold + _kit.GetName());
_host.getArcadeManager().GetDisguise().disguise(disguise);
}

View File

@ -7,6 +7,8 @@ import org.bukkit.Location;
import org.bukkit.Material;
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;
@ -29,6 +31,8 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseInsentient;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GemHuntersMountGadget;
import mineplex.core.game.GameDisplay;
@ -89,7 +93,7 @@ public class MountModule extends MiniClientPlugin<MountData>
String metadata = lootItem.getMetadata();
String[] split = metadata.split(" ");
if (split.length < 2)
if (split.length < 2 || !split[0].equals("MOUNT"))
{
return;
}
@ -131,6 +135,8 @@ public class MountModule extends MiniClientPlugin<MountData>
if (gadget == null)
{
horse = UtilVariant.spawnHorse(location, Variant.HORSE);
horse.setColor(Color.BROWN);
horse.setStyle(Style.NONE);
}
else
{
@ -147,9 +153,17 @@ public class MountModule extends MiniClientPlugin<MountData>
horse.setMaxDomestication(1);
horse.setOwner(player);
horse.setTamed(true);
horse.setCarryingChest(true);
horse.setMaxHealth(HEALTH);
horse.setHealth(HEALTH);
UtilEnt.vegetate(player);
UtilEnt.vegetate(horse);
DisguiseBase disguise = _disguise.getActiveDisguise(horse);
if (disguise != null && disguise instanceof DisguiseInsentient)
{
((DisguiseInsentient) disguise).setName(name);
}
data.onSpawn(horse, cooldown, lootItem.getItemStack());
player.sendMessage(F.main(_moduleName, "You spawned your " + F.name(getName()) + "."));
@ -323,6 +337,11 @@ public class MountModule extends MiniClientPlugin<MountData>
"Mount Skins"
);
if (gadget == null)
{
continue;
}
gadget.getType().onUpdate(event, data.getEntity());
}
}