diff --git a/VirtualComputer/.classpath b/VirtualComputer/.classpath
index 8878e24..be86bf9 100644
--- a/VirtualComputer/.classpath
+++ b/VirtualComputer/.classpath
@@ -1,6 +1,6 @@
-
+
@@ -16,6 +16,5 @@
-
diff --git a/VirtualComputer/Interop.VirtualBox.dll b/VirtualComputer/Interop.VirtualBox.dll
deleted file mode 100644
index 27d7e9c..0000000
Binary files a/VirtualComputer/Interop.VirtualBox.dll and /dev/null differ
diff --git a/VirtualComputer/VirtualComputerSender.dll b/VirtualComputer/VirtualComputerSender.dll
deleted file mode 100644
index bb667e6..0000000
Binary files a/VirtualComputer/VirtualComputerSender.dll and /dev/null differ
diff --git a/VirtualComputer/VirtualComputerSender.j4n.dll b/VirtualComputer/VirtualComputerSender.j4n.dll
deleted file mode 100644
index 2455c69..0000000
Binary files a/VirtualComputer/VirtualComputerSender.j4n.dll and /dev/null differ
diff --git a/VirtualComputer/VirtualComputerSender.j4n.jar b/VirtualComputer/VirtualComputerSender.j4n.jar
deleted file mode 100644
index 651b657..0000000
Binary files a/VirtualComputer/VirtualComputerSender.j4n.jar and /dev/null differ
diff --git a/VirtualComputer/jni4net.j-0.8.8.0.jar b/VirtualComputer/jni4net.j-0.8.8.0.jar
deleted file mode 100644
index 922c2ad..0000000
Binary files a/VirtualComputer/jni4net.j-0.8.8.0.jar and /dev/null differ
diff --git a/VirtualComputer/jni4net.n-0.8.8.0.dll b/VirtualComputer/jni4net.n-0.8.8.0.dll
deleted file mode 100644
index 2c7dc61..0000000
Binary files a/VirtualComputer/jni4net.n-0.8.8.0.dll and /dev/null differ
diff --git a/VirtualComputer/jni4net.n.w64.v40-0.8.8.0.dll b/VirtualComputer/jni4net.n.w64.v40-0.8.8.0.dll
deleted file mode 100644
index 6ff98f1..0000000
Binary files a/VirtualComputer/jni4net.n.w64.v40-0.8.8.0.dll and /dev/null differ
diff --git a/VirtualComputer/pom.xml b/VirtualComputer/pom.xml
new file mode 100644
index 0000000..0bc8a56
--- /dev/null
+++ b/VirtualComputer/pom.xml
@@ -0,0 +1,89 @@
+
+ 4.0.0
+ io.github.NorbiPeti
+ VirtualComputer
+ 1.2-SNAPSHOT
+
+ src
+
+
+ src
+
+ **/*.java
+
+
+
+ .
+
+ *.dll
+ *.yml
+
+
+
+
+
+ maven-compiler-plugin
+ 3.5.1
+
+
+ 1.8
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.4.2
+
+
+ package
+
+ shade
+
+
+
+
+ org.virtualbox:VirtualBox
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ repo
+ file://${basedir}/repo
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.9.2-R0.1-SNAPSHOT
+ provided
+
+
+ net.countercraft
+ Movecraft
+ 3.0.0
+ provided
+
+
+ org.virtualbox
+ VirtualBox
+ 5.1
+
+
+
\ No newline at end of file
diff --git a/VirtualComputer/repo/io/github/NorbiPeti/SenderBridge/1.0/SenderBridge-1.0.jar b/VirtualComputer/repo/io/github/NorbiPeti/SenderBridge/1.0/SenderBridge-1.0.jar
deleted file mode 100644
index 651b657..0000000
Binary files a/VirtualComputer/repo/io/github/NorbiPeti/SenderBridge/1.0/SenderBridge-1.0.jar and /dev/null differ
diff --git a/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1.jar b/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1.jar
new file mode 100644
index 0000000..b0bd4ee
Binary files /dev/null and b/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1.jar differ
diff --git a/VirtualComputer/repo/io/github/NorbiPeti/SenderBridge/1.0/SenderBridge-1.0.pom b/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1.pom
similarity index 77%
rename from VirtualComputer/repo/io/github/NorbiPeti/SenderBridge/1.0/SenderBridge-1.0.pom
rename to VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1.pom
index 09cb70c..35819af 100644
--- a/VirtualComputer/repo/io/github/NorbiPeti/SenderBridge/1.0/SenderBridge-1.0.pom
+++ b/VirtualComputer/repo/org/virtualbox/VirtualBox/5.1/VirtualBox-5.1.pom
@@ -2,8 +2,8 @@
4.0.0
- io.github.NorbiPeti
- SenderBridge
- 1.0
+ org.virtualbox
+ VirtualBox
+ 5.1
POM was created from install:install-file
diff --git a/VirtualComputer/src/com/mcplugindev/slipswhitley/sketchmap/map/ImageRenderer.java b/VirtualComputer/src/com/mcplugindev/slipswhitley/sketchmap/map/ImageRenderer.java
index 082ef20..9eb4364 100644
--- a/VirtualComputer/src/com/mcplugindev/slipswhitley/sketchmap/map/ImageRenderer.java
+++ b/VirtualComputer/src/com/mcplugindev/slipswhitley/sketchmap/map/ImageRenderer.java
@@ -1,53 +1,45 @@
-package com.mcplugindev.slipswhitley.sketchmap.map;
-
-import java.awt.image.BufferedImage;
-import java.util.concurrent.TimeUnit;
-
-import org.bukkit.entity.Player;
-import org.bukkit.map.MapCanvas;
-import org.bukkit.map.MapRenderer;
-import org.bukkit.map.MapView;
-
-public class ImageRenderer extends MapRenderer
-{
-
- private BufferedImage image;
-
- public ImageRenderer(BufferedImage image)
- {
- this.image = image;
- }
-
- private int progress = 0;
- public static int updatepixels = 15;
-
- @Override
- public void render(MapView view, MapCanvas canvas, Player player)
- {
- long time = System.nanoTime();
-
- try
- {
- canvas.drawImage(0, progress * updatepixels, image.getSubimage(0,
- progress * updatepixels, 128, (progress * updatepixels
- + updatepixels >= 128 ? 128 - progress
- * updatepixels : updatepixels)));
- if (progress < 128 / updatepixels)
- progress++;
- else
- progress = 0;
-
- long diff = System.nanoTime() - time;
- if (TimeUnit.NANOSECONDS.toMillis(diff) > 40)
- {
- System.out.println("Map rendering took "
- + TimeUnit.NANOSECONDS.toMillis(diff) + " ms");
- }
- } catch (Exception e)
- {
- e.printStackTrace();
- System.out.println("Progess: " + progress);
- System.out.println("UpdatePixels: " + updatepixels);
- }
- }
-}
+package com.mcplugindev.slipswhitley.sketchmap.map;
+
+import java.awt.image.BufferedImage;
+import java.util.concurrent.TimeUnit;
+
+import org.bukkit.entity.Player;
+import org.bukkit.map.MapCanvas;
+import org.bukkit.map.MapRenderer;
+import org.bukkit.map.MapView;
+
+public class ImageRenderer extends MapRenderer // Modified
+{
+
+ private BufferedImage image;
+
+ public ImageRenderer(BufferedImage image) {
+ this.image = image;
+ }
+
+ private int progress = 0;
+ public static int updatepixels = 15;
+
+ @Override
+ public void render(MapView view, MapCanvas canvas, Player player) {
+ long time = System.nanoTime();
+
+ try {
+ canvas.drawImage(0, progress * updatepixels, image.getSubimage(0, progress * updatepixels, 128,
+ (progress * updatepixels + updatepixels >= 128 ? 128 - progress * updatepixels : updatepixels)));
+ if (progress < 128 / updatepixels)
+ progress++;
+ else
+ progress = 0;
+
+ long diff = System.nanoTime() - time;
+ if (TimeUnit.NANOSECONDS.toMillis(diff) > 40) {
+ System.out.println("Map rendering took " + TimeUnit.NANOSECONDS.toMillis(diff) + " ms");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.out.println("Progess: " + progress);
+ System.out.println("UpdatePixels: " + updatepixels);
+ }
+ }
+}
diff --git a/VirtualComputer/src/sznp/virtualcomputer/PluginMain.java b/VirtualComputer/src/sznp/virtualcomputer/PluginMain.java
index bf9c9c4..62ee38f 100644
--- a/VirtualComputer/src/sznp/virtualcomputer/PluginMain.java
+++ b/VirtualComputer/src/sznp/virtualcomputer/PluginMain.java
@@ -7,7 +7,6 @@ import java.util.HashMap;
import net.countercraft.movecraft.craft.Craft;
import net.countercraft.movecraft.craft.CraftManager;
-import net.sf.jni4net.Bridge;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -15,14 +14,16 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
-
-import virtualcomputersender.Computer;
+import org.virtualbox_5_1.ISession;
+import org.virtualbox_5_1.IVirtualBox;
+import org.virtualbox_5_1.VirtualBoxManager;
import com.mcplugindev.slipswhitley.sketchmap.map.RelativeLocation;
import com.mcplugindev.slipswhitley.sketchmap.map.SketchMap;
public class PluginMain extends JavaPlugin {
- private Computer computer;
+ private IVirtualBox vbox;
+ private ISession session;
private SketchMap smap;
public static PluginMain Instance;
@@ -34,26 +35,10 @@ public class PluginMain extends JavaPlugin {
try {
ConsoleCommandSender ccs = getServer().getConsoleSender();
this.getCommand("computer").setExecutor(new Commands());
- ccs.sendMessage("§bExtracting necessary libraries...");
- final File[] libs = new File[] {
- // new File(getDataFolder(), "jni4net.j-0.8.8.0.jar"),
- new File(getDataFolder(), "jni4net.n-0.8.8.0.dll"),
- new File(getDataFolder(), "jni4net.n.w64.v40-0.8.8.0.dll"),
- // new File(getDataFolder(), "VirtualComputerSender.j4n.jar"),
- new File(getDataFolder(), "VirtualComputerSender.j4n.dll"),
- new File(getDataFolder(), "VirtualComputerSender.dll"),
- new File(getDataFolder(), "Interop.VirtualBox.dll") };
-
- for (final File lib : libs) {
- if (!lib.exists()) {
- JarUtils.extractFromJar(lib.getName(), lib.getAbsolutePath());
- }
- }
- ccs.sendMessage("§bInitializing bridge...");
- Bridge.init(new File(getDataFolder(), "jni4net.n.w64.v40-0.8.8.0.dll").getAbsoluteFile());
- Bridge.LoadAndRegisterAssemblyFrom(new File(getDataFolder(), "VirtualComputerSender.j4n.dll"));
- ccs.sendMessage("§bInititalizing VirtualBox interface...");
- computer = new Computer();
+ ccs.sendMessage("§bInitializing VirtualBox...");
+ final VirtualBoxManager manager = VirtualBoxManager.createInstance(null);
+ vbox = manager.getVBox();
+ session = manager.getSessionObject();
ccs.sendMessage("§bLoading SketchMap...");
img = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB);
HashMap map = new HashMap<>();
@@ -82,7 +67,7 @@ public class PluginMain extends JavaPlugin {
public void Start(CommandSender sender) {
sender.sendMessage("§eStarting computer...");
- computer.Start();
+ // computer.Start();
sender.sendMessage("§eComputer started.");
DoStart();
}
@@ -94,8 +79,8 @@ public class PluginMain extends JavaPlugin {
task = this.getServer().getScheduler().runTaskTimerAsynchronously(this, new Runnable() {
public void run() {
final int[] a = ((DataBufferInt) smap.image.getRaster().getDataBuffer()).getData();
- final int[] data = computer.GetScreenPixelColors();
- System.arraycopy(data, 0, a, 0, data.length);
+ // final int[] data = computer.GetScreenPixelColors();
+ // System.arraycopy(data, 0, a, 0, data.length);
}
}, 1, 10);
if (getServer().getPluginManager().isPluginEnabled("Movecraft")) {
@@ -123,7 +108,7 @@ public class PluginMain extends JavaPlugin {
public void Stop(CommandSender sender) {
sender.sendMessage("§eStopping computer...");
- computer.PowerOff();
+ // computer.PowerOff();
sender.sendMessage("§eComputer stopped.");
}
@@ -133,43 +118,36 @@ public class PluginMain extends JavaPlugin {
getServer().getScheduler().runTaskAsynchronously(this, new Runnable() {
@Override
public void run() {
- if (computer.PowerButton()) {
- DoStart();
- s.sendMessage("§eComputer started.");
- } else
- s.sendMessage("§ePowerbutton pressed.");
+ /*
+ * if (computer.PowerButton()) { DoStart(); s.sendMessage("§eComputer started."); } else s.sendMessage("§ePowerbutton pressed.");
+ */
}
});
}
public void Reset(CommandSender sender) {
sender.sendMessage("§eResetting computer...");
- computer.Reset();
+ // computer.Reset();
sender.sendMessage("§eComputer reset.");
}
public void FixScreen(CommandSender sender) {
sender.sendMessage("§eFixing screen...");
- computer.FixScreen();
+ // computer.FixScreen();
sender.sendMessage("§eScreen fixed.");
}
public void PressKey(CommandSender sender, String key, String stateorduration) {
- if (stateorduration.length() == 0)
- computer.PressKey(key, (short) 0);
- else if (stateorduration.equalsIgnoreCase("down"))
- computer.PressKey(key, (short) -1);
- else if (stateorduration.equalsIgnoreCase("up"))
- computer.PressKey(key, (short) -2);
- else
- computer.PressKey(key, Short.parseShort(stateorduration));
+ /*
+ * if (stateorduration.length() == 0) computer.PressKey(key, (short) 0); else if (stateorduration.equalsIgnoreCase("down")) computer.PressKey(key, (short) -1); else if
+ * (stateorduration.equalsIgnoreCase("up")) computer.PressKey(key, (short) -2); else computer.PressKey(key, Short.parseShort(stateorduration));
+ */
}
public void UpdateMouse(CommandSender sender, int x, int y, int z, int w, String mbs, boolean down) {
- if (down)
- computer.UpdateMouse(x, y, z, w, mbs);
- else
- computer.UpdateMouse(x, y, z, w, "");
+ /*
+ * if (down) computer.UpdateMouse(x, y, z, w, mbs); else computer.UpdateMouse(x, y, z, w, "");
+ */
}
public void UpdateMouse(CommandSender sender, int x, int y, int z, int w, String mbs) {