Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/me/codedred/playtimes/commands/Time.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,12 @@ private void handleOtherPlayerCommand(CommandSender sender, String[] args) {
ChatUtil.errno(sender, ChatUtil.ChatTypes.NO_PERMISSION);
return;
}
String userPrefixRegex = Pattern.quote(Objects.requireNonNull(data.getConfig().getString("floodgate-username-prefix")));
String regex = "[^a-z0-9_" + userPrefixRegex + "]";
new BukkitRunnable() {
@Override
public void run() {
Pattern p = Pattern.compile("[^a-z0-9_]", Pattern.CASE_INSENSITIVE);
Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(args[0]);
boolean b = m.find();

Expand Down
1 change: 1 addition & 0 deletions src/main/java/me/codedred/playtimes/data/CustomConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void reloadConfig() {
private void checkAndAddDefaults() {
Map<String, Object> requiredKeys = new LinkedHashMap<>();
requiredKeys.put("prefix", "&7[&b&lPlayTimes&7]");
requiredKeys.put("floodgate-username-prefix", ".");
requiredKeys.put("use-papi-placeholders", false);

requiredKeys.put(
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
# The 'prefix' configures the introductory text for 'player-not-found' and 'player-never-joined' notifications.
prefix: "&7[&b&lPlayTimes&7]"

# Only for servers running Floodgate for Bedrock Geyser support.
# This should be the same username-prefix found in your Floodgate config.yml
# Use '' for an empty prefix
floodgate-username-prefix: "."

# Placeholder API Configuration
# Activate this only if using PlaceholderAPI with PlayTimes.
# To integrate PlayTimes placeholders into other plugins, simply install PlaceholderAPI; integration occurs seamlessly.
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/exampleConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
# The 'prefix' configures the introductory text for 'player-not-found' and 'player-never-joined' notifications.
prefix: "&7[&b&lPlayTimes&7]"

# Only for servers running Floodgate for Bedrock Geyser support.
# This should be the same username-prefix found in your Floodgate config.yml
# Use '' for an empty prefix
floodgate-username-prefix: "."

# Placeholder API Configuration
# Activate this only if using PlaceholderAPI with PlayTimes.
# To integrate PlayTimes placeholders into other plugins, simply install PlaceholderAPI; integration occurs seamlessly.
Expand Down