diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-07-18 05:16:57 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-07-18 05:16:57 +1000 |
commit | 55ee2b01e25c7f7f6c4c893e18572150266ebd03 (patch) | |
tree | a87808aec784ac184506d4f74cc110a383dc64d8 /src/Java/miscutil | |
parent | 99f319880374db0c20d43b8c557c777ec1f8e998 (diff) | |
download | GT5-Unofficial-55ee2b01e25c7f7f6c4c893e18572150266ebd03.tar.gz GT5-Unofficial-55ee2b01e25c7f7f6c4c893e18572150266ebd03.tar.bz2 GT5-Unofficial-55ee2b01e25c7f7f6c4c893e18572150266ebd03.zip |
% Finalised a few things with Random Hex Generation related stuff.
Diffstat (limited to 'src/Java/miscutil')
-rw-r--r-- | src/Java/miscutil/core/util/Utils.java | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/Java/miscutil/core/util/Utils.java b/src/Java/miscutil/core/util/Utils.java index 5dd121f9b6..e85d65fff0 100644 --- a/src/Java/miscutil/core/util/Utils.java +++ b/src/Java/miscutil/core/util/Utils.java @@ -419,14 +419,20 @@ public class Utils { String hexChar = "0x"; String result; if (hexAsStringOrInt.getClass() == String.class){ - result = hexChar+hexAsStringOrInt; - if (result.length() != 6){ - String temp = leftPadWithZeroes(result, 6); + + if (((String) hexAsStringOrInt).length() != 6){ + String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); result = temp; } + result = hexChar+hexAsStringOrInt; return result; } else if (hexAsStringOrInt.getClass() == Integer.class){ + ; + if (((String) hexAsStringOrInt).length() != 6){ + String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6); + result = temp; + } result = hexChar+String.valueOf(hexAsStringOrInt); return result; } @@ -445,20 +451,21 @@ public class Utils { public static int generateSingularRandomHexValue(){ String temp; - int usefuleNumber = 0; - int tDecided = randInt(1, 5); + int usefulNum = 0; + int randomInt = randInt(1, 5); final Map<Integer, String> colours = Utils.hexColourGeneratorRandom(5); - if (colours.get(tDecided) != null && colours.size() > 0){ - usefuleNumber = Integer.getInteger(colours.get(tDecided)); + if (colours.get(randomInt) != null && colours.size() > 0){ + temp = colours.get(randomInt); } else { - usefuleNumber = 123456; + temp = "0F0F0F"; } - Utils.LOG_INFO("Operating with "+usefuleNumber); - temp = Utils.appenedHexNotationToString(String.valueOf(usefuleNumber)); - Utils.LOG_INFO("Made "+temp+" - Hopefully it's not a mess."); + Utils.LOG_INFO("Operating with "+temp); + temp = Utils.appenedHexNotationToString(String.valueOf(temp)); + Utils.LOG_INFO("Made "+temp+" - Hopefully it's not a mess."); + Utils.LOG_INFO("It will decode into "+Integer.decode(temp)+"."); return Integer.decode(temp); } |