Fix Plugin templates

This commit is contained in:
Nico Mexis 2022-01-07 20:16:17 +01:00
parent ab6cf8d196
commit a6f65ecfcf
No known key found for this signature in database
GPG key ID: 27D6E17CE092AB78
2 changed files with 23 additions and 25 deletions

View file

@ -93,7 +93,7 @@ public abstract class Plugin extends Thread
* On plugin start each resource container is iterated through, * On plugin start each resource container is iterated through,
* then this is called with the resource container classes * then this is called with the resource container classes
* *
* @param classNodeList all of the loaded classes for easy access. * @param classNodeList all the loaded classes for easy access.
*/ */
public abstract void execute(List<ClassNode> classNodeList); public abstract void execute(List<ClassNode> classNodeList);
} }

View file

@ -1,36 +1,34 @@
import the.bytecode.club.bytecodeviewer.api.*; import java.util.List;
import java.util.ArrayList;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.api.*;
public class Template extends Plugin {
public class Template extends Plugin
{
PluginConsole gui; PluginConsole gui;
/** /**
* Main function * Main function
*/ */
@Override @Override
public void execute(ArrayList<ClassNode> classNodeList) public void execute(List<ClassNode> classNodeList) {
{ // Create console
//create console
gui = new PluginConsole("Java Template"); gui = new PluginConsole("Java Template");
gui.setVisible(true); //show the console gui.setVisible(true); // Show the console
//debug text // Debug text
out("Class Nodes: " + classNodeList.size()); out("Class Nodes: " + classNodeList.size());
//iterate through each class node // Iterate through each class node
for (ClassNode cn : classNodeList) for (ClassNode cn : classNodeList)
process(cn); process(cn);
BCV.hideFrame(gui, 10000); //hides the console after 10 seconds BCV.hideFrame(gui, 10000); // Hides the console after 10 seconds
} }
/** /**
* Process each class node * Process each class node
*/ */
public void process(ClassNode cn) public void process(ClassNode cn) {
{
out("Node: " + cn.name + ".class"); out("Node: " + cn.name + ".class");
// TODO developer plugin code goes here // TODO developer plugin code goes here
} }
@ -38,8 +36,8 @@ public class Template extends Plugin
/** /**
* Print to console * Print to console
*/ */
public void out(String text) public void out(String text) {
{
gui.appendText(text); gui.appendText(text);
} }
} }