-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement identity return command, visibility action and more.
- Loading branch information
1 parent
b7fd371
commit 9a4d327
Showing
7 changed files
with
62 additions
and
16 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
28 changes: 23 additions & 5 deletions
28
src/main/kotlin/live/ixnoah/tapactions/actions/GeneralActions.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 |
---|---|---|
@@ -1,21 +1,39 @@ | ||
package live.ixnoah.tapactions.actions | ||
|
||
import CommandQueue | ||
import live.ixnoah.tapactions.ActionManager | ||
import live.ixnoah.tapactions.wrappers.Scoreboard | ||
|
||
class GeneralActions { | ||
object GeneralActions { | ||
private val nameRegex = Regex("^[0-9A-z '\"!@#\$%^*?]{0,20}\$") | ||
var hasStatedIdentity = false | ||
|
||
/** This can be used to show the identity of a house, like name, links & description! :D */ | ||
/** This can be used to show the identity of a house, like name, links & description! */ | ||
private val actionIdentity = { params : MutableMap<String, String> -> | ||
val paramName = params["name"] ?: "Housing" | ||
if (!hasStatedIdentity) { | ||
hasStatedIdentity = true | ||
val paramName = params["name"] ?: "Housing" | ||
|
||
if (nameRegex.containsMatchIn(paramName)) { | ||
Scoreboard.setTitle("§e§l" + paramName.uppercase()) | ||
if (nameRegex.containsMatchIn(paramName)) { | ||
Scoreboard.setTitle("§e§l" + paramName.uppercase()) | ||
} | ||
|
||
if (params["run"] !== null) { | ||
CommandQueue.pushCommand("house:${params["run"]}") | ||
} | ||
} | ||
} | ||
|
||
private val actionVisibility = { params : MutableMap<String, String> -> | ||
val paramVis : Int? = params["max"]?.toIntOrNull() | ||
|
||
if (paramVis !== null) { | ||
CommandQueue.pushCommand("visibility $paramVis") | ||
} | ||
} | ||
|
||
fun deploy() { | ||
ActionManager.registerAction("tap:identity", actionIdentity) | ||
ActionManager.registerAction("tap:visibility", actionVisibility) | ||
} | ||
} |
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
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
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
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/live/ixnoah/tapactions/events/ClientTick.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,17 @@ | ||
package live.ixnoah.tapactions.events | ||
|
||
import CommandQueue | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent | ||
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent | ||
|
||
class ClientTick { | ||
private var tick = 0; | ||
|
||
@SubscribeEvent | ||
fun onEvent(event: ClientTickEvent) { | ||
if (tick > 20) tick = 0 | ||
tick += 1 | ||
|
||
CommandQueue.onTick(tick) | ||
} | ||
} |
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