Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Fixes nullpointer
Browse files Browse the repository at this point in the history
  • Loading branch information
xknat committed Feb 7, 2023
1 parent 4f52bdd commit a1ee4a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.extendedclip.placeholderapi.expansion.skinsrestorer</groupId>
<artifactId>skinsrestorer-expansion</artifactId>
<version>1.7.1</version>
<version>1.7.2</version>

<name>Expansion-SkinsRestorer</name>
<description>SkinsRestorer expansion for PlaceholderAPI</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public boolean register() {
* @return Possible-null String
*/
@Override
public @Nullable String onRequest(OfflinePlayer offlinePlayer, @NotNull String params) {
public @Nullable String onRequest(@NotNull OfflinePlayer offlinePlayer, @NotNull String params) {
params = params.toLowerCase();
if (params.equalsIgnoreCase("test")) {
return "success";
Expand Down Expand Up @@ -71,18 +71,22 @@ public boolean register() {
return getSkinTextureUrl(p, params.toLowerCase().replace("gettextureurl_", ""));

// getSkinTextureID
if (params.toLowerCase().startsWith("gettextureid_"))
return getSkinTextureUrl(p, params.toLowerCase().replace("gettextureid_", ""))
.replace("https://textures.minecraft.net/texture/", "")
.replace("http://textures.minecraft.net/texture/", "");
if (params.toLowerCase().startsWith("gettextureid_")) {
String skinTexture = getSkinTextureUrl(p, params.toLowerCase().replace("gettextureid_", ""));
if (skinTexture != null) {
skinTexture = skinTexture.replace("https://textures.minecraft.net/texture/", "").replace("http://textures.minecraft.net/texture/", "");
return skinTexture;
}

}
return null;
}

public String getSkinTextureUrl(String p, String params) {
String url = wrapper.getSkinTextureUrl(wrapper.getSkinName(p));

//noinspection ConstantConditions
if (url != null || ("null").equals(url))
if (!(url == null || url.trim().isEmpty()))
return url;

// %getTextureUrl_Or_PlayerName%
Expand Down

0 comments on commit a1ee4a1

Please sign in to comment.