Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.chumanista.youtube;
- import java.util.Random;
- import org.apache.commons.lang.Validate;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- public class Utils {
- private static final Random rand = new Random();
- public static int getRandInt (int min, int max) throws IllegalArgumentException {
- Validate.isTrue(max > min, "Max can't be smaller than min");
- return rand.nextInt(max - min + 1) + min;
- }
- public static double getRandDouble (double min, double max) throws IllegalArgumentException {
- Validate.isTrue(max > min, "Max can't be smaller than min");
- return rand.nextDouble() * (max - min) + min;
- }
- public static boolean getChance (double chance) {
- return (chance >= 100) || (chance >= getRandDouble(0, 100));
- }
- public static void error (String msg) {
- Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "[PremiumCase] [ERROR] " + msg);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement