-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
core/src/main/kotlin/com/willfp/libreforge/effects/impl/EffectSetCustomModelData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.willfp.libreforge.effects.impl | ||
|
||
import com.willfp.eco.core.config.interfaces.Config | ||
import com.willfp.libreforge.NoCompileData | ||
import com.willfp.libreforge.arguments | ||
import com.willfp.libreforge.effects.Effect | ||
import com.willfp.libreforge.getIntFromExpression | ||
import com.willfp.libreforge.triggers.TriggerData | ||
import com.willfp.libreforge.triggers.TriggerParameter | ||
|
||
object EffectSetCustomModelData : Effect<NoCompileData>("set_custom_model_data") { | ||
override val parameters = setOf( | ||
TriggerParameter.ITEM | ||
) | ||
|
||
override val arguments = arguments { | ||
require("model", "You must specify the custom model data ID!") | ||
} | ||
|
||
override fun onTrigger(config: Config, data: TriggerData, compileData: NoCompileData): Boolean { | ||
val item = data.item ?: return false | ||
val meta = item.itemMeta ?: return false | ||
|
||
meta.setCustomModelData(config.getIntFromExpression("model", data)) | ||
item.itemMeta = meta | ||
|
||
return true | ||
} | ||
} |