Fixed code smells

This commit is contained in:
Florian CUNY 2019-03-24 15:47:25 +01:00
parent 2912ae18d2
commit 5073d9cf5c
17 changed files with 84 additions and 121 deletions

View File

@ -1,17 +1,10 @@
package world.bentobox.bentobox.api.flags;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.configuration.WorldSettings;
@ -26,6 +19,12 @@ import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.RanksManager;
import world.bentobox.bentobox.util.Util;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
public class Flag implements Comparable<Flag> {
/**
@ -304,15 +303,15 @@ public class Flag implements Comparable<Flag> {
case PROTECTION:
return createProtectionFlag(plugin, user, island, pib).build();
case SETTING:
return createSettingFlag(plugin, user, island, pib).build();
return createSettingFlag(user, island, pib).build();
case WORLD_SETTING:
return createWorldSettingFlag(plugin, user, pib).build();
return createWorldSettingFlag(user, pib).build();
default:
return pib.build();
}
}
private PanelItemBuilder createWorldSettingFlag(BentoBox plugin, User user, PanelItemBuilder pib) {
private PanelItemBuilder createWorldSettingFlag(User user, PanelItemBuilder pib) {
String worldSetting = this.isSetForWorld(user.getWorld()) ? user.getTranslation("protection.panel.flag-item.setting-active")
: user.getTranslation("protection.panel.flag-item.setting-disabled");
pib.description(user.getTranslation("protection.panel.flag-item.setting-layout", TextVariables.DESCRIPTION, user.getTranslation(getDescriptionReference())
@ -320,7 +319,7 @@ public class Flag implements Comparable<Flag> {
return pib;
}
private PanelItemBuilder createSettingFlag(BentoBox plugin, User user, Island island, PanelItemBuilder pib) {
private PanelItemBuilder createSettingFlag(User user, Island island, PanelItemBuilder pib) {
if (island != null) {
String islandSetting = island.isAllowed(this) ? user.getTranslation("protection.panel.flag-item.setting-active")
: user.getTranslation("protection.panel.flag-item.setting-disabled");

View File

@ -10,7 +10,6 @@ import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.util.Util;
import world.bentobox.bentobox.util.teleport.SafeSpotTeleport;
@ -48,7 +47,7 @@ public class PortalTeleportationListener implements Listener {
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public boolean onEndIslandPortal(PlayerPortalEvent e) {
if (e.getFrom() == null || e.getCause() != TeleportCause.END_PORTAL) {
if (e.getCause() != TeleportCause.END_PORTAL) {
return false;
}
World fromWorld = e.getFrom().getWorld();
@ -109,7 +108,7 @@ public class PortalTeleportationListener implements Listener {
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public boolean onNetherPortal(PlayerPortalEvent e) {
if (e.getFrom() == null || e.getCause() != TeleportCause.NETHER_PORTAL) {
if (e.getCause() != TeleportCause.NETHER_PORTAL) {
return false;
}
World fromWorld = e.getFrom().getWorld();

View File

@ -11,10 +11,12 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.lists.Flags;
import java.util.Optional;
/**
* Handle interaction with blocks
* @author tastybento
@ -285,17 +287,15 @@ public class BlockInteractionListener extends FlagListener {
*/
@EventHandler(priority = EventPriority.LOWEST)
public void onDragonEggTeleport(BlockFromToEvent e) {
Block from = e.getBlock();
if (!from.getType().equals(Material.DRAGON_EGG) || !getIWM().inWorld(from.getLocation())) {
Block block = e.getBlock();
if (!block.getType().equals(Material.DRAGON_EGG) || !getIWM().inWorld(block.getLocation())) {
return;
}
// If egg starts in a protected island...
getIslands().getProtectedIslandAt(from.getLocation()).ifPresent(fromIsland -> {
// Cancel if toIsland is not fromIsland or if there is no protected island there
// This protects against eggs dropping into adjacent islands, e.g. island distance and protection range are equal
e.setCancelled(getIslands().getProtectedIslandAt(e.getToBlock().getLocation()).map(toIsland -> {
return toIsland != fromIsland;
}).orElse(true));
});
// Cancel if toIsland is not fromIsland or if there is no protected island there
// This protects against eggs dropping into adjacent islands, e.g. island distance and protection range are equal
Optional<Island> fromIsland = getIslands().getProtectedIslandAt(block.getLocation());
Optional<Island> toIsland = getIslands().getProtectedIslandAt(e.getToBlock().getLocation());
fromIsland.ifPresent(from -> e.setCancelled(toIsland.map(to -> to != from).orElse(true)));
}
}

View File

@ -1,8 +1,5 @@
package world.bentobox.bentobox.listeners.flags.protection;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Animals;
import org.bukkit.event.EventHandler;
@ -10,10 +7,12 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
import java.util.Arrays;
import java.util.List;
/**
* Handles breeding protection
* Note - animal protection is done elsewhere.
@ -40,7 +39,7 @@ public class BreedingListener extends FlagListener {
if (e.getHand().equals(EquipmentSlot.OFF_HAND)) {
inHand = e.getPlayer().getInventory().getItemInOffHand();
}
if (inHand != null && BREEDING_ITEMS.contains(inHand.getType()) && !checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.BREEDING)) {
if (BREEDING_ITEMS.contains(inHand.getType()) && !checkIsland(e, e.getPlayer(), e.getRightClicked().getLocation(), Flags.BREEDING)) {
((Animals)e.getRightClicked()).setBreed(false);
}
}

View File

@ -9,7 +9,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
@ -27,11 +26,9 @@ public class BucketListener extends FlagListener {
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
if (e.getBlockClicked() != null) {
// This is where the water or lava actually will be dumped
Block dumpBlock = e.getBlockClicked().getRelative(e.getBlockFace());
checkIsland(e, e.getPlayer(), dumpBlock.getLocation(), Flags.BUCKET);
}
// This is where the water or lava actually will be dumped
Block dumpBlock = e.getBlockClicked().getRelative(e.getBlockFace());
checkIsland(e, e.getPlayer(), dumpBlock.getLocation(), Flags.BUCKET);
}
/**

View File

@ -12,7 +12,6 @@ import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.BlockIterator;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
@ -76,7 +75,7 @@ public class FireListener extends FlagListener {
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent e) {
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getMaterial() != null
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)
&& (e.getMaterial() == Material.FLINT_AND_STEEL || e.getMaterial() == Material.FIRE_CHARGE)) {
checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.FLINT_AND_STEEL);
}

View File

@ -1,7 +1,5 @@
package world.bentobox.bentobox.listeners.flags.protection;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
@ -20,12 +18,13 @@ import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.potion.PotionEffect;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
import world.bentobox.bentobox.util.Util;
import java.util.HashMap;
/**
* Handles hurting of monsters and animals directly and indirectly
@ -165,10 +164,6 @@ public class HurtingListener extends FlagListener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onLingeringPotionDamage(final EntityDamageByEntityEvent e) {
if (e.getEntity() == null || e.getEntity().getUniqueId() == null) {
return;
}
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && thrownPotions.containsKey(e.getDamager().getEntityId())) {
Player attacker = thrownPotions.get(e.getDamager().getEntityId());
// Self damage

View File

@ -6,7 +6,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerLeashEntityEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.player.PlayerUnleashEntityEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
@ -42,7 +41,7 @@ public class LeashListener extends FlagListener {
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerLeashHitch(final HangingPlaceEvent e) {
if (e.getEntity() != null && e.getEntity().getType().equals(EntityType.LEASH_HITCH)) {
if (e.getEntity().getType().equals(EntityType.LEASH_HITCH)) {
checkIsland(e, e.getPlayer(), e.getEntity().getLocation(), Flags.LEASH);
}
}

View File

@ -7,7 +7,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityInteractEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
@ -66,8 +65,7 @@ public class PhysicalInteractionListener extends FlagListener {
return;
}
Projectile p = (Projectile)e.getEntity();
if (p.getShooter() instanceof Player && e.getBlock() != null) {
if (p.getShooter() instanceof Player) {
switch(e.getBlock().getType()) {
case ACACIA_BUTTON:
case BIRCH_BUTTON:

View File

@ -10,7 +10,6 @@ import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.EntityBlockFormEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
@ -50,7 +49,7 @@ public class PlaceBlocksListener extends FlagListener {
*/
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerInteract(final PlayerInteractEvent e) {
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK) || e.getClickedBlock() == null) {
return;
}
@ -62,26 +61,24 @@ public class PlaceBlocksListener extends FlagListener {
case POWERED_RAIL:
case DETECTOR_RAIL:
case ACTIVATOR_RAIL:
if (e.getMaterial() != null && (e.getMaterial() == Material.MINECART || e.getMaterial() == Material.CHEST_MINECART || e.getMaterial() == Material.HOPPER_MINECART
if ((e.getMaterial() == Material.MINECART || e.getMaterial() == Material.CHEST_MINECART || e.getMaterial() == Material.HOPPER_MINECART
|| e.getMaterial() == Material.TNT_MINECART || e.getMaterial() == Material.FURNACE_MINECART)) {
checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.MINECART);
}
return;
default:
// Check in-hand items
if (e.getMaterial() != null) {
if (e.getMaterial().equals(Material.FIREWORK_ROCKET)
|| e.getMaterial().equals(Material.ARMOR_STAND)
|| e.getMaterial().equals(Material.END_CRYSTAL)
|| e.getMaterial().equals(Material.ITEM_FRAME)
//|| Tag.DOORS.isTagged(e.getMaterial())
|| e.getMaterial().equals(Material.CHEST)
|| e.getMaterial().equals(Material.TRAPPED_CHEST)) {
checkIsland(e, e.getPlayer(), e.getPlayer().getLocation(), Flags.PLACE_BLOCKS);
}
else if (e.getMaterial().name().contains("BOAT")) {
checkIsland(e, e.getPlayer(), e.getPlayer().getLocation(), Flags.BOAT);
}
if (e.getMaterial().equals(Material.FIREWORK_ROCKET)
|| e.getMaterial().equals(Material.ARMOR_STAND)
|| e.getMaterial().equals(Material.END_CRYSTAL)
|| e.getMaterial().equals(Material.ITEM_FRAME)
//|| Tag.DOORS.isTagged(e.getMaterial())
|| e.getMaterial().equals(Material.CHEST)
|| e.getMaterial().equals(Material.TRAPPED_CHEST)) {
checkIsland(e, e.getPlayer(), e.getPlayer().getLocation(), Flags.PLACE_BLOCKS);
}
else if (e.getMaterial().name().contains("BOAT")) {
checkIsland(e, e.getPlayer(), e.getPlayer().getLocation(), Flags.BOAT);
}
}
}
@ -96,5 +93,4 @@ public class PlaceBlocksListener extends FlagListener {
checkIsland(e, (Player)e.getEntity(), e.getBlock().getLocation(), Flags.FROST_WALKER);
}
}
}

View File

@ -10,7 +10,6 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
@ -52,8 +51,8 @@ public class TNTListener extends FlagListener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onTNTPriming(PlayerInteractEvent e) {
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)
&& e.getClickedBlock() != null
&& e.getClickedBlock().getType().equals(Material.TNT)
&& e.getMaterial() != null
&& e.getMaterial().equals(Material.FLINT_AND_STEEL)) {
checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.BREAK_BLOCKS);
}
@ -66,7 +65,7 @@ public class TNTListener extends FlagListener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onExplosion(final EntityExplodeEvent e) {
// Remove any blocks from the explosion list if they are inside a protected area and if the entity was a TNT
if (e.getEntity() != null && e.getEntityType().equals(EntityType.PRIMED_TNT)
if (e.getEntityType().equals(EntityType.PRIMED_TNT)
&& e.blockList().removeIf(b -> getIslands().getProtectedIslandAt(b.getLocation()).map(i -> !i.isAllowed(Flags.TNT)).orElse(false))) {
// If any were removed, then prevent damage too
e.setCancelled(true);

View File

@ -4,7 +4,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;
@ -22,12 +21,10 @@ public class TeleportationListener extends FlagListener {
*/
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerTeleport(final PlayerTeleportEvent e) {
if (e.getCause() != null) {
if (e.getCause().equals(TeleportCause.ENDER_PEARL)) {
checkIsland(e, e.getPlayer(), e.getTo(), Flags.ENDER_PEARL);
} else if (e.getCause().equals(TeleportCause.CHORUS_FRUIT)) {
checkIsland(e, e.getPlayer(), e.getTo(), Flags.CHORUS_FRUIT);
}
if (e.getCause().equals(TeleportCause.ENDER_PEARL)) {
checkIsland(e, e.getPlayer(), e.getTo(), Flags.ENDER_PEARL);
} else if (e.getCause().equals(TeleportCause.CHORUS_FRUIT)) {
checkIsland(e, e.getPlayer(), e.getTo(), Flags.CHORUS_FRUIT);
}
}
}

View File

@ -1,18 +1,17 @@
package world.bentobox.bentobox.listeners.flags.settings;
import java.util.Optional;
import org.bukkit.entity.PufferFish;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.lists.Flags;
import world.bentobox.bentobox.util.Util;
import java.util.Optional;
/**
* Handles natural mob spawning.
@ -30,7 +29,7 @@ public class MobSpawnListener extends FlagListener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public boolean onNaturalMobSpawn(CreatureSpawnEvent e) {
// If not in the right world, return
if (e.getEntity() == null || !getIWM().inWorld(e.getEntity().getLocation())) {
if (!getIWM().inWorld(e.getEntity().getLocation())) {
return false;
}
// Deal with natural spawning

View File

@ -1,8 +1,5 @@
package world.bentobox.bentobox.listeners.flags.settings;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Entity;
@ -19,12 +16,14 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.LingeringPotionSplashEvent;
import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.event.player.PlayerFishEvent;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.lists.Flags;
import java.util.HashMap;
import java.util.UUID;
/**
* Handles PVP
* @author tastybento
@ -173,7 +172,7 @@ public class PVPListener extends FlagListener {
@EventHandler(priority = EventPriority.NORMAL)
public void onLingeringPotionDamage(AreaEffectCloudApplyEvent e) {
if (e.getEntity() != null && thrownPotions.containsKey(e.getEntity().getEntityId())) {
if (thrownPotions.containsKey(e.getEntity().getEntityId())) {
User user = User.getInstance(thrownPotions.get(e.getEntity().getEntityId()));
// Run through affected entities and delete them if they are safe
e.getAffectedEntities().removeIf(le -> !le.getUniqueId().equals(user.getUniqueId()) && blockPVP(user, le, e, getFlag(e.getEntity().getWorld())));

View File

@ -1,13 +1,5 @@
package world.bentobox.bentobox.managers;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
@ -17,13 +9,20 @@ import org.bukkit.World.Environment;
import org.bukkit.entity.EntityType;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.bentobox.api.configuration.WorldSettings;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.hooks.MultiverseCoreHook;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Handles registration and management of worlds
*
@ -142,7 +141,7 @@ public class IslandWorldManager {
* @param gameMode - game mode to add
* @throws NullPointerException - exception if the game mode overworld is null
*/
public void addGameMode(@NonNull GameModeAddon gameMode) throws NullPointerException {
public void addGameMode(@NonNull GameModeAddon gameMode) {
WorldSettings settings = gameMode.getWorldSettings();
World world = gameMode.getOverWorld();
if (world == null) {

View File

@ -1,16 +1,6 @@
package world.bentobox.bentobox.managers;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import com.google.common.collect.ImmutableMap;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -29,9 +19,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import com.google.common.collect.ImmutableMap;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.api.events.island.IslandEvent;
@ -48,6 +35,17 @@ import world.bentobox.bentobox.util.DeleteIslandChunks;
import world.bentobox.bentobox.util.Util;
import world.bentobox.bentobox.util.teleport.SafeSpotTeleport;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* The job of this class is manage all island related data.
* It also handles island ownership, including team, trustees, coops, etc.
@ -59,7 +57,7 @@ public class IslandsManager {
private BentoBox plugin;
// Tree species to boat material map
private final static Map<TreeSpecies, Material> TREE_TO_BOAT = ImmutableMap.<TreeSpecies, Material>builder().
private static final Map<TreeSpecies, Material> TREE_TO_BOAT = ImmutableMap.<TreeSpecies, Material>builder().
put(TreeSpecies.ACACIA, Material.ACACIA_BOAT).
put(TreeSpecies.BIRCH, Material.BIRCH_BOAT).
put(TreeSpecies.DARK_OAK, Material.DARK_OAK_BOAT).

View File

@ -1,10 +1,5 @@
/**
*
*/
package world.bentobox.bentobox.managers;
import static org.mockito.Mockito.when;
import org.eclipse.jdt.annotation.NonNull;
import org.junit.After;
import org.junit.Before;
@ -14,11 +9,12 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.AddonDescription;
import world.bentobox.bentobox.api.addons.GameModeAddon;
import static org.mockito.Mockito.when;
/**
* @author tastybento
*
@ -34,13 +30,8 @@ public class GameModePlaceholderManagerTest {
@Mock
private PlaceholdersManager pm;
private GameModePlaceholderManager gpm;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
gpm = new GameModePlaceholderManager(plugin);