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> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.12-R0.1-SNAPSHOT</version> <version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View file

@ -77,12 +77,12 @@
<dependency> <dependency>
<groupId>org.virtualbox</groupId> <groupId>org.virtualbox</groupId>
<artifactId>VirtualBox</artifactId> <artifactId>VirtualBox</artifactId>
<version>5.1</version> <version>5.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.12-R0.1-SNAPSHOT</version> <version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna --> <!-- 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> <groupId>org.virtualbox</groupId>
<artifactId>VirtualBox</artifactId> <artifactId>VirtualBox</artifactId>
<versioning> <versioning>
<release>5.1</release> <release>5.2</release>
<versions> <versions>
<version>5.1</version> <version>5.1</version>
<version>5.2</version>
</versions> </versions>
<lastUpdated>20170706160733</lastUpdated> <lastUpdated>20171219203228</lastUpdated>
</versioning> </versioning>
</metadata> </metadata>

View file

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

View file

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