SkyVox

FuelReceiver

Apr 15th, 2020
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1.     public static Boolean canReceiveFuel(Player player, FuelReceiverType type, String world) {
  2.         if (isWorldBlackListed(world)) return false;
  3.         if (fuelReceiver.get(type) == null) return false;
  4.  
  5.         PlayerPoints playerPoints = PointsManager.getInstance().getPlayerPoints(player);
  6.         double increment = playerPoints.getPercentageIncrease(ShopType.MACHINE);
  7.  
  8.         double random = Math.random();
  9.         double chance = fuelReceiver.get(type).chance;
  10.  
  11.         if (increment > 0) {
  12.             chance+=increment;
  13.         }
  14.  
  15.         return (random <= chance);
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment