diff --git a/server/src/main/java/dev/plex/Plex.java b/server/src/main/java/dev/plex/Plex.java index 4e32e12..feba36c 100644 --- a/server/src/main/java/dev/plex/Plex.java +++ b/server/src/main/java/dev/plex/Plex.java @@ -109,7 +109,6 @@ public class Plex extends JavaPlugin commands.load(false); sqlConnection = new SQLConnection(); -// mongoConnection = new MongoConnection(); redisConnection = new RedisConnection(); playerCache = new PlayerCache(); @@ -153,6 +152,13 @@ public class Plex extends JavaPlugin PlexLog.debug("Not hooking into Prism"); } + if (PlexUtils.hasVanishPlugin()) + { + PlexLog.log("Hooked into SuperVanish / PremiumVanish!"); + } else { + PlexLog.debug("Not hooking into SuperVanish / PremiumVanish"); + } + updateChecker = new UpdateChecker(); PlexLog.log("Update checking enabled"); diff --git a/server/src/main/java/dev/plex/command/impl/BcastLoginMessageCMD.java b/server/src/main/java/dev/plex/command/impl/BcastLoginMessageCMD.java new file mode 100644 index 0000000..bfc69d8 --- /dev/null +++ b/server/src/main/java/dev/plex/command/impl/BcastLoginMessageCMD.java @@ -0,0 +1,59 @@ +package dev.plex.command.impl; + +import com.google.common.collect.ImmutableList; +import dev.plex.cache.DataUtils; +import dev.plex.command.PlexCommand; +import dev.plex.command.annotation.CommandParameters; +import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.exception.PlayerNotFoundException; +import dev.plex.command.source.RequiredCommandSource; +import dev.plex.meta.PlayerMeta; +import dev.plex.player.PlexPlayer; +import dev.plex.util.PlexUtils; +import net.kyori.adventure.text.Component; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +@CommandPermissions(permission = "plex.broadcastloginmessage", source = RequiredCommandSource.ANY) +@CommandParameters(name = "bcastloginmessage", usage = "/ ", description = "Broadcast your login message (for vanish support)", aliases = "bcastlm") +public class BcastLoginMessageCMD extends PlexCommand +{ + @Override + protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) + { + if (args.length == 0) + { + return usage(); + } + + PlexPlayer plexPlayer = DataUtils.getPlayer(args[0]); + + if (plexPlayer == null) + { + throw new PlayerNotFoundException(); + } + + String loginMessage = PlayerMeta.getLoginMessage(plexPlayer); + if (!loginMessage.isEmpty()) + { + PlexUtils.broadcast(PlexUtils.stringToComponent(loginMessage)); + PlexUtils.broadcast(mmString("" + plexPlayer.getName() + " joined the game")); + } + else + { + return mmString("This player does not have a login message."); + } + + return null; + } + + @Override + public @NotNull List smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException + { + return args.length == 1 && silentCheckPermission(sender, this.getPermission()) ? PlexUtils.getPlayerNameList() : ImmutableList.of(); + } +} \ No newline at end of file