From 406429f4e3cbe318f9c593b714b308408b6ffd1e Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 16 Jan 2020 18:21:35 +0000 Subject: [PATCH 1/3] Use ThreadedLocalRandom for RNG utils --- Changelog.txt | 2 ++ .../com/gmail/nossr50/util/random/RandomChanceUtil.java | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 4f1e6c865..9efef47b0 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,5 @@ +Version 2.1.112 + Use ThreadedLocalRandom for RNG utils, random is seeded, thus creating new instances of Random breaks randomness Version 2.1.112 Correct locale usage for enum access, now enforces using the english locale to prevent issues with oddball locales for configs/commands Fixed a NPE that can occur if a player engages in combat with specific skills before their profile is loaded diff --git a/src/main/java/com/gmail/nossr50/util/random/RandomChanceUtil.java b/src/main/java/com/gmail/nossr50/util/random/RandomChanceUtil.java index ae9511bd0..f01c56e60 100644 --- a/src/main/java/com/gmail/nossr50/util/random/RandomChanceUtil.java +++ b/src/main/java/com/gmail/nossr50/util/random/RandomChanceUtil.java @@ -13,6 +13,7 @@ import org.bukkit.entity.Player; import java.text.DecimalFormat; import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; public class RandomChanceUtil { @@ -78,9 +79,7 @@ public class RandomChanceUtil } public static boolean rollDice(double chanceOfSuccess, int bound) { - Random random = new Random(); - - return chanceOfSuccess > random.nextInt(bound); + return chanceOfSuccess > ThreadLocalRandom.current().nextInt(bound); } /** @@ -100,8 +99,6 @@ public class RandomChanceUtil { double chanceOfSuccess = calculateChanceOfSuccess(randomChance); - Random random = new Random(); - //Check the odds return rollDice(chanceOfSuccess, 100); } From 539cd7290e1e0568bad61152e2dec74fe33489e3 Mon Sep 17 00:00:00 2001 From: andrewkm Date: Fri, 17 Jan 2020 08:21:31 +0100 Subject: [PATCH 2/3] Retro mode documentation. (#4104) This commit will save lives, believe me. --- src/main/resources/treasures.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/resources/treasures.yml b/src/main/resources/treasures.yml index 3d4401a36..e98f2db9a 100755 --- a/src/main/resources/treasures.yml +++ b/src/main/resources/treasures.yml @@ -443,6 +443,7 @@ Enchantment_Drop_Rates: LEGENDARY: 0.75 # # Settings for Excavation's Archaeology +# If you are in retro mode, Drop_Level is multiplied by 10. ### Excavation: CAKE: @@ -573,6 +574,7 @@ Excavation: Drops_From: [Dirt, Coarse_Dirt, Podzol, Grass_Block, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand] # # Settings for Hylian Luck +# If you are in retro mode, Drop_Level is multiplied by 10. ### Hylian_Luck: MELON_SEEDS: @@ -630,7 +632,8 @@ Hylian_Luck: Drop_Level: 0 Drops_From: [Pots] # -# Settings for Shake +# Settings for Shake +# If you are in retro mode, Drop_Level is multiplied by 10. ### Shake: BLAZE: From 0c1fa07079f0ad385b8b910e1664cd6c0dc6a311 Mon Sep 17 00:00:00 2001 From: Lane Date: Fri, 17 Jan 2020 18:23:28 +1100 Subject: [PATCH 3/3] Fixed typo in config for potato (#4096) --- src/main/resources/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 3343d0564..a73b3ddc7 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -442,7 +442,7 @@ Bonus_Drops: Melon_Slice: true Nether_Wart: true Potatoes: true - Potatoe: true + Potato: true Pumpkin: true Red_Mushroom: true Sugar_Cane: true