Inner Peace added to /fishing

This commit is contained in:
nossr50 2019-04-10 05:54:19 -07:00
parent 9c1f38ce6d
commit 21e1d54ad5
3 changed files with 25 additions and 23 deletions

View File

@ -27,8 +27,8 @@ public class FishingCommand extends SkillCommand {
private String shakeChanceLucky;
private int fishermansDietRank;
private String biteChance;
private String innerPeaceMult;
private String trapTreasure;
private String commonTreasure;
private String uncommonTreasure;
private String rareTreasure;
@ -44,6 +44,7 @@ public class FishingCommand extends SkillCommand {
private boolean canFishermansDiet;
private boolean canMasterAngler;
private boolean canIceFish;
private boolean canInnerPeace;
public FishingCommand() {
super(PrimarySkillType.FISHING);
@ -114,6 +115,11 @@ public class FishingCommand extends SkillCommand {
biteChance = percent.format((rawBiteChance * 100.0D) * luckyModifier);
}
if(canInnerPeace)
{
innerPeaceMult = String.valueOf(fishingManager.getInnerPeaceMultiplier());
}
}
@Override
@ -124,6 +130,7 @@ public class FishingCommand extends SkillCommand {
canFishermansDiet = canUseSubskill(player, SubSkillType.FISHING_FISHERMANS_DIET);
canMasterAngler = canUseSubskill(player, SubSkillType.FISHING_MASTER_ANGLER);
canIceFish = canUseSubskill(player, SubSkillType.FISHING_ICE_FISHING);
canInnerPeace = canUseSubskill(player, SubSkillType.FISHING_INNER_PEACE);
}
@Override
@ -165,7 +172,7 @@ public class FishingCommand extends SkillCommand {
if(canInnerPeace)
{
m
messages.add(getStatMessage(SubSkillType.FISHING_INNER_PEACE, innerPeaceMult));
}
return messages;

View File

@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.ShareHandler;
@ -259,18 +260,21 @@ public class PlayerListener implements Listener {
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
Item fishingCatch = (Item) event.getCaught();
if (MainConfig.getInstance().getFishingOverrideTreasures() &&
fishingCatch.getItemStack().getType() != Material.SALMON &&
fishingCatch.getItemStack().getType() != Material.COD &&
fishingCatch.getItemStack().getType() != Material.TROPICAL_FISH &&
fishingCatch.getItemStack().getType() != Material.PUFFERFISH) {
fishingCatch.setItemStack(new ItemStack(Material.SALMON, 1));
if (mcMMO.getConfigManager().getConfigFishing().isOverrideVanillaTreasures())
{
if(fishingCatch.getItemStack().getType() != Material.SALMON &&
fishingCatch.getItemStack().getType() != Material.COD &&
fishingCatch.getItemStack().getType() != Material.TROPICAL_FISH &&
fishingCatch.getItemStack().getType() != Material.PUFFERFISH)
{
fishingCatch.setItemStack(new ItemStack(Material.SALMON, 1));
}
}
if (Permissions.vanillaXpBoost(player, PrimarySkillType.FISHING)) {
if (Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_INNER_PEACE)) {
//Don't modify XP below vanilla values
if(fishingManager.handleVanillaXpBoost(event.getExpToDrop()) > 1)
event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
if(fishingManager.addInnerPeaceVanillaXPBoost(event.getExpToDrop()) > 1)
event.setExpToDrop(fishingManager.addInnerPeaceVanillaXPBoost(event.getExpToDrop()));
}
return;

View File

@ -210,7 +210,7 @@ public class FishingManager extends SkillManager {
return AdvancedConfig.getInstance().getShakeChance(getLootTier());
}
protected int getVanillaXPBoostModifier() {
public int getInnerPeaceMultiplier() {
return mcMMO.getConfigManager().getConfigFishing().getVanillaXPMultInnerPeace(RankUtils.getRank(getPlayer(), SubSkillType.FISHING_INNER_PEACE));
}
@ -345,8 +345,8 @@ public class FishingManager extends SkillManager {
*
* @return the modified event damage
*/
public int handleVanillaXpBoost(int experience) {
return experience * getVanillaXpMultiplier();
public int addInnerPeaceVanillaXPBoost(int experience) {
return experience * getInnerPeaceMultiplier();
}
public Location getHookLocation() {
@ -594,13 +594,4 @@ public class FishingManager extends SkillManager {
Fishing.getInstance().getEnchantableCache().put(dropType, possibleEnchantments);
return possibleEnchantments;
}
/**
* Gets the vanilla XP multiplier
*
* @return the vanilla XP multiplier
*/
private int getVanillaXpMultiplier() {
return getVanillaXPBoostModifier();
}
}