├── libs └── libzt-1.8.10.jar ├── src └── multiplayer │ ├── Link.kt │ ├── Server.kt │ ├── Main.kt │ ├── dialogs │ └── JoinRoomDialog.kt │ └── ZeroTierNet.kt ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── .gitignore ├── .idea └── .gitignore ├── mod.hjson ├── .github └── workflows │ └── gradle.yml └── gradlew /libs/libzt-1.8.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cong0707/multiplayer/HEAD/libs/libzt-1.8.10.jar -------------------------------------------------------------------------------- /src/multiplayer/Link.kt: -------------------------------------------------------------------------------- 1 | package multiplayer 2 | 3 | data class Link(val ip: String, val port: Int) -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cong0707/multiplayer/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/multiplayer/Server.kt: -------------------------------------------------------------------------------- 1 | package multiplayer 2 | 3 | import kotlinx.serialization.Serializable 4 | 5 | @Serializable 6 | data class Server(val address: String, val port: Int) -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | systemProp.http.proxyHost=127.0.0.1 2 | systemProp.http.proxyPort=7890 3 | 4 | systemProp.https.proxyHost=127.0.0.1 5 | systemProp.https.proxyPort=7890 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/* 2 | .settings/* 3 | .vscode/* 4 | .idea/* 5 | 6 | bin/* 7 | lib/* 8 | build/* 9 | 10 | *.classpath 11 | *.project 12 | *.bat 13 | *.xml 14 | *.directory 15 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # 默认忽略的文件 2 | /shelf/ 3 | /workspace.xml 4 | # 基于编辑器的 HTTP 客户端请求 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /mod.hjson: -------------------------------------------------------------------------------- 1 | name: multiplayer, 2 | displayName: 联机, 3 | subtitle: 通过multiplayer service进行联机, 4 | description: 通过multiplayer service进行联机, 5 | author: "[#0096FF]xzxADIxzx 由cong重写并改进", 6 | minGameVersion: 146, 7 | version: 2.0, 8 | hidden: true, 9 | main: multiplayer.Main -------------------------------------------------------------------------------- /.github/workflows/gradle.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | buildJar: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: Set up PATH 12 | run: | 13 | echo "${ANDROID_HOME}/build-tools/34.0.0" >> $GITHUB_PATH 14 | - name: Set up JDK 17 15 | uses: actions/setup-java@v1 16 | with: 17 | java-version: 17 18 | - name: Build mod jar 19 | run: ./gradlew deploy 20 | - name: Upload built jar file 21 | uses: actions/upload-artifact@v2 22 | with: 23 | name: ${{ github.event.repository.name }} 24 | path: build/libs/${{ github.event.repository.name }}.jar -------------------------------------------------------------------------------- /src/multiplayer/Main.kt: -------------------------------------------------------------------------------- 1 | package multiplayer 2 | 3 | import arc.Core 4 | import mindustry.Vars 5 | import mindustry.mod.Mod 6 | import mindustry.net.ArcNetProvider 7 | import mindustry.net.Net 8 | import multiplayer.dialogs.JoinRoomDialog 9 | 10 | @Suppress("unused") 11 | class Main : Mod() { 12 | 13 | 14 | override fun init() { 15 | Vars.net = Net(ZeroTierNet(ArcNetProvider())) 16 | joinViaClaj = JoinRoomDialog() 17 | 18 | } 19 | 20 | companion object { 21 | var joinViaClaj: JoinRoomDialog? = null 22 | fun copy(text: String?) { 23 | if (text == null) return 24 | 25 | Core.app.clipboardText = text 26 | Vars.ui.showInfoFade("@copied") 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/multiplayer/dialogs/JoinRoomDialog.kt: -------------------------------------------------------------------------------- 1 | package multiplayer.dialogs 2 | 3 | import arc.scene.ui.layout.Stack 4 | import arc.scene.ui.layout.Table 5 | import mindustry.Vars 6 | import mindustry.core.NetClient.connect 7 | import mindustry.gen.Icon 8 | import mindustry.ui.dialogs.BaseDialog 9 | import multiplayer.Link 10 | import java.io.IOException 11 | 12 | class JoinRoomDialog : BaseDialog("通过组网加入游戏") { 13 | private var lastLink: String = "请输入您的房间代码" 14 | 15 | private var valid: Boolean = false 16 | private var output: String? = null 17 | 18 | init { 19 | cont.table { table: Table -> 20 | table.add("房间代码:").padRight(5f).left() 21 | table.field(lastLink) { link: String -> this.setLink(link) }.size(550f, 54f).maxTextLength(100).valid { link: String -> this.setLink(link) } 22 | }.row() 23 | 24 | cont.label { output }.width(550f).left() 25 | 26 | buttons.defaults().size(140f, 60f).pad(4f) 27 | buttons.button("@cancel") { this.hide() } 28 | buttons.button("@ok") { 29 | try { 30 | if (Vars.player.name.trim { it <= ' ' }.isEmpty()) { 31 | Vars.ui.showInfo("@noname") 32 | return@button 33 | } 34 | 35 | val link = parseLink(lastLink) 36 | connect(link.ip, link.port).also { 37 | Vars.ui.join.hide() 38 | hide() 39 | } 40 | 41 | Vars.ui.loadfrag.show("@connecting") 42 | Vars.ui.loadfrag.setButton { 43 | Vars.ui.loadfrag.hide() 44 | Vars.netClient.disconnectQuietly() 45 | } 46 | } catch (e: Throwable) { 47 | Vars.ui.showErrorMessage(e.message) 48 | } 49 | }.disabled { lastLink.isEmpty() || Vars.net.active() } 50 | 51 | fixJoinDialog() 52 | } 53 | 54 | private fun setLink(link: String): Boolean { 55 | if (lastLink == link) return valid 56 | 57 | try { 58 | parseLink(link) 59 | 60 | output = "[lime]代码格式正确, 点击下方按钮尝试连接!" 61 | valid = true 62 | } catch (ignored: Throwable) { 63 | output = ignored.message 64 | valid = false 65 | } 66 | 67 | lastLink = link 68 | return valid 69 | } 70 | 71 | private fun fixJoinDialog() { 72 | val stack = Vars.ui.join.children[1] as Stack 73 | val root = stack.children[1] as Table 74 | 75 | root.button("通过claj代码加入游戏", Icon.play) { this.show() } 76 | 77 | if (!Vars.steam && !Vars.mobile) root.cells.insert(4, root.cells.remove(6)) 78 | else root.cells.insert(3, root.cells.remove(4)) 79 | } 80 | 81 | @Throws(IOException::class) 82 | private fun parseLink(link: String): Link { 83 | var link1 = link 84 | link1 = link1.trim { it <= ' ' } 85 | if (!link1.startsWith("ZeroTier")) throw IOException("无效的ZeroTier代码:无ZeroTier前缀") 86 | 87 | // 找到冒号的位置 88 | val colonIndex = link.indexOf(':') 89 | // 提取IP地址部分(去掉前面的"ZeroTier") 90 | val ip = "zerotier:" + link.substring(8, colonIndex) 91 | // 提取端口部分 92 | val port = link.substring(colonIndex + 1).toInt() 93 | 94 | return Link(ip, port) 95 | } 96 | } -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /src/multiplayer/ZeroTierNet.kt: -------------------------------------------------------------------------------- 1 | package multiplayer 2 | 3 | import arc.ApplicationListener 4 | import arc.Core 5 | import arc.Events 6 | import arc.func.Cons 7 | import arc.util.Log 8 | import arc.util.Threads 9 | import com.zerotier.sockets.ZeroTierNative.zts_util_delay 10 | import com.zerotier.sockets.ZeroTierNode 11 | import com.zerotier.sockets.ZeroTierServerSocket 12 | import com.zerotier.sockets.ZeroTierSocket 13 | import mindustry.Vars.net 14 | import mindustry.game.EventType.ClientLoadEvent 15 | import mindustry.net.ArcNetProvider.PacketSerializer 16 | import mindustry.net.Host 17 | import mindustry.net.Net.NetProvider 18 | import mindustry.net.NetConnection 19 | import mindustry.net.Packet 20 | import mindustry.net.Packets.Connect 21 | import java.math.BigInteger 22 | import java.net.InetAddress 23 | import java.nio.ByteBuffer 24 | import java.util.concurrent.CopyOnWriteArrayList 25 | 26 | fun InetAddress.format() = "zerotier:$this" 27 | fun String.toZeroTierLong(): Long { 28 | val id = BigInteger(this, 16) 29 | return id.toLong() 30 | } 31 | 32 | class ZeroTierNet(val provider: NetProvider) : NetProvider { 33 | lateinit var serverThreads: Thread 34 | lateinit var socket: ZeroTierSocket 35 | var isZeroTierClient: Boolean = false 36 | 37 | val networkId = "6ab565387a0d0396".toZeroTierLong() 38 | val networkMoons = listOf("7458bf01d0") 39 | 40 | class ServerListener(private val socket: ZeroTierServerSocket) : Runnable { 41 | override fun run() { 42 | try { 43 | val clientSocket = socket.accept() 44 | val connection = ZeroTierConnection(clientSocket) 45 | val connect = Connect() 46 | connect.addressTCP = clientSocket.inetAddress.format() 47 | Log.info("&bReceived ZeroTier connection: @", connect.addressTCP); 48 | zerotierConnections.add(connection) 49 | net.handleServerReceived(connection, connect) 50 | } catch (e: Throwable) { 51 | Log.err(e); 52 | } 53 | } 54 | } 55 | 56 | init { 57 | val node = ZeroTierNode() 58 | node.start() 59 | while (!node.isOnline) { 60 | zts_util_delay(50); 61 | } 62 | node.join(networkId) 63 | Log.info("Join network") 64 | while (!node.isNetworkTransportReady(networkId)) { 65 | zts_util_delay(50) 66 | } 67 | Log.info("Join successful") 68 | 69 | // IPv4 70 | val addr4 = node.getIPv4Address(networkId) 71 | println("IPv4 address = " + addr4.hostAddress) 72 | 73 | // IPv6 74 | val addr6 = node.getIPv6Address(networkId) 75 | println("IPv6 address = " + addr6.hostAddress) 76 | 77 | // MAC address 78 | System.out.println("MAC address = " + node.getMACAddress(networkId)) 79 | 80 | 81 | Events.on(ClientLoadEvent::class.java) { 82 | Core.app.addListener(object : ApplicationListener { 83 | override fun update() { 84 | if (net.client() && ::socket.isInitialized) { 85 | val bytesRead = socket.inputStream.read(readBuffer.array()) 86 | if (bytesRead != -1) { 87 | readBuffer.position(0).limit(readBuffer.capacity()) 88 | readCopyBuffer.position(0) 89 | readCopyBuffer.put(readBuffer) 90 | readCopyBuffer.position(0) 91 | 92 | val output = serializer.read(readCopyBuffer) 93 | 94 | //it may be theoretically possible for this to be a framework message, if the packet is malicious or corrupted 95 | if (output is Packet) { 96 | try { 97 | net.handleClientReceived(output) 98 | } catch (t: Throwable) { 99 | net.handleException(t) 100 | } 101 | } 102 | } 103 | } 104 | } 105 | }) 106 | } 107 | 108 | } 109 | 110 | //input = socket.inputStream 111 | //output = socket.outputStream 112 | 113 | override fun connectClient(ip: String?, port: Int, success: Runnable?) { 114 | if (ip!!.startsWith("zerotier:")) { 115 | val lobbyname = ip.substring("zerotier:".length) 116 | try { 117 | socket = ZeroTierSocket(lobbyname, port) 118 | Log.info("Connected ZeroTier server") 119 | } catch (e: Exception) { 120 | Log.err("Zerotier connect error", e) 121 | } 122 | } else { 123 | provider.connectClient(ip, port, success) 124 | } 125 | } 126 | 127 | override fun sendClient(`object`: Any?, reliable: Boolean) { 128 | if (isZeroTierClient && ::socket.isInitialized) { 129 | if (socket.isClosed) { 130 | Log.info("Not connected, quitting.") 131 | return 132 | } 133 | 134 | try { 135 | writeBuffer.limit(writeBuffer.capacity()) 136 | writeBuffer.position(0) 137 | serializer.write(writeBuffer, `object`) 138 | val length = writeBuffer.position() 139 | writeBuffer.flip() 140 | 141 | val byteArray = ByteArray(writeBuffer.remaining()) 142 | writeBuffer.get(byteArray) 143 | socket.outputStream.write(byteArray) 144 | } catch (e: java.lang.Exception) { 145 | net.showError(e) 146 | } 147 | } else { 148 | provider.sendClient(`object`, reliable) 149 | } 150 | } 151 | 152 | override fun disconnectClient() { 153 | if (::socket.isInitialized) { 154 | if (!socket.isClosed) socket.close() 155 | } 156 | } 157 | 158 | override fun discoverServers(callback: Cons?, done: Runnable?) { 159 | Core.app.post(done) 160 | } 161 | 162 | override fun pingHost(address: String?, port: Int, valid: Cons?, failed: Cons?) { 163 | return provider.pingHost(address, port, valid, failed) 164 | } 165 | 166 | override fun hostServer(port: Int) { 167 | provider.hostServer(port) 168 | serverThreads = Threads.daemon { ServerListener(ZeroTierServerSocket(port)) } 169 | Log.info("Hosting Zerotier server on port @", port) 170 | } 171 | 172 | override fun getConnections(): MutableIterable { 173 | //merge provider connections 174 | val connectionsOut: CopyOnWriteArrayList = CopyOnWriteArrayList(zerotierConnections) 175 | for (c in provider.connections) connectionsOut.add(c) 176 | return connectionsOut 177 | } 178 | 179 | override fun closeServer() { 180 | if (::serverThreads.isInitialized) { 181 | if (!serverThreads.isInterrupted) serverThreads.interrupt() 182 | } 183 | provider.closeServer() 184 | } 185 | 186 | companion object { 187 | val serializer = PacketSerializer() 188 | val writeBuffer: ByteBuffer = ByteBuffer.allocateDirect(16384) 189 | val readBuffer: ByteBuffer = ByteBuffer.allocateDirect(16384) 190 | val readCopyBuffer: ByteBuffer = ByteBuffer.allocate(writeBuffer.capacity()) 191 | 192 | val zerotierConnections: MutableList = mutableListOf() 193 | } 194 | 195 | class ZeroTierConnection(val socket: ZeroTierSocket) : NetConnection("zerotier:" + socket.remoteAddress) { 196 | init { 197 | Log.info("Created Zerotier connection: @", socket.remoteAddress) 198 | } 199 | 200 | override fun send(`object`: Any, reliable: Boolean) { 201 | try { 202 | writeBuffer.limit(writeBuffer.capacity()) 203 | writeBuffer.position(0) 204 | serializer.write(writeBuffer, `object`) 205 | val length: Int = writeBuffer.position() 206 | writeBuffer.flip() 207 | 208 | val byteArray = ByteArray(writeBuffer.remaining()) 209 | writeBuffer.get(byteArray) 210 | socket.outputStream.write(byteArray) 211 | } catch (e: java.lang.Exception) { 212 | Log.err(e) 213 | Log.info("Error sending packet. Disconnecting invalid client!") 214 | close() 215 | 216 | val k = zerotierConnections.find { it.address == address } 217 | if (k != null) zerotierConnections.remove(k) 218 | } 219 | } 220 | 221 | override fun isConnected(): Boolean { 222 | return socket.isConnected 223 | } 224 | 225 | override fun close() { 226 | socket.close() 227 | } 228 | } 229 | } --------------------------------------------------------------------------------