Remove all GameModifiers and replace them with GameCosmetics
This commit is contained in:
parent
16daa3f7d8
commit
89e820e442
@ -1,5 +1,10 @@
|
||||
package mineplex.core.cosmetic.ui.page.gamemodifiers;
|
||||
|
||||
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.common.util.UtilUI;
|
||||
@ -12,10 +17,6 @@ import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticType;
|
||||
import mineplex.core.gadget.types.GameModifierGadget;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GameCosmeticCategoryPage extends GadgetPage
|
||||
{
|
||||
@ -67,7 +68,7 @@ public class GameCosmeticCategoryPage extends GadgetPage
|
||||
C.cGreen + "Left-Click to view " + category.getCategoryName() + " cosmetics"
|
||||
);
|
||||
|
||||
addButton(slots[index++], builder.build(), (player, clickType) -> getShop().openPageForPlayer(player, new GameCosmeticGadgetPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), category.getCategoryName(), player, this, category)));
|
||||
addButton(slots[index++], builder.build(), (player, clickType) -> getShop().openPageForPlayer(player, category.getGadgetPage(this)));
|
||||
}
|
||||
|
||||
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)));
|
||||
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -99,12 +98,6 @@ import mineplex.core.gadget.gadgets.flag.FlagType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GameModifierMount;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.MountType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.hat.HatItem;
|
||||
@ -320,15 +313,15 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
private final Map<Player, Long> _lastMove = new HashMap<>();
|
||||
private final Map<Player, Map<GadgetType, Gadget>> _playerActiveGadgetMap = new HashMap<>();
|
||||
|
||||
|
||||
private final HashSet<GadgetSet> _sets = new HashSet<>();
|
||||
|
||||
private UserGadgetPersistence _userGadgetPersistence;
|
||||
|
||||
|
||||
private boolean _hideParticles = false;
|
||||
private int _activeItemSlot = 3;
|
||||
private boolean _gadgetsEnabled = true;
|
||||
|
||||
|
||||
private Set<Entity> _gadgetCollideWhitelist = new HashSet<>();
|
||||
|
||||
public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager,
|
||||
@ -351,7 +344,7 @@ public class GadgetManager extends MiniPlugin
|
||||
_mountManager = mountManager;
|
||||
_hologramManager = hologramManager;
|
||||
_userGadgetPersistence = new UserGadgetPersistence(this);
|
||||
_boosterManager = new OutfitWindUpSuitBoosterManager(this);
|
||||
_boosterManager = new OutfitWindUpSuitBoosterManager(this);
|
||||
_incognitoManager = incognitoManager;
|
||||
_gameCosmeticManager = require(GameCosmeticManager.class);
|
||||
_soulManager = new SoulManager();
|
||||
@ -365,24 +358,24 @@ public class GadgetManager extends MiniPlugin
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new UnlockCosmeticsCommand(this));
|
||||
addCommand(new LockCosmeticsCommand(this));
|
||||
addCommand(new LockCosmeticsCommand(this));
|
||||
addCommand(new AmmoCommand(this));
|
||||
}
|
||||
|
||||
|
||||
private void createSets()
|
||||
{
|
||||
//Particles
|
||||
addSet(new SetFrostLord(this));
|
||||
addSet(new SetCandyCane(this));
|
||||
addSet(new SetTitan(this));
|
||||
|
||||
|
||||
//Costumes
|
||||
addSet(new SetRaveSuit(this));
|
||||
addSet(new SetSpaceSuit(this));
|
||||
addSet(new SetFreezeSuit(this));
|
||||
addSet(new SetStPatricksSuit(this));
|
||||
// Hidden in this update
|
||||
//addSet(new SetWindUpSuit(this));
|
||||
//addSet(new SetWindUpSuit(this));
|
||||
|
||||
// Sets
|
||||
addSet(new SetParty(this));
|
||||
@ -403,7 +396,7 @@ public class GadgetManager extends MiniPlugin
|
||||
_gadgets = new HashMap<>();
|
||||
_rankBasedWinEffects = new ArrayList<>();
|
||||
_singleParticleSelectors = new HashMap<>();
|
||||
|
||||
|
||||
// Items
|
||||
addGadget(new ItemEtherealPearl(this));
|
||||
addGadget(new ItemFirework(this));
|
||||
@ -428,7 +421,7 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new OutfitRaveSuitChestplate(this));
|
||||
addGadget(new OutfitRaveSuitLeggings(this));
|
||||
addGadget(new OutfitRaveSuitBoots(this));
|
||||
|
||||
|
||||
addGadget(new OutfitSpaceSuitHelmet(this));
|
||||
addGadget(new OutfitSpaceSuitChestplate(this));
|
||||
addGadget(new OutfitSpaceSuitLeggings(this));
|
||||
@ -449,12 +442,12 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new OutfitStPatricksChestplate(this));
|
||||
addGadget(new OutfitStPatricksLeggings(this));
|
||||
addGadget(new OutfitStPatricksBoots(this));
|
||||
|
||||
addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.HELMET, Material.LEATHER_HELMET, (byte)0));
|
||||
addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.CHEST, Material.LEATHER_CHESTPLATE, (byte)0));
|
||||
addGadget(new OutfitTeam(this, "Team Pants", -1, ArmorSlot.LEGS, Material.LEATHER_LEGGINGS, (byte)0));
|
||||
addGadget(new OutfitTeam(this, "Team Boots", -1, ArmorSlot.BOOTS, Material.LEATHER_BOOTS, (byte)0));
|
||||
|
||||
|
||||
addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.HELMET, Material.LEATHER_HELMET, (byte) 0));
|
||||
addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.CHEST, Material.LEATHER_CHESTPLATE, (byte) 0));
|
||||
addGadget(new OutfitTeam(this, "Team Pants", -1, ArmorSlot.LEGS, Material.LEATHER_LEGGINGS, (byte) 0));
|
||||
addGadget(new OutfitTeam(this, "Team Boots", -1, ArmorSlot.BOOTS, Material.LEATHER_BOOTS, (byte) 0));
|
||||
|
||||
// Morphs
|
||||
addGadget(new MorphVillager(this));
|
||||
addGadget(new MorphCow(this));
|
||||
@ -591,7 +584,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
addGadget(new HatItem(this, hatType));
|
||||
}
|
||||
|
||||
|
||||
//Win Effects
|
||||
addGadget(new WinEffectPodium(this));
|
||||
addGadget(new WinEffectMrPunchMan(this));
|
||||
@ -615,24 +608,17 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new WinEffectRankEternal(this));
|
||||
|
||||
// Music
|
||||
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));
|
||||
addGadget(new MusicGadget(this, "Cat Disc", new String[] {""}, -2, 2257, 185000));
|
||||
addGadget(new MusicGadget(this, "Blocks Disc", new String[] {""}, -2, 2258, 345000));
|
||||
addGadget(new MusicGadget(this, "Chirp Disc", new String[] {""}, -2, 2259, 185000));
|
||||
addGadget(new MusicGadget(this, "Far Disc", new String[] {""}, -2, 2260, 174000));
|
||||
addGadget(new MusicGadget(this, "Mall Disc", new String[] {""}, -2, 2261, 197000));
|
||||
addGadget(new MusicGadget(this, "Mellohi Disc", new String[] {""}, -2, 2262, 96000));
|
||||
addGadget(new MusicGadget(this, "Stal Disc", new String[] {""}, -2, 2263, 150000));
|
||||
addGadget(new MusicGadget(this, "Strad Disc", new String[] {""}, -2, 2264, 188000));
|
||||
addGadget(new MusicGadget(this, "Ward Disc", new String[] {""}, -2, 2265, 251000));
|
||||
addGadget(new MusicGadget(this, "Wait Disc", new String[] {""}, -2, 2267, 238000));
|
||||
|
||||
// Survival Games
|
||||
/* for (KitModifier kitModifier : KitModifier.values())
|
||||
{
|
||||
addGadget(new KitGameModifier(this, kitModifier));
|
||||
}*/
|
||||
|
||||
addGadget(new MusicGadget(this, "13 Disc", new String[]{""}, -2, 2256, 178000));
|
||||
addGadget(new MusicGadget(this, "Cat Disc", new String[]{""}, -2, 2257, 185000));
|
||||
addGadget(new MusicGadget(this, "Blocks Disc", new String[]{""}, -2, 2258, 345000));
|
||||
addGadget(new MusicGadget(this, "Chirp Disc", new String[]{""}, -2, 2259, 185000));
|
||||
addGadget(new MusicGadget(this, "Far Disc", new String[]{""}, -2, 2260, 174000));
|
||||
addGadget(new MusicGadget(this, "Mall Disc", new String[]{""}, -2, 2261, 197000));
|
||||
addGadget(new MusicGadget(this, "Mellohi Disc", new String[]{""}, -2, 2262, 96000));
|
||||
addGadget(new MusicGadget(this, "Stal Disc", new String[]{""}, -2, 2263, 150000));
|
||||
addGadget(new MusicGadget(this, "Strad Disc", new String[]{""}, -2, 2264, 188000));
|
||||
addGadget(new MusicGadget(this, "Ward Disc", new String[]{""}, -2, 2265, 251000));
|
||||
addGadget(new MusicGadget(this, "Wait Disc", new String[]{""}, -2, 2267, 238000));
|
||||
|
||||
// Balloons
|
||||
for (BalloonType balloonType : BalloonType.values())
|
||||
@ -656,19 +642,13 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new RainCloudKitSelector(this));
|
||||
addGadget(new ShimmeringRingKitSelector(this));
|
||||
|
||||
for(SingleParticleKitSelector.SingleParticleSelectors singleParticleSelectors : SingleParticleKitSelector.SingleParticleSelectors.values())
|
||||
for (SingleParticleKitSelector.SingleParticleSelectors singleParticleSelectors : SingleParticleKitSelector.SingleParticleSelectors.values())
|
||||
{
|
||||
Gadget gadget = singleParticleSelectors.getKitSelectorGadget(this);
|
||||
addGadget(gadget);
|
||||
_singleParticleSelectors.put(singleParticleSelectors, gadget);
|
||||
}
|
||||
|
||||
// Gem Hunters Mounts
|
||||
for (MountType mount : MountType.values())
|
||||
{
|
||||
addGadget(new GameModifierMount(this, mount));
|
||||
}
|
||||
|
||||
new GameCosmeticType(this, GameDisplay.MineStrike)
|
||||
{
|
||||
@Override
|
||||
@ -681,7 +661,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(1))
|
||||
{
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), mineStrikeSkin, -2));
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -692,18 +672,18 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(2))
|
||||
{
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), mineStrikeSkin, -2));
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
||||
}
|
||||
}
|
||||
};
|
||||
new GameCosmeticCategory(this, "SMG", new ItemBuilder(Material.INK_SACK, (byte) 4).build(), true)
|
||||
new GameCosmeticCategory(this, "SMG", new ItemStack(Material.INK_SACK), true)
|
||||
{
|
||||
@Override
|
||||
public void addGadgets()
|
||||
{
|
||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(3))
|
||||
{
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), mineStrikeSkin, -2));
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -714,18 +694,29 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(4))
|
||||
{
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), mineStrikeSkin, -2));
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
||||
}
|
||||
}
|
||||
};
|
||||
new GameCosmeticCategory(this, "Knife", new ItemStack(Material.DIAMOND_SWORD), true)
|
||||
new GameCosmeticCategory(this, "Sniper Rifle", new ItemStack(Material.SULPHUR), true)
|
||||
{
|
||||
@Override
|
||||
public void addGadgets()
|
||||
{
|
||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(5))
|
||||
{
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), mineStrikeSkin, -2));
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
||||
}
|
||||
}
|
||||
};
|
||||
new GameCosmeticCategory(this, "Knife", new ItemStack(Material.DIAMOND_SWORD), false)
|
||||
{
|
||||
@Override
|
||||
public void addGadgets()
|
||||
{
|
||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(6))
|
||||
{
|
||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -737,28 +728,28 @@ public class GadgetManager extends MiniPlugin
|
||||
@Override
|
||||
public void addCategories()
|
||||
{
|
||||
new GameCosmeticCategory(this,"Hero Skins", SkinData.HATTORI.getSkull(), true)
|
||||
new GameCosmeticCategory(this, "Hero Skins", SkinData.HATTORI.getSkull(), true)
|
||||
{
|
||||
@Override
|
||||
public void addGadgets()
|
||||
{
|
||||
}
|
||||
};
|
||||
new GameCosmeticCategory(this,"Taunts", new ItemStack(Material.LAVA_BUCKET), false)
|
||||
new GameCosmeticCategory(this, "Taunts", new ItemStack(Material.LAVA_BUCKET), false)
|
||||
{
|
||||
@Override
|
||||
public void addGadgets()
|
||||
{
|
||||
}
|
||||
};
|
||||
new GameCosmeticCategory(this,"Base Decorations", new ItemStack(Material.WOOD_DOOR), false)
|
||||
new GameCosmeticCategory(this, "Base Decorations", new ItemStack(Material.WOOD_DOOR), false)
|
||||
{
|
||||
@Override
|
||||
public void addGadgets()
|
||||
{
|
||||
}
|
||||
};
|
||||
new GameCosmeticCategory(this,"Shop Morph", SkinData.HATTORI.getSkull(), false)
|
||||
new GameCosmeticCategory(this, "Shop Morph", SkinData.HATTORI.getSkull(), false)
|
||||
{
|
||||
@Override
|
||||
public void addGadgets()
|
||||
@ -776,40 +767,40 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
public <T extends Gadget> T getGadget(Class<T> c)
|
||||
{
|
||||
for(GadgetType type : GadgetType.values())
|
||||
for (GadgetType type : GadgetType.values())
|
||||
{
|
||||
for(Gadget gadget : getGadgets(type))
|
||||
for (Gadget gadget : getGadgets(type))
|
||||
{
|
||||
if(gadget.getClass().equals(c)) return (T) gadget;
|
||||
if (gadget.getClass().equals(c)) return (T) gadget;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Set<GadgetSet> getSets(Gadget gadget)
|
||||
{
|
||||
HashSet<GadgetSet> hset = new HashSet<>();
|
||||
for(GadgetSet set : _sets)
|
||||
for (GadgetSet set : _sets)
|
||||
{
|
||||
if(set.isPartOfSet(gadget)) hset.add(set);
|
||||
if (set.isPartOfSet(gadget)) hset.add(set);
|
||||
}
|
||||
return hset;
|
||||
}
|
||||
|
||||
|
||||
public GadgetSet getGadgetSet(Class<? extends GadgetSet> c)
|
||||
{
|
||||
for(GadgetSet set : _sets)
|
||||
for (GadgetSet set : _sets)
|
||||
{
|
||||
if(set.getClass().equals(c)) return set;
|
||||
if (set.getClass().equals(c)) return set;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void addSet(GadgetSet set)
|
||||
{
|
||||
_sets.add(set);
|
||||
}
|
||||
|
||||
|
||||
public void addGadget(Gadget gadget)
|
||||
{
|
||||
if (!_gadgets.containsKey(gadget.getGadgetType()))
|
||||
@ -873,76 +864,12 @@ public class GadgetManager extends MiniPlugin
|
||||
}
|
||||
return balloonGadgets;
|
||||
}
|
||||
|
||||
public List<GameModifierGadget> getGameModifiers(GameModifierType gameType)
|
||||
{
|
||||
List<GameModifierGadget> list = new ArrayList<>();
|
||||
for (Gadget g : getGadgets(GadgetType.GAME_MODIFIER))
|
||||
{
|
||||
if (g instanceof GameModifierGadget)
|
||||
{
|
||||
GameModifierGadget mod = (GameModifierGadget) g;
|
||||
if (mod.getGameType() == gameType) list.add(mod);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public GameModifierMineStrikeSkin getGameModifier(MineStrikeSkin skin)
|
||||
{
|
||||
for(GameModifierGadget g : getGameModifiers(GameModifierType.MineStrike))
|
||||
{
|
||||
GameModifierMineStrikeSkin gskin = (GameModifierMineStrikeSkin) g;
|
||||
if(g.getName().equals(skin.getSkinName())) return gskin;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<GameModifierGadget> getGameModifiers(KitModifierType kitType)
|
||||
{
|
||||
List<GameModifierGadget> list = new ArrayList<>();
|
||||
for (GameModifierGadget gadget : getGameModifiers(kitType.getGameModifierType()))
|
||||
{
|
||||
if (gadget instanceof KitGameModifier)
|
||||
{
|
||||
if (((KitGameModifier) gadget).getKitType() == kitType)
|
||||
{
|
||||
list.add(gadget);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public GameModifierGadget getActiveGameModifier(Player player, GameModifierType gameType, Predicate<GameModifierGadget> selector)
|
||||
{
|
||||
for (GameModifierGadget g : getGameModifiers(gameType))
|
||||
{
|
||||
if (!g.isActive(player)) { continue; }
|
||||
if (!selector.test(g)) { continue; }
|
||||
return g;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Gets all the Game modifiers that are related to kits
|
||||
public KitGameModifier getActiveGameModifier(Player player, KitModifierType kitType, Predicate<GameModifierGadget> selector)
|
||||
{
|
||||
for (GameModifierGadget g : getGameModifiers(kitType))
|
||||
{
|
||||
if (!g.isActive(player)) { continue; }
|
||||
if (!selector.test(g)) { continue; }
|
||||
if (!(g instanceof KitGameModifier)) { continue; }
|
||||
return (KitGameModifier) g;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public HatGadget getHatGadget(HatType type)
|
||||
{
|
||||
for (Gadget gadget : getGadgets(GadgetType.HAT))
|
||||
{
|
||||
if(gadget instanceof HatGadget)
|
||||
if (gadget instanceof HatGadget)
|
||||
{
|
||||
HatGadget hatGadget = (HatGadget) gadget;
|
||||
if (type.equals(hatGadget.getHatType()))
|
||||
@ -956,7 +883,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
for (Gadget gadget : getGadgets(GadgetType.FLAG))
|
||||
{
|
||||
if(gadget instanceof FlagGadget)
|
||||
if (gadget instanceof FlagGadget)
|
||||
{
|
||||
FlagGadget flagGadget = (FlagGadget) gadget;
|
||||
|
||||
@ -999,7 +926,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
return (SingleParticleKitSelector) _singleParticleSelectors.get(singleParticleSelectors);
|
||||
}
|
||||
|
||||
|
||||
// Disallows two armor gadgets in same slot.
|
||||
public void removeOutfit(Player player, ArmorSlot slot)
|
||||
{
|
||||
@ -1019,12 +946,12 @@ public class GadgetManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void removeGadgetType(Player player, GadgetType type)
|
||||
{
|
||||
List<Gadget> gadgets = _gadgets.get(type);
|
||||
if(gadgets == null) return;
|
||||
for(Gadget g : gadgets)
|
||||
if (gadgets == null) return;
|
||||
for (Gadget g : gadgets)
|
||||
{
|
||||
g.disable(player);
|
||||
}
|
||||
@ -1033,14 +960,14 @@ public class GadgetManager extends MiniPlugin
|
||||
public void removeGadgetType(Player player, GadgetType type, Gadget enabled)
|
||||
{
|
||||
List<Gadget> gadgets = _gadgets.get(type);
|
||||
if(gadgets == null) return;
|
||||
for(Gadget g : gadgets)
|
||||
if (gadgets == null) return;
|
||||
for (Gadget g : gadgets)
|
||||
{
|
||||
if (g != enabled)
|
||||
g.disable(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void disableAll()
|
||||
{
|
||||
for (GadgetType gadgetType : _gadgets.keySet())
|
||||
@ -1058,10 +985,10 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
if (gadget instanceof DeathEffectGadget)
|
||||
continue;
|
||||
|
||||
|
||||
if (gadget instanceof WinEffectGadget)
|
||||
continue;
|
||||
|
||||
|
||||
if (gadget instanceof GameModifierGadget)
|
||||
continue;
|
||||
|
||||
@ -1070,13 +997,13 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
if (gadget instanceof KitSelectorGadget)
|
||||
continue;
|
||||
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
gadget.disable(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void disableAll(Player player)
|
||||
{
|
||||
for (GadgetType gadgetType : _gadgets.keySet())
|
||||
@ -1108,7 +1035,7 @@ public class GadgetManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void disableAll(Player player, List<String> dontDisable)
|
||||
{
|
||||
for (GadgetType gadgetType : _gadgets.keySet())
|
||||
@ -1117,7 +1044,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
if (dontDisable.contains(gadget.getName()))
|
||||
continue;
|
||||
|
||||
|
||||
gadget.disable(player);
|
||||
}
|
||||
}
|
||||
@ -1127,7 +1054,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
return _petManager;
|
||||
}
|
||||
|
||||
|
||||
public CoreClientManager getClientManager()
|
||||
{
|
||||
return _clientManager;
|
||||
@ -1142,7 +1069,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
return _preferencesManager;
|
||||
}
|
||||
|
||||
|
||||
public ProjectileManager getProjectileManager()
|
||||
{
|
||||
return _projectileManager;
|
||||
@ -1152,26 +1079,26 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
return _disguiseManager;
|
||||
}
|
||||
|
||||
|
||||
public HologramManager getHologramManager()
|
||||
{
|
||||
return _hologramManager;
|
||||
}
|
||||
|
||||
|
||||
public InventoryManager getInventoryManager()
|
||||
{
|
||||
return _inventoryManager;
|
||||
}
|
||||
|
||||
public OutfitWindUpSuitBoosterManager getBoosterManager()
|
||||
{
|
||||
return _boosterManager;
|
||||
}
|
||||
|
||||
public MountManager getMountManager()
|
||||
{
|
||||
return _mountManager;
|
||||
}
|
||||
public OutfitWindUpSuitBoosterManager getBoosterManager()
|
||||
{
|
||||
return _boosterManager;
|
||||
}
|
||||
|
||||
public MountManager getMountManager()
|
||||
{
|
||||
return _mountManager;
|
||||
}
|
||||
|
||||
public boolean collideEvent(Player shooter, Gadget gadget, Entity other)
|
||||
{
|
||||
@ -1186,7 +1113,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
return _blockRestore;
|
||||
}
|
||||
|
||||
|
||||
public PacketHandler getPacketManager()
|
||||
{
|
||||
return _packetManager;
|
||||
@ -1204,7 +1131,7 @@ public class GadgetManager extends MiniPlugin
|
||||
public boolean isMoving(Player player)
|
||||
{
|
||||
if (!UtilEnt.isGrounded(player)) return true;
|
||||
|
||||
|
||||
if (!_lastMove.containsKey(player))
|
||||
return false;
|
||||
|
||||
@ -1227,28 +1154,28 @@ public class GadgetManager extends MiniPlugin
|
||||
// Removes custom pet
|
||||
CustomPet.removeCustomPet(event.getPlayer());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void death(PlayerDeathEvent event)
|
||||
{
|
||||
_lastMove.remove(event.getEntity());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onGadgetCollide(GadgetCollideEntityEvent event)
|
||||
{
|
||||
if(event.getOther() instanceof Player)
|
||||
if (event.getOther() instanceof Player)
|
||||
{
|
||||
event.setCancelled(false);
|
||||
return;
|
||||
}
|
||||
if(isAffectedByGadgets(event.getOther()))
|
||||
if (isAffectedByGadgets(event.getOther()))
|
||||
{
|
||||
event.setCancelled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param e The entity to check
|
||||
* @return Returns true if the entity is affected by gadgets like snowballs, flesh hooks etc
|
||||
@ -1257,14 +1184,14 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
return _gadgetCollideWhitelist.contains(e);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set whether or not the given entity should be affected by gadgets by snowball, flesh hooks etc
|
||||
* By default only players and naturally spawned entities are affected.
|
||||
*/
|
||||
public void setAffectedByGadgets(Entity e, boolean affected)
|
||||
{
|
||||
if(affected)
|
||||
if (affected)
|
||||
{
|
||||
_gadgetCollideWhitelist.add(e);
|
||||
}
|
||||
@ -1297,7 +1224,7 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
_playerActiveGadgetMap.get(player).remove(gadget.getGadgetType());
|
||||
}
|
||||
|
||||
|
||||
public void setHideParticles(boolean b)
|
||||
{
|
||||
_hideParticles = b;
|
||||
@ -1312,7 +1239,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
_activeItemSlot = i;
|
||||
}
|
||||
|
||||
|
||||
public int getActiveItemSlot()
|
||||
{
|
||||
return _activeItemSlot;
|
||||
@ -1326,7 +1253,7 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
if (gadget.isActive(player))
|
||||
{
|
||||
((ItemGadget)gadget).ApplyItem(player, false);
|
||||
((ItemGadget) gadget).ApplyItem(player, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1338,13 +1265,13 @@ public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
if (gadget instanceof MusicGadget)
|
||||
{
|
||||
if (!((MusicGadget)gadget).canPlayAt(location))
|
||||
if (!((MusicGadget) gadget).canPlayAt(location))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1374,19 +1301,19 @@ public class GadgetManager extends MiniPlugin
|
||||
if (!_gadgetsEnabled)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void chissMeow(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if (event.getPlayer().isSneaking())
|
||||
return;
|
||||
|
||||
|
||||
if (event.getPlayer().getName().equalsIgnoreCase("Chiss"))
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CAT_MEOW, 1f, 1f);
|
||||
|
||||
if (event.getPlayer().getName().equalsIgnoreCase("defek7"))
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.WOLF_BARK, 1f, 1f);
|
||||
|
||||
|
||||
if (event.getPlayer().getName().equalsIgnoreCase("sterling_"))
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.PIG_IDLE, 1f, 1f);
|
||||
}
|
||||
@ -1440,7 +1367,9 @@ public class GadgetManager extends MiniPlugin
|
||||
break;
|
||||
case GAME_MODIFIER:
|
||||
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
|
||||
if (gameModifierGadget.canAllowMultiple())
|
||||
GameCosmeticCategory category = gameModifierGadget.getCategory();
|
||||
|
||||
if (category.isAllowingMultiple())
|
||||
{
|
||||
key = gameModifierGadget.getName();
|
||||
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
|
||||
@ -1450,7 +1379,7 @@ public class GadgetManager extends MiniPlugin
|
||||
}
|
||||
else
|
||||
{
|
||||
key = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", "");
|
||||
key = "active" + category.getType().getName().replace(" ", "");
|
||||
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
|
||||
{
|
||||
value = gameModifierGadget.getName();
|
||||
@ -1468,31 +1397,6 @@ public class GadgetManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isKitModifierActive(KitModifier kitModifier, Player player)
|
||||
{
|
||||
for (Gadget gadget : getGadgets(GadgetType.GAME_MODIFIER))
|
||||
{
|
||||
if (gadget instanceof KitGameModifier)
|
||||
{
|
||||
KitGameModifier kitGameModifier = (KitGameModifier) gadget;
|
||||
if (kitGameModifier.getKitModifier().equals(kitModifier))
|
||||
return kitGameModifier.isActive(player);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public KitModifier getActiveKitModifier(KitModifierType kitModifierType, Player player)
|
||||
{
|
||||
for (KitModifier kitModifier : KitModifier.values())
|
||||
{
|
||||
if (kitModifier.getKitModifierType().equals(kitModifierType))
|
||||
if (isKitModifierActive(kitModifier, player))
|
||||
return kitModifier;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVanish(IncognitoStatusChangeEvent event)
|
||||
{
|
||||
@ -1563,6 +1467,7 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
/**
|
||||
* Handles taunt commands
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
@ -1594,10 +1499,10 @@ public class GadgetManager extends MiniPlugin
|
||||
if (taunt.isGameDisabled(event.getGameDisplay()) && event.getState().equals(TauntCommandEvent.TauntState.NONE))
|
||||
event.setState(TauntCommandEvent.TauntState.GAME_DISABLED);
|
||||
|
||||
if (!event.isAlive() && event.getState().equals(TauntCommandEvent.TauntState.NONE))
|
||||
if (!event.isAlive() && event.getState().equals(TauntCommandEvent.TauntState.NONE))
|
||||
event.setState(TauntCommandEvent.TauntState.NOT_ALIVE);
|
||||
|
||||
if (event.isSpectator() && event.getState().equals(TauntCommandEvent.TauntState.NONE))
|
||||
if (event.isSpectator() && event.getState().equals(TauntCommandEvent.TauntState.NONE))
|
||||
event.setState(TauntCommandEvent.TauntState.SPECTATOR);
|
||||
|
||||
if (event.isInPvp(taunt.getPvpCooldown()) && !taunt.canPlayWithPvp()
|
||||
|
@ -1,13 +1,16 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers;
|
||||
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GameModifierGadget;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
||||
import mineplex.core.cosmetic.ui.page.gamemodifiers.GameCosmeticCategoryPage;
|
||||
import mineplex.core.cosmetic.ui.page.gamemodifiers.GameCosmeticGadgetPage;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.GameModifierGadget;
|
||||
|
||||
public abstract class GameCosmeticCategory
|
||||
{
|
||||
|
||||
@ -40,6 +43,16 @@ public abstract class GameCosmeticCategory
|
||||
_manager.addGadget(gadget);
|
||||
}
|
||||
|
||||
public GadgetPage getGadgetPage(GameCosmeticCategoryPage parent)
|
||||
{
|
||||
return new GameCosmeticGadgetPage(parent.getPlugin(), parent.getShop(), parent.getClientManager(), parent.getDonationManager(), _categoryName, parent.getClient().GetPlayer(), parent, this);
|
||||
}
|
||||
|
||||
public GameCosmeticType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public String getCategoryName()
|
||||
{
|
||||
return _categoryName;
|
||||
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -31,7 +32,12 @@ public class GameCosmeticManager extends MiniPlugin
|
||||
_cosmetics.put(type, cosmetics);
|
||||
}
|
||||
|
||||
public GameModifierGadget getOwnedCosmetic(Player player, GameDisplay gameType, String categoryName)
|
||||
public GameModifierGadget getActiveCosmetic(Player player, GameDisplay gameType, String categoryName)
|
||||
{
|
||||
return getActiveCosmetic(player, gameType, categoryName, null);
|
||||
}
|
||||
|
||||
public GameModifierGadget getActiveCosmetic(Player player, GameDisplay gameType, String categoryName, Predicate<GameModifierGadget> selector)
|
||||
{
|
||||
GameCosmeticCategory category = getCategoryFrom(gameType, categoryName);
|
||||
|
||||
@ -39,10 +45,6 @@ public class GameCosmeticManager extends MiniPlugin
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (category.isAllowingMultiple())
|
||||
{
|
||||
throw new IllegalArgumentException("The category " + categoryName + " allows for multiple gadgets to be enabled at a time. Please use getOwnedCosmetics");
|
||||
}
|
||||
|
||||
List<GameModifierGadget> gadgets = category.getGadgets();
|
||||
|
||||
@ -53,7 +55,12 @@ public class GameCosmeticManager extends MiniPlugin
|
||||
|
||||
for (GameModifierGadget gadget : gadgets)
|
||||
{
|
||||
if (gadget.ownsGadget(player))
|
||||
if (selector != null && !selector.test(gadget))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gadget.isActive(player))
|
||||
{
|
||||
return gadget;
|
||||
}
|
||||
@ -62,7 +69,12 @@ public class GameCosmeticManager extends MiniPlugin
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<GameModifierGadget> getOwnedCosmetics(Player player, GameDisplay gameType, String categoryName)
|
||||
public List<GameModifierGadget> getActiveCosmetics(Player player, GameDisplay gameType, String categoryName)
|
||||
{
|
||||
return getActiveCosmetics(player, gameType, categoryName, null);
|
||||
}
|
||||
|
||||
public List<GameModifierGadget> getActiveCosmetics(Player player, GameDisplay gameType, String categoryName, Predicate<GameModifierGadget> selector)
|
||||
{
|
||||
GameCosmeticCategory category = getCategoryFrom(gameType, categoryName);
|
||||
|
||||
@ -70,10 +82,6 @@ public class GameCosmeticManager extends MiniPlugin
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (!category.isAllowingMultiple())
|
||||
{
|
||||
throw new IllegalArgumentException("The category " + categoryName + " does not allow multiple gadgets enabled at one time. Please use getOwnedCosmetic");
|
||||
}
|
||||
|
||||
List<GameModifierGadget> gadgets = category.getGadgets();
|
||||
|
||||
@ -83,13 +91,23 @@ public class GameCosmeticManager extends MiniPlugin
|
||||
}
|
||||
|
||||
List<GameModifierGadget> gadgetsCloned = new ArrayList<>(gadgets);
|
||||
gadgetsCloned.removeIf(gadget -> !gadget.ownsGadget(player));
|
||||
gadgetsCloned.removeIf(gadget -> !gadget.isActive(player));
|
||||
|
||||
if (selector != null)
|
||||
{
|
||||
gadgets.removeIf(gadget -> !selector.test(gadget));
|
||||
}
|
||||
|
||||
return gadgetsCloned;
|
||||
}
|
||||
|
||||
private GameCosmeticCategory getCategoryFrom(GameDisplay gameType, String categoryName)
|
||||
{
|
||||
if (gameType == null || categoryName == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Entry<GameCosmeticType, List<GameCosmeticCategory>> entry : _cosmetics.entrySet())
|
||||
{
|
||||
GameCosmeticType type = entry.getKey();
|
||||
@ -113,6 +131,48 @@ public class GameCosmeticManager extends MiniPlugin
|
||||
return null;
|
||||
}
|
||||
|
||||
public GameModifierGadget getGadgetFrom(String name)
|
||||
{
|
||||
for (List<GameCosmeticCategory> categories : _cosmetics.values())
|
||||
{
|
||||
for (GameCosmeticCategory category : categories)
|
||||
{
|
||||
for (GameModifierGadget gadget : category.getGadgets())
|
||||
{
|
||||
if (gadget.getName().equals(name))
|
||||
{
|
||||
return gadget;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<GameModifierGadget> getGadgetsFrom(GameDisplay gameType)
|
||||
{
|
||||
List<GameModifierGadget> gadgets = new ArrayList<>();
|
||||
GameCosmeticType type = null;
|
||||
|
||||
for (GameCosmeticType cosmeticType : _cosmetics.keySet())
|
||||
{
|
||||
if (cosmeticType.getGame() == gameType)
|
||||
{
|
||||
type = cosmeticType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
return gadgets;
|
||||
}
|
||||
|
||||
type.getCategories().forEach(category -> gadgets.addAll(category.getGadgets()));
|
||||
return gadgets;
|
||||
}
|
||||
|
||||
public Map<GameCosmeticType, List<GameCosmeticCategory>> getTypes()
|
||||
{
|
||||
return _cosmetics;
|
||||
|
@ -47,4 +47,9 @@ public abstract class GameCosmeticType
|
||||
{
|
||||
return _game;
|
||||
}
|
||||
|
||||
public List<GameCosmeticCategory> getCategories()
|
||||
{
|
||||
return _categories;
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.gemhunters;
|
||||
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.types.GameModifierGadget;
|
||||
|
||||
public class GameModifierMount extends GameModifierGadget
|
||||
{
|
||||
|
||||
private final MountType _mountType;
|
||||
|
||||
public GameModifierMount(GadgetManager manager, MountType mountType)
|
||||
{
|
||||
super(manager, GameModifierType.GemHunters, mountType.getName() + " Mount", mountType.getDescription(), -2, mountType.getMaterial(), mountType.getData(), false);
|
||||
|
||||
_mountType = mountType;
|
||||
}
|
||||
|
||||
public final MountType getMountType()
|
||||
{
|
||||
return _mountType;
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.gemhunters;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public enum MountType
|
||||
{
|
||||
|
||||
SKELETON(EntityType.HORSE, Material.BONE, (byte) 0, "Skeleton Horse", "Spooky")
|
||||
|
||||
;
|
||||
|
||||
private final EntityType _entityType;
|
||||
private final Material _material;
|
||||
private final byte _data;
|
||||
private final String _name;
|
||||
private final String[] _description;
|
||||
|
||||
private MountType(EntityType entityType, Material material, byte data, String name, String... description)
|
||||
{
|
||||
_entityType = entityType;
|
||||
_material = material;
|
||||
_data = data;
|
||||
_name = name;
|
||||
_description = description;
|
||||
}
|
||||
|
||||
public final EntityType getEntityType()
|
||||
{
|
||||
return _entityType;
|
||||
}
|
||||
|
||||
public final Material getMaterial()
|
||||
{
|
||||
return _material;
|
||||
}
|
||||
|
||||
public byte getData()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
public final String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public final String[] getDescription()
|
||||
{
|
||||
return _description;
|
||||
}
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits;
|
||||
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.GameModifierGadget;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* This class creates a Kit modifier, to be implemented in game kits, such as Survival Games or Bridges
|
||||
*
|
||||
* @author LCastr0
|
||||
*/
|
||||
public class KitGameModifier extends GameModifierGadget
|
||||
{
|
||||
|
||||
private KitModifier _kitModifier;
|
||||
private KitModifierType _kitType;
|
||||
|
||||
public KitGameModifier(GadgetManager manager, KitModifier kitModifier)
|
||||
{
|
||||
super(manager, kitModifier.getKitModifierType().getGameModifierType(), kitModifier.getName(), kitModifier.getLore(), kitModifier.getCost(),
|
||||
kitModifier.getMaterial(), kitModifier.getData(), false);
|
||||
_kitModifier = kitModifier;
|
||||
_kitType = kitModifier.getKitModifierType();
|
||||
}
|
||||
|
||||
public KitModifierType getKitType()
|
||||
{
|
||||
return _kitType;
|
||||
}
|
||||
|
||||
public KitModifier getKitModifier()
|
||||
{
|
||||
return _kitModifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableCustom(Player player, boolean message)
|
||||
{
|
||||
Manager.getGameModifiers(getGameType()).stream().filter(getKitFilter(_kitType)).forEach(g -> g.disable(player));
|
||||
|
||||
super.enableCustom(player, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters kit based on type
|
||||
* @param kitModifierType
|
||||
* @return
|
||||
*/
|
||||
public static Predicate<GameModifierGadget> getKitFilter(KitModifierType kitModifierType)
|
||||
{
|
||||
return new Predicate<GameModifierGadget>() {
|
||||
@Override
|
||||
public boolean test(GameModifierGadget g) {
|
||||
if (!(g instanceof KitGameModifier)) { return false; }
|
||||
return ((KitGameModifier)g).getKitType().equals(kitModifierType);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public enum KitModifier
|
||||
{
|
||||
|
||||
// Bridges
|
||||
Bridges_Apple_Potato(KitModifierType.Bridges_AppleKit, "Potato", new String[] {"Placeholder"}, Material.POTATO_ITEM, 0),
|
||||
|
||||
// Survival Games
|
||||
Survival_Games_Beastmaster_Chicken(KitModifierType.SurvivalGames_BeastmasterKit, "Chicken", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.CHICKEN), 0),
|
||||
Survival_Games_Beastmaster_Mini_Guardian(KitModifierType.SurvivalGames_BeastmasterKit, "Mini Guardian", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.GUARDIAN), 0),
|
||||
Survival_Games_Beastmaster_Pig(KitModifierType.SurvivalGames_BeastmasterKit, "Pig", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.PIG), 0),
|
||||
Survival_Games_Beastmaster_Squid(KitModifierType.SurvivalGames_BeastmasterKit, "Squid", new String[] {"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.SQUID), 0),
|
||||
Survival_Games_Horseman_Mule(KitModifierType.SurvivalGames_HorsemanKit, "Mule", new String[] {"Placeholder"}, Material.CHEST, 0),
|
||||
Survival_Games_Horseman_Skeleton_Horse(KitModifierType.SurvivalGames_HorsemanKit, "Skeleton Horse", new String[] {"Placeholder"}, Material.BONE, 0),
|
||||
Survival_Games_Horseman_Zombie_Horse(KitModifierType.SurvivalGames_HorsemanKit, "Zombie Horse", new String[] {"Placeholder"}, Material.ROTTEN_FLESH, 0),
|
||||
Survival_Games_Horseman_Donkey(KitModifierType.SurvivalGames_HorsemanKit, "Donkey", new String[] {"Placeholder"}, Material.CHEST, 0),
|
||||
Survival_Games_Necromancer_Wither_Skeleton(KitModifierType.SurvivalGames_NecromancerKit, "Wither Skeleton", new String[] {"Placeholder"}, Material.SKULL_ITEM, (byte) 1, 0),
|
||||
Survival_Games_Necromancer_Zombie(KitModifierType.SurvivalGames_NecromancerKit, "Zombie", new String[] {"Placeholder"}, Material.SKULL_ITEM, (byte) 2, 0);
|
||||
|
||||
private final KitModifierType _kitModifierType;
|
||||
private final String _name;
|
||||
private final String[] _lore;
|
||||
private final Material _material;
|
||||
private final byte _data;
|
||||
private final int _cost;
|
||||
|
||||
KitModifier(KitModifierType kitModifierType, String name, String[] lore, Material material, int cost)
|
||||
{
|
||||
this(kitModifierType, name, lore, material, (byte) 0, cost);
|
||||
}
|
||||
|
||||
KitModifier(KitModifierType kitModifierType, String name, String[] lore, Material material, byte data, int cost)
|
||||
{
|
||||
_kitModifierType = kitModifierType;
|
||||
_name = name;
|
||||
_lore = lore;
|
||||
_material = material;
|
||||
_data = data;
|
||||
_cost = cost;
|
||||
}
|
||||
|
||||
public KitModifierType getKitModifierType()
|
||||
{
|
||||
return _kitModifierType;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String[] getLore()
|
||||
{
|
||||
return _lore;
|
||||
}
|
||||
|
||||
public Material getMaterial()
|
||||
{
|
||||
return _material;
|
||||
}
|
||||
|
||||
public byte getData()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
public int getCost()
|
||||
{
|
||||
return _cost;
|
||||
}
|
||||
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits;
|
||||
|
||||
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.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Lists types of KitGameModifier's
|
||||
*
|
||||
* @author LCastr0
|
||||
*/
|
||||
public enum KitModifierType
|
||||
{
|
||||
|
||||
Bridges_AppleKit(GameModifierType.Bridges, "Apple", new String[]{"Placeholder"}, Material.APPLE, (byte) 0),
|
||||
SurvivalGames_BeastmasterKit(GameModifierType.SurvivalGames, "Beastmaster", new String[]{"Placeholder"}, Material.BONE, (byte) 0),
|
||||
SurvivalGames_HorsemanKit(GameModifierType.SurvivalGames, "Horseman", new String[]{"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.HORSE)),
|
||||
SurvivalGames_NecromancerKit(GameModifierType.SurvivalGames, "Necromancer", new String[]{"Placeholder"}, Material.SKULL_ITEM, (byte) 0);
|
||||
|
||||
private final GameModifierType _type;
|
||||
private final String _kitName;
|
||||
private final List<String> _desc;
|
||||
private final Material _mat;
|
||||
private final byte _data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param kitName
|
||||
* @param desc
|
||||
* @param mat
|
||||
* @param data
|
||||
*/
|
||||
KitModifierType(GameModifierType type, String kitName, String[] desc, Material mat, byte data)
|
||||
{
|
||||
_type = type;
|
||||
_kitName = kitName;
|
||||
_desc = UtilText.splitLines(desc, LineFormat.LORE);
|
||||
_mat = mat;
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public GameModifierType getGameModifierType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public String getKitName() {
|
||||
return _kitName;
|
||||
}
|
||||
|
||||
public List<String> getDescription()
|
||||
{
|
||||
return _desc;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return ItemStackFactory.Instance.CreateStack(_mat, _data, 1, C.cGreenB + _kitName, _desc);
|
||||
}
|
||||
}
|
@ -9,75 +9,45 @@ 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.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
|
||||
import mineplex.core.gadget.types.GameModifierGadget;
|
||||
|
||||
/**
|
||||
* A gamemodifier to apply custom skin data to {@link GameModifierType#MineStrike} weapons
|
||||
*/
|
||||
import mineplex.core.game.GameDisplay;
|
||||
|
||||
public class GameModifierMineStrikeSkin extends GameModifierGadget
|
||||
{
|
||||
|
||||
private String _weapon;
|
||||
private Material _skinMat;
|
||||
private byte _skinData;
|
||||
|
||||
/**
|
||||
* @param manager Normal gadget manager
|
||||
* @param name Display name of skin
|
||||
* @param lore Lore description of skin
|
||||
* @param weaponName The exact name of the weapon which this skin will replace
|
||||
* @param newSkin Skin material
|
||||
* @param newSkinData Skin item data
|
||||
* @param cost Cost of this MineStrike skin
|
||||
* @param displayMat Display material for GUI, no in-game impact
|
||||
* @param displayData Display data for GUI, no in-game impact
|
||||
*/
|
||||
public GameModifierMineStrikeSkin(GadgetManager manager, String name, String[] lore, String weaponName, Material newSkin, byte newSkinData,
|
||||
int cost, Material displayMat, int displayData)
|
||||
private final String _weapon;
|
||||
private final Material _skinMat;
|
||||
private final byte _skinData;
|
||||
|
||||
public GameModifierMineStrikeSkin(GadgetManager manager, GameCosmeticCategory category, String name, String[] lore, String weaponName, Material newSkin, byte newSkinData, int cost, Material displayMat, int displayData)
|
||||
{
|
||||
super(manager, GameModifierType.MineStrike, name,
|
||||
UtilText.splitLinesToArray(lore, LineFormat.LORE), cost, displayMat, (byte) displayData, true);
|
||||
super(manager, category, name, UtilText.splitLinesToArray(lore, LineFormat.LORE), cost, displayMat, (byte) displayData);
|
||||
_weapon = weaponName;
|
||||
_skinMat = newSkin;
|
||||
_skinData = newSkinData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link GameModifierMineStrikeSkin} with empty lore
|
||||
* @param manager Normal gadget manager
|
||||
* @param skin {@link MineStrikeSkin} used to apply name, item data and display data from
|
||||
* @param cost Cost of this MineStrike skin
|
||||
*/
|
||||
public GameModifierMineStrikeSkin(GadgetManager manager, MineStrikeSkin skin, int cost)
|
||||
|
||||
public GameModifierMineStrikeSkin(GadgetManager manager, GameCosmeticCategory category, MineStrikeSkin skin, int cost)
|
||||
{
|
||||
this(manager, skin, new String[]{C.cGray + "Weapon: " + C.cYellow + skin.getWeaponName()}, cost);
|
||||
this(manager, category, skin, new String[]{C.cGray + "Weapon: " + C.cYellow + skin.getWeaponName()}, cost);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link GameModifierMineStrikeSkin} using the {@link MineStrikeSkin} to apply additional data
|
||||
* @param manager Normal gadget manager
|
||||
* @param skin {@link MineStrikeSkin} used to apply name, item data and display data from
|
||||
* @param lore Lore to apply to the gadget
|
||||
* @param cost Cost of this MineStrike skin
|
||||
*/
|
||||
public GameModifierMineStrikeSkin(GadgetManager manager, MineStrikeSkin skin, String[] lore, int cost)
|
||||
|
||||
public GameModifierMineStrikeSkin(GadgetManager manager, GameCosmeticCategory category, MineStrikeSkin skin, String[] lore, int cost)
|
||||
{
|
||||
this(manager, skin.getSkinName(), lore, skin.getWeaponName(), skin.getSkinMaterial(), skin.getSkinData(), cost,
|
||||
skin.getSkinMaterial(), skin.getSkinData());
|
||||
this(manager, category, skin.getSkinName(), lore, skin.getWeaponName(), skin.getSkinMaterial(), skin.getSkinData(), cost, skin.getSkinMaterial(), skin.getSkinData());
|
||||
}
|
||||
|
||||
|
||||
public String getWeaponName()
|
||||
{
|
||||
return _weapon;
|
||||
}
|
||||
|
||||
|
||||
public Material getSkinMaterial()
|
||||
{
|
||||
return _skinMat;
|
||||
}
|
||||
|
||||
|
||||
public byte getSkinData()
|
||||
{
|
||||
return _skinData;
|
||||
@ -86,20 +56,20 @@ public class GameModifierMineStrikeSkin extends GameModifierGadget
|
||||
@Override
|
||||
public void enableCustom(Player player, boolean message)
|
||||
{
|
||||
Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon).and(weapon -> weapon != this)).forEach(g -> g.disable(player));
|
||||
|
||||
Manager.getGameCosmeticManager().getGadgetsFrom(GameDisplay.MineStrike).stream().filter(getWeaponFilter(_weapon).and(weapon -> weapon != this)).forEach(g -> g.disable(player));
|
||||
|
||||
super.enableCustom(player, message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A simple {@link GameModifierGadget} filter which filters out {@link GameModifierMineStrikeSkin} gadgets depending on weapon name
|
||||
*
|
||||
* @param weaponName Exact weapon name to test for
|
||||
* @return Returns a weapon filter which will filter out any {@link GameModifierGadget}
|
||||
* which is not instance of {@link GameModifierMineStrikeSkin} and which does not match the provided weapon name
|
||||
*/
|
||||
public static Predicate<GameModifierGadget> getWeaponFilter(String weaponName)
|
||||
{
|
||||
return g -> g instanceof GameModifierMineStrikeSkin && ((GameModifierMineStrikeSkin)g).getWeaponName().equals(weaponName);
|
||||
return g -> g instanceof GameModifierMineStrikeSkin && ((GameModifierMineStrikeSkin) g).getWeaponName().equals(weaponName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,24 +19,24 @@ public enum MineStrikeSkin
|
||||
XM1014_Pig_Gun( "XM1014", "XM1014 Pig Gun", Material.LEATHER, (byte) 0, 2),
|
||||
PP_Bizon_Streak( "PP-Bizon", "PP-Bizon Streak", Material.INK_SACK, (byte) 4, 3),
|
||||
P90_Asiimov( "P90", "P90 Asiimov", Material.INK_SACK, (byte) 0, 3),
|
||||
SSG_08_Blood_in_the_Water( "SSG 08", "SSG 08 Blood in the Water", Material.INK_SACK, (byte) 12, 4),
|
||||
AWP_Asiimov( "AWP", "AWP Asiimov", Material.SULPHUR, (byte) 0, 4),
|
||||
SSG_08_Blood_in_the_Water( "SSG 08", "SSG 08 Blood in the Water", Material.INK_SACK, (byte) 12, 5),
|
||||
AWP_Asiimov( "AWP", "AWP Asiimov", Material.SULPHUR, (byte) 0, 5),
|
||||
P2000_Fire_Elemental( "P2000", "P2000 Fire Elemental", Material.INK_SACK, (byte) 6, 1),
|
||||
FAMAS_Pulse( "FAMAS", "FAMAS Pulse", Material.CLAY_BALL, (byte) 0, 4),
|
||||
M4A4_Howl( "M4A4", "M4A4 Howl", Material.INK_SACK, (byte) 11, 4),
|
||||
M4A4_Enderman( "M4A4", "Enderman M4", Material.COAL, (byte) 0, 4),
|
||||
Steyr_AUG_Torque( "Steyr AUG", "Steyr AUG Torque", Material.BLAZE_ROD, (byte) 0, 4),
|
||||
Steyr_AUG_Torque( "Steyr AUG", "Steyr AUG Torque", Material.BLAZE_ROD, (byte) 0, 5),
|
||||
Glock_18_Fade( "Glock 18", "Glock 18 Fade", Material.INK_SACK, (byte) 9, 1),
|
||||
Galil_AR_Eco( "Galil AR", "Galil AR Eco", Material.INK_SACK, (byte) 10, 1),
|
||||
AK_47_Vulcan( "AK-47", "AK-47 Vulcan", Material.INK_SACK, (byte) 7, 4),
|
||||
AK_47_Guardian( "AK-47", "Guardian AK", Material.PRISMARINE_SHARD, (byte) 0, 4),
|
||||
SG553_Pulse( "SG553", "SG553 Pulse", Material.INK_SACK, (byte) 5, 4),
|
||||
SG553_Pulse( "SG553", "SG553 Pulse", Material.INK_SACK, (byte) 5, 5),
|
||||
|
||||
|
||||
Knife_M9_Bayonette_Fade( "Knife", "M9 Bayonette Fade", Material.DIAMOND_SWORD, (byte) 0, 5),
|
||||
Knife_Counter_Terrorist_Sword("Knife", "Counter Terrorist Sword", Material.STICK, (byte) 0, 5),
|
||||
Knife_Terrorist_Sword( "Knife", "Terrorist Sword", Material.FEATHER, (byte) 0, 5),
|
||||
Knife_M9_Bayonette_Glass( "Knife", "Glass M9 Bayonette", Material.QUARTZ, (byte) 0, 5);
|
||||
Knife_M9_Bayonette_Fade( "Knife", "M9 Bayonette Fade", Material.DIAMOND_SWORD, (byte) 0, 6),
|
||||
Knife_Counter_Terrorist_Sword("Knife", "Counter Terrorist Sword", Material.STICK, (byte) 0, 6),
|
||||
Knife_Terrorist_Sword( "Knife", "Terrorist Sword", Material.FEATHER, (byte) 0, 6),
|
||||
Knife_M9_Bayonette_Glass( "Knife", "Glass M9 Bayonette", Material.QUARTZ, (byte) 0, 6);
|
||||
|
||||
private static final Map<Integer, List<MineStrikeSkin>> BY_CATEGORY;
|
||||
|
||||
|
@ -8,6 +8,7 @@ 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;
|
||||
@ -57,7 +58,9 @@ public class UserGadgetPersistence
|
||||
break;
|
||||
case GAME_MODIFIER:
|
||||
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
|
||||
if (gameModifierGadget.canAllowMultiple())
|
||||
GameCosmeticCategory category = gameModifierGadget.getCategory();
|
||||
|
||||
if (category.isAllowingMultiple())
|
||||
{
|
||||
if (!values.containsKey(gadget.getName()))
|
||||
continue;
|
||||
@ -69,7 +72,7 @@ public class UserGadgetPersistence
|
||||
}
|
||||
else
|
||||
{
|
||||
String dataKey = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", "");
|
||||
String dataKey = "active" + category.getType().getName().replace(" ", "");
|
||||
if (!values.containsKey(dataKey))
|
||||
continue;
|
||||
if (values.get(dataKey).equals(gadget.getName()))
|
||||
|
@ -6,41 +6,18 @@ 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.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
|
||||
|
||||
/**
|
||||
* An abstract wrapper for Gadgets of the type GameModifiers
|
||||
*/
|
||||
public class GameModifierGadget extends Gadget
|
||||
{
|
||||
|
||||
protected final GameModifierType _type;
|
||||
private final boolean _allowMultiple;
|
||||
private final GameCosmeticCategory _category;
|
||||
|
||||
/**
|
||||
* @param manager Normal GadgetManager
|
||||
* @param type The type of the GameModifier, normally a specific game mode
|
||||
* @param name The display name of the GameModifier
|
||||
* @param desc The lore description of the GameModifier
|
||||
* @param cost The shard cost of the GameModifier
|
||||
* @param mat The display material used in GUIs
|
||||
* @param data The display data used in GUIs
|
||||
*/
|
||||
public GameModifierGadget(GadgetManager manager, GameModifierType type, String name, String[] desc, int cost, Material mat, byte data, boolean allowMultiple)
|
||||
public GameModifierGadget(GadgetManager manager, GameCosmeticCategory category, String name, String[] desc, int cost, Material mat, byte data)
|
||||
{
|
||||
super(manager, GadgetType.GAME_MODIFIER, name, desc, cost, mat, data);
|
||||
_type = type;
|
||||
_allowMultiple = allowMultiple;
|
||||
}
|
||||
|
||||
public GameModifierType getGameType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public boolean canAllowMultiple()
|
||||
{
|
||||
return _allowMultiple;
|
||||
_category = category;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,4 +30,9 @@ public class GameModifierGadget extends Gadget
|
||||
UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + "."));
|
||||
}
|
||||
}
|
||||
|
||||
public GameCosmeticCategory getCategory()
|
||||
{
|
||||
return _category;
|
||||
}
|
||||
}
|
||||
|
@ -58,11 +58,10 @@ public class GoogleSheetsManager extends MiniPlugin
|
||||
for (int j = 0; j < values.size(); j++)
|
||||
{
|
||||
List<String> list = new ArrayList<>();
|
||||
Iterator<JsonElement> iterator = values.get(j).getAsJsonArray().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
|
||||
for (JsonElement jsonElement : values.get(j).getAsJsonArray())
|
||||
{
|
||||
String value = iterator.next().getAsString();
|
||||
String value = jsonElement.getAsString();
|
||||
list.add(value);
|
||||
}
|
||||
|
||||
|
@ -1014,7 +1014,7 @@ public class RewardManager
|
||||
|
||||
public UnknownPackageReward addMineStrikeSkin(Type type, MineStrikeSkin skin, RewardRarity rarity, int weight, int shards)
|
||||
{
|
||||
Gadget gadget = _gadgetManager.getGameModifier(skin);
|
||||
Gadget gadget = _gadgetManager.getGameCosmeticManager().getGadgetFrom(skin.getSkinName());
|
||||
return addGadget(type, gadget, gadget.getDisplayName() + " (Minestrike Weapon Skin)", rarity, weight, shards);
|
||||
}
|
||||
|
||||
|
@ -69,9 +69,9 @@ import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
||||
import mineplex.core.game.GameDisplay;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargedEvent;
|
||||
@ -902,9 +902,8 @@ public class GunModule implements Listener
|
||||
{
|
||||
Player damager = event.GetDamagerPlayer(false);
|
||||
|
||||
GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager();
|
||||
GameModifierMineStrikeSkin knifeSkin = (GameModifierMineStrikeSkin) gadgetManager.getActiveGameModifier(damager,
|
||||
GameModifierType.MineStrike, GameModifierMineStrikeSkin.getWeaponFilter("Knife"));
|
||||
GameCosmeticManager cosmeticManager = Manager.getCosmeticManager().getGadgetManager().getGameCosmeticManager();
|
||||
GameModifierMineStrikeSkin knifeSkin = (GameModifierMineStrikeSkin) cosmeticManager.getActiveCosmetic(damager, GameDisplay.MineStrike, "Knife");
|
||||
|
||||
ItemStack inHand = damager.getItemInHand();
|
||||
//Cancel Non-Knife Melee
|
||||
|
@ -46,11 +46,11 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.game.GameDisplay;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -257,9 +257,9 @@ public class Minestrike extends TeamGame
|
||||
GameTeam team = GetTeam(event.getPlayer());
|
||||
if (team == null)
|
||||
return;
|
||||
GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager();
|
||||
GameModifierMineStrikeSkin knifeSkin = (GameModifierMineStrikeSkin) gadgetManager.getActiveGameModifier(event.getPlayer(),
|
||||
GameModifierType.MineStrike, GameModifierMineStrikeSkin.getWeaponFilter("Knife"));
|
||||
|
||||
GameCosmeticManager cosmeticManager = Manager.getCosmeticManager().getGadgetManager().getGameCosmeticManager();
|
||||
GameModifierMineStrikeSkin knifeSkin = (GameModifierMineStrikeSkin) cosmeticManager.getActiveCosmetic(event.getPlayer(), GameDisplay.MineStrike, "Knife");
|
||||
|
||||
Material mat = Material.IRON_AXE;
|
||||
byte data = 0;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -31,12 +30,13 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
|
||||
import mineplex.core.game.GameDisplay;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargedEvent;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
@ -460,8 +460,7 @@ public class Gun extends StrikeItem
|
||||
|
||||
public void updateSkin(Player owner, GadgetManager gadgetmanager)
|
||||
{
|
||||
GameModifierMineStrikeSkin skin = (GameModifierMineStrikeSkin) gadgetmanager.getActiveGameModifier(owner,
|
||||
GameModifierType.MineStrike, GameModifierMineStrikeSkin.getWeaponFilter(getName()));
|
||||
GameModifierMineStrikeSkin skin = (GameModifierMineStrikeSkin) gadgetmanager.getGameCosmeticManager().getActiveCosmetic(owner, GameDisplay.MineStrike, _gunStats.getGunType().getName(), GameModifierMineStrikeSkin.getWeaponFilter(getName()));
|
||||
|
||||
if(skin == null) return;
|
||||
|
||||
|
@ -1,17 +1,5 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
@ -25,7 +13,18 @@ import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Iterator;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkApple extends Perk implements IThrown
|
||||
{
|
||||
@ -62,10 +61,10 @@ public class PerkApple extends Perk implements IThrown
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
continue;
|
||||
|
||||
if (!Recharge.Instance.use(player, getMessage(player), _spawnDelay, false, false))
|
||||
if (!Recharge.Instance.use(player, "Apple Spawn Throw", _spawnDelay, false, false))
|
||||
continue;
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(getMaterial(player)));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.APPLE));
|
||||
player.playSound(player.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
|
||||
}
|
||||
}
|
||||
@ -79,7 +78,7 @@ public class PerkApple extends Perk implements IThrown
|
||||
if (event.getPlayer().getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getItemInHand().getType() != getMaterial(event.getPlayer()))
|
||||
if (event.getPlayer().getItemInHand().getType() != Material.APPLE)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
@ -87,17 +86,17 @@ public class PerkApple extends Perk implements IThrown
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, getMessage(player) + " Throw", _throwDelay, false, false))
|
||||
if (!Recharge.Instance.use(player, "Apple Spawn Throw", _throwDelay, false, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
UtilInv.remove(player, getMaterial(player), (byte)0, 1);
|
||||
UtilInv.remove(player, Material.APPLE, (byte)0, 1);
|
||||
UtilInv.Update(player);
|
||||
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(getMaterial(player)));
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.APPLE));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f);
|
||||
}
|
||||
@ -126,7 +125,7 @@ public class PerkApple extends Perk implements IThrown
|
||||
|
||||
//Re-Drop
|
||||
if (data.getThrown() instanceof Item && data.getThrown() instanceof Player)
|
||||
data.getThrown().getWorld().dropItem(data.getThrown().getLocation(), ItemStackFactory.Instance.CreateStack(getMaterial((Player) data.getThrower()))).setPickupDelay(60);
|
||||
data.getThrown().getWorld().dropItem(data.getThrown().getLocation(), ItemStackFactory.Instance.CreateStack(Material.APPLE)).setPickupDelay(60);
|
||||
|
||||
data.getThrown().remove();
|
||||
}
|
||||
@ -159,22 +158,4 @@ public class PerkApple extends Perk implements IThrown
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Material getMaterial(Player player)
|
||||
{
|
||||
if (Manager.getCosmeticManager().getGadgetManager().isKitModifierActive(KitModifier.Bridges_Apple_Potato, player))
|
||||
{
|
||||
return Material.POTATO_ITEM;
|
||||
}
|
||||
return Material.APPLE;
|
||||
}
|
||||
|
||||
private String getMessage(Player player)
|
||||
{
|
||||
if (Manager.getCosmeticManager().getGadgetManager().isKitModifierActive(KitModifier.Bridges_Apple_Potato, player))
|
||||
{
|
||||
return "Potato Spawn";
|
||||
}
|
||||
return "Apple Spawn";
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,6 @@ import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -69,34 +66,7 @@ public class PerkHorsePet extends Perk
|
||||
|
||||
Manager.GetGame().CreatureAllowOverride = true;
|
||||
|
||||
KitModifier kitModifier = getHorseType(player);
|
||||
final Horse.Variant variant;
|
||||
if (kitModifier != null)
|
||||
{
|
||||
switch (getHorseType(player))
|
||||
{
|
||||
case Survival_Games_Horseman_Mule:
|
||||
variant = Variant.MULE;
|
||||
break;
|
||||
case Survival_Games_Horseman_Skeleton_Horse:
|
||||
variant = Variant.SKELETON_HORSE;
|
||||
break;
|
||||
case Survival_Games_Horseman_Zombie_Horse:
|
||||
variant = Variant.UNDEAD_HORSE;
|
||||
break;
|
||||
case Survival_Games_Horseman_Donkey:
|
||||
variant = Variant.DONKEY;
|
||||
break;
|
||||
default:
|
||||
variant = Variant.HORSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
variant = Variant.HORSE;
|
||||
}
|
||||
Horse horse = UtilVariant.spawnHorse(player.getLocation(), variant);
|
||||
Horse horse = UtilVariant.spawnHorse(player.getLocation(), Variant.HORSE);
|
||||
horse.setAdult();
|
||||
horse.setAgeLock(true);
|
||||
horse.setColor(Color.BROWN);
|
||||
@ -320,10 +290,4 @@ public class PerkHorsePet extends Perk
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private KitModifier getHorseType(Player player)
|
||||
{
|
||||
GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager();
|
||||
return gadgetManager.getActiveKitModifier(KitModifierType.SurvivalGames_HorsemanKit, player);
|
||||
}
|
||||
}
|
||||
|
@ -31,13 +31,8 @@ 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.disguise.disguises.DisguiseZombie;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.utils.UtilVariant;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
@ -109,46 +104,10 @@ public class PerkSkeletons extends Perk
|
||||
|
||||
Manager.GetGame().CreatureAllowOverride = true;
|
||||
|
||||
KitModifier kitModifier = getSkeletonType(killer);
|
||||
final Skeleton.SkeletonType type;
|
||||
if (kitModifier != null)
|
||||
{
|
||||
switch (kitModifier)
|
||||
{
|
||||
case Survival_Games_Necromancer_Wither_Skeleton:
|
||||
type = Skeleton.SkeletonType.WITHER;
|
||||
break;
|
||||
case Survival_Games_Necromancer_Zombie:
|
||||
type = Skeleton.SkeletonType.NORMAL;
|
||||
break;
|
||||
default:
|
||||
type = Skeleton.SkeletonType.NORMAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
type = Skeleton.SkeletonType.NORMAL;
|
||||
}
|
||||
|
||||
final Skeleton skel;
|
||||
if (type == Skeleton.SkeletonType.NORMAL)
|
||||
{
|
||||
skel = killer.getWorld().spawn(killed.getLocation(), Skeleton.class);
|
||||
|
||||
} else
|
||||
{
|
||||
skel = UtilVariant.spawnWitherSkeleton(killed.getLocation());
|
||||
}
|
||||
Skeleton skel = killed.getWorld().spawn(killed.getLocation(), Skeleton.class);
|
||||
|
||||
Manager.GetGame().CreatureAllowOverride = false;
|
||||
|
||||
if (kitModifier != null && kitModifier == KitModifier.Survival_Games_Necromancer_Zombie)
|
||||
{
|
||||
DisguiseZombie disguiseZombie = new DisguiseZombie(skel);
|
||||
Manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseZombie);
|
||||
}
|
||||
|
||||
UtilEnt.removeGoalSelectors(skel);
|
||||
|
||||
skel.setMaxHealth(30);
|
||||
@ -376,10 +335,4 @@ public class PerkSkeletons extends Perk
|
||||
{
|
||||
return _minions.get(player);
|
||||
}
|
||||
|
||||
private KitModifier getSkeletonType(Player player)
|
||||
{
|
||||
GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager();
|
||||
return gadgetManager.getActiveKitModifier(KitModifierType.SurvivalGames_NecromancerKit, player);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWolf;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wolf;
|
||||
@ -38,11 +37,6 @@ import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.disguises.DisguiseGuardian;
|
||||
import mineplex.core.disguise.disguises.DisguiseSquid;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -123,7 +117,6 @@ public class PerkWolfPet extends Perk
|
||||
_petMap.get(cur).add(wolf);
|
||||
Manager.GetGame().CreatureAllowOverride = false;
|
||||
cur.playSound(cur.getLocation(), Sound.WOLF_HOWL, 1f, 1f);
|
||||
disguise(wolf, cur);
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,47 +372,4 @@ public class PerkWolfPet extends Perk
|
||||
event.AddMod("Wolf Minion", "Negate", -event.GetDamageInitial(), false);
|
||||
event.AddMod("Wolf Minion", "Damage", damage, false);
|
||||
}
|
||||
|
||||
private void disguise(Entity wolf, Player player)
|
||||
{
|
||||
EntityType entityType = getDisguiseType(player);
|
||||
if (entityType != null)
|
||||
{
|
||||
if (entityType.equals(EntityType.GUARDIAN))
|
||||
{
|
||||
DisguiseGuardian disguiseGuardian = new DisguiseGuardian(wolf);
|
||||
Manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseGuardian);
|
||||
return;
|
||||
}
|
||||
else if (entityType.equals(EntityType.SQUID))
|
||||
{
|
||||
DisguiseSquid disguiseSquid = new DisguiseSquid(wolf);
|
||||
Manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseSquid);
|
||||
return;
|
||||
}
|
||||
/*DisguiseAnimalBase disguiseAnimal = new DisguiseAnimalBase(entityType, wolf); // TODO: what does this even do?
|
||||
Manager.getCosmeticManager().getGadgetManager().getDisguiseManager().disguise(disguiseAnimal);*/
|
||||
}
|
||||
}
|
||||
|
||||
private EntityType getDisguiseType(Player player)
|
||||
{
|
||||
GadgetManager gadgetManager = Manager.getCosmeticManager().getGadgetManager();
|
||||
KitModifier kitModifier = gadgetManager.getActiveKitModifier(KitModifierType.SurvivalGames_BeastmasterKit, player);
|
||||
if (kitModifier != null)
|
||||
{
|
||||
switch (kitModifier)
|
||||
{
|
||||
case Survival_Games_Beastmaster_Chicken:
|
||||
return EntityType.CHICKEN;
|
||||
case Survival_Games_Beastmaster_Mini_Guardian:
|
||||
return EntityType.GUARDIAN;
|
||||
case Survival_Games_Beastmaster_Pig:
|
||||
return EntityType.PIG;
|
||||
case Survival_Games_Beastmaster_Squid:
|
||||
return EntityType.SQUID;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,13 @@
|
||||
package mineplex.gemhunters;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.spigotmc.SpigotConfig;
|
||||
|
||||
import mineplex.core.CustomTagFix;
|
||||
import mineplex.core.FoodDupeFix;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
@ -72,7 +80,6 @@ import mineplex.gemhunters.loot.InventoryModule;
|
||||
import mineplex.gemhunters.loot.LootModule;
|
||||
import mineplex.gemhunters.map.ItemMapModule;
|
||||
import mineplex.gemhunters.moderation.ModerationModule;
|
||||
import mineplex.gemhunters.mount.MountModule;
|
||||
import mineplex.gemhunters.persistence.PersistenceModule;
|
||||
import mineplex.gemhunters.playerstatus.PlayerStatusModule;
|
||||
import mineplex.gemhunters.quest.QuestModule;
|
||||
@ -91,12 +98,6 @@ import mineplex.gemhunters.worldevent.WorldEventModule;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.spigotmc.SpigotConfig;
|
||||
|
||||
import static mineplex.core.Managers.require;
|
||||
|
||||
@ -281,7 +282,6 @@ public class GemHunters extends JavaPlugin
|
||||
require(ItemMapModule.class);
|
||||
require(JoinModule.class);
|
||||
require(ModerationModule.class);
|
||||
require(MountModule.class);
|
||||
require(PersistenceModule.class);
|
||||
require(PlayerStatusModule.class);
|
||||
require(QuestModule.class);
|
||||
|
@ -1,43 +0,0 @@
|
||||
package mineplex.gemhunters.mount;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.MountType;
|
||||
|
||||
public class MountData
|
||||
{
|
||||
|
||||
private MountType _mountType;
|
||||
private LivingEntity _entity;
|
||||
private long _cooldown;
|
||||
|
||||
public void setMountType(MountType mountType)
|
||||
{
|
||||
_mountType = mountType;
|
||||
}
|
||||
|
||||
public MountType getMountType()
|
||||
{
|
||||
return _mountType;
|
||||
}
|
||||
|
||||
public void setEntity(LivingEntity entity)
|
||||
{
|
||||
_entity = entity;
|
||||
}
|
||||
|
||||
public LivingEntity getEntity()
|
||||
{
|
||||
return _entity;
|
||||
}
|
||||
|
||||
public void setCooldown(long cooldown)
|
||||
{
|
||||
_cooldown = cooldown;
|
||||
}
|
||||
|
||||
public long getCooldown()
|
||||
{
|
||||
return _cooldown;
|
||||
}
|
||||
}
|
@ -1,161 +0,0 @@
|
||||
package mineplex.gemhunters.mount;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GameModifierMount;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.MountType;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.gemhunters.loot.LootItem;
|
||||
import mineplex.gemhunters.loot.LootModule;
|
||||
|
||||
@ReflectivelyCreateMiniPlugin
|
||||
public class MountModule extends MiniClientPlugin<MountData>
|
||||
{
|
||||
|
||||
private static final String ITEM_METADATA = "MOUNT";
|
||||
|
||||
private final LootModule _loot;
|
||||
private final GadgetManager _gadget;
|
||||
|
||||
private MountModule()
|
||||
{
|
||||
super("Mount");
|
||||
|
||||
_loot = require(LootModule.class);
|
||||
_gadget = require(GadgetManager.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MountData addPlayer(UUID uuid)
|
||||
{
|
||||
return new MountData();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
ItemStack itemStack = player.getItemInHand();
|
||||
|
||||
if (itemStack == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LootItem lootItem = _loot.fromItemStack(itemStack);
|
||||
|
||||
if (lootItem == null || lootItem.getMetadata() == null || !lootItem.getMetadata().startsWith(ITEM_METADATA))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.usable(player, _moduleName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int cooldown = Integer.parseInt(lootItem.getMetadata().split(" ")[1]) * 1000;
|
||||
|
||||
spawnMount(player, cooldown);
|
||||
}
|
||||
|
||||
public void spawnMount(Player player, long cooldown)
|
||||
{
|
||||
GameModifierMount mount = ((GameModifierMount) _gadget.getActiveGameModifier(player, GameModifierType.GemHunters, g -> g != null));
|
||||
MountType mountType = null;
|
||||
|
||||
if (mount != null)
|
||||
{
|
||||
mountType = mount.getMountType();
|
||||
}
|
||||
|
||||
player.sendMessage(F.main(_moduleName, "Mounts are currently disabled."));
|
||||
//spawnMount(player, mountType, cooldown);
|
||||
}
|
||||
|
||||
public void spawnMount(Player player, MountType mountType, long cooldown)
|
||||
{
|
||||
MountData data = Get(player);
|
||||
LivingEntity entity = data.getEntity();
|
||||
EntityType entityType = mountType == null ? EntityType.HORSE : mountType.getEntityType();
|
||||
|
||||
despawnMount(player);
|
||||
|
||||
entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation().add(0, 1, 0), entityType);
|
||||
|
||||
if (entity instanceof Tameable)
|
||||
{
|
||||
Tameable tameable = (Tameable) entity;
|
||||
|
||||
tameable.setOwner(player);
|
||||
}
|
||||
|
||||
if (entity instanceof Horse)
|
||||
{
|
||||
Horse horse = (Horse) entity;
|
||||
|
||||
horse.setAdult();
|
||||
horse.setAgeLock(true);
|
||||
horse.setColor(Color.BROWN);
|
||||
horse.setStyle(Style.NONE);
|
||||
horse.setMaxDomestication(1);
|
||||
horse.setJumpStrength(0.8);
|
||||
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
|
||||
horse.getInventory().setArmor(new ItemStack(player.getItemInHand().getType()));
|
||||
}
|
||||
|
||||
entity.setCustomName(player.getName() + "\'s Mount");
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setCanPickupItems(false);
|
||||
entity.setMaxHealth(40);
|
||||
entity.setHealth(40);
|
||||
|
||||
data.setEntity(entity);
|
||||
data.setMountType(mountType);
|
||||
data.setCooldown(cooldown);
|
||||
|
||||
entity.setPassenger(player);
|
||||
}
|
||||
|
||||
public void despawnMount(Player player)
|
||||
{
|
||||
MountData data = Get(player);
|
||||
LivingEntity entity = data.getEntity();
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
entity.remove();
|
||||
|
||||
Recharge.Instance.use(player, _moduleName, data.getCooldown(), true, false);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isActive(Player player)
|
||||
{
|
||||
return Get(player).getEntity() != null;
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package mineplex.gemhunters.mount.event;
|
||||
|
||||
public class MountSpawnEvent
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user