diff --git a/VirtualComputer/dependency-reduced-pom.xml b/VirtualComputer/dependency-reduced-pom.xml index 6fe3136..715dcf2 100644 --- a/VirtualComputer/dependency-reduced-pom.xml +++ b/VirtualComputer/dependency-reduced-pom.xml @@ -5,22 +5,6 @@ VirtualComputer 2.0-SNAPSHOT - src - - - src - - **/*.java - - - - . - - *.dll - *.yml - - - maven-compiler-plugin @@ -28,9 +12,9 @@ 1.8 1.8 - - -g - + + -g + @@ -91,12 +75,6 @@ - - org.bukkit - craftbukkit - 1.12.2-R0.1-SNAPSHOT - provided - diff --git a/VirtualComputer/pom.xml b/VirtualComputer/pom.xml index 4d44335..d02a27b 100644 --- a/VirtualComputer/pom.xml +++ b/VirtualComputer/pom.xml @@ -5,22 +5,6 @@ VirtualComputer 2.0-SNAPSHOT - src - - - src - - **/*.java - - - - . - - *.dll - *.yml - - - maven-compiler-plugin diff --git a/VirtualComputer/src/sznp/virtualcomputer/Commands.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/Commands.java similarity index 100% rename from VirtualComputer/src/sznp/virtualcomputer/Commands.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/Commands.java diff --git a/VirtualComputer/src/sznp/virtualcomputer/MouseLockerPlayerListener.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/MouseLockerPlayerListener.java similarity index 100% rename from VirtualComputer/src/sznp/virtualcomputer/MouseLockerPlayerListener.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/MouseLockerPlayerListener.java diff --git a/VirtualComputer/src/sznp/virtualcomputer/PluginMain.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/PluginMain.java similarity index 97% rename from VirtualComputer/src/sznp/virtualcomputer/PluginMain.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/PluginMain.java index 1f9f560..a05e9f7 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/PluginMain.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/PluginMain.java @@ -9,6 +9,12 @@ import org.bukkit.command.ConsoleCommandSender; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; import org.virtualbox_6_0.*; +import sznp.virtualcomputer.renderer.BukkitRenderer; +import sznp.virtualcomputer.renderer.GPURenderer; +import sznp.virtualcomputer.renderer.IRenderer; +import sznp.virtualcomputer.renderer.MCFrameBuffer; +import sznp.virtualcomputer.util.Scancode; +import sznp.virtualcomputer.util.VBoxLib; import javax.annotation.Nullable; import java.io.File; diff --git a/VirtualComputer/src/sznp/virtualcomputer/Test.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/Test.java similarity index 98% rename from VirtualComputer/src/sznp/virtualcomputer/Test.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/Test.java index b58232e..111a427 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/Test.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/Test.java @@ -6,6 +6,7 @@ import com.sun.jna.Pointer; import jnr.ffi.LibraryLoader; import org.bukkit.Color; import org.bukkit.map.MapPalette; +import sznp.virtualcomputer.util.PXCLib; import java.io.File; import java.lang.reflect.Field; diff --git a/VirtualComputer/src/sznp/virtualcomputer/BukkitRenderer.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/BukkitRenderer.java similarity index 98% rename from VirtualComputer/src/sznp/virtualcomputer/BukkitRenderer.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/BukkitRenderer.java index c469f48..65b1068 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/BukkitRenderer.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/BukkitRenderer.java @@ -1,4 +1,4 @@ -package sznp.virtualcomputer; +package sznp.virtualcomputer.renderer; import org.bukkit.World; import org.bukkit.entity.Player; diff --git a/VirtualComputer/src/sznp/virtualcomputer/GPURenderer.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/GPURenderer.java similarity index 98% rename from VirtualComputer/src/sznp/virtualcomputer/GPURenderer.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/GPURenderer.java index df55e7f..3356976 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/GPURenderer.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/GPURenderer.java @@ -1,4 +1,4 @@ -package sznp.virtualcomputer; +package sznp.virtualcomputer.renderer; import lombok.val; import net.minecraft.server.v1_12_R1.WorldMap; diff --git a/VirtualComputer/src/sznp/virtualcomputer/GPURendererInternal.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/GPURendererInternal.java similarity index 98% rename from VirtualComputer/src/sznp/virtualcomputer/GPURendererInternal.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/GPURendererInternal.java index ab8f341..61dfdfa 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/GPURendererInternal.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/GPURendererInternal.java @@ -1,4 +1,4 @@ -package sznp.virtualcomputer; +package sznp.virtualcomputer.renderer; import com.aparapi.Kernel; import com.aparapi.Range; diff --git a/VirtualComputer/src/sznp/virtualcomputer/IRenderer.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/IRenderer.java similarity index 90% rename from VirtualComputer/src/sznp/virtualcomputer/IRenderer.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/IRenderer.java index 1bf7ee2..f3923a0 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/IRenderer.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/IRenderer.java @@ -1,4 +1,4 @@ -package sznp.virtualcomputer; +package sznp.virtualcomputer.renderer; import org.bukkit.Bukkit; import org.bukkit.World; diff --git a/VirtualComputer/src/sznp/virtualcomputer/MCFrameBuffer.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/MCFrameBuffer.java similarity index 98% rename from VirtualComputer/src/sznp/virtualcomputer/MCFrameBuffer.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/MCFrameBuffer.java index de0460f..66d5c13 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/MCFrameBuffer.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/renderer/MCFrameBuffer.java @@ -1,4 +1,4 @@ -package sznp.virtualcomputer; +package sznp.virtualcomputer.renderer; import com.sun.jna.Pointer; import org.bukkit.Bukkit; @@ -8,6 +8,7 @@ import org.mozilla.interfaces.IFramebufferOverlay; import org.mozilla.interfaces.nsISupports; import org.mozilla.xpcom.Mozilla; import org.virtualbox_6_0.*; +import sznp.virtualcomputer.PluginMain; import java.util.Arrays; diff --git a/VirtualComputer/src/sznp/virtualcomputer/PXCLib.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/util/PXCLib.java similarity index 95% rename from VirtualComputer/src/sznp/virtualcomputer/PXCLib.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/util/PXCLib.java index f08c21b..708525e 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/PXCLib.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/util/PXCLib.java @@ -1,4 +1,4 @@ -package sznp.virtualcomputer; +package sznp.virtualcomputer.util; import jnr.ffi.Pointer; diff --git a/VirtualComputer/src/sznp/virtualcomputer/Scancode.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/util/Scancode.java similarity index 96% rename from VirtualComputer/src/sznp/virtualcomputer/Scancode.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/util/Scancode.java index 409e727..daa0a18 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/Scancode.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/util/Scancode.java @@ -1,4 +1,4 @@ -package sznp.virtualcomputer; +package sznp.virtualcomputer.util; /* The scancode values come from: @@ -9,7 +9,7 @@ The scancode values come from: */ @SuppressWarnings("unused") -enum Scancode { // https://handmade.network/forums/t/2011-keyboard_inputs_-_scancodes,_raw_input,_text_input,_key_names +public enum Scancode { // https://handmade.network/forums/t/2011-keyboard_inputs_-_scancodes,_raw_input,_text_input,_key_names sc_escape(0x01), sc_1(0x02), sc_2(0x03), sc_3(0x04), sc_4(0x05), sc_5(0x06), sc_6(0x07), sc_7(0x08), sc_8( 0x09), sc_9(0x0A), sc_0(0x0B), sc_minus(0x0C), sc_equals(0x0D), sc_backspace(0x0E), sc_tab(0x0F), sc_q( diff --git a/VirtualComputer/src/sznp/virtualcomputer/VBoxLib.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/util/VBoxLib.java similarity index 72% rename from VirtualComputer/src/sznp/virtualcomputer/VBoxLib.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/util/VBoxLib.java index 3c2b097..0cf040a 100755 --- a/VirtualComputer/src/sznp/virtualcomputer/VBoxLib.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/util/VBoxLib.java @@ -1,4 +1,4 @@ -package sznp.virtualcomputer; +package sznp.virtualcomputer.util; public interface VBoxLib { void RTR3InitExe(int argc, String argv, int somethingzero); diff --git a/VirtualComputer/src/sznp/virtualcomputer/WinLib.java b/VirtualComputer/src/main/java/sznp/virtualcomputer/util/WinLib.java similarity index 84% rename from VirtualComputer/src/sznp/virtualcomputer/WinLib.java rename to VirtualComputer/src/main/java/sznp/virtualcomputer/util/WinLib.java index c4f6580..cf8906a 100644 --- a/VirtualComputer/src/sznp/virtualcomputer/WinLib.java +++ b/VirtualComputer/src/main/java/sznp/virtualcomputer/util/WinLib.java @@ -1,4 +1,4 @@ -package sznp.virtualcomputer; +package sznp.virtualcomputer.util; import com.sun.jna.Library; import com.sun.jna.Native; diff --git a/VirtualComputer/plugin.yml b/VirtualComputer/src/main/resources/plugin.yml similarity index 96% rename from VirtualComputer/plugin.yml rename to VirtualComputer/src/main/resources/plugin.yml index 3114d8d..6ea0ca7 100644 --- a/VirtualComputer/plugin.yml +++ b/VirtualComputer/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ -name: VirtualComputer -main: sznp.virtualcomputer.PluginMain -version: 2.0 -commands: - computer: - usage: Use /computer start|stop|reset|key|mouse|input|fix - aliases: c +name: VirtualComputer +main: sznp.virtualcomputer.PluginMain +version: 2.0 +commands: + computer: + usage: Use /computer start|stop|reset|key|mouse|input|fix + aliases: c diff --git a/VirtualComputer/src/sznp/virtualcomputer/JarUtils.java b/VirtualComputer/src/sznp/virtualcomputer/JarUtils.java deleted file mode 100644 index 7016142..0000000 --- a/VirtualComputer/src/sznp/virtualcomputer/JarUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package sznp.virtualcomputer; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; -import java.net.URLDecoder; -import java.util.Enumeration; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -public class JarUtils { - - public static boolean extractFromJar(final String fileName, - final String dest) throws IOException { - if (getRunningJar() == null) { - return false; - } - final File file = new File(dest); - if (file.isDirectory()) { - file.mkdir(); - return false; - } - if (!file.exists()) { - file.getParentFile().mkdirs(); - } - - final JarFile jar = getRunningJar(); - final Enumeration e = jar.entries(); - while (e.hasMoreElements()) { - final JarEntry je = e.nextElement(); - if (!je.getName().contains(fileName)) { - continue; - } - final InputStream in = new BufferedInputStream( - jar.getInputStream(je)); - final OutputStream out = new BufferedOutputStream( - new FileOutputStream(file)); - copyInputStream(in, out); - jar.close(); - return true; - } - jar.close(); - return false; - } - - private final static void copyInputStream(final InputStream in, - final OutputStream out) throws IOException { - try { - final byte[] buff = new byte[4096]; - int n; - while ((n = in.read(buff)) > 0) { - out.write(buff, 0, n); - } - } finally { - out.flush(); - out.close(); - in.close(); - } - } - - public static URL getJarUrl(final File file) throws IOException { - return new URL("jar:" + file.toURI().toURL().toExternalForm() + "!/"); - } - - public static JarFile getRunningJar() throws IOException { - if (!RUNNING_FROM_JAR) { - return null; // null if not running from jar - } - String path = new File(JarUtils.class.getProtectionDomain() - .getCodeSource().getLocation().getPath()).getAbsolutePath(); - path = URLDecoder.decode(path, "UTF-8"); - return new JarFile(path); - } - - private static boolean RUNNING_FROM_JAR = false; - - static { - final URL resource = JarUtils.class.getClassLoader().getResource( - "plugin.yml"); - if (resource != null) { - RUNNING_FROM_JAR = true; - } - } - -}