@@ -3,6 +3,8 @@ package me.scoretwo.fastscript
33import me.scoretwo.fastscript.api.plugin.FastScriptMain
44import me.scoretwo.fastscript.api.script.ScriptManager
55import me.scoretwo.fastscript.commands.CommandManager
6+ import me.scoretwo.fastscript.config.MessageConfig
7+ import me.scoretwo.fastscript.config.SettingConfig
68import java.io.File
79
810class FastScript (main : FastScriptMain ) {
@@ -18,7 +20,7 @@ class FastScript(main: FastScriptMain) {
1820 fun hasPermission (sender : Any , string : String ) = main.hasPermission(sender, string)
1921 fun setPlaceholder (player : Any , string : String ) = main.setPlaceholder(player, string)
2022 fun sendMessage (sender : Any , string : String , colorIndex : Boolean ) = main.sendMessage(sender, string, colorIndex)
21- fun sendMessage ( sender : Any , strings : Array < String >, colorIndex : Boolean ) = strings.forEach { main.sendMessage(sender, it, colorIndex) }
23+ fun translateStringColors ( string : String ): String = main.translateStringColors(string)
2224
2325 init {
2426 CONSOLE = main.CONSOLE
@@ -72,6 +74,13 @@ class FastScript(main: FastScriptMain) {
7274 companion object {
7375 lateinit var instance: FastScript
7476 var CONSOLE = Any ()
77+
78+ fun setBootstrap (main : FastScriptMain ) {
79+ /* if (initialized) {
80+ throw UnsupportedOperationException("Cannot redefine instance")
81+ }*/
82+ instance = FastScript (main)
83+ }
7584/*
7685 @JvmStatic
7786 fun main(args: Array<out String>) {
@@ -136,23 +145,6 @@ class FastScript(main: FastScriptMain) {
136145 println()
137146 }
138147*/
139-
140- fun sendMessage (sender : Any , string : String , colorIndex : Boolean = false) {
141- instance.sendMessage(sender, string, colorIndex)
142- }
143- fun sendMessage (sender : Any , strings : Array <String >, colorIndex : Boolean = false) {
144- instance.sendMessage(sender, strings, colorIndex)
145- }
146-
147- fun setBootstrap (main : FastScriptMain ) {
148- if (instance != null ) {
149- throw UnsupportedOperationException (" Cannot redefine instance" )
150- }
151-
152- instance = FastScript (main)
153- }
154-
155-
156148 }
157149
158150}
@@ -163,12 +155,25 @@ fun Any.hasPermission(string: String): Boolean {
163155 return FastScript .instance.hasPermission(this , string)
164156}
165157
158+
159+ fun Any.sendMessage (formatHeader : FormatHeader , strings : Array <String >, colorIndex : Boolean = false) {
160+ strings.forEach {
161+ this .sendMessage(formatHeader, it, colorIndex)
162+ }
163+ }
164+
165+ fun Any.sendMessage (formatHeader : FormatHeader , string : String , colorIndex : Boolean = false) {
166+ this .sendMessage(" ${SettingConfig .instance.defaultLanguage.getLowerCaseYAMLObject(" FORMAT-HEADER" ).getLowerCaseString(formatHeader.name)}${string} " , colorIndex)
167+ }
168+
166169fun Any.sendMessage (string : String , colorIndex : Boolean = false) {
167170 FastScript .instance.sendMessage(this , string, colorIndex)
168171}
169172
170173fun Any.sendMessage (strings : Array <String >, colorIndex : Boolean = false) {
171- FastScript .instance.sendMessage(this , strings, colorIndex)
174+ strings.forEach {
175+ this .sendMessage(it, colorIndex)
176+ }
172177}
173178
174179fun String.setPlaceholder (sender : Any ): String {
0 commit comments