Added documentation

This commit is contained in:
bluefireoly
2020-07-15 14:56:12 +02:00
parent b6fa27c9a2
commit 48499bc1fe
3 changed files with 23 additions and 0 deletions

View File

@@ -10,6 +10,11 @@ import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.inventory.EquipmentSlot
import org.bukkit.inventory.ItemStack
/**
* Returns the item used in the interaction
* with the use of the [EquipmentSlot] returned
* by the value [PlayerInteractEntityEvent.hand].
*/
val PlayerInteractEntityEvent.interactItem: ItemStack?
get() {
val p: Player = this.player

View File

@@ -4,7 +4,16 @@ import org.bukkit.Material
import org.bukkit.event.inventory.PrepareItemCraftEvent
import org.bukkit.inventory.ItemStack
/**
* Checks if the event is "cancelled"
* by returning if the material of
* the result is equal to [Material.AIR].
*/
val PrepareItemCraftEvent.isCancelled: Boolean
get() = this.inventory.result?.type == Material.AIR
/**
* "Cancels" this event by
* setting the result to [Material.AIR].
*/
fun PrepareItemCraftEvent.cancel() { this.inventory.result = ItemStack(Material.AIR) }

View File

@@ -3,6 +3,15 @@ package net.axay.kspigot.main
import net.axay.kspigot.runnables.KRunnableHolder
import org.bukkit.plugin.java.JavaPlugin
/**
* This is the main instance of kSpigot.
*
* It should be initialized when a plugin using
* kSpigot gets enabled.
*
* Do not forget to call the [shutdown] method
* when your plugin gets disabled.
*/
class KSpigot(val plugin: JavaPlugin) {
val kRunnableHolder = KRunnableHolder()