Created
February 19, 2016 21:53
-
-
Save anonymous/6ece322c4bfca4a6e613 to your computer and use it in GitHub Desktop.
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
package org.parabot.capslock.cpkhfix; | |
import org.parabot.environment.scripts.Category; | |
import org.parabot.environment.scripts.Script; | |
import org.parabot.environment.scripts.ScriptManifest; | |
import org.rev317.min.Loader; | |
import java.lang.reflect.Field; | |
@ScriptManifest( | |
author = "Random (Kendal)", | |
category = Category.COOKING, | |
description = "This script is used to change your version-number. This lasts for the a single session (the version number will change back after closing the client).", | |
name = "Version Changer", | |
servers = { "PkHonor" }, | |
version = 0.1 | |
) | |
public class ChangeVersion extends Script { | |
int set_to_version = 108; | |
@Override | |
public boolean onExecute() { | |
try | |
{ | |
System.out.println(); | |
System.out.println("Attempting to load version class..."); | |
Field path = Class.forName("pkhonor.ek", false, Loader.getClient().getClass().getClassLoader()).getDeclaredField("a"); | |
path.setAccessible(true); | |
System.out.println("Succesfully loaded version class."); | |
int current_version = (int) path.get(Loader.getClient()); | |
System.out.println("Current version: " + current_version + "."); | |
System.out.println("Desired version: " + set_to_version + "."); | |
if(set_to_version != current_version) { | |
path.set(Loader.getClient(), set_to_version); | |
System.out.println("Changed version from " + current_version + " -> " + path.get(Loader.getClient()) + "."); | |
System.out.println("New version: " + path.get(Loader.getClient()) + "."); | |
} else { | |
System.out.println("You're already on version " + set_to_version + "!"); | |
} | |
} | |
catch (Exception e) | |
{ | |
e.printStackTrace(); | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment