Renamed to BukkitTelnet

This commit is contained in:
Steven Lawson 2012-03-12 01:42:15 -04:00
parent f631655873
commit 52db2ae4bd
13 changed files with 214 additions and 206 deletions

5
README Normal file
View file

@ -0,0 +1,5 @@
BukkitTelnet is a Telnet server for Minecraft. It allows you to remotely administrate your server via any Telnet client.
BukkitTelnet is a fork of MCTelnet that is designed for servers with multiple administrators who all have the same full permissions. It allows for login under any username provided that the proper password is supplied.
MCTelnet was originally created by bekvon. I modified it heavily to be better suited to my TotalFreedomServer, and eventually renamed it.

148
build.xml
View file

@ -1,74 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="MCTelnet" default="default" basedir=".">
<description>Builds, tests, and runs the project MCTelnet.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="MCTelnet-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="BukkitTelnet" default="default" basedir=".">
<description>Builds, tests, and runs the project BukkitTelnet.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="BukkitTelnet-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

View file

@ -19,7 +19,7 @@ is divided into following sections:
- cleanup
-->
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="MCTelnet-impl">
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="BukkitTelnet-impl">
<fail message="Please build using Ant 1.8.0 or higher.">
<condition>
<not>
@ -568,7 +568,7 @@ is divided into following sections:
<delete file="${built-jar.properties}" quiet="true"/>
</target>
<target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
<echo level="warn" message="Cycle detected: MCTelnet was already built"/>
<echo level="warn" message="Cycle detected: BukkitTelnet was already built"/>
</target>
<target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
<mkdir dir="${build.dir}"/>
@ -1014,7 +1014,7 @@ is divided into following sections:
<delete file="${built-clean.properties}" quiet="true"/>
</target>
<target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
<echo level="warn" message="Cycle detected: MCTelnet was already built"/>
<echo level="warn" message="Cycle detected: BukkitTelnet was already built"/>
</target>
<target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
<mkdir dir="${build.dir}"/>

View file

@ -1,8 +1,8 @@
build.xml.data.CRC32=fc2d0ea5
build.xml.script.CRC32=ea976fe1
build.xml.stylesheet.CRC32=28e38971@1.38.3.45
build.xml.data.CRC32=b69966a4
build.xml.script.CRC32=a50ca8cc
build.xml.stylesheet.CRC32=28e38971@1.50.2.46
# 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=fc2d0ea5
nbproject/build-impl.xml.script.CRC32=d2c78d70
nbproject/build-impl.xml.data.CRC32=b69966a4
nbproject/build-impl.xml.script.CRC32=bb8f2f93
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.2.46

View file

@ -1,6 +1,6 @@
compile.on.save=true
do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
user.properties.file=C:\\Users\\Steven\\.netbeans\\7.0\\build.properties
compile.on.save=true
do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
user.properties.file=C:\\Users\\Steven\\.netbeans\\7.1.1\\build.properties

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>

View file

@ -1,73 +1,73 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=MCTelnet
application.vendor=Administrator
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}/MCTelnet.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
includes=**
jar.compress=false
javac.classpath=\
${libs.Bukkit.classpath}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.5
javac.target=1.5
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=
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
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
test.src.dir=test
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=BukkitTelnet
application.vendor=Administrator
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.compress=false
javac.classpath=\
${libs.Bukkit.classpath}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.5
javac.target=1.5
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=
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
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
test.src.dir=test

View file

@ -1,15 +1,15 @@
<?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>MCTelnet</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
<?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>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

View file

@ -1,3 +1,5 @@
# BukkitTelnet v2.0 Configuration File
# Port to bind to:
port: 8765

View file

@ -1,4 +1,4 @@
package com.bekvon.bukkit.mctelnet;
package me.StevenLawson.BukkitTelnet.BukkitTelnet;
import java.io.*;
import java.net.Socket;
@ -15,7 +15,7 @@ import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
public class TelnetListener extends Handler implements CommandSender
public class BT_TelnetListener extends Handler implements CommandSender
{
private static final Logger log = Logger.getLogger("Minecraft");
private boolean is_running = false;
@ -26,13 +26,13 @@ public class TelnetListener extends Handler implements CommandSender
private Socket clientSocket;
private BufferedReader instream;
private BufferedWriter outstream;
private MCTelnet plugin;
private BukkitTelnet plugin;
private String client_ip;
private boolean show_full_log = true;
private static final String COMMAND_REGEX = "[^\\x20-\\x7E]";
private static final String LOGIN_REGEX = "[^a-zA-Z0-9\\-\\.\\_]";
public TelnetListener(Socket socket, MCTelnet plugin)
public BT_TelnetListener(Socket socket, BukkitTelnet plugin)
{
this.is_running = true;
this.clientSocket = socket;
@ -75,7 +75,7 @@ public class TelnetListener extends Handler implements CommandSender
//sendTelnetCommand(WONT, ECHO);
//sendTelnetCommand(DO, ECHO);
writeOut("[MCTelnet] - Session Started!\r\n");
writeOut("[BukkitTelnet] - Session Started!\r\n");
authenticateLoop();
commandLoop();
@ -94,7 +94,7 @@ public class TelnetListener extends Handler implements CommandSender
writeOut("Username: ");
String username = instream.readLine().replaceAll(LOGIN_REGEX, "").trim();
if (TelnetUtil.canBypassPassword(client_ip, plugin))
if (BT_Util.canBypassPassword(client_ip, plugin))
{
writeOut("Skipping password, you are on an authorized IP address.\r\n");
is_authenticated = true;
@ -122,6 +122,7 @@ public class TelnetListener extends Handler implements CommandSender
{
telnet_username = username;
writeOut("Logged In as " + getName() + ".\r\n:");
log.log(Level.INFO, "[" + plugin.getDescription().getName() + "]: " + client_ip + " logged in as \"" + getName() + "\".");
return;
}
else

View file

@ -1,4 +1,4 @@
package com.bekvon.bukkit.mctelnet;
package me.StevenLawson.BukkitTelnet.BukkitTelnet;
import java.io.File;
import java.io.FileOutputStream;
@ -9,15 +9,15 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
public class TelnetUtil
public class BT_Util
{
private static final Logger log = Logger.getLogger("Minecraft");
private TelnetUtil()
protected BT_Util()
{
}
public static boolean canBypassPassword(String user_ip, MCTelnet plugin)
public static boolean canBypassPassword(String user_ip, BukkitTelnet plugin)
{
if (plugin.bypass_password_ips == null)
{
@ -51,7 +51,7 @@ public class TelnetUtil
return false;
}
public static void createDefaultConfiguration(String name, MCTelnet plugin, File plugin_file)
public static void createDefaultConfiguration(String name, BukkitTelnet plugin, File plugin_file)
{
File actual = new File(plugin.getDataFolder(), name);
if (!actual.exists())

View file

@ -1,4 +1,4 @@
package com.bekvon.bukkit.mctelnet;
package me.StevenLawson.BukkitTelnet.BukkitTelnet;
import java.io.File;
import java.io.IOException;
@ -15,7 +15,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
public class MCTelnet extends JavaPlugin
public class BukkitTelnet extends JavaPlugin
{
private static final String CONFIG_FILE = "config.yml";
private static final Logger log = Logger.getLogger("Minecraft");
@ -23,7 +23,7 @@ public class MCTelnet extends JavaPlugin
@Override
public void onEnable()
{
log.log(Level.INFO, "[" + getDescription().getName() + "]: Enabled - Version " + this.getDescription().getVersion() + " by bekvon, revamped by Madgeek1450.");
log.log(Level.INFO, "[" + getDescription().getName() + "]: Enabled - Version " + this.getDescription().getVersion() + " by bekvon / Madgeek1450.");
log.log(Level.INFO, "[" + getDescription().getName() + "]: Starting server.");
loadConfig();
@ -45,7 +45,7 @@ public class MCTelnet extends JavaPlugin
private void loadConfig()
{
TelnetUtil.createDefaultConfiguration(CONFIG_FILE, this, getFile());
BT_Util.createDefaultConfiguration(CONFIG_FILE, this, getFile());
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), CONFIG_FILE));
port = config.getInt("port", port);
@ -64,7 +64,7 @@ public class MCTelnet extends JavaPlugin
}
private ServerSocket listenerSocket = null;
private ArrayList<TelnetListener> clientHolder;
private ArrayList<BT_TelnetListener> clientHolder;
private Thread listenerThread = null;
private boolean is_running = false;
private InetAddress listenAddress = null;
@ -117,7 +117,7 @@ public class MCTelnet extends JavaPlugin
log.log(Level.SEVERE, "[" + getDescription().getName() + "]: Cant bind to " + (address == null ? "*" : address) + ":" + port);
}
clientHolder = new ArrayList<TelnetListener>();
clientHolder = new ArrayList<BT_TelnetListener>();
is_running = true;
@ -146,14 +146,14 @@ public class MCTelnet extends JavaPlugin
client = listenerSocket.accept();
if (client != null)
{
clientHolder.add(new TelnetListener(client, this));
clientHolder.add(new BT_TelnetListener(client, this));
log.info("[" + getDescription().getName() + "]: Client connected: " + client.getInetAddress().getHostAddress());
Iterator<TelnetListener> listeners = clientHolder.iterator();
Iterator<BT_TelnetListener> listeners = clientHolder.iterator();
while (listeners.hasNext())
{
TelnetListener listener = listeners.next();
BT_TelnetListener listener = listeners.next();
if (!listener.isAlive())
{
listeners.remove();
@ -186,7 +186,7 @@ public class MCTelnet extends JavaPlugin
{
try
{
for (TelnetListener listener : clientHolder)
for (BT_TelnetListener listener : clientHolder)
{
listener.killClient();
}

View file

@ -1,5 +1,5 @@
name: MCTelnet
main: com.bekvon.bukkit.mctelnet.MCTelnet
version: 1.3
name: BukkitTelnet
main: me.StevenLawson.BukkitTelnet.BukkitTelnet
version: 2.0
description: Telnet console access plugin.
author: bekvon
author: bekvon, Madgeek1450 / StevenLawson