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 String shakeChanceLucky;
private int fishermansDietRank; private int fishermansDietRank;
private String biteChance; private String biteChance;
private String innerPeaceMult;
private String trapTreasure;
private String commonTreasure; private String commonTreasure;
private String uncommonTreasure; private String uncommonTreasure;
private String rareTreasure; private String rareTreasure;
@ -44,6 +44,7 @@ public class FishingCommand extends SkillCommand {
private boolean canFishermansDiet; private boolean canFishermansDiet;
private boolean canMasterAngler; private boolean canMasterAngler;
private boolean canIceFish; private boolean canIceFish;
private boolean canInnerPeace;
public FishingCommand() { public FishingCommand() {
super(PrimarySkillType.FISHING); super(PrimarySkillType.FISHING);
@ -114,6 +115,11 @@ public class FishingCommand extends SkillCommand {
biteChance = percent.format((rawBiteChance * 100.0D) * luckyModifier); biteChance = percent.format((rawBiteChance * 100.0D) * luckyModifier);
} }
if(canInnerPeace)
{
innerPeaceMult = String.valueOf(fishingManager.getInnerPeaceMultiplier());
}
} }
@Override @Override
@ -124,6 +130,7 @@ public class FishingCommand extends SkillCommand {
canFishermansDiet = canUseSubskill(player, SubSkillType.FISHING_FISHERMANS_DIET); canFishermansDiet = canUseSubskill(player, SubSkillType.FISHING_FISHERMANS_DIET);
canMasterAngler = canUseSubskill(player, SubSkillType.FISHING_MASTER_ANGLER); canMasterAngler = canUseSubskill(player, SubSkillType.FISHING_MASTER_ANGLER);
canIceFish = canUseSubskill(player, SubSkillType.FISHING_ICE_FISHING); canIceFish = canUseSubskill(player, SubSkillType.FISHING_ICE_FISHING);
canInnerPeace = canUseSubskill(player, SubSkillType.FISHING_INNER_PEACE);
} }
@Override @Override
@ -165,7 +172,7 @@ public class FishingCommand extends SkillCommand {
if(canInnerPeace) if(canInnerPeace)
{ {
m messages.add(getStatMessage(SubSkillType.FISHING_INNER_PEACE, innerPeaceMult));
} }
return messages; 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.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.ShareHandler; 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: //TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
Item fishingCatch = (Item) event.getCaught(); Item fishingCatch = (Item) event.getCaught();
if (MainConfig.getInstance().getFishingOverrideTreasures() && if (mcMMO.getConfigManager().getConfigFishing().isOverrideVanillaTreasures())
fishingCatch.getItemStack().getType() != Material.SALMON && {
if(fishingCatch.getItemStack().getType() != Material.SALMON &&
fishingCatch.getItemStack().getType() != Material.COD && fishingCatch.getItemStack().getType() != Material.COD &&
fishingCatch.getItemStack().getType() != Material.TROPICAL_FISH && fishingCatch.getItemStack().getType() != Material.TROPICAL_FISH &&
fishingCatch.getItemStack().getType() != Material.PUFFERFISH) { fishingCatch.getItemStack().getType() != Material.PUFFERFISH)
{
fishingCatch.setItemStack(new ItemStack(Material.SALMON, 1)); 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 //Don't modify XP below vanilla values
if(fishingManager.handleVanillaXpBoost(event.getExpToDrop()) > 1) if(fishingManager.addInnerPeaceVanillaXPBoost(event.getExpToDrop()) > 1)
event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop())); event.setExpToDrop(fishingManager.addInnerPeaceVanillaXPBoost(event.getExpToDrop()));
} }
return; return;

View File

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