mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-30 04:34:43 +02:00
MASSIVE Permissions overhaul. Added a handful of new permissions,
renamed a few more. Changed Green Terra to handle blocks based on perms rather than the config file. For more details, read the diff.
This commit is contained in:
@ -50,11 +50,6 @@ public class Herbalism {
|
||||
public static double hylianLuckMaxChance = AdvancedConfig.getInstance().getHylianLuckChanceMax();
|
||||
public static int hylianLuckMaxLevel = AdvancedConfig.getInstance().getHylianLucksMaxLevel();
|
||||
|
||||
public static boolean greenTerraWalls = Config.getInstance().getHerbalismGreenThumbCobbleWallToMossyWall();
|
||||
public static boolean greenTerraSmoothBrick = Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy();
|
||||
public static boolean greenTerraDirt = Config.getInstance().getHerbalismGreenThumbDirtToGrass();
|
||||
public static boolean greenTerraCobble = Config.getInstance().getHerbalismGreenThumbCobbleToMossy();
|
||||
|
||||
/**
|
||||
* Handle the farmers diet skill.
|
||||
*
|
||||
@ -94,27 +89,27 @@ public class Herbalism {
|
||||
if (SkillTools.blockBreakSimulate(block, player, false)) {
|
||||
Material type = block.getType();
|
||||
|
||||
if (!Permissions.greenThumbBlock(player, type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case SMOOTH_BRICK:
|
||||
if (greenTerraSmoothBrick && block.getData() == 0x0) {
|
||||
if (block.getData() == 0x0) {
|
||||
block.setData((byte) 0x1);
|
||||
}
|
||||
return;
|
||||
|
||||
case DIRT:
|
||||
if (greenTerraDirt) {
|
||||
block.setType(Material.GRASS);
|
||||
}
|
||||
block.setType(Material.GRASS);
|
||||
return;
|
||||
|
||||
case COBBLESTONE:
|
||||
if (greenTerraCobble) {
|
||||
block.setType(Material.MOSSY_COBBLESTONE);
|
||||
}
|
||||
block.setType(Material.MOSSY_COBBLESTONE);
|
||||
return;
|
||||
|
||||
case COBBLE_WALL:
|
||||
if (greenTerraWalls && block.getData() == 0x0) {
|
||||
if (block.getData() == 0x0) {
|
||||
block.setData((byte) 0x1);
|
||||
}
|
||||
return;
|
||||
@ -190,8 +185,8 @@ public class Herbalism {
|
||||
xp = customBlock.getXpGain();
|
||||
}
|
||||
|
||||
if (Permissions.herbalismDoubleDrops(player)) {
|
||||
int activationChance = PerksUtils.handleLuckyPerks(Permissions.luckyHerbalism(player));
|
||||
if (Permissions.doubleDrops(player, SkillType.HERBALISM)) {
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.HERBALISM);
|
||||
double chance = (doubleDropsMaxChance / doubleDropsMaxLevel) * SkillTools.skillCheck(herbLevel, doubleDropsMaxLevel);
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
||||
@ -255,7 +250,7 @@ public class Herbalism {
|
||||
return;
|
||||
}
|
||||
|
||||
int activationChance = PerksUtils.handleLuckyPerks(Permissions.luckyHerbalism(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.HERBALISM);
|
||||
float chance = (float) (greenThumbMaxChance / greenThumbMaxLevel * herbLevel);
|
||||
|
||||
if (chance > greenThumbMaxChance) {
|
||||
@ -302,7 +297,7 @@ public class Herbalism {
|
||||
|
||||
player.setItemInHand(new ItemStack(Material.SEEDS, seeds - 1));
|
||||
|
||||
int activationChance = PerksUtils.handleLuckyPerks(Permissions.luckyHerbalism(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.HERBALISM);
|
||||
|
||||
float chance = (float) ((greenThumbMaxChance / greenThumbMaxLevel) * skillLevel);
|
||||
if (chance > greenThumbMaxChance) chance = (float) greenThumbMaxChance;
|
||||
@ -319,7 +314,7 @@ public class Herbalism {
|
||||
int skillLevel = Users.getPlayer(player).getProfile().getSkillLevel(SkillType.HERBALISM);
|
||||
|
||||
double chance = (hylianLuckMaxChance / hylianLuckMaxLevel) * SkillTools.skillCheck(skillLevel, hylianLuckMaxLevel);
|
||||
int activationChance = PerksUtils.handleLuckyPerks(Permissions.luckyHerbalism(player));
|
||||
int activationChance = PerksUtils.handleLuckyPerks(player, SkillType.HERBALISM);
|
||||
|
||||
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
||||
List<HylianTreasure> treasures = new ArrayList<HylianTreasure>();
|
||||
|
@ -69,20 +69,7 @@ public enum HerbalismBlock {
|
||||
}
|
||||
|
||||
public boolean hasGreenThumbPermission(Player player) {
|
||||
switch (this) {
|
||||
case CARROT:
|
||||
return Permissions.greenThumbCarrots(player);
|
||||
case COCOA:
|
||||
return Permissions.greenThumbCocoa(player);
|
||||
case CROPS:
|
||||
return Permissions.greenThumbWheat(player);
|
||||
case POTATO:
|
||||
return Permissions.greenThumbPotatoes(player);
|
||||
case NETHER_WARTS:
|
||||
return Permissions.greenThumbNetherwart(player);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return Permissions.greenThumbPlant(player, blockType);
|
||||
}
|
||||
|
||||
public static HerbalismBlock getHerbalismBlock(Material blockType) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.skills.herbalism;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillCommand;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
@ -61,10 +63,10 @@ public class HerbalismCommand extends SkillCommand {
|
||||
protected void permissionsCheck() {
|
||||
hasHylianLuck = Permissions.hylianLuck(player);
|
||||
canGreenTerra = Permissions.greenTerra(player);
|
||||
canGreenThumbWheat = Permissions.greenThumbWheat(player);
|
||||
canGreenThumbBlocks = Permissions.greenThumbBlocks(player);
|
||||
canGreenThumbWheat = Permissions.greenThumbPlant(player, Material.CROPS); //TODO: This isn't really accurate - they could have perms for other crops but not wheat.
|
||||
canGreenThumbBlocks = (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK));
|
||||
canFarmersDiet = Permissions.farmersDiet(player);
|
||||
canDoubleDrop = Permissions.herbalismDoubleDrops(player);
|
||||
canDoubleDrop = Permissions.doubleDrops(player, skill);
|
||||
doubleDropsDisabled = Herbalism.doubleDropsDisabled;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user