Skip to content

Commit

Permalink
Add is-bedrock placeholder (#17)
Browse files Browse the repository at this point in the history
* Add is-bedrock placeholder that returns true/false depending if player is on bedrock client or not

* remove unneeded comments

* Add is-bedrock placeholder that returns true/false depending if player is on bedrock client or not
  • Loading branch information
TheJoshue authored Dec 25, 2023
1 parent 7009a94 commit 1bab110
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public String getVersion(){

@Override
public String onPlaceholderRequest(Player player, String identifier) {
if(player == null) {
if (player == null) {
return "";
}

Expand Down Expand Up @@ -91,6 +91,13 @@ public String onPlaceholderRequest(Player player, String identifier) {
} else {
return config.getXboxXuid().getNone(player);
}

case "isbedrock":
if (floodgatePlayer != null) {
return config.getIsBedrock().getFound();
} else {
return config.getIsBedrock().getNone(player);
}
}

return null;
Expand Down Expand Up @@ -134,7 +141,7 @@ private String getPlayerDeviceString(Player player) {
default:
return config.getDevice().getUnknown().replace("&", "§");
}
}else{
} else {
return config.getDevice().getGeneric().replace("&", "§");
}
} else {
Expand Down Expand Up @@ -168,6 +175,8 @@ public Map<String, Object> getDefaults() {
defaults.put("xbox-username.none", "&8[&6N/A&8]");
defaults.put("xbox-xuid.found", "&8[&6%xuid%&8]");
defaults.put("xbox-xuid.none", "&8[&6N/A&8]");
defaults.put("is-bedrock.found", "true");
defaults.put("is-bedrock.none", "false");
return defaults;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public GenericPlaceholders getXboxXuid() {
return new GenericPlaceholders(this, "xbox-xuid");
}

public GenericPlaceholders getIsBedrock() {
return new GenericPlaceholders(this, "is-bedrock");
}

public static class DevicePlaceholders {

private final FloodgateExpansionConfig config;
Expand Down

0 comments on commit 1bab110

Please sign in to comment.