Fixed some code smells

Added TextVariables#NEXT
This commit is contained in:
Florian CUNY 2019-08-13 10:53:07 +02:00
parent 90fd6a625f
commit 537b854c75
4 changed files with 13 additions and 7 deletions

View File

@ -17,4 +17,8 @@ public class TextVariables {
public static final String SPAWN_HERE = "[spawn_here]"; public static final String SPAWN_HERE = "[spawn_here]";
public static final String VERSION = "[version]"; public static final String VERSION = "[version]";
public static final String START_TEXT = "[start]"; public static final String START_TEXT = "[start]";
/**
* @since 1.6.0
*/
public static final String NEXT = "[next]";
} }

View File

@ -56,8 +56,6 @@ public class BlueprintPaster {
private Location pos1; private Location pos1;
// The maximum block position (x,y,z) // The maximum block position (x,y,z)
private Location pos2; private Location pos2;
// Speed of pasting
private int pasteSpeed;
private PasteState pasteState; private PasteState pasteState;
private BukkitTask pastingTask; private BukkitTask pastingTask;
private BlueprintClipboard clipboard; private BlueprintClipboard clipboard;
@ -113,7 +111,7 @@ public class BlueprintPaster {
// Initial state & speed // Initial state & speed
pasteState = PasteState.BLOCKS; pasteState = PasteState.BLOCKS;
pasteSpeed = plugin.getSettings().getPasteSpeed(); final int pasteSpeed = plugin.getSettings().getPasteSpeed();
pastingTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> { pastingTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
int count = 0; int count = 0;

View File

@ -1188,7 +1188,7 @@ public class Island implements DataObject {
* @since 1.6.0 * @since 1.6.0
*/ */
public boolean isReserved() { public boolean isReserved() {
return reserved == null ? false : reserved; return reserved != null && reserved;
} }
/** /**

View File

@ -14,6 +14,7 @@ import org.bukkit.event.inventory.ClickType;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.flags.Flag; import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.flags.Flag.Type; import world.bentobox.bentobox.api.flags.Flag.Type;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.panels.Panel; import world.bentobox.bentobox.api.panels.Panel;
import world.bentobox.bentobox.api.panels.PanelItem; import world.bentobox.bentobox.api.panels.PanelItem;
import world.bentobox.bentobox.api.panels.PanelItem.ClickHandler; import world.bentobox.bentobox.api.panels.PanelItem.ClickHandler;
@ -134,7 +135,8 @@ public class SettingsTab implements Tab, ClickHandler {
icons.put(7, new PanelItemBuilder().icon(Material.GOLD_INGOT) icons.put(7, new PanelItemBuilder().icon(Material.GOLD_INGOT)
.name(user.getTranslation(PROTECTION_PANEL + "mode.advanced.name")) .name(user.getTranslation(PROTECTION_PANEL + "mode.advanced.name"))
.description(user.getTranslation(PROTECTION_PANEL + "mode.advanced.description"), "", .description(user.getTranslation(PROTECTION_PANEL + "mode.advanced.description"), "",
user.getTranslation(PROTECTION_PANEL + "mode.click-to-switch", "[next]", user.getTranslation(PROTECTION_PANEL + "mode.expert.name"))) user.getTranslation(PROTECTION_PANEL + "mode.click-to-switch",
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.expert.name")))
.clickHandler(this) .clickHandler(this)
.build()); .build());
break; break;
@ -142,7 +144,8 @@ public class SettingsTab implements Tab, ClickHandler {
icons.put(7, new PanelItemBuilder().icon(Material.NETHER_BRICK) icons.put(7, new PanelItemBuilder().icon(Material.NETHER_BRICK)
.name(user.getTranslation(PROTECTION_PANEL + "mode.expert.name")) .name(user.getTranslation(PROTECTION_PANEL + "mode.expert.name"))
.description(user.getTranslation(PROTECTION_PANEL + "mode.expert.description"), "", .description(user.getTranslation(PROTECTION_PANEL + "mode.expert.description"), "",
user.getTranslation(PROTECTION_PANEL + "mode.click-to-switch", "[next]", user.getTranslation(PROTECTION_PANEL + "mode.basic.name"))) user.getTranslation(PROTECTION_PANEL + "mode.click-to-switch",
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.basic.name")))
.clickHandler(this) .clickHandler(this)
.build()); .build());
break; break;
@ -150,7 +153,8 @@ public class SettingsTab implements Tab, ClickHandler {
icons.put(7, new PanelItemBuilder().icon(Material.IRON_INGOT) icons.put(7, new PanelItemBuilder().icon(Material.IRON_INGOT)
.name(user.getTranslation(PROTECTION_PANEL + "mode.basic.name")) .name(user.getTranslation(PROTECTION_PANEL + "mode.basic.name"))
.description(user.getTranslation(PROTECTION_PANEL + "mode.basic.description"), "", .description(user.getTranslation(PROTECTION_PANEL + "mode.basic.description"), "",
user.getTranslation(PROTECTION_PANEL + "mode.click-to-switch", "[next]", user.getTranslation(PROTECTION_PANEL + "mode.advanced.name"))) user.getTranslation(PROTECTION_PANEL + "mode.click-to-switch",
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.advanced.name")))
.clickHandler(this) .clickHandler(this)
.build()); .build());
} }