Skip to content

Commit cff5111

Browse files
authored
Merge pull request #691 from pylonmc/idra/docs-improvements
Docs improvements
2 parents cdac382 + f80cf7d commit cff5111

93 files changed

Lines changed: 235 additions & 44 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

rebar/src/main/kotlin/io/github/pylonmc/rebar/Rebar.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ object Rebar : JavaPlugin(), RebarAddon {
178178
RebarGrowable.register(this, pm)
179179
RebarCauldron.register(this, pm)
180180
RebarSign.register(this, pm)
181-
RebarTrialVault.register(this, pm)
181+
RebarVault.register(this, pm)
182182
RebarLeaf.register(this, pm)
183183
RebarTargetBlock.register(this, pm)
184184
RebarComposter.register(this, pm)
@@ -188,7 +188,7 @@ object Rebar : JavaPlugin(), RebarAddon {
188188
RebarEnchantingTable.register(this, pm)
189189
RebarRedstoneBlock.register(this, pm)
190190
RebarInteractBlock.register(this, pm)
191-
RebarSneakableBlock.register(this, pm)
191+
RebarSneakBlock.register(this, pm)
192192
RebarJobBlock.register(this, pm)
193193
RebarJumpBlock.register(this, pm)
194194
RebarUnloadBlock.register(this, pm)

rebar/src/main/kotlin/io/github/pylonmc/rebar/block/BlockStorage.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,15 @@ object BlockStorage : Listener {
215215

216216
/**
217217
* Returns whether the block at [block] is a Rebar block.
218-
* Returns false if the chunk at [blockPosition] is not loaded.
218+
* Returns false if the chunk at [block] is not loaded.
219219
*/
220220
@JvmStatic
221221
fun isRebarBlock(block: Block): Boolean =
222222
(block.position.chunk.isLoaded) && get(block) != null
223223

224224
/**
225225
* Returns whether the block at [location] is a Rebar block
226-
* Returns false if the chunk at [blockPosition] is not loaded.
226+
* Returns false if the chunk at [location] is not loaded.
227227
*/
228228
@JvmStatic
229229
fun isRebarBlock(location: Location): Boolean =

rebar/src/main/kotlin/io/github/pylonmc/rebar/block/base/RebarBeacon.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import io.papermc.paper.event.block.BeaconActivatedEvent
1212
import io.papermc.paper.event.block.BeaconDeactivatedEvent
1313
import io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent
1414
import org.bukkit.event.EventPriority
15+
import org.jetbrains.annotations.ApiStatus
1516

1617
@Suppress("unused")
1718
interface RebarBeacon {
@@ -20,6 +21,7 @@ interface RebarBeacon {
2021
fun onEffectChange(event: PlayerChangeBeaconEffectEvent, priority: EventPriority) {}
2122
fun onEffectApply(event: BeaconEffectEvent, priority: EventPriority) {}
2223

24+
@ApiStatus.Internal
2325
companion object : MultiListener {
2426
@UniversalHandler
2527
private fun onBeaconActivate(event: BeaconActivatedEvent, priority: EventPriority) {

rebar/src/main/kotlin/io/github/pylonmc/rebar/block/base/RebarBell.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import io.github.pylonmc.rebar.event.api.annotation.UniversalHandler
99
import org.bukkit.event.EventPriority
1010
import org.bukkit.event.block.BellResonateEvent
1111
import org.bukkit.event.block.BellRingEvent
12+
import org.jetbrains.annotations.ApiStatus
1213

1314
interface RebarBell {
1415
fun onRing(event: BellRingEvent, priority: EventPriority) {}
1516
fun onResonate(event: BellResonateEvent, priority: EventPriority) {}
1617

18+
@ApiStatus.Internal
1719
companion object : MultiListener {
1820
@UniversalHandler
1921
private fun onBellRing(event: BellRingEvent, priority: EventPriority) {

rebar/src/main/kotlin/io/github/pylonmc/rebar/block/base/RebarBreakHandler.kt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,34 @@ import org.bukkit.event.block.BlockBreakEvent
55
import org.bukkit.inventory.ItemStack
66

77
interface RebarBreakHandler {
8+
89
/**
910
* Called before the block is broken. Note this is not called for [Deletions][BlockBreakContext.Delete]
1011
* as those are not cancellable.
1112
*
12-
* In the case of a vanilla [BlockBreakEvent] this is called at the lowest priority
13+
* In the case of a vanilla [BlockBreakEvent] this is called at the lowest priority.
1314
*
14-
* @return If the block should be broken. If false, the break is cancelled.
15+
* @return True if the block should be broken, false if the block break should be cancelled.
1516
*/
1617
fun preBreak(context: BlockBreakContext): Boolean {
1718
return true
1819
}
1920

2021
/**
21-
* In the case of a vanilla [BlockBreakEvent] this is called during the monitor priority
22+
* Called as the block is being broken. At this point, the block break cannot be
23+
* cancelled, but the physical block has not yet been broken or removed from [io.github.pylonmc.rebar.block.BlockStorage].
24+
*
25+
* The main purpose of this is method to allow the block drops to be modified.
26+
*
27+
* In the case of a vanilla [BlockBreakEvent] this is called during the monitor priority.
2228
*/
2329
fun onBreak(drops: MutableList<ItemStack>, context: BlockBreakContext) {}
2430

2531
/**
26-
* In the case of a vanilla [BlockBreakEvent] this is called during the monitor priority
32+
* Called after the block has been broken. At this point, the block has been physically
33+
* removed, block drops have been dropped, and the block has been removed from [io.github.pylonmc.rebar.block.BlockStorage].
34+
*
35+
* In the case of a vanilla [BlockBreakEvent] this is called during the monitor priority.
2736
*/
2837
fun postBreak(context: BlockBreakContext) {}
2938
}

rebar/src/main/kotlin/io/github/pylonmc/rebar/block/base/RebarBrewingStand.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ import org.bukkit.event.EventPriority
1010
import org.bukkit.event.block.BlockCookEvent
1111
import org.bukkit.event.block.InventoryBlockStartEvent
1212
import org.bukkit.event.inventory.BrewingStandFuelEvent
13+
import org.jetbrains.annotations.ApiStatus
1314

1415
interface RebarBrewingStand {
1516
fun onStartBrewing(event: InventoryBlockStartEvent, priority: EventPriority) {}
1617
fun onFuel(event: BrewingStandFuelEvent, priority: EventPriority) {}
1718
fun onEndBrewing(event: BlockCookEvent, priority: EventPriority) {}
1819

20+
@ApiStatus.Internal
1921
companion object : MultiListener {
2022
@UniversalHandler
2123
private fun onStartCook(event: InventoryBlockStartEvent, priority: EventPriority) {

rebar/src/main/kotlin/io/github/pylonmc/rebar/block/base/RebarCampfire.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import io.github.pylonmc.rebar.event.api.annotation.UniversalHandler
99
import org.bukkit.event.EventPriority
1010
import org.bukkit.event.block.BlockCookEvent
1111
import org.bukkit.event.block.InventoryBlockStartEvent
12+
import org.jetbrains.annotations.ApiStatus
1213

1314
interface RebarCampfire {
1415
fun onStartCooking(event: InventoryBlockStartEvent, priority: EventPriority) {}
1516
fun onEndCooking(event: BlockCookEvent, priority: EventPriority) {}
1617

18+
@ApiStatus.Internal
1719
companion object : MultiListener {
1820
@UniversalHandler
1921
private fun onStartCook(event: InventoryBlockStartEvent, priority: EventPriority) {

rebar/src/main/kotlin/io/github/pylonmc/rebar/block/base/RebarCargoBlock.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ import kotlin.math.min
3333

3434
/**
3535
* Represents a block that can connect to cargo ducts and use them to interface
36-
* with other cargo RebarCargoBlocks.
36+
* with other RebarCargoBlocks.
3737
*
38-
* Each face can have one logistic group which cargo ducts connected to that face
39-
* are allowed to interface with
38+
* Each face can have one logistic group which cargo ducts (or other RebarCargoBlocks)
39+
* connected to that face are allowed to interface with.
4040
*
4141
* In your place constructor, you will need to call [addCargoLogisticGroup] for all
4242
* the block faces you want to be able to connect cargo ducts to, and also
@@ -53,7 +53,7 @@ interface RebarCargoBlock : RebarLogisticBlock, RebarEntityHolderBlock {
5353

5454
@ApiStatus.NonExtendable
5555
fun addCargoLogisticGroup(face: BlockFace, group: String) {
56-
cargoBlockData.groups.put(face, group)
56+
cargoBlockData.groups[face] = group
5757
}
5858

5959
@ApiStatus.NonExtendable
@@ -84,15 +84,17 @@ interface RebarCargoBlock : RebarLogisticBlock, RebarEntityHolderBlock {
8484
@ApiStatus.NonExtendable
8585
get() = cargoBlockData.transferRate
8686

87+
@ApiStatus.NonExtendable
8788
fun onDuctConnected(event: RebarCargoConnectEvent, priority: EventPriority) {}
8889

90+
@ApiStatus.NonExtendable
8991
fun onDuctDisconnected(event: RebarCargoDisconnectEvent, priority: EventPriority) {}
9092

9193
/**
9294
* Checks if the block can connect to any adjacent cargo blocks, and if so, creates
9395
* a duct display between this block and the adjacent cargo block in question.
9496
*/
95-
@ApiStatus.NonExtendable
97+
@ApiStatus.Internal
9698
fun updateDirectlyConnectedFaces() {
9799
for (face in IMMEDIATE_FACES) {
98100
// We iterate IMMEDIATE_FACES instead of [cargoBlockData.groups] in case [cargoBlockData.groups] is
@@ -127,6 +129,7 @@ interface RebarCargoBlock : RebarLogisticBlock, RebarEntityHolderBlock {
127129
}
128130
}
129131

132+
@ApiStatus.Internal
130133
fun tickCargo() {
131134
for ((face, group) in cargoBlockData.groups) {
132135
val sourceGroup = getLogisticGroup(group)
@@ -149,6 +152,7 @@ interface RebarCargoBlock : RebarLogisticBlock, RebarEntityHolderBlock {
149152
}
150153
}
151154

155+
@ApiStatus.Internal
152156
fun tickCargoFace(sourceGroup: LogisticGroup, targetGroup: LogisticGroup) {
153157
for (sourceSlot in sourceGroup.slots) {
154158
val sourceStack = sourceSlot.getItemStack()

rebar/src/main/kotlin/io/github/pylonmc/rebar/block/base/RebarCauldron.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import io.github.pylonmc.rebar.event.api.annotation.MultiHandlers
88
import io.github.pylonmc.rebar.event.api.annotation.UniversalHandler
99
import org.bukkit.event.EventPriority
1010
import org.bukkit.event.block.CauldronLevelChangeEvent
11+
import org.jetbrains.annotations.ApiStatus
1112

1213
interface RebarCauldron {
1314
fun onLevelChange(event: CauldronLevelChangeEvent, priority: EventPriority) {}
1415

16+
@ApiStatus.Internal
1517
companion object : MultiListener {
1618
@UniversalHandler
1719
private fun onCauldronLevelChange(event: CauldronLevelChangeEvent, priority: EventPriority) {

rebar/src/main/kotlin/io/github/pylonmc/rebar/block/base/RebarComposter.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import io.github.pylonmc.rebar.event.api.annotation.UniversalHandler
99
import io.papermc.paper.event.block.CompostItemEvent
1010
import io.papermc.paper.event.entity.EntityCompostItemEvent
1111
import org.bukkit.event.EventPriority
12+
import org.jetbrains.annotations.ApiStatus
1213

1314
interface RebarComposter {
1415
fun onCompostByHopper(event: CompostItemEvent, priority: EventPriority) {}
1516
fun onCompostByEntity(event: EntityCompostItemEvent, priority: EventPriority) {}
1617

18+
@ApiStatus.Internal
1719
companion object : MultiListener {
1820
@UniversalHandler
1921
private fun onCompostByHopper(event: CompostItemEvent, priority: EventPriority) {

0 commit comments

Comments
 (0)