Testing persistence fixes

This commit is contained in:
LCastr0 2016-06-25 00:33:36 -03:00
parent 3433e0e3bc
commit 83f4b25887
76 changed files with 278 additions and 207 deletions

View File

@ -205,7 +205,7 @@ public class CosmeticManager extends MiniPlugin
public void disableTeamArmor()
{
for (Gadget gadget : getGadgetManager().getGadgets(GadgetType.Costume))
for (Gadget gadget : getGadgetManager().getGadgets(GadgetType.COSTUME))
{
if (gadget instanceof OutfitTeam)
{

View File

@ -28,11 +28,11 @@ public class ArrowTrailPage extends GadgetPage
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ArrowTrail))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ARROW_TRAIL))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ArrowTrail) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ARROW_TRAIL) == gadget)
addGlow(slot);
slot++;

View File

@ -26,11 +26,11 @@ public class BalloonsPage extends GadgetPage
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Balloon))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.BALLOON))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Balloon) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.BALLOON) == gadget)
addGlow(slot);
slot++;

View File

@ -36,7 +36,7 @@ public class CostumePage extends GadgetPage
{
int slot;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME))
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -1)
continue;
@ -69,7 +69,7 @@ public class CostumePage extends GadgetPage
public void onClick(Player player, ClickType clickType)
{
boolean gadgetDisabled = false;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME))
{
if (gadget.isActive(player))
{

View File

@ -28,11 +28,11 @@ public class DeathEffectPage extends GadgetPage
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Death))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DEATH))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Death) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DEATH) == gadget)
addGlow(slot);
slot++;

View File

@ -28,11 +28,11 @@ public class DoubleJumpPage extends GadgetPage
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DoubleJump))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DOUBLE_JUMP))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DoubleJump) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DOUBLE_JUMP) == gadget)
addGlow(slot);
slot++;

View File

@ -46,7 +46,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ITEM))
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -3)
continue;
@ -286,8 +286,8 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
meta.setLore(itemLore);
gadgetItemStack.setItemMeta(meta);
if (gadget.getGadgetType() == GadgetType.ArrowTrail || gadget.getGadgetType() == GadgetType.Death
|| gadget.getGadgetType() == GadgetType.Particle || gadget.getGadgetType() == GadgetType.DoubleJump)
if (gadget.getGadgetType() == GadgetType.ARROW_TRAIL || gadget.getGadgetType() == GadgetType.DEATH
|| gadget.getGadgetType() == GadgetType.PARTICLE || gadget.getGadgetType() == GadgetType.DOUBLE_JUMP)
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8)
{
@ -309,8 +309,8 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
meta.setLore(itemLore);
gadgetItemStack.setItemMeta(meta);
if (gadget.getGadgetType() == GadgetType.ArrowTrail || gadget.getGadgetType() == GadgetType.Death
|| gadget.getGadgetType() == GadgetType.Particle || gadget.getGadgetType() == GadgetType.DoubleJump)
if (gadget.getGadgetType() == GadgetType.ARROW_TRAIL || gadget.getGadgetType() == GadgetType.DEATH
|| gadget.getGadgetType() == GadgetType.PARTICLE || gadget.getGadgetType() == GadgetType.DOUBLE_JUMP)
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8)
{

View File

@ -31,13 +31,13 @@ public class HatPage extends GadgetPage
{
int slot = 19;
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.Hat);
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.HAT);
if(list != null)
for (Gadget gadget : list)
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Hat) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.HAT) == gadget)
addGlow(slot);
slot++;

View File

@ -122,32 +122,32 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
}
Creature petActive = getPlugin().getPetManager().GetPet(getPlayer());
GadgetType type = GadgetType.Particle;
GadgetType type = GadgetType.PARTICLE;
String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", "Visible Everywhere", enabled.get(type));
addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(particleSlot);
type = GadgetType.ArrowTrail;
type = GadgetType.ARROW_TRAIL;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", "Visible in Games", enabled.get(type));
addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Effects", lore, 1, false), new OpenArrowTrails(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(arrowSlot);
type = GadgetType.DoubleJump;
type = GadgetType.DOUBLE_JUMP;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", "Visible Everywhere", enabled.get(type));
addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(jumpSlot);
type = GadgetType.Death;
type = GadgetType.DEATH;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", "Visible in Games", enabled.get(type));
addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(deathSlot);
type = GadgetType.Item;
type = GadgetType.ITEM;
lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type));
addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(gadgetSlot);
type = GadgetType.Morph;
type = GadgetType.MORPH;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Have you ever wanted to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type));
addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(morphSlot);
@ -160,18 +160,18 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this));
if (petActive != null) addGlow(petSlot);
type = GadgetType.Hat;
type = GadgetType.HAT;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", "Usable in Lobbies", enabled.get(type));
addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(hatSlot);
type = GadgetType.Costume;
type = GadgetType.COSTUME;
// Fixes more than 8 costumes being counted, even without the WindUp
lore = getLore((ownedCount.get(type) > 8) ? 8 : ownedCount.get(type), /*maxCount.get(type)*/ 8, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type));
addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(costumeSlot);
type = GadgetType.MusicDisc;
type = GadgetType.MUSIC_DISC;
lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", "Usable in Lobbies", enabled.get(type));
addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(musicSlot);
@ -185,13 +185,13 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
}
});
type = GadgetType.WinEffect;
type = GadgetType.WIN_EFFECT;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awesome effects is even more fun!", "Usable in Lobbies", enabled.get(type));
addButton(winEffectSlot, new ShopItem(Material.CAKE, "Win Effects", lore, 1, false), new OpenWinEffect(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(winEffectSlot);
type = GadgetType.GameModifier;
type = GadgetType.GAME_MODIFIER;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Visible in Games", enabled.get(type));
addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Modifiers", lore, 1, false), new OpenGameModifiers(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(gameModifierSlot);

View File

@ -26,11 +26,11 @@ public class MorphPage extends GadgetPage
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Morph))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MORPH))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget)
addGlow(slot);
slot++;

View File

@ -28,7 +28,7 @@ public class MusicPage extends GadgetPage
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MusicDisc))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MUSIC_DISC))
{
addGadget(gadget, slot);

View File

@ -26,11 +26,11 @@ public class ParticlePage extends GadgetPage
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Particle))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.PARTICLE))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.PARTICLE) == gadget)
addGlow(slot);
slot++;

View File

@ -31,13 +31,13 @@ public class TauntPage extends GadgetPage
{
int slot = 19;
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.Taunt);
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.TAUNT);
if(list != null)
for (Gadget gadget : list)
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget)
addGlow(slot);
slot++;

View File

@ -28,11 +28,11 @@ public class WinEffectPage extends GadgetPage
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WinEffect))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WIN_EFFECT))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WinEffect) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WIN_EFFECT) == gadget)
addGlow(slot);
slot++;

View File

@ -19,10 +19,9 @@ import mineplex.core.gadget.gadgets.wineffect.*;
import mineplex.core.gadget.persistence.UserGadgetPersistence;
import mineplex.core.gadget.set.*;
import mineplex.core.gadget.types.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import mineplex.core.incognito.events.IncognitoHidePlayerEvent;
import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
import org.bukkit.*;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
@ -504,7 +503,7 @@ public class GadgetManager extends MiniPlugin
public List<GameModifierGadget> getGameModifiers(GameModifierType gameType)
{
List<GameModifierGadget> list = new ArrayList<>();
for (Gadget g : getGadgets(GadgetType.GameModifier))
for (Gadget g : getGadgets(GadgetType.GAME_MODIFIER))
{
if (g instanceof GameModifierGadget)
{
@ -567,7 +566,7 @@ public class GadgetManager extends MiniPlugin
public HatGadget getHatGadget(HatType type)
{
for (Gadget gadget : getGadgets(GadgetType.Hat))
for (Gadget gadget : getGadgets(GadgetType.HAT))
{
if(gadget instanceof HatGadget)
{
@ -837,7 +836,7 @@ public class GadgetManager extends MiniPlugin
public void redisplayActiveItem(Player player)
{
for (Gadget gadget : _gadgets.get(GadgetType.Item))
for (Gadget gadget : _gadgets.get(GadgetType.ITEM))
{
if (gadget instanceof ItemGadget)
{
@ -851,7 +850,7 @@ public class GadgetManager extends MiniPlugin
public boolean canPlaySongAt(Location location)
{
for (Gadget gadget : _gadgets.get(GadgetType.MusicDisc))
for (Gadget gadget : _gadgets.get(GadgetType.MUSIC_DISC))
{
if (gadget instanceof MusicGadget)
{
@ -917,6 +916,8 @@ public class GadgetManager extends MiniPlugin
private void saveGadgets(Player player)
{
if (player.getGameMode() == GameMode.SPECTATOR)
return;
Map<String, String> cache = new HashMap<>();
for (Gadget gadget : getAllGadgets())
{
@ -925,12 +926,12 @@ public class GadgetManager extends MiniPlugin
{
switch (gadgetType)
{
case MusicDisc:
case Item:
case Morph:
case Balloon:
case MUSIC_DISC:
case ITEM:
case MORPH:
case BALLOON:
break;
case Costume:
case COSTUME:
OutfitGadget outfitGadget = (OutfitGadget) gadget;
String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
if (cache.containsKey(key))
@ -938,7 +939,7 @@ public class GadgetManager extends MiniPlugin
if (outfitGadget.isActive(player))
cache.put(key, outfitGadget.getName());
break;
case GameModifier:
case GAME_MODIFIER:
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
if (gameModifierGadget.canAllowMultiple())
{
@ -963,12 +964,29 @@ public class GadgetManager extends MiniPlugin
}
}
}
cache = updateDefaultGadgets(cache);
_userGadgetPersistence.save(player, cache);
}
private Map<String, String> updateDefaultGadgets(Map<String, String> cache)
{
for (GadgetType gadgetType : GadgetType.values())
{
if (gadgetType == GadgetType.MUSIC_DISC || gadgetType == GadgetType.ITEM
|| gadgetType == GadgetType.MORPH || gadgetType == GadgetType.BALLOON
|| gadgetType == GadgetType.GAME_MODIFIER)
continue;
if (!cache.containsKey(gadgetType.getDatabaseKey()))
{
cache.put(gadgetType.getDatabaseKey(), "disabled");
}
}
return cache;
}
public boolean isKitModifierActive(KitModifier kitModifier, Player player)
{
for (Gadget gadget : getGadgets(GadgetType.GameModifier))
for (Gadget gadget : getGadgets(GadgetType.GAME_MODIFIER))
{
if (gadget instanceof KitGameModifier)
{
@ -990,4 +1008,24 @@ public class GadgetManager extends MiniPlugin
}
return null;
}
@EventHandler
public void onVanish(IncognitoStatusChangeEvent event)
{
if (event.getNewState())
{
for (Gadget gadget : getGadgets(GadgetType.PARTICLE))
{
if (gadget.isActive(event.getPlayer()))
{
gadget.disable(event.getPlayer());
}
}
}
}
public UserGadgetPersistence getUserGadgetPersistence()
{
return _userGadgetPersistence;
}
}

View File

@ -104,7 +104,7 @@ public class AmmoCommand extends CommandBase<GadgetManager>
private Gadget getGadgetByName(String gadgetName)
{
for (Gadget gadget : _plugin.getGadgets(GadgetType.Item))
for (Gadget gadget : _plugin.getGadgets(GadgetType.ITEM))
{
if (gadget.getName().equalsIgnoreCase(gadgetName.replaceAll("_", " ")))
return gadget;

View File

@ -12,7 +12,7 @@ public class GadgetEnableEvent extends Event
private Player _player;
private Gadget _gadget;
private boolean _showMessage = true;
private boolean _cancelled = false;
@ -51,4 +51,14 @@ public class GadgetEnableEvent extends Event
{
return _cancelled;
}
public void setShowMessage(boolean showMessage)
{
_showMessage = showMessage;
}
public boolean canShowMessage()
{
return _showMessage;
}
}

View File

@ -19,7 +19,7 @@ public class BabyCowBalloon extends BalloonGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
if (!canSpawnBalloon(player))
{

View File

@ -37,11 +37,11 @@ public class KitGameModifier extends GameModifierGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
Manager.getGameModifiers(getGameType()).stream().filter(getKitFilter(_kitType)).forEach(g -> g.disable(player));
super.enableCustom(player);
super.enableCustom(player, message);
}
/**

View File

@ -83,11 +83,11 @@ public class GameModifierMineStrikeSkin extends GameModifierGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon)).forEach(g -> g.disable(player));
super.enableCustom(player);
super.enableCustom(player, message);
}
/**

View File

@ -28,7 +28,7 @@ public class ItemDuelingSword extends ItemGadget
@Override
public void ApplyItem(Player player, boolean inform)
{
Manager.removeGadgetType(player, GadgetType.Item);
Manager.removeGadgetType(player, GadgetType.ITEM);
_active.add(player);

View File

@ -70,7 +70,7 @@ public class ItemLovePotion extends ItemGadget
@Override
public void ApplyItem(Player player, boolean inform)
{
Manager.removeGadgetType(player, GadgetType.Item);
Manager.removeGadgetType(player, GadgetType.ITEM);
_active.add(player);

View File

@ -52,7 +52,7 @@ public class ItemPaintbrush extends ItemGadget
@Override
public void ApplyItem(Player player, boolean inform)
{
Manager.removeGadgetType(player, GadgetType.Item);
Manager.removeGadgetType(player, GadgetType.ITEM);
_active.add(player);
@ -79,9 +79,9 @@ public class ItemPaintbrush extends ItemGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
ApplyItem(player, true);
ApplyItem(player, message);
_brushColor.put(player.getName(), (byte)15);
_playerLocation.put(player.getName(), player.getLocation());

View File

@ -54,9 +54,9 @@ public class MorphBat extends MorphGadget implements IThrown
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseBat disguise = new DisguiseBat(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -37,9 +37,9 @@ public class MorphBlaze extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseBlaze disguise = new DisguiseBlaze(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -46,9 +46,9 @@ public class MorphBlock extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
_active.put(player, new BlockForm(this, player, Material.EMERALD_BLOCK));
}

View File

@ -65,9 +65,9 @@ public class MorphBunny extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseRabbit disguise = new DisguiseRabbit(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -43,9 +43,9 @@ public class MorphChicken extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseChicken disguise = new DisguiseChicken(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -31,9 +31,9 @@ public class MorphCow extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseCow disguise = new DisguiseCow(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -45,9 +45,9 @@ public class MorphCreeper extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseCreeper disguise = new DisguiseCreeper(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -42,9 +42,9 @@ public class MorphEnderman extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseEnderman disguise = new DisguiseEnderman(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -44,9 +44,9 @@ public class MorphPig extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguisePig disguise = new DisguisePig(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -29,9 +29,9 @@ public class MorphPumpkinKing extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
disguise.showArmor();

View File

@ -43,9 +43,9 @@ public class MorphSlime extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseSlime disguise = new DisguiseSlime(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -55,9 +55,9 @@ public class MorphSnowman extends MorphGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseSnowman disguise = new DisguiseSnowman(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -55,9 +55,9 @@ public class MorphTitan extends MorphGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseGuardian disguise = new DisguiseGuardian(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -33,9 +33,9 @@ public class MorphUncleSam extends MorphGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguisePlayer disguisePlayer = new DisguisePlayer(player);
disguisePlayer.setProfile(new GameProfile(UUID.randomUUID(), C.cRed + "Uncle " + C.cBlue + "Sam"));

View File

@ -53,9 +53,9 @@ public class MorphVillager extends MorphGadget implements IThrown
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
DisguiseVillager disguise = new DisguiseVillager(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());

View File

@ -56,9 +56,9 @@ public class MorphWither extends MorphGadget
}
@Override
public void enableCustom(final Player player)
public void enableCustom(final Player player, boolean message)
{
this.ApplyArmor(player);
this.ApplyArmor(player, message);
player.setMaxHealth(300);
player.setHealth(300);

View File

@ -49,15 +49,15 @@ public class OutfitTeam extends OutfitGadget
return;
}
enableCustom(player);
enableCustom(player, true);
Manager.setActive(player, this);
Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this));
}
@Override
public void applyArmor(Player player)
public void applyArmor(Player player, boolean message)
{
Manager.removeGadgetType(player, GadgetType.Morph);
Manager.removeGadgetType(player, GadgetType.MORPH);
Manager.removeOutfit(player, _slot);
@ -89,9 +89,9 @@ public class OutfitTeam extends OutfitGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
applyArmor(player);
applyArmor(player, message);
colorArmor(player);
}

View File

@ -36,9 +36,9 @@ public class OutfitRaveSuit extends OutfitGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
applyArmor(player);
applyArmor(player, message);
_colorPhase.put(player.getName(), -1);
}

View File

@ -26,9 +26,9 @@ public class OutfitSpaceSuit extends OutfitGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
applyArmor(player);
applyArmor(player, message);
}
@Override

View File

@ -33,9 +33,9 @@ public class OutfitWindUpSuit extends OutfitGadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
applyArmor(player);
applyArmor(player, message);
_colorPhase.put(player, 0);
_percentage.put(player, 0);
}

View File

@ -5,6 +5,7 @@ import java.sql.ResultSet;
import java.util.*;
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.types.Gadget;
@ -30,6 +31,7 @@ public class UserGadgetPersistence
_repository.getAll(player.getUniqueId()).thenCompose(BukkitFuture.accept(values -> {
if (player.isOnline())
{
boolean enabledGadget = false;
for (Gadget gadget : _manager.getAllGadgets())
{
if (!gadget.ownsGadget(player))
@ -37,27 +39,33 @@ public class UserGadgetPersistence
GadgetType gadgetType = gadget.getGadgetType();
switch (gadgetType)
{
case MusicDisc:
case Item:
case Morph:
case Balloon:
case MUSIC_DISC:
case ITEM:
case MORPH:
case BALLOON:
break;
case Costume:
case COSTUME:
OutfitGadget outfitGadget = (OutfitGadget) gadget;
String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
if (!values.containsKey(key))
continue;
if (values.get(key).equals(gadget.getName()))
{
gadget.enable(player, false);
enabledGadget = true;
}
break;
case GameModifier:
case GAME_MODIFIER:
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
if (gameModifierGadget.canAllowMultiple())
{
if (!values.containsKey(gadget.getName()))
continue;
if (values.get(gadget.getName()).equals("enabled"))
{
gadget.enable(player, false);
enabledGadget = true;
}
}
else
{
@ -65,17 +73,27 @@ public class UserGadgetPersistence
if (!values.containsKey(dataKey))
continue;
if (values.get(dataKey).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);
{
gadget.enable(player, false);
enabledGadget = true;
}
break;
}
}
if (enabledGadget)
{
player.sendMessage(F.main("Cosmetics", "You enabled all your previously enabled cosmetics!"));
}
}
}));
}

View File

@ -14,7 +14,6 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.inventory.ItemStack;
public abstract class ArrowEffectGadget extends Gadget
{
@ -22,7 +21,7 @@ public abstract class ArrowEffectGadget extends Gadget
public ArrowEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames)
{
super(manager, GadgetType.ArrowTrail, name, desc, cost, mat, data, 1, altNames);
super(manager, GadgetType.ARROW_TRAIL, name, desc, cost, mat, data, 1, altNames);
}
public boolean shouldDisplay(Player player)

View File

@ -15,7 +15,7 @@ public abstract class BalloonGadget extends Gadget
public BalloonGadget(GadgetManager manager, String name, String[] desc, int cost, Material material, byte data, String... altNames)
{
super(manager, GadgetType.Balloon, name, desc, cost, material, data, 1, altNames);
super(manager, GadgetType.BALLOON, name, desc, cost, material, data, 1, altNames);
_random = new Random();
}

View File

@ -12,7 +12,7 @@ public abstract class DeathEffectGadget extends Gadget
{
public DeathEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String... altNames)
{
super(manager, GadgetType.Death, name, desc, cost, mat, data, 1, altNames);
super(manager, GadgetType.DEATH, name, desc, cost, mat, data, 1, altNames);
}
public boolean shouldDisplay(Player player)

View File

@ -12,7 +12,7 @@ public abstract class DoubleJumpEffectGadget extends Gadget
{
public DoubleJumpEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String... altNames)
{
super(manager, GadgetType.DoubleJump, name, desc, cost, mat, data, 1, altNames);
super(manager, GadgetType.DOUBLE_JUMP, name, desc, cost, mat, data, 1, altNames);
}
public boolean shouldDisplay(Player player)

View File

@ -99,19 +99,20 @@ public abstract class Gadget extends SalesPackageBase implements Listener
public void enable(Player player, boolean message)
{
GadgetEnableEvent gadgetEvent = new GadgetEnableEvent(player, this);
gadgetEvent.setShowMessage(message);
Bukkit.getServer().getPluginManager().callEvent(gadgetEvent);
if (gadgetEvent.isCancelled())
{
if (message)
UtilPlayer.message(player, F.main("Inventory", getName() + " is not enabled."));
return;
}
if (message)
System.out.println(player.getName() + " has activated " + Name);
Manager.setActive(player, this);
enableCustom(player);
enableCustom(player, message);
Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this));
}
@ -132,10 +133,11 @@ public abstract class Gadget extends SalesPackageBase implements Listener
}
}
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
Manager.removeGadgetType(player, _gadgetType, this);
_active.add(player);
if (message)
UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + "."));
}

View File

@ -41,7 +41,7 @@ public abstract class GadgetSet implements Listener
Bukkit.getPluginManager().registerEvents(this, Manager.getPlugin());
}
public void checkPlayer(Player player, Gadget gadget, boolean enable)
public void checkPlayer(Player player, Gadget gadget, boolean enable, boolean message)
{
boolean wasActive = isActive(player);
@ -60,20 +60,20 @@ public abstract class GadgetSet implements Listener
_active.add(player);
if(!wasActive)
{
customEnable(player);
customEnable(player, message);
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onActivate(GadgetEnableEvent event)
{
checkPlayer(event.getPlayer(), event.getGadget(), true);
checkPlayer(event.getPlayer(), event.getGadget(), true, event.canShowMessage());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onDeativate(GadgetDisableEvent event)
{
checkPlayer(event.getPlayer(), event.getGadget(), false);
checkPlayer(event.getPlayer(), event.getGadget(), false, true);
}
public boolean isActive(Player player)
@ -81,8 +81,9 @@ public abstract class GadgetSet implements Listener
return _active.contains(player);
}
public void customEnable(Player player)
public void customEnable(Player player, boolean message)
{
if (message)
player.sendMessage(F.main("Gadget", "Set Enabled: " + F.elem(C.cGreen + getName())));
}

View File

@ -5,19 +5,19 @@ package mineplex.core.gadget.types;
*/
public enum GadgetType
{
Item("Items", "activeItem"),
Morph("Morphs", "activeMorph"),
Particle("Particles", "activeParticle"),
MusicDisc("Music Discs", ""),
Costume("Costumes", ""),
DoubleJump("Double Jump Effects", "activeDoubleJump"),
ArrowTrail("Arrow Trails", "activeArrowTrail"),
Death("Death Effects", "activeDeathEffect"),
Hat("Hats", "activeHat"),
Taunt("Taunts", "activeTaunt"),
WinEffect("Win Effects", "activeWinEffect"),
GameModifier("Game Modifiers", ""),
Balloon("Balloons", "");
ITEM("Items", "activeItem"),
MORPH("Morphs", "activeMorph"),
PARTICLE("Particles", "activeParticle"),
MUSIC_DISC("Music Discs", ""),
COSTUME("Costumes", ""),
DOUBLE_JUMP("Double Jump Effects", "activeDoubleJump"),
ARROW_TRAIL("Arrow Trails", "activeArrowTrail"),
DEATH("Death Effects", "activeDeathEffect"),
HAT("Hats", "activeHat"),
TAUNT("Taunts", "activeTaunt"),
WIN_EFFECT("Win Effects", "activeWinEffect"),
GAME_MODIFIER("Game Modifiers", ""),
BALLOON("Balloons", "");
private String _name;
private String _databaseKey;

View File

@ -28,7 +28,7 @@ public abstract class GameModifierGadget extends Gadget
*/
public GameModifierGadget(GadgetManager manager, GameModifierType type, String name, String[] desc, int cost, Material mat, byte data, boolean allowMultiple)
{
super(manager, GadgetType.GameModifier, name, desc, cost, mat, data);
super(manager, GadgetType.GAME_MODIFIER, name, desc, cost, mat, data);
_type = type;
_allowMultiple = allowMultiple;
}
@ -44,10 +44,11 @@ public abstract class GameModifierGadget extends Gadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
_active.add(player);
if (message)
UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + "."));
}
}

View File

@ -45,14 +45,15 @@ public abstract class HatGadget extends OutfitGadget
return _hat.clone();
}
public void applyArmor(Player player)
public void applyArmor(Player player, boolean message)
{
Manager.removeGadgetType(player, GadgetType.Morph, this);
Manager.removeGadgetType(player, GadgetType.MORPH, this);
Manager.removeOutfit(player, _slot);
_active.add(player);
if (message)
UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + "."));
player.getInventory().setHelmet(getHelmetItem());
@ -84,14 +85,14 @@ public abstract class HatGadget extends OutfitGadget
@Override
public GadgetType getGadgetType()
{
return GadgetType.Hat;
return GadgetType.HAT;
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
applyArmor(player);
applyArmor(player, message);
}
@Override

View File

@ -34,7 +34,7 @@ public abstract class ItemGadget extends Gadget
public ItemGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data,
long recharge, Ammo ammo)
{
super(manager, GadgetType.Item, name, desc, cost, mat, data);
super(manager, GadgetType.ITEM, name, desc, cost, mat, data);
_ammo = ammo;
_recharge = recharge;
@ -50,9 +50,9 @@ public abstract class ItemGadget extends Gadget
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
ApplyItem(player, true);
ApplyItem(player, message);
}
@Override
@ -73,7 +73,7 @@ public abstract class ItemGadget extends Gadget
public void ApplyItem(Player player, boolean inform)
{
Manager.removeGadgetType(player, GadgetType.Item, this);
Manager.removeGadgetType(player, GadgetType.ITEM, this);
_active.add(player);

View File

@ -13,15 +13,16 @@ public abstract class MorphGadget extends Gadget
{
public MorphGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data)
{
super(manager, GadgetType.Morph, name, desc, cost, mat, data);
super(manager, GadgetType.MORPH, name, desc, cost, mat, data);
}
public void ApplyArmor(Player player)
public void ApplyArmor(Player player, boolean message)
{
Manager.removeGadgetType(player, GadgetType.Morph, this);
Manager.removeGadgetType(player, GadgetType.MORPH, this);
_active.add(player);
if (message)
UtilPlayer.message(player, F.main("Gadget", "You morphed into " + F.elem(getName()) + "."));
}

View File

@ -31,7 +31,7 @@ public class MusicGadget extends Gadget
public MusicGadget(GadgetManager manager, String name, String[] desc, int cost, int id, long duration)
{
super(manager, GadgetType.MusicDisc, name, desc, cost, Material.getMaterial(id), (byte)0);
super(manager, GadgetType.MUSIC_DISC, name, desc, cost, Material.getMaterial(id), (byte)0);
_id = id;
_duration = duration;

View File

@ -34,7 +34,7 @@ public abstract class OutfitGadget extends Gadget
public OutfitGadget(GadgetManager manager, String name, String[] desc, int cost, ArmorSlot slot, Material mat, byte data, String... altNames)
{
super(manager, GadgetType.Costume, name, desc, cost, mat, data, 1, altNames);
super(manager, GadgetType.COSTUME, name, desc, cost, mat, data, 1, altNames);
_slot = slot;
}
@ -44,14 +44,15 @@ public abstract class OutfitGadget extends Gadget
return _slot;
}
public void applyArmor(Player player)
public void applyArmor(Player player, boolean message)
{
Manager.removeGadgetType(player, GadgetType.Morph, this);
Manager.removeGadgetType(player, GadgetType.MORPH, this);
Manager.removeOutfit(player, _slot);
_active.add(player);
if (message)
UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(getName()) + "."));
if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(

View File

@ -27,15 +27,16 @@ public abstract class ParticleGadget extends Gadget
*/
public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, String...altNames)
{
super(manager, GadgetType.Particle, name, desc, cost, mat, data, 1, altNames);
super(manager, GadgetType.PARTICLE, name, desc, cost, mat, data, 1, altNames);
}
@Override
public void enableCustom(Player player)
public void enableCustom(Player player, boolean message)
{
Manager.removeGadgetType(player, GadgetType.Particle, this);
Manager.removeGadgetType(player, GadgetType.PARTICLE, this);
_active.add(player);
startEffect(player);
if (message)
UtilPlayer.message(player, F.main("Gadget", "You summoned " + F.elem(getName()) + "."));
}

View File

@ -1,6 +1,5 @@
package mineplex.core.gadget.types;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@ -15,9 +14,7 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@ -69,7 +66,7 @@ public abstract class WinEffectGadget extends Gadget
public WinEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data,
String... alternativesalepackageNames)
{
super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, alternativesalepackageNames);
super(manager, GadgetType.WIN_EFFECT, name, desc, cost, mat, data, 1, alternativesalepackageNames);
}
/**
@ -85,7 +82,7 @@ public abstract class WinEffectGadget extends Gadget
public WinEffectGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data,
boolean free, String... altName)
{
super(manager, GadgetType.WinEffect, name, desc, cost, mat, data, 1, free, altName);
super(manager, GadgetType.WIN_EFFECT, name, desc, cost, mat, data, 1, free, altName);
}
public void runPlay()
@ -152,6 +149,11 @@ public abstract class WinEffectGadget extends Gadget
_other = null;
_locked.clear();
_locked = null;
// Loads gadgets back when players are teleported to the arcade hub, after the win effect
for (Player player : UtilServer.getPlayers())
{
Manager.getUserGadgetPersistence().load(player);
}
}
/**
@ -260,8 +262,9 @@ public abstract class WinEffectGadget extends Gadget
UtilPlayer.hideFromAll(p);
p.setGameMode(GameMode.ADVENTURE);
p.getInventory().clear();
p.teleport(loc);
p.teleport(loc.clone().add(.5, 0, .5));
p.setAllowFlight(false);
Manager.disableAll(p, false);
}
}
};

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
public class IncognitoToggleCommand extends CommandBase<IncognitoManager>
{
public IncognitoToggleCommand(IncognitoManager plugin)
{
super(plugin, Rank.HELPER, "incognito", "vanish");

View File

@ -832,7 +832,7 @@ public class RewardManager
public UnknownPackageReward addMusicReward(Type type, String musicDisk, RewardRarity rarity, int weight, int shards)
{
for(Gadget gadget : _gadgetManager.getGadgets(GadgetType.MusicDisc))
for(Gadget gadget : _gadgetManager.getGadgets(GadgetType.MUSIC_DISC))
{
if(gadget.getName().equals(musicDisk) || gadget.getName().equals(musicDisk + " Disk"))
{

View File

@ -12,7 +12,6 @@ import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.mount.Mount;
import mineplex.core.reward.RewardPool;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -235,7 +234,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
int amount = 0;
Gadget[] gadgets = new Gadget[]
{
_gadgetManager.getGadget("Uncle Sam Hat", GadgetType.Hat),
_gadgetManager.getGadget("Uncle Sam Hat", GadgetType.HAT),
_gadgetManager.getGadget(ParticleFreedom.class),
_gadgetManager.getGadget(ArrowTrailFreedom.class),
_gadgetManager.getGadget(DoubleJumpFreedom.class),

View File

@ -10,7 +10,6 @@ import java.util.Iterator;
import java.util.Random;
import mineplex.core.boosters.BoosterManager;
import mineplex.core.brawl.fountain.FountainManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
@ -1071,7 +1070,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
@EventHandler
public void disableMusicChristmas(GadgetEnableEvent event)
{
if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MusicDisc)
if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MUSIC_DISC)
{
UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now!"));
event.setCancelled(true);

View File

@ -213,7 +213,7 @@ public class DisguiseCommand extends CommandBase<HubManager> implements Listener
changeName(caller, args[0], true);
Plugin.GetGadget().removeGadgetType(caller, GadgetType.Item);
Plugin.GetGadget().removeGadgetType(caller, GadgetType.ITEM);
// Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller));
UtilPlayer.message(caller, F.main("Disguise", "Disguise Active: " + ChatColor.RESET + args[0]));
@ -399,7 +399,7 @@ public class DisguiseCommand extends CommandBase<HubManager> implements Listener
@EventHandler
public void gadget(GadgetEnableEvent event)
{
if(!event.getGadget().getName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph)
if(!event.getGadget().getName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.MORPH)
return;
if(_disguisedPlayers.containsKey(event.getPlayer()))

View File

@ -68,7 +68,7 @@ public class KothManager extends MiniPlugin
_cp = new CapturePoint(this, "Desert Pyramid", new Location(Manager.GetSpawn().getWorld(), -95.5,72,54.5));
//Store Gadgets
for (Gadget gadget : gadgets.getGadgets(GadgetType.Costume))
for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME))
{
if (gadget instanceof OutfitTeam)
{
@ -76,7 +76,7 @@ public class KothManager extends MiniPlugin
}
}
for (Gadget gadget : gadgets.getGadgets(GadgetType.Item))
for (Gadget gadget : gadgets.getGadgets(GadgetType.ITEM))
{
if (gadget instanceof ItemDuelingSword)
{

View File

@ -30,7 +30,6 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wither;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
@ -450,7 +449,7 @@ public class NewsManager extends MiniPlugin
}
}
for (Gadget gadget : Manager.GetGadget().getGadgets(GadgetType.Morph))
for (Gadget gadget : Manager.GetGadget().getGadgets(GadgetType.MORPH))
{
if (gadget instanceof MorphWither)
{

View File

@ -111,7 +111,7 @@ public class SoccerManager extends MiniPlugin
_cornerBlueGoalB = new Location(Manager.GetSpawn().getWorld(), 42.25,73.5,-28.75);
//Store Gadgets
for (Gadget gadget : gadgets.getGadgets(GadgetType.Costume))
for (Gadget gadget : gadgets.getGadgets(GadgetType.COSTUME))
{
if (gadget instanceof OutfitTeam)
{

View File

@ -112,7 +112,7 @@ public class StackerManager extends MiniPlugin implements IThrown
return;
}
if (Manager.GetGadget().getActive(stacker, GadgetType.Morph) instanceof MorphBlock)
if (Manager.GetGadget().getActive(stacker, GadgetType.MORPH) instanceof MorphBlock)
{
UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack while using the Block Morph."));
return;

View File

@ -1,14 +1,11 @@
package mineplex.minecraft.game.classcombat.Class;
import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilServer;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.Skill.ISkill;
@ -198,7 +195,7 @@ public class PvpClass implements IPvpClass
continue;
}
if (_classes.getGadgetManager() != null && _classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null)
if (_classes.getGadgetManager() != null && _classes.getGadgetManager().getActive(cur, GadgetType.COSTUME) != null)
continue;
Equip(cur, _classes.getMessageSuppressedCallback(cur.getName()) == null);

View File

@ -197,7 +197,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
}
}
if (transaction.SalesPackageName.startsWith("Freedom Chest"))
if (transaction.SalesPackageName.startsWith("Freedom Treasure"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{

View File

@ -8,12 +8,12 @@ public class FreedomChest extends SalesPackageBase
public FreedomChest(SalesPackageManager manager)
{
super(manager, "1 Freedom Chest");
super(manager, "1 Freedom Treasure");
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales item " + playerName + " 1 Item Freedom Chest", "Give 1 Freedom Chest.");
addButton(agent, "/sales item " + playerName + " 1 Item Freedom Treasure", "Give 1 Freedom Chest.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}

View File

@ -1003,7 +1003,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
GetDisguise().undisguise(player);
Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph);
Gadget morph = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.MORPH);
if (morph != null && morph.isActive(player))
morph.disable(player);
}

View File

@ -216,7 +216,7 @@ public class DisguiseCommand extends CommandBase<ArcadeManager> implements Liste
changeName(caller, args[0], true);
Plugin.getCosmeticManager().getGadgetManager().removeGadgetType(caller, GadgetType.Item);
Plugin.getCosmeticManager().getGadgetManager().removeGadgetType(caller, GadgetType.ITEM);
// Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller));
UtilPlayer.message(caller, F.main("Disguise", "Disguise Active: " + ChatColor.RESET + args[0]));
@ -425,7 +425,7 @@ public class DisguiseCommand extends CommandBase<ArcadeManager> implements Liste
@EventHandler
public void gadget(GadgetEnableEvent event)
{
if(!event.getGadget().getName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.Morph)
if(!event.getGadget().getName().equalsIgnoreCase("Coin Party Bomb") && event.getGadget().getGadgetType() != GadgetType.MORPH)
return;
if(_disguisedPlayers.containsKey(event.getPlayer()))

View File

@ -1931,7 +1931,7 @@ public class EventModule extends MiniPlugin
if (!Manager.GetGame().IsAlive(event.getPlayer()))
return;
if (Manager.getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph) instanceof MorphBlock)
if (Manager.getCosmeticManager().getGadgetManager().getActive(player, GadgetType.MORPH) instanceof MorphBlock)
{
UtilPlayer.message(player, F.main("Stacker", "You cannot stack while using the Block Morph."));
return;

View File

@ -175,7 +175,7 @@ public class GameManager implements Listener
}
}
for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(GadgetType.Morph))
for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(GadgetType.MORPH))
{
if (gadget instanceof MorphWither)
{

View File

@ -37,7 +37,7 @@ public class WinEffectManager
_game.CreatureAllowOverride = true;
for(Player p : UtilServer.getPlayers())
{
Gadget g = _game.getArcadeManager().getCosmeticManager().getGadgetManager().getActive(p, GadgetType.Item);
Gadget g = _game.getArcadeManager().getCosmeticManager().getGadgetManager().getActive(p, GadgetType.ITEM);
if(g != null) g.disable(p);
}
playEffect();
@ -74,7 +74,7 @@ public class WinEffectManager
public WinEffectGadget getWinEffect()
{
GadgetManager manager = _game.getArcadeManager().getCosmeticManager().getGadgetManager();
Gadget gadget = manager.getActive(_winner, GadgetType.WinEffect);
Gadget gadget = manager.getActive(_winner, GadgetType.WIN_EFFECT);
if(gadget == null) gadget = manager.getGadget(WinEffectPodium.class);
return (WinEffectGadget) gadget;
}