ScriptCloud
-
Download/Upload JS to/from Cloud!
commands:
- .scriptcloud list : List the scripts can for download.
- .scriptcloud get <name> : Download script in list named <name>
- .scriptcloud upload <scriptName(file name with no '.js')> : Upload your script and then everyone can download your script with this script.
/// api_version=2 var script = registerScript({ name: "ScriptCloud", version: "3.0", authors: ["Anonzme"] }); var Socket = Java.type("java.net.Socket"); var BufferedWriter = Java.type("java.io.BufferedWriter"); var OutputStreamWriter = Java.type("java.io.OutputStreamWriter"); var BufferedReader = Java.type("java.io.BufferedReader"); var InputStreamReader = Java.type("java.io.InputStreamReader"); var JsonParser = Java.type("com.google.gson.JsonParser"); var JsonArray = Java.type("com.google.gson.JsonArray"); var JsonObject = Java.type("com.google.gson.JsonObject"); var Scanner = Java.type("java.util.Scanner"); var FileInputStream = Java.type("java.io.FileInputStream"); var File = Java.type("java.io.File"); var FileWriter = Java.type("java.io.FileWriter"); var StringBuilder = Java.type("java.lang.StringBuilder"); var ip = "121.36.23.123"; var port = 1025; function writeFile(text, f) { try { if (!f.exists()) f.createNewFile(); var bufferedWriter = new BufferedWriter(new FileWriter(f)); bufferedWriter.write(text); bufferedWriter.flush(); bufferedWriter.close(); } catch (err) { Chat.print("§8[§9§lScriptCloud§8] §cRuntime Error(1): " + err); } } function getScriptFile(name) { var a = new File(mc.mcDataDir, "LiquidBounce-1.8"); var b = new File(a, "scripts"); var f = new File(b, name); return f; } function readWhole(bufferedReader) { var stringBuilder = new StringBuilder(); var temp = ""; while ((temp = bufferedReader.readLine())!= null) stringBuilder.append(temp).append("\n"); return stringBuilder.toString(); } script.registerCommand({ name: "ScriptCloud", aliases: ["scriptcloud", "sc"] }, function(command) { command.on("execute", function(args) { if (args.length < 2) { Chat.print("§8[§9§lScriptCloud§8] §3Syntax: §7.scriptcloud <list/get/upload>"); return; } switch (args[1].toLowerCase()) { case "list": try { var j1 = new JsonObject(); j1.addProperty("action", "SCRIPT_LIST"); var socket1 = new Socket(ip, port); var bw1 = new BufferedWriter(new OutputStreamWriter(socket1.getOutputStream())); bw1.write(j1.toString()); bw1.flush(); socket1.shutdownOutput(); var br1 = new BufferedReader(new InputStreamReader(socket1.getInputStream())); var s1 = readWhole(br1); var jo1 = new JsonParser().parse(s1).getAsJsonObject(); if (jo1.get("error").getAsBoolean()) { Chat.print("§8[§9§lScriptCloud§8] §cError(2): " + jo1.get("reason").getAsString()); return; } bw1.close(); br1.close(); var cnt = 0; Chat.print("§8[§9§lScriptCloud§8] §3Scripts: "); for (var i in JSON.parse(jo1.toString()).result) Chat.print("§8[§9§lScriptCloud§8] §3" + ++cnt + ": §a" + JSON.parse(jo1.toString()).result[i]); } catch (err1) { Chat.print("§8[§9§lScriptCloud§8] §cRuntime Error(3): " + err1); } break; case "get": if (args.length != 3) { Chat.print("§8[§9§lScriptCloud§8] §3Syntax: §7.scriptcloud get <scriptName>"); return; } try { var j2 = new JsonObject(); j2.addProperty("action", "GET_SCRIPT"); j2.addProperty("scriptName", args[2]); var socket2 = new Socket(ip, port); var bw2 = new BufferedWriter(new OutputStreamWriter(socket2.getOutputStream())); bw2.write(j2.toString()); bw2.flush(); socket2.shutdownOutput(); var br2 = new BufferedReader(new InputStreamReader(socket2.getInputStream())); var s2 = readWhole(br2); var jo2 = new JsonParser().parse(s2).getAsJsonObject(); if (jo2.get("error").getAsBoolean()) { Chat.print("§8[§9§lScriptCloud§8] §cError: " + jo2.get("reason").getAsString()); return; } bw2.close(); br2.close(); writeFile(JSON.parse(jo2.toString()).result, getScriptFile(args[2] + ".js")); Chat.print("§8[§9§lScriptCloud§8] §aSuccess download §l" + args[2] + "§a! Now you can view it in scripts folder!"); } catch (err2) { Chat.print("§8[§9§lScriptCloud§8] §cRuntime Error(4): " + err2); } break; case "upload": if (args.length != 3) { Chat.print("§8[§9§lScriptCloud§8] §3Syntax: §7.scriptcloud upload <scriptFileName(without \".js\")>"); return; } try { var scanner = new Scanner(new FileInputStream(getScriptFile(args[2] + ".js"))); var text = ""; while (scanner.hasNextLine()) text += scanner.nextLine() + "\n"; var j3 = {}; j3.action = "UPLOAD_SCRIPT"; j3.scriptName = args[2]; j3.scriptText = text; var jobj = new JsonParser().parse(JSON.stringify(j3)).getAsJsonObject(); var socket3 = new Socket(ip, port); var bw3 = new BufferedWriter(new OutputStreamWriter(socket3.getOutputStream())); bw3.write(jobj.toString()); bw3.flush(); socket3.shutdownOutput(); var br3 = new BufferedReader(new InputStreamReader(socket3.getInputStream())); var c3 = readWhole(br3); var jo3 = new JsonParser().parse(c3).getAsJsonObject(); if (jo3.get("error").getAsBoolean()) { Chat.print("§8[§9§lScriptCloud§8] §cError: " + jo3.get("reason").getAsString()); return; } bw3.close(); br3.close(); Chat.print("§8[§9§lScriptCloud§8] §aSuccess upload §l" + args[2] + "§a!"); } catch (err3) { Chat.print("§8[§9§lScriptCloud§8] §cRuntime Error(5): " + err3); } break; default: Chat.print("§8[§9§lScriptCloud§8] §3Syntax: §7.scriptcloud <list/get/upload>"); break; } }); });
-
Get Manager and download / upload any script, auto install or upload themes (including fonts) and configs.
-
-
Update 2.0 . Now you can upload script!
-
Update 3.0
优化客户端&服务端性能
修复一些编码BugOptimize client & server performance.
Fix some coding bugs.