Update, made some progress too

Currently only 'runs' as root, but that doesn't work either
This commit is contained in:
Norbi Peti 2017-12-19 23:05:41 +01:00
parent dfc86e8371
commit e16b1cbccf
7 changed files with 22 additions and 10 deletions

View file

@ -102,7 +102,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View file

@ -77,12 +77,12 @@
<dependency>
<groupId>org.virtualbox</groupId>
<artifactId>VirtualBox</artifactId>
<version>5.1</version>
<version>5.2</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna -->

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.virtualbox</groupId>
<artifactId>VirtualBox</artifactId>
<version>5.2</version>
<description>POM was created from install:install-file</description>
</project>

View file

@ -3,10 +3,11 @@
<groupId>org.virtualbox</groupId>
<artifactId>VirtualBox</artifactId>
<versioning>
<release>5.1</release>
<release>5.2</release>
<versions>
<version>5.1</version>
<version>5.2</version>
</versions>
<lastUpdated>20170706160733</lastUpdated>
<lastUpdated>20171219203228</lastUpdated>
</versioning>
</metadata>

View file

@ -5,7 +5,7 @@ import org.mozilla.interfaces.IFramebuffer;
import org.mozilla.interfaces.IFramebufferOverlay;
import org.mozilla.interfaces.nsISupports;
import org.mozilla.xpcom.Mozilla;
import org.virtualbox_5_1.*;
import org.virtualbox_5_2.*;
public class MCFrameBuffer implements IFramebuffer {
private IDisplay display;

View file

@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.virtualbox_5_1.*;
import org.virtualbox_5_2.*;
import com.google.common.collect.Lists;
@ -35,7 +35,8 @@ public class PluginMain extends JavaPlugin {
this.getCommand("computer").setExecutor(new Commands());
ccs.sendMessage("§bInitializing VirtualBox...");
String vbpath = System.getProperty("os.name").toLowerCase().contains("mac")
? "/Applications/VirtualBox.app/Contents/MacOS" : "/opt/virtualbox";
? "/Applications/VirtualBox.app/Contents/MacOS"
: "/opt/virtualbox";
File f = new File(vbpath);
if (!f.isDirectory() || !Arrays.stream(f.list()).anyMatch(s -> s.contains("xpcom")))
vbpath = "/usr/lib/virtualbox";
@ -103,7 +104,7 @@ public class PluginMain extends JavaPlugin {
sender.sendMessage("B: " + machine.getState().toString());
final IConsole console = session.getConsole();
sender.sendMessage("1: " + console.getState().toString());
console.powerUp().waitForCompletion(10000);
console.powerUp();
sender.sendMessage("2: " + console.getState().toString());
console.getDisplay().attachFramebuffer(0L,
new IFramebuffer(new MCFrameBuffer(console.getDisplay())));
@ -115,7 +116,8 @@ public class PluginMain extends JavaPlugin {
&& console.getState().equals(MachineState.Running))
console.getDisplay().invalidateAndUpdateScreen(0L);
if (session.getState().equals(SessionState.Unlocked) // Stop if the machine stopped fully
|| console.getState().equals(MachineState.PoweredOff)) {
|| console.getState().equals(MachineState.PoweredOff)
|| console.getState().equals(MachineState.Saved)) {
sender.sendMessage("5: " + console.getState().toString());
if (session.getState().equals(SessionState.Locked)) {
session.unlockMachine();