mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Command updates - Herbalism
This commit is contained in:
parent
6cc207a10c
commit
04f3e44c3a
@ -13,6 +13,7 @@ Version 1.3.07
|
|||||||
+ Added a permission node for Archery bonus damage
|
+ Added a permission node for Archery bonus damage
|
||||||
+ Added a permission node for Greater Impact ability
|
+ Added a permission node for Greater Impact ability
|
||||||
+ Added permission nodes for Treasure & Magic Hunter for Fishing
|
+ Added permission nodes for Treasure & Magic Hunter for Fishing
|
||||||
|
+ Added a permission node for Farmer's Diet
|
||||||
+ Added config options for enabling/disabling specific double drops
|
+ Added config options for enabling/disabling specific double drops
|
||||||
+ Added automatic zip backup of flatfile database & config files
|
+ Added automatic zip backup of flatfile database & config files
|
||||||
= Fixed bug where the permission node for Impact didn't work
|
= Fixed bug where the permission node for Impact didn't work
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -10,6 +12,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
|||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Page;
|
import com.gmail.nossr50.util.Page;
|
||||||
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class HerbalismCommand implements CommandExecutor {
|
public class HerbalismCommand implements CommandExecutor {
|
||||||
@ -20,6 +23,12 @@ public class HerbalismCommand implements CommandExecutor {
|
|||||||
private String farmersDietRank;
|
private String farmersDietRank;
|
||||||
private String doubleDropChance;
|
private String doubleDropChance;
|
||||||
|
|
||||||
|
private boolean canGreenTerra;
|
||||||
|
private boolean canGreenThumbWheat;
|
||||||
|
private boolean canGreenThumbBlocks;
|
||||||
|
private boolean canFarmersDiet;
|
||||||
|
private boolean canDoubleDrop;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (CommandHelper.noConsoleUsage(sender)) {
|
if (CommandHelper.noConsoleUsage(sender)) {
|
||||||
@ -35,24 +44,59 @@ public class HerbalismCommand implements CommandExecutor {
|
|||||||
|
|
||||||
skillValue = (float) PP.getSkillLevel(SkillType.HERBALISM);
|
skillValue = (float) PP.getSkillLevel(SkillType.HERBALISM);
|
||||||
dataCalculations(skillValue);
|
dataCalculations(skillValue);
|
||||||
|
permissionsCheck(player);
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Herbalism.SkillName") }));
|
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Herbalism.SkillName") }));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Herbalism") }));
|
player.sendMessage(LocaleLoader.getString("Commands.XPGain", new Object[] { LocaleLoader.getString("Commands.XPGain.Herbalism") }));
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
|
player.sendMessage(LocaleLoader.getString("Effects.Level", new Object[] { PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM) }));
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
|
if (canGreenTerra || canDoubleDrop || canFarmersDiet || canGreenThumbBlocks || canGreenThumbWheat) {
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1") }));
|
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Effects.Effects") }));
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.2"), LocaleLoader.getString("Herbalism.Effect.3") }));
|
}
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.4"), LocaleLoader.getString("Herbalism.Effect.5") }));
|
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.6"), LocaleLoader.getString("Herbalism.Effect.7") }));
|
|
||||||
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.8"), LocaleLoader.getString("Herbalism.Effect.9") }));
|
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
|
if (canGreenTerra) {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength }));
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.0"), LocaleLoader.getString("Herbalism.Effect.1") }));
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }));
|
}
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", new Object[] { greenThumbStage }));
|
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.FD", new Object[] { farmersDietRank } ));
|
if (canGreenThumbWheat) {
|
||||||
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }));
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.2"), LocaleLoader.getString("Herbalism.Effect.3") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canGreenThumbBlocks) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.4"), LocaleLoader.getString("Herbalism.Effect.5") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canFarmersDiet) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.6"), LocaleLoader.getString("Herbalism.Effect.7") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canDoubleDrop) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Herbalism.Effect.8"), LocaleLoader.getString("Herbalism.Effect.9") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canGreenTerra || canDoubleDrop || canFarmersDiet || canGreenThumbBlocks || canGreenThumbWheat) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Skills.Header", new Object[] { LocaleLoader.getString("Commands.Stats.Self") }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canGreenTerra) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTe.Length", new Object[] { greenTerraLength }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canGreenThumbBlocks || canGreenThumbWheat) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", new Object[] { greenThumbChance }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canGreenThumbWheat) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Stage", new Object[] { greenThumbStage }));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canFarmersDiet) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.FD", new Object[] { farmersDietRank } ));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canDoubleDrop) {
|
||||||
|
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.DoubleDropChance", new Object[] { doubleDropChance }));
|
||||||
|
}
|
||||||
|
|
||||||
Page.grabGuidePageForSkill(SkillType.HERBALISM, player, args);
|
Page.grabGuidePageForSkill(SkillType.HERBALISM, player, args);
|
||||||
|
|
||||||
@ -60,49 +104,61 @@ public class HerbalismCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void dataCalculations(float skillValue) {
|
private void dataCalculations(float skillValue) {
|
||||||
|
DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||||
|
|
||||||
greenTerraLength = String.valueOf(2 + ((int) skillValue / 50));
|
greenTerraLength = String.valueOf(2 + ((int) skillValue / 50));
|
||||||
|
|
||||||
if (skillValue >= 1500) {
|
if (skillValue >= 1500) {
|
||||||
greenThumbChance = "100";
|
greenThumbChance = "100.00%";
|
||||||
greenThumbStage = "4";
|
greenThumbStage = "4";
|
||||||
farmersDietRank = "5";
|
farmersDietRank = "5";
|
||||||
doubleDropChance = "100";
|
doubleDropChance = "100.00%";
|
||||||
}
|
}
|
||||||
else if (skillValue >= 1000) {
|
else if (skillValue >= 1000) {
|
||||||
greenThumbChance = String.valueOf(skillValue / 15);
|
greenThumbChance = percent.format(skillValue / 1500);
|
||||||
greenThumbStage = "4";
|
greenThumbStage = "4";
|
||||||
farmersDietRank = "5";
|
farmersDietRank = "5";
|
||||||
doubleDropChance = "100";
|
doubleDropChance = "100.00%";
|
||||||
}
|
}
|
||||||
else if (skillValue >= 800) {
|
else if (skillValue >= 800) {
|
||||||
greenThumbChance = String.valueOf(skillValue / 15);
|
greenThumbChance = percent.format(skillValue / 1500);
|
||||||
greenThumbStage = "4";
|
greenThumbStage = "4";
|
||||||
farmersDietRank = "4";
|
farmersDietRank = "4";
|
||||||
doubleDropChance = String.valueOf(skillValue / 10);
|
doubleDropChance = percent.format(skillValue / 1000);
|
||||||
}
|
}
|
||||||
else if (skillValue >= 600) {
|
else if (skillValue >= 600) {
|
||||||
greenThumbChance = String.valueOf(skillValue / 15);
|
greenThumbChance = percent.format(skillValue / 1500);
|
||||||
greenThumbStage = "4";
|
greenThumbStage = "4";
|
||||||
farmersDietRank = "3";
|
farmersDietRank = "3";
|
||||||
doubleDropChance = String.valueOf(skillValue / 10);
|
doubleDropChance = percent.format(skillValue / 1000);
|
||||||
}
|
}
|
||||||
else if (skillValue >= 400) {
|
else if (skillValue >= 400) {
|
||||||
greenThumbChance = String.valueOf(skillValue / 15);
|
greenThumbChance = percent.format(skillValue / 1500);
|
||||||
greenThumbStage = "3";
|
greenThumbStage = "3";
|
||||||
farmersDietRank = "2";
|
farmersDietRank = "2";
|
||||||
doubleDropChance = String.valueOf(skillValue / 10);
|
doubleDropChance = percent.format(skillValue / 1000);
|
||||||
}
|
}
|
||||||
else if (skillValue >= 200) {
|
else if (skillValue >= 200) {
|
||||||
greenThumbChance = String.valueOf(skillValue / 15);
|
greenThumbChance = percent.format(skillValue / 1500);
|
||||||
greenThumbStage = "2";
|
greenThumbStage = "2";
|
||||||
farmersDietRank = "1";
|
farmersDietRank = "1";
|
||||||
doubleDropChance = String.valueOf(skillValue / 10);
|
doubleDropChance = percent.format(skillValue / 1000);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
greenThumbChance = String.valueOf(skillValue / 15);
|
greenThumbChance = percent.format(skillValue / 1500);
|
||||||
greenThumbStage = "1";
|
greenThumbStage = "1";
|
||||||
farmersDietRank = "1";
|
farmersDietRank = "1";
|
||||||
doubleDropChance = String.valueOf(skillValue / 10);
|
doubleDropChance = percent.format(skillValue / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void permissionsCheck(Player player) {
|
||||||
|
Permissions permInstance = Permissions.getInstance();
|
||||||
|
|
||||||
|
canGreenTerra = permInstance.greenTerra(player);
|
||||||
|
canGreenThumbWheat = permInstance.greenThumbWheat(player);
|
||||||
|
canGreenThumbBlocks = permInstance.greenThumbBlocks(player);
|
||||||
|
canFarmersDiet = permInstance.farmersDiet(player);
|
||||||
|
canDoubleDrop = permInstance.herbalismDoubleDrops(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,6 +222,10 @@ public class EntityListener implements Listener {
|
|||||||
int currentFoodLevel = player.getFoodLevel();
|
int currentFoodLevel = player.getFoodLevel();
|
||||||
int newFoodLevel = event.getFoodLevel();
|
int newFoodLevel = event.getFoodLevel();
|
||||||
|
|
||||||
|
if (!Permissions.getInstance().farmersDiet(player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some foods have 3 ranks
|
* Some foods have 3 ranks
|
||||||
* Some foods have 5 ranks
|
* Some foods have 5 ranks
|
||||||
|
@ -35,6 +35,7 @@ public class Permissions {
|
|||||||
public boolean hardcoremodeBypass(Player player) {
|
public boolean hardcoremodeBypass(Player player) {
|
||||||
return player.hasPermission("mcmmo.bypass.hardcoremode");
|
return player.hasPermission("mcmmo.bypass.hardcoremode");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean arcaneBypass(Player player) {
|
public boolean arcaneBypass(Player player) {
|
||||||
return player.hasPermission("mcmmo.bypass.arcanebypass");
|
return player.hasPermission("mcmmo.bypass.arcanebypass");
|
||||||
}
|
}
|
||||||
@ -251,6 +252,10 @@ public class Permissions {
|
|||||||
return player.hasPermission("mcmmo.ability.herbalism.greenthumbwheat");
|
return player.hasPermission("mcmmo.ability.herbalism.greenthumbwheat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean farmersDiet(Player player) {
|
||||||
|
return player.hasPermission("mcmmo.ability.herbalism.farmersdiet");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MCMMO.ABILITY.EXCAVATION.*
|
* MCMMO.ABILITY.EXCAVATION.*
|
||||||
*/
|
*/
|
||||||
|
@ -117,10 +117,10 @@ Fishing.SkillName=FISHING
|
|||||||
Fishing.Skillup=[[YELLOW]]Fishing skill increased by {0}. Total ({1})
|
Fishing.Skillup=[[YELLOW]]Fishing skill increased by {0}. Total ({1})
|
||||||
|
|
||||||
#HERBALISM
|
#HERBALISM
|
||||||
Herbalism.Ability.DoubleDropChance=[[RED]]Double Drop Chance: [[YELLOW]]{0}%
|
Herbalism.Ability.DoubleDropChance=[[RED]]Double Drop Chance: [[YELLOW]]{0}
|
||||||
Herbalism.Ability.FD=[[RED]]Farmers Diet: [[YELLOW]]Rank {0}
|
Herbalism.Ability.FD=[[RED]]Farmers Diet: [[YELLOW]]Rank {0}
|
||||||
Herbalism.Ability.GTe.Length=[[RED]]Green Terra Length: [[YELLOW]]{0}s
|
Herbalism.Ability.GTe.Length=[[RED]]Green Terra Length: [[YELLOW]]{0}s
|
||||||
Herbalism.Ability.GTh.Chance=[[RED]]Green Thumb Chance: [[YELLOW]]{0}%
|
Herbalism.Ability.GTh.Chance=[[RED]]Green Thumb Chance: [[YELLOW]]{0}
|
||||||
Herbalism.Ability.GTh.Fail=[[RED]]**GREEN THUMB FAIL**
|
Herbalism.Ability.GTh.Fail=[[RED]]**GREEN THUMB FAIL**
|
||||||
Herbalism.Ability.GTh.Stage=[[RED]]Green Thumb Stage: [[YELLOW]] Wheat grows in stage {0}
|
Herbalism.Ability.GTh.Stage=[[RED]]Green Thumb Stage: [[YELLOW]] Wheat grows in stage {0}
|
||||||
Herbalism.Ability.GTh=[[GREEN]]**GREEN THUMB**
|
Herbalism.Ability.GTh=[[GREEN]]**GREEN THUMB**
|
||||||
@ -130,8 +130,8 @@ Herbalism.Effect.0=Green Terra (ABILITY)
|
|||||||
Herbalism.Effect.1=Spread the Terra, 3x Drops
|
Herbalism.Effect.1=Spread the Terra, 3x Drops
|
||||||
Herbalism.Effect.2=Green Thumb (Wheat)
|
Herbalism.Effect.2=Green Thumb (Wheat)
|
||||||
Herbalism.Effect.3=Auto-Plants wheat when harvesting
|
Herbalism.Effect.3=Auto-Plants wheat when harvesting
|
||||||
Herbalism.Effect.4=Green Thumb (Cobble/Stone Brick)
|
Herbalism.Effect.4=Green Thumb (Cobble/Stone Brick/Dirt)
|
||||||
Herbalism.Effect.5=Cobblestone/Stone Brick -> Mossy w/ Seeds
|
Herbalism.Effect.5=Make bricks mossy, or make grass grow
|
||||||
Herbalism.Effect.6=Farmer's Diet
|
Herbalism.Effect.6=Farmer's Diet
|
||||||
Herbalism.Effect.7=Improves hunger restored from farmed foods
|
Herbalism.Effect.7=Improves hunger restored from farmed foods
|
||||||
Herbalism.Effect.8=Double Drops (All Herbs)
|
Herbalism.Effect.8=Double Drops (All Herbs)
|
||||||
|
@ -318,6 +318,7 @@ permissions:
|
|||||||
mcmmo.ability.herbalism.greenterra: true
|
mcmmo.ability.herbalism.greenterra: true
|
||||||
mcmmo.ability.herbalism.greenthumbblocks: true
|
mcmmo.ability.herbalism.greenthumbblocks: true
|
||||||
mcmmo.ability.herbalism.greenthumbwheat: true
|
mcmmo.ability.herbalism.greenthumbwheat: true
|
||||||
|
mcmmo.ability.herbalism.foodbonus: true
|
||||||
mcmmo.ability.herbalism.doubledrops:
|
mcmmo.ability.herbalism.doubledrops:
|
||||||
description: Allows double drop chance from Herbalism
|
description: Allows double drop chance from Herbalism
|
||||||
mcmmo.ability.herbalism.greenterra:
|
mcmmo.ability.herbalism.greenterra:
|
||||||
@ -326,6 +327,8 @@ permissions:
|
|||||||
description: Allows access to the Green Thumb ability for blocks
|
description: Allows access to the Green Thumb ability for blocks
|
||||||
mcmmo.ability.herbalism.greenthumbwheat:
|
mcmmo.ability.herbalism.greenthumbwheat:
|
||||||
description: Allows access to the Green Thumb ability for wheat
|
description: Allows access to the Green Thumb ability for wheat
|
||||||
|
mcmmo.ability.herbalism.farmersdiet:
|
||||||
|
description: Allows access to the Farmer's Diet ability
|
||||||
mcmmo.ability.excavation.*:
|
mcmmo.ability.excavation.*:
|
||||||
description: Allows access to all Excavation abilities
|
description: Allows access to all Excavation abilities
|
||||||
children:
|
children:
|
||||||
|
Loading…
Reference in New Issue
Block a user