From a6f65ecfcff123adfba05cd9ba79605cc095e32f Mon Sep 17 00:00:00 2001 From: Nico Mexis Date: Fri, 7 Jan 2022 20:16:17 +0100 Subject: [PATCH] Fix Plugin templates --- .../club/bytecodeviewer/api/Plugin.java | 2 +- .../resources/templates/Template_Plugin.java | 46 +++++++++---------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java b/src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java index 3831ff72..fb7d3610 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/api/Plugin.java @@ -93,7 +93,7 @@ public abstract class Plugin extends Thread * On plugin start each resource container is iterated through, * 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 classNodeList); } diff --git a/src/main/resources/templates/Template_Plugin.java b/src/main/resources/templates/Template_Plugin.java index 94d7359d..2a99b101 100644 --- a/src/main/resources/templates/Template_Plugin.java +++ b/src/main/resources/templates/Template_Plugin.java @@ -1,45 +1,43 @@ -import the.bytecode.club.bytecodeviewer.api.*; -import java.util.ArrayList; +import java.util.List; import org.objectweb.asm.tree.ClassNode; +import the.bytecode.club.bytecodeviewer.api.*; + +public class Template extends Plugin { -public class Template extends Plugin -{ PluginConsole gui; - + /** * Main function */ @Override - public void execute(ArrayList classNodeList) - { - //create console + public void execute(List classNodeList) { + // Create console gui = new PluginConsole("Java Template"); - gui.setVisible(true); //show the console - - //debug text + gui.setVisible(true); // Show the console + + // Debug text out("Class Nodes: " + classNodeList.size()); - - //iterate through each class node - for(ClassNode cn : classNodeList) + + // Iterate through each class node + for (ClassNode cn : classNodeList) 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 */ - public void process(ClassNode cn) - { + public void process(ClassNode cn) { out("Node: " + cn.name + ".class"); - //TODO developer plugin code goes here + // TODO developer plugin code goes here } - + /** * Print to console */ - public void out(String text) - { + public void out(String text) { gui.appendText(text); } -} \ No newline at end of file + +}