mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-08 09:27:38 +01:00
Fixed a few code smells
This commit is contained in:
parent
6aff686763
commit
6f16c28591
@ -85,7 +85,7 @@ public class TabbedPanel extends Panel implements PanelListener {
|
||||
|
||||
// Remove any tabs that have no items, if required
|
||||
if (tpb.isHideIfEmpty()) {
|
||||
tpb.getTabs().values().removeIf(t -> !t.equals(tab) && !t.getPanelItems().stream().anyMatch(Objects::nonNull));
|
||||
tpb.getTabs().values().removeIf(t -> !t.equals(tab) && t.getPanelItems().stream().noneMatch(Objects::nonNull));
|
||||
}
|
||||
|
||||
// Set up the tabbed header
|
||||
|
@ -62,8 +62,7 @@ public class JSONDatabaseHandler<T> extends AbstractJSONDatabaseHandler<T> {
|
||||
list.add(object);
|
||||
} else {
|
||||
plugin.logError("JSON file created a null object: " + file.getPath());
|
||||
// Required to keep OS file handlers low and not rely on GC NOSONAR
|
||||
reader.close();
|
||||
reader.close(); // NOSONAR Required to keep OS file handlers low and not rely on GC
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
plugin.logError("Could not load file '" + file.getName() + "': File not found.");
|
||||
|
@ -61,8 +61,6 @@ public class IslandDeletionManager implements Listener {
|
||||
}
|
||||
});
|
||||
}
|
||||
// Remove the islands from the database so they don't come back
|
||||
//toBeRemoved.forEach(handler::deleteObject);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
|
@ -36,7 +36,8 @@ import world.bentobox.bentobox.lists.Flags;
|
||||
*/
|
||||
public class SettingsTab implements Tab, ClickHandler {
|
||||
|
||||
protected static final String PROTECTION_PANEL = "protection.panel.";
|
||||
private static final String PROTECTION_PANEL = "protection.panel.";
|
||||
private static final String CLICK_TO_SWITCH = PROTECTION_PANEL + "mode.click-to-switch";
|
||||
protected BentoBox plugin = BentoBox.getInstance();
|
||||
protected Flag.Type type;
|
||||
protected User user;
|
||||
@ -138,7 +139,7 @@ public class SettingsTab implements Tab, ClickHandler {
|
||||
icons.put(7, new PanelItemBuilder().icon(Material.GOLD_INGOT)
|
||||
.name(user.getTranslation(PROTECTION_PANEL + "mode.advanced.name"))
|
||||
.description(user.getTranslation(PROTECTION_PANEL + "mode.advanced.description"), "",
|
||||
user.getTranslation(PROTECTION_PANEL + "mode.click-to-switch",
|
||||
user.getTranslation(CLICK_TO_SWITCH,
|
||||
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.expert.name")))
|
||||
.clickHandler(this)
|
||||
.build());
|
||||
@ -147,7 +148,7 @@ public class SettingsTab implements Tab, ClickHandler {
|
||||
icons.put(7, new PanelItemBuilder().icon(Material.NETHER_BRICK)
|
||||
.name(user.getTranslation(PROTECTION_PANEL + "mode.expert.name"))
|
||||
.description(user.getTranslation(PROTECTION_PANEL + "mode.expert.description"), "",
|
||||
user.getTranslation(PROTECTION_PANEL + "mode.click-to-switch",
|
||||
user.getTranslation(CLICK_TO_SWITCH,
|
||||
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.basic.name")))
|
||||
.clickHandler(this)
|
||||
.build());
|
||||
@ -156,7 +157,7 @@ public class SettingsTab implements Tab, ClickHandler {
|
||||
icons.put(7, new PanelItemBuilder().icon(Material.IRON_INGOT)
|
||||
.name(user.getTranslation(PROTECTION_PANEL + "mode.basic.name"))
|
||||
.description(user.getTranslation(PROTECTION_PANEL + "mode.basic.description"), "",
|
||||
user.getTranslation(PROTECTION_PANEL + "mode.click-to-switch",
|
||||
user.getTranslation(CLICK_TO_SWITCH,
|
||||
TextVariables.NEXT, user.getTranslation(PROTECTION_PANEL + "mode.advanced.name")))
|
||||
.clickHandler(this)
|
||||
.build());
|
||||
|
Loading…
Reference in New Issue
Block a user