mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-10-01 02:17:22 +00:00
Merge pull request #303 from Parabot/task/thread-getId-redirect
[TASK] Added Thread#getId redirect
This commit is contained in:
@@ -73,8 +73,8 @@ public class Context {
|
||||
public static double getJavaVersion() {
|
||||
String version = System.getProperty("java.version");
|
||||
int pos = version.indexOf('.');
|
||||
pos = version.indexOf('.', pos+1);
|
||||
return Double.parseDouble(version.substring (0, pos));
|
||||
pos = version.indexOf('.', pos + 1);
|
||||
return Double.parseDouble(version.substring(0, pos));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,4 +65,8 @@ public class ThreadRedirect {
|
||||
public static boolean isInterrupted(Thread thread) {
|
||||
return thread.isInterrupted();
|
||||
}
|
||||
|
||||
public static long getId(Thread thread) {
|
||||
return thread.getId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ public class XMLHookParser extends HookParser {
|
||||
|
||||
public XMLHookParser(HookFile hookFile) {
|
||||
super(hookFile);
|
||||
interfaceMap = new HashMap<String, String>();
|
||||
constants = new HashMap<String, String>();
|
||||
interfaceMap = new HashMap<>();
|
||||
constants = new HashMap<>();
|
||||
try {
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory
|
||||
.newInstance();
|
||||
@@ -45,48 +45,6 @@ public class XMLHookParser extends HookParser {
|
||||
}
|
||||
}
|
||||
|
||||
private static String resolveDesc(String returnDesc) {
|
||||
String array = "";
|
||||
if (returnDesc != null && returnDesc.contains("%s")) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
if (returnDesc.startsWith("[")) {
|
||||
for (int i = 0; i < returnDesc.length(); i++) {
|
||||
if (returnDesc.charAt(i) == '[') {
|
||||
array += '[';
|
||||
}
|
||||
}
|
||||
returnDesc = returnDesc.replaceAll("\\[", "");
|
||||
}
|
||||
str.append(array)
|
||||
.append('L')
|
||||
.append(String.format(returnDesc,
|
||||
AddInterfaceAdapter.getAccessorPackage()))
|
||||
.append(";");
|
||||
returnDesc = str.toString();
|
||||
}
|
||||
return returnDesc;
|
||||
}
|
||||
|
||||
private static final boolean isSet(String tag, Element element) {
|
||||
return element.getElementsByTagName(tag).getLength() > 0;
|
||||
}
|
||||
|
||||
private static final String getValue(String tag, Element element) {
|
||||
if (element.getElementsByTagName(tag).item(0) == null) {
|
||||
throw new NullPointerException("MISSING HOOK TAG: The '" + tag + "' xml tag is missing from one of the hooks of type: " + element.getParentNode().getNodeName());
|
||||
}
|
||||
NodeList nodes = element.getElementsByTagName(tag).item(0)
|
||||
.getChildNodes();
|
||||
if (nodes.getLength() == 0 || nodes.item(0) == null) {
|
||||
if (Core.inVerboseMode()) {
|
||||
System.err.println("WARNING: Invalid Hook " + tag + " subnode. Tag is missing or empty?");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
Node node = (Node) nodes.item(0);
|
||||
return node.getNodeValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Interface[] getInterfaces() {
|
||||
parsedInterfaces = true;
|
||||
@@ -468,4 +426,46 @@ public class XMLHookParser extends HookParser {
|
||||
return callbackList.toArray(new Callback[callbackList.size()]);
|
||||
}
|
||||
|
||||
private static String resolveDesc(String returnDesc) {
|
||||
String array = "";
|
||||
if (returnDesc != null && returnDesc.contains("%s")) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
if (returnDesc.startsWith("[")) {
|
||||
for (int i = 0; i < returnDesc.length(); i++) {
|
||||
if (returnDesc.charAt(i) == '[') {
|
||||
array += '[';
|
||||
}
|
||||
}
|
||||
returnDesc = returnDesc.replaceAll("\\[", "");
|
||||
}
|
||||
str.append(array)
|
||||
.append('L')
|
||||
.append(String.format(returnDesc,
|
||||
AddInterfaceAdapter.getAccessorPackage()))
|
||||
.append(";");
|
||||
returnDesc = str.toString();
|
||||
}
|
||||
return returnDesc;
|
||||
}
|
||||
|
||||
private static final boolean isSet(String tag, Element element) {
|
||||
return element.getElementsByTagName(tag).getLength() > 0;
|
||||
}
|
||||
|
||||
private static final String getValue(String tag, Element element) {
|
||||
if (element.getElementsByTagName(tag).item(0) == null) {
|
||||
throw new NullPointerException("MISSING HOOK TAG: The '" + tag + "' xml tag is missing from one of the hooks of type: " + element.getParentNode().getNodeName());
|
||||
}
|
||||
NodeList nodes = element.getElementsByTagName(tag).item(0)
|
||||
.getChildNodes();
|
||||
if (nodes.getLength() == 0 || nodes.item(0) == null) {
|
||||
if (Core.inVerboseMode()) {
|
||||
System.err.println("WARNING: Invalid Hook " + tag + " subnode. Tag is missing or empty?");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
Node node = (Node) nodes.item(0);
|
||||
return node.getNodeValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user