diff --git a/common/src/main/kotlin/com/undefined/stellar/argument/SubCommandHandler.kt b/common/src/main/kotlin/com/undefined/stellar/argument/SubCommandHandler.kt index e73466c..ace3bf1 100644 --- a/common/src/main/kotlin/com/undefined/stellar/argument/SubCommandHandler.kt +++ b/common/src/main/kotlin/com/undefined/stellar/argument/SubCommandHandler.kt @@ -8,6 +8,7 @@ import com.undefined.stellar.argument.types.custom.OnlinePlayersArgument import com.undefined.stellar.argument.types.entity.EntityAnchorArgument import com.undefined.stellar.argument.types.entity.EntityArgument import com.undefined.stellar.argument.types.entity.EntityDisplayType +import com.undefined.stellar.argument.types.entity.PotionEffectTypeArgument import com.undefined.stellar.argument.types.item.ItemArgument import com.undefined.stellar.argument.types.item.ItemPredicateArgument import com.undefined.stellar.argument.types.item.ItemSlotArgument @@ -208,4 +209,7 @@ open class ArgumentHandler { fun addStructureTypeArgument(name: String): StructureTypeArgument = addArgument { StructureTypeArgument(base, name) } + fun addPotionEffectTypeArgument(name: String): PotionEffectTypeArgument = + addArgument { PotionEffectTypeArgument(base, name) } + } \ No newline at end of file diff --git a/common/src/main/kotlin/com/undefined/stellar/argument/types/entity/PotionEffectTypeArgument.kt b/common/src/main/kotlin/com/undefined/stellar/argument/types/entity/PotionEffectTypeArgument.kt new file mode 100644 index 0000000..24c8c76 --- /dev/null +++ b/common/src/main/kotlin/com/undefined/stellar/argument/types/entity/PotionEffectTypeArgument.kt @@ -0,0 +1,6 @@ +package com.undefined.stellar.argument.types.entity + +import com.undefined.stellar.AbstractStellarCommand +import com.undefined.stellar.argument.AbstractStellarArgument + +class PotionEffectTypeArgument(parent: AbstractStellarCommand<*>, name: String) : AbstractStellarArgument(parent, name) \ No newline at end of file diff --git a/server/src/main/kotlin/com/undefined/stellar/Main.kt b/server/src/main/kotlin/com/undefined/stellar/Main.kt index 289eaea..9fd17f2 100644 --- a/server/src/main/kotlin/com/undefined/stellar/Main.kt +++ b/server/src/main/kotlin/com/undefined/stellar/Main.kt @@ -1,16 +1,16 @@ package com.undefined.stellar import org.bukkit.entity.Player -import org.bukkit.generator.structure.StructureType import org.bukkit.plugin.java.JavaPlugin +import org.bukkit.potion.PotionEffectType class Main : JavaPlugin() { override fun onEnable() { val main = StellarCommand("test", description = "this is a description", "othertest") - main.addStructureTypeArgument("type") + main.addPotionEffectTypeArgument("type") .addExecution { - source.sendMessage(getArgument("type").key.toString()) + source.sendMessage(getArgument("type").key.toString()) } .register(this) } diff --git a/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt b/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt index 75d5c00..4fbda43 100644 --- a/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt +++ b/v1_20_6/src/main/kotlin/com/undefined/stellar/v1_20_6/ArgumentHelper.kt @@ -15,6 +15,7 @@ import com.undefined.stellar.argument.types.custom.CustomArgument import com.undefined.stellar.argument.types.custom.EnumArgument import com.undefined.stellar.argument.types.custom.ListArgument import com.undefined.stellar.argument.types.entity.EntityDisplayType +import com.undefined.stellar.argument.types.entity.PotionEffectTypeArgument import com.undefined.stellar.argument.types.item.ItemSlotArgument import com.undefined.stellar.argument.types.item.ItemSlotsArgument import com.undefined.stellar.argument.types.math.AxisArgument @@ -148,6 +149,7 @@ object ArgumentHelper { is UUIDArgument -> UuidArgument.uuid() is GameEventArgument -> ResourceKeyArgument.key(Registries.GAME_EVENT) is StructureTypeArgument -> ResourceKeyArgument.key(Registries.STRUCTURE_TYPE) + is PotionEffectTypeArgument -> ResourceKeyArgument.key(Registries.MOB_EFFECT) else -> throw UnsupportedArgumentException() } @@ -217,6 +219,7 @@ object ArgumentHelper { is UUIDArgument -> UuidArgument.getUuid(context, argument.name) is GameEventArgument -> org.bukkit.Registry.GAME_EVENT.get(getId(context, argument.name, Registries.GAME_EVENT)) is StructureTypeArgument -> org.bukkit.Registry.STRUCTURE_TYPE.get(getId(context, argument.name, Registries.STRUCTURE_TYPE)) + is PotionEffectTypeArgument -> org.bukkit.Registry.POTION_EFFECT_TYPE.get(getId(context, argument.name, Registries.MOB_EFFECT)) else -> throw UnsupportedArgumentException() } }