mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-14 03:24:43 +02:00
Random update. :D
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.CropState;
|
||||
import org.bukkit.Location;
|
||||
@ -22,6 +24,8 @@ import com.gmail.nossr50.runnables.GreenThumbTimer;
|
||||
|
||||
public class Herbalism {
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
/**
|
||||
* Activate the Green Terra ability.
|
||||
*
|
||||
@ -137,7 +141,7 @@ public class Herbalism {
|
||||
if (b.getType().equals(Material.CACTUS)) {
|
||||
mat = Material.CACTUS;
|
||||
if (!b.hasMetadata("mcmmoPlacedBlock")) {
|
||||
if(herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= herbLevel)) {
|
||||
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) {
|
||||
catciDrops++;
|
||||
}
|
||||
xp += LoadProperties.mcactus;
|
||||
@ -193,7 +197,7 @@ public class Herbalism {
|
||||
if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) {
|
||||
mat = Material.SUGAR_CANE;
|
||||
if (!b.hasMetadata("mcmmoPlacedBlock")) {
|
||||
if(herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= herbLevel)) {
|
||||
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) {
|
||||
caneDrops++;
|
||||
}
|
||||
xp += LoadProperties.msugar;
|
||||
@ -226,7 +230,7 @@ public class Herbalism {
|
||||
else {
|
||||
ItemStack is = new ItemStack(mat);
|
||||
|
||||
if (herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= herbLevel)) {
|
||||
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) {
|
||||
if (type.equals(Material.CACTUS)) {
|
||||
m.mcDropItems(loc, is, catciDrops);
|
||||
}
|
||||
@ -268,7 +272,7 @@ public class Herbalism {
|
||||
boolean hasSeeds = inventory.contains(Material.SEEDS);
|
||||
Location loc = block.getLocation();
|
||||
|
||||
if (hasSeeds && PP.getGreenTerraMode() || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1500 <= herbLevel))) {
|
||||
if (hasSeeds && PP.getGreenTerraMode() || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1500) <= herbLevel)) {
|
||||
event.setCancelled(true);
|
||||
|
||||
m.mcDropItem(loc, new ItemStack(Material.WHEAT));
|
||||
@ -297,7 +301,7 @@ public class Herbalism {
|
||||
|
||||
player.setItemInHand(new ItemStack(Material.SEEDS, seeds - 1));
|
||||
|
||||
if (skillLevel > MAX_BONUS_LEVEL || Math.random() * 1500 <= skillLevel) {
|
||||
if (skillLevel > MAX_BONUS_LEVEL || random.nextInt(1500) <= skillLevel) {
|
||||
greenTerra(player, block);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user