Let /saveskin ignore .png

This commit is contained in:
libraryaddict 2020-12-27 13:31:06 +13:00
parent b3274cc88b
commit 73d2d6b1a5

View File

@ -29,7 +29,9 @@ public class GrabSkinCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) { public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
if (sender instanceof Player && !sender.isOp() && if (sender instanceof Player && !sender.isOp() &&
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) { (!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
sender.sendMessage(ChatColor.RED + "This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin usage!"); sender.sendMessage(ChatColor.RED +
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for " +
"non-admin usage!");
return true; return true;
} }
@ -54,8 +56,8 @@ public class GrabSkinCommand implements CommandExecutor {
return true; return true;
} }
if (tName == null && skin.matches("(.*\\/)?[a-zA-Z0-9_-]{3,20}\\.png")) { if (tName == null && skin.matches("(.*\\/)?[a-zA-Z0-9_-]{3,20}(\\.png)?")) {
tName = skin.substring(skin.lastIndexOf("/") + 1, skin.lastIndexOf(".")); tName = skin.substring(skin.lastIndexOf("/") + 1, skin.contains(".") ? skin.lastIndexOf(".") : skin.length());
if (DisguiseUtilities.hasGameProfile(tName)) { if (DisguiseUtilities.hasGameProfile(tName)) {
tName = null; tName = null;
@ -101,8 +103,7 @@ public class GrabSkinCommand implements CommandExecutor {
} }
if (profile.getName() == null || !profile.getName().equals(nName)) { if (profile.getName() == null || !profile.getName().equals(nName)) {
profile = ReflectionManager profile = ReflectionManager.getGameProfileWithThisSkin(profile.getUUID(), profile.getName(), profile);
.getGameProfileWithThisSkin(profile.getUUID(), profile.getName(), profile);
} }
DisguiseAPI.addGameProfile(nName, profile); DisguiseAPI.addGameProfile(nName, profile);
@ -132,8 +133,7 @@ public class GrabSkinCommand implements CommandExecutor {
start += end; start += end;
builder.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, sub)); builder.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, sub));
builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(LibsMsg.CLICK_TO_COPY_HOVER.get() + " " + msg).create()));
new ComponentBuilder(LibsMsg.CLICK_TO_COPY_HOVER.get() + " " + msg).create()));
msg += 1; msg += 1;
} }