mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2025-01-18 21:01:30 +01:00
Fix some color codes not being applied, and some bad sanitization
This commit is contained in:
parent
d01e55e5d7
commit
2aaeeca677
@ -55,7 +55,7 @@ public class GrabHeadCommand implements CommandExecutor {
|
||||
String usable = SkinUtils.getUsableStatus();
|
||||
|
||||
if (usable != null) {
|
||||
sender.sendMessage(usable);
|
||||
DisguiseUtilities.sendMessage(sender, usable);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class GrabSkinCommand implements CommandExecutor {
|
||||
String usable = SkinUtils.getUsableStatus();
|
||||
|
||||
if (usable != null) {
|
||||
sender.sendMessage(usable);
|
||||
DisguiseUtilities.sendMessage(sender, usable);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -73,7 +73,12 @@ public class GrabSkinCommand implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
String name = tName.toLowerCase(Locale.ROOT).endsWith(":slim") ? tName.substring(0, tName.lastIndexOf(":")) : tName;
|
||||
String name = tName != null && tName.toLowerCase(Locale.ROOT).endsWith(":slim") ? tName.substring(0, tName.lastIndexOf(":")) : tName;
|
||||
|
||||
if (name != null && name.replaceAll("[_a-zA-Z \\d-@#]", "").length() > 0) {
|
||||
LibsMsg.SKIN_API_INVALID_NAME.send(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
SkinUtils.SkinCallback callback = new SkinUtils.SkinCallback() {
|
||||
private final BukkitTask runnable = new BukkitRunnable() {
|
||||
|
@ -176,8 +176,9 @@ public class SkinUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
File file =
|
||||
new File(LibsDisguises.getInstance().getDataFolder(), "/Skins/" + param + (param.toLowerCase(Locale.ENGLISH).endsWith(".png") ? "" : ".png"));
|
||||
File expectedFolder = new File(LibsDisguises.getInstance().getDataFolder(), "/Skins/");
|
||||
|
||||
File file = new File(expectedFolder, param + (param.toLowerCase(Locale.ENGLISH).endsWith(".png") ? "" : ".png"));
|
||||
|
||||
if (!file.exists()) {
|
||||
file = null;
|
||||
@ -186,6 +187,9 @@ public class SkinUtils {
|
||||
callback.onError(LibsMsg.SKIN_API_BAD_FILE_NAME);
|
||||
return;
|
||||
}
|
||||
} else if (!file.getParentFile().getAbsolutePath().equals(expectedFolder.getAbsolutePath())) {
|
||||
callback.onError(LibsMsg.SKIN_API_INVALID_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
if (file != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user