mirror of
https://github.com/plexusorg/Module-BukkitTelnet.git
synced 2024-11-16 17:56:15 +00:00
update plex
This commit is contained in:
parent
e0a14df84e
commit
2c8622764a
@ -7,14 +7,13 @@ group "dev.plex"
|
|||||||
version "0.1"
|
version "0.1"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven {
|
maven {
|
||||||
url = uri("https://papermc.io/repo/repository/maven-public/")
|
url = uri("https://papermc.io/repo/repository/maven-public/")
|
||||||
}
|
}
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
url = uri("https://nexus.telesphoreo.me/repository/plex")
|
url = uri("https://nexus.telesphoreo.me/repository/plex-snapshots/")
|
||||||
}
|
}
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
@ -29,11 +28,13 @@ dependencies {
|
|||||||
compileOnly("org.projectlombok:lombok:1.18.22")
|
compileOnly("org.projectlombok:lombok:1.18.22")
|
||||||
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:0.10-SNAPSHOT")
|
compileOnly("dev.plex:Plex:1.0.1-SNAPSHOT")
|
||||||
compileOnly("me.totalfreedom:BukkitTelnet:4.7") {
|
compileOnly("me.totalfreedom:BukkitTelnet:4.7") {
|
||||||
exclude("org.spigotmc", "spigot-api")
|
exclude("org.spigotmc", "spigot-api")
|
||||||
}
|
}
|
||||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
|
compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
|
||||||
|
exclude("org.bukkit", "bukkit")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
@ -5,31 +5,39 @@ 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.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.UUID;
|
import java.util.List;
|
||||||
|
|
||||||
public class BukkitTelnetListener extends PlexListener {
|
public class BukkitTelnetListener extends PlexListener
|
||||||
|
{
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPreLogin(TelnetPreLoginEvent event) {
|
public void onPreLogin(TelnetPreLoginEvent event)
|
||||||
|
{
|
||||||
final String ip = event.getIp();
|
final String ip = event.getIp();
|
||||||
final PlexPlayer player = DataUtils.getPlayerByIP(ip);
|
final PlexPlayer player = DataUtils.getPlayerByIP(ip);
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
if (plugin.getSystem().equalsIgnoreCase("ranks"))
|
if (plugin.getSystem().equalsIgnoreCase("ranks"))
|
||||||
{
|
{
|
||||||
PlexLog.debug("Plex-BukkitTelnet using ranks check");
|
PlexLog.debug("Plex-BukkitTelnet using ranks check");
|
||||||
if (player.getRankFromString().isAtLeast(Rank.ADMIN)) {
|
if (player.getRankFromString().isAtLeast(Rank.ADMIN))
|
||||||
|
{
|
||||||
event.setBypassPassword(true);
|
event.setBypassPassword(true);
|
||||||
event.setName(player.getName());
|
event.setName(player.getName());
|
||||||
}
|
}
|
||||||
} 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(UUID.fromString(player.getUuid()));
|
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(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.setBypassPassword(true);
|
||||||
event.setName(player.getName());
|
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 New Issue
Block a user