More fixes for gadget persistence
This commit is contained in:
parent
30f413d04e
commit
24186d9992
@ -35,7 +35,7 @@ public abstract class MiniClientPlugin<DataType extends Object> extends MiniPlug
|
||||
synchronized (_clientDataLock)
|
||||
{
|
||||
if (!_clientData.containsKey(name))
|
||||
_clientData.put(name, AddPlayer(name));
|
||||
_clientData.put(name, addPlayer(name));
|
||||
|
||||
return _clientData.get(name);
|
||||
}
|
||||
@ -66,5 +66,5 @@ public abstract class MiniClientPlugin<DataType extends Object> extends MiniPlug
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract DataType AddPlayer(String player);
|
||||
protected abstract DataType addPlayer(String player);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class BenefitManager extends MiniDbClientPlugin<BenefitData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BenefitData AddPlayer(String player)
|
||||
protected BenefitData addPlayer(String player)
|
||||
{
|
||||
return new BenefitData();
|
||||
}
|
||||
|
@ -989,7 +989,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BonusClientData AddPlayer(String player)
|
||||
protected BonusClientData addPlayer(String player)
|
||||
{
|
||||
return new BonusClientData();
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class BoosterTipManager extends MiniDbClientPlugin<PlayerTipData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerTipData AddPlayer(String player)
|
||||
protected PlayerTipData addPlayer(String player)
|
||||
{
|
||||
return new PlayerTipData();
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class CosmeticManager extends MiniPlugin
|
||||
{
|
||||
_gadgetManager.disableAll();
|
||||
_mountManager.DisableAll();
|
||||
_petManager.DisableAll();
|
||||
_petManager.disableAll();
|
||||
}
|
||||
|
||||
public void setHideParticles(boolean b)
|
||||
|
@ -8,7 +8,7 @@ public class PetSorter implements Comparator<Pet>
|
||||
{
|
||||
public int compare(Pet a, Pet b)
|
||||
{
|
||||
if (a.GetPetType().getTypeId() < b.GetPetType().getTypeId())
|
||||
if (a.getPetType().getTypeId() < b.getPetType().getTypeId())
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
|
@ -23,7 +23,7 @@ public class ActivatePetButton implements IButton
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_page.playAcceptSound(player);
|
||||
_page.getPlugin().getPetManager().AddPetOwner(player, _pet.GetPetType(), player.getLocation());
|
||||
_page.getPlugin().getPetManager().addPetOwner(player, _pet.getPetType(), player.getLocation());
|
||||
_page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class DeactivatePetButton implements IButton
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_page.playAcceptSound(player);
|
||||
_petManager.RemovePet(player, true);
|
||||
_petManager.removePet(player, true);
|
||||
_page.refresh();
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class OpenPets implements IButton
|
||||
else
|
||||
{
|
||||
_menu.playAcceptSound(player);
|
||||
_menu.getPlugin().getPetManager().RemovePet(player, true);
|
||||
_menu.getPlugin().getPetManager().removePet(player, true);
|
||||
_menu.refresh();
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.banner.CountryFlag;
|
||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@ -393,6 +395,9 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
playAcceptSound(player);
|
||||
gadget.enable(player);
|
||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget,
|
||||
GadgetChangeEvent.GadgetState.ENABLED);
|
||||
UtilServer.getPluginManager().callEvent(gadgetChangeEvent);
|
||||
|
||||
refresh();
|
||||
}
|
||||
@ -409,6 +414,9 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
playAcceptSound(player);
|
||||
gadget.disable(player);
|
||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget,
|
||||
GadgetChangeEvent.GadgetState.DISABLED);
|
||||
UtilServer.getPluginManager().callEvent(gadgetChangeEvent);
|
||||
refresh();
|
||||
}
|
||||
}
|
@ -100,7 +100,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
Mount<?> mountActive = getPlugin().getMountManager().getActive(getPlayer());
|
||||
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
|
||||
{
|
||||
if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.getName()) || mount.hasMount(getPlayer()))
|
||||
if (mount.hasMount(getPlayer()))
|
||||
{
|
||||
mountOwned++;
|
||||
}
|
||||
@ -110,17 +110,17 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
int petOwned = 0;
|
||||
int petMax = 0;
|
||||
for (Pet pet : getPlugin().getPetManager().GetFactory().GetPets())
|
||||
for (Pet pet : getPlugin().getPetManager().getFactory().GetPets())
|
||||
{
|
||||
NautHashMap<EntityType, String> pets = getPlugin().getPetManager().Get(getPlayer()).GetPets();
|
||||
if (pets != null && pets.containsKey(pet.GetPetType()))
|
||||
NautHashMap<EntityType, String> pets = getPlugin().getPetManager().Get(getPlayer()).getPets();
|
||||
if (pets != null && pets.containsKey(pet.getPetType()))
|
||||
{
|
||||
petOwned++;
|
||||
}
|
||||
|
||||
petMax++;
|
||||
}
|
||||
Creature petActive = getPlugin().getPetManager().GetPet(getPlayer());
|
||||
Creature petActive = getPlugin().getPetManager().getPet(getPlayer());
|
||||
|
||||
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));
|
||||
|
@ -49,7 +49,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
int slot = 19;
|
||||
|
||||
List<Pet> pets = new ArrayList<Pet>(getPlugin().getPetManager().GetFactory().GetPets());
|
||||
List<Pet> pets = new ArrayList<Pet>(getPlugin().getPetManager().getFactory().GetPets());
|
||||
|
||||
Collections.sort(pets, new PetSorter());
|
||||
|
||||
@ -61,7 +61,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
itemLore.add(C.cGray + "Your very own " + pet.getName() + "!");
|
||||
|
||||
//Chest Unlocks
|
||||
if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
|
||||
if (!getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType()))
|
||||
{
|
||||
if (pet.getCost(CurrencyType.TREASURE_SHARD) == -1)
|
||||
{
|
||||
@ -113,21 +113,21 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
}
|
||||
|
||||
//Owned
|
||||
if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType()))
|
||||
if (getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType()))
|
||||
{
|
||||
String petName = getPlugin().getPetManager().Get(getPlayer()).GetPets().get(pet.GetPetType());
|
||||
String petName = getPlugin().getPetManager().Get(getPlayer()).getPets().get(pet.getPetType());
|
||||
if (petName == null)
|
||||
{
|
||||
petName = pet.getName();
|
||||
}
|
||||
|
||||
if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.GetPetType())
|
||||
if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.getPetType())
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Disable");
|
||||
|
||||
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(),
|
||||
pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
|
||||
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getPetType().getTypeId(),
|
||||
pet.getPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
|
||||
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager()));
|
||||
|
||||
addGlow(slot);
|
||||
@ -137,8 +137,8 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Enable");
|
||||
|
||||
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(),
|
||||
pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
|
||||
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getPetType().getTypeId(),
|
||||
pet.getPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
|
||||
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this));
|
||||
}
|
||||
}
|
||||
@ -156,18 +156,18 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cGreen + "Click to Purchase");
|
||||
|
||||
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this));
|
||||
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this));
|
||||
}
|
||||
else if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0)
|
||||
{
|
||||
itemLore.add(C.cBlack);
|
||||
itemLore.add(C.cRed + "Not enough Treasure Shards.");
|
||||
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
}
|
||||
|
||||
slot = 49;
|
||||
for (PetExtra petExtra : getPlugin().getPetManager().GetFactory().GetPetExtras())
|
||||
for (PetExtra petExtra : getPlugin().getPetManager().getFactory().GetPetExtras())
|
||||
{
|
||||
List<String> itemLore = new ArrayList<String>();
|
||||
|
||||
@ -233,7 +233,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
public void deactivatePet(Player player)
|
||||
{
|
||||
playAcceptSound(player);
|
||||
getPlugin().getPetManager().RemovePet(player, true);
|
||||
getPlugin().getPetManager().removePet(player, true);
|
||||
refresh();
|
||||
}
|
||||
}
|
@ -108,8 +108,8 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId();
|
||||
|
||||
token.Name = getPlayer().getName();
|
||||
token.PetType = _pet.GetPetType().toString();
|
||||
token.PetId = _pet.GetPetType().ordinal();
|
||||
token.PetType = _pet.getPetType().toString();
|
||||
token.PetId = _pet.getPetType().ordinal();
|
||||
token.PetName = _tagName;
|
||||
|
||||
PetToken petToken = new PetToken();
|
||||
@ -117,16 +117,16 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
if (_petPurchase)
|
||||
{
|
||||
getPlugin().getPetManager().GetRepository().AddPet(token);
|
||||
getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.GetPetType());
|
||||
getPlugin().getPetManager().getRepository().AddPet(token);
|
||||
getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.getPetType());
|
||||
}
|
||||
else
|
||||
{
|
||||
getPlugin().getPetManager().GetRepository().UpdatePet(token);
|
||||
getPlugin().getPetManager().getRepository().UpdatePet(token);
|
||||
getPlugin().getPetManager().addRenamePetToQueue(getPlayer().getName(), token.PetName);
|
||||
}
|
||||
|
||||
getPlugin().getPetManager().Get(getPlayer()).GetPets().put(_pet.GetPetType(), token.PetName);
|
||||
getPlugin().getPetManager().Get(getPlayer()).getPets().put(_pet.getPetType(), token.PetName);
|
||||
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer()));
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class CustomDataManager extends MiniDbClientPlugin<PlayerCustomData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerCustomData AddPlayer(String player)
|
||||
protected PlayerCustomData addPlayer(String player)
|
||||
{
|
||||
return new PlayerCustomData(_repository);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class DelayedTask extends MiniClientPlugin<DelayedTaskClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DelayedTaskClient AddPlayer(String player)
|
||||
protected DelayedTaskClient addPlayer(String player)
|
||||
{
|
||||
return new DelayedTaskClient(Bukkit.getPlayer(player));
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Donor AddPlayer(String player)
|
||||
protected Donor addPlayer(String player)
|
||||
{
|
||||
return new Donor();
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EloClientData AddPlayer(String player)
|
||||
protected EloClientData addPlayer(String player)
|
||||
{
|
||||
return new EloClientData();
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class Energy extends MiniClientPlugin<ClientEnergy>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientEnergy AddPlayer(String player)
|
||||
protected ClientEnergy addPlayer(String player)
|
||||
{
|
||||
return new ClientEnergy();
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class FacebookManager extends MiniDbClientPlugin<FacebookClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FacebookClient AddPlayer(String player)
|
||||
protected FacebookClient addPlayer(String player)
|
||||
{
|
||||
return new FacebookClient(false);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class FriendManager extends MiniDbClientPlugin<FriendData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FriendData AddPlayer(String player)
|
||||
protected FriendData addPlayer(String player)
|
||||
{
|
||||
return new FriendData();
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import mineplex.core.gadget.commands.LockCosmeticsCommand;
|
||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
|
||||
import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom;
|
||||
@ -776,7 +777,9 @@ public class GadgetManager extends MiniPlugin
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
saveGadgets(event.getPlayer());
|
||||
//saveGadgets(event.getPlayer());
|
||||
event.getPlayer().setWalkSpeed(0.2f);
|
||||
event.getPlayer().setFlySpeed(0.1f);
|
||||
disableAll(event.getPlayer(), false);
|
||||
_lastMove.remove(event.getPlayer());
|
||||
_playerActiveGadgetMap.remove(event.getPlayer());
|
||||
@ -914,91 +917,144 @@ public class GadgetManager extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
private void saveGadgets(Player player)
|
||||
@EventHandler
|
||||
private void saveGadget(GadgetChangeEvent event)
|
||||
{
|
||||
if (player.getGameMode() == GameMode.SPECTATOR)
|
||||
return;
|
||||
Map<String, String> cache = new HashMap<>();
|
||||
for (Gadget gadget : getAllGadgets())
|
||||
Gadget gadget = event.getGadget();
|
||||
if (gadget != null)
|
||||
{
|
||||
String value = "disabled", key = "";
|
||||
GadgetType gadgetType = gadget.getGadgetType();
|
||||
if (gadget.ownsGadget(player))
|
||||
{
|
||||
switch (gadgetType)
|
||||
{
|
||||
case MUSIC_DISC:
|
||||
case ITEM:
|
||||
case MORPH:
|
||||
case BALLOON:
|
||||
break;
|
||||
case COSTUME:
|
||||
OutfitGadget outfitGadget = (OutfitGadget) gadget;
|
||||
String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
|
||||
if (cache.containsKey(key))
|
||||
continue;
|
||||
if (outfitGadget.isActive(player))
|
||||
cache.put(key, outfitGadget.getName());
|
||||
break;
|
||||
case GAME_MODIFIER:
|
||||
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
|
||||
if (gameModifierGadget.canAllowMultiple())
|
||||
{
|
||||
if (cache.containsKey(gadget.getName()))
|
||||
continue;
|
||||
cache.put(gadget.getName(), (gadget.isActive(player)) ? "enabled" : "disabled");
|
||||
} else
|
||||
{
|
||||
String dataKey = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", "");
|
||||
if (cache.containsKey(dataKey))
|
||||
continue;
|
||||
if (gadget.isActive(player))
|
||||
cache.put(dataKey, gadget.getName());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (cache.containsKey(gadgetType.getDatabaseKey()))
|
||||
continue;
|
||||
if (gadget.isActive(player))
|
||||
cache.put(gadgetType.getDatabaseKey(), gadget.getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
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()))
|
||||
switch (gadgetType)
|
||||
{
|
||||
String key = gadgetType.getDatabaseKey();
|
||||
if (gadgetType.equals(GadgetType.COSTUME))
|
||||
{
|
||||
for (ArmorSlot armorSlot : ArmorSlot.values())
|
||||
case MUSIC_DISC:
|
||||
case ITEM:
|
||||
case MORPH:
|
||||
case BALLOON:
|
||||
return;
|
||||
case COSTUME:
|
||||
OutfitGadget outfitGadget = (OutfitGadget) gadget;
|
||||
key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
|
||||
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
|
||||
{
|
||||
key = "activeCostume" + armorSlot.getDatabaseKey();
|
||||
if (!cache.containsKey(key))
|
||||
value = outfitGadget.getName();
|
||||
}
|
||||
break;
|
||||
case GAME_MODIFIER:
|
||||
GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
|
||||
if (gameModifierGadget.canAllowMultiple())
|
||||
{
|
||||
key = gameModifierGadget.getName();
|
||||
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
|
||||
{
|
||||
cache.put(key, "disabled");
|
||||
value = "enabled";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cache.put(key, "disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
key = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", "");
|
||||
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
|
||||
{
|
||||
value = gameModifierGadget.getName();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
key = gadgetType.getDatabaseKey();
|
||||
if (event.getGadgetState() == GadgetChangeEvent.GadgetState.ENABLED)
|
||||
{
|
||||
value = gadget.getName();
|
||||
}
|
||||
}
|
||||
_userGadgetPersistence.save(event.getPlayer(), key, value);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
// private void saveGadgets(Player player)
|
||||
// {
|
||||
// if (player.getGameMode() == GameMode.SPECTATOR)
|
||||
// return;
|
||||
// Map<String, String> cache = new HashMap<>();
|
||||
// for (Gadget gadget : getAllGadgets())
|
||||
// {
|
||||
// GadgetType gadgetType = gadget.getGadgetType();
|
||||
// if (gadget.ownsGadget(player))
|
||||
// {
|
||||
// switch (gadgetType)
|
||||
// {
|
||||
// case MUSIC_DISC:
|
||||
// case ITEM:
|
||||
// case MORPH:
|
||||
// case BALLOON:
|
||||
// break;
|
||||
// case COSTUME:
|
||||
// OutfitGadget outfitGadget = (OutfitGadget) gadget;
|
||||
// String key = "activeCostume" + outfitGadget.getSlot().getDatabaseKey();
|
||||
// if (cache.containsKey(key))
|
||||
// continue;
|
||||
// if (outfitGadget.isActive(player))
|
||||
// cache.put(key, outfitGadget.getName());
|
||||
// break;
|
||||
// case GAME_MODIFIER:
|
||||
// GameModifierGadget gameModifierGadget = (GameModifierGadget) gadget;
|
||||
// if (gameModifierGadget.canAllowMultiple())
|
||||
// {
|
||||
// if (cache.containsKey(gadget.getName()))
|
||||
// continue;
|
||||
// cache.put(gadget.getName(), (gadget.isActive(player)) ? "enabled" : "disabled");
|
||||
// } else
|
||||
// {
|
||||
// String dataKey = "activeModifier" + gameModifierGadget.getGameType().getName().replace(" ", "");
|
||||
// if (cache.containsKey(dataKey))
|
||||
// continue;
|
||||
// if (gadget.isActive(player))
|
||||
// cache.put(dataKey, gadget.getName());
|
||||
// }
|
||||
// break;
|
||||
// default:
|
||||
// if (cache.containsKey(gadgetType.getDatabaseKey()))
|
||||
// continue;
|
||||
// if (gadget.isActive(player))
|
||||
// cache.put(gadgetType.getDatabaseKey(), gadget.getName());
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 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()))
|
||||
// {
|
||||
// String key = gadgetType.getDatabaseKey();
|
||||
// if (gadgetType.equals(GadgetType.COSTUME))
|
||||
// {
|
||||
// for (ArmorSlot armorSlot : ArmorSlot.values())
|
||||
// {
|
||||
// key = "activeCostume" + armorSlot.getDatabaseKey();
|
||||
// if (!cache.containsKey(key))
|
||||
// {
|
||||
// cache.put(key, "disabled");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// cache.put(key, "disabled");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return cache;
|
||||
// }
|
||||
|
||||
public boolean isKitModifierActive(KitModifier kitModifier, Player player)
|
||||
{
|
||||
for (Gadget gadget : getGadgets(GadgetType.GAME_MODIFIER))
|
||||
|
@ -2,12 +2,17 @@ package mineplex.core.gadget.commands;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.inventory.ClientItem;
|
||||
import mineplex.core.inventory.data.Item;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.pet.Pet;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -28,7 +33,7 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
// Removes all cosmetic types
|
||||
if (args.length == 0)
|
||||
{
|
||||
addCosmetics(null, caller);
|
||||
lockCosmetics(null, caller);
|
||||
}
|
||||
// Removes specific type
|
||||
else
|
||||
@ -36,8 +41,16 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
String type = args[0];
|
||||
if (type.equalsIgnoreCase("all"))
|
||||
{
|
||||
addCosmetics(null, caller);
|
||||
lockCosmetics(null, caller);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("pet"))
|
||||
{
|
||||
lockPets(caller);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("mount"))
|
||||
{
|
||||
lockMounts(caller);
|
||||
}
|
||||
else
|
||||
{
|
||||
GadgetType gadgetType = GadgetType.valueOf(type);
|
||||
@ -47,27 +60,74 @@ public class LockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
addCosmetics(gadgetType, caller);
|
||||
lockCosmetics(gadgetType, caller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addCosmetics(GadgetType gadgetType, Player caller)
|
||||
private void lockCosmetics(GadgetType gadgetType, Player caller)
|
||||
{
|
||||
if (gadgetType == null)
|
||||
{
|
||||
for (GadgetType type : GadgetType.values())
|
||||
{
|
||||
addCosmetics(type, caller);
|
||||
lockCosmetics(type, caller);
|
||||
}
|
||||
lockMounts(caller);
|
||||
lockPets(caller);
|
||||
return;
|
||||
}
|
||||
int removed = 0;
|
||||
for (Gadget gadget : _plugin.getGadgets(gadgetType))
|
||||
{
|
||||
_plugin.getDonationManager().Get(caller.getName()).RemoveUnknownSalesPackagesOwned(gadget.getName());
|
||||
if (gadget.getGadgetType() == GadgetType.ITEM)
|
||||
continue;
|
||||
if (gadget.ownsGadget(caller))
|
||||
{
|
||||
Item clientItem = _plugin.getInventoryManager().getItem(gadget.getName());
|
||||
if (clientItem == null)
|
||||
continue;
|
||||
_plugin.getInventoryManager().Get(caller.getName()).removeItem(new ClientItem(clientItem, 1));
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name() + " cosmetics!"));
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name().toLowerCase()
|
||||
.replace("_", " ") + "! (Removed " + C.cRed + removed + C.cGray + " " +
|
||||
UtilText.plural("item", removed) + ")"));
|
||||
}
|
||||
|
||||
private void lockMounts(Player caller)
|
||||
{
|
||||
int removed = 0;
|
||||
for (Mount<?> mount : _plugin.getMountManager().getMounts())
|
||||
{
|
||||
if (mount.hasMount(caller))
|
||||
{
|
||||
Item clientItem = _plugin.getInventoryManager().getItem(mount.getName());
|
||||
if (clientItem == null)
|
||||
continue;
|
||||
_plugin.getInventoryManager().Get(caller.getName()).removeItem(new ClientItem(clientItem, 1));
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " +
|
||||
UtilText.plural("mount", removed) + "!"));
|
||||
}
|
||||
|
||||
private void lockPets(Player caller)
|
||||
{
|
||||
int removed = 0;
|
||||
for (Pet pet : _plugin.getPetManager().getFactory().GetPets())
|
||||
{
|
||||
if (_plugin.getPetManager().Get(caller).getPets().containsKey(pet.getPetType()))
|
||||
{
|
||||
_plugin.getPetManager().Get(caller).getPets().remove(pet.getPetType());
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Removed " + C.cRed + removed + C.cGray + " " +
|
||||
UtilText.plural("pet", removed) + "!"));
|
||||
}
|
||||
}
|
@ -2,15 +2,15 @@ package mineplex.core.gadget.commands;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.pet.Pet;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
@ -40,6 +40,14 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
{
|
||||
addCosmetics(null, caller);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("pet"))
|
||||
{
|
||||
addPets(caller);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("mount"))
|
||||
{
|
||||
addMounts(caller);
|
||||
}
|
||||
else
|
||||
{
|
||||
GadgetType gadgetType = GadgetType.valueOf(type);
|
||||
@ -64,12 +72,54 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
{
|
||||
addCosmetics(type, caller);
|
||||
}
|
||||
addMounts(caller);
|
||||
addPets(caller);
|
||||
return;
|
||||
}
|
||||
int added = 0;
|
||||
int amount = 1;
|
||||
for (Gadget gadget : _plugin.getGadgets(gadgetType))
|
||||
{
|
||||
_plugin.getDonationManager().Get(caller.getName()).AddUnknownSalesPackagesOwned(gadget.getName());
|
||||
if (gadgetType == GadgetType.ITEM)
|
||||
amount = 20;
|
||||
if (!gadget.ownsGadget(caller))
|
||||
{
|
||||
_plugin.getInventoryManager().addItemToInventory(caller, gadget.getName(), amount);
|
||||
added++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name() + " cosmetics!"));
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name().toLowerCase()
|
||||
.replace("_", " ") + "! (Added " + C.cRed + added + C.cGray + " " +
|
||||
UtilText.plural("item", added) + ")"));
|
||||
}
|
||||
|
||||
private void addMounts(Player caller)
|
||||
{
|
||||
int added = 0;
|
||||
for (Mount<?> mount : _plugin.getMountManager().getMounts())
|
||||
{
|
||||
if (!mount.hasMount(caller))
|
||||
{
|
||||
_plugin.getInventoryManager().addItemToInventory(caller, mount.getName(), 1);
|
||||
added++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Added " + C.cRed + added + C.cGray + " " +
|
||||
UtilText.plural("mount", added) + "!"));
|
||||
}
|
||||
|
||||
private void addPets(Player caller)
|
||||
{
|
||||
int added = 0;
|
||||
for (Pet pet : _plugin.getPetManager().getFactory().GetPets())
|
||||
{
|
||||
if (!_plugin.getPetManager().Get(caller).getPets().containsKey(pet.getPetType()))
|
||||
{
|
||||
_plugin.getPetManager().Get(caller).getPets().put(pet.getPetType(), pet.getName());
|
||||
added++;
|
||||
}
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Added " + C.cRed + added + C.cGray + " " +
|
||||
UtilText.plural("pet", added) + "!"));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package mineplex.core.gadget.event;
|
||||
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class GadgetChangeEvent extends Event
|
||||
{
|
||||
|
||||
public enum GadgetState
|
||||
{
|
||||
ENABLED,
|
||||
DISABLED
|
||||
}
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private final Player _player;
|
||||
private final Gadget _gadget;
|
||||
private final GadgetState _gadgetState;
|
||||
|
||||
public GadgetChangeEvent(Player player, Gadget gadget, GadgetState gadgetState)
|
||||
{
|
||||
_player = player;
|
||||
_gadget = gadget;
|
||||
_gadgetState = gadgetState;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public Gadget getGadget()
|
||||
{
|
||||
return _gadget;
|
||||
}
|
||||
|
||||
public GadgetState getGadgetState()
|
||||
{
|
||||
return _gadgetState;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -117,7 +117,7 @@ public class ItemCoal extends ItemGadget
|
||||
}
|
||||
|
||||
//Coal Apparition
|
||||
if (!Manager.getPetManager().Get(player).GetPets().containsKey(EntityType.PIG_ZOMBIE))
|
||||
if (!Manager.getPetManager().Get(player).getPets().containsKey(EntityType.PIG_ZOMBIE))
|
||||
{
|
||||
goal = _pet;
|
||||
|
||||
|
@ -262,7 +262,6 @@ public abstract class WinEffectGadget extends Gadget
|
||||
UtilPlayer.hideFromAll(p);
|
||||
p.setGameMode(GameMode.ADVENTURE);
|
||||
p.getInventory().clear();
|
||||
p.teleport(loc.clone().add(.5, 0, .5));
|
||||
p.setAllowFlight(false);
|
||||
Manager.disableAll(p, false);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class GiveawayManager extends MiniDbClientPlugin<PlayerGiveawayData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerGiveawayData AddPlayer(String player)
|
||||
protected PlayerGiveawayData addPlayer(String player)
|
||||
{
|
||||
return new PlayerGiveawayData();
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class IgnoreManager extends MiniDbClientPlugin<IgnoreData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IgnoreData AddPlayer(String player)
|
||||
protected IgnoreData addPlayer(String player)
|
||||
{
|
||||
return new IgnoreData();
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
|
||||
UtilPlayer.message(player, " ");
|
||||
}
|
||||
|
||||
protected IncognitoClient AddPlayer(String player)
|
||||
protected IncognitoClient addPlayer(String player)
|
||||
{
|
||||
return new IncognitoClient();
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientInventory AddPlayer(String player)
|
||||
protected ClientInventory addPlayer(String player)
|
||||
{
|
||||
return new ClientInventory();
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientMessage AddPlayer(String player)
|
||||
protected ClientMessage addPlayer(String player)
|
||||
{
|
||||
Set(player, new ClientMessage());
|
||||
return Get(player);
|
||||
|
@ -40,7 +40,7 @@ public class Movement extends MiniClientPlugin<ClientMovement>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientMovement AddPlayer(String player)
|
||||
protected ClientMovement addPlayer(String player)
|
||||
{
|
||||
return new ClientMovement();
|
||||
}
|
||||
|
@ -24,17 +24,17 @@ public class Pet extends SalesPackageBase
|
||||
KnownPackage = false;
|
||||
}
|
||||
|
||||
public EntityType GetPetType()
|
||||
public EntityType getPetType()
|
||||
{
|
||||
return _petType;
|
||||
}
|
||||
|
||||
public void Update(PetSalesToken petToken)
|
||||
public void update(PetSalesToken petToken)
|
||||
{
|
||||
_name = petToken.Name;
|
||||
}
|
||||
|
||||
public String GetPetName()
|
||||
public String getPetName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class PetClient
|
||||
private NautHashMap<EntityType, String> _pets;
|
||||
private int _petNameTagCount;
|
||||
|
||||
public void Load(ClientPetToken token)
|
||||
public void load(ClientPetToken token)
|
||||
{
|
||||
_pets = new NautHashMap<EntityType, String>();
|
||||
|
||||
@ -26,7 +26,7 @@ public class PetClient
|
||||
_petNameTagCount = Math.max(0, token.PetNameTagCount);
|
||||
}
|
||||
|
||||
public NautHashMap<EntityType, String> GetPets()
|
||||
public NautHashMap<EntityType, String> getPets()
|
||||
{
|
||||
return _pets;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
if (player != null && player.isOnline())
|
||||
{
|
||||
AddPetOwner(player, _petOwnerQueue.get(playerName), player.getLocation());
|
||||
addPetOwner(player, _petOwnerQueue.get(playerName), player.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,24 +160,24 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
if (rank.has(Rank.LEGEND))
|
||||
{
|
||||
if (!Get(p).GetPets().containsKey(EntityType.WITHER))
|
||||
Get(p).GetPets().put(EntityType.WITHER, "Widder");
|
||||
if (!Get(p).getPets().containsKey(EntityType.WITHER))
|
||||
Get(p).getPets().put(EntityType.WITHER, "Widder");
|
||||
}
|
||||
|
||||
if (rank.has(Rank.TITAN))
|
||||
{
|
||||
if (!Get(p).GetPets().containsKey(EntityType.SKELETON))
|
||||
Get(p).GetPets().put(EntityType.SKELETON, "Guardian");
|
||||
if (!Get(p).getPets().containsKey(EntityType.SKELETON))
|
||||
Get(p).getPets().put(EntityType.SKELETON, "Guardian");
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPetOwner(Player player, EntityType entityType, Location location)
|
||||
public void addPetOwner(Player player, EntityType entityType, Location location)
|
||||
{
|
||||
if (_activePetOwners.containsKey(player.getName()))
|
||||
{
|
||||
if (_activePetOwners.get(player.getName()).getType() != entityType)
|
||||
{
|
||||
RemovePet(player, true);
|
||||
removePet(player, true);
|
||||
}
|
||||
else
|
||||
return;
|
||||
@ -214,10 +214,10 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
}
|
||||
|
||||
//Named Pet
|
||||
if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0)
|
||||
if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0)
|
||||
{
|
||||
//pet.setCustomNameVisible(true);
|
||||
pet.setCustomName(Get(player).GetPets().get(entityType));
|
||||
pet.setCustomName(Get(player).getPets().get(entityType));
|
||||
}
|
||||
|
||||
if (pet instanceof Zombie)
|
||||
@ -245,9 +245,9 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
DisguiseGuardian disguise = new DisguiseGuardian(pet);
|
||||
|
||||
if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0)
|
||||
if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0)
|
||||
{
|
||||
disguise.setName(Get(player).GetPets().get(entityType));
|
||||
disguise.setName(Get(player).getPets().get(entityType));
|
||||
}
|
||||
|
||||
_disguiseManager.disguise(disguise);
|
||||
@ -265,12 +265,12 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
UtilEnt.Vegetate(pet);
|
||||
}
|
||||
|
||||
public Creature GetPet(Player player)
|
||||
public Creature getPet(Player player)
|
||||
{
|
||||
return _activePetOwners.get(player.getName());
|
||||
}
|
||||
|
||||
public void RemovePet(final Player player, boolean removeOwner)
|
||||
public void removePet(final Player player, boolean removeOwner)
|
||||
{
|
||||
if (_activePetOwners.containsKey(player.getName()))
|
||||
{
|
||||
@ -303,7 +303,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
RemovePet(event.getPlayer(), true);
|
||||
removePet(event.getPlayer(), true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -336,7 +336,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
if (player != null && player.isOnline())
|
||||
{
|
||||
RemovePet(player, true);
|
||||
removePet(player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -438,25 +438,25 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void OnClientWebResponse(ClientWebResponseEvent event)
|
||||
public void onClientWebResponse(ClientWebResponseEvent event)
|
||||
{
|
||||
ClientPetTokenWrapper token = new Gson().fromJson(event.GetResponse(), ClientPetTokenWrapper.class);
|
||||
|
||||
Get(token.Name).Load(token.DonorToken);
|
||||
Get(token.Name).load(token.DonorToken);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PetClient AddPlayer(String player)
|
||||
protected PetClient addPlayer(String player)
|
||||
{
|
||||
return new PetClient();
|
||||
}
|
||||
|
||||
public PetFactory GetFactory()
|
||||
public PetFactory getFactory()
|
||||
{
|
||||
return _petFactory;
|
||||
}
|
||||
|
||||
public PetRepository GetRepository()
|
||||
public PetRepository getRepository()
|
||||
{
|
||||
return _repository;
|
||||
}
|
||||
@ -471,15 +471,15 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
return _activePetOwners.get(name);
|
||||
}
|
||||
|
||||
public void DisableAll()
|
||||
public void disableAll()
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
RemovePet(player, true);
|
||||
removePet(player, true);
|
||||
}
|
||||
|
||||
public void DisableAll(Player player)
|
||||
public void disableAll(Player player)
|
||||
{
|
||||
RemovePet(player, true);
|
||||
removePet(player, true);
|
||||
}
|
||||
|
||||
public Collection<Creature> getPets()
|
||||
|
@ -51,7 +51,7 @@ public class PollManager extends MiniDbClientPlugin<PlayerPollData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerPollData AddPlayer(String player)
|
||||
protected PlayerPollData addPlayer(String player)
|
||||
{
|
||||
return new PlayerPollData();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UserPreferences AddPlayer(String player)
|
||||
protected UserPreferences addPlayer(String player)
|
||||
{
|
||||
return new UserPreferences();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class KitProgressionManager extends MiniClientPlugin<PlayerKit>
|
||||
|
||||
|
||||
@Override
|
||||
protected PlayerKit AddPlayer(String player)
|
||||
protected PlayerKit addPlayer(String player)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -929,7 +929,7 @@ public class RewardManager
|
||||
|
||||
public PetReward addPetReward(Type type, EntityType entityType, RewardRarity rarity, int weight, int shards)
|
||||
{
|
||||
Pet pet = _petManager.GetFactory().getPet(entityType);
|
||||
Pet pet = _petManager.getFactory().getPet(entityType);
|
||||
PetReward reward = new PetReward(_petManager, _inventoryManager, _donationManager,
|
||||
pet.getName() + " Pet", pet.getName(), entityType, rarity, weight, shards);
|
||||
addReward(type, reward);
|
||||
|
@ -50,8 +50,8 @@ public class PetReward extends UnknownPackageReward
|
||||
PetToken petToken = new PetToken();
|
||||
petToken.PetType = token.PetType;
|
||||
|
||||
_petManager.GetRepository().AddPet(token);
|
||||
_petManager.Get(player).GetPets().put(_petEntity, token.PetName);
|
||||
_petManager.getRepository().AddPet(token);
|
||||
_petManager.Get(player).getPets().put(_petEntity, token.PetName);
|
||||
|
||||
_inventoryManager.addItemToInventory(player, _petEntity.toString(), 1);
|
||||
|
||||
@ -67,6 +67,6 @@ public class PetReward extends UnknownPackageReward
|
||||
return false;
|
||||
}
|
||||
|
||||
return !_petManager.Get(player).GetPets().containsKey(_petEntity);
|
||||
return !_petManager.Get(player).getPets().containsKey(_petEntity);
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerStats AddPlayer(String player)
|
||||
protected PlayerStats addPlayer(String player)
|
||||
{
|
||||
return new PlayerStats();
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class TaskManager extends MiniDbClientPlugin<TaskClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TaskClient AddPlayer(String playerName)
|
||||
protected TaskClient addPlayer(String playerName)
|
||||
{
|
||||
return new TaskClient();
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class TournamentManager extends MiniDbClientPlugin<ClientTournamentData>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientTournamentData AddPlayer(String player)
|
||||
protected ClientTournamentData addPlayer(String player)
|
||||
{
|
||||
return new ClientTournamentData();
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class YoutubeManager extends MiniDbClientPlugin<YoutubeClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected YoutubeClient AddPlayer(String player)
|
||||
protected YoutubeClient addPlayer(String player)
|
||||
{
|
||||
return new YoutubeClient(null);
|
||||
}
|
||||
|
@ -984,7 +984,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientClan AddPlayer(String player)
|
||||
protected ClientClan addPlayer(String player)
|
||||
{
|
||||
return new ClientClan();
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class MurderManager extends MiniClientPlugin<ClientMurder>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientMurder AddPlayer(String player)
|
||||
protected ClientMurder addPlayer(String player)
|
||||
{
|
||||
return new ClientMurder();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class Playtime extends MiniClientPlugin<PlayingClient>
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Set(event.getPlayer(), AddPlayer(event.getPlayer().getName()));
|
||||
Set(event.getPlayer(), addPlayer(event.getPlayer().getName()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -73,7 +73,7 @@ public class Playtime extends MiniClientPlugin<PlayingClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayingClient AddPlayer(String player)
|
||||
protected PlayingClient addPlayer(String player)
|
||||
{
|
||||
return new PlayingClient(Bukkit.getPlayer(player), TaskManager.Instance);
|
||||
}
|
||||
|
@ -786,7 +786,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HubClient AddPlayer(String player)
|
||||
protected HubClient addPlayer(String player)
|
||||
{
|
||||
return new HubClient(player);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class MailManager extends MiniClientPlugin<PlayerMailData> implements Not
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerMailData AddPlayer(String player)
|
||||
protected PlayerMailData addPlayer(String player)
|
||||
{
|
||||
return new PlayerMailData();
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ public class KothManager extends MiniPlugin
|
||||
|
||||
Manager.GetGadget().disableAll(player, outfit);
|
||||
Manager.GetMount().DisableAll(player);
|
||||
Manager.getPetManager().DisableAll(player);
|
||||
Manager.getPetManager().disableAll(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -472,7 +472,7 @@ public class SoccerManager extends MiniPlugin
|
||||
|
||||
Manager.GetGadget().disableAll(player, outfit);
|
||||
Manager.GetMount().DisableAll(player);
|
||||
Manager.getPetManager().DisableAll(player);
|
||||
Manager.getPetManager().disableAll(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -948,7 +948,7 @@ public class ServerManager extends MiniDbClientPlugin<SimpleClanToken> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SimpleClanToken AddPlayer(String player)
|
||||
protected SimpleClanToken addPlayer(String player)
|
||||
{
|
||||
return new SimpleClanToken();
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientClass AddPlayer(String player)
|
||||
protected ClientClass addPlayer(String player)
|
||||
{
|
||||
return new ClientClass(this, _skillFactory, _itemFactory, _clientManager.Get(player), _donationManager.Get(player), null);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user