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

@ -65,9 +65,8 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) {
return true;
}
else {
return false;
}
return false;
}
}
@ -114,9 +113,8 @@ public class BlockChecks {
if (block.getTypeId() == Config.getInstance().getRepairAnvilId() || block.getTypeId() == Config.getInstance().getSalvageAnvilId()) {
return false;
}
else {
return true;
}
return true;
}
}
@ -142,9 +140,8 @@ public class BlockChecks {
if (customBlocksEnabled && ModChecks.isCustomOreBlock(block)) {
return true;
}
else {
return false;
}
return false;
}
}
@ -198,9 +195,8 @@ public class BlockChecks {
if (block.getData() == CropState.RIPE.getData()) {
return true;
}
else {
return false;
}
return false;
default:
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
@ -208,9 +204,8 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
return true;
}
else {
return false;
}
return false;
}
}
@ -245,9 +240,8 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) {
return true;
}
else {
return false;
}
return false;
}
}
@ -274,9 +268,8 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
return true;
}
else {
return false;
}
return false;
}
}
@ -299,9 +292,8 @@ public class BlockChecks {
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
return true;
}
else {
return false;
}
return false;
}
}
@ -309,8 +301,7 @@ public class BlockChecks {
if (block.getType().equals(Material.LOG) || (customBlocksEnabled && ModChecks.isCustomLogBlock(block))) {
return true;
}
else {
return false;
}
return false;
}
}

View File

@ -172,9 +172,8 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customHelmetIDs.contains(is.getTypeId())) {
return true;
}
else {
return false;
}
return false;
}
}
@ -196,9 +195,8 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customChestplateIDs.contains(is.getTypeId())) {
return true;
}
else {
return false;
}
return false;
}
}
@ -220,9 +218,8 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customLeggingIDs.contains(is.getTypeId())) {
return true;
}
else {
return false;
}
return false;
}
}
@ -244,9 +241,8 @@ public class ItemChecks {
if (customArmorEnabled && CustomArmorConfig.getInstance().customBootIDs.contains(is.getTypeId())) {
return true;
}
else {
return false;
}
return false;
}
}

View File

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

View File

@ -398,23 +398,22 @@ 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) {
final Iterator<Graph> iter = graphs.iterator();
}
while (iter.hasNext()) {
final Graph graph = iter.next();
// Is this the first update this hour?
if (response.contains("OK This is your first update this hour")) {
synchronized (graphs) {
final Iterator<Graph> iter = graphs.iterator();
for (Plotter plotter : graph.getPlotters()) {
plotter.reset();
}
while (iter.hasNext()) {
final Graph graph = iter.next();
for (Plotter plotter : graph.getPlotters()) {
plotter.reset();
}
}
}
}
//if (response.startsWith("OK")) - We should get "OK" followed by an optional description if everything goes right
}
/**

View File

@ -92,9 +92,8 @@ public class Misc {
if (isInt(string)) {
return Integer.parseInt(string);
}
else {
return 0;
}
return 0;
}
/**
@ -113,9 +112,8 @@ public class Misc {
if (le.getNoDamageTicks() > le.getMaximumNoDamageTicks() / 2.0F && event.getDamage() <= le.getLastDamage()) {
return true;
}
else {
return false;
}
return false;
}
/**
@ -145,9 +143,8 @@ public class Misc {
if (!damageEvent.isCancelled() && !breakEvent.isCancelled()) {
return true;
}
else {
return false;
}
return false;
}
/**
@ -197,9 +194,8 @@ public class Misc {
if (first.distanceSquared(second) < (maxDistance * maxDistance)) {
return true;
}
else {
return false;
}
return false;
}
/**
@ -294,9 +290,8 @@ public class Misc {
if (skillLevel > maxLevel) {
return maxLevel;
}
else {
return skillLevel;
}
return skillLevel;
}
/**
@ -310,8 +305,7 @@ public class Misc {
if (levelCap > 0) {
return levelCap;
}
else {
return Integer.MAX_VALUE;
}
return Integer.MAX_VALUE;
}
}

View File

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

View File

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

View File

@ -56,9 +56,8 @@ public class Skills {
if (currentTime - oldTime >= (adjustedCooldown * Misc.TIME_CONVERSION_FACTOR)) {
return true;
}
else {
return false;
}
return false;
}
/**
@ -324,9 +323,8 @@ public class Skills {
if (getSkillType(skillName) != null) {
return true;
}
else {
return false;
}
return false;
}
/**
@ -343,9 +341,8 @@ public class Skills {
|| Permissions.unarmed(player)) {
return true;
}
else {
return false;
}
return false;
}
/**
@ -362,9 +359,8 @@ public class Skills {
|| Permissions.woodcutting(player)) {
return true;
}
else {
return false;
}
return false;
}
/**
@ -377,9 +373,8 @@ public class Skills {
if (Permissions.acrobatics(player) || Permissions.repair(player)) {
return true;
}
else {
return false;
}
return false;
}
/**

View File

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

View File

@ -65,11 +65,11 @@ 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);
}
}
ChunkletStore in = deserializeChunkletStore(yFile);
if(in != null) {
store.put(world.getName() + "," + cx + "," + cz + "," + y, in);
}
}
}

View File

@ -8,8 +8,8 @@ public class ChunkManagerFactory {
if(hConfig.getChunkletsEnabled()) {
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();
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;