2019-05-15 20:16:41 +02:00
|
|
|
package world.bentobox.bentobox.blueprints.dataobjects;
|
|
|
|
|
2019-05-26 22:14:24 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.EnumMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2019-06-03 00:52:27 +02:00
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.World;
|
|
|
|
|
|
|
|
import com.google.gson.annotations.Expose;
|
|
|
|
|
|
|
|
import world.bentobox.bentobox.blueprints.Blueprint;
|
|
|
|
import world.bentobox.bentobox.database.objects.DataObject;
|
|
|
|
|
2019-05-15 20:16:41 +02:00
|
|
|
/**
|
|
|
|
* Represents a bundle of three {@link Blueprint}s.
|
|
|
|
* This is what the player will choose when creating his island.
|
|
|
|
* @since 1.5.0
|
|
|
|
* @author Poslovitch, tastybento
|
|
|
|
*/
|
|
|
|
public class BlueprintBundle implements DataObject {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The unique id of this bundle
|
|
|
|
*/
|
|
|
|
@Expose
|
|
|
|
private String uniqueId;
|
|
|
|
/**
|
|
|
|
* Icon of the bundle
|
|
|
|
*/
|
|
|
|
@Expose
|
|
|
|
private Material icon = Material.PAPER;
|
|
|
|
/**
|
|
|
|
* Name on the icon
|
|
|
|
*/
|
|
|
|
@Expose
|
|
|
|
private String displayName = "";
|
|
|
|
/**
|
|
|
|
* Description to show players
|
|
|
|
*/
|
|
|
|
@Expose
|
|
|
|
private List<String> description = new ArrayList<>();
|
|
|
|
/**
|
|
|
|
* If true, then the player needs to have a permission to view or use this bundle
|
|
|
|
* The permission is GameModeAddon.island.create.uniqueId of blueprint bundle.
|
|
|
|
* e.g. bskyblock.island.create.vip
|
|
|
|
*/
|
|
|
|
@Expose
|
|
|
|
private boolean requirePermission;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reference to the blueprint
|
|
|
|
*/
|
|
|
|
@Expose
|
2019-05-26 22:14:24 +02:00
|
|
|
private Map<World.Environment, String> blueprints = new EnumMap<>(World.Environment.class);
|
2019-06-03 00:52:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Preferred slot in GUI.
|
|
|
|
*/
|
|
|
|
@Expose
|
|
|
|
private int slot = 0;
|
|
|
|
|
2024-04-01 02:29:18 +02:00
|
|
|
/**
|
|
|
|
* Number of times this bundle can be used by a single player. 0 = unlimited
|
|
|
|
*/
|
|
|
|
@Expose
|
|
|
|
private int times = 0;
|
2019-06-03 00:52:27 +02:00
|
|
|
|
|
|
|
|
2019-05-15 20:16:41 +02:00
|
|
|
/**
|
|
|
|
* @return the uniqueId
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public String getUniqueId() {
|
2022-09-29 17:44:07 +02:00
|
|
|
return uniqueId;
|
2019-05-15 20:16:41 +02:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param uniqueId the uniqueId to set
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void setUniqueId(String uniqueId) {
|
|
|
|
this.uniqueId = uniqueId;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return the icon
|
|
|
|
*/
|
|
|
|
public Material getIcon() {
|
|
|
|
return icon;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param icon the icon to set
|
|
|
|
*/
|
|
|
|
public void setIcon(Material icon) {
|
|
|
|
this.icon = icon;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return the displayName
|
|
|
|
*/
|
|
|
|
public String getDisplayName() {
|
|
|
|
return displayName;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param displayName the displayName to set
|
|
|
|
*/
|
|
|
|
public void setDisplayName(String displayName) {
|
|
|
|
this.displayName = displayName;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return the description
|
|
|
|
*/
|
|
|
|
public List<String> getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param description the description to set
|
|
|
|
*/
|
|
|
|
public void setDescription(List<String> description) {
|
|
|
|
this.description = description;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return the blueprints
|
|
|
|
*/
|
2019-05-26 22:14:24 +02:00
|
|
|
public Map<World.Environment, String> getBlueprints() {
|
2019-05-15 20:16:41 +02:00
|
|
|
return blueprints;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param blueprints the blueprints to set
|
|
|
|
*/
|
2019-05-26 22:14:24 +02:00
|
|
|
public void setBlueprints(Map<World.Environment, String> blueprints) {
|
2019-05-15 20:16:41 +02:00
|
|
|
this.blueprints = blueprints;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-05-27 07:03:09 +02:00
|
|
|
* Adds a blueprint to the blueprint bundle. It will replace any blueprint that already exists of the same Environment type.
|
|
|
|
* @param env - the Environment
|
2019-05-15 20:16:41 +02:00
|
|
|
* @param bp - blueprint
|
|
|
|
*/
|
|
|
|
public void setBlueprint(World.Environment env, Blueprint bp) {
|
|
|
|
this.blueprints.put(env, bp.getName());
|
|
|
|
}
|
|
|
|
|
2019-05-20 08:18:24 +02:00
|
|
|
/**
|
|
|
|
* Removes a blueprint from this environment slot
|
|
|
|
* @param env - the world environment
|
|
|
|
*/
|
|
|
|
public void clearBlueprint(World.Environment env) {
|
|
|
|
this.blueprints.remove(env);
|
|
|
|
}
|
|
|
|
|
2019-05-15 20:16:41 +02:00
|
|
|
/**
|
|
|
|
* Get the blueprint for the environment type
|
2019-05-27 07:03:09 +02:00
|
|
|
* @param env - Environment type
|
2019-05-15 20:16:41 +02:00
|
|
|
* @return Blueprint or null if one does not exist
|
|
|
|
*/
|
|
|
|
public String getBlueprint(World.Environment env) {
|
|
|
|
return this.blueprints.get(env);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a line to the description
|
|
|
|
*
|
2019-07-11 22:55:17 +02:00
|
|
|
* @param string description
|
2019-05-15 20:16:41 +02:00
|
|
|
*/
|
|
|
|
public void setDescription(String string) {
|
|
|
|
if (description == null)
|
|
|
|
description = new ArrayList<>();
|
|
|
|
this.description.add(string);
|
|
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @return the requirePermission
|
|
|
|
*/
|
|
|
|
public boolean isRequirePermission() {
|
|
|
|
return requirePermission;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param requirePermission the requirePermission to set
|
|
|
|
*/
|
|
|
|
public void setRequirePermission(boolean requirePermission) {
|
|
|
|
this.requirePermission = requirePermission;
|
|
|
|
}
|
2019-06-03 00:52:27 +02:00
|
|
|
/**
|
|
|
|
* @return the slot
|
|
|
|
*/
|
|
|
|
public int getSlot() {
|
|
|
|
return slot;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @param slot the slot to set
|
|
|
|
*/
|
|
|
|
public void setSlot(int slot) {
|
|
|
|
this.slot = slot;
|
|
|
|
}
|
2019-05-15 20:16:41 +02:00
|
|
|
|
2024-04-01 02:29:18 +02:00
|
|
|
/**
|
|
|
|
* @return the times
|
|
|
|
*/
|
|
|
|
public int getTimes() {
|
|
|
|
return times;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param times the times to set
|
|
|
|
*/
|
|
|
|
public void setTimes(int times) {
|
|
|
|
this.times = times;
|
|
|
|
}
|
|
|
|
|
2019-05-15 20:16:41 +02:00
|
|
|
}
|