mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-30 21:07:47 +01:00
Fixes a regex bug that replaced every [player] char instead of whole word.
This commit is contained in:
parent
0d69459738
commit
468232cabc
@ -806,9 +806,9 @@ public class TryToComplete
|
|||||||
String alert = "Running command '" + cmd + "' as " + this.user.getName();
|
String alert = "Running command '" + cmd + "' as " + this.user.getName();
|
||||||
this.addon.getLogger().info(alert);
|
this.addon.getLogger().info(alert);
|
||||||
cmd = cmd.substring(6).
|
cmd = cmd.substring(6).
|
||||||
replaceAll(Constants.PARAMETER_PLAYER, this.user.getName()).
|
replaceAll(Constants.ESC + Constants.PARAMETER_PLAYER, this.user.getName()).
|
||||||
replaceAll(Constants.PARAMETER_OWNER, owner).
|
replaceAll(Constants.ESC + Constants.PARAMETER_OWNER, owner).
|
||||||
replaceAll(Constants.PARAMETER_NAME, island == null || island.getName() == null ? "" : island.getName()).
|
replaceAll(Constants.ESC + Constants.PARAMETER_NAME, island == null || island.getName() == null ? "" : island.getName()).
|
||||||
trim();
|
trim();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -829,9 +829,9 @@ public class TryToComplete
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cmd = cmd.replaceAll(Constants.PARAMETER_PLAYER, this.user.getName()).
|
cmd = cmd.replaceAll(Constants.ESC + Constants.PARAMETER_PLAYER, this.user.getName()).
|
||||||
replaceAll(Constants.PARAMETER_OWNER, owner).
|
replaceAll(Constants.ESC + Constants.PARAMETER_OWNER, owner).
|
||||||
replaceAll(Constants.PARAMETER_NAME, island == null || island.getName() == null ? "" : island.getName()).
|
replaceAll(Constants.ESC + Constants.PARAMETER_NAME, island == null || island.getName() == null ? "" : island.getName()).
|
||||||
trim();
|
trim();
|
||||||
|
|
||||||
if (!this.addon.getServer().dispatchCommand(this.addon.getServer().getConsoleSender(), cmd))
|
if (!this.addon.getServer().dispatchCommand(this.addon.getServer().getConsoleSender(), cmd))
|
||||||
|
@ -223,4 +223,9 @@ public class Constants
|
|||||||
* Reference string to challenge parameter in translations.
|
* Reference string to challenge parameter in translations.
|
||||||
*/
|
*/
|
||||||
public static final String PARAMETER_CHALLENGE = "[challenge]";
|
public static final String PARAMETER_CHALLENGE = "[challenge]";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regex escape chars.
|
||||||
|
*/
|
||||||
|
public static final String ESC = "\\";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user