From 35d436bb61d218f563271eeb560dc903aae4c188 Mon Sep 17 00:00:00 2001 From: Taah Date: Sun, 3 Apr 2022 21:07:48 -0700 Subject: [PATCH] remove and swap it to {number} for messages --- src/main/java/dev/plex/util/PlexUtils.java | 6 +- src/main/resources/messages.yml | 213 +++++++++++---------- 2 files changed, 113 insertions(+), 106 deletions(-) diff --git a/src/main/java/dev/plex/util/PlexUtils.java b/src/main/java/dev/plex/util/PlexUtils.java index 8729441..901b1cd 100644 --- a/src/main/java/dev/plex/util/PlexUtils.java +++ b/src/main/java/dev/plex/util/PlexUtils.java @@ -146,9 +146,13 @@ public class PlexUtils extends PlexBase { throw new NullPointerException(); } - for (Object object : objects) + /*for (Object object : objects) { f = f.replaceFirst("", String.valueOf(object)); + }*/ + for (int i = 0; i < objects.length; i++) + { + f = f.replace("{" + i + "}", String.valueOf(objects[i])); } return f; } diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 07df062..c47865b 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -5,103 +5,103 @@ # Messages in here will be placed in for certain commands, actions, etc. # Warning: not all commands have customizable messages -# Variables - these are code-defined replacements for things that should be inserted into messages. (e.g. names, statuses, numbers) +# Variables {number} - these are code-defined replacements for things that should be inserted into messages. (e.g. names, statuses, numbers) # If any of these variables are supposed to be used within a message, some documentation is provided to give more context to what the variables indicate. -# You are unable to change the order the variables are used due to it being a code-side functionality. # If you are wishing to change these messages it's recommended you use the same amount of variables as stated in the documentation, however it's not required. -# 1. Appeal URL -# 2. Reason -# 3. Expiry -# 4. Punisher -banMessage: "You have been banned! You may appeal at .\nReason: \nEnd date: \nBanned by: " -# The type of indefinite ban -# Appeal URL -indefBanMessage: "Your is indefinitely banned! You may appeal at ." +# 0 - Appeal URL +# 1 - Reason +# 2 - Expiry +# 3 - Punisher +banMessage: "You have been banned! You may appeal at {0}.\nReason: {1}\nEnd date: {2}\nBanned by: {3}" +# 0 - The type of indefinite ban +# 1 - Appeal URL +indefBanMessage: "Your {0} is indefinitely banned! You may appeal at {1}." playerNotFound: "Player not found!" worldNotFound: "World not found!" -# 1. The world you have been teleported to -playerWorldTeleport: "You have been teleported to ." -# 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 -oppedPlayer: " - Opped " -# 1. The person who is deopped -# 2. The person who has been deopped -deoppedPlayer: " - Deopped " -# 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 -unfrozePlayer: " - Unfroze " -# 1. The command sender -# 2. The person who has been muted -mutedPlayer: " - Muted " -# 1. The command sender -# 2. The person who has been unmuted -unmutedPlayer: " - Unmuted " -# 1. The person who is locking up -# 2. The person who has been locked up -lockedUpPlayer: " - Locking up " -# 1. The person who is unlocking -# 2. The person who has been unlocked -unlockedPlayer: " - Unlocking " -# 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!" +# 0 - The world you have been teleported to +playerWorldTeleport: "You have been teleported to {0}." +# 0 - The sender who opped everyone +oppedAllPlayers: "{0} - Opped all players on the server" +# 0 - The sender who de-opped everyone +deoppedAllPlayers: "{0} - De-opped all players on the server" +# 0 - The person who is opping +# 1 - The person who has been opped +oppedPlayer: "{0} - Opped {1}" +# 0 - The person who is deopped +# 1 - The person who has been deopped +deoppedPlayer: "{0} - Deopped {1}" +# 0 - The person who is freezing +# 1 - The person who has been frozen +frozePlayer: "{0} - Froze {1}" +# 0 - The person who is unfreezing +# 1 - The person who has been unfrozen +unfrozePlayer: "{0} - Unfroze {1}" +# 0 - The command sender +# 1 - The person who has been muted +mutedPlayer: "{0} - Muted {1}" +# 0 - The command sender +# 1 - The person who has been unmuted +unmutedPlayer: "{0} - Unmuted {1}" +# 0 - The person who is locking up +# 1 - The person who has been locked up +lockedUpPlayer: "{0} - Locking up {1}" +# 0 - The person who is unlocking +# 1 - The person who has been unlocked +unlockedPlayer: "{0} - Unlocking {1}" +# 0 - The rank required to use the command +noPermissionRank: "You must be at least {0} to use this command!" +# 0 - The permission node required to use the command +noPermissionNode: "You must have the permission: {0} 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 -nameHistoryTitle: "Name History of " +# 0 - The username of the name history +nameHistoryTitle: "Name History of {0}" nameHistorySeparator: "-----------------------------" -# 1. The name -# 2. The date and time of the name change -nameHistoryBody: " - " -# 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 " +# 0 - The name +# 1 - The date and time of the name change +nameHistoryBody: "{0} - {1}" +# 0 - The gamemode +gameModeSetTo: "Your gamemode has been set to {0}." +# 0 - The player's name +# 1 - The gamemode +setOtherPlayerGameModeTo: "You set {0}'s gamemode to {1}." +# 0 - The command sender +# 1 - The gamemode +playerSetOtherGameMode: "{0} set your gamemode to {1}." +# 0 - The command sender +# 1 - The gamemode +setEveryoneGameMode: "{0} - Changing everyone's gamemode to {1}" 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 ." +# 0 - The command sender +# 1 - The player +newAdminAdded: "{0} - Adding {1} to the admin list" +# 0 - The command sender +# 1 - The player +adminRemoved: "{0} - Removing {1} from the admin list" +# 0 - The command sender +# 1 - The player +# 2 - The rank +adminSetRank: "{0} - Setting {1}'s rank to {2}" +# 0 - The world name +teleportedToWorld: "You have been teleported to the {0}." higherRankThanYou: "This player is an admin or a higher rank than you." playerNotAdmin: "That player is not an admin." 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 " +# 0 - Rank +yourRank: "Your rank is: {0}" +# 0 - Player name +# 1 - Rank +otherRank: "{0}'s rank is: {1}" +# 0 - The command sender +# 1 - The player +banningPlayer: "{0} - Banning {1}" +# 0 - The command sender +# 1 - The player +unbanningPlayer: "{0} - Unbanning {1}" playerNotBanned: "That player is not banned!" playerNotFrozen: "That player is not frozen!" playerNotMuted: "That player is not muted!" @@ -110,33 +110,36 @@ playerFrozen: "That player is already frozen!" playerMuted: "That player is already muted!" playerLockedUp: "That player is already locked up!" muted: "You are currently muted - STFU!" -# 1. The command sender -# 2. The player -kickedPlayer: " - Kicking " +# 0 - The command sender +# 1 - The player +kickedPlayer: "{0} - Kicking {1}" teleportedToWorldSpawn: "Teleporting to the local spawn" toggleCommandSpy: "CommandSpy has been" enabled: "enabled." disabled: "disabled." -adminChatFormat: '[AdminChat] » ' -maximumPrefixLength: "The maximum length for a tag may only be ." +# 0 - The admin / staff member +# 1 - The message +adminChatFormat: '[AdminChat] {0} » {1}' +# 0 - Maximum length, configured in config.yml +maximumPrefixLength: "The maximum length for a tag may only be {0}." prefixCleared: "Your prefix has been cleared." -# 1. The player name -otherPrefixCleared: "You have cleared 's prefix." -# 1. The new prefix -prefixSetTo: "Your prefix has been set to " -# 1. The amount of players whose edits are blocked -blockedEditsSize: "Blocked block modification abilities for players." -# 1. The amount of players whose edits are unblocked -unblockedEditsSize: "Unblocked all block modification abilities for players." -# 1. The command sender -# 2. The player name -blockingEditFor: " - Blocking block modification abilities for " -# 1. The command sender -# 2. The player name -unblockingEditFor: " - Unblocking block modification abilities for " +# 0 - The player name +otherPrefixCleared: "You have cleared {0}'s prefix." +# 0 - The new prefix +prefixSetTo: "Your prefix has been set to {0}" +# 0 - The amount of players whose edits are blocked +blockedEditsSize: "Blocked block modification abilities for {0} players." +# 0 - The amount of players whose edits are unblocked +unblockedEditsSize: "Unblocked all block modification abilities for {0} players." +# 0 - The command sender +# 1 - The player name +blockingEditFor: "{0} - Blocking block modification abilities for {1}" +# 0 - The command sender +# 1 - The player name +unblockingEditFor: "{0} - Unblocking block modification abilities for {1}" yourEditsHaveBeenBlocked: "Your block modification abilities have been blocked." yourEditsHaveBeenUnblocked: "Your block modification abilities have been restored." -# 1. The player name -editsBlocked: "Blocked block modification abilities for " -# 1. The player name -editsUnblocked: "Unblocked block modification abilities for " \ No newline at end of file +# 0 - The player name +editsBlocked: "Blocked block modification abilities for {0}" +# 0 - The player name +editsUnblocked: "Unblocked block modification abilities for {0}" \ No newline at end of file