A few changes

- Better documentation for messages.yml
- Add rawsay command
- Add seeing other peoples ranks
This commit is contained in:
Telesphoreo 2022-02-24 00:04:26 -06:00
parent 5e63f2572d
commit e326477a5a
4 changed files with 86 additions and 24 deletions

View File

@ -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;
}

View File

@ -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 = "/<command> <message>", 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;
}
}

View File

@ -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());

View File

@ -19,53 +19,68 @@ errorColor: "c"
# Broadcast color <b> - this will make the color of the message the broadcast color defined above.
# Error color <e> - 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<v>.\n&cReason: &6<v>\n&cEnd date: &6<v>\n&cBanned by: &6<v>"
test: "this is a test message!"
# 1: the command sender's username
# 1. The command sender's username
variableTest: "variable test with <v>!"
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 <v>."
# 1: the command sender who opped everyone
# 1. The sender who opped everyone
oppedAllPlayers: "<b><v> - Opped all players on the server"
# 1. The sender who de-opped everyone
deoppedAllPlayers: "<b><v> - 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: "<b><v> - Opped <v>"
# 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: "<b><v> - Froze <v>"
# 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: "<b><v> - Unfroze <v>"
noPermission: "<e>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: "<e>You must be at least <v> to use this command!"
# 1. The permission node required to use the command
noPermissionNode: "<e>You must have the permission: <v> to use this command!"
noPermissionInGame: "<e>You must be in console to use this command!"
noPermissionConsole: "<e>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 <v>"
# 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: " - <v> (<v>)"
# 1: the username that failed
# 1. The username that failed
nameHistoryFail: "<e>Something went wrong while trying to retrieve name history of <v>! Try again later!"
nameHistoryDoesntExist: "<e>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 <v>."
# 1. The player's name
# 2. The gamemode
setOtherPlayerGameModeTo: "You set <v>'s gamemode to <v>."
# 1. The command sender
# 2. The gamemode
playerSetOtherGameMode: "<v> set your gamemode to <v>."
# 1. The command sender
# 2. The gamemode
setEveryoneGameMode: "<b><v> - Changing everyone's gamemode to <v>"
consoleMustDefinePlayer: "You must define a player since you are running this command from console."
# 1. The command sender
# 2. The player
newAdminAdded: "<b><v> - Adding <v> to the admin list"
# 1. The command sender
# 2. The player
adminRemoved: "<e><v> - Removing <v> from the admin list"
# 1. The command sender
# 2. The player
adminSetRank: "<b><v> - Setting <v>'s rank to <v>"
# The world name
teleportedToWorld: "<b>You have been teleported to the <v>."
higherRankThanYou: "<e>This player is an admin and a higher rank than you."
playerNotAdmin: "<e>That player is not an admin."
@ -73,8 +88,16 @@ playerIsAdmin: "<e>That player is already an admin."
rankNotFound: "<e>The rank you entered was not found."
rankMustBeHigherThanAdmin: "<e>The rank you entered must be higher than Admin."
consoleOnly: "<e>This command can only be executed by the console."
# 1. Rank
yourRank: "<b>Your rank is: <v>"
# 1. Player name
# 2. Rank
otherRank: "<b><v>'s rank is: <v>"
# 1. The command sender
# 2. The player
banningPlayer: "<e><v> - Banning <v>"
# 1. The command sender
# 2. The player
unbanningPlayer: "<b><v> - Unbanning <v>"
playerNotBanned: "<e>That player is not banned!"
teleportedToWorldSpawn: "<b>Teleporting to the local spawn"