mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-28 11:59:35 +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();
|
||||
this.addon.getLogger().info(alert);
|
||||
cmd = cmd.substring(6).
|
||||
replaceAll(Constants.PARAMETER_PLAYER, this.user.getName()).
|
||||
replaceAll(Constants.PARAMETER_OWNER, owner).
|
||||
replaceAll(Constants.PARAMETER_NAME, island == null || island.getName() == null ? "" : island.getName()).
|
||||
replaceAll(Constants.ESC + Constants.PARAMETER_PLAYER, this.user.getName()).
|
||||
replaceAll(Constants.ESC + Constants.PARAMETER_OWNER, owner).
|
||||
replaceAll(Constants.ESC + Constants.PARAMETER_NAME, island == null || island.getName() == null ? "" : island.getName()).
|
||||
trim();
|
||||
try
|
||||
{
|
||||
@ -829,9 +829,9 @@ public class TryToComplete
|
||||
|
||||
try
|
||||
{
|
||||
cmd = cmd.replaceAll(Constants.PARAMETER_PLAYER, this.user.getName()).
|
||||
replaceAll(Constants.PARAMETER_OWNER, owner).
|
||||
replaceAll(Constants.PARAMETER_NAME, island == null || island.getName() == null ? "" : island.getName()).
|
||||
cmd = cmd.replaceAll(Constants.ESC + Constants.PARAMETER_PLAYER, this.user.getName()).
|
||||
replaceAll(Constants.ESC + Constants.PARAMETER_OWNER, owner).
|
||||
replaceAll(Constants.ESC + Constants.PARAMETER_NAME, island == null || island.getName() == null ? "" : island.getName()).
|
||||
trim();
|
||||
|
||||
if (!this.addon.getServer().dispatchCommand(this.addon.getServer().getConsoleSender(), cmd))
|
||||
|
@ -223,4 +223,9 @@ public class Constants
|
||||
* Reference string to challenge parameter in translations.
|
||||
*/
|
||||
public static final String PARAMETER_CHALLENGE = "[challenge]";
|
||||
|
||||
/**
|
||||
* Regex escape chars.
|
||||
*/
|
||||
public static final String ESC = "\\";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user