mirror of
https://github.com/plexusorg/Module-BukkitTelnet.git
synced 2024-12-22 09:57:40 +00:00
Few formatting things + it compiles
This commit is contained in:
parent
e0a14df84e
commit
30a037b0f5
@ -3,12 +3,15 @@ plugins {
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
group "dev.plex"
|
||||
version "0.1"
|
||||
group = "dev.plex"
|
||||
description = "Module-BukkitTelnet"
|
||||
version = "1.0"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
url = uri("https://papermc.io/repo/repository/maven-public/")
|
||||
}
|
||||
@ -20,6 +23,7 @@ repositories {
|
||||
maven {
|
||||
url = uri("https://nexus.telesphoreo.me/repository/totalfreedom")
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri("https://jitpack.io")
|
||||
}
|
||||
@ -63,6 +67,6 @@ publishing {
|
||||
}
|
||||
|
||||
tasks.getByName<Jar>("jar") {
|
||||
archiveBaseName.set("Plex-BukkitTelnet")
|
||||
archiveBaseName.set("Module-BukkitTelnet")
|
||||
}
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
rootProject.name = "plex-bukkittelnet"
|
||||
rootProject.name = "Module-BukkitTelnet"
|
||||
|
||||
|
@ -3,13 +3,12 @@ package dev.plex;
|
||||
import dev.plex.listener.BukkitTelnetListener;
|
||||
import dev.plex.module.PlexModule;
|
||||
import lombok.Getter;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class BukkitTelnetModule extends PlexModule {
|
||||
|
||||
public class BukkitTelnetModule extends PlexModule
|
||||
{
|
||||
@Getter
|
||||
private static BukkitTelnetModule module;
|
||||
|
||||
@ -17,13 +16,16 @@ public class BukkitTelnetModule extends PlexModule {
|
||||
private Permission permissions = null;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
public void load()
|
||||
{
|
||||
module = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
if (!setupPermissions() && getPlex().getSystem().equalsIgnoreCase("permissions") && !Bukkit.getPluginManager().isPluginEnabled("Vault")) {
|
||||
public void enable()
|
||||
{
|
||||
if (!setupPermissions() && 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!");
|
||||
}
|
||||
|
||||
@ -31,11 +33,12 @@ public class BukkitTelnetModule extends PlexModule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
|
||||
public void disable()
|
||||
{
|
||||
}
|
||||
|
||||
private boolean setupPermissions() {
|
||||
private boolean setupPermissions()
|
||||
{
|
||||
RegisteredServiceProvider<Permission> rsp = Bukkit.getServicesManager().getRegistration(Permission.class);
|
||||
permissions = rsp.getProvider();
|
||||
return permissions != null;
|
||||
|
@ -5,31 +5,38 @@ import dev.plex.cache.DataUtils;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.rank.enums.Rank;
|
||||
import dev.plex.util.PlexLog;
|
||||
import java.util.UUID;
|
||||
import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BukkitTelnetListener extends PlexListener {
|
||||
public class BukkitTelnetListener extends PlexListener
|
||||
{
|
||||
@EventHandler
|
||||
public void onPreLogin(TelnetPreLoginEvent event) {
|
||||
public void onPreLogin(TelnetPreLoginEvent event)
|
||||
{
|
||||
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");
|
||||
if (player.getRankFromString().isAtLeast(Rank.ADMIN)) {
|
||||
if (player.getRankFromString().isAtLeast(Rank.ADMIN))
|
||||
{
|
||||
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");
|
||||
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(UUID.fromString(player.getUuid()));
|
||||
if (BukkitTelnetModule.getModule().getPermissions().playerHas(null, offlinePlayer, "plex.telnet.autoconnect")) {
|
||||
if (BukkitTelnetModule.getModule().getPermissions().playerHas(null, offlinePlayer, "plex.telnet.autoconnect"))
|
||||
{
|
||||
event.setBypassPassword(true);
|
||||
event.setName(player.getName());
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: Plex-BukkitTelnet
|
||||
main: dev.plex.BukkitTelnetModule
|
||||
description: The plex module for BukkitTelnet
|
||||
version: 0.1
|
||||
description: The Plex module for BukkitTelnet
|
||||
version: 1.0
|
Loading…
Reference in New Issue
Block a user