-
Notifications
You must be signed in to change notification settings - Fork 51
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 #134 from rlqu/revamp/chat-tab-module
- Loading branch information
Showing
13 changed files
with
141 additions
and
63 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
51 changes: 51 additions & 0 deletions
51
...hat-tab/src/main/kotlin/eu/thesimplecloud/module/prefix/manager/command/ChatTabCommand.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,51 @@ | ||
package eu.thesimplecloud.module.prefix.manager.command | ||
|
||
import eu.thesimplecloud.api.CloudAPI | ||
import eu.thesimplecloud.api.command.ICommandSender | ||
import eu.thesimplecloud.api.player.ICloudPlayer | ||
import eu.thesimplecloud.launcher.console.command.CommandType | ||
import eu.thesimplecloud.launcher.console.command.ICommandHandler | ||
import eu.thesimplecloud.launcher.console.command.annotations.Command | ||
import eu.thesimplecloud.launcher.console.command.annotations.CommandArgument | ||
import eu.thesimplecloud.launcher.console.command.annotations.CommandSubPath | ||
import eu.thesimplecloud.launcher.console.command.provider.ServiceGroupCommandSuggestionProvider | ||
import eu.thesimplecloud.module.prefix.manager.config.ChatTabConfig | ||
import java.util.* | ||
|
||
@Command(name = "chat-tab", CommandType.CONSOLE_AND_INGAME, "cloud.module.chat-tab") | ||
class ChatTabCommand : ICommandHandler { | ||
|
||
@CommandSubPath("set <group> <delay>", "Sets the delay for the given group") | ||
fun executeSetDelayWithGroup( | ||
commandSender: ICommandSender, | ||
@CommandArgument("group", ServiceGroupCommandSuggestionProvider::class) group: String, | ||
@CommandArgument("delay") delay: String | ||
) { | ||
|
||
if (CloudAPI.instance.getCloudServiceGroupManager().getServiceGroupByName(group) == null) { | ||
commandSender.sendProperty("module.chat-tab.command.chat-tab.group-not-exist") | ||
return | ||
} | ||
|
||
val config = CloudAPI.instance.getGlobalPropertyHolder().getProperty<ChatTabConfig>("prefix-config")?.getValue() ?: return | ||
config.delay[group] = delay.toLongOrNull() ?: 0L | ||
config.update() | ||
|
||
commandSender.sendProperty("module.chat-tab.command.chat-tab.delay-set-success", group, delay) | ||
} | ||
|
||
@CommandSubPath("set <delay>", "Sets the delay for the current group you're online on") | ||
fun executeSetDelayWithPlayerGroup( | ||
commandSender: ICommandSender, | ||
@CommandArgument("delay") delay: String | ||
) { | ||
|
||
if (commandSender !is ICloudPlayer) { | ||
commandSender.sendProperty("module.chat-tab.command.chat-tab.no-player") | ||
return | ||
} | ||
|
||
executeSetDelayWithGroup(commandSender, commandSender.getConnectedServer()!!.getGroupName(), delay) | ||
} | ||
} | ||
|
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
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
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
6 changes: 6 additions & 0 deletions
6
simplecloud-modules/simplecloud-module-chat-tab/src/main/resources/languages/de.json
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,6 @@ | ||
{ | ||
"module.chat-tab.command.chat-tab.group-not-exist": "§cDie Gruppe wurde nicht gefunden.", | ||
"module.chat-tab.command.chat-tab.delay-set-success": "§7Setze die Verzögerung für %SERVICE% auf %DELAY% ticks.", | ||
"module.chat-tab.command.chat-tab.no-player": "§cHierfür musst du ein Spieler sein.", | ||
"module.chat-tab.command.chat-tab.get-group-failed": "§cKonnte die Gruppe nicht finden, auf dem du online bist." | ||
} |
6 changes: 6 additions & 0 deletions
6
simplecloud-modules/simplecloud-module-chat-tab/src/main/resources/languages/en.json
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,6 @@ | ||
{ | ||
"module.chat-tab.command.chat-tab.group-not-exist": "§cGroup not found.", | ||
"module.chat-tab.command.chat-tab.delay-set-success": "§7Set the delay for %SERVICE% to %DELAY% ticks.", | ||
"module.chat-tab.command.chat-tab.no-player": "§cYou have to be a player to do this.", | ||
"module.chat-tab.command.chat-tab.get-group-failed": "§cCouldn't find the group you're online on." | ||
} |
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