-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ๐ธ ๆฅๆฌ่ชๅใฎๆ็กใใณใใณใใงๅใๆฟใใงใใใใใซ
- Loading branch information
1 parent
d9a1481
commit 069b3d3
Showing
15 changed files
with
221 additions
and
13 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
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
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/io/github/bluesheep2804/selenechat/command/JapanizeCommand.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,22 @@ | ||
package io.github.bluesheep2804.selenechat.command | ||
|
||
import io.github.bluesheep2804.selenechat.player.SeleneChatPlayer | ||
import net.kyori.adventure.text.Component | ||
|
||
class JapanizeCommand : ICommand { | ||
override fun execute(sender: SeleneChatPlayer, args: Array<String>): Boolean { | ||
sender.toggleJapanize() | ||
sender.sendMessage(Component.text(sender.isEnabledJapanize)) | ||
return true | ||
} | ||
|
||
override fun suggest(sender: SeleneChatPlayer, args: Array<String>): List<String> { | ||
return emptyList() | ||
} | ||
|
||
companion object { | ||
const val COMMAND_NAME = "japanize" | ||
val COMMAND_ALIASES = arrayOf("jp") | ||
const val PERMISSION = "selenechat.command.japanize" | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/io/github/bluesheep2804/selenechat/command/JapanizeCommandBungee.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,28 @@ | ||
package io.github.bluesheep2804.selenechat.command | ||
|
||
import io.github.bluesheep2804.selenechat.SeleneChatBungee | ||
import io.github.bluesheep2804.selenechat.player.SeleneChatPlayerBungee | ||
import io.github.bluesheep2804.selenechat.player.SeleneChatPlayerBungeeConsole | ||
import net.md_5.bungee.api.CommandSender | ||
import net.md_5.bungee.api.connection.ProxiedPlayer | ||
import net.md_5.bungee.api.plugin.Command | ||
import net.md_5.bungee.api.plugin.TabExecutor | ||
|
||
class JapanizeCommandBungee(val plugin: SeleneChatBungee) : Command(JapanizeCommand.COMMAND_NAME, JapanizeCommand.PERMISSION, *JapanizeCommand.COMMAND_ALIASES), TabExecutor { | ||
val command = JapanizeCommand() | ||
override fun execute(commandSender: CommandSender, args: Array<String>) { | ||
val sender = when (commandSender) { | ||
is ProxiedPlayer -> SeleneChatPlayerBungee(commandSender) | ||
else -> SeleneChatPlayerBungeeConsole(commandSender) | ||
} | ||
command.execute(sender, args) | ||
} | ||
|
||
override fun onTabComplete(commandSender: CommandSender, args: Array<String>): List<String> { | ||
val sender = when (commandSender) { | ||
is ProxiedPlayer -> SeleneChatPlayerBungee(commandSender) | ||
else -> SeleneChatPlayerBungeeConsole(commandSender) | ||
} | ||
return command.suggest(sender, args) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/io/github/bluesheep2804/selenechat/command/JapanizeCommandSpigot.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,28 @@ | ||
package io.github.bluesheep2804.selenechat.command | ||
|
||
import io.github.bluesheep2804.selenechat.SeleneChatSpigot | ||
import io.github.bluesheep2804.selenechat.player.SeleneChatPlayerSpigot | ||
import io.github.bluesheep2804.selenechat.player.SeleneChatPlayerSpigotConsole | ||
import org.bukkit.command.* | ||
import org.bukkit.entity.Player | ||
|
||
class JapanizeCommandSpigot(val plugin: SeleneChatSpigot) :CommandExecutor, TabExecutor { | ||
val command = JapanizeCommand() | ||
override fun onCommand(commandSender: CommandSender, command: Command, label: String, args: Array<String>): Boolean { | ||
val sender = when (commandSender) { | ||
is Player -> SeleneChatPlayerSpigot(commandSender) | ||
is ConsoleCommandSender -> SeleneChatPlayerSpigotConsole(commandSender) | ||
else -> return false | ||
} | ||
return this.command.execute(sender, args) | ||
} | ||
|
||
override fun onTabComplete(commandSender: CommandSender, command: Command, label: String, args: Array<String>): List<String> { | ||
val sender = when (commandSender) { | ||
is Player -> SeleneChatPlayerSpigot(commandSender) | ||
is ConsoleCommandSender -> SeleneChatPlayerSpigotConsole(commandSender) | ||
else -> return emptyList() | ||
} | ||
return this.command.suggest(sender, args) | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/kotlin/io/github/bluesheep2804/selenechat/command/JapanizeCommandVelocity.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,37 @@ | ||
package io.github.bluesheep2804.selenechat.command | ||
|
||
import com.velocitypowered.api.command.SimpleCommand | ||
import com.velocitypowered.api.command.SimpleCommand.Invocation | ||
import com.velocitypowered.api.proxy.ConsoleCommandSource | ||
import com.velocitypowered.api.proxy.Player | ||
import io.github.bluesheep2804.selenechat.SeleneChatVelocity | ||
import io.github.bluesheep2804.selenechat.player.SeleneChatPlayerVelocity | ||
import io.github.bluesheep2804.selenechat.player.SeleneChatPlayerVelocityConsole | ||
|
||
class JapanizeCommandVelocity(val plugin: SeleneChatVelocity) : SimpleCommand { | ||
val command = JapanizeCommand() | ||
override fun execute(invocation: Invocation) { | ||
val source = invocation.source() | ||
val args = invocation.arguments() | ||
val sender = when (source) { | ||
is Player -> SeleneChatPlayerVelocity(source) | ||
is ConsoleCommandSource -> SeleneChatPlayerVelocityConsole(source) | ||
else -> return | ||
} | ||
command.execute(sender, args) | ||
} | ||
|
||
override fun hasPermission(invocation: Invocation): Boolean { | ||
return invocation.source().hasPermission(JapanizeCommand.PERMISSION) | ||
} | ||
|
||
override fun suggest(invocation: Invocation): List<String> { | ||
val sender = when (val source = invocation.source()) { | ||
is Player -> SeleneChatPlayerVelocity(source) | ||
is ConsoleCommandSource -> SeleneChatPlayerVelocityConsole(source) | ||
else -> return emptyList() | ||
} | ||
val args = if (invocation.arguments().isNotEmpty()) invocation.arguments() else invocation.arguments() + "" | ||
return command.suggest(sender, args) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/io/github/bluesheep2804/selenechat/japanize/JapanizePlayers.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,9 @@ | ||
package io.github.bluesheep2804.selenechat.japanize | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class JapanizePlayers( | ||
val enable: MutableList<String> = mutableListOf(), | ||
val disable: MutableList<String> = mutableListOf() | ||
) |
35 changes: 35 additions & 0 deletions
35
src/main/kotlin/io/github/bluesheep2804/selenechat/japanize/JapanizePlayersManager.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,35 @@ | ||
package io.github.bluesheep2804.selenechat.japanize | ||
|
||
import com.charleskorn.kaml.Yaml | ||
import java.io.File | ||
import java.io.FileInputStream | ||
import java.io.FileOutputStream | ||
|
||
class JapanizePlayersManager(private val file: File) { | ||
lateinit var japanizePlayers: JapanizePlayers | ||
init { | ||
reload() | ||
} | ||
fun reload() { | ||
val japanizeFile = File(file, "jp.yml") | ||
if (!file.exists()) { | ||
file.mkdir() | ||
} | ||
if (!japanizeFile.exists()) { | ||
japanizeFile.createNewFile() | ||
val japanizePlayers = JapanizePlayers() | ||
val output = FileOutputStream(japanizeFile) | ||
Yaml.default.encodeToStream(JapanizePlayers.serializer(), japanizePlayers, output) | ||
} | ||
val japanizeFileInputStream = FileInputStream(japanizeFile) | ||
japanizePlayers = Yaml.default.decodeFromStream(JapanizePlayers.serializer(), japanizeFileInputStream) | ||
} | ||
fun save() { | ||
val japanizeFile = File(file, "jp.yml") | ||
if (!file.exists()) { | ||
file.mkdir() | ||
} | ||
val output = FileOutputStream(japanizeFile) | ||
Yaml.default.encodeToStream(JapanizePlayers.serializer(), japanizePlayers, output) | ||
} | ||
} |
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
Oops, something went wrong.