Update to v4.3

Mavenized project
Refractored files to me.totalfreedom.bukkittelnet package
Use instances instead of singletons
Fix event behaviour
Fix not being able to execute vanilla commands
Mass format
Compile for Java 1.7
Other changes
This commit is contained in:
Jerom van der Sar 2016-03-05 22:03:06 +01:00
parent 10a524f980
commit bd1d0c207b
32 changed files with 666 additions and 1748 deletions

22
.gitignore vendored
View File

@ -1,14 +1,26 @@
# Netbeans excludes
/nbproject/private/
/dist/
/build/
/nbproject/private
/dist
/build
nb-configuration.xml
manifest.mf
# Now defines that Maven CheckStyle is used
# nb-configuration.xml
# Eclipse excludes
.project
.classpath
/bin/
/.settings/
/bin
/.settings
# IntelliJ excludes
*.iml
*.ipr
*.iws
/.idea
# Maven excludes
/target
# OS generated files
.DS_Store

View File

@ -1,3 +1,54 @@
# BukkitTelnet License #
# TotalFreedom General License #
_Version 2.0, 27th February 2015_
BukkitTelnet is licensed under the TotalFreedom General License. It is available [here](https://github.com/TotalFreedom/License/blob/master/LICENSE.md).
Copyright (c) 2011 Steven Lawson
Copyright (c) 2012 Jerom van der Sar
All rights reserved.
##### 1. Definitions #####
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by this document.
"Licensor" shall mean the copyright holder or entity authorised by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You", "Your" or "Yourself" shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, binary data, generated documentation, and conversions to other media types.
"Work" and "This Software" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
"Redistribution" shall mean any partial or complete availability, transfer or publication of the Work from one Legal Entity to another.
##### 2. Grant of Copyright License #####
Subject to the terms and conditions of this License, You are granted a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to prepare Derivative Works of, publicly display, publicly perform, inspect and redistribute the Work and such Derivative Works as long as the following conditions are met:
1. Redistributions of This Software must solely occur in Source form. Redistribution in Object form is prohibited without prior written permission from the Licensor.
2. Neither the names of the copyright holders nor the names this software's contributors may be removed from This Software's source code.
3. Neither the names of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from This Software without specific prior written permission.
4. Accreditations referencing This Software's copyright holders or contributors may neither be altered or removed from source code nor withheld from reproduction in Object form whatsoever.
5. Any conditions specified by this license may be temporarily or permanently waived by any the aforementioned copyright holders.
6. Redistributions of This Software must retain this License document in its exact form.
7. Sub licensing of This Software is prohibited without prior written permission from the Licensor.
##### 3. Submission of Contributions #####
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
##### 4. Disclaimer of Warranty #####
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

133
checkstyle.xml Normal file
View File

@ -0,0 +1,133 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java, properties, xml"/>
<module name="SuppressionFilter">
<property name="file" value="supressions.xml" />
</module>
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="TreeWalker">
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format" value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message" value="Avoid using corresponding octal or Unicode escape."/>
</module>
<module name="LineLength">
<property name="max" value="200"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="NeedBraces"/>
<module name="LeftCurly">
<property name="option" value="nl"/>
</module>
<module name="RightCurly">
<property name="option" value="alone"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OneStatementPerLine"/>
<module name="ArrayTypeStyle"/>
<module name="FallThrough"/>
<module name="UpperEll"/>
<module name="ModifierOrder"/>
<module name="SeparatorWrap">
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<property name="format" value="(^[A-Z][0-9]?)$|(^[A-Z][_a-zA-Z0-9]*$)"/>
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][_a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z][_a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalVariableName">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="format" value="^[a-z][_a-zA-Z0-9]*$"/>
<property name="allowOneCharVarInForLoop" value="true"/>
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="CustomImportOrder"/><!-- http://checkstyle.sourceforge.net/config_imports.html -->
<module name="MethodParamPad"/>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
</module>
<module name="AnnotationLocation">
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="CommentsIndentation"/>
</module>
</module>

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
build.xml.data.CRC32=ad7c8973
build.xml.script.CRC32=48b261b8
build.xml.stylesheet.CRC32=8064a381@1.74.2.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=ad7c8973
nbproject/build-impl.xml.script.CRC32=2da68af5
nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46

View File

@ -1,102 +0,0 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=0
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterClassHeader=0
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.enableCommentFormatting=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeCatchOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
application.title=BukkitTelnet
application.vendor=Steven Lawson
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/BukkitTelnet.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${libs.Bukkit.classpath}:\
${libs.Log4J-core.classpath}:\
${libs.Log4J-api.classpath}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.6
javac.target=1.6
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=true
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>BukkitTelnet</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots/>
</data>
</configuration>
</project>

128
pom.xml Normal file
View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.totalfreedom</groupId>
<artifactId>bukkittelnet</artifactId>
<version>4.3</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jar.finalName>${project.name}</jar.finalName>
</properties>
<name>BukkitTelnet</name>
<description>Admin telnet access for minecraft servers.</description>
<url>https://github.com/TotalFreedom/BukkitTelnet</url>
<licenses>
<license>
<name>TotalFreedom General License</name>
<url>https://github.com/TotalFreedom/License/blob/master/LICENSE.md</url>
</license>
</licenses>
<organization>
<name>Total Freedom</name>
<url>https://totalfreedom.me</url>
</organization>
<scm>
<connection>scm:git:git@github.com:TotalFreedom/BukkitTelnet.git</connection>
<developerConnection>scm:git:git@github.com:TotalFreedom/BukkitTelnet.git</developerConnection>
<url>git@github.com:TotalFreedom/BukkitTelnet.git</url>
</scm>
<repositories>
<repository>
<id>spigot</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.9-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Compiler -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<compilerVersion>1.7</compilerVersion>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- Checkstyle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>2.17</version>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<!-- Checkstyle -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>2.17</version>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
<consoleOutput>true</consoleOutput>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,55 @@
package me.totalfreedom.bukkittelnet;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;
public class BukkitTelnet extends JavaPlugin
{
private BukkitTelnet plugin;
public TelnetConfigLoader config;
public TelnetServer telnet;
public TelnetLogAppender appender;
public PlayerEventListener listener;
@Override
public void onLoad()
{
plugin = this;
config = new TelnetConfigLoader(plugin);
telnet = new TelnetServer(plugin, config.getConfig());
appender = new TelnetLogAppender();
listener = new PlayerEventListener(plugin);
TelnetLogger.setPluginLogger(plugin.getLogger());
TelnetLogger.setServerLogger(Bukkit.getLogger());
}
@Override
public void onEnable()
{
config.load();
appender.attach();
telnet.startServer();
getServer().getPluginManager().registerEvents(listener, plugin);
TelnetLogger.info(plugin.getName() + " v" + plugin.getDescription().getVersion() + " enabled");
}
@Override
public void onDisable()
{
HandlerList.unregisterAll(plugin);
appender.deattach();
appender.removeAllSesssions();
telnet.stopServer();
TelnetLogger.info(plugin.getName() + " disabled");
}
}

View File

@ -1,9 +1,9 @@
package me.StevenLawson.BukkitTelnet;
package me.totalfreedom.bukkittelnet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import me.StevenLawson.BukkitTelnet.api.TelnetRequestDataTagsEvent;
import me.totalfreedom.bukkittelnet.api.TelnetRequestDataTagsEvent;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -20,8 +20,12 @@ import org.json.simple.JSONObject;
public class PlayerEventListener implements Listener
{
public PlayerEventListener()
private final BukkitTelnet plugin;
public PlayerEventListener(BukkitTelnet plugin)
{
this.plugin = plugin;
}
@EventHandler(priority = EventPriority.MONITOR)
@ -30,12 +34,6 @@ public class PlayerEventListener implements Listener
triggerPlayerListUpdates();
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerKick(PlayerKickEvent event)
{
triggerPlayerListUpdates();
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event)
{
@ -44,7 +42,7 @@ public class PlayerEventListener implements Listener
private static BukkitTask updateTask = null;
public static void triggerPlayerListUpdates()
public void triggerPlayerListUpdates()
{
if (updateTask != null)
{
@ -56,7 +54,7 @@ public class PlayerEventListener implements Listener
@Override
public void run()
{
final SocketListener socketListener = TelnetServer.getInstance().getSocketListener();
final SocketListener socketListener = plugin.telnet.getSocketListener();
if (socketListener != null)
{
final TelnetRequestDataTagsEvent event = new TelnetRequestDataTagsEvent();
@ -64,7 +62,7 @@ public class PlayerEventListener implements Listener
socketListener.triggerPlayerListUpdates(generatePlayerList(event.getDataTags()));
}
}
}.runTaskLater(BukkitTelnet.plugin, 20L * 2L);
}.runTaskLater(plugin, 20L * 2L);
}
@SuppressWarnings("unchecked")
@ -75,7 +73,7 @@ public class PlayerEventListener implements Listener
final Iterator<Map.Entry<Player, Map<String, Object>>> dataTagsIt = dataTags.entrySet().iterator();
while (dataTagsIt.hasNext())
{
final HashMap<String, String> info = new HashMap<String, String>();
final HashMap<String, String> info = new HashMap<>();
final Map.Entry<Player, Map<String, Object>> dataTagsEntry = dataTagsIt.next();
final Player player = dataTagsEntry.getKey();

View File

@ -1,4 +1,4 @@
package me.StevenLawson.BukkitTelnet;
package me.totalfreedom.bukkittelnet;
import java.io.BufferedWriter;
import java.io.IOException;
@ -12,20 +12,22 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import me.StevenLawson.BukkitTelnet.session.ClientSession;
import me.totalfreedom.bukkittelnet.session.ClientSession;
public class SocketListener extends Thread
{
public static long LISTEN_THRESHOLD_MILLIS = 10000;
private final ServerSocket serverSocket;
private final List<ClientSession> clientSessions;
private final Map<InetAddress, Long> recentIPs;
public SocketListener(ServerSocket serverSocket)
public static long LISTEN_THRESHOLD_MILLIS = 10000;
//
private final TelnetServer telnet;
private final ServerSocket serverSocket;
private final List<ClientSession> clientSessions = new ArrayList<>();
private final Map<InetAddress, Long> recentIPs = new HashMap<>();
public SocketListener(TelnetServer telnet, ServerSocket serverSocket)
{
this.telnet = telnet;
this.serverSocket = serverSocket;
this.clientSessions = new ArrayList<ClientSession>();
this.recentIPs = new HashMap<InetAddress, Long>();
}
@Override
@ -46,7 +48,6 @@ public class SocketListener extends Thread
// Remove old entries
final Iterator<Entry<InetAddress, Long>> it = recentIPs.entrySet().iterator();
Entry<InetAddress, Long> entry;
while (it.hasNext())
{
if (it.next().getValue() + LISTEN_THRESHOLD_MILLIS < System.currentTimeMillis())
@ -89,12 +90,14 @@ public class SocketListener extends Thread
recentIPs.put(addr, System.currentTimeMillis());
final ClientSession clientSession = new ClientSession(clientSocket);
final ClientSession clientSession = new ClientSession(telnet, clientSocket);
clientSessions.add(clientSession);
clientSession.start();
removeDisconnected();
}
TelnetLogger.info("Server closed");
}
private void removeDisconnected()
@ -107,7 +110,7 @@ public class SocketListener extends Thread
if (!session.syncIsConnected())
{
TelnetLogAppender.getInstance().removeSession(session);
telnet.getPlugin().appender.removeSession(session);
it.remove();
}
}

View File

@ -1,23 +1,24 @@
package me.StevenLawson.BukkitTelnet;
package me.totalfreedom.bukkittelnet;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.pravian.bukkitlib.YamlConfig;
import me.totalfreedom.bukkittelnet.thirdparty.YamlConfig;
public class TelnetConfig
public class TelnetConfigLoader
{
private final YamlConfig config;
private final SimpleConfigEntries configEntries;
private TelnetConfig()
private final YamlConfig config;
private final TelnetConfig configEntries;
public TelnetConfigLoader(BukkitTelnet plugin)
{
configEntries = new SimpleConfigEntries();
config = new YamlConfig(BukkitTelnet.plugin, "config.yml", true);
configEntries = new TelnetConfig();
config = new YamlConfig(plugin, "config.yml", true);
}
public void loadConfig()
public void load()
{
config.load();
@ -48,21 +49,22 @@ public class TelnetConfig
}
}
public SimpleConfigEntries getConfigEntries()
public TelnetConfig getConfig()
{
return configEntries;
}
public static final class SimpleConfigEntries
public static final class TelnetConfig
{
private int port;
private String address;
private String password;
private final Map<String, List<String>> admins;
private SimpleConfigEntries()
private TelnetConfig()
{
admins = new HashMap<String, List<String>>();
admins = new HashMap<>();
}
public int getPort()
@ -111,13 +113,4 @@ public class TelnetConfig
}
}
public static TelnetConfig getInstance()
{
return TelnetConfigHolder.INSTANCE;
}
private static class TelnetConfigHolder
{
private static final TelnetConfig INSTANCE = new TelnetConfig();
}
}

View File

@ -1,26 +1,30 @@
package me.StevenLawson.BukkitTelnet;
package me.totalfreedom.bukkittelnet;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import me.StevenLawson.BukkitTelnet.session.ClientSession;
import me.StevenLawson.BukkitTelnet.session.FilterMode;
import me.totalfreedom.bukkittelnet.session.ClientSession;
import me.totalfreedom.bukkittelnet.session.FilterMode;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.appender.AbstractAppender;
public class TelnetLogAppender extends AbstractAppender
{
private final Set<ClientSession> sessions;
private final SimpleDateFormat dateFormat;
private TelnetLogAppender()
public TelnetLogAppender()
{
super("BukkitTelnet", null, null);
this.sessions = new HashSet<ClientSession>();
this.sessions = new HashSet<>();
this.dateFormat = new SimpleDateFormat("HH:mm:ss");
super.start();
@ -53,33 +57,33 @@ public class TelnetLogAppender extends AbstractAppender
for (ClientSession session : sessions)
{
if (!session.syncIsConnected())
try
{
continue;
}
if (session.getFilterMode() == FilterMode.CHAT_ONLY)
{
if (!(message.startsWith("<")
|| message.startsWith("[Server")
|| message.startsWith("[CONSOLE") || message.startsWith("[TotalFreedomMod] [ADMIN]")))
if (!session.syncIsConnected())
{
return;
continue;
}
}
if (session.getFilterMode() == FilterMode.NONCHAT_ONLY)
{
if (message.startsWith("<")
boolean chat = message.startsWith("<")
|| message.startsWith("[Server")
|| message.startsWith("[CONSOLE")
|| message.startsWith("[TotalFreedomMod] [ADMIN]"))
{
return;
}
}
|| message.startsWith("[CONSOLE") || message.startsWith("[TotalFreedomMod] [ADMIN]");
session.printRawLine(formatMessage(message, event));
if (session.getFilterMode() == FilterMode.CHAT_ONLY && !chat)
{
continue;
}
if (session.getFilterMode() == FilterMode.NONCHAT_ONLY && chat)
{
continue;
}
session.writeRawLine(formatMessage(message, event));
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
@ -89,7 +93,7 @@ public class TelnetLogAppender extends AbstractAppender
final Throwable ex = event.getThrown();
builder.append("[");
builder.append(dateFormat.format(event.getMillis()));
builder.append(dateFormat.format(new Date()));
builder.append(" ");
builder.append(event.getLevel().name().toUpperCase());
builder.append("]: ");
@ -105,13 +109,14 @@ public class TelnetLogAppender extends AbstractAppender
return builder.toString();
}
public static TelnetLogAppender getInstance()
public void attach()
{
return TelnetLogAppenderHolder.INSTANCE;
((Logger) LogManager.getRootLogger()).addAppender(this);
}
private static class TelnetLogAppenderHolder
public void deattach()
{
private static final TelnetLogAppender INSTANCE = new TelnetLogAppender();
((Logger) LogManager.getRootLogger()).removeAppender(this);
}
}

View File

@ -1,18 +1,16 @@
package me.StevenLawson.BukkitTelnet;
package me.totalfreedom.bukkittelnet;
import java.util.logging.Logger;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
public final class TelnetLogger
{
private static Logger serverLogger = null;
private static Logger pluginLogger = null;
private TelnetLogger()
{
throw new AssertionError();
}
public static void setServerLogger(Logger serverLogger)

View File

@ -1,26 +1,35 @@
package me.StevenLawson.BukkitTelnet;
package me.totalfreedom.bukkittelnet;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.UnknownHostException;
import me.StevenLawson.BukkitTelnet.TelnetConfig.SimpleConfigEntries;
import lombok.Getter;
import me.totalfreedom.bukkittelnet.TelnetConfigLoader.TelnetConfig;
import me.totalfreedom.bukkittelnet.api.Server;
public class TelnetServer
public class TelnetServer implements Server
{
@Getter
private final BukkitTelnet plugin;
@Getter
private final TelnetConfig config;
//
private SocketListener socketListener;
private TelnetServer()
public TelnetServer(BukkitTelnet plugin, TelnetConfig config)
{
this.plugin = plugin;
this.config = config;
}
@Override
public void startServer()
{
// If the server is running, stop it
stopServer();
final SimpleConfigEntries config = TelnetConfig.getInstance().getConfigEntries();
// Server address, optional.
final InetAddress hostAddress;
@ -64,13 +73,14 @@ public class TelnetServer
return;
}
socketListener = new SocketListener(serversocket);
socketListener = new SocketListener(this, serversocket);
socketListener.start();
final String host = serversocket.getInetAddress().getHostAddress().replace("0.0.0.0", "*");
TelnetLogger.info("Server started on " + host + ":" + serversocket.getLocalPort());
}
@Override
public void stopServer()
{
if (socketListener == null)
@ -81,18 +91,10 @@ public class TelnetServer
socketListener.stopServer();
}
@Override
public SocketListener getSocketListener()
{
return socketListener;
}
public static TelnetServer getInstance()
{
return TelnetServerHolder.INSTANCE;
}
private static class TelnetServerHolder
{
private static final TelnetServer INSTANCE = new TelnetServer();
}
}

View File

@ -1,7 +1,8 @@
package me.StevenLawson.BukkitTelnet;
package me.totalfreedom.bukkittelnet;
public class Util
{
public static boolean fuzzyIpMatch(String a, String b, int octets)
{
boolean match = true;

View File

@ -0,0 +1,19 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package me.totalfreedom.bukkittelnet.api;
import me.totalfreedom.bukkittelnet.SocketListener;
public interface Server
{
public void startServer();
public void stopServer();
public SocketListener getSocketListener();
}

View File

@ -1,10 +1,14 @@
package me.StevenLawson.BukkitTelnet.api;
package me.totalfreedom.bukkittelnet.api;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
public class TelnetCommandEvent extends TelnetEvent implements Cancellable
{
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private CommandSender sender;
private String command;
@ -52,4 +56,15 @@ public class TelnetCommandEvent extends TelnetEvent implements Cancellable
this.command = command;
}
@Override
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -0,0 +1,8 @@
package me.totalfreedom.bukkittelnet.api;
import org.bukkit.event.server.ServerEvent;
public abstract class TelnetEvent extends ServerEvent
{
}

View File

@ -1,11 +1,14 @@
package me.StevenLawson.BukkitTelnet.api;
package me.totalfreedom.bukkittelnet.api;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
public class TelnetPreLoginEvent extends TelnetEvent implements Cancellable
{
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false;
//
private String name;
private final String ip;
private boolean bypassPassword;
@ -53,4 +56,15 @@ public class TelnetPreLoginEvent extends TelnetEvent implements Cancellable
{
this.bypassPassword = bypassPassword;
}
@Override
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -1,13 +1,16 @@
package me.StevenLawson.BukkitTelnet.api;
package me.totalfreedom.bukkittelnet.api;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
public class TelnetRequestDataTagsEvent extends TelnetEvent
{
private final Map<Player, Map<String, Object>> dataTags = new HashMap<Player, Map<String, Object>>();
private static final HandlerList handlers = new HandlerList();
private final Map<Player, Map<String, Object>> dataTags = new HashMap<>();
public TelnetRequestDataTagsEvent()
{
@ -21,4 +24,15 @@ public class TelnetRequestDataTagsEvent extends TelnetEvent
{
return dataTags;
}
@Override
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -1,7 +1,7 @@
package me.StevenLawson.BukkitTelnet.session;
package me.totalfreedom.bukkittelnet.session;
import me.StevenLawson.BukkitTelnet.api.TelnetPreLoginEvent;
import me.StevenLawson.BukkitTelnet.api.TelnetCommandEvent;
import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
import me.totalfreedom.bukkittelnet.api.TelnetCommandEvent;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
@ -11,12 +11,9 @@ import java.net.Socket;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import me.StevenLawson.BukkitTelnet.BukkitTelnet;
import me.StevenLawson.BukkitTelnet.PlayerEventListener;
import me.StevenLawson.BukkitTelnet.TelnetConfig;
import me.StevenLawson.BukkitTelnet.TelnetLogAppender;
import me.StevenLawson.BukkitTelnet.TelnetLogger;
import me.StevenLawson.BukkitTelnet.Util;
import me.totalfreedom.bukkittelnet.TelnetLogger;
import me.totalfreedom.bukkittelnet.TelnetServer;
import me.totalfreedom.bukkittelnet.Util;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Server;
@ -24,14 +21,16 @@ import org.bukkit.scheduler.BukkitRunnable;
public final class ClientSession extends Thread
{
public static final Pattern NONASCII_FILTER = Pattern.compile("[^\\x20-\\x7E]");
public static final Pattern AUTH_INPUT_FILTER = Pattern.compile("[^a-zA-Z0-9]");
public static final Pattern COMMAND_INPUT_FILTER = Pattern.compile("^[^a-zA-Z0-9/\\?!\\.]+");
//
private final TelnetServer telnet;
private final Socket clientSocket;
private final String clientAddress;
//
private final SessionCommandSender commandSender;
//
private FilterMode filterMode;
//
private BufferedWriter writer;
@ -40,21 +39,21 @@ public final class ClientSession extends Thread
private boolean hasTerminated;
private boolean enhancedMode = false;
public ClientSession(Socket clientSocket)
public ClientSession(TelnetServer telnet, Socket clientSocket)
{
this.telnet = telnet;
this.clientSocket = clientSocket;
this.clientAddress = clientSocket.getInetAddress().getHostAddress();
this.username = "";
this.commandSender = new SessionCommandSender(this);
this.filterMode = FilterMode.FULL;
this.hasTerminated = false;
TelnetLogger.info("Client connected: " + clientAddress);
}
@Override
public void run()
{
TelnetLogger.info("Client connected: " + clientAddress);
try
{
synchronized (clientSocket)
@ -100,7 +99,7 @@ public final class ClientSession extends Thread
hasTerminated = true;
TelnetLogger.info("Closing connection: " + clientAddress + (username.isEmpty() ? "" : " (" + username + ")"));
TelnetLogAppender.getInstance().removeSession(this);
telnet.getPlugin().appender.removeSession(this);
synchronized (clientSocket)
{
@ -141,7 +140,12 @@ public final class ClientSession extends Thread
this.filterMode = filterMode;
}
public void printRawLine(String message)
public void writeLine(String message)
{
writeRawLine("[" + (username.isEmpty() ? "" : username + "@") + "BukkitTelnet]$ " + message);
}
public void writeRawLine(String message)
{
if (writer == null || !syncIsConnected())
{
@ -158,11 +162,6 @@ public final class ClientSession extends Thread
}
}
public void writeLine(String message)
{
printRawLine("[" + (username.isEmpty() ? "" : username + "@") + "BukkitTelnet]$ " + message);
}
public void flush()
{
if (writer == null || !syncIsConnected())
@ -191,19 +190,14 @@ public final class ClientSession extends Thread
final TelnetCommandEvent event = new TelnetCommandEvent(commandSender, command);
server.getPluginManager().callEvent(event);
if (event.isCancelled())
{
return;
}
if (event.getCommand().isEmpty())
if (event.isCancelled() || event.getCommand().isEmpty())
{
return;
}
server.dispatchCommand(event.getSender(), event.getCommand());
}
}.runTask(BukkitTelnet.plugin);
}.runTask(telnet.getPlugin());
}
private boolean authenticate()
@ -218,7 +212,7 @@ public final class ClientSession extends Thread
// Pre-authenticate IP addresses
if (clientAddress != null)
{
final Map<String, List<String>> admins = TelnetConfig.getInstance().getConfigEntries().getAdmins();
final Map<String, List<String>> admins = telnet.getConfig().getAdmins();
// For every admin
for (String name : admins.keySet())
@ -337,7 +331,7 @@ public final class ClientSession extends Thread
input = AUTH_INPUT_FILTER.matcher(input).replaceAll("").trim();
if (TelnetConfig.getInstance().getConfigEntries().getPassword().equals(input))
if (telnet.getConfig().getPassword().equals(input))
{
return true;
}
@ -366,7 +360,7 @@ public final class ClientSession extends Thread
TelnetLogger.info(clientAddress + " logged in as \"" + username + "\".");
// Start feeding data to the client.
TelnetLogAppender.getInstance().addSession(this);
telnet.getPlugin().appender.addSession(this);
// Process commands
while (syncIsConnected())
@ -379,6 +373,7 @@ public final class ClientSession extends Thread
}
catch (IOException ex)
{
TelnetLogger.severe(ex);
break;
}
@ -421,6 +416,7 @@ public final class ClientSession extends Thread
{
writeLine("Shutting down the server...");
TelnetLogger.warning(username + ": Shutting down the server...");
Bukkit.shutdown();
System.exit(0);
}
else if ("telnet.log".equalsIgnoreCase(command))
@ -449,7 +445,7 @@ public final class ClientSession extends Thread
}
else if ("telnet.exit".equalsIgnoreCase(command))
{
writeLine("Goodbye.");
writeLine("Goodbye. <3");
syncTerminateSession();
}
else if ("telnet.enhanced".equalsIgnoreCase(command))
@ -458,7 +454,7 @@ public final class ClientSession extends Thread
writeLine((enhancedMode ? "A" : "Dea") + "ctivated enhanced mode.");
if (enhancedMode)
{
PlayerEventListener.triggerPlayerListUpdates();
telnet.getPlugin().listener.triggerPlayerListUpdates();
}
}
else

View File

@ -1,7 +1,8 @@
package me.StevenLawson.BukkitTelnet.session;
package me.totalfreedom.bukkittelnet.session;
public enum FilterMode
{
FULL,
NONCHAT_ONLY,
CHAT_ONLY;

View File

@ -1,16 +1,19 @@
package me.StevenLawson.BukkitTelnet.session;
package me.totalfreedom.bukkittelnet.session;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
public class SessionCommandSender implements CommandSender
public class SessionCommandSender implements ConsoleCommandSender
{
private final ClientSession session;
public SessionCommandSender(ClientSession session)
@ -21,13 +24,7 @@ public class SessionCommandSender implements CommandSender
@Override
public void sendMessage(String message)
{
session.printRawLine(message);
}
@Override
public String getName()
{
return this.session.getUserName();
session.writeRawLine(message);
}
@Override
@ -39,6 +36,12 @@ public class SessionCommandSender implements CommandSender
}
}
@Override
public String getName()
{
return this.session.getUserName();
}
@Override
public Server getServer()
{
@ -119,4 +122,38 @@ public class SessionCommandSender implements CommandSender
public void setOp(boolean value)
{
}
@Override
public boolean isConversing()
{
return false;
}
@Override
public void acceptConversationInput(String string)
{
}
@Override
public boolean beginConversation(Conversation c)
{
return false;
}
@Override
public void abandonConversation(Conversation c)
{
}
@Override
public void abandonConversation(Conversation c, ConversationAbandonedEvent cae)
{
}
@Override
public void sendRawMessage(String string)
{
session.writeRawLine(string);
}
}

View File

@ -1,4 +1,4 @@
package net.pravian.bukkitlib;
package me.totalfreedom.bukkittelnet.thirdparty;
import java.io.File;
import java.io.FileInputStream;
@ -19,6 +19,7 @@ import org.bukkit.plugin.Plugin;
*/
public class FileUtils
{
/**
* Downloads a file from the specified URIL and saves it at the specified location.
*
@ -121,7 +122,8 @@ public class FileUtils
/**
* Delete a specified folder and all contents quietly.
*
* <p><b>Warning</b>: This method will delete files, only folders!</p>
* <p>
* <b>Warning</b>: This method will delete files, only folders!</p>
*
* @param file The folder to delete.
* @return true if the delete was successful.

View File

@ -1,4 +1,4 @@
package net.pravian.bukkitlib;
package me.totalfreedom.bukkittelnet.thirdparty;
import java.io.File;
import java.io.IOException;
@ -13,6 +13,7 @@ import org.bukkit.plugin.Plugin;
*/
public class YamlConfig extends YamlConfiguration
{
private final Plugin PLUGIN;
private final File CONFIG_FILE;
private final boolean COPY_DEFAULTS;
@ -20,7 +21,8 @@ public class YamlConfig extends YamlConfiguration
/**
* Creates a new YamlConfig instance.
*
* <p>Example:
* <p>
* Example:
* <pre>
* YamlConfig config = new YamlConfig(this, "config.yml", true);
* config.load();
@ -38,7 +40,8 @@ public class YamlConfig extends YamlConfiguration
/**
* Creates a new YamlConfig instance.
*
* <p>Example:
* <p>
* Example:
* <pre>
* YamlConfig config = new YamlConfig(this, new File(plugin.getDataFolder() + "/players", "DarthSalamon.yml"), false);
* config.load();
@ -76,7 +79,8 @@ public class YamlConfig extends YamlConfiguration
/**
* Loads the configuration from the predefined file.
*
* <p>Optionally, if loadDefaults has been set to true, the file will be copied over from the default inside the jar-file of the owning plugin.</p>
* <p>
* Optionally, if loadDefaults has been set to true, the file will be copied over from the default inside the jar-file of the owning plugin.</p>
*
* @see #YamlConfig(Plugin, String, boolean)
*/
@ -126,6 +130,7 @@ public class YamlConfig extends YamlConfiguration
/**
* Returns the default configuration as been stored in the jar-file of the owning plugin.
*
* @return The default configuration.
*/
public YamlConfiguration getDefaultConfig()

View File

@ -13,7 +13,7 @@ password: 'walrus'
admins:
madgeek1450:
- 74.131.135.3
darthsalamon:
- 94.209.214.179
prozza:
- 176.56.237.227
markbyron:
- 71.47.67.103

View File

@ -0,0 +1,5 @@
name: BukkitTelnet
main: me.totalfreedom.bukkittelnet.BukkitTelnet
version: 4.3
description: Telnet console access plugin.
authors: [bekvon, Madgeek1450, Prozza]

View File

@ -1,44 +0,0 @@
package me.StevenLawson.BukkitTelnet;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.Logger;
import org.bukkit.Server;
import org.bukkit.plugin.java.JavaPlugin;
public class BukkitTelnet extends JavaPlugin
{
public static BukkitTelnet plugin;
public static Server server;
@Override
public void onLoad()
{
plugin = this;
server = plugin.getServer();
TelnetLogger.setPluginLogger(plugin.getLogger());
TelnetLogger.setServerLogger(server.getLogger());
}
@Override
public void onEnable()
{
TelnetConfig.getInstance().loadConfig();
((Logger) LogManager.getRootLogger()).addAppender(TelnetLogAppender.getInstance());
TelnetServer.getInstance().startServer();
TelnetLogger.info(plugin.getName() + " v" + plugin.getDescription().getVersion() + " enabled");
this.getServer().getPluginManager().registerEvents(new PlayerEventListener(), plugin);
}
@Override
public void onDisable()
{
TelnetServer.getInstance().stopServer();
TelnetLogger.info(plugin.getName() + " disabled.");
}
}

View File

@ -1,20 +0,0 @@
package me.StevenLawson.BukkitTelnet.api;
import org.bukkit.event.HandlerList;
import org.bukkit.event.server.ServerEvent;
public abstract class TelnetEvent extends ServerEvent
{
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -1,5 +0,0 @@
name: BukkitTelnet
main: me.StevenLawson.BukkitTelnet.BukkitTelnet
version: 4.2
description: Telnet console access plugin.
authors: [bekvon, Madgeek1450, DarthSalamon]

9
supressions.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files="me[\\/]totalfreedom[\\/]bukkittelnet[\\/]thirdparty" checks="[a-zA-Z0-9]*"/>
</suppressions>