So many useless else statements...

This commit is contained in:
gmcferrin 2013-01-09 22:43:21 -05:00
parent 75a5ffcb10
commit 8b9432d1d9
33 changed files with 358 additions and 407 deletions

View File

@ -43,7 +43,7 @@ public class InspectCommand implements CommandExecutor {
return true; return true;
} }
else {
if (sender instanceof Player && !sender.isOp() && !Permissions.inspectOfflineBypass((Player) sender)) { if (sender instanceof Player && !sender.isOp() && !Permissions.inspectOfflineBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline")); sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true; return true;
@ -77,7 +77,6 @@ public class InspectCommand implements CommandExecutor {
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR) })); sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR) }));
return true; return true;
}
default: default:
sender.sendMessage(usage); sender.sendMessage(usage);

View File

@ -62,7 +62,7 @@ public class MctopCommand implements CommandExecutor {
return true; return true;
} }
} }
else {
String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing"; String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
switch (args.length) { switch (args.length) {
@ -103,7 +103,6 @@ public class MctopCommand implements CommandExecutor {
return true; return true;
} }
} }
}
private void flatfileDisplay(int page, String skill, CommandSender sender) { private void flatfileDisplay(int page, String skill, CommandSender sender) {
String[] info = Leaderboard.retrieveInfo(skill, page); String[] info = Leaderboard.retrieveInfo(skill, page);

View File

@ -56,15 +56,13 @@ public class InviteCommand implements CommandExecutor {
target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1")); target.sendMessage(LocaleLoader.getString("Commands.Party.Invite.1"));
return true; return true;
} }
else {
player.sendMessage(LocaleLoader.getString("Party.Locked")); player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true; return true;
} }
}
else {
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid")); player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true; return true;
}
default: default:
sender.sendMessage(usage); sender.sendMessage(usage);

View File

@ -186,7 +186,7 @@ public class PartyCommand implements CommandExecutor {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]})); player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]}));
return true; return true;
} }
else {
String partyName = party.getName(); String partyName = party.getName();
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.KICKED_FROM_PARTY); McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.KICKED_FROM_PARTY);
@ -198,7 +198,6 @@ public class PartyCommand implements CommandExecutor {
partyManagerInstance.removeFromParty(args[1], party); partyManagerInstance.removeFromParty(args[1], party);
} }
}
else { else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner")); player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
} }
@ -209,11 +208,10 @@ public class PartyCommand implements CommandExecutor {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]})); player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]}));
return true; return true;
} }
else {
partyManagerInstance.setPartyLeader(args[1], party); partyManagerInstance.setPartyLeader(args[1], party);
} }
} }
}
else { else {
Party newParty = partyManagerInstance.getParty(args[0]); Party newParty = partyManagerInstance.getParty(args[0]);

View File

@ -48,10 +48,9 @@ public class Config extends ConfigLoader {
if (getStringIncludingInts(config, "MySQL.Database.User_Password") != null) { if (getStringIncludingInts(config, "MySQL.Database.User_Password") != null) {
return getStringIncludingInts(config, "MySQL.Database.User_Password"); return getStringIncludingInts(config, "MySQL.Database.User_Password");
} }
else {
return ""; return "";
} }
}
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);

View File

@ -265,11 +265,10 @@ public class TreasuresConfig extends ConfigLoader{
if (issues.isEmpty()) { if (issues.isEmpty()) {
return true; return true;
} }
else {
for (String issue : issues) { for (String issue : issues) {
plugin.getLogger().warning(issue); plugin.getLogger().warning(issue);
} }
return false; return false;
} }
} }
}

View File

@ -99,11 +99,10 @@ public class RepairConfig extends ConfigLoader {
if (issues.isEmpty()) { if (issues.isEmpty()) {
return true; return true;
} }
else {
for (String issue : issues) { for (String issue : issues) {
plugin.getLogger().warning(issue); plugin.getLogger().warning(issue);
} }
return false; return false;
} }
} }
}

View File

@ -209,10 +209,9 @@ public class McMMOPlayer {
if (invite != null) { if (invite != null) {
return true; return true;
} }
else {
return false; return false;
} }
}
public void setParty(Party party) { public void setParty(Party party) {
this.party = party; this.party = party;
@ -226,10 +225,9 @@ public class McMMOPlayer {
if (party != null) { if (party != null) {
return true; return true;
} }
else {
return false; return false;
} }
}
public void removeParty() { public void removeParty() {
party = null; party = null;

View File

@ -96,7 +96,7 @@ public class PlayerProfile {
if (userId == 0) { if (userId == 0) {
return false; return false;
} }
else {
HashMap<Integer, ArrayList<String>> huds = database.read("SELECT hudtype FROM " + tablePrefix + "huds WHERE user_id = " + userId); HashMap<Integer, ArrayList<String>> huds = database.read("SELECT hudtype FROM " + tablePrefix + "huds WHERE user_id = " + userId);
if (huds.get(1) == null) { if (huds.get(1) == null) {
@ -179,7 +179,6 @@ public class PlayerProfile {
loaded = true; loaded = true;
return true; return true;
} }
}
public void addMySQLPlayer() { public void addMySQLPlayer() {
Database database = mcMMO.getPlayerDatabase(); Database database = mcMMO.getPlayerDatabase();
@ -1175,10 +1174,9 @@ public class PlayerProfile {
if (invite != null) { if (invite != null) {
return true; return true;
} }
else {
return false; return false;
} }
}
public void setParty(Party party) { public void setParty(Party party) {
this.party = party; this.party = party;
@ -1193,10 +1191,9 @@ public class PlayerProfile {
if (party != null) { if (party != null) {
return true; return true;
} }
else {
return false; return false;
} }
}
public void removeParty() { public void removeParty() {
party = null; party = null;

View File

@ -57,10 +57,9 @@ public enum SkillType {
if (maxLevel > 0) { if (maxLevel > 0) {
return maxLevel; return maxLevel;
} }
else {
return Integer.MAX_VALUE; return Integer.MAX_VALUE;
} }
}
public ToolType getTool() { public ToolType getTool() {
return tool; return tool;

View File

@ -136,13 +136,12 @@ public class BlockListener implements Listener {
if (block.getRelative(0, y, 0).getType().equals(Material.AIR)) { if (block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
continue; continue;
} }
else {
Block newLocation = block.getRelative(0, y + 1, 0); Block newLocation = block.getRelative(0, y + 1, 0);
mcMMO.placeStore.setTrue(newLocation); mcMMO.placeStore.setTrue(newLocation);
break; break;
} }
} }
}
/* Check if the blocks placed should be monitored so they do not give out XP in the future */ /* Check if the blocks placed should be monitored so they do not give out XP in the future */
if (BlockChecks.shouldBeWatched(block)) { if (BlockChecks.shouldBeWatched(block)) {

View File

@ -86,13 +86,18 @@ public class BlockStoreConversionZDirectory implements Runnable {
for (this.y = 0; this.y < (this.world.getMaxHeight() / 64); this.y++) { for (this.y = 0; this.y < (this.world.getMaxHeight() / 64); this.y++) {
this.chunkletName = this.world.getName() + "," + this.cx + "," + this.cz + "," + this.y; this.chunkletName = this.world.getName() + "," + this.cx + "," + this.cz + "," + this.y;
this.tempChunklet = this.manager.store.get(this.chunkletName); this.tempChunklet = this.manager.store.get(this.chunkletName);
if(this.tempChunklet instanceof PrimitiveChunkletStore)
if (this.tempChunklet instanceof PrimitiveChunkletStore) {
this.primitiveChunklet = (PrimitiveChunkletStore) this.tempChunklet; this.primitiveChunklet = (PrimitiveChunkletStore) this.tempChunklet;
else if(this.tempChunklet instanceof PrimitiveExChunkletStore) }
else if (this.tempChunklet instanceof PrimitiveExChunkletStore) {
this.primitiveExChunklet = (PrimitiveExChunkletStore) this.tempChunklet; this.primitiveExChunklet = (PrimitiveExChunkletStore) this.tempChunklet;
}
if (this.tempChunklet == null) { if (this.tempChunklet == null) {
continue; continue;
} else { }
this.chunkName = this.world.getName() + "," + this.cx + "," + this.cz; this.chunkName = this.world.getName() + "," + this.cx + "," + this.cz;
this.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName); this.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName);
@ -140,7 +145,6 @@ public class BlockStoreConversionZDirectory implements Runnable {
} }
} }
} }
}
this.manager.unloadChunk(this.cx, this.cz, this.world); this.manager.unloadChunk(this.cx, this.cz, this.world);
this.newManager.unloadChunk(this.cx, this.cz, this.world); this.newManager.unloadChunk(this.cx, this.cz, this.world);

View File

@ -211,8 +211,7 @@ public class Axes {
if (inventory.getBoots() != null || inventory.getChestplate() != null || inventory.getHelmet() != null || inventory.getLeggings() != null) { if (inventory.getBoots() != null || inventory.getChestplate() != null || inventory.getHelmet() != null || inventory.getLeggings() != null) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}

View File

@ -327,10 +327,9 @@ public class WoodCutting {
if ((currentType.equals(Material.LEAVES) || currentType.equals(Material.AIR) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLeafBlock(currentBlock))) && (newType.equals(Material.LEAVES) || newType.equals(Material.AIR) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLeafBlock(currentBlock)))) { if ((currentType.equals(Material.LEAVES) || currentType.equals(Material.AIR) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLeafBlock(currentBlock))) && (newType.equals(Material.LEAVES) || newType.equals(Material.AIR) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLeafBlock(currentBlock)))) {
return true; return true;
} }
else {
return false; return false;
} }
}
/** /**
* Check for double drops. * Check for double drops.

View File

@ -69,11 +69,10 @@ public class SuperBreakerEventHandler {
if (ModChecks.getCustomBlock(block).getTier() < tier) { if (ModChecks.getCustomBlock(block).getTier() < tier) {
return false; return false;
} }
else {
return true; return true;
} }
}
else {
switch (blockType) { switch (blockType) {
case OBSIDIAN: case OBSIDIAN:
if (tier < Mining.DIAMOND_TOOL_TIER) { if (tier < Mining.DIAMOND_TOOL_TIER) {
@ -111,7 +110,6 @@ public class SuperBreakerEventHandler {
return false; return false;
} }
} }
}
private void calculateDurabilityLoss() { private void calculateDurabilityLoss() {
this.durabilityLoss = Misc.TOOL_DURABILITY_LOSS; this.durabilityLoss = Misc.TOOL_DURABILITY_LOSS;

View File

@ -187,10 +187,9 @@ public class SimpleRepairManager implements RepairManager {
if (inventory.getItem(location).getTypeId() == itemId) { if (inventory.getItem(location).getTypeId() == itemId) {
return location; return location;
} }
else {
return -1; return -1;
} }
}
/** /**
* Search the inventory for an item and return the index. * Search the inventory for an item and return the index.

View File

@ -44,8 +44,7 @@ public class BeastLoreEventHandler {
if (tamer instanceof Player) { if (tamer instanceof Player) {
return ((Player) tamer).getName(); return ((Player) tamer).getName();
} }
else {
return "Offline Master"; return "Offline Master";
} }
} }
}

View File

@ -195,7 +195,7 @@ public class TamingManager {
eventHandler.sendInsufficientAmountMessage(); eventHandler.sendInsufficientAmountMessage();
return; return;
} }
else {
if (eventHandler.nearbyEntityExists()) { if (eventHandler.nearbyEntityExists()) {
eventHandler.sendFailureMessage(); eventHandler.sendFailureMessage();
} }
@ -205,7 +205,6 @@ public class TamingManager {
eventHandler.sendSuccessMessage(); eventHandler.sendSuccessMessage();
} }
} }
}
/** /**
* Handle the Environmentally Aware ability. * Handle the Environmentally Aware ability.

View File

@ -134,10 +134,9 @@ public class UnarmedManager {
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
return true; return true;
} }
else {
return false; return false;
} }
}
protected int getSkillLevel() { protected int getSkillLevel() {
return skillLevel; return skillLevel;

View File

@ -65,11 +65,10 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) { if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}
/** /**
* Check if a block should allow for the activation of abilities. * Check if a block should allow for the activation of abilities.
@ -114,11 +113,10 @@ public class BlockChecks {
if (block.getTypeId() == Config.getInstance().getRepairAnvilId() || block.getTypeId() == Config.getInstance().getSalvageAnvilId()) { if (block.getTypeId() == Config.getInstance().getRepairAnvilId() || block.getTypeId() == Config.getInstance().getSalvageAnvilId()) {
return false; return false;
} }
else {
return true; return true;
} }
} }
}
/** /**
* Check if a block type is an ore. * Check if a block type is an ore.
@ -142,11 +140,10 @@ public class BlockChecks {
if (customBlocksEnabled && ModChecks.isCustomOreBlock(block)) { if (customBlocksEnabled && ModChecks.isCustomOreBlock(block)) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}
/** /**
* Check if a block can be made mossy. * Check if a block can be made mossy.
@ -198,9 +195,8 @@ public class BlockChecks {
if (block.getData() == CropState.RIPE.getData()) { if (block.getData() == CropState.RIPE.getData()) {
return true; return true;
} }
else {
return false; return false;
}
default: default:
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1); ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
@ -208,11 +204,10 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) { if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}
/** /**
* Check to see if a block is broken by Super Breaker. * Check to see if a block is broken by Super Breaker.
@ -245,11 +240,10 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) { if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}
/** /**
* Check to see if a block can be broken by Giga Drill Breaker. * Check to see if a block can be broken by Giga Drill Breaker.
@ -274,11 +268,10 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) { if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}
/** /**
* Checks if the block is affected by Tree Feller. * Checks if the block is affected by Tree Feller.
@ -299,18 +292,16 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) { if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}
public static boolean isLog (Block block){ public static boolean isLog (Block block){
if (block.getType().equals(Material.LOG) || (customBlocksEnabled && ModChecks.isCustomLogBlock(block))) { if (block.getType().equals(Material.LOG) || (customBlocksEnabled && ModChecks.isCustomLogBlock(block))) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}

View File

@ -172,11 +172,10 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customHelmetIDs.contains(is.getTypeId())) { if (customArmorEnabled && CustomArmorConfig.getInstance().customHelmetIDs.contains(is.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}
/** /**
* Checks if the item is a chestplate. * Checks if the item is a chestplate.
@ -196,11 +195,10 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customChestplateIDs.contains(is.getTypeId())) { if (customArmorEnabled && CustomArmorConfig.getInstance().customChestplateIDs.contains(is.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}
/** /**
* Checks if the item is a pair of pants. * Checks if the item is a pair of pants.
@ -220,11 +218,10 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customLeggingIDs.contains(is.getTypeId())) { if (customArmorEnabled && CustomArmorConfig.getInstance().customLeggingIDs.contains(is.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}
/** /**
* Checks if the item is a pair of boots. * Checks if the item is a pair of boots.
@ -244,11 +241,10 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customBootIDs.contains(is.getTypeId())) { if (customArmorEnabled && CustomArmorConfig.getInstance().customBootIDs.contains(is.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}
/** /**
* Checks to see if an item is a wearable armor piece. * Checks to see if an item is a wearable armor piece.

View File

@ -55,9 +55,8 @@ public class Leaderboard {
if (players.contains(p)) { if (players.contains(p)) {
continue; continue;
} }
else {
players.add(p); players.add(p);
}
if (character.length > 1 && Misc.isInt(character[1])) { if (character.length > 1 && Misc.isInt(character[1])) {
Mining.add(new PlayerStat(p, Integer.valueOf(character[1]))); Mining.add(new PlayerStat(p, Integer.valueOf(character[1])));

View File

@ -398,7 +398,8 @@ public class Metrics {
if (response == null || response.startsWith("ERR")) { if (response == null || response.startsWith("ERR")) {
throw new IOException(response); //Throw the exception throw new IOException(response); //Throw the exception
} else { }
// Is this the first update this hour? // Is this the first update this hour?
if (response.contains("OK This is your first update this hour")) { if (response.contains("OK This is your first update this hour")) {
synchronized (graphs) { synchronized (graphs) {
@ -414,8 +415,6 @@ public class Metrics {
} }
} }
} }
//if (response.startsWith("OK")) - We should get "OK" followed by an optional description if everything goes right
}
/** /**
* Check if mineshafter is present. If it is, we need to bypass it to send POST requests * Check if mineshafter is present. If it is, we need to bypass it to send POST requests

View File

@ -92,10 +92,9 @@ public class Misc {
if (isInt(string)) { if (isInt(string)) {
return Integer.parseInt(string); return Integer.parseInt(string);
} }
else {
return 0; return 0;
} }
}
/** /**
* Checks to see if an entity is currently invincible. * Checks to see if an entity is currently invincible.
@ -113,10 +112,9 @@ public class Misc {
if (le.getNoDamageTicks() > le.getMaximumNoDamageTicks() / 2.0F && event.getDamage() <= le.getLastDamage()) { if (le.getNoDamageTicks() > le.getMaximumNoDamageTicks() / 2.0F && event.getDamage() <= le.getLastDamage()) {
return true; return true;
} }
else {
return false; return false;
} }
}
/** /**
* Simulate a block break event. * Simulate a block break event.
@ -145,10 +143,9 @@ public class Misc {
if (!damageEvent.isCancelled() && !breakEvent.isCancelled()) { if (!damageEvent.isCancelled() && !breakEvent.isCancelled()) {
return true; return true;
} }
else {
return false; return false;
} }
}
/** /**
* Get the upgrade tier of the item in hand. * Get the upgrade tier of the item in hand.
@ -197,10 +194,9 @@ public class Misc {
if (first.distanceSquared(second) < (maxDistance * maxDistance)) { if (first.distanceSquared(second) < (maxDistance * maxDistance)) {
return true; return true;
} }
else {
return false; return false;
} }
}
/** /**
* Determine if a string represents an Integer * Determine if a string represents an Integer
@ -294,10 +290,9 @@ public class Misc {
if (skillLevel > maxLevel) { if (skillLevel > maxLevel) {
return maxLevel; return maxLevel;
} }
else {
return skillLevel; return skillLevel;
} }
}
/** /**
* Get the max power level for a player. * Get the max power level for a player.
@ -310,8 +305,7 @@ public class Misc {
if (levelCap > 0) { if (levelCap > 0) {
return levelCap; return levelCap;
} }
else {
return Integer.MAX_VALUE; return Integer.MAX_VALUE;
} }
} }
}

View File

@ -154,10 +154,9 @@ public class ModChecks {
if (customToolsEnabled && toolInstance.customTools.containsKey(item.getTypeId())) { if (customToolsEnabled && toolInstance.customTools.containsKey(item.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
} }
}
/** /**
* Checks to see if an item is custom armor. * Checks to see if an item is custom armor.
@ -169,8 +168,7 @@ public class ModChecks {
if (customArmorEnabled && armorInstance.customArmor.containsKey(item.getTypeId())) { if (customArmorEnabled && armorInstance.customArmor.containsKey(item.getTypeId())) {
return true; return true;
} }
else {
return false; return false;
} }
} }
}

View File

@ -15,7 +15,7 @@ public class Page {
String[] addressSplit = LocaleLoader.getString(address).split("\n"); String[] addressSplit = LocaleLoader.getString(address).split("\n");
if(addressSplit.length <= 8) if(addressSplit.length <= 8)
return 1; return 1;
else
return (addressSplit.length/8)+1; return (addressSplit.length/8)+1;
} }

View File

@ -56,10 +56,9 @@ public class Skills {
if (currentTime - oldTime >= (adjustedCooldown * Misc.TIME_CONVERSION_FACTOR)) { if (currentTime - oldTime >= (adjustedCooldown * Misc.TIME_CONVERSION_FACTOR)) {
return true; return true;
} }
else {
return false; return false;
} }
}
/** /**
* Calculate the time remaining until the cooldown expires. * Calculate the time remaining until the cooldown expires.
@ -324,10 +323,9 @@ public class Skills {
if (getSkillType(skillName) != null) { if (getSkillType(skillName) != null) {
return true; return true;
} }
else {
return false; return false;
} }
}
/** /**
* Check if the player has any combat skill permissions. * Check if the player has any combat skill permissions.
@ -343,10 +341,9 @@ public class Skills {
|| Permissions.unarmed(player)) { || Permissions.unarmed(player)) {
return true; return true;
} }
else {
return false; return false;
} }
}
/** /**
* Check if the player has any gathering skill permissions. * Check if the player has any gathering skill permissions.
@ -362,10 +359,9 @@ public class Skills {
|| Permissions.woodcutting(player)) { || Permissions.woodcutting(player)) {
return true; return true;
} }
else {
return false; return false;
} }
}
/** /**
* Check if the player has any misc skill permissions. * Check if the player has any misc skill permissions.
@ -377,10 +373,9 @@ public class Skills {
if (Permissions.acrobatics(player) || Permissions.repair(player)) { if (Permissions.acrobatics(player) || Permissions.repair(player)) {
return true; return true;
} }
else {
return false; return false;
} }
}
/** /**
* Handle tool durability loss from abilities. * Handle tool durability loss from abilities.

View File

@ -8,8 +8,8 @@ public class ChunkletManagerFactory {
if(hConfig.getChunkletsEnabled()) { if(hConfig.getChunkletsEnabled()) {
return new HashChunkletManager(); return new HashChunkletManager();
} else { }
return new NullChunkletManager(); return new NullChunkletManager();
} }
} }
}

View File

@ -65,14 +65,14 @@ public class HashChunkletManager implements ChunkletManager {
File yFile = new File(czDir, "" + y); File yFile = new File(czDir, "" + y);
if(!yFile.exists()) { if(!yFile.exists()) {
continue; continue;
} else { }
ChunkletStore in = deserializeChunkletStore(yFile); ChunkletStore in = deserializeChunkletStore(yFile);
if(in != null) { if(in != null) {
store.put(world.getName() + "," + cx + "," + cz + "," + y, in); store.put(world.getName() + "," + cx + "," + cz + "," + y, in);
} }
} }
} }
}
@Override @Override
public void unloadChunk(int cx, int cz, World world) { public void unloadChunk(int cx, int cz, World world) {

View File

@ -8,8 +8,8 @@ public class ChunkManagerFactory {
if(hConfig.getChunkletsEnabled()) { if(hConfig.getChunkletsEnabled()) {
return new HashChunkManager(); return new HashChunkManager();
} else { }
return new NullChunkManager(); return new NullChunkManager();
} }
} }
}

View File

@ -61,9 +61,9 @@ public class HashChunkManager implements ChunkManager {
Object o = objectStream.readObject(); Object o = objectStream.readObject();
if (o instanceof ChunkStore) { if (o instanceof ChunkStore) {
return (ChunkStore) o; return (ChunkStore) o;
} else {
throw new RuntimeException("Wrong class type read for chunk meta data for " + x + ", " + z);
} }
throw new RuntimeException("Wrong class type read for chunk meta data for " + x + ", " + z);
} catch (IOException e) { } catch (IOException e) {
// Assume the format changed // Assume the format changed
return null; return null;

View File

@ -84,10 +84,9 @@ public class ZipLibrary {
if (path == null || path.isEmpty()) { if (path == null || path.isEmpty()) {
return file; return file;
} }
else {
return path + File.separator + file; return path + File.separator + file;
} }
}
private static void zipDir(ZipOutputStream zos, String path, File dir) throws IOException { private static void zipDir(ZipOutputStream zos, String path, File dir) throws IOException {
if (!dir.canRead()) { if (!dir.canRead()) {

View File

@ -216,9 +216,9 @@ public class mcMMOSimpleRegionFile {
if (old != null && old == used) { if (old != null && old == used) {
if (old) { if (old) {
throw new IllegalStateException("Attempting to overwrite an in-use segment"); throw new IllegalStateException("Attempting to overwrite an in-use segment");
} else {
throw new IllegalStateException("Attempting to delete empty segment");
} }
throw new IllegalStateException("Attempting to delete empty segment");
} }
} }
@ -271,9 +271,9 @@ public class mcMMOSimpleRegionFile {
private synchronized int sizeToSegments(int size) { private synchronized int sizeToSegments(int size) {
if (size <= 0) { if (size <= 0) {
return 1; return 1;
} else {
return ((size - 1) >> segmentSize) + 1;
} }
return ((size - 1) >> segmentSize) + 1;
} }
private synchronized Integer getChunkIndex(int x, int z) { private synchronized Integer getChunkIndex(int x, int z) {