mirror of
https://github.com/plexusorg/Module-BukkitTelnet.git
synced 2024-12-22 01:47:39 +00:00
update bukkit telnet
This commit is contained in:
parent
18b41dd874
commit
a3fac0a8ad
@ -8,6 +8,7 @@ version "0.1"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven {
|
||||
url = uri("https://papermc.io/repo/repository/maven-public/")
|
||||
}
|
||||
@ -29,12 +30,9 @@ dependencies {
|
||||
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.7") {
|
||||
compileOnly("me.totalfreedom:bukkittelnet:4.8-SNAPSHOT") {
|
||||
exclude("org.spigotmc", "spigot-api")
|
||||
}
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
|
||||
exclude("org.bukkit", "bukkit")
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -65,5 +63,6 @@ publishing {
|
||||
|
||||
tasks.getByName<Jar>("jar") {
|
||||
archiveBaseName.set("Plex-BukkitTelnet")
|
||||
archiveVersion.set("")
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package dev.plex;
|
||||
import dev.plex.listener.BukkitTelnetListener;
|
||||
import dev.plex.module.PlexModule;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.bukkittelnet.BukkitTelnet;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
@ -12,8 +13,7 @@ public class BukkitTelnetModule extends PlexModule
|
||||
@Getter
|
||||
private static BukkitTelnetModule module;
|
||||
|
||||
@Getter
|
||||
private Permission permissions = null;
|
||||
private BukkitTelnet bukkitTelnet;
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
@ -24,23 +24,17 @@ public class BukkitTelnetModule extends PlexModule
|
||||
@Override
|
||||
public void enable()
|
||||
{
|
||||
if (!setupPermissions() && getPlex().getSystem().equalsIgnoreCase("permissions") && !Bukkit.getPluginManager().isPluginEnabled("Vault"))
|
||||
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!");
|
||||
}
|
||||
|
||||
this.registerListener(new BukkitTelnetListener());
|
||||
this.bukkitTelnet = BukkitTelnet.getPlugin();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable()
|
||||
{
|
||||
}
|
||||
|
||||
private boolean setupPermissions()
|
||||
{
|
||||
RegisteredServiceProvider<Permission> rsp = Bukkit.getServicesManager().getRegistration(Permission.class);
|
||||
permissions = rsp.getProvider();
|
||||
return permissions != null;
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,15 @@
|
||||
package dev.plex.listener;
|
||||
|
||||
import dev.plex.BukkitTelnetModule;
|
||||
import dev.plex.cache.DataUtils;
|
||||
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.command.Command;
|
||||
import org.bukkit.command.PluginCommandYamlParser;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BukkitTelnetListener extends PlexListener
|
||||
{
|
||||
@ -35,8 +30,7 @@ public class BukkitTelnetListener extends PlexListener
|
||||
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
PlexLog.debug("Plex-BukkitTelnet using permissions check");
|
||||
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(player.getUuid());
|
||||
if (BukkitTelnetModule.getModule().getPermissions().playerHas(null, offlinePlayer, "plex.telnet.autoconnect"))
|
||||
if (BukkitTelnet.getPlugin().handler.hasPermission(player.getName(), "plex.telnet.autoconnect"))
|
||||
{
|
||||
event.setBypassPassword(true);
|
||||
event.setName(player.getName());
|
||||
@ -45,14 +39,4 @@ public class BukkitTelnetListener extends PlexListener
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCommand(TelnetCommandEvent event)
|
||||
{
|
||||
if (!plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
//TODO: check players perms
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user