get bukkit 1.7.2 to compile

This commit is contained in:
Ryan Michela 2013-12-28 22:47:19 -08:00
parent e98113397d
commit 2326c7e2cb
4 changed files with 47 additions and 13 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.ryanmichela</groupId> <groupId>com.ryanmichela</groupId>
<artifactId>SSHD</artifactId> <artifactId>SSHD</artifactId>
<version>1.0</version> <version>1.1</version>
<url>http://dev.bukkit.org/server-mods/sshd/</url> <url>http://dev.bukkit.org/server-mods/sshd/</url>
<!-- Repositories --> <!-- Repositories -->
@ -30,7 +30,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.6.4-R1.0</version> <version>1.7.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
@ -41,11 +41,6 @@
<scope>compile</scope> <scope>compile</scope>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<!--<dependency>-->
<!--<groupId>org.bouncycastle</groupId>-->
<!--<artifactId>bcprov-jdk16</artifactId>-->
<!--<version>1.46</version>-->
<!--</dependency>-->
</dependencies> </dependencies>
<!-- Build --> <!-- Build -->

View File

@ -0,0 +1,42 @@
package com.ryanmichela.sshd;
/**
* Copyright 2013 Ryan Michela
*/
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
public class ConsoleLogFormatter extends Formatter {
private SimpleDateFormat dateFormat;
public ConsoleLogFormatter() {
this.dateFormat = new SimpleDateFormat("HH:mm:ss");
}
public String format(LogRecord logrecord) {
StringBuilder stringbuilder = new StringBuilder();
stringbuilder.append(" [");
stringbuilder.append(this.dateFormat.format(Long.valueOf(logrecord.getMillis()))).append(" ");
stringbuilder.append(logrecord.getLevel().getName()).append("]: ");
stringbuilder.append(this.formatMessage(logrecord));
stringbuilder.append('\n');
Throwable throwable = logrecord.getThrown();
if (throwable != null) {
StringWriter stringwriter = new StringWriter();
throwable.printStackTrace(new PrintWriter(stringwriter));
stringbuilder.append(stringwriter.toString());
}
return stringbuilder.toString();
}
}

View File

@ -10,7 +10,6 @@ import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.logging.Formatter;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.logging.StreamHandler; import java.util.logging.StreamHandler;
@ -66,19 +65,17 @@ public class ConsoleShellFactory implements Factory<Command> {
public void start(Environment env) throws IOException { public void start(Environment env) throws IOException {
Formatter bukkitFormatter = Bukkit.getLogger().getHandlers()[0].getFormatter();
try { try {
consoleReader = new ConsoleReader(in, new FlushyOutputStream(out), new SshTerminal()); consoleReader = new ConsoleReader(in, new FlushyOutputStream(out), new SshTerminal());
consoleReader.setExpandEvents(true); consoleReader.setExpandEvents(true);
consoleReader.addCompleter(new ConsoleCommandCompleter()); consoleReader.addCompleter(new ConsoleCommandCompleter());
streamHandler = new FlushyStreamHandler(out, bukkitFormatter, consoleReader); streamHandler = new FlushyStreamHandler(out, new ConsoleLogFormatter(), consoleReader);
Bukkit.getLogger().addHandler(streamHandler); Bukkit.getLogger().addHandler(streamHandler);
Logger.getLogger("").addHandler(streamHandler); Logger.getLogger("").addHandler(streamHandler);
environment = env; environment = env;
thread = new Thread(this, "EchoShell " + env.getEnv().get(Environment.ENV_USER)); thread = new Thread(this, "SSHD ConsoleShell " + env.getEnv().get(Environment.ENV_USER));
thread.start(); thread.start();
} catch (Exception e) { } catch (Exception e) {
throw new IOException("Error starting shell", e); throw new IOException("Error starting shell", e);

View File

@ -1,6 +1,6 @@
package com.ryanmichela.sshd; package com.ryanmichela.sshd;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang.ArrayUtils;
import org.apache.sshd.server.PublickeyAuthenticator; import org.apache.sshd.server.PublickeyAuthenticator;
import org.apache.sshd.server.session.ServerSession; import org.apache.sshd.server.session.ServerSession;