diff --git a/src/main/java/dev/plex/command/impl/RankCMD.java b/src/main/java/dev/plex/command/impl/RankCMD.java index 0dc6911..eaa3069 100644 --- a/src/main/java/dev/plex/command/impl/RankCMD.java +++ b/src/main/java/dev/plex/command/impl/RankCMD.java @@ -11,8 +11,6 @@ import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -// TODO: See ranks of other players - @CommandPermissions(level = Rank.OP, permission = "plex.rank", source = RequiredCommandSource.IN_GAME) @CommandParameters(name = "rank", description = "Displays your rank") public class RankCMD extends PlexCommand @@ -20,10 +18,19 @@ public class RankCMD extends PlexCommand @Override protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) { - if (!(playerSender == null)) + if (args.length == 0) { - Rank rank = getPlexPlayer(playerSender).getRankFromString(); - return tl("yourRank", rank.getReadable()); + if (!(playerSender == null)) + { + Rank rank = getPlexPlayer(playerSender).getRankFromString(); + return tl("yourRank", rank.getReadable()); + } + } + else + { + Player player = getNonNullPlayer(args[0]); + Rank rank = getPlexPlayer(player).getRankFromString(); + return tl("otherRank", player.getName(), rank.getReadable()); } return null; } diff --git a/src/main/java/dev/plex/command/impl/RawSayCMD.java b/src/main/java/dev/plex/command/impl/RawSayCMD.java new file mode 100644 index 0000000..caa269b --- /dev/null +++ b/src/main/java/dev/plex/command/impl/RawSayCMD.java @@ -0,0 +1,31 @@ +package dev.plex.command.impl; + +import dev.plex.command.PlexCommand; +import dev.plex.command.annotation.CommandParameters; +import dev.plex.command.annotation.CommandPermissions; +import dev.plex.command.source.RequiredCommandSource; +import dev.plex.rank.enums.Rank; +import dev.plex.util.PlexUtils; +import net.kyori.adventure.text.Component; +import org.apache.commons.lang.StringUtils; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@CommandPermissions(level = Rank.SENIOR_ADMIN, permission = "plex.rawsay", source = RequiredCommandSource.ANY) +@CommandParameters(name = "rawsay", usage = "/ ", description = "Displays a message to everyone") +public class RawSayCMD extends PlexCommand +{ + @Override + protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args) + { + if (args.length == 0) + { + return usage(); + } + + PlexUtils.broadcast(StringUtils.join(args, " ")); + return null; + } +} \ No newline at end of file diff --git a/src/main/java/dev/plex/handlers/CommandHandler.java b/src/main/java/dev/plex/handlers/CommandHandler.java index 39244be..56dd9cb 100644 --- a/src/main/java/dev/plex/handlers/CommandHandler.java +++ b/src/main/java/dev/plex/handlers/CommandHandler.java @@ -40,6 +40,7 @@ public class CommandHandler extends PlexBase commands.add(new NameHistoryCMD()); commands.add(new PlexCMD()); commands.add(new PunishmentsCMD()); + commands.add(new RawSayCMD()); commands.add(new SpectatorCMD()); commands.add(new SurvivalCMD()); commands.add(new TagCMD()); diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index cc69e67..ce4533e 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -19,53 +19,68 @@ errorColor: "c" # Broadcast color - this will make the color of the message the broadcast color defined above. # Error color - this will make the color of the message the error color defined above. -# 1: Appeal URL -# 2: Reason -# 3: Expiry -# 4: Punisher +# 1. Appeal URL +# 2. Reason +# 3. Expiry +# 4. Punisher banMessage: "&cYou have been banned! You may appeal at &6.\n&cReason: &6\n&cEnd date: &6\n&cBanned by: &6" test: "this is a test message!" -# 1: the command sender's username +# 1. The command sender's username variableTest: "variable test with !" playerNotFound: "Player not found!" worldNotFound: "World not found!" - -# 1: the world you have been teleported to +# 1. The world you have been teleported to playerWorldTeleport: "You have been teleported to ." -# 1: the command sender who opped everyone +# 1. The sender who opped everyone oppedAllPlayers: " - Opped all players on the server" +# 1. The sender who de-opped everyone deoppedAllPlayers: " - De-opped all players on the server" -# 1: the person who is opping -# 2: the person who has been opped +# 1. The person who is opping +# 2. The person who has been opped oppedPlayer: " - Opped " -# 1: the person who is freezing -# 2: the person who has been frozen +# 1. The person who is freezing +# 2. The person who has been frozen frozePlayer: " - Froze " -# 1: the person who is unfreezing -# 2: the person who has been unfrozen +# 1. The person who is unfreezing +# 2. The person who has been unfrozen unfrozePlayer: " - Unfroze " noPermission: "You cannot use this command!" -# 1: the login message (uncolored) of the rank required to use the command +# 1. The rank required to use the command noPermissionRank: "You must be at least to use this command!" +# 1. The permission node required to use the command noPermissionNode: "You must have the permission: to use this command!" noPermissionInGame: "You must be in console to use this command!" noPermissionConsole: "You must be in-game to use this command!" -# 1: the username of the name history +# 1. The username of the name history nameHistoryTitle: "Name History of " -# 1: a username of the found user -# 2: when the user changed to that username +# 1. A username of the found user +# 2. When the user changed to that username nameHistoryBody: " - ()" -# 1: the username that failed +# 1. The username that failed nameHistoryFail: "Something went wrong while trying to retrieve name history of ! Try again later!" nameHistoryDoesntExist: "Couldn't find this user! Please check if your spelling was correct and this player exists" +# 1. The gamemode gameModeSetTo: "Your gamemode has been set to ." +# 1. The player's name +# 2. The gamemode setOtherPlayerGameModeTo: "You set 's gamemode to ." +# 1. The command sender +# 2. The gamemode playerSetOtherGameMode: " set your gamemode to ." +# 1. The command sender +# 2. The gamemode setEveryoneGameMode: " - Changing everyone's gamemode to " consoleMustDefinePlayer: "You must define a player since you are running this command from console." +# 1. The command sender +# 2. The player newAdminAdded: " - Adding to the admin list" +# 1. The command sender +# 2. The player adminRemoved: " - Removing from the admin list" +# 1. The command sender +# 2. The player adminSetRank: " - Setting 's rank to " +# The world name teleportedToWorld: "You have been teleported to the ." higherRankThanYou: "This player is an admin and a higher rank than you." playerNotAdmin: "That player is not an admin." @@ -73,8 +88,16 @@ playerIsAdmin: "That player is already an admin." rankNotFound: "The rank you entered was not found." rankMustBeHigherThanAdmin: "The rank you entered must be higher than Admin." consoleOnly: "This command can only be executed by the console." +# 1. Rank yourRank: "Your rank is: " +# 1. Player name +# 2. Rank +otherRank: "'s rank is: " +# 1. The command sender +# 2. The player banningPlayer: " - Banning " +# 1. The command sender +# 2. The player unbanningPlayer: " - Unbanning " playerNotBanned: "That player is not banned!" teleportedToWorldSpawn: "Teleporting to the local spawn"