mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-07 07:51:41 +01:00
Fixed some code smells
This commit is contained in:
parent
160749c065
commit
9f676636e0
@ -106,7 +106,7 @@ public class BentoBox extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
islandsManager = new IslandsManager(this);
|
||||
ranksManager = new RanksManager(this);
|
||||
ranksManager = new RanksManager();
|
||||
|
||||
// Start head getter
|
||||
headGetter = new HeadGetter(this);
|
||||
|
@ -85,7 +85,7 @@ public class JoinLeaveListener implements Listener {
|
||||
OfflinePlayer owner = Bukkit.getOfflinePlayer(island.getOwner());
|
||||
|
||||
// Converting the setting (in days) to milliseconds.
|
||||
long inactivityThreshold = plugin.getSettings().getAutoOwnershipTransferInactivityThreshold() * 24 * 60 * 60 * 1000;
|
||||
long inactivityThreshold = plugin.getSettings().getAutoOwnershipTransferInactivityThreshold() * 24 * 60 * 60 * 1000L;
|
||||
long timestamp = System.currentTimeMillis() - inactivityThreshold;
|
||||
|
||||
// We make sure the current owner is inactive.
|
||||
|
@ -24,12 +24,11 @@ public class BlockInteractionListener extends FlagListener {
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerInteract(final PlayerInteractEvent e) {
|
||||
// For some items, we need to do a specific check for RIGHT_CLICK_BLOCK
|
||||
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||
if (e.getClickedBlock().getType().equals(Material.ITEM_FRAME)) {
|
||||
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)
|
||||
&& e.getClickedBlock().getType().equals(Material.ITEM_FRAME)) {
|
||||
checkIsland(e, e.getClickedBlock().getLocation(), Flags.ITEM_FRAME);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, we just don't care about the RIGHT_CLICK_BLOCK action.
|
||||
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||
|
@ -29,17 +29,11 @@ public class RanksManager {
|
||||
public static final int VISITOR_RANK = 0;
|
||||
public static final int BANNED_RANK = -1;
|
||||
|
||||
private BentoBox plugin;
|
||||
|
||||
// The store of ranks
|
||||
private LinkedHashMap<String, Integer> ranks = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* @param plugin - plugin object
|
||||
*/
|
||||
public RanksManager(BentoBox plugin) {
|
||||
public RanksManager() {
|
||||
super();
|
||||
this.plugin = plugin;
|
||||
// Hard coded ranks
|
||||
ranksPut(ADMIN_RANK_REF, ADMIN_RANK);
|
||||
ranksPut(MOD_RANK_REF, MOD_RANK);
|
||||
|
@ -31,9 +31,7 @@ public class RanksManagerTest {
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
BentoBox plugin = mock(BentoBox.class);
|
||||
|
||||
ranksManager = new RanksManager(plugin);
|
||||
ranksManager = new RanksManager();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user