Do uuid version 3 warning

This commit is contained in:
libraryaddict 2021-05-23 10:17:46 +12:00
parent 8641115c75
commit 42f04766b1
5 changed files with 28 additions and 9 deletions

View File

@ -80,6 +80,7 @@ public class GrabHeadCommand implements CommandExecutor {
@Override @Override
public void onSuccess(WrappedGameProfile profile) { public void onSuccess(WrappedGameProfile profile) {
runnable.cancel(); runnable.cancel();
DisguiseUtilities.doSkinUUIDWarning(sender);
DisguiseUtilities.setGrabHeadCommandUsed(); DisguiseUtilities.setGrabHeadCommandUsed();

View File

@ -90,6 +90,7 @@ public class GrabSkinCommand implements CommandExecutor {
@Override @Override
public void onSuccess(WrappedGameProfile profile) { public void onSuccess(WrappedGameProfile profile) {
runnable.cancel(); runnable.cancel();
DisguiseUtilities.doSkinUUIDWarning(sender);
String nName = name; String nName = name;

View File

@ -30,7 +30,9 @@ public class SaveDisguiseCommand 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;
} }
@ -68,8 +70,7 @@ public class SaveDisguiseCommand implements CommandExecutor {
DisguiseAPI.addCustomDisguise(name, disguiseString); DisguiseAPI.addCustomDisguise(name, disguiseString);
LibsMsg.CUSTOM_DISGUISE_SAVED.send(sender, name); LibsMsg.CUSTOM_DISGUISE_SAVED.send(sender, name);
} } catch (DisguiseParseException e) {
catch (DisguiseParseException e) {
if (e.getMessage() != null) { if (e.getMessage() != null) {
DisguiseUtilities.sendMessage(sender, e.getMessage()); DisguiseUtilities.sendMessage(sender, e.getMessage());
} else { } else {
@ -85,8 +86,9 @@ public class SaveDisguiseCommand implements CommandExecutor {
int i = 2; int i = 2;
for (; i < args.length; i++) { for (; i < args.length; i++) {
if (!args[i].equalsIgnoreCase("setskin")) if (!args[i].equalsIgnoreCase("setskin")) {
continue; continue;
}
break; break;
} }
@ -138,6 +140,7 @@ public class SaveDisguiseCommand implements CommandExecutor {
@Override @Override
public void onSuccess(WrappedGameProfile profile) { public void onSuccess(WrappedGameProfile profile) {
runnable.cancel(); runnable.cancel();
DisguiseUtilities.doSkinUUIDWarning(sender);
finalArgs[skinId] = DisguiseUtilities.getGson().toJson(profile); finalArgs[skinId] = DisguiseUtilities.getGson().toJson(profile);
@ -166,8 +169,7 @@ public class SaveDisguiseCommand implements CommandExecutor {
LibsMsg.CUSTOM_DISGUISE_SAVED.send(sender, name); LibsMsg.CUSTOM_DISGUISE_SAVED.send(sender, name);
DisguiseUtilities.setSaveDisguiseCommandUsed(); DisguiseUtilities.setSaveDisguiseCommandUsed();
} } catch (DisguiseParseException e) {
catch (DisguiseParseException e) {
if (e.getMessage() != null) { if (e.getMessage() != null) {
DisguiseUtilities.sendMessage(sender, e.getMessage()); DisguiseUtilities.sendMessage(sender, e.getMessage());
} else { } else {

View File

@ -196,6 +196,7 @@ public class DisguiseUtilities {
private final static ConcurrentHashMap<String, DScoreTeam> teams = new ConcurrentHashMap<>(); private final static ConcurrentHashMap<String, DScoreTeam> teams = new ConcurrentHashMap<>();
private final static boolean java16; private final static boolean java16;
private static boolean criedOverJava16; private static boolean criedOverJava16;
private static HashSet<UUID> warnedSkin = new HashSet<>();
static { static {
final Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(System.getProperty("java.version")); final Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(System.getProperty("java.version"));
@ -214,6 +215,21 @@ public class DisguiseUtilities {
} }
} }
public static void doSkinUUIDWarning(CommandSender sender) {
if (!(sender instanceof Player)) {
return;
}
UUID uuid = ((Player) sender).getUniqueId();
if (uuid.version() == 4 || warnedSkin.contains(uuid)) {
return;
}
warnedSkin.add(uuid);
LibsMsg.SKIN_API_UUID_3.send(sender);
}
/** /**
* Only allow saves every 2 minutes * Only allow saves every 2 minutes
*/ */

View File

@ -198,9 +198,8 @@ public enum LibsMsg {
COPY_DISGUISE_NO_COPY(ChatColor.GREEN + "Data: " + ChatColor.YELLOW + "%s"), COPY_DISGUISE_NO_COPY(ChatColor.GREEN + "Data: " + ChatColor.YELLOW + "%s"),
CLICK_TO_COPY_HOVER(ChatColor.GOLD + "Click to Copy"), CLICK_TO_COPY_HOVER(ChatColor.GOLD + "Click to Copy"),
CLICK_COPY(ChatColor.YELLOW + "" + ChatColor.BOLD + "%s"), CLICK_COPY(ChatColor.YELLOW + "" + ChatColor.BOLD + "%s"),
SKIN_API_UUID_3(ChatColor.RED + SKIN_API_UUID_3(ChatColor.RED + "Using account with UUID version 3. If skin is incorrect, try change 'UUIDVersion' in protocol.yml" +
"You seem to be using a Minecraft account with an UUID version of 3. If the skin is not as expected, you can change 'UUIDVersion' in protocol.yml" + " to 3. If skin is still incorrect and you did not purchase Minecraft, this cannot be fixed."),
" to 3 which may fix this. If you are using a Minecraft account that was not purchased, then there is nothing further we can do to fix this."),
SKIN_API_IN_USE(ChatColor.RED + "mineskin.org is currently in use, please try again"), SKIN_API_IN_USE(ChatColor.RED + "mineskin.org is currently in use, please try again"),
SKIN_API_TIMER(ChatColor.RED + "mineskin.org can be used again in %s seconds"), SKIN_API_TIMER(ChatColor.RED + "mineskin.org can be used again in %s seconds"),
SKIN_API_FAIL(ChatColor.RED + "Unexpected error while accessing mineskin.org, please try again"), SKIN_API_FAIL(ChatColor.RED + "Unexpected error while accessing mineskin.org, please try again"),