mirror of
https://github.com/plexusorg/Module-BukkitTelnet.git
synced 2024-12-21 23:35:04 +00:00
update plex
This commit is contained in:
parent
e0a14df84e
commit
2c8622764a
2 changed files with 29 additions and 10 deletions
|
@ -7,14 +7,13 @@ group "dev.plex"
|
|||
version "0.1"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven {
|
||||
url = uri("https://papermc.io/repo/repository/maven-public/")
|
||||
}
|
||||
|
||||
maven {
|
||||
url = uri("https://nexus.telesphoreo.me/repository/plex")
|
||||
url = uri("https://nexus.telesphoreo.me/repository/plex-snapshots/")
|
||||
}
|
||||
|
||||
maven {
|
||||
|
@ -29,11 +28,13 @@ 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:0.10-SNAPSHOT")
|
||||
compileOnly("dev.plex:Plex:1.0.1-SNAPSHOT")
|
||||
compileOnly("me.totalfreedom:BukkitTelnet:4.7") {
|
||||
exclude("org.spigotmc", "spigot-api")
|
||||
}
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
|
||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
|
||||
exclude("org.bukkit", "bukkit")
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
|
|
@ -5,31 +5,39 @@ 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.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.UUID;
|
||||
import java.util.List;
|
||||
|
||||
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 (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"))
|
||||
{
|
||||
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")) {
|
||||
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(player.getUuid());
|
||||
if (BukkitTelnetModule.getModule().getPermissions().playerHas(null, offlinePlayer, "plex.telnet.autoconnect"))
|
||||
{
|
||||
event.setBypassPassword(true);
|
||||
event.setName(player.getName());
|
||||
}
|
||||
|
@ -37,4 +45,14 @@ 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