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,42 +43,41 @@ public class InspectCommand implements CommandExecutor {
return true; return true;
} }
else {
if (sender instanceof Player && !sender.isOp() && !Permissions.inspectOfflineBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true;
}
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", new Object[] { args[0] }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR) }));
if (sender instanceof Player && !sender.isOp() && !Permissions.inspectOfflineBypass((Player) sender)) {
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
return true; return true;
} }
PlayerProfile profile = new PlayerProfile(args[0], false); //Temporary Profile
if (!profile.isLoaded()) {
sender.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
return true;
}
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", new Object[] { args[0] }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING) }));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED) }));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
sender.sendMessage(LocaleLoader.getString("Skills.Stats", new Object[] { LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS) }));
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: default:
sender.sendMessage(usage); sender.sendMessage(usage);
return true; return true;

View File

@ -62,46 +62,45 @@ public class MctopCommand implements CommandExecutor {
return true; return true;
} }
} }
else {
String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
switch (args.length) { String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing";
case 0:
sqlDisplay(1, powerlevel, sender);
return true;
case 1: switch (args.length) {
if (Misc.isInt(args[0])) { case 0:
sqlDisplay(Integer.valueOf(args[0]), powerlevel, sender); sqlDisplay(1, powerlevel, sender);
} return true;
else if (Skills.isSkill(args[0])) {
sqlDisplay(1, args[0].toLowerCase(), sender);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
return true; case 1:
if (Misc.isInt(args[0])) {
sqlDisplay(Integer.valueOf(args[0]), powerlevel, sender);
}
else if (Skills.isSkill(args[0])) {
sqlDisplay(1, args[0].toLowerCase(), sender);
}
else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
}
case 2: return true;
if (!Skills.isSkill(args[0])) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
return true;
}
if (Misc.isInt(args[1])) { case 2:
sqlDisplay(Integer.valueOf(args[1]), args[0].toLowerCase(), sender); if (!Skills.isSkill(args[0])) {
} sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true; return true;
} }
if (Misc.isInt(args[1])) {
sqlDisplay(Integer.valueOf(args[1]), args[0].toLowerCase(), sender);
}
else {
sender.sendMessage(usage);
}
return true;
default:
sender.sendMessage(usage);
return true;
} }
} }

View File

@ -56,16 +56,14 @@ 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;
}
}
else {
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true; return true;
} }
player.sendMessage(LocaleLoader.getString("Party.Player.Invalid"));
return true;
default: default:
sender.sendMessage(usage); sender.sendMessage(usage);
return true; return true;

View File

@ -186,18 +186,17 @@ 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();
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.KICKED_FROM_PARTY);
plugin.getServer().getPluginManager().callEvent(event); String partyName = party.getName();
McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, partyName, null, EventReason.KICKED_FROM_PARTY);
if (event.isCancelled()) { plugin.getServer().getPluginManager().callEvent(event);
return true;
}
partyManagerInstance.removeFromParty(args[1], party); if (event.isCancelled()) {
return true;
} }
partyManagerInstance.removeFromParty(args[1], party);
} }
else { else {
player.sendMessage(LocaleLoader.getString("Party.NotOwner")); player.sendMessage(LocaleLoader.getString("Party.NotOwner"));
@ -209,9 +208,8 @@ 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 {

View File

@ -48,9 +48,8 @@ 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) {

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,9 +209,8 @@ 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) {
@ -226,9 +225,8 @@ public class McMMOPlayer {
if (party != null) { if (party != null) {
return true; return true;
} }
else {
return false; return false;
}
} }
public void removeParty() { public void removeParty() {

View File

@ -96,89 +96,88 @@ 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);
if (huds.get(1) == null) { HashMap<Integer, ArrayList<String>> huds = database.read("SELECT hudtype FROM " + tablePrefix + "huds WHERE user_id = " + userId);
database.write("INSERT INTO " + tablePrefix + "huds (user_id) VALUES (" + userId + ")");
} if (huds.get(1) == null) {
else { database.write("INSERT INTO " + tablePrefix + "huds (user_id) VALUES (" + userId + ")");
for (HudType type : HudType.values()) { }
if (type.toString().equals(huds.get(1).get(0))) { else {
hudType = type; for (HudType type : HudType.values()) {
} if (type.toString().equals(huds.get(1).get(0))) {
hudType = type;
} }
} }
/*
* I'm still learning MySQL, this is a fix for adding a new table
* its not pretty but it works
*/
HashMap<Integer, ArrayList<String>> cooldowns = database.read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes, blast_mining FROM " + tablePrefix + "cooldowns WHERE user_id = " + userId);
ArrayList<String> cooldownValues = cooldowns.get(1);
if (cooldownValues == null) {
database.write("INSERT INTO " + tablePrefix + "cooldowns (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the cooldown table. Their cooldowns will be reset.");
}
else {
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(cooldownValues.get(0)));
skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(cooldownValues.get(1)));
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(cooldownValues.get(2)));
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(cooldownValues.get(3)));
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(cooldownValues.get(4)));
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(cooldownValues.get(5)));
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldownValues.get(6)));
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(cooldownValues.get(7)));
}
HashMap<Integer, ArrayList<String>> stats = database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM " + tablePrefix + "skills WHERE user_id = " + userId);
ArrayList<String> statValues = stats.get(1);
if (statValues == null) {
database.write("INSERT INTO " + tablePrefix + "skills (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the skills table. Their stats will be reset.");
}
else {
skills.put(SkillType.TAMING, Integer.valueOf(statValues.get(0)));
skills.put(SkillType.MINING, Integer.valueOf(statValues.get(1)));
skills.put(SkillType.REPAIR, Integer.valueOf(statValues.get(2)));
skills.put(SkillType.WOODCUTTING, Integer.valueOf(statValues.get(3)));
skills.put(SkillType.UNARMED, Integer.valueOf(statValues.get(4)));
skills.put(SkillType.HERBALISM, Integer.valueOf(statValues.get(5)));
skills.put(SkillType.EXCAVATION, Integer.valueOf(statValues.get(6)));
skills.put(SkillType.ARCHERY, Integer.valueOf(statValues.get(7)));
skills.put(SkillType.SWORDS, Integer.valueOf(statValues.get(8)));
skills.put(SkillType.AXES, Integer.valueOf(statValues.get(9)));
skills.put(SkillType.ACROBATICS, Integer.valueOf(statValues.get(10)));
skills.put(SkillType.FISHING, Integer.valueOf(statValues.get(11)));
}
HashMap<Integer, ArrayList<String>> experience = database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM " + tablePrefix + "experience WHERE user_id = " + userId);
ArrayList<String> experienceValues = experience.get(1);
if (experienceValues == null) {
database.write("INSERT INTO " + tablePrefix + "experience (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the experience table. Their experience will be reset.");
}
else {
skillsXp.put(SkillType.TAMING, Integer.valueOf(experienceValues.get(0)));
skillsXp.put(SkillType.MINING, Integer.valueOf(experienceValues.get(1)));
skillsXp.put(SkillType.REPAIR, Integer.valueOf(experienceValues.get(2)));
skillsXp.put(SkillType.WOODCUTTING, Integer.valueOf(experienceValues.get(3)));
skillsXp.put(SkillType.UNARMED, Integer.valueOf(experienceValues.get(4)));
skillsXp.put(SkillType.HERBALISM, Integer.valueOf(experienceValues.get(5)));
skillsXp.put(SkillType.EXCAVATION, Integer.valueOf(experienceValues.get(6)));
skillsXp.put(SkillType.ARCHERY, Integer.valueOf(experienceValues.get(7)));
skillsXp.put(SkillType.SWORDS, Integer.valueOf(experienceValues.get(8)));
skillsXp.put(SkillType.AXES, Integer.valueOf(experienceValues.get(9)));
skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(experienceValues.get(10)));
skillsXp.put(SkillType.FISHING, Integer.valueOf(experienceValues.get(11)));
}
loaded = true;
return true;
} }
/*
* I'm still learning MySQL, this is a fix for adding a new table
* its not pretty but it works
*/
HashMap<Integer, ArrayList<String>> cooldowns = database.read("SELECT mining, woodcutting, unarmed, herbalism, excavation, swords, axes, blast_mining FROM " + tablePrefix + "cooldowns WHERE user_id = " + userId);
ArrayList<String> cooldownValues = cooldowns.get(1);
if (cooldownValues == null) {
database.write("INSERT INTO " + tablePrefix + "cooldowns (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the cooldown table. Their cooldowns will be reset.");
}
else {
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(cooldownValues.get(0)));
skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(cooldownValues.get(1)));
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(cooldownValues.get(2)));
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(cooldownValues.get(3)));
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(cooldownValues.get(4)));
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(cooldownValues.get(5)));
skillsDATS.put(AbilityType.SKULL_SPLIITER, Integer.valueOf(cooldownValues.get(6)));
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(cooldownValues.get(7)));
}
HashMap<Integer, ArrayList<String>> stats = database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM " + tablePrefix + "skills WHERE user_id = " + userId);
ArrayList<String> statValues = stats.get(1);
if (statValues == null) {
database.write("INSERT INTO " + tablePrefix + "skills (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the skills table. Their stats will be reset.");
}
else {
skills.put(SkillType.TAMING, Integer.valueOf(statValues.get(0)));
skills.put(SkillType.MINING, Integer.valueOf(statValues.get(1)));
skills.put(SkillType.REPAIR, Integer.valueOf(statValues.get(2)));
skills.put(SkillType.WOODCUTTING, Integer.valueOf(statValues.get(3)));
skills.put(SkillType.UNARMED, Integer.valueOf(statValues.get(4)));
skills.put(SkillType.HERBALISM, Integer.valueOf(statValues.get(5)));
skills.put(SkillType.EXCAVATION, Integer.valueOf(statValues.get(6)));
skills.put(SkillType.ARCHERY, Integer.valueOf(statValues.get(7)));
skills.put(SkillType.SWORDS, Integer.valueOf(statValues.get(8)));
skills.put(SkillType.AXES, Integer.valueOf(statValues.get(9)));
skills.put(SkillType.ACROBATICS, Integer.valueOf(statValues.get(10)));
skills.put(SkillType.FISHING, Integer.valueOf(statValues.get(11)));
}
HashMap<Integer, ArrayList<String>> experience = database.read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics, fishing FROM " + tablePrefix + "experience WHERE user_id = " + userId);
ArrayList<String> experienceValues = experience.get(1);
if (experienceValues == null) {
database.write("INSERT INTO " + tablePrefix + "experience (user_id) VALUES (" + userId + ")");
mcMMO.p.getLogger().warning(playerName + "does not exist in the experience table. Their experience will be reset.");
}
else {
skillsXp.put(SkillType.TAMING, Integer.valueOf(experienceValues.get(0)));
skillsXp.put(SkillType.MINING, Integer.valueOf(experienceValues.get(1)));
skillsXp.put(SkillType.REPAIR, Integer.valueOf(experienceValues.get(2)));
skillsXp.put(SkillType.WOODCUTTING, Integer.valueOf(experienceValues.get(3)));
skillsXp.put(SkillType.UNARMED, Integer.valueOf(experienceValues.get(4)));
skillsXp.put(SkillType.HERBALISM, Integer.valueOf(experienceValues.get(5)));
skillsXp.put(SkillType.EXCAVATION, Integer.valueOf(experienceValues.get(6)));
skillsXp.put(SkillType.ARCHERY, Integer.valueOf(experienceValues.get(7)));
skillsXp.put(SkillType.SWORDS, Integer.valueOf(experienceValues.get(8)));
skillsXp.put(SkillType.AXES, Integer.valueOf(experienceValues.get(9)));
skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(experienceValues.get(10)));
skillsXp.put(SkillType.FISHING, Integer.valueOf(experienceValues.get(11)));
}
loaded = true;
return true;
} }
public void addMySQLPlayer() { public void addMySQLPlayer() {
@ -1175,9 +1174,8 @@ 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) {
@ -1193,9 +1191,8 @@ public class PlayerProfile {
if (party != null) { if (party != null) {
return true; return true;
} }
else {
return false; return false;
}
} }
public void removeParty() { public void removeParty() {

View File

@ -57,9 +57,8 @@ 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() {

View File

@ -136,11 +136,10 @@ 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;
}
} }
} }

View File

@ -83,61 +83,65 @@ public class BlockStoreConversionZDirectory implements Runnable {
this.manager.loadChunk(this.cx, this.cz, this.world); 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.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.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName);
if(this.currentChunk != null) { this.chunkName = this.world.getName() + "," + this.cx + "," + this.cz;
this.xPos = this.cx * 16; this.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName);
this.zPos = this.cz * 16;
for(this.x = 0; this.x < 16; this.x++) { if (this.currentChunk != null) {
for(this.z = 0; this.z < 16; this.z++) { this.xPos = this.cx * 16;
this.cxPos = this.xPos + this.x; this.zPos = this.cz * 16;
this.czPos = this.zPos + this.z;
for(this.y2 = (64 * this.y); this.y2 < (64 * this.y + 64); this.y2++) { for (this.x = 0; this.x < 16; this.x++) {
try { for(this.z = 0; this.z < 16; this.z++) {
if(!this.manager.isTrue(this.cxPos, this.y2, this.czPos, this.world)) this.cxPos = this.xPos + this.x;
continue; this.czPos = this.zPos + this.z;
this.newManager.setTrue(this.cxPos, this.y2, this.czPos, this.world); for(this.y2 = (64 * this.y); this.y2 < (64 * this.y + 64); this.y2++) {
} try {
catch(Exception e) {} if(!this.manager.isTrue(this.cxPos, this.y2, this.czPos, this.world))
continue;
this.newManager.setTrue(this.cxPos, this.y2, this.czPos, this.world);
} }
catch(Exception e) {}
} }
} }
continue;
} }
continue;
}
this.newManager.setTrue(this.cx * 16, 0, this.cz * 16, this.world); this.newManager.setTrue(this.cx * 16, 0, this.cz * 16, this.world);
this.newManager.setFalse(this.cx * 16, 0, this.cz * 16, this.world); this.newManager.setFalse(this.cx * 16, 0, this.cz * 16, this.world);
this.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName); this.currentChunk = (PrimitiveChunkStore) this.newManager.store.get(this.chunkName);
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++) { for(this.z = 0; this.z < 16; this.z++) {
if(this.primitiveChunklet != null) if(this.primitiveChunklet != null)
this.oldArray = this.primitiveChunklet.store[x][z]; this.oldArray = this.primitiveChunklet.store[x][z];
if(this.primitiveExChunklet != null) if(this.primitiveExChunklet != null)
this.oldArray = this.primitiveExChunklet.store[x][z]; this.oldArray = this.primitiveExChunklet.store[x][z];
else else
return; return;
this.newArray = this.currentChunk.store[x][z]; this.newArray = this.currentChunk.store[x][z];
if(this.oldArray.length < 64) if(this.oldArray.length < 64)
return; return;
else if(this.newArray.length < ((this.y * 64) + 64)) else if(this.newArray.length < ((this.y * 64) + 64))
return; return;
System.arraycopy(this.oldArray, 0, this.newArray, (this.y * 64), 64); System.arraycopy(this.oldArray, 0, this.newArray, (this.y * 64), 64);
}
} }
} }
} }

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,9 +327,8 @@ 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;
}
} }
/** /**

View File

@ -69,47 +69,45 @@ 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) {
case OBSIDIAN:
if (tier < Mining.DIAMOND_TOOL_TIER) {
return false;
}
/* FALL THROUGH */
case DIAMOND_ORE: switch (blockType) {
case GLOWING_REDSTONE_ORE: case OBSIDIAN:
case GOLD_ORE: if (tier < Mining.DIAMOND_TOOL_TIER) {
case LAPIS_ORE:
case REDSTONE_ORE:
case EMERALD_ORE:
if (tier < Mining.IRON_TOOL_TIER) {
return false;
}
/* FALL THROUGH */
case IRON_ORE:
if (tier < Mining.STONE_TOOL_TIER) {
return false;
}
/* FALL THROUGH */
case COAL_ORE:
case ENDER_STONE:
case GLOWSTONE:
case MOSSY_COBBLESTONE:
case NETHERRACK:
case SANDSTONE:
case STONE:
return true;
default:
return false; return false;
} }
/* FALL THROUGH */
case DIAMOND_ORE:
case GLOWING_REDSTONE_ORE:
case GOLD_ORE:
case LAPIS_ORE:
case REDSTONE_ORE:
case EMERALD_ORE:
if (tier < Mining.IRON_TOOL_TIER) {
return false;
}
/* FALL THROUGH */
case IRON_ORE:
if (tier < Mining.STONE_TOOL_TIER) {
return false;
}
/* FALL THROUGH */
case COAL_ORE:
case ENDER_STONE:
case GLOWSTONE:
case MOSSY_COBBLESTONE:
case NETHERRACK:
case SANDSTONE:
case STONE:
return true;
default:
return false;
} }
} }

View File

@ -187,9 +187,8 @@ 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;
}
} }
/** /**

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,15 +195,14 @@ public class TamingManager {
eventHandler.sendInsufficientAmountMessage(); eventHandler.sendInsufficientAmountMessage();
return; return;
} }
if (eventHandler.nearbyEntityExists()) {
eventHandler.sendFailureMessage();
}
else { else {
if (eventHandler.nearbyEntityExists()) { eventHandler.spawnCreature();
eventHandler.sendFailureMessage(); eventHandler.processResourceCost();
} eventHandler.sendSuccessMessage();
else {
eventHandler.spawnCreature();
eventHandler.processResourceCost();
eventHandler.sendSuccessMessage();
}
} }
} }

View File

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

View File

@ -65,9 +65,8 @@ 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;
}
} }
} }
@ -114,9 +113,8 @@ 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;
}
} }
} }
@ -142,9 +140,8 @@ public class BlockChecks {
if (customBlocksEnabled && ModChecks.isCustomOreBlock(block)) { if (customBlocksEnabled && ModChecks.isCustomOreBlock(block)) {
return true; return true;
} }
else {
return false; return false;
}
} }
} }
@ -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,9 +204,8 @@ 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;
}
} }
} }
@ -245,9 +240,8 @@ 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;
}
} }
} }
@ -274,9 +268,8 @@ 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;
}
} }
} }
@ -299,9 +292,8 @@ 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;
}
} }
} }
@ -309,8 +301,7 @@ public class BlockChecks {
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,9 +172,8 @@ 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;
}
} }
} }
@ -196,9 +195,8 @@ 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;
}
} }
} }
@ -220,9 +218,8 @@ 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;
}
} }
} }
@ -244,9 +241,8 @@ 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;
}
} }
} }

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,23 +398,22 @@ 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?
if (response.contains("OK This is your first update this hour")) {
synchronized (graphs) {
final Iterator<Graph> iter = graphs.iterator();
while (iter.hasNext()) { // Is this the first update this hour?
final Graph graph = iter.next(); if (response.contains("OK This is your first update this hour")) {
synchronized (graphs) {
final Iterator<Graph> iter = graphs.iterator();
for (Plotter plotter : graph.getPlotters()) { while (iter.hasNext()) {
plotter.reset(); 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)) { if (isInt(string)) {
return Integer.parseInt(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()) { if (le.getNoDamageTicks() > le.getMaximumNoDamageTicks() / 2.0F && event.getDamage() <= le.getLastDamage()) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -145,9 +143,8 @@ public class Misc {
if (!damageEvent.isCancelled() && !breakEvent.isCancelled()) { if (!damageEvent.isCancelled() && !breakEvent.isCancelled()) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -197,9 +194,8 @@ public class Misc {
if (first.distanceSquared(second) < (maxDistance * maxDistance)) { if (first.distanceSquared(second) < (maxDistance * maxDistance)) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -294,9 +290,8 @@ public class Misc {
if (skillLevel > maxLevel) { if (skillLevel > maxLevel) {
return maxLevel; return maxLevel;
} }
else {
return skillLevel; return skillLevel;
}
} }
/** /**
@ -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,9 +154,8 @@ 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;
}
} }
/** /**
@ -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,8 +15,8 @@ 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;
} }
public static ArrayList<String> grabPageContents(String header, String address, int pagenum) 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)) { if (currentTime - oldTime >= (adjustedCooldown * Misc.TIME_CONVERSION_FACTOR)) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -324,9 +323,8 @@ public class Skills {
if (getSkillType(skillName) != null) { if (getSkillType(skillName) != null) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -343,9 +341,8 @@ public class Skills {
|| Permissions.unarmed(player)) { || Permissions.unarmed(player)) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -362,9 +359,8 @@ public class Skills {
|| Permissions.woodcutting(player)) { || Permissions.woodcutting(player)) {
return true; return true;
} }
else {
return false; return false;
}
} }
/** /**
@ -377,9 +373,8 @@ 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;
}
} }
/** /**

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

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,9 +84,8 @@ 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 {

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) {