Class Research
-
- All Implemented Interfaces:
-
net.kyori.adventure.key.Keyed,org.bukkit.Keyed
public final class Research implements Keyed
A Rebar research as seem in the 'researches' guide section.
Researches typically have a research point cost specified. However, this is optional, and you can implement your own methods to unlock a research.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classResearch.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static Research.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description Research(NamespacedKey key, ItemStack itemTemplate, Component name, Long cost, Set<NamespacedKey> unlocks)Research(NamespacedKey key, ItemStack item, Long cost, NamespacedKey unlocks)A constructor that sets the name to a default language file key.
-
Method Summary
Modifier and Type Method Description final ComponentgetName()final LonggetCost()If null, the research cannot be unlocked using points final Set<NamespacedKey>getUnlocks()The keys of the items that are unlocked by this research final ItemStackgetItem()final voidregister()final voidaddTo(Player player, Boolean sendMessage, Boolean effects)Adds the research to a player. final voidaddTo(Player player, Boolean sendMessage)Adds the research to a player. final voidaddTo(Player player)Adds the research to a player. final voidremoveFrom(Player player)Removes a research from a player. final BooleanisResearchedBy(Player player)Returns whether a research has been researched by the given player. NamespacedKeygetKey()Booleanequals(Object other)IntegerhashCode()final static Set<Research>getResearches(OfflinePlayer player)final static voidsetResearches(Player player, Set<Research> researches)final static voidaddResearch(Player player, Research research)final static voidremoveResearch(Player player, Research research)final static BooleancanPlayerCraft(Player $self, RebarItem item, Boolean sendMessage, Boolean respectBypass)final static BooleancanPlayerCraft(Player $self, RebarItem item, Boolean sendMessage)final static BooleancanPlayerCraft(Player $self, RebarItem item)final static BooleancanPlayerCraft(Player $self, RebarItemSchema schema, Boolean sendMessage, Boolean respectBypass)Checks whether a player can craft an item (ie has the associated research, or has permission to bypass research. final static BooleancanPlayerCraft(Player $self, RebarItemSchema schema, Boolean sendMessage)Checks whether a player can craft an item (ie has the associated research, or has permission to bypass research. final static BooleancanPlayerCraft(Player $self, RebarItemSchema schema)Checks whether a player can craft an item (ie has the associated research, or has permission to bypass research. final static BooleancanPlayerPickUp(Player $self, RebarItem item, Boolean sendMessage)Checks whether a player can pick up an item (ie has the associated research, or has permission to bypass research. final static BooleancanPlayerPickUp(Player $self, RebarItem item)Checks whether a player can pick up an item (ie has the associated research, or has permission to bypass research. final static BooleancanPlayerUse(Player $self, RebarItem item, Boolean sendMessage)final static BooleancanPlayerUse(Player $self, RebarItem item)final static BooleancanPlayerUse(Player $self, RebarItemSchema schema, Boolean sendMessage)Checks whether a player can use an item (ie has the associated research, or has permission to bypass research. final static BooleancanPlayerUse(Player $self, RebarItemSchema schema)Checks whether a player can use an item (ie has the associated research, or has permission to bypass research. final static ResearchloadFromConfig(ConfigSection section, NamespacedKey key)final static LonggetResearchPoints(Player $self)final static voidsetResearchPoints(Player $self, Long <set-?>)final static BooleangetResearchConfetti(Player $self)final static voidsetResearchConfetti(Player $self, Boolean <set-?>)final static BooleangetResearchSounds(Player $self)final static voidsetResearchSounds(Player $self, Boolean <set-?>)final static BooleangetGuideHints(Player $self)final static voidsetGuideHints(Player $self, Boolean <set-?>)-
-
Constructor Detail
-
Research
Research(NamespacedKey key, ItemStack itemTemplate, Component name, Long cost, Set<NamespacedKey> unlocks)
-
Research
Research(NamespacedKey key, ItemStack item, Long cost, NamespacedKey unlocks)
A constructor that sets the name to a default language file key.
-
-
Method Detail
-
getUnlocks
final Set<NamespacedKey> getUnlocks()
The keys of the items that are unlocked by this research
-
register
final void register()
-
addTo
@JvmOverloads() final void addTo(Player player, Boolean sendMessage, Boolean effects)
Adds the research to a player.
- Parameters:
sendMessage- If set, sends a message to notify the player that they have unlocked the research
-
addTo
@JvmOverloads() final void addTo(Player player, Boolean sendMessage)
Adds the research to a player.
- Parameters:
sendMessage- If set, sends a message to notify the player that they have unlocked the research
-
addTo
@JvmOverloads() final void addTo(Player player)
Adds the research to a player.
-
removeFrom
final void removeFrom(Player player)
Removes a research from a player.
-
isResearchedBy
final Boolean isResearchedBy(Player player)
Returns whether a research has been researched by the given player.
-
getKey
NamespacedKey getKey()
-
getResearches
final static Set<Research> getResearches(OfflinePlayer player)
-
setResearches
final static void setResearches(Player player, Set<Research> researches)
-
addResearch
final static void addResearch(Player player, Research research)
-
removeResearch
final static void removeResearch(Player player, Research research)
-
canPlayerCraft
@JvmOverloads() final static Boolean canPlayerCraft(Player $self, RebarItem item, Boolean sendMessage, Boolean respectBypass)
-
canPlayerCraft
@JvmOverloads() final static Boolean canPlayerCraft(Player $self, RebarItem item, Boolean sendMessage)
-
canPlayerCraft
@JvmOverloads() final static Boolean canPlayerCraft(Player $self, RebarItem item)
-
canPlayerCraft
@JvmOverloads() final static Boolean canPlayerCraft(Player $self, RebarItemSchema schema, Boolean sendMessage, Boolean respectBypass)
Checks whether a player can craft an item (ie has the associated research, or has permission to bypass research.
- Parameters:
sendMessage- Whether, if the player cannot craft the item, a message should be sent to them to notify them of this fact
-
canPlayerCraft
@JvmOverloads() final static Boolean canPlayerCraft(Player $self, RebarItemSchema schema, Boolean sendMessage)
Checks whether a player can craft an item (ie has the associated research, or has permission to bypass research.
- Parameters:
sendMessage- Whether, if the player cannot craft the item, a message should be sent to them to notify them of this fact
-
canPlayerCraft
@JvmOverloads() final static Boolean canPlayerCraft(Player $self, RebarItemSchema schema)
Checks whether a player can craft an item (ie has the associated research, or has permission to bypass research.
-
canPlayerPickUp
@JvmOverloads() final static Boolean canPlayerPickUp(Player $self, RebarItem item, Boolean sendMessage)
Checks whether a player can pick up an item (ie has the associated research, or has permission to bypass research.
- Parameters:
sendMessage- Whether, if the player cannot pick up the item, a message should be sent to them to notify them of this fact
-
canPlayerPickUp
@JvmOverloads() final static Boolean canPlayerPickUp(Player $self, RebarItem item)
Checks whether a player can pick up an item (ie has the associated research, or has permission to bypass research.
-
canPlayerUse
@JvmOverloads() final static Boolean canPlayerUse(Player $self, RebarItem item, Boolean sendMessage)
-
canPlayerUse
@JvmOverloads() final static Boolean canPlayerUse(Player $self, RebarItem item)
-
canPlayerUse
@JvmOverloads() final static Boolean canPlayerUse(Player $self, RebarItemSchema schema, Boolean sendMessage)
Checks whether a player can use an item (ie has the associated research, or has permission to bypass research.
- Parameters:
sendMessage- Whether, if the player cannot use the item, a message should be sent to them to notify them of this fact
-
canPlayerUse
@JvmOverloads() final static Boolean canPlayerUse(Player $self, RebarItemSchema schema)
Checks whether a player can use an item (ie has the associated research, or has permission to bypass research.
-
loadFromConfig
final static Research loadFromConfig(ConfigSection section, NamespacedKey key)
-
getResearchPoints
final static Long getResearchPoints(Player $self)
-
setResearchPoints
final static void setResearchPoints(Player $self, Long <set-?>)
-
getResearchConfetti
final static Boolean getResearchConfetti(Player $self)
-
setResearchConfetti
final static void setResearchConfetti(Player $self, Boolean <set-?>)
-
getResearchSounds
final static Boolean getResearchSounds(Player $self)
-
setResearchSounds
final static void setResearchSounds(Player $self, Boolean <set-?>)
-
getGuideHints
final static Boolean getGuideHints(Player $self)
-
setGuideHints
final static void setGuideHints(Player $self, Boolean <set-?>)
-
-
-
-