General cleanup to satisfy my OCD a little while longer.

This commit is contained in:
GJ 2013-01-21 17:22:54 -05:00
parent 900623461a
commit 0711454e31
37 changed files with 180 additions and 163 deletions

View File

@ -31,16 +31,16 @@ public class McrankCommand implements CommandExecutor {
Player player = (Player) sender; Player player = (Player) sender;
String playerName; String playerName;
switch (args.length) { switch (args.length) {
case 0: case 0:
playerName = player.getName(); playerName = player.getName();
break; break;
case 1: case 1:
playerName = args[0]; playerName = args[0];
break; break;
default: default:
return false; return false;
} }
if (Config.getInstance().getUseMySQL()) { if (Config.getInstance().getUseMySQL()) {

View File

@ -118,8 +118,8 @@ public class MctopCommand implements CommandExecutor {
} }
private void flatfileDisplay(int page, String skill, CommandSender sender) { private void flatfileDisplay(int page, String skill, CommandSender sender) {
Leaderboard.updateLeaderboards(); //Make sure we have the latest information Leaderboard.updateLeaderboards(); //Make sure we have the latest information
SkillType skillType = SkillType.getSkill(skill); SkillType skillType = SkillType.getSkill(skill);
String[] info = Leaderboard.retrieveInfo(skillType, page); String[] info = Leaderboard.retrieveInfo(skillType, page);
if (skill.equalsIgnoreCase("ALL")) { if (skill.equalsIgnoreCase("ALL")) {

View File

@ -95,21 +95,21 @@ public class AcrobaticsCommand extends SkillCommand {
if (canRoll) { if (canRoll) {
if (lucky) if (lucky)
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { rollChanceLucky })); player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { rollChanceLucky }));
else else
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance })); player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Chance", new Object[] { rollChance }));
} }
if (canGracefulRoll) { if (canGracefulRoll) {
if (lucky) if (lucky)
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { gracefulRollChanceLucky })); player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { gracefulRollChanceLucky }));
else else
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance })); player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.GraceChance", new Object[] { gracefulRollChance }));
} }
if (canDodge) { if (canDodge) {
if (lucky) if (lucky)
player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { dodgeChanceLucky })); player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { dodgeChanceLucky }));
else else
player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance })); player.sendMessage(LocaleLoader.getString("Acrobatics.DodgeChance", new Object[] { dodgeChance }));
} }
} }

View File

@ -89,21 +89,21 @@ public class ArcheryCommand extends SkillCommand {
@Override @Override
protected void statsDisplay() { protected void statsDisplay() {
if (canSkillShot) { if (canSkillShot) {
player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus })); player.sendMessage(LocaleLoader.getString("Archery.Combat.SkillshotBonus", new Object[] { skillShotBonus }));
} }
if (canDaze) { if (canDaze) {
if (lucky) if (lucky)
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { dazeChanceLucky })); player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { dazeChanceLucky }));
else else
player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance })); player.sendMessage(LocaleLoader.getString("Archery.Combat.DazeChance", new Object[] { dazeChance }));
} }
if (canRetrieve) { if (canRetrieve) {
if (lucky) if (lucky)
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { retrieveChanceLucky })); player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { retrieveChanceLucky }));
else else
player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance })); player.sendMessage(LocaleLoader.getString("Archery.Combat.RetrieveChance", new Object[] { retrieveChance }));
} }
} }
} }

View File

@ -9,8 +9,8 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.CommandHelper; import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.SpoutConfig; import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.HudType; import com.gmail.nossr50.datatypes.HudType;
import com.gmail.nossr50.datatypes.SpoutHud;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SpoutHud;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;

View File

@ -57,13 +57,13 @@ public class Config extends ConfigLoader {
} }
private static String getStringIncludingInts(ConfigurationSection cfg, String key) { private static String getStringIncludingInts(ConfigurationSection cfg, String key) {
String str = cfg.getString(key); String str = cfg.getString(key);
if (str == null) if (str == null)
str = String.valueOf(cfg.getInt(key)); str = String.valueOf(cfg.getInt(key));
if (str == null) if (str == null)
str = "No value set for '" + key + "'"; str = "No value set for '" + key + "'";
return str; return str;
} }
/* Hardcore Mode */ /* Hardcore Mode */
public boolean getHardcoreEnabled() { return config.getBoolean("Hardcore.Enabled", false); } public boolean getHardcoreEnabled() { return config.getBoolean("Hardcore.Enabled", false); }

View File

@ -19,77 +19,77 @@ public enum AbilityType {
"Unarmed.Skills.Berserk.Refresh", "Unarmed.Skills.Berserk.Refresh",
"Unarmed.Skills.Berserk.Other.Off"), "Unarmed.Skills.Berserk.Other.Off"),
SUPER_BREAKER( SUPER_BREAKER(
Config.getInstance().getAbilityCooldownSuperBreaker(), Config.getInstance().getAbilityCooldownSuperBreaker(),
Config.getInstance().getAbilityMaxTicksSuperBreaker(), Config.getInstance().getAbilityMaxTicksSuperBreaker(),
"Mining.Skills.SuperBreaker.On", "Mining.Skills.SuperBreaker.On",
"Mining.Skills.SuperBreaker.Off", "Mining.Skills.SuperBreaker.Off",
"Mining.Skills.SuperBreaker.Other.On", "Mining.Skills.SuperBreaker.Other.On",
"Mining.Skills.SuperBreaker.Refresh", "Mining.Skills.SuperBreaker.Refresh",
"Mining.Skills.SuperBreaker.Other.Off"), "Mining.Skills.SuperBreaker.Other.Off"),
GIGA_DRILL_BREAKER( GIGA_DRILL_BREAKER(
Config.getInstance().getAbilityCooldownGigaDrillBreaker(), Config.getInstance().getAbilityCooldownGigaDrillBreaker(),
Config.getInstance().getAbilityMaxTicksGigaDrillBreaker(), Config.getInstance().getAbilityMaxTicksGigaDrillBreaker(),
"Excavation.Skills.GigaDrillBreaker.On", "Excavation.Skills.GigaDrillBreaker.On",
"Excavation.Skills.GigaDrillBreaker.Off", "Excavation.Skills.GigaDrillBreaker.Off",
"Excavation.Skills.GigaDrillBreaker.Other.On", "Excavation.Skills.GigaDrillBreaker.Other.On",
"Excavation.Skills.GigaDrillBreaker.Refresh", "Excavation.Skills.GigaDrillBreaker.Refresh",
"Excavation.Skills.GigaDrillBreaker.Other.Off"), "Excavation.Skills.GigaDrillBreaker.Other.Off"),
GREEN_TERRA( GREEN_TERRA(
Config.getInstance().getAbilityCooldownGreenTerra(), Config.getInstance().getAbilityCooldownGreenTerra(),
Config.getInstance().getAbilityMaxTicksGreenTerra(), Config.getInstance().getAbilityMaxTicksGreenTerra(),
"Herbalism.Skills.GTe.On", "Herbalism.Skills.GTe.On",
"Herbalism.Skills.GTe.Off", "Herbalism.Skills.GTe.Off",
"Herbalism.Skills.GTe.Other.On", "Herbalism.Skills.GTe.Other.On",
"Herbalism.Skills.GTe.Refresh", "Herbalism.Skills.GTe.Refresh",
"Herbalism.Skills.GTe.Other.Off"), "Herbalism.Skills.GTe.Other.Off"),
SKULL_SPLIITER( SKULL_SPLIITER(
Config.getInstance().getAbilityCooldownSkullSplitter(), Config.getInstance().getAbilityCooldownSkullSplitter(),
Config.getInstance().getAbilityMaxTicksSkullSplitter(), Config.getInstance().getAbilityMaxTicksSkullSplitter(),
"Axes.Skills.SS.On", "Axes.Skills.SS.On",
"Axes.Skills.SS.Off", "Axes.Skills.SS.Off",
"Axes.Skills.SS.Other.On", "Axes.Skills.SS.Other.On",
"Axes.Skills.SS.Refresh", "Axes.Skills.SS.Refresh",
"Axes.Skills.SS.Other.Off"), "Axes.Skills.SS.Other.Off"),
TREE_FELLER( TREE_FELLER(
Config.getInstance().getAbilityCooldownTreeFeller(), Config.getInstance().getAbilityCooldownTreeFeller(),
Config.getInstance().getAbilityMaxTicksTreeFeller(), Config.getInstance().getAbilityMaxTicksTreeFeller(),
"Woodcutting.Skills.TreeFeller.On", "Woodcutting.Skills.TreeFeller.On",
"Woodcutting.Skills.TreeFeller.Off", "Woodcutting.Skills.TreeFeller.Off",
"Woodcutting.Skills.TreeFeller.Other.On", "Woodcutting.Skills.TreeFeller.Other.On",
"Woodcutting.Skills.TreeFeller.Refresh", "Woodcutting.Skills.TreeFeller.Refresh",
"Woodcutting.Skills.TreeFeller.Other.Off"), "Woodcutting.Skills.TreeFeller.Other.Off"),
SERRATED_STRIKES( SERRATED_STRIKES(
Config.getInstance().getAbilityCooldownSerratedStrikes(), Config.getInstance().getAbilityCooldownSerratedStrikes(),
Config.getInstance().getAbilityMaxTicksSerratedStrikes(), Config.getInstance().getAbilityMaxTicksSerratedStrikes(),
"Swords.Skills.SS.On", "Swords.Skills.SS.On",
"Swords.Skills.SS.Off", "Swords.Skills.SS.Off",
"Swords.Skills.SS.Other.On", "Swords.Skills.SS.Other.On",
"Swords.Skills.SS.Refresh", "Swords.Skills.SS.Refresh",
"Swords.Skills.SS.Other.Off"), "Swords.Skills.SS.Other.Off"),
BLAST_MINING( BLAST_MINING(
Config.getInstance().getAbilityCooldownBlastMining(), Config.getInstance().getAbilityCooldownBlastMining(),
Config.getInstance().getAbilityMaxTicksBlastMining(), Config.getInstance().getAbilityMaxTicksBlastMining(),
null, null,
null, null,
"Mining.Blast.Other.On", "Mining.Blast.Other.On",
"Mining.Blast.Refresh", "Mining.Blast.Refresh",
null), null),
LEAF_BLOWER( LEAF_BLOWER(
0, 0,
0, 0,
null, null,
null, null,
null, null,
null, null,
null); null);
private int cooldown; private int cooldown;
private int maxTicks; private int maxTicks;

View File

@ -417,7 +417,7 @@ public class PlayerProfile {
e.printStackTrace(); e.printStackTrace();
} }
} }
lastSave = timestamp; lastSave = timestamp;
} }
public void addPlayer() { public void addPlayer() {

View File

@ -30,8 +30,8 @@ import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import com.gmail.nossr50.runnables.StickyPistonTracker; import com.gmail.nossr50.runnables.StickyPistonTracker;
import com.gmail.nossr50.skills.gathering.Excavation; import com.gmail.nossr50.skills.gathering.Excavation;
import com.gmail.nossr50.skills.gathering.Herbalism; import com.gmail.nossr50.skills.gathering.Herbalism;
import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.gathering.WoodCutting; import com.gmail.nossr50.skills.gathering.WoodCutting;
import com.gmail.nossr50.skills.mining.MiningManager;
import com.gmail.nossr50.skills.repair.Repair; import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.repair.Salvage; import com.gmail.nossr50.skills.repair.Salvage;
import com.gmail.nossr50.spout.SpoutSounds; import com.gmail.nossr50.spout.SpoutSounds;

View File

@ -12,8 +12,8 @@ import org.getspout.spoutapi.player.SpoutPlayer;
import com.gmail.nossr50.config.SpoutConfig; import com.gmail.nossr50.config.SpoutConfig;
import com.gmail.nossr50.datatypes.McMMOPlayer; import com.gmail.nossr50.datatypes.McMMOPlayer;
import com.gmail.nossr50.datatypes.SpoutHud;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SpoutHud;
import com.gmail.nossr50.datatypes.buttons.McmmoButton; import com.gmail.nossr50.datatypes.buttons.McmmoButton;
import com.gmail.nossr50.datatypes.popups.Menu; import com.gmail.nossr50.datatypes.popups.Menu;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;

View File

@ -14,6 +14,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import com.gmail.nossr50.commands.general.AddlevelsCommand; import com.gmail.nossr50.commands.general.AddlevelsCommand;
import com.gmail.nossr50.commands.general.AddxpCommand; import com.gmail.nossr50.commands.general.AddxpCommand;
import com.gmail.nossr50.commands.general.InspectCommand; import com.gmail.nossr50.commands.general.InspectCommand;
@ -390,7 +391,7 @@ public class mcMMO extends JavaPlugin {
} }
if(configInstance.getCommandMCRankEnabled()) { if(configInstance.getCommandMCRankEnabled()) {
getCommand("mcrank").setExecutor(new McrankCommand()); getCommand("mcrank").setExecutor(new McrankCommand());
} }
if (configInstance.getCommandMCStatsEnabled()) { if (configInstance.getCommandMCStatsEnabled()) {

View File

@ -28,7 +28,7 @@ public class GreenThumbTimer implements Runnable {
int skillLevel = this.profile.getSkillLevel(SkillType.HERBALISM); int skillLevel = this.profile.getSkillLevel(SkillType.HERBALISM);
final int STAGE_CHANGE = advancedConfig.getGreenThumbStageChange(); final int STAGE_CHANGE = advancedConfig.getGreenThumbStageChange();
int greenThumbStage = (int) ((double) skillLevel / (double) STAGE_CHANGE); int greenThumbStage = (int) ((double) skillLevel / (double) STAGE_CHANGE);
if (greenThumbStage > 4) greenThumbStage = 4; if (greenThumbStage > 4) greenThumbStage = 4;

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.runnables; package com.gmail.nossr50.runnables;
import java.lang.Runnable;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
@ -35,6 +33,7 @@ public class MobStoreCleaner implements Runnable
taskID = -1; taskID = -1;
} }
@Override
public void run() public void run()
{ {
mcMMO.placeStore.cleanMobLists(); mcMMO.placeStore.cleanMobLists();

View File

@ -1,12 +1,11 @@
package com.gmail.nossr50.runnables.blockstoreconversion; package com.gmail.nossr50.runnables.blockstoreconversion;
import java.io.File; import java.io.File;
import java.lang.Runnable;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.HiddenConfig;
public class BlockStoreConversionMain implements Runnable { public class BlockStoreConversionMain implements Runnable {
private int taskID, i; private int taskID, i;

View File

@ -1,12 +1,11 @@
package com.gmail.nossr50.runnables.blockstoreconversion; package com.gmail.nossr50.runnables.blockstoreconversion;
import java.io.File; import java.io.File;
import java.lang.Runnable;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.HiddenConfig;
public class BlockStoreConversionXDirectory implements Runnable { public class BlockStoreConversionXDirectory implements Runnable {
private int taskID, i; private int taskID, i;

View File

@ -1,18 +1,16 @@
package com.gmail.nossr50.runnables.blockstoreconversion; package com.gmail.nossr50.runnables.blockstoreconversion;
import java.io.File; import java.io.File;
import java.lang.Runnable;
import java.lang.String;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.blockmeta.ChunkletStore; import com.gmail.nossr50.util.blockmeta.ChunkletStore;
import com.gmail.nossr50.util.blockmeta.HashChunkletManager;
import com.gmail.nossr50.util.blockmeta.PrimitiveChunkletStore; import com.gmail.nossr50.util.blockmeta.PrimitiveChunkletStore;
import com.gmail.nossr50.util.blockmeta.PrimitiveExChunkletStore; import com.gmail.nossr50.util.blockmeta.PrimitiveExChunkletStore;
import com.gmail.nossr50.util.blockmeta.chunkmeta.PrimitiveChunkStore;
import com.gmail.nossr50.util.blockmeta.HashChunkletManager;
import com.gmail.nossr50.util.blockmeta.chunkmeta.HashChunkManager; import com.gmail.nossr50.util.blockmeta.chunkmeta.HashChunkManager;
import com.gmail.nossr50.util.blockmeta.chunkmeta.PrimitiveChunkStore;
public class BlockStoreConversionZDirectory implements Runnable { public class BlockStoreConversionZDirectory implements Runnable {
public int taskID, cx, cz, x, y, z, y2, xPos, zPos, cxPos, czPos; public int taskID, cx, cz, x, y, z, y2, xPos, zPos, cxPos, czPos;

View File

@ -107,7 +107,7 @@ public class Herbalism {
randomChance = 75; randomChance = 75;
} }
float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * herbLevel); float chance = (float) ((MAX_CHANCE / MAX_BONUS_LEVEL) * herbLevel);
if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE; if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE;
switch (type) { switch (type) {
@ -125,7 +125,7 @@ public class Herbalism {
if (b.getType().equals(Material.CACTUS)) { if (b.getType().equals(Material.CACTUS)) {
mat = Material.CACTUS; mat = Material.CACTUS;
if (!mcMMO.placeStore.isTrue(b)) { if (!mcMMO.placeStore.isTrue(b)) {
if (chance > Misc.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
catciDrops++; catciDrops++;
} }
xp += Config.getInstance().getHerbalismXPCactus(); xp += Config.getInstance().getHerbalismXPCactus();
@ -185,7 +185,7 @@ public class Herbalism {
if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) { if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) {
mat = Material.SUGAR_CANE; mat = Material.SUGAR_CANE;
if (!mcMMO.placeStore.isTrue(b)) { if (!mcMMO.placeStore.isTrue(b)) {
if (chance > Misc.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
caneDrops++; caneDrops++;
} }
xp += Config.getInstance().getHerbalismXPSugarCane(); xp += Config.getInstance().getHerbalismXPSugarCane();
@ -410,8 +410,8 @@ public class Herbalism {
* @param plugin mcMMO plugin instance * @param plugin mcMMO plugin instance
*/ */
private static void greenThumbWheat(Block block, Player player, BlockBreakEvent event, mcMMO plugin) { private static void greenThumbWheat(Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
final int MAX_CHANCE = advancedConfig.getGreenThumbChanceMax(); final int MAX_CHANCE = advancedConfig.getGreenThumbChanceMax();
final int MAX_BONUS_LEVEL = advancedConfig.getGreenThumbMaxLevel(); final int MAX_BONUS_LEVEL = advancedConfig.getGreenThumbMaxLevel();
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);
int herbLevel = profile.getSkillLevel(SkillType.HERBALISM); int herbLevel = profile.getSkillLevel(SkillType.HERBALISM);
@ -455,7 +455,7 @@ public class Herbalism {
} }
float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * herbLevel); float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * herbLevel);
if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE; if (chance > MAX_CHANCE) chance = MAX_CHANCE;
if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (chance > Misc.getRandom().nextInt(randomChance))) { if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (chance > Misc.getRandom().nextInt(randomChance))) {
event.setCancelled(true); event.setCancelled(true);
@ -529,7 +529,7 @@ public class Herbalism {
} }
float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel); float chance = (float) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * skillLevel);
if (chance > MAX_CHANCE) chance = (float) MAX_CHANCE; if (chance > MAX_CHANCE) chance = MAX_CHANCE;
if (chance > Misc.getRandom().nextInt(randomChance)) { if (chance > Misc.getRandom().nextInt(randomChance)) {
greenTerraConvert(player, block); greenTerraConvert(player, block);

View File

@ -35,7 +35,7 @@ public class Mining {
* @param player The player to award XP to * @param player The player to award XP to
* @param block The block to award XP for * @param block The block to award XP for
*/ */
protected static void miningXP(Player player, PlayerProfile profile, Block block, Material type) { protected static void miningXP(Player player, PlayerProfile profile, Block block, Material type) {
int xp = 0; int xp = 0;
switch (type) { switch (type) {

View File

@ -205,8 +205,8 @@ public class Repair {
*/ */
protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) { protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
float bonus; float bonus;
if (skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = ((float) REPAIR_MASTERY_CHANCE_MAX / 100F); if (skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = (REPAIR_MASTERY_CHANCE_MAX / 100F);
else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * (((float) REPAIR_MASTERY_CHANCE_MAX) / 100F); else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * ((REPAIR_MASTERY_CHANCE_MAX) / 100F);
if (Permissions.repairMastery(player)) { if (Permissions.repairMastery(player)) {
bonus = repairAmount * bonus; bonus = repairAmount * bonus;

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import org.bukkit.inventory.ItemStack;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.api.SpoutToolsAPI; import com.gmail.nossr50.api.SpoutToolsAPI;
@ -470,7 +470,7 @@ public class ItemChecks {
public static boolean isEnchantable(ItemStack is) { public static boolean isEnchantable(ItemStack is) {
Material type = is.getType(); Material type = is.getType();
return isArmor(is) || isSword(is) || isAxe(is) || isShovel(is) || isPickaxe(is) || return isArmor(is) || isSword(is) || isAxe(is) || isShovel(is) || isPickaxe(is) ||
type == Material.SHEARS || type == Material.FISHING_ROD || type == Material.CARROT_STICK || type == Material.SHEARS || type == Material.FISHING_ROD || type == Material.CARROT_STICK ||
type == Material.FLINT_AND_STEEL || type == Material.BOW; type == Material.FLINT_AND_STEEL || type == Material.BOW;
} }
} }

View File

@ -1,12 +1,10 @@
package com.gmail.nossr50.util.blockmeta.chunkmeta; package com.gmail.nossr50.util.blockmeta.chunkmeta;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.lang.Boolean;
import java.lang.Integer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -18,11 +16,10 @@ import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.getspout.spoutapi.chunkstore.mcMMOSimpleRegionFile;
import com.gmail.nossr50.runnables.blockstoreconversion.BlockStoreConversionZDirectory; import com.gmail.nossr50.runnables.blockstoreconversion.BlockStoreConversionZDirectory;
import org.getspout.spoutapi.chunkstore.mcMMOSimpleRegionFile;
public class HashChunkManager implements ChunkManager { public class HashChunkManager implements ChunkManager {
private HashMap<UUID, HashMap<Long, mcMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, mcMMOSimpleRegionFile>>(); private HashMap<UUID, HashMap<Long, mcMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, mcMMOSimpleRegionFile>>();
public HashMap<String, ChunkStore> store = new HashMap<String, ChunkStore>(); public HashMap<String, ChunkStore> store = new HashMap<String, ChunkStore>();
@ -577,34 +574,41 @@ public class HashChunkManager implements ChunkManager {
return true; return true;
} }
@Override
public boolean isSpawnedMob(Entity entity) { public boolean isSpawnedMob(Entity entity) {
return spawnedMobs.contains(entity); return spawnedMobs.contains(entity);
} }
@Override
public boolean isSpawnedPet(Entity entity) { public boolean isSpawnedPet(Entity entity) {
return spawnedMobs.contains(entity); return spawnedMobs.contains(entity);
} }
@Override
public void addSpawnedMob(Entity entity) { public void addSpawnedMob(Entity entity) {
if (!isSpawnedMob(entity)) if (!isSpawnedMob(entity))
spawnedMobs.add(entity); spawnedMobs.add(entity);
} }
@Override
public void addSpawnedPet(Entity entity) { public void addSpawnedPet(Entity entity) {
if (!isSpawnedMob(entity)) if (!isSpawnedMob(entity))
spawnedMobs.add(entity); spawnedMobs.add(entity);
} }
@Override
public void removeSpawnedMob(Entity entity) { public void removeSpawnedMob(Entity entity) {
if (isSpawnedMob(entity)) if (isSpawnedMob(entity))
spawnedMobs.remove(entity); spawnedMobs.remove(entity);
} }
@Override
public void removeSpawnedPet(Entity entity) { public void removeSpawnedPet(Entity entity) {
if (isSpawnedMob(entity)) if (isSpawnedMob(entity))
spawnedMobs.remove(entity); spawnedMobs.remove(entity);
} }
@Override
public synchronized void cleanMobLists() { public synchronized void cleanMobLists() {
if (!safeToRemoveMobs || iteratingMobs) if (!safeToRemoveMobs || iteratingMobs)
return; return;

View File

@ -88,11 +88,18 @@ public class NullChunkManager implements ChunkManager {
@Override @Override
public void cleanUp() {} public void cleanUp() {}
@Override
public boolean isSpawnedMob(Entity entity) {return false;} public boolean isSpawnedMob(Entity entity) {return false;}
@Override
public boolean isSpawnedPet(Entity entity) {return false;} public boolean isSpawnedPet(Entity entity) {return false;}
@Override
public void addSpawnedMob(Entity entity) {} public void addSpawnedMob(Entity entity) {}
@Override
public void addSpawnedPet(Entity entity) {} public void addSpawnedPet(Entity entity) {}
@Override
public void removeSpawnedMob(Entity entity) {} public void removeSpawnedMob(Entity entity) {}
@Override
public void removeSpawnedPet(Entity entity) {} public void removeSpawnedPet(Entity entity) {}
@Override
public synchronized void cleanMobLists() {} public synchronized void cleanMobLists() {}
} }

View File

@ -26,7 +26,7 @@ public class PrimitiveChunkStore implements ChunkStore {
transient private int worldHeight; transient private int worldHeight;
transient private int xBitShifts; transient private int xBitShifts;
transient private int zBitShifts; transient private int zBitShifts;
transient private boolean conversionNeeded; transient private boolean conversionNeeded;
public PrimitiveChunkStore(World world, int cx, int cz) { public PrimitiveChunkStore(World world, int cx, int cz) {
@ -104,14 +104,17 @@ public class PrimitiveChunkStore implements ChunkStore {
dirty = true; dirty = true;
} }
@Override
public boolean isSpawnedMob(UUID id) { public boolean isSpawnedMob(UUID id) {
return spawnedMobs.contains(id); return spawnedMobs.contains(id);
} }
@Override
public boolean isSpawnedPet(UUID id) { public boolean isSpawnedPet(UUID id) {
return spawnedMobs.contains(id); return spawnedMobs.contains(id);
} }
@Override
public void addSpawnedMob(UUID id) { public void addSpawnedMob(UUID id) {
if (!isSpawnedMob(id)) { if (!isSpawnedMob(id)) {
spawnedMobs.add(id); spawnedMobs.add(id);
@ -119,6 +122,7 @@ public class PrimitiveChunkStore implements ChunkStore {
} }
} }
@Override
public void addSpawnedPet(UUID id) { public void addSpawnedPet(UUID id) {
if (!isSpawnedPet(id)) { if (!isSpawnedPet(id)) {
spawnedMobs.add(id); spawnedMobs.add(id);
@ -126,6 +130,7 @@ public class PrimitiveChunkStore implements ChunkStore {
} }
} }
@Override
public void removeSpawnedMob(UUID id) { public void removeSpawnedMob(UUID id) {
if (isSpawnedMob(id)) { if (isSpawnedMob(id)) {
spawnedMobs.remove(id); spawnedMobs.remove(id);
@ -133,6 +138,7 @@ public class PrimitiveChunkStore implements ChunkStore {
} }
} }
@Override
public void removeSpawnedPet(UUID id) { public void removeSpawnedPet(UUID id) {
if (isSpawnedPet(id)) { if (isSpawnedPet(id)) {
spawnedMobs.remove(id); spawnedMobs.remove(id);
@ -140,6 +146,7 @@ public class PrimitiveChunkStore implements ChunkStore {
} }
} }
@Override
public void clearSpawnedMobs() { public void clearSpawnedMobs() {
if (!spawnedMobs.isEmpty()) { if (!spawnedMobs.isEmpty()) {
spawnedMobs.clear(); spawnedMobs.clear();
@ -147,6 +154,7 @@ public class PrimitiveChunkStore implements ChunkStore {
} }
} }
@Override
public void clearSpawnedPets() { public void clearSpawnedPets() {
if (!spawnedMobs.isEmpty()) { if (!spawnedMobs.isEmpty()) {
spawnedMobs.clear(); spawnedMobs.clear();
@ -154,10 +162,12 @@ public class PrimitiveChunkStore implements ChunkStore {
} }
} }
@Override
public List<UUID> getSpawnedMobs() { public List<UUID> getSpawnedMobs() {
return spawnedMobs; return spawnedMobs;
} }
@Override
public List<UUID> getSpawnedPets() { public List<UUID> getSpawnedPets() {
return spawnedMobs; return spawnedMobs;
} }

View File

@ -6,7 +6,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
public class PrimitiveExChunkletStoreTest { public class PrimitiveExChunkletStoreTest {
byte addresses[][] = new byte[16][16]; byte addresses[][] = new byte[16][16];
@Before @Before
public void populateAddresses() { public void populateAddresses() {