diff --git a/com/aranai/crafty/ActiveUserActionListener.java b/src/com/aranai/crafty/ActiveUserActionListener.java similarity index 100% rename from com/aranai/crafty/ActiveUserActionListener.java rename to src/com/aranai/crafty/ActiveUserActionListener.java diff --git a/com/aranai/crafty/ActiveUserPopupListener.java b/src/com/aranai/crafty/ActiveUserPopupListener.java similarity index 100% rename from com/aranai/crafty/ActiveUserPopupListener.java rename to src/com/aranai/crafty/ActiveUserPopupListener.java diff --git a/com/aranai/crafty/CommandManager.java b/src/com/aranai/crafty/CommandManager.java similarity index 100% rename from com/aranai/crafty/CommandManager.java rename to src/com/aranai/crafty/CommandManager.java diff --git a/com/aranai/crafty/Crafty.java b/src/com/aranai/crafty/Crafty.java similarity index 97% rename from com/aranai/crafty/Crafty.java rename to src/com/aranai/crafty/Crafty.java index f8de232..3a355ae 100644 --- a/com/aranai/crafty/Crafty.java +++ b/src/com/aranai/crafty/Crafty.java @@ -55,15 +55,16 @@ import javax.swing.text.DefaultCaret; import javax.swing.text.StyledDocument; -import jline.console.ConsoleReader; -import joptsimple.OptionParser; -import joptsimple.OptionSet; +import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader; +import org.bukkit.craftbukkit.libs.joptsimple.OptionException; +import org.bukkit.craftbukkit.libs.joptsimple.OptionParser; +import org.bukkit.craftbukkit.libs.joptsimple.OptionSet; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.Main; import org.bukkit.entity.Player; -import net.minecraft.server.MinecraftServer; +import net.minecraft.server.DedicatedServer; import net.minecraft.server.PropertyManager; import net.minecraft.server.StatisticList; import net.minecraft.server.ThreadServerApplication; @@ -109,8 +110,8 @@ public static final class UserActions { protected JLabel statusMsg; protected JLabel activeUserLabel; - protected JList activeUserList; - protected DefaultListModel activeUserListModel; + protected JList activeUserList; + protected DefaultListModel activeUserListModel; protected JScrollPane activeUserScroller; protected JPopupMenu activeUserPopup; @@ -143,7 +144,7 @@ public static final class UserActions { protected PerformanceMonitor pf; protected OutputStream out; protected ByteArrayInputStream in; - protected MinecraftServer ms; + protected DedicatedServer ms; protected static Logger logger; private ThreadServerApplication tsa; private CraftyExceptionHandler eh; @@ -274,8 +275,8 @@ public void actionPerformed(ActionEvent e) activeUserLabel.setPreferredSize(new Dimension(190, 24)); commandPanel.add(activeUserLabel); - activeUserListModel = new DefaultListModel(); - activeUserList = new JList(activeUserListModel); + activeUserListModel = new DefaultListModel(); + activeUserList = new JList(activeUserListModel); activeUserListModel.addElement("Nobody"); activeUserList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); activeUserList.setLayoutOrientation(JList.VERTICAL); @@ -681,7 +682,7 @@ public void startServer() { this.cLog.log(Level.ALL, "Arg: "+s); } - } catch (joptsimple.OptionException ex) { + } catch (OptionException ex) { this.cLog.log(Level.SEVERE, ex.getLocalizedMessage()); } @@ -750,7 +751,7 @@ public void startServer() StatisticList.a(); // Create the Minecraft server - ms = new MinecraftServer(options); + ms = new DedicatedServer(options); // Override the default ConsoleReader with our own bizarro version // Ours sits around for a bit and then returns null @@ -765,7 +766,7 @@ public String readLine() throws IOException }; // Create our own ThreadServerApplication - tsa = new ThreadServerApplication("Server thread", ms); + tsa = new ThreadServerApplication(ms, "Server thread"); // Catch exceptions from the TSA ourselves (mainly used to catch system.exit() events) tsa.setUncaughtExceptionHandler(eh); @@ -775,7 +776,7 @@ public String readLine() throws IOException logger = Logger.getLogger("Minecraft"); } catch (Exception exception) { - MinecraftServer.log.log(Level.SEVERE, "Failed to start the minecraft server", exception); + DedicatedServer.log.log(Level.SEVERE, "Failed to start the minecraft server", exception); } } } @@ -962,10 +963,10 @@ public static void queueConsoleCommand(String cmd) { logger.info("SecurityException"); return; } - MinecraftServer ms; + DedicatedServer ms; try { f.setAccessible(true); - ms = (MinecraftServer) f.get(cs); + ms = (DedicatedServer) f.get(cs); } catch (IllegalArgumentException ex) { logger.info("IllegalArgumentException"); return; @@ -974,7 +975,7 @@ public static void queueConsoleCommand(String cmd) { return; } - if ((!ms.isStopped) && (MinecraftServer.isRunning(ms))) { + if ((!ms.isStopped()) && (ms.isRunning())) { ms.issueCommand(cmd, ms); } } @@ -1062,6 +1063,7 @@ public void prepAndPrintText(String text) int len = doc.getLength(); doc.insertString(len, text, tm.getCurrentTheme().getAttributeSet(Theme.TEXT_BASE)); + doc.insertString(len, "", tm.getCurrentTheme().getAttributeSet(Theme.TEXT_BASE)); //TODO test: this should prevent any lines that drop a reset code from bleeding into the rest of the console. // Style bracketed log indicators int at = text.indexOf("[INFO]"); @@ -1072,7 +1074,9 @@ public void prepAndPrintText(String text) if(at >= 0) { doc.setCharacterAttributes(len+at, 8, tm.getCurrentTheme().getAttributeSet(Theme.SYNTAX_SEVERE), false); } at = text.indexOf("[CRAFTY]"); if(at >= 0) { doc.setCharacterAttributes(len+at, 8, tm.getCurrentTheme().getAttributeSet(Theme.SYNTAX_CRAFTY), false); } - + + //TODO color codes here + // Style timestamp if(timestamp.length() > 0) { diff --git a/com/aranai/crafty/CraftyExceptionHandler.java b/src/com/aranai/crafty/CraftyExceptionHandler.java similarity index 100% rename from com/aranai/crafty/CraftyExceptionHandler.java rename to src/com/aranai/crafty/CraftyExceptionHandler.java diff --git a/com/aranai/crafty/CraftyThreadServerApplication.java b/src/com/aranai/crafty/CraftyThreadServerApplication.java similarity index 100% rename from com/aranai/crafty/CraftyThreadServerApplication.java rename to src/com/aranai/crafty/CraftyThreadServerApplication.java diff --git a/com/aranai/crafty/CraftyWindowListener.java b/src/com/aranai/crafty/CraftyWindowListener.java similarity index 100% rename from com/aranai/crafty/CraftyWindowListener.java rename to src/com/aranai/crafty/CraftyWindowListener.java diff --git a/com/aranai/crafty/ExitTrappedException.java b/src/com/aranai/crafty/ExitTrappedException.java similarity index 100% rename from com/aranai/crafty/ExitTrappedException.java rename to src/com/aranai/crafty/ExitTrappedException.java diff --git a/com/aranai/crafty/PerformanceMonitor.java b/src/com/aranai/crafty/PerformanceMonitor.java similarity index 94% rename from com/aranai/crafty/PerformanceMonitor.java rename to src/com/aranai/crafty/PerformanceMonitor.java index 6197ada..9728f3b 100644 --- a/com/aranai/crafty/PerformanceMonitor.java +++ b/src/com/aranai/crafty/PerformanceMonitor.java @@ -13,8 +13,7 @@ public class PerformanceMonitor { static final Runtime runtime = Runtime.getRuntime (); - @SuppressWarnings("restriction") - public synchronized double getCpuUsage() + public synchronized double getCpuUsage() { if ( lastSystemTime == 0 ) { @@ -46,7 +45,6 @@ public synchronized double getCpuUsage() return (cpuUsage / availableProcessors) * 100.0; } - @SuppressWarnings("restriction") private void baselineCounters() { lastSystemTime = System.nanoTime(); diff --git a/com/aranai/crafty/StatusBar.java b/src/com/aranai/crafty/StatusBar.java similarity index 100% rename from com/aranai/crafty/StatusBar.java rename to src/com/aranai/crafty/StatusBar.java diff --git a/com/aranai/crafty/Theme.java b/src/com/aranai/crafty/Theme.java similarity index 100% rename from com/aranai/crafty/Theme.java rename to src/com/aranai/crafty/Theme.java diff --git a/com/aranai/crafty/ThemeBuilder.java b/src/com/aranai/crafty/ThemeBuilder.java similarity index 100% rename from com/aranai/crafty/ThemeBuilder.java rename to src/com/aranai/crafty/ThemeBuilder.java diff --git a/com/aranai/crafty/ThemeManager.java b/src/com/aranai/crafty/ThemeManager.java similarity index 100% rename from com/aranai/crafty/ThemeManager.java rename to src/com/aranai/crafty/ThemeManager.java diff --git a/com/aranai/crafty/resources/ban.png b/src/com/aranai/crafty/resources/ban.png similarity index 100% rename from com/aranai/crafty/resources/ban.png rename to src/com/aranai/crafty/resources/ban.png diff --git a/com/aranai/crafty/resources/deop.png b/src/com/aranai/crafty/resources/deop.png similarity index 100% rename from com/aranai/crafty/resources/deop.png rename to src/com/aranai/crafty/resources/deop.png diff --git a/com/aranai/crafty/resources/getip.png b/src/com/aranai/crafty/resources/getip.png similarity index 100% rename from com/aranai/crafty/resources/getip.png rename to src/com/aranai/crafty/resources/getip.png diff --git a/com/aranai/crafty/resources/icon.png b/src/com/aranai/crafty/resources/icon.png similarity index 100% rename from com/aranai/crafty/resources/icon.png rename to src/com/aranai/crafty/resources/icon.png diff --git a/com/aranai/crafty/resources/kick.png b/src/com/aranai/crafty/resources/kick.png similarity index 100% rename from com/aranai/crafty/resources/kick.png rename to src/com/aranai/crafty/resources/kick.png diff --git a/com/aranai/crafty/resources/op.png b/src/com/aranai/crafty/resources/op.png similarity index 100% rename from com/aranai/crafty/resources/op.png rename to src/com/aranai/crafty/resources/op.png diff --git a/com/aranai/crafty/resources/shutdown.png b/src/com/aranai/crafty/resources/shutdown.png similarity index 100% rename from com/aranai/crafty/resources/shutdown.png rename to src/com/aranai/crafty/resources/shutdown.png