Attempted fix for 1.12.
This commit is contained in:
parent
956f0cc3ef
commit
f034cef465
19
pom.xml
19
pom.xml
@ -12,8 +12,8 @@
|
||||
<!-- Repositories -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>bukkit-repo</id>
|
||||
<url>http://repo.bukkit.org/content/groups/public/</url>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
@ -30,14 +30,15 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.9-R0.2</version>
|
||||
<scope>provided</scope>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<type>jar</type>
|
||||
<systemPath>${basedir}/bukkit-build/bukkit.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.sshd</groupId>
|
||||
<artifactId>sshd-core</artifactId>
|
||||
<version>0.9.0</version>
|
||||
<version>1.6.0</version>
|
||||
<scope>compile</scope>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
@ -47,7 +48,7 @@
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Shade plugin -->
|
||||
<plugin>
|
||||
<!--<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
@ -72,15 +73,15 @@
|
||||
</filters>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugin>-->
|
||||
<!-- Compile plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.0</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.ryanmichela.sshd;
|
||||
|
||||
import org.apache.sshd.server.PasswordAuthenticator;
|
||||
import org.apache.sshd.server.auth.password.PasswordAuthenticator;
|
||||
import org.apache.sshd.server.session.ServerSession;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.ryanmichela.sshd;
|
||||
|
||||
import org.apache.mina.util.Base64;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.math.BigInteger;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.ryanmichela.sshd;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.sshd.server.PublickeyAuthenticator;
|
||||
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
|
||||
import org.apache.sshd.server.session.ServerSession;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.ryanmichela.sshd;
|
||||
|
||||
import org.apache.sshd.SshServer;
|
||||
import org.apache.sshd.server.SshServer;
|
||||
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -41,7 +41,7 @@ public class SshdPlugin extends JavaPlugin {
|
||||
File hostKey = new File(getDataFolder(), "hostkey");
|
||||
File authorizedKeys = new File(getDataFolder(), "authorized_keys");
|
||||
|
||||
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(hostKey.getPath()));
|
||||
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(hostKey));
|
||||
sshd.setShellFactory(new ConsoleShellFactory());
|
||||
sshd.setPasswordAuthenticator(new ConfigPasswordAuthenticator());
|
||||
sshd.setPublickeyAuthenticator(new PublicKeyAuthenticator(authorizedKeys));
|
||||
|
@ -25,15 +25,18 @@ public class StreamHandlerAppender implements Appender {
|
||||
@Override
|
||||
public void append(LogEvent logEvent) {
|
||||
java.util.logging.Level level;
|
||||
switch (logEvent.getLevel())
|
||||
{
|
||||
case DEBUG: level = java.util.logging.Level.FINE; break;
|
||||
case INFO: level = java.util.logging.Level.INFO; break;
|
||||
case WARN: level = java.util.logging.Level.WARNING; break;
|
||||
case ERROR: level = java.util.logging.Level.SEVERE; break;
|
||||
default: level = java.util.logging.Level.INFO; break;
|
||||
}
|
||||
|
||||
if(logEvent.getLevel().equals(org.apache.logging.log4j.Level.DEBUG)) {
|
||||
level = java.util.logging.Level.FINE;
|
||||
} else if(logEvent.getLevel().equals(org.apache.logging.log4j.Level.INFO)) {
|
||||
level = java.util.logging.Level.INFO;
|
||||
} else if(logEvent.getLevel().equals(org.apache.logging.log4j.Level.WARN)) {
|
||||
level = java.util.logging.Level.WARNING;
|
||||
} else if(logEvent.getLevel().equals(org.apache.logging.log4j.Level.ERROR)) {
|
||||
level = java.util.logging.Level.SEVERE;
|
||||
} else {
|
||||
level = java.util.logging.Level.INFO;
|
||||
}
|
||||
String message = logEvent.getMessage().getFormattedMessage();
|
||||
|
||||
|
||||
@ -66,6 +69,16 @@ public class StreamHandlerAppender implements Appender {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public State getState() {
|
||||
return null; // TODO: Generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
// TODO: Generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
||||
@ -80,4 +93,9 @@ public class StreamHandlerAppender implements Appender {
|
||||
public boolean isStarted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStopped() {
|
||||
return false; // TODO: Generated method stub
|
||||
}
|
||||
}
|
||||
|
@ -32,12 +32,14 @@ public class PluginSlf4jFactory implements ILoggerFactory {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user