Builds and runs.
This commit is contained in:
@@ -15,6 +15,9 @@ import java.io.OutputStream;
|
||||
import java.util.logging.StreamHandler;
|
||||
|
||||
public class ConsoleShellFactory implements Factory<Command> {
|
||||
public Command get() {
|
||||
return this.create();
|
||||
}
|
||||
|
||||
public Command create() {
|
||||
return new ConsoleShell();
|
||||
@@ -92,7 +95,7 @@ public class ConsoleShellFactory implements Factory<Command> {
|
||||
String command;
|
||||
try {
|
||||
printPreamble(consoleReader);
|
||||
while(true) {
|
||||
while (true) {
|
||||
command = consoleReader.readLine("\r>", null);
|
||||
if (command != null) {
|
||||
if (command.equals("exit")) {
|
||||
@@ -109,7 +112,7 @@ public class ConsoleShellFactory implements Factory<Command> {
|
||||
}
|
||||
}
|
||||
|
||||
private void printPreamble(ConsoleReader consoleReader) throws IOException{
|
||||
private void printPreamble(ConsoleReader consoleReader) throws IOException {
|
||||
consoleReader.println(" _____ _____ _ _ _____");
|
||||
consoleReader.println(" / ____/ ____| | | | __ \\");
|
||||
consoleReader.println("| (___| (___ | |__| | | | |");
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ryanmichela.sshd;
|
||||
import org.apache.sshd.common.SshException;
|
||||
import org.bukkit.craftbukkit.libs.jline.console.ConsoleReader;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.logging.*;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class PemDecoder extends java.io.BufferedReader {
|
||||
}
|
||||
|
||||
public PublicKey getPemBytes() throws Exception {
|
||||
StringBuffer b64 = new StringBuffer();
|
||||
StringBuilder b64 = new StringBuilder();
|
||||
|
||||
String line = readLine();
|
||||
if (!line.matches(BEGIN)) {
|
||||
|
||||
@@ -28,9 +28,7 @@ public class ReflectionUtil {
|
||||
modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL);
|
||||
|
||||
f.set(o, newValue);
|
||||
} catch (NoSuchFieldException ex) {
|
||||
System.out.println("*** " + c.getName() + ":" + ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
} catch (NoSuchFieldException | IllegalAccessException ex) {
|
||||
System.out.println("*** " + c.getName() + ":" + ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,12 +71,12 @@ public class StreamHandlerAppender implements Appender {
|
||||
|
||||
@Override
|
||||
public State getState() {
|
||||
return null; // TODO: Generated method stub
|
||||
return State.INITIALIZED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
// TODO: Generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,6 +96,6 @@ public class StreamHandlerAppender implements Appender {
|
||||
|
||||
@Override
|
||||
public boolean isStopped() {
|
||||
return false; // TODO: Generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,24 +22,19 @@ public class PluginSlf4jFactory implements ILoggerFactory {
|
||||
private String name;
|
||||
|
||||
private boolean isEnabled(Level level) {
|
||||
if (SshdPlugin.instance != null) {
|
||||
return SshdPlugin.instance.getLogger().isLoggable(level);
|
||||
}
|
||||
return false;
|
||||
return SshdPlugin.instance != null && SshdPlugin.instance.getLogger().isLoggable(level);
|
||||
}
|
||||
|
||||
private void log(Level level, String s, Object[] objects) {
|
||||
if (SshdPlugin.instance != null && isEnabled(level)) {
|
||||
FormattingTuple ft = MessageFormatter.arrayFormat(s, objects);
|
||||
SshdPlugin.instance.getLogger().log(level, ft.getMessage(), ft.getThrowable());
|
||||
SshdPlugin.instance.getLogger().log(level, s, Thread.currentThread().getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
private void log(Level level, String s, Throwable throwable) {
|
||||
if (SshdPlugin.instance != null && isEnabled(level)) {
|
||||
SshdPlugin.instance.getLogger().log(level, s, throwable);
|
||||
SshdPlugin.instance.getLogger().log(level, s, Thread.currentThread().getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user