Skip to content

Instantly share code, notes, and snippets.

@scorpion3013
Last active October 20, 2019 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scorpion3013/92141beba446dda3c5cf05bee7d3a22f to your computer and use it in GitHub Desktop.
Save scorpion3013/92141beba446dda3c5cf05bee7d3a22f to your computer and use it in GitHub Desktop.
var scriptName = "cape_mover";
var scriptAuthor = "scorpion";
var scriptVersion = 1.0;
HttpPatch = Java.type("org.apache.http.client.methods.HttpPatch")
HttpClients = Java.type("org.apache.http.impl.client.HttpClients")
StringEntity = Java.type("org.apache.http.entity.StringEntity")
var Thread = Java.type("java.lang.Thread");
var Runnable = Java.type("java.lang.Runnable");
auth_key = ""
function CapeMover() {
this.getName = function() {
return "Cape_mover";
}
this.getDescription = function() {
return "Moves your donator cape to your current alt.";
}
this.getCategory = function() {
return "Misc";
}
var uuid = ""
this.onUpdate = function() {
if (uuid != String(mc.thePlayer.getGameProfile().id).replace(/-/g,"")){
uuid = String(mc.thePlayer.getGameProfile().id).replace(/-/g,"")
new Thread(new Patcher()).start()
}
}
var Patcher = Java.extend(Runnable, {
run: function () {
httpClient = HttpClients.createDefault()
request = new HttpPatch("http://capes.liquidbounce.net/api/v1/cape/self")
request.setHeader("Content-Type", "application/json")
request.setHeader("Authorization", auth_key)
body = new StringEntity(JSON.stringify({"uuid": uuid}))
request.setEntity(body)
response = httpClient.execute(request)
}
});
}
var capeMover = new CapeMover();
var capeMoverClient;
function onEnable() {
capeMoverClient = moduleManager.registerModule(capeMover);
}
function onDisable() {
moduleManager.unregisterModule(capeMoverClient);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment