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;
}
else {
if (sender instanceof Player && !sender.isOp() && !Permissions.inspectOfflineBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
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) }));
return true;
}
default:
sender.sendMessage(usage);

View File

@ -62,7 +62,7 @@ public class MctopCommand implements CommandExecutor {
return true;
}
}
else {
String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
switch (args.length) {
@ -103,7 +103,6 @@ public class MctopCommand implements CommandExecutor {
return true;
}
}
}
private void flatfileDisplay(int page, String skill, CommandSender sender) {
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"));
return true;
}
else {
player.sendMessage(LocaleLoader.getString("Party.Locked"));
return true;
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true;
}
default:
sender.sendMessage(usage);

View File

@ -186,7 +186,7 @@ public class PartyCommand implements CommandExecutor {
player.sendMessage(LocaleLoader.getString("Party.NotInYourParty", new Object[] {args[1]}));
return true;
}
else {
String partyName = party.getName();
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);
}
}
else {
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]}));
return true;
}
else {
partyManagerInstance.setPartyLeader(args[1], party);
}
}
}
else {
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) {
return getStringIncludingInts(config, "MySQL.Database.User_Password");
}
else {
return "";
}
}
private static String getStringIncludingInts(ConfigurationSection cfg, String key) {
String str = cfg.getString(key);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -83,24 +83,29 @@ public class BlockStoreConversionZDirectory implements Runnable {
this.manager.loadChunk(this.cx, this.cz, this.world);
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.tempChunklet = this.manager.store.get(this.chunkletName);
if(this.tempChunklet instanceof PrimitiveChunkletStore)
if (this.tempChunklet instanceof PrimitiveChunkletStore) {
this.primitiveChunklet = (PrimitiveChunkletStore) this.tempChunklet;
else if(this.tempChunklet instanceof PrimitiveExChunkletStore)
}
else if (this.tempChunklet instanceof PrimitiveExChunkletStore) {
this.primitiveExChunklet = (PrimitiveExChunkletStore) this.tempChunklet;
if(this.tempChunklet == null) {
}
if (this.tempChunklet == null) {
continue;
} else {
}
this.chunkName = this.world.getName() + "," + this.cx + "," + this.cz;
this.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName);
if(this.currentChunk != null) {
if (this.currentChunk != null) {
this.xPos = this.cx * 16;
this.zPos = this.cz * 16;
for(this.x = 0; this.x < 16; this.x++) {
for (this.x = 0; this.x < 16; this.x++) {
for(this.z = 0; this.z < 16; this.z++) {
this.cxPos = this.xPos + this.x;
this.czPos = this.zPos + this.z;
@ -140,7 +145,6 @@ public class BlockStoreConversionZDirectory implements Runnable {
}
}
}
}
this.manager.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) {
return true;
}
else {
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)))) {
return true;
}
else {
return false;
}
}
/**
* Check for double drops.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -65,11 +65,10 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) {
return true;
}
else {
return false;
}
}
}
/**
* 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()) {
return false;
}
else {
return true;
}
}
}
/**
* Check if a block type is an ore.
@ -142,11 +140,10 @@ public class BlockChecks {
if (customBlocksEnabled && ModChecks.isCustomOreBlock(block)) {
return true;
}
else {
return false;
}
}
}
/**
* Check if a block can be made mossy.
@ -198,9 +195,8 @@ public class BlockChecks {
if (block.getData() == CropState.RIPE.getData()) {
return true;
}
else {
return false;
}
default:
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
@ -208,11 +204,10 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
return true;
}
else {
return false;
}
}
}
/**
* 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)) {
return true;
}
else {
return false;
}
}
}
/**
* 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)) {
return true;
}
else {
return false;
}
}
}
/**
* Checks if the block is affected by Tree Feller.
@ -299,18 +292,16 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
return true;
}
else {
return false;
}
}
}
public static boolean isLog (Block block){
if (block.getType().equals(Material.LOG) || (customBlocksEnabled && ModChecks.isCustomLogBlock(block))) {
return true;
}
else {
return false;
}
}
}

View File

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

View File

@ -55,9 +55,8 @@ public class Leaderboard {
if (players.contains(p)) {
continue;
}
else {
players.add(p);
}
if (character.length > 1 && Misc.isInt(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")) {
throw new IOException(response); //Throw the exception
} else {
}
// Is this the first update this hour?
if (response.contains("OK This is your first update this hour")) {
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

View File

@ -92,10 +92,9 @@ public class Misc {
if (isInt(string)) {
return Integer.parseInt(string);
}
else {
return 0;
}
}
/**
* 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()) {
return true;
}
else {
return false;
}
}
/**
* Simulate a block break event.
@ -145,10 +143,9 @@ public class Misc {
if (!damageEvent.isCancelled() && !breakEvent.isCancelled()) {
return true;
}
else {
return false;
}
}
/**
* Get the upgrade tier of the item in hand.
@ -197,10 +194,9 @@ public class Misc {
if (first.distanceSquared(second) < (maxDistance * maxDistance)) {
return true;
}
else {
return false;
}
}
/**
* Determine if a string represents an Integer
@ -294,10 +290,9 @@ public class Misc {
if (skillLevel > maxLevel) {
return maxLevel;
}
else {
return skillLevel;
}
}
/**
* Get the max power level for a player.
@ -310,8 +305,7 @@ public class Misc {
if (levelCap > 0) {
return levelCap;
}
else {
return Integer.MAX_VALUE;
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -61,9 +61,9 @@ public class HashChunkManager implements ChunkManager {
Object o = objectStream.readObject();
if (o instanceof ChunkStore) {
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) {
// Assume the format changed
return null;

View File

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

View File

@ -216,9 +216,9 @@ public class mcMMOSimpleRegionFile {
if (old != null && old == used) {
if (old) {
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) {
if (size <= 0) {
return 1;
} else {
return ((size - 1) >> segmentSize) + 1;
}
return ((size - 1) >> segmentSize) + 1;
}
private synchronized Integer getChunkIndex(int x, int z) {