-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from Y2Kwastaken/module/extinguish
Add Extinguish Module
- Loading branch information
Showing
2 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
.../main/kotlin/com/github/spigotbasics/modules/basicsextinguish/BasicsExtinguishExecutor.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,25 @@ | ||
package com.github.spigotbasics.modules.basicsextinguish | ||
|
||
import com.github.spigotbasics.core.command.parsed.CommandContextExecutor | ||
import com.github.spigotbasics.core.command.parsed.context.MapContext | ||
import org.bukkit.command.CommandSender | ||
import org.bukkit.entity.Player | ||
|
||
class BasicsExtinguishExecutor(private val module: BasicsExtinguishModule) : CommandContextExecutor<MapContext> { | ||
override fun execute( | ||
sender: CommandSender, | ||
context: MapContext, | ||
) { | ||
val player = context["player"] as Player? ?: sender as Player? | ||
|
||
val msg = | ||
if (sender == player) { | ||
module.messageExtinguished | ||
} else { | ||
module.messageExtinguishedOther | ||
} | ||
|
||
player?.fireTicks = 0 | ||
msg.concerns(player).sendToSender(sender) | ||
} | ||
} |
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