Compare commits

...

23 Commits
4.8 ... master

Author SHA1 Message Date
Telesphoreo 58322f8138
Release 1.3 2023-07-22 23:03:36 -05:00
Telesphoreo 911be08241 Update Gradle 2023-03-08 13:18:37 -06:00
Telesphoreo 5e5ce15828 Update dependencies and Gradle 2023-03-02 23:20:43 -06:00
Telesphoreo c6fcb1b58e
Update dependencies 2022-11-27 22:17:15 -06:00
Telesphoreo 01caef2f75 Update Gradle + remove API 2022-08-02 20:42:18 -05:00
Telesphoreo c9b7dfa8de Update module to 1.19 2022-06-13 22:59:26 -05:00
Telesphoreo 80b8badaa5 Update for 1.2 2022-06-05 22:05:51 -05:00
Telesphoreo ed1faf9f96 Add GitHub workflow 2022-06-05 21:41:04 -05:00
Telesphoreo 0b5f61f28c Update version 2022-05-28 22:03:27 -05:00
Telesphoreo 65549b2912 Update repo 2022-05-21 21:03:49 -05:00
Telesphoreo b297c7019c
Create CONTRIBUTING.md 2022-05-17 14:58:17 -05:00
Allink 12a6cd4f7c
Shutdown the server instead of attempting to load new BukkitTelnet in place over old one 2022-05-15 01:47:33 +01:00
Allink da6343368e
Check if BukkitTelnet is enabled & delete .gradle folder on compilation success 2022-05-15 01:18:30 +01:00
Allink 4d3873cb1f
Fix incorrectly formatted commit 2022-05-14 11:25:17 +01:00
Allink 950cf97ff6
Add BukkitTelnet compiler 2022-05-14 11:19:13 +01:00
Telesphoreo f2dba7bb6b
Update build.gradle.kts 2022-05-13 19:33:14 -05:00
Telesphoreo 44469d91ec
Account for non-Plex versions of BukkitTelnet 2022-05-12 22:01:16 -05:00
Telesphoreo 46ad9c7c8c
Update build.gradle.kts 2022-05-08 21:23:28 -05:00
Telesphoreo 28ce3ce8da
Update README.md 2022-05-05 22:31:10 -05:00
Telesphoreo 316b0a4159 This was preventing Plex from starting up 2022-04-21 20:35:53 -05:00
Telesphoreo 629919673a This needs to be changed 2022-04-21 20:24:17 -05:00
Telesphoreo 5002f4bc4c Update version 2022-04-21 18:26:29 -05:00
Telesphoreo f8e65c179b fix a few things 2022-04-14 17:20:38 -05:00
14 changed files with 430 additions and 41 deletions

18
.github/workflows/gradle.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Gradle
on: [ push ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Build with Gradle
run: chmod a+x gradlew && ./gradlew build --no-daemon

View File

@ -0,0 +1,49 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Plexus Code Style" version="1">
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" />
<package name="" withSubpackages="true" static="true" />
</value>
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
</JetCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="BRACE_STYLE" value="2" />
<option name="CLASS_BRACE_STYLE" value="2" />
<option name="METHOD_BRACE_STYLE" value="2" />
<option name="LAMBDA_BRACE_STYLE" value="2" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="0" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Plexus Code Style" />
</state>
</component>

24
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,24 @@
For those who are wanting to contribute, we fully encourage doing so. There are a few rules we require following when contributing however.
## Steps
1. Make an issue and get feedback. It's important to know if your idea will be accepted before writing any code.
- If it is a feature request, describe the feature and be extremely specific.
- If it is a bug report, ensure you include how to reproduce the bug and the expected outcome
- If it is an enhancement, describe your proposed changes. Ensure you are extremely specific.
2. Fork this project
3. Create a new branch that describes the new feature, enhancement, or bug fix. For example, this is good: `feature/add-xyz`. This is bad: `fix-this-lol`.
4. Write the code that addresses your change.
- Keep in mind that it **must** be formatted correctly. If you are using IntelliJ, there is a `codeStyle.xml` file that tells IntelliJ how to format your code. Check this link for information on how to use the file: https://www.jetbrains.com/help/idea/configuring-code-style.html#import-export-schemes
- If you are not using IntelliJ, that is fine. We use the Plexus Code Style (which is almost the same as Allman) so please format your code accordingly.
6. Push your changes to your new branch and make a PR based off of that branch.
## Requirements for a PR
- The issue must be marked as approved
- It must only address each specific issue. Don't make one PR for multiple issues.
- Your PR must compile and work. If it does not compile or work, your PR will most likely be rejected.
## Code requirements
- Most importantly, your code must be efficient. Your pull request may be rejected if your code is deemed inefficient or sloppy.
- Do not repeat yourself. Create functions as needed if you're using large blocks of code over and over again.
- Do not use an excessive amount of commits when making your PR. It makes the master branch look messy.
- Your code must be consistent with Plex's codebase. If a function already exists, use it.

View File

@ -1,2 +1,2 @@
# Module-BukkitTelnet
# Module-BukkitTelnet [![Build Status](https://ci.plex.us.org/job/Module-BukkitTelnet/badge/icon)](https://ci.plex.us.org/job/Module-BukkitTelnet/)
The BukkitTelnet module for Plex

View File

@ -4,50 +4,50 @@ plugins {
}
group = "dev.plex"
version = "1.0"
version = "1.3"
description = "Module-BukkitTelnet"
repositories {
mavenCentral()
maven {
url = uri("https://papermc.io/repo/repository/maven-public/")
url = uri("https://repo.papermc.io/repository/maven-public/")
}
maven {
url = uri("https://nexus.telesphoreo.me/repository/plex-snapshots/")
url = uri("https://nexus.telesphoreo.me/repository/plex/")
}
maven {
url = uri("https://nexus.telesphoreo.me/repository/totalfreedom/")
}
maven {
url = uri("https://jitpack.io")
content {
includeGroup("com.github.plexusorg")
}
}
}
dependencies {
compileOnly("org.projectlombok:lombok:1.18.22")
annotationProcessor("org.projectlombok:lombok:1.18.22")
compileOnly("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT")
compileOnly("dev.plex:Plex:1.0.1-SNAPSHOT")
compileOnly("me.totalfreedom:BukkitTelnet:4.8") {
exclude("org.spigotmc", "spigot-api")
compileOnly("org.projectlombok:lombok:1.18.28")
annotationProcessor("org.projectlombok:lombok:1.18.28")
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
compileOnly("dev.plex:server:1.3")
compileOnly("com.github.plexusorg:BukkitTelnet:6908ff201f") {
exclude("org.papermc.paper", "paper-api")
}
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(17)
options.encoding = Charsets.UTF_8.name()
}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
options.encoding = Charsets.UTF_8.name()
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
filteringCharset = Charsets.UTF_8.name()
}
}

Binary file not shown.

View File

@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

18
gradlew vendored
View File

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -80,10 +80,10 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

15
gradlew.bat vendored
View File

@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

View File

@ -1,16 +1,20 @@
package dev.plex;
import dev.plex.automation.PatchedTelnetCompiler;
import dev.plex.listener.BukkitTelnetListener;
import dev.plex.module.PlexModule;
import dev.plex.util.PlexLog;
import lombok.Getter;
import me.totalfreedom.bukkittelnet.BukkitTelnet;
import org.bukkit.Bukkit;
import java.lang.reflect.Method;
public class BukkitTelnetModule extends PlexModule
{
@Getter
private static BukkitTelnetModule module;
boolean failed = false;
private BukkitTelnet bukkitTelnet;
@Override
@ -24,7 +28,54 @@ public class BukkitTelnetModule extends PlexModule
{
if (getPlex().getSystem().equalsIgnoreCase("permissions") && !Bukkit.getPluginManager().isPluginEnabled("Vault"))
{
throw new RuntimeException("Plex-BukkitTelnet requires the 'Vault' plugin as well as a Permissions plugin that hooks into 'Vault.' We recommend LuckPerms!");
failed = true;
PlexLog.error("Plex-BukkitTelnet requires the 'Vault' plugin as well as a Permissions plugin that hooks into 'Vault.' We recommend LuckPerms!");
module.disable();
return;
}
if (!Bukkit.getPluginManager().isPluginEnabled("BukkitTelnet"))
{
failed = true;
PlexLog.warn("The Plex-BukkitTelnet module requires the BukkitTelnet plugin to work. I am automatically compiling BukkitTelnet plugin for you, however if something fails, please download it from: https://github.com/plexusorg/BukkitTelnet/releases");
try
{
PatchedTelnetCompiler.execute();
return;
}
catch (Exception e)
{
PlexLog.error("Failed to compile patched telnet.");
e.printStackTrace();
}
module.disable();
return;
}
try
{
failed = true;
Class<?> clazz = Class.forName("me.totalfreedom.bukkittelnet.BukkitTelnet");
Method method = clazz.getDeclaredMethod("getPlugin");
}
catch (ClassNotFoundException | NoSuchMethodException ignored)
{
PlexLog.warn("You are using an older version of BukkitTelnet that does not support Plex. I am automatically compiling a build that does work for you, however if something fails, please download a version that does from: https://ci.plex.us.org/job/Plex-BukkitTelnet");
try
{
PatchedTelnetCompiler.execute();
return;
}
catch (Exception e)
{
PlexLog.error("Failed to compile patched telnet.");
e.printStackTrace();
}
module.disable();
return;
}
this.registerListener(new BukkitTelnetListener());
@ -34,5 +85,9 @@ public class BukkitTelnetModule extends PlexModule
@Override
public void disable()
{
if (failed)
{
PlexLog.error("Disabling Module-BukkitTelnet. Please resolve the above error.");
}
}
}

View File

@ -0,0 +1,224 @@
package dev.plex.automation;
import com.google.common.collect.ImmutableList;
import dev.plex.BukkitTelnetModule;
import dev.plex.util.PlexLog;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.util.Comparator;
import java.util.List;
import java.util.Timer;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class PatchedTelnetCompiler
{
private static final PluginManager PLUGIN_MANAGER = Bukkit.getPluginManager();
private static final URI CODE_ARCHIVE = URI.create("https://github.com/plexusorg/BukkitTelnet/archive/refs/heads/master.zip");
private static final Path PLUGIN_DIRECTORY = Bukkit.getServer().getPluginsFolder().toPath();
private static final File TARGET_PLUGIN = PLUGIN_DIRECTORY.resolve("BukkitTelnet.jar").toFile();
private static final Path WORKING_DIRECTORY = Path.of(System.getProperty("user.dir"));
private static final Path HIDDEN_GRADLE = WORKING_DIRECTORY.resolve(".gradle");
private static final Path ROOT_PATH = WORKING_DIRECTORY.resolve("build");
private static final Path EXTRACT_TARGET = ROOT_PATH.resolve("extract");
private static final Path EXTRACT_SUBDIR = EXTRACT_TARGET.resolve("BukkitTelnet-master");
private static final Path BINARIES_PATH = EXTRACT_SUBDIR.resolve("build").resolve("libs");
private static final String DOWNLOADED_ARCHIVE_PATH = String.valueOf(ROOT_PATH.resolve("BukkitTelnet-master.zip"));
private static final HttpClient HTTP_CLIENT = HttpClient.newHttpClient();
public static void execute() throws Exception
{
// Create directories
final List<Path> directories = ImmutableList.of(ROOT_PATH, EXTRACT_TARGET);
for (Path directory : directories)
{
PlexLog.debug("Checking if {0} exists...", String.valueOf(directory));
if (Files.notExists(directory))
{
PlexLog.debug("It doesn't! Creating directory...");
Files.createDirectory(directory);
}
}
downloadArchive();
}
private static void downloadArchive() throws Exception
{
PlexLog.log("Downloading archive...");
// Create the request
final HttpRequest request = HttpRequest.newBuilder()
.GET()
// GitHub may block blank/generic user agents in the future, so we're spoofing one
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36")
.uri(CODE_ARCHIVE)
.build();
// Send the request
final HttpResponse<String> response = HTTP_CLIENT.send(request, HttpResponse.BodyHandlers.ofString());
// Get the redirect
final URI redirect = URI.create(response.headers().firstValue("location").orElseThrow());
// Download the file from the redirect
final HttpRequest downloadRequest = HttpRequest.newBuilder()
.GET()
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36")
.uri(redirect)
.build();
HTTP_CLIENT.send(downloadRequest, HttpResponse.BodyHandlers.ofFileDownload(ROOT_PATH, StandardOpenOption.CREATE, StandardOpenOption.WRITE));
extractArchive();
}
private static void extractArchive() throws Exception
{
PlexLog.log("Extracting archive...");
final ZipInputStream inputStream = new ZipInputStream(new FileInputStream(DOWNLOADED_ARCHIVE_PATH));
ZipEntry entry = inputStream.getNextEntry();
while (entry != null)
{
final Path outputDestination = EXTRACT_TARGET.resolve(entry.getName());
if (entry.isDirectory())
{
if (Files.notExists(outputDestination))
{
PlexLog.debug("{0} doesn't exist, creating it!", String.valueOf(outputDestination));
Files.createDirectory(outputDestination);
}
}
else
{
final FileOutputStream outputStream = new FileOutputStream(String.valueOf(outputDestination));
int read = 0;
while ((read = inputStream.read()) != -1)
{
outputStream.write(read);
}
outputStream.close();
}
inputStream.closeEntry();
entry = inputStream.getNextEntry();
}
executeGradleTarget();
}
private static void executeGradleTarget() throws Exception
{
PlexLog.log("Executing gradle target...");
boolean nix = !System.getProperty("os.name").toLowerCase().contains("win"); // Assume Windows if name contains win
String gradlew = String.valueOf(nix ? EXTRACT_SUBDIR.resolve("gradlew") : EXTRACT_SUBDIR.resolve("gradlew.bat"));
if (nix)
{
final ProcessBuilder chmodBuilder = new ProcessBuilder("chmod", "+x", gradlew);
Process chmodProcess = chmodBuilder.start();
chmodProcess.waitFor();
}
final ProcessBuilder builder = new ProcessBuilder(gradlew, "--no-daemon", "clean", "build");
builder.directory(new File(String.valueOf(EXTRACT_SUBDIR)));
PlexLog.debug("Executing compile command: {0}", builder.command());
//builder.redirectErrorStream(true);
//builder.redirectOutput(ProcessBuilder.Redirect.PIPE);
builder.inheritIO();
final Process process = builder.start();
process.waitFor();
PlexLog.debug("Compilation command ended with status code {0}", process.exitValue());
copyBinary();
}
private static void copyBinary() throws Exception
{
PlexLog.log("Copying binaries...");
final File binaryDirectory = new File(String.valueOf(BINARIES_PATH));
final File[] files = binaryDirectory.listFiles();
if (files == null)
{
throw new IllegalStateException("Didn't manage to compile jars!");
}
else if (files.length == 0)
{
throw new IllegalStateException("Didn't manage to compile jars!");
}
Files.copy(BINARIES_PATH.resolve("BukkitTelnet.jar"), TARGET_PLUGIN.toPath(), StandardCopyOption.REPLACE_EXISTING);
Files.walk(ROOT_PATH)
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
if (Files.exists(HIDDEN_GRADLE))
{
Files.walk(HIDDEN_GRADLE)
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
}
Timer timer = new Timer();
Plugin plugin = null;
// Check if incorrect BukkitTelnet plugin is present
if (PLUGIN_MANAGER.isPluginEnabled("BukkitTelnet"))
{
PlexLog.warn("Stopping server since unpatched BukkitTelnet was already loaded, please restart and it should work!");
// Running stop doesn't seem to work...
Bukkit.savePlayers();
for (Player onlinePlayer : Bukkit.getOnlinePlayers())
{
onlinePlayer.kick(Component.text("Server is restarting due to a plugin upgrade, please wait!"));
}
for (World world : Bukkit.getWorlds())
{
Bukkit.unloadWorld(world, true);
}
Runtime.getRuntime().halt(0);
return;
}
else
{
plugin = PLUGIN_MANAGER.loadPlugin(TARGET_PLUGIN);
}
if (plugin == null) throw new IllegalStateException("BukkitTelnet cannot be null after successful compile!");
plugin.onLoad();
PLUGIN_MANAGER.enablePlugin(plugin);
done();
}
private static void done()
{
BukkitTelnetModule.getModule().enable();
}
}

View File

@ -5,10 +5,7 @@ import dev.plex.player.PlexPlayer;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexLog;
import me.totalfreedom.bukkittelnet.BukkitTelnet;
import me.totalfreedom.bukkittelnet.api.TelnetCommandEvent;
import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.EventHandler;
public class BukkitTelnetListener extends PlexListener
@ -18,7 +15,10 @@ public class BukkitTelnetListener extends PlexListener
{
final String ip = event.getIp();
final PlexPlayer player = DataUtils.getPlayerByIP(ip);
if (player == null) return;
if (player == null)
{
return;
}
if (plugin.getSystem().equalsIgnoreCase("ranks"))
{
PlexLog.debug("Plex-BukkitTelnet using ranks check");
@ -27,7 +27,8 @@ public class BukkitTelnetListener extends PlexListener
event.setBypassPassword(true);
event.setName(player.getName());
}
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
PlexLog.debug("Plex-BukkitTelnet using permissions check");
if (BukkitTelnet.getPlugin().handler.hasPermission(player.getName(), "plex.telnet.autoconnect"))
@ -38,5 +39,4 @@ public class BukkitTelnetListener extends PlexListener
}
}
}

View File

@ -1,4 +1,4 @@
name: Plex-BukkitTelnet
name: Module-BukkitTelnet
main: dev.plex.BukkitTelnetModule
description: The Plex module for BukkitTelnet
version: 1.0
version: 1.3