From edfe465ad556fff0d35d44f5378a061a3d32fd57 Mon Sep 17 00:00:00 2001 From: drtshock Date: Mon, 17 Nov 2014 14:30:41 -0600 Subject: [PATCH] Add missing return statements. --- .../factions/cmd/CmdDeinvite.java | 1 + .../massivecraft/factions/cmd/CmdKick.java | 1 + .../massivecraft/factions/cmd/CmdShow.java | 90 +++++++++---------- .../factions/cmd/CmdShowInvites.java | 2 - 4 files changed, 46 insertions(+), 48 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java index 12b6da66..70f588c4 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java @@ -36,6 +36,7 @@ public class CmdDeinvite extends FCommand { msg.then(name + " ").color(ChatColor.WHITE).tooltip("Click to revoke invite for " + name).command("f deinvite " + name); } sendFancyMessage(msg); + return; } if (you.getFaction() == myFaction) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java index 3aa2c26e..74d3053d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java @@ -47,6 +47,7 @@ public class CmdKick extends FCommand { } sendFancyMessage(msg); + return; } if (fme == toKick) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java index 5ebac12f..e75d0afa 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java @@ -7,12 +7,10 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; -import com.massivecraft.factions.struct.Role; import mkremins.fanciful.FancyMessage; import org.bukkit.ChatColor; import java.util.ArrayList; -import java.util.Collection; public class CmdShow extends FCommand { @@ -47,10 +45,6 @@ public class CmdShow extends FCommand { return; } - Collection admins = faction.getFPlayersWhereRole(Role.ADMIN); - Collection mods = faction.getFPlayersWhereRole(Role.MODERATOR); - Collection normals = faction.getFPlayersWhereRole(Role.NORMAL); - msg(p.txt.titleize(faction.getTag(fme))); msg("Description: %s", faction.getDescription()); if (!faction.isNormal()) { @@ -88,46 +82,48 @@ public class CmdShow extends FCommand { } } - ArrayList allies = new ArrayList(); - ArrayList enemies = new ArrayList(); - FancyMessage currentAllies = new FancyMessage("Allies: ").color(ChatColor.GOLD); - FancyMessage currentEnemies = new FancyMessage("Enemies: ").color(ChatColor.GOLD); + ArrayList allies = new ArrayList(); + ArrayList enemies = new ArrayList(); + FancyMessage currentAllies = new FancyMessage("Allies: ").color(ChatColor.GOLD); + FancyMessage currentEnemies = new FancyMessage("Enemies: ").color(ChatColor.GOLD); - boolean firstAlly = true; - boolean firstEnemy = true; - for (Faction otherFaction : Factions.getInstance().getAllFactions()) { - if (otherFaction == faction) { - continue; - } + boolean firstAlly = true; + boolean firstEnemy = true; + for (Faction otherFaction : Factions.getInstance().getAllFactions()) { + if (otherFaction == faction) { + continue; + } - Relation rel = otherFaction.getRelationTo(faction); - String s = otherFaction.getTag(fme); - if (rel.isAlly()) { - if (firstAlly) - currentAllies.then(s).tooltip(getToolTips(otherFaction)); - else - currentAllies.then(", " + s).tooltip(getToolTips(otherFaction)); - firstAlly = false; + Relation rel = otherFaction.getRelationTo(faction); + String s = otherFaction.getTag(fme); + if (rel.isAlly()) { + if (firstAlly) { + currentAllies.then(s).tooltip(getToolTips(otherFaction)); + } else { + currentAllies.then(", " + s).tooltip(getToolTips(otherFaction)); + } + firstAlly = false; - if (currentAllies.toJSONString().length() >= 32700) { // Client gets kicked at 32767, some leniency - allies.add(currentAllies); - currentAllies = new FancyMessage(); - } - } else if (rel.isEnemy()) { - if (firstEnemy) - currentEnemies.then(s).tooltip(getToolTips(otherFaction)); - else - currentEnemies.then(", " + s).tooltip(getToolTips(otherFaction)); - firstEnemy = false; + if (currentAllies.toJSONString().length() >= 32700) { // Client gets kicked at 32767, some leniency + allies.add(currentAllies); + currentAllies = new FancyMessage(); + } + } else if (rel.isEnemy()) { + if (firstEnemy) { + currentEnemies.then(s).tooltip(getToolTips(otherFaction)); + } else { + currentEnemies.then(", " + s).tooltip(getToolTips(otherFaction)); + } + firstEnemy = false; - if (currentEnemies.toJSONString().length() >= 32700) { // Client gets kicked at 32767, some leniency - enemies.add(currentEnemies); - currentEnemies = new FancyMessage(); - } - } - } - allies.add(currentAllies); - enemies.add(currentEnemies); + if (currentEnemies.toJSONString().length() >= 32700) { // Client gets kicked at 32767, some leniency + enemies.add(currentEnemies); + currentEnemies = new FancyMessage(); + } + } + } + allies.add(currentAllies); + enemies.add(currentEnemies); FancyMessage online = new FancyMessage("Members online: ").color(ChatColor.GOLD); FancyMessage offline = new FancyMessage("Members offline: ").color(ChatColor.GOLD); @@ -136,16 +132,18 @@ public class CmdShow extends FCommand { for (FPlayer p : faction.getFPlayers()) { String name = p.getNameAndTitle(); if (p.isOnline()) { - if (firstOnline) + if (firstOnline) { online.then(name).tooltip(getToolTips(p)); - else + } else { online.then(", " + name).tooltip(getToolTips(p)); + } firstOnline = false; } else { - if (firstOffline) + if (firstOffline) { offline.then(name).tooltip(getToolTips(p)); - else + } else { offline.then(", " + name).tooltip(getToolTips(p)); + } firstOffline = false; } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java b/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java index 07eab21b..c730bcd6 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java @@ -27,8 +27,6 @@ public class CmdShowInvites extends FCommand { } sendFancyMessage(msg); - - }