Class KingdomBuilding<S extends KingdomBuildingStyle<?,?,?>>

Type Parameters:
S - The custom style of the building which can be configured.
All Implemented Interfaces:
org.kingdoms.abstraction.Levellable, Keyed<SimpleLocation>, SmartObject, org.kingdoms.constants.group.model.logs.Loggable, org.kingdoms.data.Deserializable, org.kingdoms.data.Serializable, org.kingdoms.locale.provider.CascadingMessageContextProvider, org.kingdoms.locale.provider.MessageContextProvider
Direct Known Subclasses:
Structure, Turret

public abstract class KingdomBuilding<S extends KingdomBuildingStyle<?,?,?>> extends KingdomBlock implements org.kingdoms.abstraction.Levellable, org.kingdoms.data.Serializable, org.kingdoms.data.Deserializable
A building represents a set of blocks defined by getBuilding() which can perform a set of functions and can potentially be upgraded which might change its functionality and appearance.
  • Field Details

    • style

      protected final @NonNull S extends KingdomBuildingStyle<?,?,?> style
    • level

      protected @org.checkerframework.common.value.qual.IntRange(from=1L) int level
    • building

      protected org.kingdoms.constants.land.building.Building building
    • durability

      protected double durability
  • Constructor Details

    • KingdomBuilding

      public KingdomBuilding(@NonNull S type, @NonNull SimpleLocation origin)
  • Method Details

    • getKey

      public final @NonNull SimpleLocation getKey()
      Specified by:
      getKey in interface Keyed<S extends KingdomBuildingStyle<?,?,?>>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getStyle

      public @NonNull S getStyle()
    • getBlock

      public @NonNull org.bukkit.block.Block getBlock()
    • modifyData

      public void modifyData(Land land, boolean adding)
      Specified by:
      modifyData in class KingdomBlock
    • getDataMap

      protected Map<org.kingdoms.server.location.BlockVector3,KingdomBlock> getDataMap(Land land)
    • remove

      public final KingdomItemBreakEvent<?> remove()
    • getContext

      public PlaceholderContextBuilder getContext()
    • onBuildFinish

      @OverridingMethodsMustInvokeSuper public void onBuildFinish()
    • prepareBuilding

      public org.kingdoms.constants.land.building.BuildingConstruction prepareBuilding(org.kingdoms.constants.land.building.info.BuildingSchematic info)
    • place

      @MustBeInvokedByOverriders public KingdomItemPlaceEvent<?> place(org.kingdoms.events.items.KingdomItemPlaceContext context)
    • getVisualsManager

      public org.kingdoms.managers.land.distance.KingdomBuildingVisualizer getVisualsManager()
    • remove

      @MustBeInvokedByOverriders public @NonNull KingdomItemBreakEvent<?> remove(org.kingdoms.events.items.KingdomItemRemoveContext context)
    • update

      public void update()
      Updates the settings.
    • dropItem

      public void dropItem(org.bukkit.Location location, org.kingdoms.constants.item.KingdomItemCreateSettings settings)
    • serialize

      @MustBeInvokedByOverriders public void serialize(SerializationContext<org.kingdoms.data.database.dataprovider.SectionableDataSetter> context)
      Specified by:
      serialize in interface org.kingdoms.data.Serializable
      Parameters:
      context - can be also a ItemSerializationContext which implies that this building is being serialized into an in-game item.
    • deserialize

      @MustBeInvokedByOverriders public void deserialize(DeserializationContext<org.kingdoms.data.database.dataprovider.SectionableDataGetter> context)
      Specified by:
      deserialize in interface org.kingdoms.data.Deserializable
    • isEnabled

      public boolean isEnabled()
      Returns:
      true if this item is enabled in the config, otherwise false.
    • getDurability

      public double getDurability()
    • setDurability

      public void setDurability(double durability)
    • playSound

      public void playSound(String sound)
    • playSound

      public void playSound(org.bukkit.Location location, String sound)
    • playSound

      public void playSound(org.bukkit.Location location, ConfigPath sound)
    • getBuildingSettings

      @NotNull public @NotNull org.kingdoms.constants.land.building.info.BuildingSettings getBuildingSettings(int level)
    • displayParticle

      public void displayParticle(String particle)
    • displayParticle

      public void displayParticle(org.bukkit.Location location, String particle)
    • getParticleDisplay

      public com.cryptomorin.xseries.particles.ParticleDisplay getParticleDisplay(ConfigPath path)
    • getItem

      public org.kingdoms.constants.item.KingdomItem getItem(@NotNull @NotNull org.kingdoms.constants.item.KingdomItemCreateSettings settings)
    • addMessageContextEdits

      @MustBeInvokedByOverriders public MessagePlaceholderProvider addMessageContextEdits(MessagePlaceholderProvider context, Kingdom kingdom)
    • addMessageContextEdits

      public final void addMessageContextEdits(@NotNull @NotNull MessagePlaceholderProvider context)
      Specified by:
      addMessageContextEdits in interface org.kingdoms.locale.provider.CascadingMessageContextProvider
      Overrides:
      addMessageContextEdits in class KingdomsObject
    • getLevel

      public int getLevel()
      Specified by:
      getLevel in interface org.kingdoms.abstraction.Levellable
    • setLevel

      public void setLevel(int level)
      Specified by:
      setLevel in interface org.kingdoms.abstraction.Levellable
    • upgrade

      public org.kingdoms.events.items.KingdomBuildingUpgradeEvent upgrade(int newLevel, long paidResourcePoints, KingdomPlayer by)
    • repair

      public void repair()
    • getMaxLevel

      public int getMaxLevel(@Nullable Kingdom kingdom)
    • getPlaceholderContext

      public PlaceholderProvider getPlaceholderContext(Kingdom kingdom, int lvl)
    • getUpgradeCost

      public int getUpgradeCost(@Nullable Kingdom kingdom)
    • eval

      public double eval(@NonNull String str, @Nullable Kingdom kingdom, int lvl)
    • eval

      public double eval(@NonNull KeyedConfigAccessor option, @Nullable Kingdom kingdom, int lvl)
    • ofSection

      public KeyedConfigAccessor ofSection(String sectionName)
    • ofSection

      public KeyedConfigAccessor ofSection(String sectionName, int withLevel)
    • ofSection

      public KeyedConfigAccessor ofSection(String sectionName, int withLevel, boolean error)
    • getBuilding

      public org.kingdoms.constants.land.building.Building getBuilding()
    • setBuilding

      @Internal public void setBuilding(org.kingdoms.constants.land.building.Building building)
    • canFunction

      public boolean canFunction()
    • requireRepair

      public void requireRepair()
    • decreaseDurability

      public void decreaseDurability(double amount)
    • toString

      public String toString()
      Overrides:
      toString in class CompressedSmartObject