mirror of
https://github.com/plexusorg/Module-BukkitTelnet.git
synced 2024-12-22 07:45:03 +00:00
update bukkit telnet
This commit is contained in:
parent
18b41dd874
commit
a3fac0a8ad
3 changed files with 9 additions and 32 deletions
|
@ -8,6 +8,7 @@ version "0.1"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
maven {
|
maven {
|
||||||
url = uri("https://papermc.io/repo/repository/maven-public/")
|
url = uri("https://papermc.io/repo/repository/maven-public/")
|
||||||
}
|
}
|
||||||
|
@ -29,12 +30,9 @@ dependencies {
|
||||||
annotationProcessor("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("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT")
|
||||||
compileOnly("dev.plex:Plex:1.0.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")
|
exclude("org.spigotmc", "spigot-api")
|
||||||
}
|
}
|
||||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
|
|
||||||
exclude("org.bukkit", "bukkit")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
@ -65,5 +63,6 @@ publishing {
|
||||||
|
|
||||||
tasks.getByName<Jar>("jar") {
|
tasks.getByName<Jar>("jar") {
|
||||||
archiveBaseName.set("Plex-BukkitTelnet")
|
archiveBaseName.set("Plex-BukkitTelnet")
|
||||||
|
archiveVersion.set("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package dev.plex;
|
||||||
import dev.plex.listener.BukkitTelnetListener;
|
import dev.plex.listener.BukkitTelnetListener;
|
||||||
import dev.plex.module.PlexModule;
|
import dev.plex.module.PlexModule;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import me.totalfreedom.bukkittelnet.BukkitTelnet;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
|
@ -12,8 +13,7 @@ public class BukkitTelnetModule extends PlexModule
|
||||||
@Getter
|
@Getter
|
||||||
private static BukkitTelnetModule module;
|
private static BukkitTelnetModule module;
|
||||||
|
|
||||||
@Getter
|
private BukkitTelnet bukkitTelnet;
|
||||||
private Permission permissions = null;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load()
|
public void load()
|
||||||
|
@ -24,23 +24,17 @@ public class BukkitTelnetModule extends PlexModule
|
||||||
@Override
|
@Override
|
||||||
public void enable()
|
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!");
|
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.registerListener(new BukkitTelnetListener());
|
||||||
|
this.bukkitTelnet = BukkitTelnet.getPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable()
|
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;
|
package dev.plex.listener;
|
||||||
|
|
||||||
import dev.plex.BukkitTelnetModule;
|
|
||||||
import dev.plex.cache.DataUtils;
|
import dev.plex.cache.DataUtils;
|
||||||
import dev.plex.player.PlexPlayer;
|
import dev.plex.player.PlexPlayer;
|
||||||
import dev.plex.rank.enums.Rank;
|
import dev.plex.rank.enums.Rank;
|
||||||
import dev.plex.util.PlexLog;
|
import dev.plex.util.PlexLog;
|
||||||
|
import me.totalfreedom.bukkittelnet.BukkitTelnet;
|
||||||
import me.totalfreedom.bukkittelnet.api.TelnetCommandEvent;
|
import me.totalfreedom.bukkittelnet.api.TelnetCommandEvent;
|
||||||
import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
|
import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.PluginCommandYamlParser;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BukkitTelnetListener extends PlexListener
|
public class BukkitTelnetListener extends PlexListener
|
||||||
{
|
{
|
||||||
|
@ -35,8 +30,7 @@ public class BukkitTelnetListener extends PlexListener
|
||||||
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
|
||||||
{
|
{
|
||||||
PlexLog.debug("Plex-BukkitTelnet using permissions check");
|
PlexLog.debug("Plex-BukkitTelnet using permissions check");
|
||||||
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(player.getUuid());
|
if (BukkitTelnet.getPlugin().handler.hasPermission(player.getName(), "plex.telnet.autoconnect"))
|
||||||
if (BukkitTelnetModule.getModule().getPermissions().playerHas(null, offlinePlayer, "plex.telnet.autoconnect"))
|
|
||||||
{
|
{
|
||||||
event.setBypassPassword(true);
|
event.setBypassPassword(true);
|
||||||
event.setName(player.getName());
|
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 a new issue