mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Cleanup formatting.
This commit is contained in:
@ -18,7 +18,7 @@ public class Archery {
|
||||
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
|
||||
|
||||
public static final int ARROW_TRACKING_MAX_BONUS_LEVEL = advancedConfig.getRetrieveMaxBonusLevel();
|
||||
|
||||
|
||||
public static final int BONUS_DAMAGE_INCREASE_LEVEL = advancedConfig.getSkillShotIncreaseLevel();
|
||||
public static final double BONUS_DAMAGE_INCREASE_PERCENT = advancedConfig.getSkillShotIncreasePercentage();
|
||||
public static final double BONUS_DAMAGE_MAX_BONUS_PERCENTAGE = advancedConfig.getSkillShotBonusMax();
|
||||
|
@ -12,7 +12,7 @@ import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class ArcheryManager {
|
||||
AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
|
||||
|
||||
private Player player;
|
||||
private PlayerProfile profile;
|
||||
private int skillLevel;
|
||||
@ -22,15 +22,15 @@ public class ArcheryManager {
|
||||
private float dazeMaxBonusLevel = advancedConfig.getDazeMaxBonusLevel();
|
||||
private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax();
|
||||
private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel();
|
||||
|
||||
|
||||
public ArcheryManager (Player player) {
|
||||
this.player = player;
|
||||
this.profile = Users.getProfile(player);
|
||||
|
||||
|
||||
//Compatibility with Citizens, Citizens NPCs won't create a profile so we'll check for it here
|
||||
if(this.profile == null)
|
||||
return;
|
||||
|
||||
|
||||
this.skillLevel = profile.getSkillLevel(SkillType.ARCHERY);
|
||||
this.permissionsInstance = Permissions.getInstance();
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class ArcheryManager {
|
||||
if (player.hasPermission("mcmmo.perks.lucky.archery")) {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
final float chance = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * (double) skillLevel);
|
||||
final float chance = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillLevel);
|
||||
if (chance > Archery.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.addToTracker();
|
||||
}
|
||||
@ -81,14 +81,14 @@ public class ArcheryManager {
|
||||
}
|
||||
|
||||
DazeEventHandler eventHandler = new DazeEventHandler(this, event, defender);
|
||||
|
||||
|
||||
int randomChance = 100;
|
||||
|
||||
|
||||
if (player.hasPermission("mcmmo.perks.lucky.archery")) {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
final float chance = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * (double) skillLevel);
|
||||
|
||||
final float chance = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillLevel);
|
||||
if (chance > Archery.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.handleDazeEffect();
|
||||
eventHandler.sendAbilityMessages();
|
||||
|
@ -87,14 +87,14 @@ public class Axes {
|
||||
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
int randomChance = 100;
|
||||
double chance = ((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillCheck;
|
||||
double chance = (MAX_CHANCE / MAX_BONUS_LEVEL) * skillCheck;
|
||||
|
||||
if (attacker.hasPermission("mcmmo.perks.lucky.axes")) {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
if (chance > random.nextInt(randomChance) && !entity.isDead()){
|
||||
// if (random.nextInt(randomChance) <= skillCheck && !entity.isDead()){
|
||||
// if (random.nextInt(randomChance) <= skillCheck && !entity.isDead()){
|
||||
int damage = event.getDamage();
|
||||
|
||||
if (entity instanceof Player){
|
||||
@ -158,7 +158,7 @@ public class Axes {
|
||||
private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||
if(attacker == null)
|
||||
return;
|
||||
|
||||
|
||||
final int GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance();
|
||||
final double GREATER_IMPACT_MULTIPLIER = advancedConfig.getGreaterImpactModifier();
|
||||
final int GREATER_IMPACT_DAMAGE = advancedConfig.getGreaterImpactBonusDamage();
|
||||
|
@ -31,7 +31,7 @@ public class BlastMining {
|
||||
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
|
||||
private static int blastMiningRank1 = advancedConfig.getBlastMiningRank1();
|
||||
private static int blastMiningRank2 = advancedConfig.getBlastMiningRank2();
|
||||
private static int blastMiningRank3 = advancedConfig.getBlastMiningRank3();
|
||||
@ -317,7 +317,7 @@ public class BlastMining {
|
||||
player.sendMessage(LocaleLoader.getString("Mining.Blast.Boom"));
|
||||
|
||||
/* Create the TNT entity */
|
||||
// TNTPrimed tnt = (TNTPrimed) player.getWorld().spawnEntity(block.getLocation(), EntityType.PRIMED_TNT);
|
||||
// TNTPrimed tnt = (TNTPrimed) player.getWorld().spawnEntity(block.getLocation(), EntityType.PRIMED_TNT);
|
||||
TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class);
|
||||
plugin.addToTNTTracker(tnt.getEntityId(), player.getName());
|
||||
tnt.setFuseTicks(0);
|
||||
|
@ -40,8 +40,9 @@ public class Fishing {
|
||||
|
||||
/**
|
||||
* Get the player's current fishing loot tier.
|
||||
*
|
||||
* @param profile The profile of the player
|
||||
*
|
||||
* @param profile
|
||||
* The profile of the player
|
||||
* @return the player's current fishing rank
|
||||
*/
|
||||
public static int getFishingLootTier(PlayerProfile profile) {
|
||||
@ -50,18 +51,14 @@ public class Fishing {
|
||||
|
||||
if (level >= Config.getInstance().getFishingTierLevelsTier5()) {
|
||||
fishingTier = 5;
|
||||
}
|
||||
else if (level >= Config.getInstance().getFishingTierLevelsTier4()) {
|
||||
} else if (level >= Config.getInstance().getFishingTierLevelsTier4()) {
|
||||
fishingTier = 4;
|
||||
}
|
||||
else if (level >= Config.getInstance().getFishingTierLevelsTier3()) {
|
||||
fishingTier = 3;
|
||||
}
|
||||
else if (level >= Config.getInstance().getFishingTierLevelsTier2()) {
|
||||
fishingTier = 2;
|
||||
}
|
||||
else {
|
||||
fishingTier = 1;
|
||||
} else if (level >= Config.getInstance().getFishingTierLevelsTier3()) {
|
||||
fishingTier = 3;
|
||||
} else if (level >= Config.getInstance().getFishingTierLevelsTier2()) {
|
||||
fishingTier = 2;
|
||||
} else {
|
||||
fishingTier = 1;
|
||||
}
|
||||
|
||||
return fishingTier;
|
||||
@ -69,12 +66,14 @@ public class Fishing {
|
||||
|
||||
/**
|
||||
* Get item results from Fishing.
|
||||
*
|
||||
* @param player The player that was fishing
|
||||
* @param event The event to modify
|
||||
*
|
||||
* @param player
|
||||
* The player that was fishing
|
||||
* @param event
|
||||
* The event to modify
|
||||
*/
|
||||
private static void getFishingResults(Player player, PlayerFishEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
@ -106,8 +105,10 @@ public class Fishing {
|
||||
break;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getFishingDropsEnabled() && rewards.size() > 0 && Permissions.getInstance().fishingTreasures(player)) {
|
||||
FishingTreasure treasure = rewards.get(random.nextInt(rewards.size()));
|
||||
if (Config.getInstance().getFishingDropsEnabled() && rewards.size() > 0
|
||||
&& Permissions.getInstance().fishingTreasures(player)) {
|
||||
FishingTreasure treasure = rewards.get(random.nextInt(rewards
|
||||
.size()));
|
||||
|
||||
int randomChance = 100;
|
||||
|
||||
@ -116,31 +117,37 @@ public class Fishing {
|
||||
}
|
||||
|
||||
if (random.nextDouble() * randomChance <= treasure.getDropChance()) {
|
||||
Users.getPlayer(player).addXP(SkillType.FISHING, treasure.getXp());
|
||||
Users.getPlayer(player).addXP(SkillType.FISHING,
|
||||
treasure.getXp());
|
||||
theCatch.setItemStack(treasure.getDrop());
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
||||
}
|
||||
|
||||
short maxDurability = theCatch.getItemStack().getType().getMaxDurability();
|
||||
short maxDurability = theCatch.getItemStack().getType()
|
||||
.getMaxDurability();
|
||||
|
||||
if (maxDurability > 0) {
|
||||
theCatch.getItemStack().setDurability((short) (random.nextInt(maxDurability))); //Change durability to random value
|
||||
theCatch.getItemStack().setDurability(
|
||||
(short) (random.nextInt(maxDurability))); // Change
|
||||
// durability to
|
||||
// random value
|
||||
}
|
||||
|
||||
Skills.xpProcessing(player, profile, SkillType.FISHING, Config.getInstance().getFishingBaseXP());
|
||||
Skills.xpProcessing(player, profile, SkillType.FISHING, Config
|
||||
.getInstance().getFishingBaseXP());
|
||||
}
|
||||
|
||||
/**
|
||||
* Process results from Fishing.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*
|
||||
* @param event
|
||||
* The event to modify
|
||||
*/
|
||||
public static void processResults(PlayerFishEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
@ -149,7 +156,8 @@ public class Fishing {
|
||||
Item theCatch = (Item) event.getCaught();
|
||||
|
||||
if (theCatch.getItemStack().getType() != Material.RAW_FISH) {
|
||||
final int ENCHANTMENT_CHANCE = advancedConfig.getFishingEnchantmentChance();
|
||||
final int ENCHANTMENT_CHANCE = advancedConfig
|
||||
.getFishingEnchantmentChance();
|
||||
boolean enchanted = false;
|
||||
ItemStack fishingResults = theCatch.getItemStack();
|
||||
|
||||
@ -162,29 +170,40 @@ public class Fishing {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
if (random.nextInt(randomChance) <= ENCHANTMENT_CHANCE && Permissions.getInstance().fishingMagic(player)) {
|
||||
if (random.nextInt(randomChance) <= ENCHANTMENT_CHANCE
|
||||
&& Permissions.getInstance().fishingMagic(player)) {
|
||||
for (Enchantment newEnchant : Enchantment.values()) {
|
||||
if (newEnchant.canEnchantItem(fishingResults)) {
|
||||
Map<Enchantment, Integer> resultEnchantments = fishingResults.getEnchantments();
|
||||
Map<Enchantment, Integer> resultEnchantments = fishingResults
|
||||
.getEnchantments();
|
||||
|
||||
for (Enchantment oldEnchant : resultEnchantments.keySet()) {
|
||||
for (Enchantment oldEnchant : resultEnchantments
|
||||
.keySet()) {
|
||||
if (oldEnchant.conflictsWith(newEnchant))
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Actual chance to have an enchantment is related to your fishing skill */
|
||||
if (random.nextInt(15) < Fishing.getFishingLootTier(profile)) {
|
||||
/*
|
||||
* Actual chance to have an enchantment is related
|
||||
* to your fishing skill
|
||||
*/
|
||||
if (random.nextInt(15) < Fishing
|
||||
.getFishingLootTier(profile)) {
|
||||
enchanted = true;
|
||||
int randomEnchantLevel = random.nextInt(newEnchant.getMaxLevel()) + 1;
|
||||
int randomEnchantLevel = random
|
||||
.nextInt(newEnchant.getMaxLevel()) + 1;
|
||||
|
||||
if (randomEnchantLevel < newEnchant.getStartLevel()) {
|
||||
randomEnchantLevel = newEnchant.getStartLevel();
|
||||
if (randomEnchantLevel < newEnchant
|
||||
.getStartLevel()) {
|
||||
randomEnchantLevel = newEnchant
|
||||
.getStartLevel();
|
||||
}
|
||||
|
||||
if(randomEnchantLevel >= 1000)
|
||||
if (randomEnchantLevel >= 1000)
|
||||
continue;
|
||||
|
||||
fishingResults.addEnchantment(newEnchant, randomEnchantLevel);
|
||||
fishingResults.addEnchantment(newEnchant,
|
||||
randomEnchantLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -199,8 +218,9 @@ public class Fishing {
|
||||
|
||||
/**
|
||||
* Shake a mob, have them drop an item.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*
|
||||
* @param event
|
||||
* The event to modify
|
||||
*/
|
||||
public static void shakeMob(PlayerFishEvent event) {
|
||||
int randomChance = 100;
|
||||
@ -214,9 +234,10 @@ public class Fishing {
|
||||
int lootTier = getFishingLootTier(profile);
|
||||
|
||||
int dropChance = getShakeChance(lootTier);
|
||||
|
||||
|
||||
if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) {
|
||||
dropChance = (int) (dropChance * 1.25); //With lucky perk on max level tier, its 100%
|
||||
dropChance = (int) (dropChance * 1.25); // With lucky perk on max
|
||||
// level tier, its 100%
|
||||
}
|
||||
|
||||
final int DROP_CHANCE = random.nextInt(100);
|
||||
@ -263,7 +284,8 @@ public class Fishing {
|
||||
|
||||
case CREEPER:
|
||||
if (DROP_NUMBER > 97) {
|
||||
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4));
|
||||
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM,
|
||||
1, (short) 4));
|
||||
} else {
|
||||
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
|
||||
}
|
||||
@ -299,14 +321,17 @@ public class Fishing {
|
||||
if (DROP_NUMBER > 95) {
|
||||
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
|
||||
} else if (DROP_NUMBER > 90) {
|
||||
Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP));
|
||||
Misc.dropItem(location, new ItemStack(
|
||||
Material.MUSHROOM_SOUP));
|
||||
} else if (DROP_NUMBER > 60) {
|
||||
Misc.dropItem(location, new ItemStack(Material.LEATHER));
|
||||
} else if (DROP_NUMBER > 30) {
|
||||
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
|
||||
} else {
|
||||
Misc.dropItem(location, new ItemStack(Material.RED_MUSHROOM));
|
||||
Misc.randomDropItems(location, new ItemStack(Material.RED_MUSHROOM), 50, 2);
|
||||
Misc.dropItem(location,
|
||||
new ItemStack(Material.RED_MUSHROOM));
|
||||
Misc.randomDropItems(location, new ItemStack(
|
||||
Material.RED_MUSHROOM), 50, 2);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -316,7 +341,8 @@ public class Fishing {
|
||||
|
||||
case PIG_ZOMBIE:
|
||||
if (DROP_NUMBER > 50) {
|
||||
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
|
||||
Misc.dropItem(location,
|
||||
new ItemStack(Material.ROTTEN_FLESH));
|
||||
} else {
|
||||
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
|
||||
}
|
||||
@ -338,23 +364,27 @@ public class Fishing {
|
||||
break;
|
||||
|
||||
case SKELETON:
|
||||
if (((Skeleton)le).getSkeletonType() == SkeletonType.WITHER) {
|
||||
if (((Skeleton) le).getSkeletonType() == SkeletonType.WITHER) {
|
||||
if (DROP_NUMBER > 97) {
|
||||
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1));
|
||||
Misc.dropItem(location, new ItemStack(
|
||||
Material.SKULL_ITEM, 1, (short) 1));
|
||||
} else if (DROP_NUMBER > 50) {
|
||||
Misc.dropItem(location, new ItemStack(Material.BONE));
|
||||
} else {
|
||||
Misc.dropItem(location, new ItemStack(Material.COAL));
|
||||
Misc.randomDropItems(location, new ItemStack(Material.COAL), 50, 2);
|
||||
Misc.randomDropItems(location, new ItemStack(
|
||||
Material.COAL), 50, 2);
|
||||
}
|
||||
} else {
|
||||
if (DROP_NUMBER > 97) {
|
||||
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM));
|
||||
Misc.dropItem(location, new ItemStack(
|
||||
Material.SKULL_ITEM));
|
||||
} else if (DROP_NUMBER > 50) {
|
||||
Misc.dropItem(location, new ItemStack(Material.BONE));
|
||||
} else {
|
||||
Misc.dropItem(location, new ItemStack(Material.ARROW));
|
||||
Misc.randomDropItems(location, new ItemStack(Material.ARROW), 50, 2);
|
||||
Misc.randomDropItems(location, new ItemStack(
|
||||
Material.ARROW), 50, 2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -368,7 +398,8 @@ public class Fishing {
|
||||
Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
|
||||
} else {
|
||||
Misc.dropItem(location, new ItemStack(Material.SNOW_BALL));
|
||||
Misc.randomDropItems(location, new ItemStack(Material.SNOW_BALL), 50, 4);
|
||||
Misc.randomDropItems(location, new ItemStack(
|
||||
Material.SNOW_BALL), 50, 4);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -381,30 +412,38 @@ public class Fishing {
|
||||
break;
|
||||
|
||||
case SQUID:
|
||||
Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0));
|
||||
Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1,
|
||||
(short) 0));
|
||||
break;
|
||||
|
||||
case WITCH:
|
||||
final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1;
|
||||
if (DROP_NUMBER > 95) {
|
||||
if (DROP_NUMBER_2 > 66) {
|
||||
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197));
|
||||
Misc.dropItem(location, new ItemStack(Material.POTION,
|
||||
1, (short) 8197));
|
||||
} else if (DROP_NUMBER_2 > 33) {
|
||||
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195));
|
||||
Misc.dropItem(location, new ItemStack(Material.POTION,
|
||||
1, (short) 8195));
|
||||
} else {
|
||||
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194));
|
||||
Misc.dropItem(location, new ItemStack(Material.POTION,
|
||||
1, (short) 8194));
|
||||
}
|
||||
} else {
|
||||
if (DROP_NUMBER_2 > 88) {
|
||||
Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE));
|
||||
Misc.dropItem(location, new ItemStack(
|
||||
Material.GLASS_BOTTLE));
|
||||
} else if (DROP_NUMBER_2 > 75) {
|
||||
Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST));
|
||||
Misc.dropItem(location, new ItemStack(
|
||||
Material.GLOWSTONE_DUST));
|
||||
} else if (DROP_NUMBER_2 > 63) {
|
||||
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
|
||||
} else if (DROP_NUMBER_2 > 50) {
|
||||
Misc.dropItem(location, new ItemStack(Material.REDSTONE));
|
||||
Misc.dropItem(location,
|
||||
new ItemStack(Material.REDSTONE));
|
||||
} else if (DROP_NUMBER_2 > 38) {
|
||||
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
|
||||
Misc.dropItem(location, new ItemStack(
|
||||
Material.SPIDER_EYE));
|
||||
} else if (DROP_NUMBER_2 > 25) {
|
||||
Misc.dropItem(location, new ItemStack(Material.STICK));
|
||||
} else if (DROP_NUMBER_2 > 13) {
|
||||
@ -417,9 +456,11 @@ public class Fishing {
|
||||
|
||||
case ZOMBIE:
|
||||
if (DROP_NUMBER > 97) {
|
||||
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2));
|
||||
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM,
|
||||
1, (short) 2));
|
||||
} else {
|
||||
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
|
||||
Misc.dropItem(location,
|
||||
new ItemStack(Material.ROTTEN_FLESH));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -430,10 +471,12 @@ public class Fishing {
|
||||
|
||||
Combat.dealDamage(le, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets chance of shake success.
|
||||
*
|
||||
* @param rank Treasure hunter rank
|
||||
*
|
||||
* @param rank
|
||||
* Treasure hunter rank
|
||||
* @return The chance of a successful shake
|
||||
*/
|
||||
public static int getShakeChance(int lootTier) {
|
||||
@ -456,5 +499,5 @@ public class Fishing {
|
||||
default:
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,9 +203,9 @@ public class Herbalism {
|
||||
xp = Config.getInstance().getHerbalismXPLilyPads();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case COCOA:
|
||||
if ((((byte) data) & 0x8) == 0x8) {
|
||||
if (((data) & 0x8) == 0x8) {
|
||||
mat = Material.COCOA;
|
||||
xp = Config.getInstance().getHerbalismXPCocoa();
|
||||
|
||||
@ -341,7 +341,7 @@ public class Herbalism {
|
||||
Misc.dropItem(location, is);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case COCOA:
|
||||
if (configInstance.getCocoaDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, is);
|
||||
|
@ -87,7 +87,7 @@ public class Mining {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case EMERALD_ORE:
|
||||
if (configInstance.getEmeraldDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
@ -202,7 +202,7 @@ public class Mining {
|
||||
Misc.dropItem(location, item);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case EMERALD_ORE:
|
||||
if (configInstance.getEmeraldDoubleDropsEnabled()) {
|
||||
item = new ItemStack(Material.EMERALD);
|
||||
@ -294,7 +294,7 @@ public class Mining {
|
||||
case STONE:
|
||||
xp += Config.getInstance().getMiningXPStone();
|
||||
break;
|
||||
|
||||
|
||||
case EMERALD_ORE:
|
||||
xp += Config.getInstance().getMiningXPEmeraldOre();
|
||||
break;
|
||||
@ -324,12 +324,12 @@ public class Mining {
|
||||
|
||||
final int MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel();
|
||||
int MAX_CHANCE = advancedConfig.getMiningDoubleDropChance();
|
||||
|
||||
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
|
||||
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
int randomChance = 100;
|
||||
int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillCheck);
|
||||
int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillCheck);
|
||||
|
||||
if (player.hasPermission("mcmmo.perks.lucky.mining")) {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
|
@ -173,24 +173,24 @@ public class WoodCutting {
|
||||
WoodCutting.woodCuttingProcCheck(player, x);
|
||||
|
||||
switch (species) {
|
||||
case GENERIC:
|
||||
xp += Config.getInstance().getWoodcuttingXPOak();
|
||||
break;
|
||||
case GENERIC:
|
||||
xp += Config.getInstance().getWoodcuttingXPOak();
|
||||
break;
|
||||
|
||||
case REDWOOD:
|
||||
xp += Config.getInstance().getWoodcuttingXPSpruce();
|
||||
break;
|
||||
case REDWOOD:
|
||||
xp += Config.getInstance().getWoodcuttingXPSpruce();
|
||||
break;
|
||||
|
||||
case BIRCH:
|
||||
xp += Config.getInstance().getWoodcuttingXPBirch();
|
||||
break;
|
||||
case BIRCH:
|
||||
xp += Config.getInstance().getWoodcuttingXPBirch();
|
||||
break;
|
||||
|
||||
case JUNGLE:
|
||||
xp += Config.getInstance().getWoodcuttingXPJungle() / 2; //Nerf XP from Jungle Trees when using Tree Feller
|
||||
break;
|
||||
case JUNGLE:
|
||||
xp += Config.getInstance().getWoodcuttingXPJungle() / 2; //Nerf XP from Jungle Trees when using Tree Feller
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,7 +345,7 @@ public class WoodCutting {
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
|
||||
int randomChance = 100;
|
||||
int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillLevel);
|
||||
int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel);
|
||||
|
||||
if (player.hasPermission("mcmmo.perks.lucky.woodcutting")) {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
@ -438,7 +438,7 @@ public class WoodCutting {
|
||||
type ^= 0x8;
|
||||
|
||||
TreeSpecies species = TreeSpecies.getByData(type);
|
||||
|
||||
|
||||
//Apparently species can be null in certain cases (custom server mods?)
|
||||
//https://github.com/mcMMO-Dev/mcMMO/issues/229
|
||||
if(species == null)
|
||||
|
@ -224,7 +224,7 @@ public class Repair {
|
||||
}
|
||||
|
||||
if(repairAmount <= 0 || repairAmount > 32767)
|
||||
repairAmount = 32767;
|
||||
repairAmount = 32767;
|
||||
|
||||
durability -= repairAmount;
|
||||
|
||||
@ -248,11 +248,11 @@ public class Repair {
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
|
||||
|
||||
int randomChance = 100;
|
||||
int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillLevel);
|
||||
int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel);
|
||||
if (skillLevel >= MAX_BONUS_LEVEL) chance = MAX_CHANCE;
|
||||
|
||||
if (player.hasPermission("mcmmo.perks.lucky.repair")) randomChance = (int) (randomChance * 0.75);
|
||||
|
||||
|
||||
if (chance > random.nextInt(randomChance) && permInstance.repairBonus(player)){
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
|
||||
return true;
|
||||
|
@ -29,27 +29,27 @@ public class Salvage {
|
||||
}
|
||||
|
||||
if(player.getGameMode() == GameMode.SURVIVAL) {
|
||||
final PlayerProfile profile = Users.getProfile(player);
|
||||
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
|
||||
final int unlockLevel = configInstance.getSalvageUnlockLevel();
|
||||
final PlayerProfile profile = Users.getProfile(player);
|
||||
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
|
||||
final int unlockLevel = configInstance.getSalvageUnlockLevel();
|
||||
|
||||
if (skillLevel >= unlockLevel) {
|
||||
final float currentdura = inHand.getDurability();
|
||||
if (skillLevel >= unlockLevel) {
|
||||
final float currentdura = inHand.getDurability();
|
||||
|
||||
if (currentdura == 0) {
|
||||
final int salvagedAmount = getSalvagedAmount(inHand);
|
||||
final int itemID = getSalvagedItemID(inHand);
|
||||
if (currentdura == 0) {
|
||||
final int salvagedAmount = getSalvagedAmount(inHand);
|
||||
final int itemID = getSalvagedItemID(inHand);
|
||||
|
||||
player.setItemInHand(new ItemStack(0));
|
||||
location.setY(location.getY() + 1);
|
||||
Misc.dropItem(location, new ItemStack(itemID, salvagedAmount));
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess"));
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.NotFullDurability"));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage"));
|
||||
}
|
||||
player.setItemInHand(new ItemStack(0));
|
||||
location.setY(location.getY() + 1);
|
||||
Misc.dropItem(location, new ItemStack(itemID, salvagedAmount));
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess"));
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.NotFullDurability"));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,12 +38,12 @@ public class SimpleRepairable implements Repairable {
|
||||
|
||||
@Override
|
||||
public RepairItemType getRepairItemType() {
|
||||
return repairItemType;
|
||||
return repairItemType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepairMaterialType getRepairMaterialType() {
|
||||
return repairMaterialType;
|
||||
return repairMaterialType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,7 +6,7 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
||||
|
||||
public class Swords {
|
||||
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
|
||||
|
||||
public static final int BLEED_MAX_BONUS_LEVEL = advancedConfig.getBleedMaxBonusLevel();
|
||||
public static final int MAX_BLEED_TICKS = advancedConfig.getBleedMaxTicks();
|
||||
public static final int BASE_BLEED_TICKS = advancedConfig.getBleedBaseTicks();
|
||||
|
@ -50,7 +50,7 @@ public class SwordsManager {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
final float chance = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * (double) skillLevel);
|
||||
final float chance = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * skillLevel);
|
||||
if (chance > Swords.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.addBleedTicks();
|
||||
eventHandler.sendAbilityMessages();
|
||||
@ -81,7 +81,7 @@ public class SwordsManager {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
final float chance = (float) (((double) counterChanceMax / (double) counterMaxLevel) * (double) skillLevel);
|
||||
final float chance = (float) (((double) counterChanceMax / (double) counterMaxLevel) * skillLevel);
|
||||
if (chance > Swords.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.dealDamage();
|
||||
eventHandler.sendAbilityMessages();
|
||||
|
@ -6,7 +6,7 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
||||
|
||||
public class Taming {
|
||||
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
|
||||
|
||||
public static final int ENVIRONMENTALLY_AWARE_ACTIVATION_LEVEL = advancedConfig.getEnviromentallyAwareUnlock();
|
||||
|
||||
public static final int FAST_FOOD_SERVICE_ACTIVATION_CHANCE = advancedConfig.getFastFoodChance();
|
||||
|
@ -102,7 +102,7 @@ public class TamingManager {
|
||||
}
|
||||
|
||||
GoreEventHandler eventHandler = new GoreEventHandler(this, event);
|
||||
|
||||
|
||||
int goreChanceMax = AdvancedConfig.getInstance().getGoreChanceMax();
|
||||
int goreMaxLevel = AdvancedConfig.getInstance().getGoreMaxBonusLevel();
|
||||
int randomChance = 100;
|
||||
@ -111,7 +111,7 @@ public class TamingManager {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
final float chance = (float) (((double) goreChanceMax / (double) goreMaxLevel) * (double) skillLevel);
|
||||
final float chance = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillLevel);
|
||||
if (chance > Taming.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.modifyEventDamage();
|
||||
eventHandler.applyBleed();
|
||||
@ -281,9 +281,9 @@ public class TamingManager {
|
||||
}
|
||||
|
||||
if (skillLevel >= Taming.THICK_FUR_ACTIVATION_LEVEL) {
|
||||
ThickFurEventHandler eventHandler = new ThickFurEventHandler(event, cause);
|
||||
ThickFurEventHandler eventHandler = new ThickFurEventHandler(event, cause);
|
||||
|
||||
eventHandler.modifyEventDamage();
|
||||
eventHandler.modifyEventDamage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
||||
|
||||
public class Unarmed {
|
||||
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
|
||||
|
||||
public static final int BONUS_DAMAGE_MAX_BONUS_MODIFIER = advancedConfig.getIronArmBonus();
|
||||
public static final int BONUS_DAMAGE_INCREASE_LEVEL = advancedConfig.getIronArmIncreaseLevel();
|
||||
public static final int DEFLECT_MAX_CHANCE = advancedConfig.getDisarmChanceMax() ;
|
||||
|
@ -51,7 +51,7 @@ public class UnarmedManager {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
final float chance = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * (double) skillLevel);
|
||||
final float chance = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * skillLevel);
|
||||
if (chance > Unarmed.getRandom().nextInt(randomChance)) {
|
||||
if (!hasIronGrip(defender)) {
|
||||
eventHandler.sendAbilityMessage();
|
||||
@ -83,12 +83,12 @@ public class UnarmedManager {
|
||||
int deflectChanceMax = AdvancedConfig.getInstance().getDeflectChanceMax();
|
||||
int deflectMaxLevel = AdvancedConfig.getInstance().getDeflectMaxBonusLevel();
|
||||
int randomChance = 100;
|
||||
|
||||
|
||||
if (player.hasPermission("mcmmo.perks.lucky.unarmed")) {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
final float chance = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * (double) skillLevel);
|
||||
|
||||
final float chance = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * skillLevel);
|
||||
if (chance > Unarmed.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.cancelEvent();
|
||||
eventHandler.sendAbilityMessage();
|
||||
@ -143,8 +143,8 @@ public class UnarmedManager {
|
||||
if (defender.hasPermission("mcmmo.perks.lucky.unarmed")) {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
final float chance = (float) (((double) ironGripChanceMax / (double) ironGripMaxLevel) * (double) skillLevel);
|
||||
|
||||
final float chance = (float) (((double) ironGripChanceMax / (double) ironGripMaxLevel) * skillLevel);
|
||||
if (chance > Unarmed.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.sendAbilityMessages();
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user