Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.brokenarrow.storage.Settings;
- import java.util.ArrayList;
- import java.util.List;
- public final class SettingsContainerData {
- private final String containerType;
- private final String icon;
- private final String displayName;
- private final String limitAmontOfItems;
- private final String uppgrade;
- private final String takeLevelOrExp;
- private final String soundWhenPlaceContainer;
- private final String soundWhenOpenContainer;
- private final String soundWhenCloseContainer;
- private final String expandCostUpgradePages;
- private final String suctionRange;
- private final String suctionBorderEffect;
- private final String soundWhenContainerRunTask;
- private final String blockVisualizationBlocktype;
- private final String blockVisualizationMessageOnTop;
- private String placeholderItemStack;
- private final List<String> effectOnContainer;
- private final List<String> lore;
- private final List<String> blackListedItems;
- private final List<String> effectWhenContainerRunTask;
- private final List<String> effectWhenPlaceContainer;
- private final double costUpgrade;
- private final double moneyToTakeFromPlayer;
- private final int guiSize;
- private final int numberOfPages;
- private final int whenBrakeContainer;
- private final int secPicupTeleportItems;
- private final int experienceToTakePlayer;
- private final int suctionBorderShowTime;
- private final int linkedRange;
- private final int amontOfLinks;
- private final int maxOfPages;
- private final int amountPlaceForFree;
- private final long timeBeforeReset;
- private final boolean defultGlowOnOff;
- private final boolean shallCostBeActiveWhenPlaceContainer;
- private boolean placeholderItemStackisGlow;
- private final Builder builder;
- private SettingsContainerData(Builder builder) {
- this.containerType = builder.containerType;
- this.icon = builder.icon;
- this.displayName = builder.displayName;
- this.limitAmontOfItems = builder.limitAmontOfItems;
- this.uppgrade = builder.uppgrade;
- this.moneyToTakeFromPlayer = builder.moneyToTakeFromPlayer;
- this.takeLevelOrExp = builder.takeLevelOrExp;
- this.soundWhenPlaceContainer = builder.soundWhenPlaceContainer;
- this.soundWhenOpenContainer = builder.soundWhenOpenContainer;
- this.soundWhenCloseContainer = builder.soundWhenCloseContainer;
- this.expandCostUpgradePages = builder.expandCostUpgradePages;
- this.suctionRange = builder.suctionRange;
- this.suctionBorderEffect = builder.suctionBorderEffect;
- this.soundWhenContainerRunTask = builder.soundWhenContainerRunTask;
- this.blockVisualizationBlocktype = builder.blockVisualizationBlocktype;
- this.blockVisualizationMessageOnTop = builder.blockVisualizationMessageOnTop;
- this.placeholderItemStack = builder.placeholderItemStack;
- this.effectOnContainer = builder.effectOnContainer;
- this.lore = builder.lore;
- this.blackListedItems = builder.blackListedItems;
- this.effectWhenContainerRunTask = builder.effectWhenContainerRunTask;
- this.effectWhenPlaceContainer = builder.effectWhenPlaceContainer;
- this.costUpgrade = builder.costUpgrade;
- this.guiSize = builder.guiSize;
- this.numberOfPages = builder.numberOfPages;
- this.whenBrakeContainer = builder.whenBrakeContainer;
- this.secPicupTeleportItems = builder.secPicupTeleportItems;
- this.experienceToTakePlayer = builder.experienceToTakePlayer;
- this.suctionBorderShowTime = builder.suctionBorderShowTime;
- this.linkedRange = builder.linkedRange;
- this.amontOfLinks = builder.amontOfLinks;
- this.maxOfPages = builder.maxOfPages;
- this.amountPlaceForFree = builder.amountPlaceForFree;
- this.timeBeforeReset = builder.timeBeforeReset;
- this.defultGlowOnOff = builder.defultGlowOnOff;
- this.shallCostBeActiveWhenPlaceContainer = builder.shallCostBeActiveWhenPlaceContainer;
- this.placeholderItemStackisGlow = builder.placeholderItemStackisGlow;
- this.builder = builder;
- }
- /**
- * Get what type container it is.
- *
- * @return the type of container.
- * @see org.brokenarrow.storage.cache.ContainerRegistry.TypeOfContainer
- */
- public String getContainerType() {
- return containerType;
- }
- /**
- * Get icon type this container type have.
- *
- * @return item enum name.
- */
- public String getIcon() {
- return icon;
- }
- /**
- * Name it will have both as title inside inventory
- * and as display mame when is a item.
- *
- * @return text you want to have as title.
- */
- public String getDisplayName() {
- return displayName;
- }
- /**
- * get limit of amount of items, are used for storage unit/container.
- * <p>
- * If method return -1 it will be unlimit amount and everything over 1 limit
- * the amount of items.
- *
- * @return aomut of items max can be stored.
- */
- public String getLimitAmontOfItems() {
- return limitAmontOfItems;
- }
- /**
- * Get update for this container. It use the key inside the yml file
- * to get current and next update.
- *
- * @return upgrade key from the yaml file.
- */
- public String getUppgrade() {
- return uppgrade;
- }
- /**
- * Get if shall use exp or level from player.
- * <p>
- * This method set how much it will take {@link Builder#setExperienceToTakePlayer(int)}.
- *
- * @return EXP or LVL.
- */
- public String getTakeLevelOrExp() {
- return takeLevelOrExp;
- }
- /**
- * Get sound type when place contanier.
- *
- * @return sound enum name.
- */
- public String getSoundWhenPlaceContainer() {
- return soundWhenPlaceContainer;
- }
- /**
- * Get sound type when open contanier.
- *
- * @return sound enum name.
- */
- public String getSoundWhenOpenContainer() {
- return soundWhenOpenContainer;
- }
- /**
- * Get sound type when close contanier.
- *
- * @return sound enum name.
- */
- public String getSoundWhenCloseContainer() {
- return soundWhenCloseContainer;
- }
- /**
- * Set how much cost shall increase in percent. For every updated
- *
- * @return aomunt of percent it will increase.
- */
- public String getExpandCostUpgradePages() {
- return expandCostUpgradePages;
- }
- /**
- * Get the max range it will pick up items.
- * <p>
- * If you want one chunk, set it to -1 or -1,2 if you want 9 chunks insted of
- * only one (you can use biger number for example -1,5 it vill be 5 x biger area).
- * Be carefully to not set the area too big it can cuse lag on the server.
- * Set to -2 to disable or for example 5,8,5 will it be in blocks arund the container.
- *
- * @return the suction range.
- */
- public String getSuctionRange() {
- return suctionRange;
- }
- /**
- * Get the type of effect you want to use to show the suction border.
- *
- * @return enum name on the effect and in 1.18 can it be matrial enum too.
- */
- public String getSuctionBorderEffect() {
- return suctionBorderEffect;
- }
- /**
- * Get sound type when run a task (for example after it have sold or craft or pick up item).
- *
- * @return sound enum name.
- */
- public String getSoundWhenContainerRunTask() {
- return soundWhenContainerRunTask;
- }
- /**
- * Get type of block it shall use for visualization (it is used to show
- * what container you have linked to).
- *
- * @return enum name on the block.
- */
- public String getBlockVisualizationBlocktype() {
- return blockVisualizationBlocktype;
- }
- /**
- * Get message some are ontop of the block you link too.
- *
- * @return message you want on top of the container.
- */
- public String getBlockVisualizationMessageOnTop() {
- return blockVisualizationMessageOnTop;
- }
- /**
- * Get effects some will spawn random arund the container.
- *
- * @return list of visible effects some shall spawn on the container.
- */
- public List<String> getEffectOnContainer() {
- return effectOnContainer;
- }
- /**
- * Get lore on the item.
- *
- * @return list of text.
- */
- public List<String> getLore() {
- return lore;
- }
- /**
- * Get items some shall be blacklisted (Is for filter and crafting list to allow or disallow items can be added).
- *
- * @return List of items some are blacklisted.
- */
- public List<String> getBlackListedItems() {
- return blackListedItems;
- }
- /**
- * When container run a task, like crafting,sell or pick up items.
- * Get effects it shall run on the chest.
- *
- * @return list of diffrent effects or same effect several times.
- */
- public List<String> getEffectWhenContainerRunTask() {
- return effectWhenContainerRunTask;
- }
- /**
- * Get list of effects shall show when place container.
- *
- * @return list of diffrent effects or same effect several times.
- */
- public List<String> getEffectWhenPlaceContainer() {
- return effectWhenPlaceContainer;
- }
- /**
- * Get cost for upgrade the container.
- *
- * @return cost with decimals.
- */
- public double getCostUpgrade() {
- return costUpgrade;
- }
- /**
- * Get cost for place the container.
- *
- * @return cost with decimals.
- */
- public double getMoneyToTakeFromPlayer() {
- return moneyToTakeFromPlayer;
- }
- /**
- * Get size on the inventory.
- *
- * @return size of the inventory.
- */
- public int getGuiSize() {
- return guiSize;
- }
- /**
- * Get defult amount of pages container have.
- *
- * @return amount of pages.
- */
- public int getNumberOfPages() {
- return numberOfPages;
- }
- /**
- * Get dropmode for the container.
- * 1 Will dropp items on grund.
- * 2 It will be stored "inside" the container.
- *
- * @return a number.
- */
- public int getWhenBrakeContainer() {
- return whenBrakeContainer;
- }
- /**
- * Get time how often it will teleport and pic up items.
- *
- * @return number of seconds.
- */
- public int getSecPicupTeleportItems() {
- return secPicupTeleportItems;
- }
- /**
- * How much it will cost when place container when is no free placement left.
- *
- * @return amunt of xp or levels to take.
- */
- public int getExperienceToTakePlayer() {
- return experienceToTakePlayer;
- }
- /**
- * Get how long time it will show border in seconds.
- *
- * @return number of seconds.
- */
- public int getSuctionBorderShowTime() {
- return suctionBorderShowTime;
- }
- /**
- * Get max range you can link your link/suction container to the container you link.
- *
- * @return number of blocks away the container you link to can be.
- */
- public int getLinkedRange() {
- return linkedRange;
- }
- /**
- * Get max amount of links you can do with this container.
- *
- * @return amount of links you can have.
- */
- public int getAmontOfLinks() {
- return amontOfLinks;
- }
- /**
- * Get max amount of pages the container can have.
- *
- * @return amount of pages the container can have max.
- */
- public int getMaxOfPages() {
- return maxOfPages;
- }
- /**
- * Get amount of free placements.
- *
- * @return amount of free placements.
- */
- public int getAmountPlaceForFree() {
- return amountPlaceForFree;
- }
- /**
- * Get time before it will reset your placements. it will be in seconds.
- *
- * @return time in seconds it will be reseted.
- */
- public long getTimeBeforeReset() {
- return timeBeforeReset;
- }
- /**
- * Get if item shall glow or not in inventory.
- *
- * @return true if item shall have glow effect.
- */
- public boolean isDefultGlowOnOff() {
- return defultGlowOnOff;
- }
- /**
- * Get if cost and xp shall be active for that type of container when place.
- *
- * @return true if cost are active on container.
- */
- public boolean isShallCostBeActiveWhenPlaceContainer() {
- return shallCostBeActiveWhenPlaceContainer;
- }
- /**
- * Get old values from builder class.
- *
- * @return instance of bulder class.
- */
- public Builder getBuilder() {
- return builder;
- }
- public static class Builder {
- private String containerType;
- private String icon;
- private String displayName;
- private String limitAmontOfItems;
- private String uppgrade;
- private String takeLevelOrExp;
- private String soundWhenPlaceContainer;
- private String soundWhenOpenContainer;
- private String soundWhenCloseContainer;
- private String expandCostUpgradePages;
- private String suctionRange;
- private String suctionBorderEffect;
- private String soundWhenContainerRunTask;
- private String blockVisualizationBlocktype;
- private String blockVisualizationMessageOnTop;
- private String placeholderItemStack;
- private List<String> effectOnContainer = new ArrayList<>();
- private List<String> lore = new ArrayList<>();
- private List<String> blackListedItems = new ArrayList<>();
- private List<String> effectWhenContainerRunTask = new ArrayList<>();
- private List<String> effectWhenPlaceContainer = new ArrayList<>();
- private double moneyToTakeFromPlayer;
- private double costUpgrade;
- private int guiSize;
- private int numberOfPages;
- private int whenBrakeContainer;
- private int secPicupTeleportItems;
- private int experienceToTakePlayer;
- private int suctionBorderShowTime;
- private int linkedRange;
- private int amontOfLinks;
- private int maxOfPages;
- private int amountPlaceForFree;
- private long timeBeforeReset;
- private boolean defultGlowOnOff;
- private boolean shallCostBeActiveWhenPlaceContainer;
- private boolean placeholderItemStackisGlow;
- /**
- * Set Type of container you want this container should be.
- *
- * @param containerType the type of container.
- * @return builder class.
- * @see org.brokenarrow.storage.cache.ContainerRegistry.TypeOfContainer
- */
- public Builder setContainerType(String containerType) {
- this.containerType = containerType;
- return this;
- }
- /**
- * Set icon type you want this container type should have.
- *
- * @param icon the item enum name.
- * @return builder class.
- */
- public Builder setIcon(String icon) {
- this.icon = icon;
- return this;
- }
- /**
- * Name it will have both as title inside inventory
- * and as display mame when is a item.
- *
- * @param displayName text you want to have as title.
- * @return builder class.
- */
- public Builder setDisplayName(String displayName) {
- this.displayName = displayName;
- return this;
- }
- /**
- * Set placeholder items. Inside storage unit Container.
- *
- * @param placeholderItemStack the enum name.
- */
- public void setPlaceholderItemStack(String placeholderItemStack) {
- this.placeholderItemStack = placeholderItemStack;
- }
- /**
- * Set limit of amount of items, are used for storage unit/container.
- * If set to -1 it will be unlimit amount and everything over 1 limit
- * the amount of items.
- *
- * @param limitAmontOfItems the limit of items.
- * @return builder class.
- */
- public Builder setLimitAmontOfItems(String limitAmontOfItems) {
- this.limitAmontOfItems = limitAmontOfItems;
- return this;
- }
- /**
- * Set update for this container. It use the key inside the yml file
- * to get current and next update.
- *
- * @param uppgrade the upgrade key to use.
- * @return builder class.
- */
- public Builder setUppgrade(String uppgrade) {
- this.uppgrade = uppgrade;
- return this;
- }
- /**
- * Set to EXP for experience and LVL for levels.
- * <p>
- * This method set how much it will take {@link #setExperienceToTakePlayer(int)}.
- *
- * @param takeLevelOrExp with method it should use.
- * @return builder class.
- */
- public Builder setTakeLevelOrExp(String takeLevelOrExp) {
- this.takeLevelOrExp = takeLevelOrExp;
- return this;
- }
- /**
- * Set sound type when place contanier.
- *
- * @param soundWhenPlaceContainer sound enum name you want to use.
- * @return builder class.
- */
- public Builder setSoundWhenPlaceContainer(String soundWhenPlaceContainer) {
- this.soundWhenPlaceContainer = soundWhenPlaceContainer;
- return this;
- }
- /**
- * Set sound type when open contanier.
- *
- * @param soundWhenOpenContainer sound enum name you want to use.
- * @return builder class.
- */
- public Builder setSoundWhenOpenContainer(String soundWhenOpenContainer) {
- this.soundWhenOpenContainer = soundWhenOpenContainer;
- return this;
- }
- /**
- * Set sound type when close contanier.
- *
- * @param soundWhenCloseContainer sound enum name you want to use.
- * @return builder class.
- */
- public Builder setSoundWhenCloseContainer(String soundWhenCloseContainer) {
- this.soundWhenCloseContainer = soundWhenCloseContainer;
- return this;
- }
- /**
- * Set how much cost shall increase in percent. For every updated
- *
- * @param expandCostUpgradePages upgrade cost.
- * @return builder class.
- */
- public Builder setExpandCostUpgradePages(String expandCostUpgradePages) {
- this.expandCostUpgradePages = expandCostUpgradePages;
- return this;
- }
- /**
- * Set the max range it will pick up items.
- * <p>
- * If you want one chunk, set it to -1 or -1,2 if you want 9 chunks insted of
- * only one (you can use biger number for example -1,5 it vill be 5 x biger area).
- * Be carefully to not set the area too big it can cuse lag on the server.
- * Set to -2 to disable or for example 5,8,5 will it be in blocks arund the container.
- *
- * @param suctionRange the suction range.
- * @return builder class.
- */
- public Builder setSuctionRange(String suctionRange) {
- this.suctionRange = suctionRange;
- return this;
- }
- /**
- * Set the type of effect you want to use to show the suction border.
- *
- * @param suctionBorderEffect enum name on the effect you want to use and in 1.18 you can use Matrial too.
- * @return builder class.
- */
- public Builder setSuctionBorderEffect(String suctionBorderEffect) {
- this.suctionBorderEffect = suctionBorderEffect;
- return this;
- }
- /**
- * Set sound type when run a task (for example after it have sold or craft or pick up item).
- *
- * @param soundWhenContainerRunTask sound enum name you want to use.
- * @return builder class.
- */
- public Builder setSoundWhenContainerRunTask(String soundWhenContainerRunTask) {
- this.soundWhenContainerRunTask = soundWhenContainerRunTask;
- return this;
- }
- /**
- * Set type of block it shall use for visualization (it is used to show
- * what container you have linked to).
- *
- * @param blockVisualizationBlocktype enum name on the block you want to use.
- * @return builder class.
- */
- public Builder setBlockVisualizationBlocktype(String blockVisualizationBlocktype) {
- this.blockVisualizationBlocktype = blockVisualizationBlocktype;
- return this;
- }
- /**
- * Set message some will show ontop of the block you link too.
- *
- * @param blockVisualizationMessageOnTop message you want on top of the container.
- * @return builder class.
- */
- public Builder setBlockVisualizationMessageOnTop(String blockVisualizationMessageOnTop) {
- this.blockVisualizationMessageOnTop = blockVisualizationMessageOnTop;
- return this;
- }
- /**
- * Set effects it shall run some will spawn random arund the container.
- *
- * @param effectOnContainer List of visible effects on the container.
- * @return builder class.
- */
- public Builder setEffectOnContainer(List<String> effectOnContainer) {
- this.effectOnContainer = effectOnContainer;
- return this;
- }
- /**
- * Set lore on the item.
- *
- * @param lore list of text you want on the item.
- * @return builder class.
- */
- public Builder setLore(List<String> lore) {
- this.lore = lore;
- return this;
- }
- /**
- * Set items some shall be blacklisted (Is for filter and crafting list to allow or disallow items can be added)
- *
- * @param blackListedItems List of items you not allow be added.
- * @return builder class.
- */
- public Builder setBlackListedItems(List<String> blackListedItems) {
- this.blackListedItems = blackListedItems;
- return this;
- }
- /**
- * When container run a task, like crafting,sell or pick up items.
- * Set effects it shall run on the chest.
- *
- * @param effectWhenContainerRunTask type of effects.
- * @return builder class.
- */
- public Builder setEffectWhenContainerRunTask(List<String> effectWhenContainerRunTask) {
- this.effectWhenContainerRunTask = effectWhenContainerRunTask;
- return this;
- }
- /**
- * Set list of effects shall show when place container.
- *
- * @param effectWhenPlaceContainer type of effects.
- * @return builder class.
- */
- public Builder setEffectWhenPlaceContainer(List<String> effectWhenPlaceContainer) {
- this.effectWhenPlaceContainer = effectWhenPlaceContainer;
- return this;
- }
- /**
- * Amount of maney to take when player place the container.
- *
- * @param moneyToTakeFromPlayer amount it will take (support decimals).
- * @return builder class.
- */
- public Builder setMoneyToTakeFromPlayer(double moneyToTakeFromPlayer) {
- this.moneyToTakeFromPlayer = moneyToTakeFromPlayer;
- return this;
- }
- /**
- * Set cost for upgrade the container. You can use 1.0 as example.
- *
- * @param costUpgrade the cost with decimals
- * @return builder class.
- */
- public Builder setCostUpgrade(double costUpgrade) {
- this.costUpgrade = costUpgrade;
- return this;
- }
- /**
- * Set size on the inventory from 9 to 53.
- *
- * @param guiSize size of the inventory.
- * @return builder class.
- */
- public Builder setGuiSize(int guiSize) {
- this.guiSize = guiSize;
- return this;
- }
- /**
- * Set defult amount of pages container shall have before you need upgrade it for more pages.
- *
- * @param numberOfPages amount of pages defult.
- * @return builder class.
- */
- public Builder setNumberOfPages(int numberOfPages) {
- this.numberOfPages = numberOfPages;
- return this;
- }
- /**
- * Set this how items shall drop.
- * 1 Will dropp items on grund.
- * 2 It will be stored "inside" the container.
- *
- * @param whenBrakeContainer drop mode it shall use.
- * @return builder class.
- */
- public Builder setWhenBrakeContainer(int whenBrakeContainer) {
- this.whenBrakeContainer = whenBrakeContainer;
- return this;
- }
- /**
- * Set time how often it shall teleport and pic up items.
- *
- * @param secPicupTeleportItems seconds it will take when pickup items.
- * @return builder class.
- */
- public Builder setSecPicupTeleportItems(int secPicupTeleportItems) {
- this.secPicupTeleportItems = secPicupTeleportItems;
- return this;
- }
- /**
- * How much it will cost when place container when is no free placement left.
- *
- * @param experienceToTakePlayer amount of exp or level/levels (depending on setting).
- * @return builder class.
- */
- public Builder setExperienceToTakePlayer(int experienceToTakePlayer) {
- this.experienceToTakePlayer = experienceToTakePlayer;
- return this;
- }
- /**
- * Set how long time it will show border in seconds.
- *
- * @param suctionBorderShowTime seconds it will show border.
- * @return builder class.
- */
- public Builder setSuctionBorderShowTime(int suctionBorderShowTime) {
- this.suctionBorderShowTime = suctionBorderShowTime;
- return this;
- }
- /**
- * Set range you can link your container to.
- *
- * @param linkedRange distans you can link from.
- * @return builder class.
- */
- public Builder setLinkedRange(int linkedRange) {
- this.linkedRange = linkedRange;
- return this;
- }
- /**
- * Set max amount of links you can do with this container.
- *
- * @param amontOfLinks number of links max.
- * @return builder class.
- */
- public Builder setAmontOfLinks(int amontOfLinks) {
- this.amontOfLinks = amontOfLinks;
- return this;
- }
- /**
- * Set max amount of pages the container can have.
- *
- * @param maxOfPages number of pages max.
- * @return builder class.
- */
- public Builder setMaxOfPages(int maxOfPages) {
- this.maxOfPages = maxOfPages;
- return this;
- }
- /**
- * Set amount of placements you can make for free.
- *
- * @param amountPlaceForFree number of placements.
- * @return builder class.
- */
- public Builder setAmountPlaceForFree(int amountPlaceForFree) {
- this.amountPlaceForFree = amountPlaceForFree;
- return this;
- }
- /**
- * Set time before it will reset your placements. it will be in seconds.
- *
- * @param timeBeforeReset set seconds it will reset.
- * @return builder class.
- */
- public Builder setTimeBeforeReset(long timeBeforeReset) {
- this.timeBeforeReset = timeBeforeReset;
- return this;
- }
- /**
- * Set if item shall glow or not.
- *
- * @param defultGlowOnOff if it true item will glow.
- * @return builder class.
- */
- public Builder setDefultGlowOnOff(boolean defultGlowOnOff) {
- this.defultGlowOnOff = defultGlowOnOff;
- return this;
- }
- /**
- * Set if cost and xp shall be active for that type of container when place.
- *
- * @param shallCostBeActiveWhenPlaceContainer true if this containertype shall have cost when place.
- * @return builder class.
- */
- public Builder setShallCostBeActiveWhenPlaceContainer(boolean shallCostBeActiveWhenPlaceContainer) {
- this.shallCostBeActiveWhenPlaceContainer = shallCostBeActiveWhenPlaceContainer;
- return this;
- }
- /**
- * Set if placeholder items shall glow. Inside storage unit Container.
- *
- * @param placeholderItemStackisGlow set to true if it shall glow.
- * @return builder class.
- */
- public Builder setPlaceholderItemStackisGlow(boolean placeholderItemStackisGlow) {
- this.placeholderItemStackisGlow = placeholderItemStackisGlow;
- return this;
- }
- public SettingsContainerData build() {
- return new SettingsContainerData(this);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement