diff --git a/README.md b/README.md old mode 100755 new mode 100644 index ed52b4e71..9f2ff6f6e --- a/README.md +++ b/README.md @@ -1,61 +1,2 @@ -BSkyBlock -========== - -[![Build Status](https://travis-ci.org/tastybento/bskyblock.svg?branch=master)](https://travis-ci.org/tastybento/bskyblock) -![Lines Of Code](https://sonarcloud.io/api/project_badges/measure?project=us.tastybento%3Abskyblock&metric=ncloc) -![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=us.tastybento%3Abskyblock&metric=sqale_rating) -![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=us.tastybento%3Abskyblock&metric=reliability_rating) -![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=us.tastybento%3Abskyblock&metric=security_rating) -![Bugs](https://sonarcloud.io/api/project_badges/measure?project=us.tastybento%3Abskyblock&metric=bugs) - - -A skyblock Bukkit plugin for Minecraft derived from the well-known ASkyBlock! -This is a survival game where the player starts with an island in the sky. - -BSkyBlock (Better SkyBlock) represents a turning point on ASkyBlock's history : Tastybento and Poslovitch thought and designed together this complete rewrite in order to provide a whole new way to play Skyblock. - -**Discover today BSkyBlock, its gameplay overhaul, and enjoy the Skyblock revival!** - -Add-ons -======= -BSkyBlock is built to enable add-ons (plugins that use the BSkyBlock API). Here is a list of the current ones: - -* Level - provides island level calculation and a top ten -* Welcome Warps - provides the warp sign feature - -You can find the projects on tastybento's GitHub. - -Bugs and Feature requests -========================= -File bug and feature requests here: https://github.com/tastybento/bskyblock/issues - -Note for developers -=================== -This is an actively developed project but we are not currently accepting Pull Requests from non-collaborators. Once we have finished the main development, we'll be open to PR's. - -Development Builds -================== -Jenkins: https://ci.codemc.org/job/Tastybento/job/bskyblock/ - -API -=== -Maven dependency: -```xml - - - codemc-repo - https://repo.codemc.org/repository/maven-public/ - - - - - - us.tastybento - bskyblock - FC-0.74 - provided - - -``` - -You can find the javadoc here: https://ci.codemc.org/job/Tastybento/job/bskyblock/javadoc/ +# bentobox +BentoBox Minecraft Plugin diff --git a/config.yml b/config.yml index 1cbaff04a..d2c46b4a7 100644 --- a/config.yml +++ b/config.yml @@ -1,10 +1,10 @@ -# BSkyBlock Configuration FC-0.7 +# BentoBox Configuration FC # This config file is dynamic and saved when the server is shutdown. # You cannot edit it while the server is running because changes will # be lost! Use in-game settings GUI or edit when server is offline. # general: - # BSkyBlock uses bStats.org to get global data about the plugin to help improving it. + # BentoBox uses bStats.org to get global data about the plugin to help improving it. # bStats has nearly no effect on your server's performance and the sent data is completely # anonymous so please consider twice if you really want to disable it. metrics: true @@ -62,272 +62,27 @@ general: allow-obsidian-scooping: true # Time in seconds that players have to confirm sensitive commands, e.g. island reset confirmation-time: 20 -world: - # Friendly name for this world. Used in admin commands. Must be a single word - friendly-name: BSkyBlock - # Name of the world - if it does not exist then it will be generated. - # It acts like a prefix for nether and end (e.g. BSkyBlock, BSkyBlock_nether, BSkyBlock_end) - world-name: BSkyBlock_world - # World difficulty setting - PEACEFUL, EASY, NORMAL, HARD - # Other plugins may override this setting - difficulty: NORMAL - # Radius of island in blocks. (So distance between islands is twice this) - # Will be rounded up to the nearest 16 blocks. - # It is the same for every dimension : Overworld, Nether and End. - # This value cannot be changed mid-game and the plugin will not start if it is different. - distance-between-islands: 64 - # Default protection range radius in blocks. Cannot be larger than distance. - # Admins can change protection sizes for players individually using /bsadmin setrange - # or set this permission: bskyblock.island.range. - protection-range: 50 - # Start islands at these coordinates. This is where new islands will start in the - # world. These must be a factor of your island distance, but the plugin will auto - # calculate the closest location on the grid. Islands develop around this location - # both positively and negatively in a square grid. - # If none of this makes sense, leave it at 0,0. - start-x: 0 - start-z: 0 - offset-x: 0 - offset-z: 0 - # Island height - Lowest is 5. - # It is the y coordinate of the bedrock block in the schem - island-height: 120 - # Use your own world generator for this world. In this case, the plugin will not generate - # anything. - use-own-generator: false - # Sea height (don't changes this mid-game unless you delete the world) - # Minimum is 0, which means you are playing Skyblock! - # If sea height is less than about 10, then players will drop right through it - # if it exists. Makes for an interesting variation on skyblock. - sea-height: 0 - # Maximum number of islands in the world. Set to 0 for unlimited. - # If the number of islands is greater than this number, no new island will be created. - max-islands: 0 - # The default game mode for this world. Players will be set to this mode when they create - # a new island for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR - default-game-mode: SURVIVAL - nether: - # Generate Nether - if this is false, the nether world will not be made and access to - # the nether will not occur. Other plugins may still enable portal usage. - # Note: Some challenges will not be possible if there is no nether. - # Note that with a standard nether all players arrive at the same portal and entering a - # portal will return them back to their islands. - generate: true - # Islands in Nether. Change to false for standard vanilla nether. - islands: true - # Nether trees are made if a player grows a tree in the nether (gravel and glowstone) - # Applies to both vanilla and islands Nether - trees: true - # Make the nether roof, if false, there is nothing up there - # Change to false if lag is a problem from the generation - # Only applies to islands Nether - roof: true - # Nether spawn protection radius - this is the distance around the nether spawn - # that will be protected from player interaction (breaking blocks, pouring lava etc.) - # Minimum is 0 (not recommended), maximum is 100. Default is 25. - # Only applies to vanilla nether - spawn-radius: 25 - end: - generate: true - islands: true - dragon-spawn: false - # Removing mobs - this kills all monsters in the vicinity. Benefit is that it helps - # players return to their island if the island has been overrun by monsters. - # This setting is toggled in world flags and set by the settings GUI. - # Mob white list - these mobs will NOT be removed when logging in or doing /island - remove-mobs-whitelist: - - ZOMBIE_VILLAGER - - WITHER - - PIG_ZOMBIE - - ENDERMAN - # World flags. These are boolean settings for various flags for this world - flags: - ENTER_EXIT_MESSAGES: true - ISLAND_RESPAWN: true - OFFLINE_REDSTONE: true - REMOVE_MOBS: true - # These are the default protection settings for new islands. - # The value is the minimum island rank required allowed to do the action - # Ranks are: Visitor = 0, Member = 900, Owner = 1000 - default-island-flags: - HURT_ANIMALS: 900 - COLLECT_WATER: 900 - REDSTONE: 900 - BUCKET: 900 - BUTTON: 900 - LOCK: 0 - FIRE_EXTINGUISH: 900 - ENDER_PEARL: 900 - DOOR: 900 - BEACON: 900 - TRAPDOOR: 900 - PRESSURE_PLATE: 900 - FURNACE: 900 - PLACE_BLOCKS: 900 - ANVIL: 900 - FIRE: 900 - CRAFTING: 900 - BREEDING: 900 - SHEARING: 900 - ENCHANTING: 900 - HURT_VILLAGERS: 900 - SPAWN_EGGS: 900 - BED: 900 - COLLECT_LAVA: 900 - MILKING: 900 - LEVER: 900 - RIDING: 900 - HURT_MONSTERS: 900 - ARMOR_STAND: 900 - GATE: 900 - TRADING: 900 - EGGS: 900 - ITEM_DROP: 900 - PORTAL: 900 - CHEST: 900 - NOTE_BLOCK: 900 - LEASH: 900 - MOUNT_INVENTORY: 900 - BREAK_BLOCKS: 900 - CHORUS_FRUIT: 900 - ITEM_PICKUP: 900 - CROP_TRAMPLE: 900 - JUKEBOX: 900 - BREWING: 900 - # These are the default settings for new islands - default-island-settings: - PVP_END: false - ANIMAL_SPAWN: true - PVP_NETHER: false - MONSTER_SPAWN: true - FIRE_SPREAD: true - PVP_OVERWORLD: false - # These are the settings visible to users. - visible-settings: [] - # Visitor banned commands - Visitors to islands cannot use these commands in this world - visitor-banned-commands: - - spawner - - spawnmob +panel: + close-on-click-outside: true island: - limits: - entities: {} - tile-entities: {} - # Default max team size - # Use this permission to set for specific user groups: askyblock.team.maxsize. - # Permission size cannot be less than the default below. - max-team-size: 4 - # Default maximum number of homes a player can have. Min = 1 - # Accessed via sethome or go - # Use this permission to set for specific user groups: askyblock.island.maxhomes. - max-homes: 1 - name: - # Island naming - # Only players with the TODO can name their island - # It is displayed in the top ten and enter and exit announcements - # It replaces the owner's name. Players can use & for color coding if they have the TODO permission - # These set the minimum and maximum size of a name. - min-length: 0 - max-length: 20 # How long a player must wait until they can rejoin a team island after being # kicked in minutes. This slows the effectiveness of players repeating challenges # by repetitively being invited to a team island. invite-wait: 60 - reset: - # How many resets a player is allowed (override with /asadmin clearreset ) - # Value of -1 means unlimited, 0 means hardcore - no resets. - # Example, 2 resets means they get 2 resets or 3 islands lifetime - reset-limit: -1 - # Kicked or leaving players lose resets - # Players who leave a team will lose an island reset chance - # If a player has zero resets left and leaves a team, they cannot make a new - # island by themselves and can only join a team. - # Leave this true to avoid players exploiting free islands - leavers-lose-reset: false - # Allow kicked players to keep their inventory. - # If false, kicked player's inventory will be thrown at the island leader if the - # kicked player is online and in the island world. - kicked-keep-inventory: false - on-join: - # What the plugin should reset when the player joins or creates an island - # Reset Money - if this is true, will reset the player's money to the starting money - # Recommendation is that this is set to true, but if you run multi-worlds - # make sure your economy handles multi-worlds too. - money: false - # Reset inventory - if true, the player's inventory will be cleared. - # Note: if you have MultiInv running or a similar inventory control plugin, that - # plugin may still reset the inventory when the world changes. - inventory: false - # Reset Ender Chest - if true, the player's Ender Chest will be cleared. - ender-chest: false - on-leave: - # What the plugin should reset when the player leaves or is kicked from an island - # Reset Money - if this is true, will reset the player's money to the starting money - # Recommendation is that this is set to true, but if you run multi-worlds - # make sure your economy handles multi-worlds too. - money: false - # Reset inventory - if true, the player's inventory will be cleared. - # Note: if you have MultiInv running or a similar inventory control plugin, that - # plugin may still reset the inventory when the world changes. - inventory: false - # Reset Ender Chest - if true, the player's Ender Chest will be cleared. - ender-chest: false require-confirmation: - reset: true # Ask the player to confirm the command he is using by typing it again. # The 'wait' value is the number of seconds to wait for confirmation. kick: true kick-wait: 10 leave: true leave-wait: 10 - # How long a player must wait before they can reset their island again in second + reset: true + # How long a player must wait before they can reset their island again in seconds reset-wait: 300 - make-island-if-none: false - # Immediately teleport player to their island (home 1 if it exists) when entering the world - immediate-teleport-on-island: false - # Have player's respawn on their island if they die - respawn-on-island: false - deaths: - # Maximum number of deaths to count. The death count can be used by add-ons. - max: 10 - sum-team: false - # When a player joins a team, reset their death count - team-join-reset: true + name: + # These set the minimum and maximum size of a name. + min-length: 4 + max-length: 20 customranks: {} -protection: - # Geo restrict mobs. - # Mobs that exit the island space where they were spawned will be removed. - geo-limit-settings: - - GHAST - - BAT - - BLAZE - # Invincible visitors. List of damages that will not affect visitors. - # Make list blank if visitors should receive all damages - invincible-visitors: - - BLOCK_EXPLOSION - - CONTACT - - CUSTOM - - DROWNING - - ENTITY_ATTACK - - ENTITY_EXPLOSION - - FALL - - FALLING_BLOCK - - FIRE - - FIRE_TICK - - LAVA - - LIGHTNING - - MAGIC - - POISON - - PROJECTILE - - STARVATION - - SUFFOCATION - - THORNS - - WITHER - - DRAGON_BREATH - - FLY_INTO_WALL - - HOT_FLOOR - - CRAMMING - - VOID -togglePvPCooldown: 0 -panel: - close-on-click-outside: true +# These settings should not be edited uniqueId: config diff --git a/plugin.yml b/plugin.yml index 1d44d1c9d..3f725c6ee 100755 --- a/plugin.yml +++ b/plugin.yml @@ -1,5 +1,5 @@ -name: BSkyBlock -main: us.tastybento.bskyblock.BSkyBlock +name: BentoBox +main: world.bentobox.bbox.BentoBox version: ${version} authors: [tastybento, Poslovitch] @@ -8,143 +8,3 @@ softdepend: [PlaceholderAPI, MVdWPlaceholderAPI] load: startup loadbefore: [Multiverse-Core] - -permissions: - bskyblock.*: - default: false - children: - bskyblock.island.*: - children: - bskyblock.island: - description: Allow island command usage - default: true - bskyblock.island.create: - description: Allow island creation - default: true - bskyblock.island.home: - description: Allow teleporting to player island - default: true - bskyblock.island.reset: - description: Player can use the island reset or restart command - default: true - bskyblock.island.sethome: - description: Let the player use the sethome command - default: true - bskyblock.island.info: - description: Let the player check their island level - default: true - bskyblock.island.sethome: - description: Let the player set their island teleport point - default: true - bskyblock.island.controlpanel: - description: Allows usage of the island GUI - default: true - bskyblock.island.lock: - description: Allows island locking - default: true - bskyblock.island.expel: - description: Allows expelling of visitors - default: true - bskyblock.island.ban: - description: Allows banning of visitors - default: true - bskyblock.island.settings: - description: Player can see server settings - default: true - bskyblock.island.lang: - description: Player can select a language - default: true - bskyblock.island.name: - description: Player can set the name of their island - default: true - bskyblock.island.spawn: - description: Player can use the island spawn command if spawn exists - default: true - bskyblock.island.reset: - description: Player can use the island reset or restart command - default: true - bskyblock.island.team: - description: Let a player use team commands - default: true - bskyblock.mod.*: - children: - bskyblock.mod.info: - description: Let a moderator see info on a player - default: op - bskyblock.mod.resethome: - description: Allows setting or reseting of a player's home position - default: op - bskyblock.mod.clearreset: - description: Allow clearing of island reset limit - default: false - bskyblock.mod.tp: - description: Allows teleport to an island - default: op - bskyblock.mod.bypassprotect: - description: Allow moderator to bypass island protection - default: op - bskyblock.mod.bypassexpel: - description: Allow moderator to bypass island expulsion - default: op - bskyblock.mod.topbreeders: - description: Lists most populated islands current loaded - default: op - bskyblock.mod.lock: - description: Locks or unlocks an island - default: op - bskyblock.mod.bypasslock: - description: Bypasses an island lock - default: op - bskyblock.mod.team: - description: Enables modification of teams via kick and add commands - default: false - bskyblock.mod.name: - description: Enables naming of player's islands - default: false - bskyblock.mod.resetname: - description: Enables reset of player's island names - default: false - bskyblock.admin.*: - children: - bskyblock.admin.clearresetall: - description: Allow clearing of island reset limit of all players - default: op - bskyblock.admin.reload: - description: Reload the config.yml - default: op - bskyblock.admin.delete: - description: Let a player completely remove a player (including island) - default: op - bskyblock.admin.deleteisland: - description: Let a player completely remove the island the player is on - default: op - bskyblock.admin.register: - description: Let a player register the nearest island to another player. - default: op - bskyblock.admin.unregister: - description: Removes a player from an island without deleting the island blocks. - default: op - bskyblock.admin.purge: - description: Let a player purge old islands. - default: op - bskyblock.admin.setspawn: - description: Allows use of spawn tools - default: op - bskyblock.admin.setrange: - description: Allows setting of island protection range - default: op - bskyblock.admin.topbreeders: - description: Lists most populated islands current loaded - default: op - bskyblock.admin.reserve: - description: Reserves an empty spot for a player's next island - default: op - bskyblock.admin.settingsreset: - description: Resets all the islands to default protection settings - default: op - bskyblock.admin.noban: - description: Player cannot be banned from an island - default: op - bskyblock.admin.setlanguage: - description: Resets all player languages and sets the default language - default: op \ No newline at end of file diff --git a/pom.xml b/pom.xml index 28412a116..b3257bc1e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,11 @@ - 4.0.0 - us.tastybento - bskyblock + world.bentobox + bentobox jar - FC-0.79 - BSkyBlock - The next generation of ASkyBlock + BentoBox 1.8 1.8 @@ -64,16 +63,38 @@ - + + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.0.0 + + -Xdoclint:none + + + + attach-javadocs + + jar + + + + @@ -180,4 +201,5 @@ https://hub.spigotmc.org/nexus/content/repositories/snapshots + 1.0 diff --git a/schems/end-island.schem b/schems/end-island.schem deleted file mode 100644 index 796334e67..000000000 Binary files a/schems/end-island.schem and /dev/null differ diff --git a/schems/island.schem b/schems/island.schem deleted file mode 100644 index 55a0e2f58..000000000 Binary files a/schems/island.schem and /dev/null differ diff --git a/schems/nether-island.schem b/schems/nether-island.schem deleted file mode 100644 index 5cd7841c3..000000000 Binary files a/schems/nether-island.schem and /dev/null differ diff --git a/src/main/java/us/tastybento/bskyblock/Settings.java b/src/main/java/us/tastybento/bskyblock/Settings.java deleted file mode 100644 index c264d7fa0..000000000 --- a/src/main/java/us/tastybento/bskyblock/Settings.java +++ /dev/null @@ -1,1503 +0,0 @@ -package us.tastybento.bskyblock; - -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; - -import org.bukkit.Difficulty; -import org.bukkit.GameMode; -import org.bukkit.entity.EntityType; - -import us.tastybento.bskyblock.api.addons.Addon; -import us.tastybento.bskyblock.api.configuration.ConfigComment; -import us.tastybento.bskyblock.api.configuration.ConfigEntry; -import us.tastybento.bskyblock.api.configuration.StoreAt; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.database.BSBDbSetup.DatabaseType; -import us.tastybento.bskyblock.database.objects.DataObject; -import us.tastybento.bskyblock.database.objects.adapters.Adapter; -import us.tastybento.bskyblock.database.objects.adapters.FlagSerializer; -import us.tastybento.bskyblock.database.objects.adapters.FlagSerializer2; - -/** - * All the plugin settings are here - * @author Tastybento - */ -@StoreAt(filename="config.yml") // Explicitly call out what name this should have. -@ConfigComment("BSkyBlock Configuration [version]") -@ConfigComment("This config file is dynamic and saved when the server is shutdown.") -@ConfigComment("You cannot edit it while the server is running because changes will") -@ConfigComment("be lost! Use in-game settings GUI or edit when server is offline.") -@ConfigComment("") -public class Settings implements DataObject, WorldSettings { - - // --------------------------------------------- - - /* GENERAL */ - @ConfigComment("BSkyBlock uses bStats.org to get global data about the plugin to help improving it.") - @ConfigComment("bStats has nearly no effect on your server's performance and the sent data is completely") - @ConfigComment("anonymous so please consider twice if you really want to disable it.") - @ConfigEntry(path = "general.metrics") - private boolean metrics = true; - - @ConfigComment("Check for updates - this will tell Ops and the console if there is a new") - @ConfigComment("version available. It contacts dev.bukkit.org to request the latest version") - @ConfigComment("info. It does not download the latest version or change any files") - @ConfigEntry(path = "general.check-updates") - private boolean checkUpdates = true; - - @ConfigComment("Default language for new players.") - @ConfigComment("This is the filename in the locale folder without .yml.") - @ConfigComment("If this does not exist, the default en-US will be used.") - @ConfigEntry(path = "general.default-language") - private String defaultLanguage = "en-US"; - - @ConfigComment("Use economy or not. If true, an economy plugin is required. If false, no money is used or give.") - @ConfigComment("If there is no economy plugin present anyway, money will be automatically disabled.") - @ConfigEntry(path = "general.use-economy") - private boolean useEconomy = true; - - @ConfigComment("Starting money - this is how much money new players will have as their") - @ConfigComment("balance at the start of an island.") - @ConfigEntry(path = "general.starting-money") - private double startingMoney = 10.0; - - // Purge - @ConfigComment("Only islands below this level will be removed if they are abandoned and admins issue the purge command") - @ConfigEntry(path = "general.purge.max-island-level") - private int purgeMaxIslandLevel = 50; - - @ConfigComment("Remove user data when its island gets purged.") - @ConfigComment("Helps a lot to avoid huge backups and can save some performance on startup,") - @ConfigComment("but the player settings and data will be reset.") - @ConfigEntry(path = "general.purge.remove-user-data") - private boolean purgeRemoveUserData = false; - - // Database - @ConfigComment("FLATFILE, MYSQL, MONGO") - @ConfigComment("if you use MONGO, you must also run the BSBMongo plugin (not addon)") - @ConfigComment("See https://github.com/tastybento/bsbMongo/releases/") - @ConfigEntry(path = "general.database.type") - private DatabaseType databaseType = DatabaseType.FLATFILE; - - @ConfigEntry(path = "general.database.host") - private String dbHost = "localhost"; - - @ConfigComment("Port 3306 is MySQL's default. Port 27017 is MongoDB's default.") - @ConfigEntry(path = "general.database.port") - private int dbPort = 3306; - - @ConfigEntry(path = "general.database.name") - private String dbName = "BSkyBlock"; - - @ConfigEntry(path = "general.database.username") - private String dbUsername = "username"; - - @ConfigEntry(path = "general.database.password") - private String dbPassword = "password"; - - @ConfigComment("How often the data will be saved to file in mins. Default is 5 minutes.") - @ConfigComment("This helps prevent issues if the server crashes.") - @ConfigComment("Data is also saved at important points in the game.") - @ConfigEntry(path = "general.database.backup-period") - private int databaseBackupPeriod = 5; - - @ConfigComment("Recover super flat - if the generator does not run for some reason, you can get") - @ConfigComment("super flat chunks (grass). To remove automatically, select this option. Turn off") - @ConfigComment("if there are no more because it may cause lag.") - @ConfigComment("This will regenerate any chunks with bedrock at y=0 when they are loaded") - @ConfigEntry(path = "general.recover-super-flat") - private boolean recoverSuperFlat = false; - - @ConfigComment("Mute death messages") - @ConfigEntry(path = "general.mute-death-messages") - private boolean muteDeathMessages = false; - - @ConfigComment("Allow FTB Autonomous Activator to work (will allow a pseudo player [CoFH] to place and break blocks and hang items)") - @ConfigComment("Add other fake player names here if required") - @ConfigEntry(path = "general.fakeplayers") - private Set fakePlayers = new HashSet<>(); - - @ConfigComment("Allow obsidian to be scooped up with an empty bucket back into lava") - @ConfigComment("This only works if there is a single block of obsidian (no obsidian within 10 blocks)") - @ConfigComment("Recommendation is to keep this true so that newbies don't bother you or reset their") - @ConfigComment("island unnecessarily.") - @ConfigEntry(path = "general.allow-obsidian-scooping") - private boolean allowObsidianScooping = true; - - @ConfigComment("Time in seconds that players have to confirm sensitive commands, e.g. island reset") - @ConfigEntry(path = "general.confirmation-time") - private int confirmationTime = 20; - - // --------------------------------------------- - - /* WORLD */ - @ConfigComment("Friendly name for this world. Used in admin commands. Must be a single word") - @ConfigEntry(path = "world.friendly-name", needsReset = true) - private String friendlyName = "BSkyBlock"; - - @ConfigComment("Name of the world - if it does not exist then it will be generated.") - @ConfigComment("It acts like a prefix for nether and end (e.g. BSkyBlock, BSkyBlock_nether, BSkyBlock_end)") - @ConfigEntry(path = "world.world-name", needsReset = true) - private String worldName = "BSkyBlock-world"; - - @ConfigComment("World difficulty setting - PEACEFUL, EASY, NORMAL, HARD") - @ConfigComment("Other plugins may override this setting") - @ConfigEntry(path = "world.difficulty") - private Difficulty difficulty; - - @ConfigComment("Radius of island in blocks. (So distance between islands is twice this)") - @ConfigComment("Will be rounded up to the nearest 16 blocks.") - @ConfigComment("It is the same for every dimension : Overworld, Nether and End.") - @ConfigComment("This value cannot be changed mid-game and the plugin will not start if it is different.") - @ConfigEntry(path = "world.distance-between-islands", needsReset = true) - private int islandDistance = 200; - - @ConfigComment("Default protection range radius in blocks. Cannot be larger than distance.") - @ConfigComment("Admins can change protection sizes for players individually using /bsadmin setrange") - @ConfigComment("or set this permission: bskyblock.island.range.") - @ConfigEntry(path = "world.protection-range", overrideOnChange = true) - private int islandProtectionRange = 100; - - @ConfigComment("Start islands at these coordinates. This is where new islands will start in the") - @ConfigComment("world. These must be a factor of your island distance, but the plugin will auto") - @ConfigComment("calculate the closest location on the grid. Islands develop around this location") - @ConfigComment("both positively and negatively in a square grid.") - @ConfigComment("If none of this makes sense, leave it at 0,0.") - @ConfigEntry(path = "world.start-x", needsReset = true) - private int islandStartX = 0; - - @ConfigEntry(path = "world.start-z", needsReset = true) - private int islandStartZ = 0; - - @ConfigEntry(path = "world.offset-x") - private int islandXOffset; - @ConfigEntry(path = "world.offset-z") - private int islandZOffset; - - @ConfigComment("Island height - Lowest is 5.") - @ConfigComment("It is the y coordinate of the bedrock block in the schem") - @ConfigEntry(path = "world.island-height") - private int islandHeight = 100; - - @ConfigComment("Use your own world generator for this world. In this case, the plugin will not generate") - @ConfigComment("anything.") - @ConfigEntry(path = "world.use-own-generator") - private boolean useOwnGenerator; - - @ConfigComment("Sea height (don't changes this mid-game unless you delete the world)") - @ConfigComment("Minimum is 0, which means you are playing Skyblock!") - @ConfigComment("If sea height is less than about 10, then players will drop right through it") - @ConfigComment("if it exists. Makes for an interesting variation on skyblock.") - @ConfigEntry(path = "world.sea-height") - private int seaHeight = 0; - - @ConfigComment("Maximum number of islands in the world. Set to 0 for unlimited. ") - @ConfigComment("If the number of islands is greater than this number, no new island will be created.") - @ConfigEntry(path = "world.max-islands") - private int maxIslands = -1; - - @ConfigComment("The default game mode for this world. Players will be set to this mode when they create") - @ConfigComment("a new island for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR") - @ConfigEntry(path = "world.default-game-mode") - private GameMode defaultGameMode = GameMode.SURVIVAL; - - // Nether - @ConfigComment("Generate Nether - if this is false, the nether world will not be made and access to") - @ConfigComment("the nether will not occur. Other plugins may still enable portal usage.") - @ConfigComment("Note: Some challenges will not be possible if there is no nether.") - @ConfigComment("Note that with a standard nether all players arrive at the same portal and entering a") - @ConfigComment("portal will return them back to their islands.") - @ConfigEntry(path = "world.nether.generate") - private boolean netherGenerate = true; - - @ConfigComment("Islands in Nether. Change to false for standard vanilla nether.") - @ConfigEntry(path = "world.nether.islands", needsReset = true) - private boolean netherIslands = true; - - @ConfigComment("Nether trees are made if a player grows a tree in the nether (gravel and glowstone)") - @ConfigComment("Applies to both vanilla and islands Nether") - @ConfigEntry(path = "world.nether.trees") - private boolean netherTrees = true; - - @ConfigComment("Make the nether roof, if false, there is nothing up there") - @ConfigComment("Change to false if lag is a problem from the generation") - @ConfigComment("Only applies to islands Nether") - @ConfigEntry(path = "world.nether.roof") - private boolean netherRoof = true; - - @ConfigComment("Nether spawn protection radius - this is the distance around the nether spawn") - @ConfigComment("that will be protected from player interaction (breaking blocks, pouring lava etc.)") - @ConfigComment("Minimum is 0 (not recommended), maximum is 100. Default is 25.") - @ConfigComment("Only applies to vanilla nether") - @ConfigEntry(path = "world.nether.spawn-radius") - private int netherSpawnRadius = 32; - - // End - @ConfigEntry(path = "world.end.generate") - private boolean endGenerate = true; - - @ConfigEntry(path = "world.end.islands", needsReset = true) - private boolean endIslands = true; - - @ConfigEntry(path = "world.end.dragon-spawn") - private boolean dragonSpawn = false; - - @ConfigComment("Removing mobs - this kills all monsters in the vicinity. Benefit is that it helps") - @ConfigComment("players return to their island if the island has been overrun by monsters.") - @ConfigComment("This setting is toggled in world flags and set by the settings GUI.") - @ConfigComment("Mob white list - these mobs will NOT be removed when logging in or doing /island") - @ConfigEntry(path = "world.remove-mobs-whitelist") - private Set removeMobsWhitelist = new HashSet<>(); - - @ConfigComment("World flags. These are boolean settings for various flags for this world") - @ConfigEntry(path = "world.flags") - private Map worldFlags = new HashMap<>(); - - @ConfigComment("These are the default protection settings for new islands.") - @ConfigComment("The value is the minimum island rank required allowed to do the action") - @ConfigComment("Ranks are: Visitor = 0, Member = 900, Owner = 1000") - @ConfigEntry(path = "world.default-island-flags") - @Adapter(FlagSerializer.class) - private Map defaultIslandFlags = new HashMap<>(); - - @ConfigComment("These are the default settings for new islands") - @ConfigEntry(path = "world.default-island-settings") - @Adapter(FlagSerializer2.class) - private Map defaultIslandSettings = new HashMap<>(); - - @ConfigComment("These are the settings visible to users.") - @ConfigEntry(path = "world.visible-settings") - private List visibleSettings = new ArrayList<>(); - - @ConfigComment("Visitor banned commands - Visitors to islands cannot use these commands in this world") - @ConfigEntry(path = "world.visitor-banned-commands") - private List visitorBannedCommands = new ArrayList<>(); - - // --------------------------------------------- - - /* ISLAND */ - // Entities - @ConfigEntry(path = "island.limits.entities") - private Map entityLimits = new EnumMap<>(EntityType.class); - @ConfigEntry(path = "island.limits.tile-entities") - private Map tileEntityLimits = new HashMap<>(); - - @ConfigComment("Default max team size") - @ConfigComment("Use this permission to set for specific user groups: askyblock.team.maxsize.") - @ConfigComment("Permission size cannot be less than the default below. ") - @ConfigEntry(path = "island.max-team-size") - private int maxTeamSize = 4; - @ConfigComment("Default maximum number of homes a player can have. Min = 1") - @ConfigComment("Accessed via sethome or go ") - @ConfigComment("Use this permission to set for specific user groups: askyblock.island.maxhomes.") - @ConfigEntry(path = "island.max-homes") - private int maxHomes = 5; - @ConfigComment("Island naming") - @ConfigComment("Only players with the TODO can name their island") - @ConfigComment("It is displayed in the top ten and enter and exit announcements") - @ConfigComment("It replaces the owner's name. Players can use & for color coding if they have the TODO permission") - @ConfigComment("These set the minimum and maximum size of a name.") - @ConfigEntry(path = "island.name.min-length") - private int nameMinLength = 4; - @ConfigEntry(path = "island.name.max-length") - private int nameMaxLength = 20; - @ConfigComment("How long a player must wait until they can rejoin a team island after being") - @ConfigComment("kicked in minutes. This slows the effectiveness of players repeating challenges") - @ConfigComment("by repetitively being invited to a team island.") - @ConfigEntry(path = "island.invite-wait") - private int inviteWait = 60; - - // Reset - @ConfigComment("How many resets a player is allowed (override with /asadmin clearreset )") - @ConfigComment("Value of -1 means unlimited, 0 means hardcore - no resets.") - @ConfigComment("Example, 2 resets means they get 2 resets or 3 islands lifetime") - @ConfigEntry(path = "island.reset.reset-limit") - private int resetLimit = -1; - - @ConfigEntry(path = "island.require-confirmation.reset") - private boolean resetConfirmation = true; - - @ConfigComment("How long a player must wait before they can reset their island again in second") - @ConfigEntry(path = "island.reset-wait") - private long resetWait = 300; - - @ConfigComment("Kicked or leaving players lose resets") - @ConfigComment("Players who leave a team will lose an island reset chance") - @ConfigComment("If a player has zero resets left and leaves a team, they cannot make a new") - @ConfigComment("island by themselves and can only join a team.") - @ConfigComment("Leave this true to avoid players exploiting free islands") - @ConfigEntry(path = "island.reset.leavers-lose-reset") - private boolean leaversLoseReset = false; - - @ConfigComment("Allow kicked players to keep their inventory.") - @ConfigComment("If false, kicked player's inventory will be thrown at the island leader if the") - @ConfigComment("kicked player is online and in the island world.") - @ConfigEntry(path = "island.reset.kicked-keep-inventory") - private boolean kickedKeepInventory = false; - - @ConfigComment("What the plugin should reset when the player joins or creates an island") - @ConfigComment("Reset Money - if this is true, will reset the player's money to the starting money") - @ConfigComment("Recommendation is that this is set to true, but if you run multi-worlds") - @ConfigComment("make sure your economy handles multi-worlds too.") - @ConfigEntry(path = "island.reset.on-join.money") - private boolean onJoinResetMoney = false; - - @ConfigComment("Reset inventory - if true, the player's inventory will be cleared.") - @ConfigComment("Note: if you have MultiInv running or a similar inventory control plugin, that") - @ConfigComment("plugin may still reset the inventory when the world changes.") - @ConfigEntry(path = "island.reset.on-join.inventory") - private boolean onJoinResetInventory = false; - - @ConfigComment("Reset Ender Chest - if true, the player's Ender Chest will be cleared.") - @ConfigEntry(path = "island.reset.on-join.ender-chest") - private boolean onJoinResetEnderChest = false; - - @ConfigComment("What the plugin should reset when the player leaves or is kicked from an island") - @ConfigComment("Reset Money - if this is true, will reset the player's money to the starting money") - @ConfigComment("Recommendation is that this is set to true, but if you run multi-worlds") - @ConfigComment("make sure your economy handles multi-worlds too.") - @ConfigEntry(path = "island.reset.on-leave.money") - private boolean onLeaveResetMoney = false; - - @ConfigComment("Reset inventory - if true, the player's inventory will be cleared.") - @ConfigComment("Note: if you have MultiInv running or a similar inventory control plugin, that") - @ConfigComment("plugin may still reset the inventory when the world changes.") - @ConfigEntry(path = "island.reset.on-leave.inventory") - private boolean onLeaveResetInventory = false; - - @ConfigComment("Reset Ender Chest - if true, the player's Ender Chest will be cleared.") - @ConfigEntry(path = "island.reset.on-leave.ender-chest") - private boolean onLeaveResetEnderChest = false; - - @ConfigEntry(path = "island.make-island-if-none") - private boolean makeIslandIfNone = false; - @ConfigComment("Immediately teleport player to their island (home 1 if it exists) when entering the world") - @ConfigEntry(path = "island.immediate-teleport-on-island") - private boolean immediateTeleportOnIsland = false; - @ConfigComment("Have player's respawn on their island if they die") - @ConfigEntry(path = "island.respawn-on-island") - private boolean respawnOnIsland = true; - - // Deaths - @ConfigComment("Maximum number of deaths to count. The death count can be used by add-ons.") - @ConfigEntry(path = "island.deaths.max") - private int deathsMax = 10; - - @ConfigEntry(path = "island.deaths.sum-team") - private boolean deathsSumTeam = false; - - @ConfigComment("When a player joins a team, reset their death count") - @ConfigEntry(path = "island.deaths.team-join-reset") - private boolean teamJoinDeathReset = true; - - // Ranks - @ConfigEntry(path = "island.customranks") - private Map customRanks = new HashMap<>(); - - // --------------------------------------------- - - /* PROTECTION */ - private int togglePvPCooldown; - - @ConfigComment("Geo restrict mobs.") - @ConfigComment("Mobs that exit the island space where they were spawned will be removed.") - @ConfigEntry(path = "protection.geo-limit-settings") - private List geoLimitSettings = new ArrayList<>(); - - // Invincible visitor settings - @ConfigComment("Invincible visitors. List of damages that will not affect visitors.") - @ConfigComment("Make list blank if visitors should receive all damages") - @ConfigEntry(path = "protection.invincible-visitors") - private List ivSettings = new ArrayList<>(); - - // --------------------------------------------- - - // Timeout for team kick and leave commands - @ConfigComment("Ask the player to confirm the command he is using by typing it again.") - @ConfigComment("The 'wait' value is the number of seconds to wait for confirmation.") - @ConfigEntry(path = "island.require-confirmation.kick") - private boolean kickConfirmation = true; - - @ConfigEntry(path = "island.require-confirmation.kick-wait") - private long kickWait = 10L; - - @ConfigEntry(path = "island.require-confirmation.leave") - private boolean leaveConfirmation = true; - - @ConfigEntry(path = "island.require-confirmation.leave-wait") - private long leaveWait = 10L; - - @ConfigEntry(path = "panel.close-on-click-outside") - private boolean closePanelOnClickOutside = true; - - //---------------------------------------------------------------------------------------/ - @ConfigComment("These settings should not be edited") - @ConfigEntry(path = "do-not-edit-these-settings.reset-epoch") - private long resetEpoch = 0; - - private String uniqueId = "config"; - - // Getters and setters - - /** - * @return the metrics - */ - public boolean isMetrics() { - return metrics; - } - /** - * @param metrics the metrics to set - */ - public void setMetrics(boolean metrics) { - this.metrics = metrics; - } - /** - * @return the startingMoney - */ - public double getStartingMoney() { - return startingMoney; - } - /** - * @param startingMoney the startingMoney to set - */ - public void setStartingMoney(double startingMoney) { - this.startingMoney = startingMoney; - } - /** - * @return the recoverSuperFlat - */ - public boolean isRecoverSuperFlat() { - return recoverSuperFlat; - } - /** - * @param recoverSuperFlat the recoverSuperFlat to set - */ - public void setRecoverSuperFlat(boolean recoverSuperFlat) { - this.recoverSuperFlat = recoverSuperFlat; - } - /** - * @return the muteDeathMessages - */ - public boolean isMuteDeathMessages() { - return muteDeathMessages; - } - /** - * @param muteDeathMessages the muteDeathMessages to set - */ - public void setMuteDeathMessages(boolean muteDeathMessages) { - this.muteDeathMessages = muteDeathMessages; - } - /** - * @return the customRanks - */ - public Map getCustomRanks() { - return customRanks; - } - /** - * @return the databaseBackupPeriod - */ - public int getDatabaseBackupPeriod() { - return databaseBackupPeriod; - } - /** - * @return the databaseType - */ - public DatabaseType getDatabaseType() { - return databaseType; - } - /** - * @return the dbHost - */ - public String getDbHost() { - return dbHost; - } - /** - * @return the dbName - */ - public String getDbName() { - return dbName; - } - /** - * @return the dbPassword - */ - public String getDbPassword() { - return dbPassword; - } - /** - * @return the dbPort - */ - public int getDbPort() { - return dbPort; - } - /** - * @return the dbUsername - */ - public String getDbUsername() { - return dbUsername; - } - /** - * @return the deathsMax - */ - public int getDeathsMax() { - return deathsMax; - } - /** - * @param teamJoinDeathReset the teamJoinDeathReset to set - */ - public void setTeamJoinDeathReset(boolean teamJoinDeathReset) { - this.teamJoinDeathReset = teamJoinDeathReset; - } - /** - * @return the defaultLanguage - */ - public String getDefaultLanguage() { - return defaultLanguage; - } - /** - * @return the entityLimits - */ - @Override - public Map getEntityLimits() { - return entityLimits; - } - /** - * Number of minutes to wait - * @return the inviteWait - */ - public int getInviteWait() { - return inviteWait; - } - /** - * @return the islandDistance - */ - @Override - public int getIslandDistance() { - return islandDistance; - } - /** - * @return the islandHeight - */ - @Override - public int getIslandHeight() { - return islandHeight; - } - /** - * @return the islandProtectionRange - */ - @Override - public int getIslandProtectionRange() { - return islandProtectionRange; - } - /** - * @return the islandStartX - */ - @Override - public int getIslandStartX() { - return islandStartX; - } - /** - * @return the islandStartZ - */ - @Override - public int getIslandStartZ() { - return islandStartZ; - } - /** - * @return the islandXOffset - */ - @Override - public int getIslandXOffset() { - return islandXOffset; - } - /** - * @return the islandZOffset - */ - @Override - public int getIslandZOffset() { - return islandZOffset; - } - /** - * @return the kickWait - */ - public long getKickWait() { - return kickWait; - } - /** - * @return the leaveWait - */ - public long getLeaveWait() { - return leaveWait; - } - /** - * @return the maxHomes - */ - @Override - public int getMaxHomes() { - return maxHomes; - } - /** - * @return the maxIslands - */ - @Override - public int getMaxIslands() { - return maxIslands; - } - /** - * @return the maxTeamSize - */ - @Override - public int getMaxTeamSize() { - return maxTeamSize; - } - /** - * @return the nameMaxLength - */ - public int getNameMaxLength() { - return nameMaxLength; - } - /** - * @return the nameMinLength - */ - public int getNameMinLength() { - return nameMinLength; - } - /** - * @return the netherSpawnRadius - */ - @Override - public int getNetherSpawnRadius() { - return netherSpawnRadius; - } - /** - * @return the purgeMaxIslandLevel - */ - public int getPurgeMaxIslandLevel() { - return purgeMaxIslandLevel; - } - /** - * @return the resetLimit - */ - @Override - public int getResetLimit() { - return resetLimit; - } - /** - * @return the resetWait - */ - public long getResetWait() { - return resetWait; - } - /** - * @return the seaHeight - */ - @Override - public int getSeaHeight() { - return seaHeight; - } - /** - * @return the tileEntityLimits - */ - @Override - public Map getTileEntityLimits() { - return tileEntityLimits; - } - /** - * @return the togglePvPCooldown - */ - public int getTogglePvPCooldown() { - return togglePvPCooldown; - } - /** - * @return the uniqueId - */ - @Override - public String getUniqueId() { - return uniqueId; - } - /** - * @return the worldName - */ - @Override - public String getWorldName() { - return worldName; - } - /** - * @return the allowObsidianScooping - */ - public boolean isAllowObsidianScooping() { - return allowObsidianScooping; - } - /** - * @return the checkUpdates - */ - public boolean isCheckUpdates() { - return checkUpdates; - } - /** - * @return the deathsSumTeam - */ - public boolean isDeathsSumTeam() { - return deathsSumTeam; - } - /** - * @return the endGenerate - */ - @Override - public boolean isEndGenerate() { - return endGenerate; - } - /** - * @return the endIslands - */ - @Override - public boolean isEndIslands() { - return endIslands; - } - /** - * @return the immediateTeleportOnIsland - */ - public boolean isImmediateTeleportOnIsland() { - return immediateTeleportOnIsland; - } - /** - * @return the kickConfirmation - */ - public boolean isKickConfirmation() { - return kickConfirmation; - } - /** - * @return the kickedKeepInventory - */ - public boolean isKickedKeepInventory() { - return kickedKeepInventory; - } - /** - * @return the leaveConfirmation - */ - public boolean isLeaveConfirmation() { - return leaveConfirmation; - } - /** - * @return the leaversLoseReset - */ - public boolean isLeaversLoseReset() { - return leaversLoseReset; - } - /** - * @return the makeIslandIfNone - */ - public boolean isMakeIslandIfNone() { - return makeIslandIfNone; - } - /** - * @return the netherGenerate - */ - @Override - public boolean isNetherGenerate() { - return netherGenerate; - } - /** - * @return the netherIslands - */ - @Override - public boolean isNetherIslands() { - return netherIslands; - } - /** - * @return the netherRoof - */ - public boolean isNetherRoof() { - return netherRoof; - } - /** - * @return the netherTrees - */ - @Override - public boolean isNetherTrees() { - return netherTrees; - } - /** - * @return the purgeRemoveUserData - */ - public boolean isPurgeRemoveUserData() { - return purgeRemoveUserData; - } - /** - * @return the resetConfirmation - */ - public boolean isResetConfirmation() { - return resetConfirmation; - } - /** - * @return the respawnOnIsland - */ - public boolean isRespawnOnIsland() { - return respawnOnIsland; - } - /** - * @return the useEconomy - */ - public boolean isUseEconomy() { - return useEconomy; - } - /** - * @return the useOwnGenerator - */ - @Override - public boolean isUseOwnGenerator() { - return useOwnGenerator; - } - /** - * @param allowObsidianScooping the allowObsidianScooping to set - */ - public void setAllowObsidianScooping(boolean allowObsidianScooping) { - this.allowObsidianScooping = allowObsidianScooping; - } - /** - * @param checkUpdates the checkUpdates to set - */ - public void setCheckUpdates(boolean checkUpdates) { - this.checkUpdates = checkUpdates; - } - /** - * @param customRanks the customRanks to set - */ - public void setCustomRanks(Map customRanks) { - this.customRanks = customRanks; - } - /** - * @param databaseBackupPeriod the databaseBackupPeriod to set - */ - public void setDatabaseBackupPeriod(int databaseBackupPeriod) { - this.databaseBackupPeriod = databaseBackupPeriod; - } - /** - * @param databaseType the databaseType to set - */ - public void setDatabaseType(DatabaseType databaseType) { - this.databaseType = databaseType; - } - /** - * @param dbHost the dbHost to set - */ - public void setDbHost(String dbHost) { - this.dbHost = dbHost; - } - /** - * @param dbName the dbName to set - */ - public void setDbName(String dbName) { - this.dbName = dbName; - } - /** - * @param dbPassword the dbPassword to set - */ - public void setDbPassword(String dbPassword) { - this.dbPassword = dbPassword; - } - /** - * @param dbPort the dbPort to set - */ - public void setDbPort(int dbPort) { - this.dbPort = dbPort; - } - /** - * @param dbUsername the dbUsername to set - */ - public void setDbUsername(String dbUsername) { - this.dbUsername = dbUsername; - } - /** - * @param deathsMax the deathsMax to set - */ - public void setDeathsMax(int deathsMax) { - this.deathsMax = deathsMax; - } - /** - * @param deathsSumTeam the deathsSumTeam to set - */ - public void setDeathsSumTeam(boolean deathsSumTeam) { - this.deathsSumTeam = deathsSumTeam; - } - /** - * @param defaultLanguage the defaultLanguage to set - */ - public void setDefaultLanguage(String defaultLanguage) { - this.defaultLanguage = defaultLanguage; - } - /** - * @param endGenerate the endGenerate to set - */ - public void setEndGenerate(boolean endGenerate) { - this.endGenerate = endGenerate; - } - /** - * @param endIslands the endIslands to set - */ - public void setEndIslands(boolean endIslands) { - this.endIslands = endIslands; - } - /** - * @param entityLimits the entityLimits to set - */ - public void setEntityLimits(Map entityLimits) { - this.entityLimits = entityLimits; - } - /** - * @param immediateTeleportOnIsland the immediateTeleportOnIsland to set - */ - public void setImmediateTeleportOnIsland(boolean immediateTeleportOnIsland) { - this.immediateTeleportOnIsland = immediateTeleportOnIsland; - } - /** - * @param inviteWait the inviteWait to set - */ - public void setInviteWait(int inviteWait) { - this.inviteWait = inviteWait; - } - /** - * @param islandDistance the islandDistance to set - */ - public void setIslandDistance(int islandDistance) { - this.islandDistance = islandDistance; - } - /** - * @param islandHeight the islandHeight to set - */ - public void setIslandHeight(int islandHeight) { - this.islandHeight = islandHeight; - } - /** - * @param islandProtectionRange the islandProtectionRange to set - */ - public void setIslandProtectionRange(int islandProtectionRange) { - this.islandProtectionRange = islandProtectionRange; - } - /** - * @param islandStartX the islandStartX to set - */ - public void setIslandStartX(int islandStartX) { - this.islandStartX = islandStartX; - } - /** - * @param islandStartZ the islandStartZ to set - */ - public void setIslandStartZ(int islandStartZ) { - this.islandStartZ = islandStartZ; - } - /** - * @param islandXOffset the islandXOffset to set - */ - public void setIslandXOffset(int islandXOffset) { - this.islandXOffset = islandXOffset; - } - /** - * @param islandZOffset the islandZOffset to set - */ - public void setIslandZOffset(int islandZOffset) { - this.islandZOffset = islandZOffset; - } - /** - * @param kickConfirmation the kickConfirmation to set - */ - public void setKickConfirmation(boolean kickConfirmation) { - this.kickConfirmation = kickConfirmation; - } - /** - * @param kickedKeepInventory the kickedKeepInventory to set - */ - public void setKickedKeepInventory(boolean kickedKeepInventory) { - this.kickedKeepInventory = kickedKeepInventory; - } - /** - * @param kickWait the kickWait to set - */ - public void setKickWait(long kickWait) { - this.kickWait = kickWait; - } - /** - * @param leaveConfirmation the leaveConfirmation to set - */ - public void setLeaveConfirmation(boolean leaveConfirmation) { - this.leaveConfirmation = leaveConfirmation; - } - /** - * @param leaversLoseReset the leaversLoseReset to set - */ - public void setLeaversLoseReset(boolean leaversLoseReset) { - this.leaversLoseReset = leaversLoseReset; - } - /** - * @param leaveWait the leaveWait to set - */ - public void setLeaveWait(long leaveWait) { - this.leaveWait = leaveWait; - } - /** - * @param makeIslandIfNone the makeIslandIfNone to set - */ - public void setMakeIslandIfNone(boolean makeIslandIfNone) { - this.makeIslandIfNone = makeIslandIfNone; - } - /** - * @param maxHomes the maxHomes to set - */ - public void setMaxHomes(int maxHomes) { - this.maxHomes = maxHomes; - } - /** - * @param maxIslands the maxIslands to set - */ - public void setMaxIslands(int maxIslands) { - this.maxIslands = maxIslands; - } - /** - * @param maxTeamSize the maxTeamSize to set - */ - public void setMaxTeamSize(int maxTeamSize) { - this.maxTeamSize = maxTeamSize; - } - /** - * @param nameMaxLength the nameMaxLength to set - */ - public void setNameMaxLength(int nameMaxLength) { - this.nameMaxLength = nameMaxLength; - } - /** - * @param nameMinLength the nameMinLength to set - */ - public void setNameMinLength(int nameMinLength) { - this.nameMinLength = nameMinLength; - } - /** - * @param netherGenerate the netherGenerate to set - */ - public void setNetherGenerate(boolean netherGenerate) { - this.netherGenerate = netherGenerate; - } - /** - * @param netherIslands the netherIslands to set - */ - public void setNetherIslands(boolean netherIslands) { - this.netherIslands = netherIslands; - } - /** - * @param netherRoof the netherRoof to set - */ - public void setNetherRoof(boolean netherRoof) { - this.netherRoof = netherRoof; - } - /** - * @param netherSpawnRadius the netherSpawnRadius to set - */ - public void setNetherSpawnRadius(int netherSpawnRadius) { - this.netherSpawnRadius = netherSpawnRadius; - } - /** - * @param netherTrees the netherTrees to set - */ - public void setNetherTrees(boolean netherTrees) { - this.netherTrees = netherTrees; - } - /** - * @param purgeMaxIslandLevel the purgeMaxIslandLevel to set - */ - public void setPurgeMaxIslandLevel(int purgeMaxIslandLevel) { - this.purgeMaxIslandLevel = purgeMaxIslandLevel; - } - /** - * @param purgeRemoveUserData the purgeRemoveUserData to set - */ - public void setPurgeRemoveUserData(boolean purgeRemoveUserData) { - this.purgeRemoveUserData = purgeRemoveUserData; - } - /** - * @param resetConfirmation the resetConfirmation to set - */ - public void setResetConfirmation(boolean resetConfirmation) { - this.resetConfirmation = resetConfirmation; - } - /** - * @param resetLimit the resetLimit to set - */ - public void setResetLimit(int resetLimit) { - this.resetLimit = resetLimit; - } - /** - * @param resetWait the resetWait to set - */ - public void setResetWait(long resetWait) { - this.resetWait = resetWait; - } - /** - * @param respawnOnIsland the respawnOnIsland to set - */ - public void setRespawnOnIsland(boolean respawnOnIsland) { - this.respawnOnIsland = respawnOnIsland; - } - /** - * @param seaHeight the seaHeight to set - */ - public void setSeaHeight(int seaHeight) { - this.seaHeight = seaHeight; - } - /** - * @param tileEntityLimits the tileEntityLimits to set - */ - public void setTileEntityLimits(Map tileEntityLimits) { - this.tileEntityLimits = tileEntityLimits; - } - /** - * @param togglePvPCooldown the togglePvPCooldown to set - */ - public void setTogglePvPCooldown(int togglePvPCooldown) { - this.togglePvPCooldown = togglePvPCooldown; - } - /** - * @param uniqueId - unique ID the uniqueId to set - */ - @Override - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - /** - * @param useEconomy the useEconomy to set - */ - public void setUseEconomy(boolean useEconomy) { - this.useEconomy = useEconomy; - } - /** - * @param useOwnGenerator the useOwnGenerator to set - */ - public void setUseOwnGenerator(boolean useOwnGenerator) { - this.useOwnGenerator = useOwnGenerator; - } - /** - * @param worldName the worldName to set - */ - public void setWorldName(String worldName) { - this.worldName = worldName; - } - /** - * @return the fakePlayers - */ - public Set getFakePlayers() { - return fakePlayers; - } - /** - * @param fakePlayers the fakePlayers to set - */ - public void setFakePlayers(Set fakePlayers) { - this.fakePlayers = fakePlayers; - } - /** - * @return the confirmationTime - */ - public int getConfirmationTime() { - return confirmationTime; - } - /** - * @param confirmationTime the confirmationTime to set - */ - public void setConfirmationTime(int confirmationTime) { - this.confirmationTime = confirmationTime; - } - - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.configuration.WorldSettings#getFriendlyName() - */ - @Override - public String getFriendlyName() { - return friendlyName; - } - - /** - * @param friendlyName the friendlyName to set - */ - public void setFriendlyName(String friendlyName) { - this.friendlyName = friendlyName; - } - /** - * @return the dragonSpawn - */ - @Override - public boolean isDragonSpawn() { - return dragonSpawn; - } - /** - * @param dragonSpawn the dragonSpawn to set - */ - public void setDragonSpawn(boolean dragonSpawn) { - this.dragonSpawn = dragonSpawn; - } - - @Override - public String getPermissionPrefix() { - return "bskyblock"; - } - - /** - * Invincible visitor settings - * @return the ivSettings - */ - @Override - public List getIvSettings() { - return ivSettings; - } - - /** - * @param ivSettings the ivSettings to set - */ - public void setIvSettings(List ivSettings) { - this.ivSettings = ivSettings; - } - - /** - * @return the worldFlags - */ - @Override - public Map getWorldFlags() { - return worldFlags; - } - /** - * @param worldFlags the worldFlags to set - */ - public void setWorldFlags(Map worldFlags) { - this.worldFlags = worldFlags; - } - - /** - * @return whether panels should close when clicked outside or not - */ - public boolean isClosePanelOnClickOutside() { - return closePanelOnClickOutside; - } - - /** - * Set panel close on click outside - * @param closePanelOnClickOutside - true means close panel when click is outside panel - */ - public void setClosePanelOnClickOutside(boolean closePanelOnClickOutside) { - this.closePanelOnClickOutside = closePanelOnClickOutside; - } - /** - * @return the defaultGameMode - */ - @Override - public GameMode getDefaultGameMode() { - return defaultGameMode; - } - /** - * @param defaultGameMode the defaultGameMode to set - */ - public void setDefaultGameMode(GameMode defaultGameMode) { - this.defaultGameMode = defaultGameMode; - } - /** - * @return the removeMobsWhitelist - */ - @Override - public Set getRemoveMobsWhitelist() { - return removeMobsWhitelist; - } - /** - * @param removeMobsWhitelist the removeMobsWhitelist to set - */ - public void setRemoveMobsWhitelist(Set removeMobsWhitelist) { - this.removeMobsWhitelist = removeMobsWhitelist; - } - /** - * @return the onJoinResetMoney - */ - @Override - public boolean isOnJoinResetMoney() { - return onJoinResetMoney; - } - /** - * @return the onJoinResetInventory - */ - @Override - public boolean isOnJoinResetInventory() { - return onJoinResetInventory; - } - /** - * @return the onJoinResetEnderChest - */ - @Override - public boolean isOnJoinResetEnderChest() { - return onJoinResetEnderChest; - } - /** - * @return the onLeaveResetMoney - */ - @Override - public boolean isOnLeaveResetMoney() { - return onLeaveResetMoney; - } - /** - * @return the onLeaveResetInventory - */ - @Override - public boolean isOnLeaveResetInventory() { - return onLeaveResetInventory; - } - /** - * @return the onLeaveResetEnderChest - */ - @Override - public boolean isOnLeaveResetEnderChest() { - return onLeaveResetEnderChest; - } - /** - * @param onJoinResetMoney the onJoinResetMoney to set - */ - public void setOnJoinResetMoney(boolean onJoinResetMoney) { - this.onJoinResetMoney = onJoinResetMoney; - } - /** - * @param onJoinResetInventory the onJoinResetInventory to set - */ - public void setOnJoinResetInventory(boolean onJoinResetInventory) { - this.onJoinResetInventory = onJoinResetInventory; - } - /** - * @param onJoinResetEnderChest the onJoinResetEnderChest to set - */ - public void setOnJoinResetEnderChest(boolean onJoinResetEnderChest) { - this.onJoinResetEnderChest = onJoinResetEnderChest; - } - /** - * @param onLeaveResetMoney the onLeaveResetMoney to set - */ - public void setOnLeaveResetMoney(boolean onLeaveResetMoney) { - this.onLeaveResetMoney = onLeaveResetMoney; - } - /** - * @param onLeaveResetInventory the onLeaveResetInventory to set - */ - public void setOnLeaveResetInventory(boolean onLeaveResetInventory) { - this.onLeaveResetInventory = onLeaveResetInventory; - } - /** - * @param onLeaveResetEnderChest the onLeaveResetEnderChest to set - */ - public void setOnLeaveResetEnderChest(boolean onLeaveResetEnderChest) { - this.onLeaveResetEnderChest = onLeaveResetEnderChest; - } - - @Override - public Optional getAddon() { - // This is a plugin, not an addon - return Optional.empty(); - } - /** - * @return the defaultIslandProtection - */ - @Override - public Map getDefaultIslandFlags() { - return defaultIslandFlags; - } - /** - * @return the visibleSettings - */ - @Override - public List getVisibleSettings() { - return visibleSettings; - } - /** - */ - public void setDefaultIslandFlags(Map defaultIslandFlags) { - this.defaultIslandFlags = defaultIslandFlags; - } - /** - * @param visibleSettings the visibleSettings to set - */ - public void setVisibleSettings(List visibleSettings) { - this.visibleSettings = visibleSettings; - } - /** - * @return the defaultIslandSettings - */ - @Override - public Map getDefaultIslandSettings() { - return defaultIslandSettings; - } - /** - * @param defaultIslandSettings the defaultIslandSettings to set - */ - public void setDefaultIslandSettings(Map defaultIslandSettings) { - this.defaultIslandSettings = defaultIslandSettings; - } - - public boolean isTeamJoinDeathReset() { - return teamJoinDeathReset; - } - /** - * @return the visitorbannedcommands - */ - @Override - public List getVisitorBannedCommands() { - return visitorBannedCommands; - } - /** - * @param visitorBannedCommands the visitorbannedcommands to set - */ - public void setVisitorBannedCommands(List visitorBannedCommands) { - this.visitorBannedCommands = visitorBannedCommands; - } - /** - * @return the difficulty - */ - @Override - public Difficulty getDifficulty() { - return difficulty; - } - /** - * @param difficulty the difficulty to set - */ - @Override - public void setDifficulty(Difficulty difficulty) { - this.difficulty = difficulty; - } - - @Override - public boolean isWaterUnsafe() { - return false; - } - /** - * @return the geoLimitSettings - */ - @Override - public List getGeoLimitSettings() { - return geoLimitSettings; - } - /** - * @param geoLimitSettings the geoLimitSettings to set - */ - public void setGeoLimitSettings(List geoLimitSettings) { - this.geoLimitSettings = geoLimitSettings; - } - /** - * @return the resetEpoch - */ - @Override - public long getResetEpoch() { - return resetEpoch; - } - /** - * @param resetEpoch the resetEpoch to set - */ - @Override - public void setResetEpoch(long resetEpoch) { - this.resetEpoch = resetEpoch; - } - - -} \ No newline at end of file diff --git a/src/main/java/us/tastybento/bskyblock/commands/AdminCommand.java b/src/main/java/us/tastybento/bskyblock/commands/AdminCommand.java deleted file mode 100755 index 456f28e09..000000000 --- a/src/main/java/us/tastybento/bskyblock/commands/AdminCommand.java +++ /dev/null @@ -1,74 +0,0 @@ -package us.tastybento.bskyblock.commands; - -import java.util.List; - -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.admin.AdminClearResetsAllCommand; -import us.tastybento.bskyblock.commands.admin.AdminClearResetsCommand; -import us.tastybento.bskyblock.commands.admin.AdminGetRankCommand; -import us.tastybento.bskyblock.commands.admin.AdminInfoCommand; -import us.tastybento.bskyblock.commands.admin.AdminRegisterCommand; -import us.tastybento.bskyblock.commands.admin.AdminReloadCommand; -import us.tastybento.bskyblock.commands.admin.AdminSchemCommand; -import us.tastybento.bskyblock.commands.admin.AdminSetRankCommand; -import us.tastybento.bskyblock.commands.admin.AdminTeleportCommand; -import us.tastybento.bskyblock.commands.admin.AdminUnregisterCommand; -import us.tastybento.bskyblock.commands.admin.AdminVersionCommand; -import us.tastybento.bskyblock.commands.admin.range.AdminRangeCommand; -import us.tastybento.bskyblock.commands.admin.team.AdminTeamAddCommand; -import us.tastybento.bskyblock.commands.admin.team.AdminTeamDisbandCommand; -import us.tastybento.bskyblock.commands.admin.team.AdminTeamKickCommand; -import us.tastybento.bskyblock.commands.admin.team.AdminTeamMakeLeaderCommand; - -public class AdminCommand extends CompositeCommand { - - public AdminCommand() { - super("bsbadmin", "bsb"); - } - - @Override - public void setup() { - setPermissionPrefix("bskyblock"); - setPermission("admin.*"); - setOnlyPlayer(false); - setParameters("commands.admin.help.parameters"); - setDescription("commands.admin.help.description"); - setWorld(getPlugin().getIWM().getBSBIslandWorld()); - new AdminVersionCommand(this); - new AdminReloadCommand(this); - new AdminTeleportCommand(this, "tp"); - new AdminTeleportCommand(this, "tpnether"); - new AdminTeleportCommand(this, "tpend"); - new AdminGetRankCommand(this); - new AdminSetRankCommand(this); - new AdminInfoCommand(this); - // Team commands - new AdminTeamAddCommand(this); - new AdminTeamKickCommand(this); - new AdminTeamDisbandCommand(this); - new AdminTeamMakeLeaderCommand(this); - // Schems - new AdminSchemCommand(this); - // Register/unregister islands - new AdminRegisterCommand(this); - new AdminUnregisterCommand(this); - // Range - new AdminRangeCommand(this); - // Resets - new AdminClearResetsCommand(this); - new AdminClearResetsAllCommand(this); - } - - @Override - public boolean execute(User user, String label, List args) { - if (!args.isEmpty()) { - user.sendMessage("general.errors.unknown-command", TextVariables.LABEL, getTopLabel()); - return false; - } - // By default run the attached help command, if it exists (it should) - return showHelp(this, user); - } - -} diff --git a/src/main/java/us/tastybento/bskyblock/commands/IslandCommand.java b/src/main/java/us/tastybento/bskyblock/commands/IslandCommand.java deleted file mode 100755 index d7cfac96f..000000000 --- a/src/main/java/us/tastybento/bskyblock/commands/IslandCommand.java +++ /dev/null @@ -1,78 +0,0 @@ -package us.tastybento.bskyblock.commands; - -import java.util.ArrayList; -import java.util.List; - -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.island.IslandAboutCommand; -import us.tastybento.bskyblock.commands.island.IslandBanCommand; -import us.tastybento.bskyblock.commands.island.IslandBanlistCommand; -import us.tastybento.bskyblock.commands.island.IslandCreateCommand; -import us.tastybento.bskyblock.commands.island.IslandGoCommand; -import us.tastybento.bskyblock.commands.island.IslandLanguageCommand; -import us.tastybento.bskyblock.commands.island.IslandResetCommand; -import us.tastybento.bskyblock.commands.island.IslandResetnameCommand; -import us.tastybento.bskyblock.commands.island.IslandSethomeCommand; -import us.tastybento.bskyblock.commands.island.IslandSetnameCommand; -import us.tastybento.bskyblock.commands.island.IslandSettingsCommand; -import us.tastybento.bskyblock.commands.island.IslandUnbanCommand; -import us.tastybento.bskyblock.commands.island.team.IslandTeamCommand; - -public class IslandCommand extends CompositeCommand { - - public IslandCommand() { - super("island", "is"); - } - - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup() - */ - @Override - public void setup() { - setDescription("commands.island.help.description"); - setOnlyPlayer(true); - // Permission - setPermissionPrefix("bskyblock"); - setPermission("island"); - setWorld(getPlugin().getIWM().getBSBIslandWorld()); - // Set up subcommands - new IslandAboutCommand(this); - new IslandCreateCommand(this); - new IslandGoCommand(this); - new IslandResetCommand(this); - new IslandSetnameCommand(this); - new IslandResetnameCommand(this); - new IslandSethomeCommand(this); - new IslandSettingsCommand(this); - new IslandLanguageCommand(this); - new IslandBanCommand(this); - new IslandUnbanCommand(this); - new IslandBanlistCommand(this); - // Team commands - new IslandTeamCommand(this); - } - - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) - */ - @Override - public boolean execute(User user, String label, List args) { - if (user == null) { - return false; - } - if (args.isEmpty()) { - // If user has an island, go - if (getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) != null) { - return getSubCommand("go").map(goCmd -> goCmd.execute(user, goCmd.getLabel(), new ArrayList<>())).orElse(false); - } - // No islands currently - return getSubCommand("create").map(createCmd -> createCmd.execute(user, createCmd.getLabel(), new ArrayList<>())).orElse(false); - } - user.sendMessage("general.errors.unknown-command", TextVariables.LABEL, getTopLabel()); - return false; - - } - -} diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandInfoCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandInfoCommand.java deleted file mode 100644 index 7c5ed939e..000000000 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandInfoCommand.java +++ /dev/null @@ -1,4 +0,0 @@ -package us.tastybento.bskyblock.commands.island; - -public class IslandInfoCommand { -} diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSpawnCommand.java b/src/main/java/us/tastybento/bskyblock/commands/island/IslandSpawnCommand.java deleted file mode 100644 index f5fa1d3a7..000000000 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSpawnCommand.java +++ /dev/null @@ -1,4 +0,0 @@ -package us.tastybento.bskyblock.commands.island; - -public class IslandSpawnCommand { -} diff --git a/src/main/java/us/tastybento/bskyblock/database/flatfile/FlatFileDatabase.java b/src/main/java/us/tastybento/bskyblock/database/flatfile/FlatFileDatabase.java deleted file mode 100755 index 86bfba544..000000000 --- a/src/main/java/us/tastybento/bskyblock/database/flatfile/FlatFileDatabase.java +++ /dev/null @@ -1,23 +0,0 @@ -package us.tastybento.bskyblock.database.flatfile; - -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.database.AbstractDatabaseHandler; -import us.tastybento.bskyblock.database.BSBDbSetup; - -public class FlatFileDatabase extends BSBDbSetup{ - - @Override - public AbstractDatabaseHandler getHandler(Class type) { - return new FlatFileDatabaseHandler<>(BSkyBlock.getInstance(), type, new FlatFileDatabaseConnecter(BSkyBlock.getInstance())); - } - - /** - * Get the config - * @param type - config object type - * @return - the config handler - */ - public AbstractDatabaseHandler getConfig(Class type) { - return new ConfigHandler<>(BSkyBlock.getInstance(), type, new FlatFileDatabaseConnecter(BSkyBlock.getInstance())); - } - -} diff --git a/src/main/java/us/tastybento/bskyblock/generators/ChunkGeneratorWorld.java b/src/main/java/us/tastybento/bskyblock/generators/ChunkGeneratorWorld.java deleted file mode 100644 index d4661a356..000000000 --- a/src/main/java/us/tastybento/bskyblock/generators/ChunkGeneratorWorld.java +++ /dev/null @@ -1,143 +0,0 @@ -package us.tastybento.bskyblock.generators; - -import java.util.Arrays; -import java.util.List; -import java.util.Random; - -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.World.Environment; -import org.bukkit.generator.BlockPopulator; -import org.bukkit.generator.ChunkGenerator; -import org.bukkit.util.noise.PerlinOctaveGenerator; - -import us.tastybento.bskyblock.BSkyBlock; - -/** - * @author tastybento - * Creates the world - */ -public class ChunkGeneratorWorld extends ChunkGenerator { - - BSkyBlock plugin; - Random rand = new Random(); - PerlinOctaveGenerator gen; - - /** - * @param plugin - BSkyBlock plugin object - */ - public ChunkGeneratorWorld(BSkyBlock plugin) { - super(); - this.plugin = plugin; - } - - @Override - public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, ChunkGenerator.BiomeGrid biomeGrid) { - if (world.getEnvironment().equals(World.Environment.NETHER)) { - return generateNetherChunks(world, random, chunkX, chunkZ, biomeGrid); - } - ChunkData result = createChunkData(world); - if (plugin.getSettings().getSeaHeight() != 0) { - for (int x = 0; x < 16; x++) { - for (int z = 0; z < 16; z++) { - for (int y = 0; y < plugin.getSettings().getSeaHeight(); y++) { - result.setBlock(x, y, z, Material.STATIONARY_WATER); - } - } - } - - } - return result; - } - - // This needs to be set to return true to override minecraft's default - // behavior - @Override - public boolean canSpawn(World world, int x, int z) { - return true; - } - - @Override - public List getDefaultPopulators(final World world) { - return Arrays.asList(new BlockPopulator[0]); - } - - /* - * Nether Section - */ - private ChunkData generateNetherChunks(World world, Random random, int chunkX, int chunkZ, BiomeGrid biomeGrid) { - ChunkData result = createChunkData(world); - rand.setSeed(world.getSeed()); - gen = new PerlinOctaveGenerator((long) (random.nextLong() * random.nextGaussian()), 8); - // This is a nether generator - if (!world.getEnvironment().equals(Environment.NETHER)) { - return result; - } - if (plugin.getSettings().isNetherRoof()) { - // Make the roof - common across the world - for (int x = 0; x < 16; x++) { - for (int z = 0; z < 16; z++) { - // Do the ceiling - int maxHeight = world.getMaxHeight(); - result.setBlock(x, (maxHeight - 1), z, Material.BEDROCK); - // Next three layers are a mix of bedrock and netherrack - for (int y = 2; y < 5; y++) { - double r = gen.noise(x, (maxHeight - y), z, 0.5, 0.5); - if (r > 0D) { - result.setBlock(x, (maxHeight - y), z, Material.BEDROCK); - } - } - // Next three layers are a mix of netherrack and air - for (int y = 5; y < 8; y++) { - double r = gen.noise(x, (double)maxHeight - y, z, 0.5, 0.5); - if (r > 0D) { - result.setBlock(x, (maxHeight - y), z, Material.NETHERRACK); - } else { - result.setBlock(x, (maxHeight - y), z, Material.AIR); - } - } - // Layer 8 may be glowstone - double r = gen.noise(x, (double)maxHeight - 8, z, random.nextFloat(), random.nextFloat()); - if (r > 0.5D) { - // Have blobs of glowstone - switch (random.nextInt(4)) { - case 1: - // Single block - result.setBlock(x, (maxHeight - 8), z, Material.GLOWSTONE); - if (x < 14 && z < 14) { - result.setBlock(x + 1, (maxHeight - 8), z + 1, Material.GLOWSTONE); - result.setBlock(x + 2, (maxHeight - 8), z + 2, Material.GLOWSTONE); - result.setBlock(x + 1, (maxHeight - 8), z + 2, Material.GLOWSTONE); - result.setBlock(x + 1, (maxHeight - 8), z + 2, Material.GLOWSTONE); - } - break; - case 2: - // Stalatite - for (int i = 0; i < random.nextInt(10); i++) { - result.setBlock(x, (maxHeight - 8 - i), z, Material.GLOWSTONE); - } - break; - case 3: - result.setBlock(x, (maxHeight - 8), z, Material.GLOWSTONE); - if (x > 3 && z > 3) { - for (int xx = 0; xx < 3; xx++) { - for (int zz = 0; zz < 3; zz++) { - result.setBlock(x - xx, (maxHeight - 8 - random.nextInt(2)), z - xx, Material.GLOWSTONE); - } - } - } - break; - default: - result.setBlock(x, (maxHeight - 8), z, Material.GLOWSTONE); - } - result.setBlock(x, (maxHeight - 8), z, Material.GLOWSTONE); - } else { - result.setBlock(x, (maxHeight - 8), z, Material.AIR); - } - } - } - } - return result; - - } -} \ No newline at end of file diff --git a/src/main/java/us/tastybento/bskyblock/generators/NetherPopulator.java b/src/main/java/us/tastybento/bskyblock/generators/NetherPopulator.java deleted file mode 100644 index ded89fced..000000000 --- a/src/main/java/us/tastybento/bskyblock/generators/NetherPopulator.java +++ /dev/null @@ -1,122 +0,0 @@ -package us.tastybento.bskyblock.generators; - -import java.util.Random; - -import org.bukkit.Chunk; -import org.bukkit.Material; -import org.bukkit.TreeType; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.Chest; -import org.bukkit.block.CreatureSpawner; -import org.bukkit.entity.EntityType; -import org.bukkit.generator.BlockPopulator; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; - -/** - * @author tastybento - * Populates the Nether with appropriate blocks - * - */ -public class NetherPopulator extends BlockPopulator { - - @Override - public void populate(World world, Random random, Chunk source) { - // Rough check - convert spawners to Nether spawners - for (int x = 0; x < 16; x++) { - for (int y = 0; y < world.getMaxHeight(); y++) { - for (int z = 0; z < 16; z++) { - Block b = source.getBlock(x, y, z); - if (b.getType().equals(Material.MOB_SPAWNER)) { - CreatureSpawner cs = (CreatureSpawner) b.getState(); - switch (random.nextInt(3)) { - case 0: - cs.setSpawnedType(EntityType.BLAZE); - break; - case 1: - cs.setSpawnedType(EntityType.SKELETON); - break; - case 2: - cs.setSpawnedType(EntityType.MAGMA_CUBE); - break; - default: - cs.setSpawnedType(EntityType.BLAZE); - } - } else if (b.getType().equals(Material.OBSIDIAN)) { - b.setType(Material.CHEST); - Chest cs = (Chest) b.getState(); - Inventory chestInv = cs.getInventory(); - // Fill it with random goodies - /* - * 2 to 5 stacks of any of the following - * Diamonds 1 - 3 6.85% (5/73) - * Iron Ingots 1 - 5 6.85% (5/73) - * Gold Ingots 1 - 3 20.5% (15/73) - * Golden Sword 1 6.85% (5/73) - * Golden Chestplate 1 6.85% (5/73) - * Flint and Steel 1 6.85% (5/73) - * Nether Wart 3 - 7 6.85% (5/73) - * Saddle 1 13.7% (10/73) - * Golden Horse Armor 1 11.0% (8/73) - * Iron Horse Armor 1 6.85% (5/73) - * Diamond Horse Armor 1 4.11% (3/73) - * Obsidian 2 - 4 2.74% (2/73) - */ - // Pick how many stacks - int numOfStacks = 2 + random.nextInt(3); - // Pick the stacks - for (int i = 0; i < numOfStacks; i++) { - // Pick a random inventory slot - int slot = random.nextInt(chestInv.getSize()); - // Try a few times to find an empty slot (avoids an - // infinite loop potential) - for (int j = 0; j < chestInv.getSize(); j++) { - if (chestInv.getItem(slot) == null) { - break; - } - slot = random.nextInt(chestInv.getSize()); - } - int choice = random.nextInt(73); - if (choice < 5) { - chestInv.setItem(slot, new ItemStack(Material.DIAMOND, random.nextInt(2) + 1)); - } else if (choice < 10) { - chestInv.setItem(slot, new ItemStack(Material.IRON_INGOT, random.nextInt(4) + 1)); - } else if (choice < 25) { - chestInv.setItem(slot, new ItemStack(Material.GOLD_INGOT, random.nextInt(2) + 1)); - } else if (choice < 30) { - chestInv.setItem(slot, new ItemStack(Material.GOLD_SWORD, 1)); - } else if (choice < 35) { - chestInv.setItem(slot, new ItemStack(Material.GOLD_CHESTPLATE, 1)); - } else if (choice < 40) { - chestInv.setItem(slot, new ItemStack(Material.FLINT_AND_STEEL, 1)); - } else if (choice < 45) { - chestInv.setItem(slot, new ItemStack(Material.NETHER_STALK, random.nextInt(4) + 3)); - } else if (choice < 55) { - chestInv.setItem(slot, new ItemStack(Material.SADDLE, 1)); - } else if (choice < 63) { - chestInv.setItem(slot, new ItemStack(Material.GOLD_BARDING, 1)); - } else if (choice < 68) { - chestInv.setItem(slot, new ItemStack(Material.IRON_BARDING, 1)); - } else if (choice < 71) { - chestInv.setItem(slot, new ItemStack(Material.DIAMOND_BARDING, 1)); - } else { - chestInv.setItem(slot, new ItemStack(Material.OBSIDIAN, random.nextInt(3) + 1)); - } - } - - } else if (b.getType().equals(Material.STONE)) { - b.setType(Material.QUARTZ_ORE); - } else if (b.getType().equals(Material.DIRT)) { - world.generateTree(source.getBlock(x, y + 1, z).getLocation(), TreeType.BROWN_MUSHROOM); - b.setType(Material.SOUL_SAND); - } else if (b.getType().equals(Material.SOUL_SAND) && b.getRelative(BlockFace.UP).getType().equals(Material.AIR) - && random.nextInt(9) == 1) { - b.getRelative(BlockFace.UP).setType(Material.NETHER_WARTS); - } - } - } - } - } -} diff --git a/src/main/java/us/tastybento/bskyblock/BSkyBlock.java b/src/main/java/world/bentobox/bbox/BentoBox.java similarity index 82% rename from src/main/java/us/tastybento/bskyblock/BSkyBlock.java rename to src/main/java/world/bentobox/bbox/BentoBox.java index efa163b1e..9aa8afb75 100755 --- a/src/main/java/us/tastybento/bskyblock/BSkyBlock.java +++ b/src/main/java/world/bentobox/bbox/BentoBox.java @@ -1,44 +1,42 @@ -package us.tastybento.bskyblock; +package world.bentobox.bbox; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; -import us.tastybento.bskyblock.api.configuration.BSBConfig; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.events.BSBReadyEvent; -import us.tastybento.bskyblock.api.placeholders.PlaceholderHandler; -import us.tastybento.bskyblock.api.user.Notifier; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.commands.IslandCommand; -import us.tastybento.bskyblock.database.BSBDbSetup; -import us.tastybento.bskyblock.listeners.BannedVisitorCommands; -import us.tastybento.bskyblock.listeners.BlockEndDragon; -import us.tastybento.bskyblock.listeners.JoinLeaveListener; -import us.tastybento.bskyblock.listeners.NetherPortals; -import us.tastybento.bskyblock.listeners.ObsidianToLava; -import us.tastybento.bskyblock.listeners.PanelListenerManager; -import us.tastybento.bskyblock.listeners.protection.FlyingMobEvents; -import us.tastybento.bskyblock.managers.AddonsManager; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.managers.RanksManager; -import us.tastybento.bskyblock.managers.SchemsManager; -import us.tastybento.bskyblock.util.HeadGetter; +import world.bentobox.bbox.api.configuration.BSBConfig; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.events.BentoBoxReadyEvent; +import world.bentobox.bbox.api.placeholders.PlaceholderHandler; +import world.bentobox.bbox.api.user.Notifier; +import world.bentobox.bbox.database.BSBDbSetup; +import world.bentobox.bbox.listeners.BannedVisitorCommands; +import world.bentobox.bbox.listeners.BlockEndDragon; +import world.bentobox.bbox.listeners.JoinLeaveListener; +import world.bentobox.bbox.listeners.NetherPortals; +import world.bentobox.bbox.listeners.ObsidianToLava; +import world.bentobox.bbox.listeners.PanelListenerManager; +import world.bentobox.bbox.listeners.protection.FlyingMobEvents; +import world.bentobox.bbox.managers.AddonsManager; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.managers.RanksManager; +import world.bentobox.bbox.managers.SchemsManager; +import world.bentobox.bbox.util.HeadGetter; /** - * Main BSkyBlock class - provides an island minigame in the sky + * Main BentoBox class * @author tastybento * @author Poslovitch */ -public class BSkyBlock extends JavaPlugin { +public class BentoBox extends JavaPlugin { - private static BSkyBlock instance; + private static BentoBox instance; // Databases private PlayersManager playersManager; @@ -112,12 +110,6 @@ public class BSkyBlock extends JavaPlugin { islandWorldManager = new IslandWorldManager(instance); // Load schems manager schemsManager = new SchemsManager(instance); - // Load the default island schems - schemsManager.loadIslands(getIWM().getBSBIslandWorld()); - - // Set up commands - new IslandCommand(); - new AdminCommand(); // Locales manager must be loaded before addons localesManager = new LocalesManager(instance); @@ -151,7 +143,7 @@ public class BSkyBlock extends JavaPlugin { instance.log("#############################################"); // Fire plugin ready event - Bukkit.getServer().getPluginManager().callEvent(new BSBReadyEvent()); + Bukkit.getServer().getPluginManager().callEvent(new BentoBoxReadyEvent()); }); }); } @@ -247,11 +239,11 @@ public class BSkyBlock extends JavaPlugin { return islandsManager; } - private static void setInstance(BSkyBlock plugin) { - BSkyBlock.instance = plugin; + private static void setInstance(BentoBox plugin) { + BentoBox.instance = plugin; } - public static BSkyBlock getInstance() { + public static BentoBox getInstance() { return instance; } diff --git a/src/main/java/us/tastybento/bskyblock/Constants.java b/src/main/java/world/bentobox/bbox/Constants.java similarity index 92% rename from src/main/java/us/tastybento/bskyblock/Constants.java rename to src/main/java/world/bentobox/bbox/Constants.java index 1223358c8..76a04be0b 100644 --- a/src/main/java/us/tastybento/bskyblock/Constants.java +++ b/src/main/java/world/bentobox/bbox/Constants.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock; +package world.bentobox.bbox; /** * Contains the plugin constants. diff --git a/src/main/java/us/tastybento/bskyblock/Metrics.java b/src/main/java/world/bentobox/bbox/Metrics.java similarity index 99% rename from src/main/java/us/tastybento/bskyblock/Metrics.java rename to src/main/java/world/bentobox/bbox/Metrics.java index 53ad3d90d..b21e8a0a2 100755 --- a/src/main/java/us/tastybento/bskyblock/Metrics.java +++ b/src/main/java/world/bentobox/bbox/Metrics.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock; +package world.bentobox.bbox; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; diff --git a/src/main/java/world/bentobox/bbox/Settings.java b/src/main/java/world/bentobox/bbox/Settings.java new file mode 100644 index 000000000..f88623221 --- /dev/null +++ b/src/main/java/world/bentobox/bbox/Settings.java @@ -0,0 +1,614 @@ +package world.bentobox.bbox; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import world.bentobox.bbox.api.configuration.ConfigComment; +import world.bentobox.bbox.api.configuration.ConfigEntry; +import world.bentobox.bbox.api.configuration.StoreAt; +import world.bentobox.bbox.database.BSBDbSetup.DatabaseType; +import world.bentobox.bbox.database.objects.DataObject; + +/** + * All the plugin settings are here + * @author Tastybento + */ +@StoreAt(filename="config.yml") // Explicitly call out what name this should have. +@ConfigComment("BentoBox Configuration [version]") +@ConfigComment("This config file is dynamic and saved when the server is shutdown.") +@ConfigComment("You cannot edit it while the server is running because changes will") +@ConfigComment("be lost! Use in-game settings GUI or edit when server is offline.") +@ConfigComment("") +public class Settings implements DataObject { + + // --------------------------------------------- + + /* GENERAL */ + @ConfigComment("BentoBox uses bStats.org to get global data about the plugin to help improving it.") + @ConfigComment("bStats has nearly no effect on your server's performance and the sent data is completely") + @ConfigComment("anonymous so please consider twice if you really want to disable it.") + @ConfigEntry(path = "general.metrics") + private boolean metrics = true; + + @ConfigComment("Check for updates - this will tell Ops and the console if there is a new") + @ConfigComment("version available. It contacts dev.bukkit.org to request the latest version") + @ConfigComment("info. It does not download the latest version or change any files") + @ConfigEntry(path = "general.check-updates") + private boolean checkUpdates = true; + + @ConfigComment("Default language for new players.") + @ConfigComment("This is the filename in the locale folder without .yml.") + @ConfigComment("If this does not exist, the default en-US will be used.") + @ConfigEntry(path = "general.default-language") + private String defaultLanguage = "en-US"; + + @ConfigComment("Use economy or not. If true, an economy plugin is required. If false, no money is used or give.") + @ConfigComment("If there is no economy plugin present anyway, money will be automatically disabled.") + @ConfigEntry(path = "general.use-economy") + private boolean useEconomy = true; + + @ConfigComment("Starting money - this is how much money new players will have as their") + @ConfigComment("balance at the start of an island.") + @ConfigEntry(path = "general.starting-money") + private double startingMoney = 10.0; + + // Purge + @ConfigComment("Only islands below this level will be removed if they are abandoned and admins issue the purge command") + @ConfigEntry(path = "general.purge.max-island-level") + private int purgeMaxIslandLevel = 50; + + @ConfigComment("Remove user data when its island gets purged.") + @ConfigComment("Helps a lot to avoid huge backups and can save some performance on startup,") + @ConfigComment("but the player settings and data will be reset.") + @ConfigEntry(path = "general.purge.remove-user-data") + private boolean purgeRemoveUserData = false; + + // Database + @ConfigComment("FLATFILE, MYSQL, MONGO") + @ConfigComment("if you use MONGO, you must also run the BSBMongo plugin (not addon)") + @ConfigComment("See https://github.com/tastybento/bsbMongo/releases/") + @ConfigEntry(path = "general.database.type") + private DatabaseType databaseType = DatabaseType.FLATFILE; + + @ConfigEntry(path = "general.database.host") + private String dbHost = "localhost"; + + @ConfigComment("Port 3306 is MySQL's default. Port 27017 is MongoDB's default.") + @ConfigEntry(path = "general.database.port") + private int dbPort = 3306; + + @ConfigEntry(path = "general.database.name") + private String dbName = "bentobox"; + + @ConfigEntry(path = "general.database.username") + private String dbUsername = "username"; + + @ConfigEntry(path = "general.database.password") + private String dbPassword = "password"; + + @ConfigComment("How often the data will be saved to file in mins. Default is 5 minutes.") + @ConfigComment("This helps prevent issues if the server crashes.") + @ConfigComment("Data is also saved at important points in the game.") + @ConfigEntry(path = "general.database.backup-period") + private int databaseBackupPeriod = 5; + + @ConfigComment("Recover super flat - if the generator does not run for some reason, you can get") + @ConfigComment("super flat chunks (grass). To remove automatically, select this option. Turn off") + @ConfigComment("if there are no more because it may cause lag.") + @ConfigComment("This will regenerate any chunks with bedrock at y=0 when they are loaded") + @ConfigEntry(path = "general.recover-super-flat") + private boolean recoverSuperFlat = false; + + @ConfigComment("Mute death messages") + @ConfigEntry(path = "general.mute-death-messages") + private boolean muteDeathMessages = false; + + @ConfigComment("Allow FTB Autonomous Activator to work (will allow a pseudo player [CoFH] to place and break blocks and hang items)") + @ConfigComment("Add other fake player names here if required") + @ConfigEntry(path = "general.fakeplayers") + private Set fakePlayers = new HashSet<>(); + + @ConfigComment("Allow obsidian to be scooped up with an empty bucket back into lava") + @ConfigComment("This only works if there is a single block of obsidian (no obsidian within 10 blocks)") + @ConfigComment("Recommendation is to keep this true so that newbies don't bother you or reset their") + @ConfigComment("island unnecessarily.") + @ConfigEntry(path = "general.allow-obsidian-scooping") + private boolean allowObsidianScooping = true; + + @ConfigComment("Time in seconds that players have to confirm sensitive commands, e.g. island reset") + @ConfigEntry(path = "general.confirmation-time") + private int confirmationTime = 20; + + @ConfigEntry(path = "panel.close-on-click-outside") + private boolean closePanelOnClickOutside = true; + + /* + * Island + */ + // Invites + @ConfigComment("How long a player must wait until they can rejoin a team island after being") + @ConfigComment("kicked in minutes. This slows the effectiveness of players repeating challenges") + @ConfigComment("by repetitively being invited to a team island.") + @ConfigEntry(path = "island.invite-wait") + private int inviteWait = 60; + + // Timeout for team kick and leave commands + @ConfigComment("Ask the player to confirm the command he is using by typing it again.") + @ConfigComment("The 'wait' value is the number of seconds to wait for confirmation.") + @ConfigEntry(path = "island.require-confirmation.kick") + private boolean kickConfirmation = true; + + @ConfigEntry(path = "island.require-confirmation.kick-wait") + private long kickWait = 10L; + + @ConfigEntry(path = "island.require-confirmation.leave") + private boolean leaveConfirmation = true; + + @ConfigEntry(path = "island.require-confirmation.leave-wait") + private long leaveWait = 10L; + + @ConfigEntry(path = "island.require-confirmation.reset") + private boolean resetConfirmation = true; + + @ConfigComment("How long a player must wait before they can reset their island again in seconds") + @ConfigEntry(path = "island.reset-wait") + private long resetWait = 300; + + @ConfigComment("These set the minimum and maximum size of a name.") + @ConfigEntry(path = "island.name.min-length") + private int nameMinLength = 4; + @ConfigEntry(path = "island.name.max-length") + private int nameMaxLength = 20; + + + // Ranks + @ConfigEntry(path = "island.customranks") + private Map customRanks = new HashMap<>(); + + + //---------------------------------------------------------------------------------------/ + @ConfigComment("These settings should not be edited") + private String uniqueId = "config"; + + /** + * @return the metrics + */ + public boolean isMetrics() { + return metrics; + } + + /** + * @return the checkUpdates + */ + public boolean isCheckUpdates() { + return checkUpdates; + } + + /** + * @return the defaultLanguage + */ + public String getDefaultLanguage() { + return defaultLanguage; + } + + /** + * @return the useEconomy + */ + public boolean isUseEconomy() { + return useEconomy; + } + + /** + * @return the startingMoney + */ + public double getStartingMoney() { + return startingMoney; + } + + /** + * @return the purgeMaxIslandLevel + */ + public int getPurgeMaxIslandLevel() { + return purgeMaxIslandLevel; + } + + /** + * @return the purgeRemoveUserData + */ + public boolean isPurgeRemoveUserData() { + return purgeRemoveUserData; + } + + /** + * @return the databaseType + */ + public DatabaseType getDatabaseType() { + return databaseType; + } + + /** + * @return the dbHost + */ + public String getDbHost() { + return dbHost; + } + + /** + * @return the dbPort + */ + public int getDbPort() { + return dbPort; + } + + /** + * @return the dbName + */ + public String getDbName() { + return dbName; + } + + /** + * @return the dbUsername + */ + public String getDbUsername() { + return dbUsername; + } + + /** + * @return the dbPassword + */ + public String getDbPassword() { + return dbPassword; + } + + /** + * @return the databaseBackupPeriod + */ + public int getDatabaseBackupPeriod() { + return databaseBackupPeriod; + } + + /** + * @return the recoverSuperFlat + */ + public boolean isRecoverSuperFlat() { + return recoverSuperFlat; + } + + /** + * @return the muteDeathMessages + */ + public boolean isMuteDeathMessages() { + return muteDeathMessages; + } + + /** + * @return the fakePlayers + */ + public Set getFakePlayers() { + return fakePlayers; + } + + /** + * @return the allowObsidianScooping + */ + public boolean isAllowObsidianScooping() { + return allowObsidianScooping; + } + + /** + * @return the confirmationTime + */ + public int getConfirmationTime() { + return confirmationTime; + } + + /** + * @return the closePanelOnClickOutside + */ + public boolean isClosePanelOnClickOutside() { + return closePanelOnClickOutside; + } + + /** + * @return the uniqueId + */ + @Override + public String getUniqueId() { + return uniqueId; + } + + /** + * @param metrics the metrics to set + */ + public void setMetrics(boolean metrics) { + this.metrics = metrics; + } + + /** + * @param checkUpdates the checkUpdates to set + */ + public void setCheckUpdates(boolean checkUpdates) { + this.checkUpdates = checkUpdates; + } + + /** + * @param defaultLanguage the defaultLanguage to set + */ + public void setDefaultLanguage(String defaultLanguage) { + this.defaultLanguage = defaultLanguage; + } + + /** + * @param useEconomy the useEconomy to set + */ + public void setUseEconomy(boolean useEconomy) { + this.useEconomy = useEconomy; + } + + /** + * @param startingMoney the startingMoney to set + */ + public void setStartingMoney(double startingMoney) { + this.startingMoney = startingMoney; + } + + /** + * @param purgeMaxIslandLevel the purgeMaxIslandLevel to set + */ + public void setPurgeMaxIslandLevel(int purgeMaxIslandLevel) { + this.purgeMaxIslandLevel = purgeMaxIslandLevel; + } + + /** + * @param purgeRemoveUserData the purgeRemoveUserData to set + */ + public void setPurgeRemoveUserData(boolean purgeRemoveUserData) { + this.purgeRemoveUserData = purgeRemoveUserData; + } + + /** + * @param databaseType the databaseType to set + */ + public void setDatabaseType(DatabaseType databaseType) { + this.databaseType = databaseType; + } + + /** + * @param dbHost the dbHost to set + */ + public void setDbHost(String dbHost) { + this.dbHost = dbHost; + } + + /** + * @param dbPort the dbPort to set + */ + public void setDbPort(int dbPort) { + this.dbPort = dbPort; + } + + /** + * @param dbName the dbName to set + */ + public void setDbName(String dbName) { + this.dbName = dbName; + } + + /** + * @param dbUsername the dbUsername to set + */ + public void setDbUsername(String dbUsername) { + this.dbUsername = dbUsername; + } + + /** + * @param dbPassword the dbPassword to set + */ + public void setDbPassword(String dbPassword) { + this.dbPassword = dbPassword; + } + + /** + * @param databaseBackupPeriod the databaseBackupPeriod to set + */ + public void setDatabaseBackupPeriod(int databaseBackupPeriod) { + this.databaseBackupPeriod = databaseBackupPeriod; + } + + /** + * @param recoverSuperFlat the recoverSuperFlat to set + */ + public void setRecoverSuperFlat(boolean recoverSuperFlat) { + this.recoverSuperFlat = recoverSuperFlat; + } + + /** + * @param muteDeathMessages the muteDeathMessages to set + */ + public void setMuteDeathMessages(boolean muteDeathMessages) { + this.muteDeathMessages = muteDeathMessages; + } + + /** + * @param fakePlayers the fakePlayers to set + */ + public void setFakePlayers(Set fakePlayers) { + this.fakePlayers = fakePlayers; + } + + /** + * @param allowObsidianScooping the allowObsidianScooping to set + */ + public void setAllowObsidianScooping(boolean allowObsidianScooping) { + this.allowObsidianScooping = allowObsidianScooping; + } + + /** + * @param confirmationTime the confirmationTime to set + */ + public void setConfirmationTime(int confirmationTime) { + this.confirmationTime = confirmationTime; + } + + /** + * @param closePanelOnClickOutside the closePanelOnClickOutside to set + */ + public void setClosePanelOnClickOutside(boolean closePanelOnClickOutside) { + this.closePanelOnClickOutside = closePanelOnClickOutside; + } + + /** + * @param uniqueId the uniqueId to set + */ + @Override + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + /** + * @return the customRanks + */ + public Map getCustomRanks() { + return customRanks; + } + + /** + * @param customRanks the customRanks to set + */ + public void setCustomRanks(Map customRanks) { + this.customRanks = customRanks; + } + + /** + * @return the inviteWait + */ + public int getInviteWait() { + return inviteWait; + } + + /** + * @param inviteWait the inviteWait to set + */ + public void setInviteWait(int inviteWait) { + this.inviteWait = inviteWait; + } + + /** + * @return the kickConfirmation + */ + public boolean isKickConfirmation() { + return kickConfirmation; + } + + /** + * @return the kickWait + */ + public long getKickWait() { + return kickWait; + } + + /** + * @return the leaveConfirmation + */ + public boolean isLeaveConfirmation() { + return leaveConfirmation; + } + + /** + * @return the leaveWait + */ + public long getLeaveWait() { + return leaveWait; + } + + /** + * @param kickConfirmation the kickConfirmation to set + */ + public void setKickConfirmation(boolean kickConfirmation) { + this.kickConfirmation = kickConfirmation; + } + + /** + * @param kickWait the kickWait to set + */ + public void setKickWait(long kickWait) { + this.kickWait = kickWait; + } + + /** + * @param leaveConfirmation the leaveConfirmation to set + */ + public void setLeaveConfirmation(boolean leaveConfirmation) { + this.leaveConfirmation = leaveConfirmation; + } + + /** + * @param leaveWait the leaveWait to set + */ + public void setLeaveWait(long leaveWait) { + this.leaveWait = leaveWait; + } + + /** + * @return the resetWait + */ + public long getResetWait() { + return resetWait; + } + + /** + * @param resetWait the resetWait to set + */ + public void setResetWait(long resetWait) { + this.resetWait = resetWait; + } + + /** + * @return the resetConfirmation + */ + public boolean isResetConfirmation() { + return resetConfirmation; + } + + /** + * @param resetConfirmation the resetConfirmation to set + */ + public void setResetConfirmation(boolean resetConfirmation) { + this.resetConfirmation = resetConfirmation; + } + + /** + * @return the nameMinLength + */ + public int getNameMinLength() { + return nameMinLength; + } + + /** + * @return the nameMaxLength + */ + public int getNameMaxLength() { + return nameMaxLength; + } + + /** + * @param nameMinLength the nameMinLength to set + */ + public void setNameMinLength(int nameMinLength) { + this.nameMinLength = nameMinLength; + } + + /** + * @param nameMaxLength the nameMaxLength to set + */ + public void setNameMaxLength(int nameMaxLength) { + this.nameMaxLength = nameMaxLength; + } + + // Getters and setters + + +} \ No newline at end of file diff --git a/src/main/java/us/tastybento/bskyblock/api/addons/Addon.java b/src/main/java/world/bentobox/bbox/api/addons/Addon.java similarity index 95% rename from src/main/java/us/tastybento/bskyblock/api/addons/Addon.java rename to src/main/java/world/bentobox/bbox/api/addons/Addon.java index 9a88e2cdf..92cf50725 100644 --- a/src/main/java/us/tastybento/bskyblock/api/addons/Addon.java +++ b/src/main/java/world/bentobox/bbox/api/addons/Addon.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.addons; +package world.bentobox.bbox.api.addons; import java.io.File; import java.io.IOException; @@ -14,9 +14,9 @@ import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.event.Listener; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.PlayersManager; /** * Add-on class for BSkyBlock. Extend this to create an add-on. The operation @@ -37,8 +37,8 @@ public abstract class Addon implements AddonInterface { enabled = false; } - public BSkyBlock getBSkyBlock() { - return BSkyBlock.getInstance(); + public BentoBox getBSkyBlock() { + return BentoBox.getInstance(); } /** @@ -118,7 +118,7 @@ public abstract class Addon implements AddonInterface { * @param listener - listener */ public void registerListener(Listener listener) { - Bukkit.getPluginManager().registerEvents(listener, BSkyBlock.getInstance()); + Bukkit.getPluginManager().registerEvents(listener, BentoBox.getInstance()); } /** diff --git a/src/main/java/us/tastybento/bskyblock/api/addons/AddonClassLoader.java b/src/main/java/world/bentobox/bbox/api/addons/AddonClassLoader.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/api/addons/AddonClassLoader.java rename to src/main/java/world/bentobox/bbox/api/addons/AddonClassLoader.java index c53b9d79e..29e278d8a 100644 --- a/src/main/java/us/tastybento/bskyblock/api/addons/AddonClassLoader.java +++ b/src/main/java/world/bentobox/bbox/api/addons/AddonClassLoader.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.addons; +package world.bentobox.bbox.api.addons; import java.io.File; import java.net.MalformedURLException; @@ -14,11 +14,11 @@ import org.bukkit.permissions.PermissionDefault; import org.bukkit.plugin.InvalidDescriptionException; import org.bukkit.util.permissions.DefaultPermissions; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.addons.AddonDescription.AddonDescriptionBuilder; -import us.tastybento.bskyblock.api.addons.exception.InvalidAddonFormatException; -import us.tastybento.bskyblock.api.addons.exception.InvalidAddonInheritException; -import us.tastybento.bskyblock.managers.AddonsManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.addons.AddonDescription.AddonDescriptionBuilder; +import world.bentobox.bbox.api.addons.exception.InvalidAddonFormatException; +import world.bentobox.bbox.api.addons.exception.InvalidAddonInheritException; +import world.bentobox.bbox.managers.AddonsManager; /** * Loads addons and sets up permissions @@ -49,7 +49,7 @@ public class AddonClassLoader extends URLClassLoader { throw new InvalidAddonFormatException("Packages declaration cannot start with 'us.tastybento'"); } } catch (ClassNotFoundException e) { - BSkyBlock.getInstance().logError("Could not load '" + path.getName() + "' in folder '" + path.getParent() + "' - invalid addon.yml"); + BentoBox.getInstance().logError("Could not load '" + path.getName() + "' in folder '" + path.getParent() + "' - invalid addon.yml"); throw new InvalidDescriptionException("Invalid addon.yml"); } diff --git a/src/main/java/us/tastybento/bskyblock/api/addons/AddonDescription.java b/src/main/java/world/bentobox/bbox/api/addons/AddonDescription.java similarity index 98% rename from src/main/java/us/tastybento/bskyblock/api/addons/AddonDescription.java rename to src/main/java/world/bentobox/bbox/api/addons/AddonDescription.java index 22372fa45..f66294833 100644 --- a/src/main/java/us/tastybento/bskyblock/api/addons/AddonDescription.java +++ b/src/main/java/world/bentobox/bbox/api/addons/AddonDescription.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.addons; +package world.bentobox.bbox.api.addons; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/us/tastybento/bskyblock/api/addons/AddonInterface.java b/src/main/java/world/bentobox/bbox/api/addons/AddonInterface.java similarity index 71% rename from src/main/java/us/tastybento/bskyblock/api/addons/AddonInterface.java rename to src/main/java/world/bentobox/bbox/api/addons/AddonInterface.java index 07fb8250e..0ca0b1711 100644 --- a/src/main/java/us/tastybento/bskyblock/api/addons/AddonInterface.java +++ b/src/main/java/world/bentobox/bbox/api/addons/AddonInterface.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.addons; +package world.bentobox.bbox.api.addons; public interface AddonInterface { void onEnable(); diff --git a/src/main/java/us/tastybento/bskyblock/api/addons/AddonState.java b/src/main/java/world/bentobox/bbox/api/addons/AddonState.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/api/addons/AddonState.java rename to src/main/java/world/bentobox/bbox/api/addons/AddonState.java index 47d252e56..d5f4fda6b 100644 --- a/src/main/java/us/tastybento/bskyblock/api/addons/AddonState.java +++ b/src/main/java/world/bentobox/bbox/api/addons/AddonState.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.addons; +package world.bentobox.bbox.api.addons; /** * Represents the current run-time state of a {@link Addon}. diff --git a/src/main/java/us/tastybento/bskyblock/api/addons/exception/AddonException.java b/src/main/java/world/bentobox/bbox/api/addons/exception/AddonException.java similarity index 82% rename from src/main/java/us/tastybento/bskyblock/api/addons/exception/AddonException.java rename to src/main/java/world/bentobox/bbox/api/addons/exception/AddonException.java index 0c15d3988..f5a5915d3 100644 --- a/src/main/java/us/tastybento/bskyblock/api/addons/exception/AddonException.java +++ b/src/main/java/world/bentobox/bbox/api/addons/exception/AddonException.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.addons.exception; +package world.bentobox.bbox.api.addons.exception; public abstract class AddonException extends Exception { diff --git a/src/main/java/us/tastybento/bskyblock/api/addons/exception/InvalidAddonFormatException.java b/src/main/java/world/bentobox/bbox/api/addons/exception/InvalidAddonFormatException.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/api/addons/exception/InvalidAddonFormatException.java rename to src/main/java/world/bentobox/bbox/api/addons/exception/InvalidAddonFormatException.java index 761630bb1..f09625792 100644 --- a/src/main/java/us/tastybento/bskyblock/api/addons/exception/InvalidAddonFormatException.java +++ b/src/main/java/world/bentobox/bbox/api/addons/exception/InvalidAddonFormatException.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.addons.exception; +package world.bentobox.bbox.api.addons.exception; import java.util.logging.Level; diff --git a/src/main/java/us/tastybento/bskyblock/api/addons/exception/InvalidAddonInheritException.java b/src/main/java/world/bentobox/bbox/api/addons/exception/InvalidAddonInheritException.java similarity index 83% rename from src/main/java/us/tastybento/bskyblock/api/addons/exception/InvalidAddonInheritException.java rename to src/main/java/world/bentobox/bbox/api/addons/exception/InvalidAddonInheritException.java index 42b56c27b..21c0b2357 100644 --- a/src/main/java/us/tastybento/bskyblock/api/addons/exception/InvalidAddonInheritException.java +++ b/src/main/java/world/bentobox/bbox/api/addons/exception/InvalidAddonInheritException.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.addons.exception; +package world.bentobox.bbox.api.addons.exception; public class InvalidAddonInheritException extends AddonException { diff --git a/src/main/java/us/tastybento/bskyblock/api/commands/BSBCommand.java b/src/main/java/world/bentobox/bbox/api/commands/BSBCommand.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/api/commands/BSBCommand.java rename to src/main/java/world/bentobox/bbox/api/commands/BSBCommand.java index 5f7be5969..47eb4cf9b 100644 --- a/src/main/java/us/tastybento/bskyblock/api/commands/BSBCommand.java +++ b/src/main/java/world/bentobox/bbox/api/commands/BSBCommand.java @@ -1,9 +1,9 @@ -package us.tastybento.bskyblock.api.commands; +package world.bentobox.bbox.api.commands; import java.util.List; import java.util.Optional; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.user.User; /** * Interface for BSkyBlock Commands diff --git a/src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java b/src/main/java/world/bentobox/bbox/api/commands/CompositeCommand.java similarity index 96% rename from src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java rename to src/main/java/world/bentobox/bbox/api/commands/CompositeCommand.java index ccda8f9e0..7f77562a6 100644 --- a/src/main/java/us/tastybento/bskyblock/api/commands/CompositeCommand.java +++ b/src/main/java/world/bentobox/bbox/api/commands/CompositeCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.commands; +package world.bentobox.bbox.api.commands; import java.util.ArrayList; import java.util.Arrays; @@ -21,16 +21,16 @@ import org.bukkit.command.PluginIdentifiableCommand; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitTask; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.addons.Addon; -import us.tastybento.bskyblock.api.events.command.CommandEvent; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.addons.Addon; +import world.bentobox.bbox.api.events.command.CommandEvent; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.util.Util; /** * BSB composite command @@ -39,7 +39,7 @@ import us.tastybento.bskyblock.util.Util; */ public abstract class CompositeCommand extends Command implements PluginIdentifiableCommand, BSBCommand { - private final BSkyBlock plugin; + private final BentoBox plugin; /** * True if the command is for the player only (not for the console) @@ -108,7 +108,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi super(label); this.addon = addon; this.topLabel = label; - this.plugin = BSkyBlock.getInstance(); + this.plugin = BentoBox.getInstance(); setAliases(new ArrayList<>(Arrays.asList(aliases))); parent = null; setUsage(""); @@ -143,7 +143,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi public CompositeCommand(CompositeCommand parent, String label, String... aliases) { super(label); this.topLabel = parent.getTopLabel(); - this.plugin = BSkyBlock.getInstance(); + this.plugin = BentoBox.getInstance(); this.parent = parent; subCommandLevel = parent.getLevel() + 1; // Add this sub-command to the parent @@ -287,7 +287,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi } @Override - public BSkyBlock getPlugin() { + public BentoBox getPlugin() { return plugin; } diff --git a/src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java b/src/main/java/world/bentobox/bbox/api/commands/DefaultHelpCommand.java similarity index 96% rename from src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java rename to src/main/java/world/bentobox/bbox/api/commands/DefaultHelpCommand.java index 7167f5a1a..2cee7842a 100644 --- a/src/main/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommand.java +++ b/src/main/java/world/bentobox/bbox/api/commands/DefaultHelpCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.commands; +package world.bentobox.bbox.api.commands; import java.util.Collections; import java.util.List; @@ -6,8 +6,8 @@ import java.util.Optional; import org.apache.commons.lang.math.NumberUtils; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; /** * Adds a default help to every command that will show the usage of the command diff --git a/src/main/java/us/tastybento/bskyblock/api/configuration/BSBConfig.java b/src/main/java/world/bentobox/bbox/api/configuration/BSBConfig.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/api/configuration/BSBConfig.java rename to src/main/java/world/bentobox/bbox/api/configuration/BSBConfig.java index 9bcf1b582..701597c49 100644 --- a/src/main/java/us/tastybento/bskyblock/api/configuration/BSBConfig.java +++ b/src/main/java/world/bentobox/bbox/api/configuration/BSBConfig.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.configuration; +package world.bentobox.bbox.api.configuration; import java.beans.IntrospectionException; import java.lang.reflect.InvocationTargetException; @@ -6,10 +6,10 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.addons.Addon; -import us.tastybento.bskyblock.database.AbstractDatabaseHandler; -import us.tastybento.bskyblock.database.flatfile.FlatFileDatabase; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.addons.Addon; +import world.bentobox.bbox.database.AbstractDatabaseHandler; +import world.bentobox.bbox.database.flatfile.FlatFileDatabase; /** * Handy config class to store and load Java POJOs as YAML configs @@ -23,7 +23,7 @@ public class BSBConfig { private Logger logger; @SuppressWarnings("unchecked") - public BSBConfig(BSkyBlock plugin, Class type) { + public BSBConfig(BentoBox plugin, Class type) { this.logger = plugin.getLogger(); handler = (AbstractDatabaseHandler) new FlatFileDatabase().getHandler(type); } diff --git a/src/main/java/us/tastybento/bskyblock/api/configuration/ConfigComment.java b/src/main/java/world/bentobox/bbox/api/configuration/ConfigComment.java similarity index 92% rename from src/main/java/us/tastybento/bskyblock/api/configuration/ConfigComment.java rename to src/main/java/world/bentobox/bbox/api/configuration/ConfigComment.java index 75aafdb7f..e4a5c6af2 100644 --- a/src/main/java/us/tastybento/bskyblock/api/configuration/ConfigComment.java +++ b/src/main/java/world/bentobox/bbox/api/configuration/ConfigComment.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.configuration; +package world.bentobox.bbox.api.configuration; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; diff --git a/src/main/java/us/tastybento/bskyblock/api/configuration/ConfigEntry.java b/src/main/java/world/bentobox/bbox/api/configuration/ConfigEntry.java similarity index 84% rename from src/main/java/us/tastybento/bskyblock/api/configuration/ConfigEntry.java rename to src/main/java/world/bentobox/bbox/api/configuration/ConfigEntry.java index b81c5a15c..5b2af5550 100644 --- a/src/main/java/us/tastybento/bskyblock/api/configuration/ConfigEntry.java +++ b/src/main/java/world/bentobox/bbox/api/configuration/ConfigEntry.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.api.configuration; +package world.bentobox.bbox.api.configuration; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import us.tastybento.bskyblock.Constants.GameType; +import world.bentobox.bbox.Constants.GameType; /** * diff --git a/src/main/java/us/tastybento/bskyblock/api/configuration/StoreAt.java b/src/main/java/world/bentobox/bbox/api/configuration/StoreAt.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/api/configuration/StoreAt.java rename to src/main/java/world/bentobox/bbox/api/configuration/StoreAt.java index f6f63b03a..021915a3c 100644 --- a/src/main/java/us/tastybento/bskyblock/api/configuration/StoreAt.java +++ b/src/main/java/world/bentobox/bbox/api/configuration/StoreAt.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.configuration; +package world.bentobox.bbox.api.configuration; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/us/tastybento/bskyblock/api/configuration/WorldSettings.java b/src/main/java/world/bentobox/bbox/api/configuration/WorldSettings.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/api/configuration/WorldSettings.java rename to src/main/java/world/bentobox/bbox/api/configuration/WorldSettings.java index 9380fed83..060c8b382 100644 --- a/src/main/java/us/tastybento/bskyblock/api/configuration/WorldSettings.java +++ b/src/main/java/world/bentobox/bbox/api/configuration/WorldSettings.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.configuration; +package world.bentobox.bbox.api.configuration; import java.util.List; import java.util.Map; @@ -9,8 +9,8 @@ import org.bukkit.Difficulty; import org.bukkit.GameMode; import org.bukkit.entity.EntityType; -import us.tastybento.bskyblock.api.addons.Addon; -import us.tastybento.bskyblock.api.flags.Flag; +import world.bentobox.bbox.api.addons.Addon; +import world.bentobox.bbox.api.flags.Flag; /** * Contains world-specific settings. Only getters are required, but you may need setters for your own class. @@ -251,4 +251,14 @@ public interface WorldSettings { * Set the island reset time stamp. Any player who last logged in before this time will have resets zeroed */ void setResetEpoch(long timestamp); + + /** + * @return true if the death count should be reset when joining a team in this world + */ + boolean isTeamJoinDeathReset(); + + /** + * @return max number of deaths for this world + */ + int getDeathsMax(); } diff --git a/src/main/java/us/tastybento/bskyblock/api/events/BSBReadyEvent.java b/src/main/java/world/bentobox/bbox/api/events/BentoBoxReadyEvent.java similarity index 54% rename from src/main/java/us/tastybento/bskyblock/api/events/BSBReadyEvent.java rename to src/main/java/world/bentobox/bbox/api/events/BentoBoxReadyEvent.java index 41da85eed..fdeb5dad5 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/BSBReadyEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/BentoBoxReadyEvent.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.events; +package world.bentobox.bbox.api.events; /** * Fired when BSkyBlock is ready to play and all files are loaded @@ -6,4 +6,4 @@ package us.tastybento.bskyblock.api.events; * @author tastybento * @since 1.0 */ -public class BSBReadyEvent extends PremadeEvent {} +public class BentoBoxReadyEvent extends PremadeEvent {} diff --git a/src/main/java/us/tastybento/bskyblock/api/events/IslandBaseEvent.java b/src/main/java/world/bentobox/bbox/api/events/IslandBaseEvent.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/api/events/IslandBaseEvent.java rename to src/main/java/world/bentobox/bbox/api/events/IslandBaseEvent.java index 3d93c9d1b..5bb3313e0 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/IslandBaseEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/IslandBaseEvent.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.api.events; +package world.bentobox.bbox.api.events; import java.util.UUID; import org.bukkit.Location; import org.bukkit.event.Cancellable; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.database.objects.Island; /** * diff --git a/src/main/java/us/tastybento/bskyblock/api/events/PremadeEvent.java b/src/main/java/world/bentobox/bbox/api/events/PremadeEvent.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/api/events/PremadeEvent.java rename to src/main/java/world/bentobox/bbox/api/events/PremadeEvent.java index e1630e52d..27d411987 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/PremadeEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/PremadeEvent.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.events; +package world.bentobox.bbox.api.events; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; diff --git a/src/main/java/us/tastybento/bskyblock/api/events/addon/AddonBaseEvent.java b/src/main/java/world/bentobox/bbox/api/events/addon/AddonBaseEvent.java similarity index 64% rename from src/main/java/us/tastybento/bskyblock/api/events/addon/AddonBaseEvent.java rename to src/main/java/world/bentobox/bbox/api/events/addon/AddonBaseEvent.java index cc8c4d3ec..c27bedc80 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/addon/AddonBaseEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/addon/AddonBaseEvent.java @@ -1,7 +1,7 @@ -package us.tastybento.bskyblock.api.events.addon; +package world.bentobox.bbox.api.events.addon; -import us.tastybento.bskyblock.api.addons.Addon; -import us.tastybento.bskyblock.api.events.PremadeEvent; +import world.bentobox.bbox.api.addons.Addon; +import world.bentobox.bbox.api.events.PremadeEvent; /** * @author Poslovitch diff --git a/src/main/java/us/tastybento/bskyblock/api/events/addon/AddonEvent.java b/src/main/java/world/bentobox/bbox/api/events/addon/AddonEvent.java similarity index 95% rename from src/main/java/us/tastybento/bskyblock/api/events/addon/AddonEvent.java rename to src/main/java/world/bentobox/bbox/api/events/addon/AddonEvent.java index 9a71f1b55..db42b6e6a 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/addon/AddonEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/addon/AddonEvent.java @@ -1,6 +1,6 @@ -package us.tastybento.bskyblock.api.events.addon; +package world.bentobox.bbox.api.events.addon; -import us.tastybento.bskyblock.api.addons.Addon; +import world.bentobox.bbox.api.addons.Addon; public class AddonEvent { diff --git a/src/main/java/us/tastybento/bskyblock/api/events/command/CommandEvent.java b/src/main/java/world/bentobox/bbox/api/events/command/CommandEvent.java similarity index 95% rename from src/main/java/us/tastybento/bskyblock/api/events/command/CommandEvent.java rename to src/main/java/world/bentobox/bbox/api/events/command/CommandEvent.java index 119ad869e..29e781b97 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/command/CommandEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/command/CommandEvent.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.api.events.command; +package world.bentobox.bbox.api.events.command; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.event.Cancellable; -import us.tastybento.bskyblock.api.events.PremadeEvent; +import world.bentobox.bbox.api.events.PremadeEvent; /** * Fired when a team event happens. diff --git a/src/main/java/us/tastybento/bskyblock/api/events/island/FlagChangeEvent.java b/src/main/java/world/bentobox/bbox/api/events/island/FlagChangeEvent.java similarity index 83% rename from src/main/java/us/tastybento/bskyblock/api/events/island/FlagChangeEvent.java rename to src/main/java/world/bentobox/bbox/api/events/island/FlagChangeEvent.java index 0d416b713..95a9cfbee 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/island/FlagChangeEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/island/FlagChangeEvent.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.api.events.island; +package world.bentobox.bbox.api.events.island; import java.util.UUID; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.database.objects.Island; /** * This event is fired when a player changes a flag on his island diff --git a/src/main/java/us/tastybento/bskyblock/api/events/island/IslandEvent.java b/src/main/java/world/bentobox/bbox/api/events/island/IslandEvent.java similarity index 98% rename from src/main/java/us/tastybento/bskyblock/api/events/island/IslandEvent.java rename to src/main/java/world/bentobox/bbox/api/events/island/IslandEvent.java index 4804272c0..2fc528230 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/island/IslandEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/island/IslandEvent.java @@ -1,12 +1,12 @@ -package us.tastybento.bskyblock.api.events.island; +package world.bentobox.bbox.api.events.island; import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Location; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.database.objects.Island; /** * Fired when a team event happens. diff --git a/src/main/java/us/tastybento/bskyblock/api/events/purge/PurgeDeleteIslandEvent.java b/src/main/java/world/bentobox/bbox/api/events/purge/PurgeDeleteIslandEvent.java similarity index 72% rename from src/main/java/us/tastybento/bskyblock/api/events/purge/PurgeDeleteIslandEvent.java rename to src/main/java/world/bentobox/bbox/api/events/purge/PurgeDeleteIslandEvent.java index 9f4360245..3da9c826e 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/purge/PurgeDeleteIslandEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/purge/PurgeDeleteIslandEvent.java @@ -1,7 +1,7 @@ -package us.tastybento.bskyblock.api.events.purge; +package world.bentobox.bbox.api.events.purge; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.database.objects.Island; /** * This event is fired before an island is going to be purged. diff --git a/src/main/java/us/tastybento/bskyblock/api/events/purge/PurgeStartEvent.java b/src/main/java/world/bentobox/bbox/api/events/purge/PurgeStartEvent.java similarity index 95% rename from src/main/java/us/tastybento/bskyblock/api/events/purge/PurgeStartEvent.java rename to src/main/java/world/bentobox/bbox/api/events/purge/PurgeStartEvent.java index 2ecae337e..206fd6143 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/purge/PurgeStartEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/purge/PurgeStartEvent.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.api.events.purge; +package world.bentobox.bbox.api.events.purge; import java.util.List; import java.util.UUID; import org.bukkit.event.Cancellable; -import us.tastybento.bskyblock.api.events.PremadeEvent; +import world.bentobox.bbox.api.events.PremadeEvent; /** * This event is fired when islands to remove have been chosen and before starting to remove them. diff --git a/src/main/java/us/tastybento/bskyblock/api/events/team/TeamEvent.java b/src/main/java/world/bentobox/bbox/api/events/team/TeamEvent.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/api/events/team/TeamEvent.java rename to src/main/java/world/bentobox/bbox/api/events/team/TeamEvent.java index c53daba2b..f61ceb2c1 100644 --- a/src/main/java/us/tastybento/bskyblock/api/events/team/TeamEvent.java +++ b/src/main/java/world/bentobox/bbox/api/events/team/TeamEvent.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.api.events.team; +package world.bentobox.bbox.api.events.team; import java.util.UUID; import org.bukkit.Location; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.database.objects.Island; /** * Fired when a team event happens. diff --git a/src/main/java/us/tastybento/bskyblock/api/flags/AbstractFlagListener.java b/src/main/java/world/bentobox/bbox/api/flags/AbstractFlagListener.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/api/flags/AbstractFlagListener.java rename to src/main/java/world/bentobox/bbox/api/flags/AbstractFlagListener.java index 9941baa50..aad9d6c62 100644 --- a/src/main/java/us/tastybento/bskyblock/api/flags/AbstractFlagListener.java +++ b/src/main/java/world/bentobox/bbox/api/flags/AbstractFlagListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.flags; +package world.bentobox.bbox.api.flags; import java.lang.reflect.Method; import java.util.Optional; @@ -9,12 +9,12 @@ import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.Listener; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; /** * Abstract class for flag listeners. Provides common code. @@ -23,13 +23,13 @@ import us.tastybento.bskyblock.managers.IslandsManager; */ public abstract class AbstractFlagListener implements Listener { - private BSkyBlock plugin = BSkyBlock.getInstance(); + private BentoBox plugin = BentoBox.getInstance(); private User user = null; /** * @return the plugin */ - public BSkyBlock getPlugin() { + public BentoBox getPlugin() { return plugin; } @@ -37,7 +37,7 @@ public abstract class AbstractFlagListener implements Listener { * Used for unit testing only to set the plugin * @param plugin - BSkyBlock plugin object */ - public void setPlugin(BSkyBlock plugin) { + public void setPlugin(BentoBox plugin) { this.plugin = plugin; } @@ -106,7 +106,7 @@ public abstract class AbstractFlagListener implements Listener { * Check if flag is allowed at location * @param e - event * @param loc - location - * @param flag - flag {@link us.tastybento.bskyblock.lists.Flags} + * @param flag - flag {@link world.bentobox.bbox.lists.Flags} * @return true if allowed, false if not */ public boolean checkIsland(Event e, Location loc, Flag flag) { @@ -117,7 +117,7 @@ public abstract class AbstractFlagListener implements Listener { * Check if flag is allowed at location * @param e - event * @param loc - location - * @param flag - flag {@link us.tastybento.bskyblock.lists.Flags} + * @param flag - flag {@link world.bentobox.bbox.lists.Flags} * @param silent - if true, no attempt is made to tell the user * @return true if the check is okay, false if it was disallowed */ diff --git a/src/main/java/us/tastybento/bskyblock/api/flags/Flag.java b/src/main/java/world/bentobox/bbox/api/flags/Flag.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/api/flags/Flag.java rename to src/main/java/world/bentobox/bbox/api/flags/Flag.java index 2aba31670..aa2ae6d8e 100644 --- a/src/main/java/us/tastybento/bskyblock/api/flags/Flag.java +++ b/src/main/java/world/bentobox/bbox/api/flags/Flag.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.flags; +package world.bentobox.bbox.api.flags; import java.util.Optional; @@ -7,20 +7,20 @@ import org.bukkit.World; import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.RanksManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.panels.builders.PanelItemBuilder; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.RanksManager; public class Flag implements Comparable { public enum Type { PROTECTION(Material.SHIELD), - SETTING(Material.COMMAND), + SETTING(Material.STONE), WORLD_SETTING(Material.GRASS); private Material icon; @@ -75,7 +75,7 @@ public class Flag implements Comparable { */ public boolean isSetForWorld(World world) { if (type.equals(Type.WORLD_SETTING)) { - WorldSettings ws = BSkyBlock.getInstance().getIWM().getWorldSettings(world); + WorldSettings ws = BentoBox.getInstance().getIWM().getWorldSettings(world); if (ws != null) { ws.getWorldFlags().putIfAbsent(getID(), setting); return ws.getWorldFlags().get(getID()); @@ -94,7 +94,7 @@ public class Flag implements Comparable { */ public void setSetting(World world, boolean setting) { if (getType().equals(Type.WORLD_SETTING)) { - BSkyBlock.getInstance().getIWM().getWorldSettings(world).getWorldFlags().put(getID(), setting); + BentoBox.getInstance().getIWM().getWorldSettings(world).getWorldFlags().put(getID(), setting); } } @@ -183,7 +183,7 @@ public class Flag implements Comparable { * @param user - user that will see this flag * @return - PanelItem for this flag */ - public PanelItem toPanelItem(BSkyBlock plugin, User user) { + public PanelItem toPanelItem(BentoBox plugin, User user) { // Start the flag conversion PanelItemBuilder pib = new PanelItemBuilder() .icon(new ItemStack(icon)) @@ -200,7 +200,7 @@ public class Flag implements Comparable { pib.description(user.getTranslation("protection.panel.flag-item.setting-layout", TextVariables.DESCRIPTION, user.getTranslation(getDescriptionReference()) , "[setting]", worldDetting)); return pib.build(); - } + } // Get the island this user is on or their own Island island = plugin.getIslands().getIslandAt(user.getLocation()).orElse(plugin.getIslands().getIsland(user.getWorld(), user.getUniqueId())); diff --git a/src/main/java/us/tastybento/bskyblock/api/flags/FlagBuilder.java b/src/main/java/world/bentobox/bbox/api/flags/FlagBuilder.java similarity index 86% rename from src/main/java/us/tastybento/bskyblock/api/flags/FlagBuilder.java rename to src/main/java/world/bentobox/bbox/api/flags/FlagBuilder.java index d1bc5e914..741a6789c 100644 --- a/src/main/java/us/tastybento/bskyblock/api/flags/FlagBuilder.java +++ b/src/main/java/world/bentobox/bbox/api/flags/FlagBuilder.java @@ -1,14 +1,14 @@ -package us.tastybento.bskyblock.api.flags; +package world.bentobox.bbox.api.flags; import org.bukkit.Material; import org.bukkit.event.Listener; -import us.tastybento.bskyblock.api.flags.Flag.Type; -import us.tastybento.bskyblock.api.flags.clicklisteners.CycleClick; -import us.tastybento.bskyblock.api.flags.clicklisteners.IslandToggleClick; -import us.tastybento.bskyblock.api.flags.clicklisteners.WorldToggleClick; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.managers.RanksManager; +import world.bentobox.bbox.api.flags.Flag.Type; +import world.bentobox.bbox.api.flags.clicklisteners.CycleClick; +import world.bentobox.bbox.api.flags.clicklisteners.IslandToggleClick; +import world.bentobox.bbox.api.flags.clicklisteners.WorldToggleClick; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.managers.RanksManager; public class FlagBuilder { @@ -109,7 +109,7 @@ public class FlagBuilder { /** * Adds a listener for clicks on this flag when it is a panel item. Default is - * {@link us.tastybento.bskyblock.api.flags.clicklisteners.CycleClick} + * {@link world.bentobox.bbox.api.flags.clicklisteners.CycleClick} * @param onClickListener - the listener for clicks. Must use the ClickOn interface * @return FlagBuilder */ diff --git a/src/main/java/us/tastybento/bskyblock/api/flags/clicklisteners/CycleClick.java b/src/main/java/world/bentobox/bbox/api/flags/clicklisteners/CycleClick.java similarity index 84% rename from src/main/java/us/tastybento/bskyblock/api/flags/clicklisteners/CycleClick.java rename to src/main/java/world/bentobox/bbox/api/flags/clicklisteners/CycleClick.java index f2a260712..086386256 100644 --- a/src/main/java/us/tastybento/bskyblock/api/flags/clicklisteners/CycleClick.java +++ b/src/main/java/world/bentobox/bbox/api/flags/clicklisteners/CycleClick.java @@ -1,16 +1,16 @@ -package us.tastybento.bskyblock.api.flags.clicklisteners; +package world.bentobox.bbox.api.flags.clicklisteners; import org.bukkit.Sound; import org.bukkit.event.inventory.ClickType; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.RanksManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.RanksManager; +import world.bentobox.bbox.util.Util; /** * Left Clicks increase rank, right clicks lower rank @@ -19,7 +19,7 @@ import us.tastybento.bskyblock.util.Util; */ public class CycleClick implements PanelItem.ClickHandler { - private BSkyBlock plugin = BSkyBlock.getInstance(); + private BentoBox plugin = BentoBox.getInstance(); private final String id; /** diff --git a/src/main/java/us/tastybento/bskyblock/api/flags/clicklisteners/IslandToggleClick.java b/src/main/java/world/bentobox/bbox/api/flags/clicklisteners/IslandToggleClick.java similarity index 72% rename from src/main/java/us/tastybento/bskyblock/api/flags/clicklisteners/IslandToggleClick.java rename to src/main/java/world/bentobox/bbox/api/flags/clicklisteners/IslandToggleClick.java index d34833153..53b60d13f 100644 --- a/src/main/java/us/tastybento/bskyblock/api/flags/clicklisteners/IslandToggleClick.java +++ b/src/main/java/world/bentobox/bbox/api/flags/clicklisteners/IslandToggleClick.java @@ -1,18 +1,18 @@ /* */ -package us.tastybento.bskyblock.api.flags.clicklisteners; +package world.bentobox.bbox.api.flags.clicklisteners; import org.bukkit.Sound; import org.bukkit.event.inventory.ClickType; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem.ClickHandler; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.util.Util; /** * Toggles a island setting on/off @@ -21,7 +21,7 @@ import us.tastybento.bskyblock.util.Util; */ public class IslandToggleClick implements ClickHandler { - private BSkyBlock plugin = BSkyBlock.getInstance(); + private BentoBox plugin = BentoBox.getInstance(); private String id; /** @@ -31,9 +31,6 @@ public class IslandToggleClick implements ClickHandler { this.id = id; } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler#onClick(us.tastybento.bskyblock.api.panels.Panel, us.tastybento.bskyblock.api.user.User, org.bukkit.event.inventory.ClickType, int) - */ @Override public boolean onClick(Panel panel, User user, ClickType clickType, int slot) { // Get the world diff --git a/src/main/java/us/tastybento/bskyblock/api/flags/clicklisteners/WorldToggleClick.java b/src/main/java/world/bentobox/bbox/api/flags/clicklisteners/WorldToggleClick.java similarity index 70% rename from src/main/java/us/tastybento/bskyblock/api/flags/clicklisteners/WorldToggleClick.java rename to src/main/java/world/bentobox/bbox/api/flags/clicklisteners/WorldToggleClick.java index e0b47422e..d12067a15 100644 --- a/src/main/java/us/tastybento/bskyblock/api/flags/clicklisteners/WorldToggleClick.java +++ b/src/main/java/world/bentobox/bbox/api/flags/clicklisteners/WorldToggleClick.java @@ -1,17 +1,17 @@ /* */ -package us.tastybento.bskyblock.api.flags.clicklisteners; +package world.bentobox.bbox.api.flags.clicklisteners; import org.bukkit.Sound; import org.bukkit.event.inventory.ClickType; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem.ClickHandler; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; /** * Toggles a worldwide setting on/off @@ -20,7 +20,7 @@ import us.tastybento.bskyblock.util.Util; */ public class WorldToggleClick implements ClickHandler { - private BSkyBlock plugin = BSkyBlock.getInstance(); + private BentoBox plugin = BentoBox.getInstance(); private String id; /** @@ -30,10 +30,6 @@ public class WorldToggleClick implements ClickHandler { this.id = id; } - - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler#onClick(us.tastybento.bskyblock.api.panels.Panel, us.tastybento.bskyblock.api.user.User, org.bukkit.event.inventory.ClickType, int) - */ @Override public boolean onClick(Panel panel, User user, ClickType clickType, int slot) { // Get the world diff --git a/src/main/java/us/tastybento/bskyblock/api/localization/BSBLocale.java b/src/main/java/world/bentobox/bbox/api/localization/BentoBoxLocale.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/api/localization/BSBLocale.java rename to src/main/java/world/bentobox/bbox/api/localization/BentoBoxLocale.java index 0dc06fbca..613bb7fa1 100644 --- a/src/main/java/us/tastybento/bskyblock/api/localization/BSBLocale.java +++ b/src/main/java/world/bentobox/bbox/api/localization/BentoBoxLocale.java @@ -1,24 +1,22 @@ -package us.tastybento.bskyblock.api.localization; +package world.bentobox.bbox.api.localization; -import java.io.File; import java.util.Locale; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.inventory.ItemStack; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.util.ItemParser; +import world.bentobox.bbox.util.ItemParser; /** * @author Poslovitch, tastybento */ -public class BSBLocale { +public class BentoBoxLocale { private Locale locale; private YamlConfiguration config; private ItemStack banner; - public BSBLocale(Locale locale, YamlConfiguration config) { + public BentoBoxLocale(Locale locale, YamlConfiguration config) { this.locale = locale; this.config = config; diff --git a/src/main/java/us/tastybento/bskyblock/api/localization/TextVariables.java b/src/main/java/world/bentobox/bbox/api/localization/TextVariables.java similarity index 92% rename from src/main/java/us/tastybento/bskyblock/api/localization/TextVariables.java rename to src/main/java/world/bentobox/bbox/api/localization/TextVariables.java index 3f0bcf305..fea96d04c 100644 --- a/src/main/java/us/tastybento/bskyblock/api/localization/TextVariables.java +++ b/src/main/java/world/bentobox/bbox/api/localization/TextVariables.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.localization; +package world.bentobox.bbox.api.localization; /** * Contains the common variables that can be used in texts. diff --git a/src/main/java/us/tastybento/bskyblock/api/panels/Panel.java b/src/main/java/world/bentobox/bbox/api/panels/Panel.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/api/panels/Panel.java rename to src/main/java/world/bentobox/bbox/api/panels/Panel.java index fcb2adde5..bd1846f7d 100644 --- a/src/main/java/us/tastybento/bskyblock/api/panels/Panel.java +++ b/src/main/java/world/bentobox/bbox/api/panels/Panel.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.panels; +package world.bentobox.bbox.api.panels; import java.util.Map; import java.util.Optional; @@ -10,10 +10,10 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.listeners.PanelListenerManager; -import us.tastybento.bskyblock.util.HeadGetter; -import us.tastybento.bskyblock.util.HeadRequester; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.listeners.PanelListenerManager; +import world.bentobox.bbox.util.HeadGetter; +import world.bentobox.bbox.util.HeadRequester; public class Panel implements HeadRequester { diff --git a/src/main/java/us/tastybento/bskyblock/api/panels/PanelItem.java b/src/main/java/world/bentobox/bbox/api/panels/PanelItem.java similarity index 95% rename from src/main/java/us/tastybento/bskyblock/api/panels/PanelItem.java rename to src/main/java/world/bentobox/bbox/api/panels/PanelItem.java index df27748ac..e2bceb543 100644 --- a/src/main/java/us/tastybento/bskyblock/api/panels/PanelItem.java +++ b/src/main/java/world/bentobox/bbox/api/panels/PanelItem.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.panels; +package world.bentobox.bbox.api.panels; import java.util.List; import java.util.Optional; @@ -9,8 +9,8 @@ import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.panels.builders.PanelItemBuilder; +import world.bentobox.bbox.api.user.User; public class PanelItem { diff --git a/src/main/java/us/tastybento/bskyblock/api/panels/PanelListener.java b/src/main/java/world/bentobox/bbox/api/panels/PanelListener.java similarity index 79% rename from src/main/java/us/tastybento/bskyblock/api/panels/PanelListener.java rename to src/main/java/world/bentobox/bbox/api/panels/PanelListener.java index dbc7c5942..b7f4d95e5 100644 --- a/src/main/java/us/tastybento/bskyblock/api/panels/PanelListener.java +++ b/src/main/java/world/bentobox/bbox/api/panels/PanelListener.java @@ -1,9 +1,9 @@ -package us.tastybento.bskyblock.api.panels; +package world.bentobox.bbox.api.panels; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.user.User; public interface PanelListener { diff --git a/src/main/java/us/tastybento/bskyblock/api/panels/builders/PanelBuilder.java b/src/main/java/world/bentobox/bbox/api/panels/builders/PanelBuilder.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/api/panels/builders/PanelBuilder.java rename to src/main/java/world/bentobox/bbox/api/panels/builders/PanelBuilder.java index 0a49fd3e3..49897a262 100644 --- a/src/main/java/us/tastybento/bskyblock/api/panels/builders/PanelBuilder.java +++ b/src/main/java/world/bentobox/bbox/api/panels/builders/PanelBuilder.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.api.panels.builders; +package world.bentobox.bbox.api.panels.builders; import java.util.TreeMap; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.panels.PanelListener; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.panels.PanelListener; +import world.bentobox.bbox.api.user.User; public class PanelBuilder { private String name; diff --git a/src/main/java/us/tastybento/bskyblock/api/panels/builders/PanelItemBuilder.java b/src/main/java/world/bentobox/bbox/api/panels/builders/PanelItemBuilder.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/api/panels/builders/PanelItemBuilder.java rename to src/main/java/world/bentobox/bbox/api/panels/builders/PanelItemBuilder.java index 54d173f53..03630aed0 100644 --- a/src/main/java/us/tastybento/bskyblock/api/panels/builders/PanelItemBuilder.java +++ b/src/main/java/world/bentobox/bbox/api/panels/builders/PanelItemBuilder.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.panels.builders; +package world.bentobox.bbox.api.panels.builders; import java.util.ArrayList; import java.util.Arrays; @@ -8,8 +8,8 @@ import java.util.List; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.panels.PanelItem.ClickHandler; public class PanelItemBuilder { private ItemStack icon = new ItemStack(Material.AIR); @@ -35,7 +35,7 @@ public class PanelItemBuilder { * @return PanelItemBuilder */ public PanelItemBuilder icon(String playerName) { - this.icon = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); + this.icon = new ItemStack(Material.SKULL_ITEM, 1); this.name = playerName; this.playerHead = true; return this; diff --git a/src/main/java/us/tastybento/bskyblock/api/placeholders/Placeholder.java b/src/main/java/world/bentobox/bbox/api/placeholders/Placeholder.java similarity index 84% rename from src/main/java/us/tastybento/bskyblock/api/placeholders/Placeholder.java rename to src/main/java/world/bentobox/bbox/api/placeholders/Placeholder.java index fc4adddf4..a9ebde73a 100644 --- a/src/main/java/us/tastybento/bskyblock/api/placeholders/Placeholder.java +++ b/src/main/java/world/bentobox/bbox/api/placeholders/Placeholder.java @@ -1,6 +1,6 @@ -package us.tastybento.bskyblock.api.placeholders; +package world.bentobox.bbox.api.placeholders; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.user.User; /** * @author Poslovitch diff --git a/src/main/java/us/tastybento/bskyblock/api/placeholders/PlaceholderAPIInterface.java b/src/main/java/world/bentobox/bbox/api/placeholders/PlaceholderAPIInterface.java similarity index 78% rename from src/main/java/us/tastybento/bskyblock/api/placeholders/PlaceholderAPIInterface.java rename to src/main/java/world/bentobox/bbox/api/placeholders/PlaceholderAPIInterface.java index 1bc6f10be..8de94bf7d 100644 --- a/src/main/java/us/tastybento/bskyblock/api/placeholders/PlaceholderAPIInterface.java +++ b/src/main/java/world/bentobox/bbox/api/placeholders/PlaceholderAPIInterface.java @@ -1,7 +1,7 @@ -package us.tastybento.bskyblock.api.placeholders; +package world.bentobox.bbox.api.placeholders; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; /** * Simple interface for every Placeholder API. @@ -21,13 +21,13 @@ public interface PlaceholderAPIInterface { * @param plugin - BSkyBlock plugin object * @return true if successfully registered */ - boolean register(BSkyBlock plugin); + boolean register(BentoBox plugin); /** * Unregisters the placeholder API * @param plugin - BSkyBlock plugin object */ - void unregister(BSkyBlock plugin); + void unregister(BentoBox plugin); /** * Replace placeholders in the message according to the receiver diff --git a/src/main/java/us/tastybento/bskyblock/api/placeholders/PlaceholderBuilder.java b/src/main/java/world/bentobox/bbox/api/placeholders/PlaceholderBuilder.java similarity index 92% rename from src/main/java/us/tastybento/bskyblock/api/placeholders/PlaceholderBuilder.java rename to src/main/java/world/bentobox/bbox/api/placeholders/PlaceholderBuilder.java index f6ca9f36b..49cc38a3a 100644 --- a/src/main/java/us/tastybento/bskyblock/api/placeholders/PlaceholderBuilder.java +++ b/src/main/java/world/bentobox/bbox/api/placeholders/PlaceholderBuilder.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.placeholders; +package world.bentobox.bbox.api.placeholders; public class PlaceholderBuilder { diff --git a/src/main/java/us/tastybento/bskyblock/api/placeholders/PlaceholderHandler.java b/src/main/java/world/bentobox/bbox/api/placeholders/PlaceholderHandler.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/api/placeholders/PlaceholderHandler.java rename to src/main/java/world/bentobox/bbox/api/placeholders/PlaceholderHandler.java index f69ba83f2..195a673db 100644 --- a/src/main/java/us/tastybento/bskyblock/api/placeholders/PlaceholderHandler.java +++ b/src/main/java/world/bentobox/bbox/api/placeholders/PlaceholderHandler.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.api.placeholders; +package world.bentobox.bbox.api.placeholders; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; /** * Handles hooks with other Placeholder APIs. @@ -13,11 +13,11 @@ import us.tastybento.bskyblock.api.user.User; * @author Poslovitch, Tastybento */ public class PlaceholderHandler { - private static final String PACKAGE = "us.tastybento.bskyblock.api.placeholders.hooks."; - + private static final String PACKAGE = "world.bentobox.bbox.api.placeholders.hooks."; + // This class should never be instantiated (all methods are static) private PlaceholderHandler() {} - + /** * List of API classes in the package specified above (except the Internal one) */ @@ -31,7 +31,7 @@ public class PlaceholderHandler { * Register placeholders and hooks * @param plugin - BSkyBlock plugin object */ - public static void register(BSkyBlock plugin){ + public static void register(BentoBox plugin){ // Load Internal Placeholder API try{ @@ -66,7 +66,7 @@ public class PlaceholderHandler { * Unregister placeholder hooks * @param plugin - BSkyBlock plugin object */ - public static void unregister(BSkyBlock plugin){ + public static void unregister(BentoBox plugin){ Iterator it = apis.iterator(); while (it.hasNext()) { PlaceholderAPIInterface api = it.next(); diff --git a/src/main/java/us/tastybento/bskyblock/api/placeholders/hooks/InternalPlaceholderImpl.java b/src/main/java/world/bentobox/bbox/api/placeholders/hooks/InternalPlaceholderImpl.java similarity index 64% rename from src/main/java/us/tastybento/bskyblock/api/placeholders/hooks/InternalPlaceholderImpl.java rename to src/main/java/world/bentobox/bbox/api/placeholders/hooks/InternalPlaceholderImpl.java index f8afcadd9..32d91828f 100644 --- a/src/main/java/us/tastybento/bskyblock/api/placeholders/hooks/InternalPlaceholderImpl.java +++ b/src/main/java/world/bentobox/bbox/api/placeholders/hooks/InternalPlaceholderImpl.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.api.placeholders.hooks; +package world.bentobox.bbox.api.placeholders.hooks; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.placeholders.Placeholder; -import us.tastybento.bskyblock.api.placeholders.PlaceholderAPIInterface; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Placeholders; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.placeholders.Placeholder; +import world.bentobox.bbox.api.placeholders.PlaceholderAPIInterface; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Placeholders; /** * Built-in placeholder API @@ -19,12 +19,12 @@ public class InternalPlaceholderImpl implements PlaceholderAPIInterface { } @Override - public boolean register(BSkyBlock plugin) { + public boolean register(BentoBox plugin) { return true; } @Override - public void unregister(BSkyBlock plugin) { + public void unregister(BentoBox plugin) { // Useless : it would disable the placeholders. } diff --git a/src/main/java/us/tastybento/bskyblock/api/user/Notifier.java b/src/main/java/world/bentobox/bbox/api/user/Notifier.java similarity index 98% rename from src/main/java/us/tastybento/bskyblock/api/user/Notifier.java rename to src/main/java/world/bentobox/bbox/api/user/Notifier.java index 72094891a..20879bb96 100644 --- a/src/main/java/us/tastybento/bskyblock/api/user/Notifier.java +++ b/src/main/java/world/bentobox/bbox/api/user/Notifier.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.user; +package world.bentobox.bbox.api.user; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/us/tastybento/bskyblock/api/user/User.java b/src/main/java/world/bentobox/bbox/api/user/User.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/api/user/User.java rename to src/main/java/world/bentobox/bbox/api/user/User.java index e7acff6da..614db14ef 100644 --- a/src/main/java/us/tastybento/bskyblock/api/user/User.java +++ b/src/main/java/world/bentobox/bbox/api/user/User.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.user; +package world.bentobox.bbox.api.user; import java.util.HashMap; import java.util.Locale; @@ -17,8 +17,8 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.PlayerInventory; import org.bukkit.permissions.PermissionAttachmentInfo; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.placeholders.PlaceholderHandler; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.placeholders.PlaceholderHandler; /** * BSB's user object. Wraps Player. @@ -87,7 +87,7 @@ public class User { // ---------------------------------------------------- - private static BSkyBlock plugin = BSkyBlock.getInstance(); + private static BentoBox plugin = BentoBox.getInstance(); private Player player; private final UUID playerUUID; @@ -116,7 +116,7 @@ public class User { * Used for testing * @param p - BSkyBlock plugin */ - public static void setPlugin(BSkyBlock p) { + public static void setPlugin(BentoBox p) { plugin = p; } diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsAllCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminClearResetsAllCommand.java similarity index 87% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsAllCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminClearResetsAllCommand.java index 05efa4fdb..d59bb20a2 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsAllCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminClearResetsAllCommand.java @@ -1,12 +1,12 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.util.List; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; public class AdminClearResetsAllCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminClearResetsCommand.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminClearResetsCommand.java index 7fc7bf3f5..9bc4cd0c6 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminClearResetsCommand.java @@ -1,13 +1,13 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; public class AdminClearResetsCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminGetRankCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminGetRankCommand.java similarity index 75% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminGetRankCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminGetRankCommand.java index ab38bf879..6af82163a 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminGetRankCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminGetRankCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.util.List; import java.util.Optional; @@ -8,11 +8,11 @@ import java.util.stream.Collectors; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.RanksManager; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.RanksManager; /** * @author tastybento @@ -24,9 +24,6 @@ public class AdminGetRankCommand extends CompositeCommand { super(adminCommand, "getrank"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.BSBCommand#setup() - */ @Override public void setup() { setPermission("admin.setrank"); @@ -35,16 +32,13 @@ public class AdminGetRankCommand extends CompositeCommand { setDescription("commands.admin.getrank.description"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List) - */ @Override public boolean execute(User user, String label, List args) { if (args.size() != 1) { // Show help showHelp(this, user); return false; - } + } // Get target player UUID targetUUID = getPlayers().getUUID(args.get(0)); if (targetUUID == null) { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminInfoCommand.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminInfoCommand.java index 991391a11..da2dc4f82 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminInfoCommand.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.util.List; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; public class AdminInfoCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminRegisterCommand.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminRegisterCommand.java index 356dd7056..cb248f066 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminRegisterCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.util.ArrayList; import java.util.List; @@ -8,10 +8,10 @@ import java.util.UUID; import org.bukkit.Location; import org.bukkit.Material; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.util.Util; public class AdminRegisterCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminReloadCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminReloadCommand.java similarity index 55% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminReloadCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminReloadCommand.java index b95837c2a..bba63004f 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminReloadCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminReloadCommand.java @@ -1,9 +1,9 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.util.List; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; /** * @author tastybento @@ -18,17 +18,11 @@ public class AdminReloadCommand extends CompositeCommand { super(parent, "reload", "rl"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.BSBCommand#setup() - */ @Override public void setup() { setDescription("commands.admin.reload.description"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List) - */ @Override public boolean execute(User user, String label, List args) { return true; diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSchemCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminSchemCommand.java similarity index 95% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminSchemCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminSchemCommand.java index e77d13ca3..b7b8bbd1c 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSchemCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminSchemCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.io.File; import java.util.HashMap; @@ -10,10 +10,10 @@ import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.island.builders.Clipboard; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.island.builders.Clipboard; +import world.bentobox.bbox.util.Util; public class AdminSchemCommand extends CompositeCommand { private Map clipboards; diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSetRankCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminSetRankCommand.java similarity index 80% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminSetRankCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminSetRankCommand.java index 0ec49b4f9..bf7dbbfba 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminSetRankCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminSetRankCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.util.List; import java.util.Map; @@ -6,10 +6,10 @@ import java.util.Optional; import java.util.UUID; import java.util.stream.Collectors; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.RanksManager; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.RanksManager; /** * @author tastybento @@ -21,9 +21,6 @@ public class AdminSetRankCommand extends CompositeCommand { super(adminCommand, "setrank"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.BSBCommand#setup() - */ @Override public void setup() { setPermission("admin.setrank"); @@ -32,16 +29,13 @@ public class AdminSetRankCommand extends CompositeCommand { setDescription("commands.admin.setrank.description"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List) - */ @Override public boolean execute(User user, String label, List args) { if (args.size() != 2) { // Show help showHelp(this, user); return false; - } + } // Get target player UUID targetUUID = getPlayers().getUUID(args.get(0)); if (targetUUID == null) { @@ -62,8 +56,8 @@ public class AdminSetRankCommand extends CompositeCommand { return false; } User target = User.getInstance(targetUUID); - - Island island = getPlugin().getIslands().getIsland(getWorld(), targetUUID); + + Island island = getPlugin().getIslands().getIsland(getWorld(), targetUUID); int currentRank = island.getRank(target); island.setRank(target, rankValue); user.sendMessage("commands.admin.setrank.rank-set", "[from]", user.getTranslation(rm.getRank(currentRank)), "[to]", user.getTranslation(rm.getRank(rankValue))); diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminTeleportCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminTeleportCommand.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminTeleportCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminTeleportCommand.java index 144c8bb0c..7d619e9b0 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminTeleportCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminTeleportCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.util.ArrayList; import java.util.List; @@ -7,10 +7,10 @@ import java.util.UUID; import org.bukkit.Location; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; -import us.tastybento.bskyblock.util.teleport.SafeTeleportBuilder; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; +import world.bentobox.bbox.util.teleport.SafeTeleportBuilder; public class AdminTeleportCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminUnregisterCommand.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminUnregisterCommand.java index 190a24424..619a73e27 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminUnregisterCommand.java @@ -1,13 +1,13 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; public class AdminUnregisterCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminVersionCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/AdminVersionCommand.java similarity index 75% rename from src/main/java/us/tastybento/bskyblock/commands/admin/AdminVersionCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/AdminVersionCommand.java index 0cdd3f3a6..11b16a088 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/AdminVersionCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/AdminVersionCommand.java @@ -1,9 +1,9 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import java.util.List; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; public class AdminVersionCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeCommand.java similarity index 79% rename from src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeCommand.java index 89a083b20..1379d3e0e 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeCommand.java @@ -1,9 +1,9 @@ -package us.tastybento.bskyblock.commands.admin.range; +package world.bentobox.bbox.commands.admin.range; import java.util.List; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; /** * @author Poslovitch diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeDisplayCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeDisplayCommand.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeDisplayCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeDisplayCommand.java index 6cf8c5fc6..64f60ffad 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeDisplayCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeDisplayCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin.range; +package world.bentobox.bbox.commands.admin.range; import java.util.HashMap; import java.util.List; @@ -10,8 +10,8 @@ import org.bukkit.Particle; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; /** * @author Poslovitch @@ -76,8 +76,8 @@ public class AdminRangeDisplayCommand extends CompositeCommand { drawZone(user.getPlayer(), Particle.BARRIER, island.getCenter(), island.getProtectionRange()); // Draw the default protected area if island protected zone is different - if (island.getProtectionRange() != getPlugin().getSettings().getIslandProtectionRange()) { - drawZone(user.getPlayer(), Particle.VILLAGER_HAPPY, island.getCenter(), getPlugin().getSettings().getIslandProtectionRange()); + if (island.getProtectionRange() != getPlugin().getIWM().getIslandProtectionRange(getWorld())) { + drawZone(user.getPlayer(), Particle.VILLAGER_HAPPY, island.getCenter(), getPlugin().getIWM().getIslandProtectionRange(getWorld())); } // Draw the island area diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeResetCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeResetCommand.java similarity index 83% rename from src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeResetCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeResetCommand.java index 6046d283e..24204c0bf 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeResetCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeResetCommand.java @@ -1,12 +1,12 @@ -package us.tastybento.bskyblock.commands.admin.range; +package world.bentobox.bbox.commands.admin.range; import java.util.List; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; public class AdminRangeResetCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeSetCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeSetCommand.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeSetCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeSetCommand.java index 3c9ec6773..38f0531f0 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeSetCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/range/AdminRangeSetCommand.java @@ -1,14 +1,14 @@ -package us.tastybento.bskyblock.commands.admin.range; +package world.bentobox.bbox.commands.admin.range; import java.util.List; import java.util.UUID; import org.apache.commons.lang.StringUtils; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; public class AdminRangeSetCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamAddCommand.java similarity index 92% rename from src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamAddCommand.java index a504b179a..7989ad516 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamAddCommand.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.commands.admin.team; +package world.bentobox.bbox.commands.admin.team; import java.util.List; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; public class AdminTeamAddCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamDisbandCommand.java similarity index 92% rename from src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamDisbandCommand.java index 4c8bd4ed4..9a35e3895 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamDisbandCommand.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.commands.admin.team; +package world.bentobox.bbox.commands.admin.team; import java.util.List; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; public class AdminTeamDisbandCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamKickCommand.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamKickCommand.java index 040f2c5e6..2eabbd9b0 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamKickCommand.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.commands.admin.team; +package world.bentobox.bbox.commands.admin.team; import java.util.List; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; public class AdminTeamKickCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommand.java b/src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamMakeLeaderCommand.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommand.java rename to src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamMakeLeaderCommand.java index 77733a10f..4e743f195 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/admin/team/AdminTeamMakeLeaderCommand.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.commands.admin.team; +package world.bentobox.bbox.commands.admin.team; import java.util.List; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; public class AdminTeamMakeLeaderCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/CustomIslandMultiHomeHelp.java b/src/main/java/world/bentobox/bbox/commands/island/CustomIslandMultiHomeHelp.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/commands/island/CustomIslandMultiHomeHelp.java rename to src/main/java/world/bentobox/bbox/commands/island/CustomIslandMultiHomeHelp.java index 2eedd9624..75d3b0985 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/CustomIslandMultiHomeHelp.java +++ b/src/main/java/world/bentobox/bbox/commands/island/CustomIslandMultiHomeHelp.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.List; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; /** * This is a custom help for the /island go and /island sethome commands. It overrides the default help sub command. diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandAboutCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandAboutCommand.java similarity index 87% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandAboutCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandAboutCommand.java index 11267166e..45ece6332 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandAboutCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandAboutCommand.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.List; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; public class IslandAboutCommand extends CompositeCommand { @@ -23,7 +23,7 @@ public class IslandAboutCommand extends CompositeCommand { @Override public boolean execute(User user, String label, List args) { - user.sendRawMessage("About " + BSkyBlock.getInstance().getDescription().getName() + " v" + BSkyBlock.getInstance().getDescription().getVersion() + ":"); + user.sendRawMessage("About " + BentoBox.getInstance().getDescription().getName() + " v" + BentoBox.getInstance().getDescription().getVersion() + ":"); user.sendRawMessage("Copyright (c) 2017 - 2018 Tastybento, Poslovitch"); user.sendRawMessage("All rights reserved."); user.sendRawMessage(""); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandBanCommand.java similarity index 92% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandBanCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandBanCommand.java index 2618a6c8b..721549c07 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandBanCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.List; import java.util.Optional; @@ -9,11 +9,11 @@ import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.util.Util; public class IslandBanCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandBanlistCommand.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandBanlistCommand.java index 42454d315..656866a74 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandBanlistCommand.java @@ -1,12 +1,12 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; public class IslandBanlistCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandCreateCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandCreateCommand.java similarity index 77% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandCreateCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandCreateCommand.java index e4f58d7d0..1e08a82a6 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandCreateCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandCreateCommand.java @@ -1,12 +1,12 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.io.IOException; import java.util.List; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.managers.island.NewIsland; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.events.island.IslandEvent.Reason; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.island.NewIsland; /** * /island create - Create an island. @@ -30,9 +30,6 @@ public class IslandCreateCommand extends CompositeCommand { setDescription("commands.island.create.description"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) - */ @Override public boolean execute(User user, String label, List args) { if (getIslands().hasIsland(getWorld(), user.getUniqueId())) { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandGoCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandGoCommand.java similarity index 72% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandGoCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandGoCommand.java index c71e243b9..08520a8b6 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandGoCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandGoCommand.java @@ -1,13 +1,13 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.List; import org.apache.commons.lang.math.NumberUtils; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; /** * @author tastybento @@ -18,9 +18,6 @@ public class IslandGoCommand extends CompositeCommand { super(islandCommand, "go", "home", "h"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup() - */ @Override public void setup() { setPermission("island.home"); @@ -29,9 +26,6 @@ public class IslandGoCommand extends CompositeCommand { new CustomIslandMultiHomeHelp(this); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) - */ @Override public boolean execute(User user, String label, List args) { if (getIslands().getIsland(getWorld(), user.getUniqueId()) == null) { diff --git a/src/main/java/world/bentobox/bbox/commands/island/IslandInfoCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandInfoCommand.java new file mode 100644 index 000000000..3b01e7853 --- /dev/null +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandInfoCommand.java @@ -0,0 +1,4 @@ +package world.bentobox.bbox.commands.island; + +public class IslandInfoCommand { +} diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandLanguageCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandLanguageCommand.java similarity index 55% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandLanguageCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandLanguageCommand.java index 33ba33aab..a99164841 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandLanguageCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandLanguageCommand.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.List; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.panels.LanguagePanel; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.panels.LanguagePanel; /** * @author Poslovitch @@ -15,9 +15,6 @@ public class IslandLanguageCommand extends CompositeCommand { super(islandCommand, "language", "lang"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup() - */ @Override public void setup() { setPermission("island.language"); @@ -25,9 +22,6 @@ public class IslandLanguageCommand extends CompositeCommand { setDescription("commands.island.language.description"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) - */ @Override public boolean execute(User user, String label, List args) { LanguagePanel.openPanel(user); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandResetCommand.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandResetCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandResetCommand.java index b159fa378..ac9ead81c 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandResetCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.io.IOException; import java.util.HashMap; @@ -9,12 +9,12 @@ import java.util.UUID; import org.bukkit.GameMode; import org.bukkit.entity.Player; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.island.NewIsland; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.events.island.IslandEvent.Reason; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.island.NewIsland; public class IslandResetCommand extends CompositeCommand { @@ -115,6 +115,6 @@ public class IslandResetCommand extends CompositeCommand { } private void setCooldown(User user) { - cooldown.put(user.getUniqueId(), System.currentTimeMillis() + (getSettings().getResetLimit() * 1000L)); + cooldown.put(user.getUniqueId(), System.currentTimeMillis() + (getIWM().getResetLimit(getWorld()) * 1000L)); } } diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetnameCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandResetnameCommand.java similarity index 77% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandResetnameCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandResetnameCommand.java index 640e62fb3..b3ad628ab 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandResetnameCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandResetnameCommand.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.List; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; /** * @author tastybento @@ -23,9 +23,6 @@ public class IslandResetnameCommand extends CompositeCommand { setDescription("commands.island.resetname.description"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) - */ @Override public boolean execute(User user, String label, List args) { UUID playerUUID = user.getUniqueId(); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSethomeCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandSethomeCommand.java similarity index 88% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandSethomeCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandSethomeCommand.java index 31bf8755d..ec77db626 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSethomeCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandSethomeCommand.java @@ -1,12 +1,12 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.List; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; public class IslandSethomeCommand extends CompositeCommand { @@ -40,7 +40,7 @@ public class IslandSethomeCommand extends CompositeCommand { user.sendMessage("commands.island.sethome.home-set"); } else { // Dynamic home sizes with permissions - int maxHomes = Util.getPermValue(user.getPlayer(), "island.maxhomes", getSettings().getMaxHomes()); + int maxHomes = Util.getPermValue(user.getPlayer(), "island.maxhomes", getIWM().getMaxHomes(getWorld())); if (maxHomes > 1) { // Check the number given is a number int number; diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSetnameCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandSetnameCommand.java similarity index 85% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandSetnameCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandSetnameCommand.java index af027e522..ad37e2e5c 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSetnameCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandSetnameCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.List; import java.util.UUID; @@ -6,9 +6,9 @@ import java.util.stream.Collectors; import org.bukkit.ChatColor; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; /** * @author tastybento @@ -28,9 +28,6 @@ public class IslandSetnameCommand extends CompositeCommand { setDescription("commands.island.setname.description"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) - */ @Override public boolean execute(User user, String label, List args) { UUID playerUUID = user.getUniqueId(); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSettingsCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandSettingsCommand.java similarity index 61% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandSettingsCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandSettingsCommand.java index efb3fc770..8e3cd1b60 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandSettingsCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandSettingsCommand.java @@ -1,12 +1,12 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.List; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.panels.SettingsPanel; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.panels.SettingsPanel; +import world.bentobox.bbox.util.Util; /** * @author Poslovitch @@ -17,9 +17,6 @@ public class IslandSettingsCommand extends CompositeCommand { super(islandCommand, "settings", "flags"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup() - */ @Override public void setup() { setPermission("island.settings"); @@ -27,9 +24,6 @@ public class IslandSettingsCommand extends CompositeCommand { setDescription("commands.island.settings.description"); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[]) - */ @Override public boolean execute(User user, String label, List args) { // Settings are only shown if you are in the right world diff --git a/src/main/java/world/bentobox/bbox/commands/island/IslandSpawnCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandSpawnCommand.java new file mode 100644 index 000000000..88169723f --- /dev/null +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandSpawnCommand.java @@ -0,0 +1,4 @@ +package world.bentobox.bbox.commands.island; + +public class IslandSpawnCommand { +} diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommand.java b/src/main/java/world/bentobox/bbox/commands/island/IslandUnbanCommand.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/IslandUnbanCommand.java index e77152d2f..b7455cea2 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/IslandUnbanCommand.java @@ -1,15 +1,15 @@ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import java.util.List; import java.util.Optional; import java.util.UUID; import java.util.stream.Collectors; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.util.Util; public class IslandUnbanCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamCommand.java b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamCommand.java similarity index 88% rename from src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamCommand.java index 0eba71c2b..1dfd0f216 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamCommand.java @@ -1,14 +1,14 @@ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import java.util.List; import java.util.Set; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.api.events.team.TeamEvent; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.api.events.team.TeamEvent; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; public class IslandTeamCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteAcceptCommand.java b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteAcceptCommand.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteAcceptCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteAcceptCommand.java index b1883a160..8f78ec00d 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteAcceptCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteAcceptCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import java.util.List; import java.util.UUID; @@ -6,12 +6,12 @@ import java.util.UUID; import org.bukkit.GameMode; import org.bukkit.Location; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.api.events.team.TeamEvent; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.api.events.team.TeamEvent; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; public class IslandTeamInviteAcceptCommand extends CompositeCommand { @@ -95,8 +95,8 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand { getIslands().deleteIsland(island, true); // TODO Set the cooldown // Reset deaths - if (getSettings().isTeamJoinDeathReset()) { - getPlayers().setDeaths(playerUUID, 0); + if (getIWM().isTeamJoinDeathReset(getWorld())) { + getPlayers().setDeaths(getWorld(), playerUUID, 0); } // Put player back into normal mode user.setGameMode(getIWM().getDefaultGameMode(getWorld())); diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommand.java b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteCommand.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteCommand.java index 5f3840cc8..73ef8c837 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import java.util.ArrayList; import java.util.List; @@ -11,12 +11,12 @@ import org.bukkit.OfflinePlayer; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.api.events.team.TeamEvent; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.api.events.team.TeamEvent; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; public class IslandTeamInviteCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteRejectCommand.java b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteRejectCommand.java similarity index 85% rename from src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteRejectCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteRejectCommand.java index e27fae93b..ec571956c 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteRejectCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteRejectCommand.java @@ -1,13 +1,13 @@ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import java.util.List; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.api.events.team.TeamEvent; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.api.events.team.TeamEvent; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; public class IslandTeamInviteRejectCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommand.java b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamKickCommand.java similarity index 95% rename from src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamKickCommand.java index 443c67dd6..eea293d3e 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamKickCommand.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import java.util.HashSet; import java.util.List; @@ -7,8 +7,8 @@ import java.util.UUID; import org.bukkit.scheduler.BukkitRunnable; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; public class IslandTeamKickCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommand.java b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamLeaveCommand.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamLeaveCommand.java index e2f5500df..83d376ba4 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamLeaveCommand.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import java.util.List; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; public class IslandTeamLeaveCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamPromoteCommand.java b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamPromoteCommand.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamPromoteCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamPromoteCommand.java index a66eea8e6..0335f20c3 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamPromoteCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamPromoteCommand.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import java.util.List; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; public class IslandTeamPromoteCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamSetownerCommand.java b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamSetownerCommand.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamSetownerCommand.java rename to src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamSetownerCommand.java index 44b7adfd2..4628aa961 100644 --- a/src/main/java/us/tastybento/bskyblock/commands/island/team/IslandTeamSetownerCommand.java +++ b/src/main/java/world/bentobox/bbox/commands/island/team/IslandTeamSetownerCommand.java @@ -1,15 +1,15 @@ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.api.events.team.TeamEvent; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.api.events.team.TeamEvent; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; public class IslandTeamSetownerCommand extends CompositeCommand { diff --git a/src/main/java/us/tastybento/bskyblock/database/AbstractDatabaseHandler.java b/src/main/java/world/bentobox/bbox/database/AbstractDatabaseHandler.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/database/AbstractDatabaseHandler.java rename to src/main/java/world/bentobox/bbox/database/AbstractDatabaseHandler.java index 56d021da2..711309bf8 100644 --- a/src/main/java/us/tastybento/bskyblock/database/AbstractDatabaseHandler.java +++ b/src/main/java/world/bentobox/bbox/database/AbstractDatabaseHandler.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.database; +package world.bentobox.bbox.database; import java.beans.IntrospectionException; import java.lang.reflect.InvocationTargetException; import java.util.List; -import us.tastybento.bskyblock.BSkyBlock; +import world.bentobox.bbox.BentoBox; /** * An abstract class that handles insert/select-operations into/from a database @@ -27,7 +27,7 @@ public abstract class AbstractDatabaseHandler { */ protected DatabaseConnecter databaseConnecter; - protected BSkyBlock plugin; + protected BentoBox plugin; /** * Constructor @@ -39,7 +39,7 @@ public abstract class AbstractDatabaseHandler { * Contains the settings to create a connection to the database * like host/port/database/user/password */ - protected AbstractDatabaseHandler(BSkyBlock plugin, Class type, DatabaseConnecter databaseConnecter) { + protected AbstractDatabaseHandler(BentoBox plugin, Class type, DatabaseConnecter databaseConnecter) { this.plugin = plugin; this.databaseConnecter = databaseConnecter; this.dataObject = type; diff --git a/src/main/java/us/tastybento/bskyblock/database/BSBDatabase.java b/src/main/java/world/bentobox/bbox/database/BSBDatabase.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/database/BSBDatabase.java rename to src/main/java/world/bentobox/bbox/database/BSBDatabase.java index 158f99bc4..d6732af76 100644 --- a/src/main/java/us/tastybento/bskyblock/database/BSBDatabase.java +++ b/src/main/java/world/bentobox/bbox/database/BSBDatabase.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database; +package world.bentobox.bbox.database; import java.beans.IntrospectionException; import java.lang.reflect.InvocationTargetException; @@ -6,8 +6,8 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.addons.Addon; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.addons.Addon; /** * Handy class to store and load Java POJOs in the BSkyBlock Database @@ -21,7 +21,7 @@ public class BSBDatabase { private Logger logger; @SuppressWarnings("unchecked") - public BSBDatabase(BSkyBlock plugin, Class type) { + public BSBDatabase(BentoBox plugin, Class type) { this.logger = plugin.getLogger(); handler = (AbstractDatabaseHandler) BSBDbSetup.getDatabase().getHandler(type); } diff --git a/src/main/java/us/tastybento/bskyblock/database/BSBDbSetup.java b/src/main/java/world/bentobox/bbox/database/BSBDbSetup.java similarity index 74% rename from src/main/java/us/tastybento/bskyblock/database/BSBDbSetup.java rename to src/main/java/world/bentobox/bbox/database/BSBDbSetup.java index 59c2e0f52..d9940d0ff 100755 --- a/src/main/java/us/tastybento/bskyblock/database/BSBDbSetup.java +++ b/src/main/java/world/bentobox/bbox/database/BSBDbSetup.java @@ -1,9 +1,9 @@ -package us.tastybento.bskyblock.database; +package world.bentobox.bbox.database; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.database.flatfile.FlatFileDatabase; -import us.tastybento.bskyblock.database.mongodb.MongoDBDatabase; -import us.tastybento.bskyblock.database.mysql.MySQLDatabase; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.database.flatfile.FlatFileDatabase; +import world.bentobox.bbox.database.mongodb.MongoDBDatabase; +import world.bentobox.bbox.database.mysql.MySQLDatabase; public abstract class BSBDbSetup { @@ -14,7 +14,7 @@ public abstract class BSBDbSetup { */ public static BSBDbSetup getDatabase(){ for(DatabaseType type : DatabaseType.values()){ - if(type == BSkyBlock.getInstance().getSettings().getDatabaseType()) { + if(type == BentoBox.getInstance().getSettings().getDatabaseType()) { return type.database; } } diff --git a/src/main/java/us/tastybento/bskyblock/database/DatabaseConnecter.java b/src/main/java/world/bentobox/bbox/database/DatabaseConnecter.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/database/DatabaseConnecter.java rename to src/main/java/world/bentobox/bbox/database/DatabaseConnecter.java index 85976ee5e..e2e632ce2 100644 --- a/src/main/java/us/tastybento/bskyblock/database/DatabaseConnecter.java +++ b/src/main/java/world/bentobox/bbox/database/DatabaseConnecter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database; +package world.bentobox.bbox.database; import java.util.Map; diff --git a/src/main/java/us/tastybento/bskyblock/database/DatabaseConnectionSettingsImpl.java b/src/main/java/world/bentobox/bbox/database/DatabaseConnectionSettingsImpl.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/database/DatabaseConnectionSettingsImpl.java rename to src/main/java/world/bentobox/bbox/database/DatabaseConnectionSettingsImpl.java index a040bfcbf..e27412190 100644 --- a/src/main/java/us/tastybento/bskyblock/database/DatabaseConnectionSettingsImpl.java +++ b/src/main/java/world/bentobox/bbox/database/DatabaseConnectionSettingsImpl.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database; +package world.bentobox.bbox.database; public class DatabaseConnectionSettingsImpl { private String host; diff --git a/src/main/java/us/tastybento/bskyblock/database/flatfile/ConfigHandler.java b/src/main/java/world/bentobox/bbox/database/flatfile/ConfigHandler.java similarity index 78% rename from src/main/java/us/tastybento/bskyblock/database/flatfile/ConfigHandler.java rename to src/main/java/world/bentobox/bbox/database/flatfile/ConfigHandler.java index 8051806c0..b3f236fdd 100644 --- a/src/main/java/us/tastybento/bskyblock/database/flatfile/ConfigHandler.java +++ b/src/main/java/world/bentobox/bbox/database/flatfile/ConfigHandler.java @@ -1,10 +1,10 @@ -package us.tastybento.bskyblock.database.flatfile; +package world.bentobox.bbox.database.flatfile; import java.beans.IntrospectionException; import java.lang.reflect.InvocationTargetException; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.database.DatabaseConnecter; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.database.DatabaseConnecter; /** * Class handles config settings saving and loading @@ -16,7 +16,7 @@ import us.tastybento.bskyblock.database.DatabaseConnecter; public class ConfigHandler extends FlatFileDatabaseHandler { - public ConfigHandler(BSkyBlock plugin, Class type, DatabaseConnecter databaseConnecter) { + public ConfigHandler(BentoBox plugin, Class type, DatabaseConnecter databaseConnecter) { super(plugin, type, databaseConnecter); } diff --git a/src/main/java/world/bentobox/bbox/database/flatfile/FlatFileDatabase.java b/src/main/java/world/bentobox/bbox/database/flatfile/FlatFileDatabase.java new file mode 100755 index 000000000..279895c54 --- /dev/null +++ b/src/main/java/world/bentobox/bbox/database/flatfile/FlatFileDatabase.java @@ -0,0 +1,23 @@ +package world.bentobox.bbox.database.flatfile; + +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.database.AbstractDatabaseHandler; +import world.bentobox.bbox.database.BSBDbSetup; + +public class FlatFileDatabase extends BSBDbSetup{ + + @Override + public AbstractDatabaseHandler getHandler(Class type) { + return new FlatFileDatabaseHandler<>(BentoBox.getInstance(), type, new FlatFileDatabaseConnecter(BentoBox.getInstance())); + } + + /** + * Get the config + * @param type - config object type + * @return - the config handler + */ + public AbstractDatabaseHandler getConfig(Class type) { + return new ConfigHandler<>(BentoBox.getInstance(), type, new FlatFileDatabaseConnecter(BentoBox.getInstance())); + } + +} diff --git a/src/main/java/us/tastybento/bskyblock/database/flatfile/FlatFileDatabaseConnecter.java b/src/main/java/world/bentobox/bbox/database/flatfile/FlatFileDatabaseConnecter.java similarity index 87% rename from src/main/java/us/tastybento/bskyblock/database/flatfile/FlatFileDatabaseConnecter.java rename to src/main/java/world/bentobox/bbox/database/flatfile/FlatFileDatabaseConnecter.java index 9222b0536..4d2a5e96d 100644 --- a/src/main/java/us/tastybento/bskyblock/database/flatfile/FlatFileDatabaseConnecter.java +++ b/src/main/java/world/bentobox/bbox/database/flatfile/FlatFileDatabaseConnecter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.flatfile; +package world.bentobox.bbox.database.flatfile; import java.io.File; import java.io.IOException; @@ -14,18 +14,18 @@ import java.util.UUID; import org.bukkit.configuration.file.YamlConfiguration; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.database.DatabaseConnecter; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.database.DatabaseConnecter; public class FlatFileDatabaseConnecter implements DatabaseConnecter { private static final int MAX_LOOPS = 100; private static final String DATABASE_FOLDER_NAME = "database"; - private BSkyBlock plugin; + private BentoBox plugin; private File dataFolder; - public FlatFileDatabaseConnecter(BSkyBlock plugin) { + public FlatFileDatabaseConnecter(BentoBox plugin) { this.plugin = plugin; dataFolder = new File(plugin.getDataFolder(), DATABASE_FOLDER_NAME); } @@ -40,9 +40,6 @@ public class FlatFileDatabaseConnecter implements DatabaseConnecter { return null; // Not used } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.database.DatabaseConnecter#loadYamlFile(java.lang.String, java.lang.String) - */ @Override public YamlConfiguration loadYamlFile(String tableName, String fileName) { if (!fileName.endsWith(".yml")) { @@ -78,9 +75,6 @@ public class FlatFileDatabaseConnecter implements DatabaseConnecter { return config; } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.database.DatabaseConnecter#saveYamlFile(org.bukkit.configuration.file.YamlConfiguration, java.lang.String, java.lang.String) - */ @Override public void saveYamlFile(YamlConfiguration yamlConfig, String tableName, String fileName, Map commentMap) { if (!fileName.endsWith(".yml")) { @@ -94,7 +88,7 @@ public class FlatFileDatabaseConnecter implements DatabaseConnecter { try { // Approach is save to temp file (saving is not necessarily atomic), then move file atomically // This has best chance of no file corruption - + File tmpFile = File.createTempFile("yaml", null, tableFolder); yamlConfig.save(tmpFile); if (tmpFile.exists()) { @@ -143,12 +137,9 @@ public class FlatFileDatabaseConnecter implements DatabaseConnecter { Files.move(commentedFile.toPath(), file.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e1) { plugin.logError("Could not comment config file " + file.getName() + " " + e1.getMessage()); - } + } } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.database.DatabaseConnecter#getUniqueId(java.lang.String) - */ @Override public String getUniqueId(String tableName) { UUID uuid = UUID.randomUUID(); @@ -161,9 +152,6 @@ public class FlatFileDatabaseConnecter implements DatabaseConnecter { return uuid.toString(); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.database.DatabaseConnecter#uniqueIdExists(java.lang.String, java.lang.String) - */ @Override public boolean uniqueIdExists(String tableName, String key) { File file = new File(dataFolder, tableName + File.separator + key + ".yml"); diff --git a/src/main/java/us/tastybento/bskyblock/database/flatfile/FlatFileDatabaseHandler.java b/src/main/java/world/bentobox/bbox/database/flatfile/FlatFileDatabaseHandler.java similarity index 95% rename from src/main/java/us/tastybento/bskyblock/database/flatfile/FlatFileDatabaseHandler.java rename to src/main/java/world/bentobox/bbox/database/flatfile/FlatFileDatabaseHandler.java index 484de3441..621b9ad41 100644 --- a/src/main/java/us/tastybento/bskyblock/database/flatfile/FlatFileDatabaseHandler.java +++ b/src/main/java/world/bentobox/bbox/database/flatfile/FlatFileDatabaseHandler.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.flatfile; +package world.bentobox.bbox.database.flatfile; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; @@ -27,18 +27,18 @@ import org.bukkit.World; import org.bukkit.configuration.MemorySection; import org.bukkit.configuration.file.YamlConfiguration; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Constants; -import us.tastybento.bskyblock.Constants.GameType; -import us.tastybento.bskyblock.api.configuration.ConfigComment; -import us.tastybento.bskyblock.api.configuration.ConfigEntry; -import us.tastybento.bskyblock.api.configuration.StoreAt; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.database.AbstractDatabaseHandler; -import us.tastybento.bskyblock.database.DatabaseConnecter; -import us.tastybento.bskyblock.database.objects.adapters.Adapter; -import us.tastybento.bskyblock.database.objects.adapters.AdapterInterface; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Constants; +import world.bentobox.bbox.Constants.GameType; +import world.bentobox.bbox.api.configuration.ConfigComment; +import world.bentobox.bbox.api.configuration.ConfigEntry; +import world.bentobox.bbox.api.configuration.StoreAt; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.database.AbstractDatabaseHandler; +import world.bentobox.bbox.database.DatabaseConnecter; +import world.bentobox.bbox.database.objects.adapters.Adapter; +import world.bentobox.bbox.database.objects.adapters.AdapterInterface; +import world.bentobox.bbox.util.Util; /** * Class that creates a list of s filled with values from the corresponding @@ -54,13 +54,10 @@ public class FlatFileDatabaseHandler extends AbstractDatabaseHandler { private static final String DATABASE_FOLDER_NAME = "database"; protected boolean configFlag; - public FlatFileDatabaseHandler(BSkyBlock plugin, Class type, DatabaseConnecter dbConnecter) { + public FlatFileDatabaseHandler(BentoBox plugin, Class type, DatabaseConnecter dbConnecter) { super(plugin, type, dbConnecter); } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler#loadObject(java.lang.String) - */ @Override public T loadObject(String key) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException { String path = DATABASE_FOLDER_NAME + File.separator + dataObject.getSimpleName(); @@ -79,10 +76,6 @@ public class FlatFileDatabaseHandler extends AbstractDatabaseHandler { return databaseConnecter.uniqueIdExists(dataObject.getSimpleName(), uniqueId); } - - /* (non-Javadoc) - * @see us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler#loadObjects() - */ @Override public List loadObjects() throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException { List list = new ArrayList<>(); diff --git a/src/main/java/us/tastybento/bskyblock/database/mongodb/MongoDBDatabase.java b/src/main/java/world/bentobox/bbox/database/mongodb/MongoDBDatabase.java similarity index 74% rename from src/main/java/us/tastybento/bskyblock/database/mongodb/MongoDBDatabase.java rename to src/main/java/world/bentobox/bbox/database/mongodb/MongoDBDatabase.java index 0ce08b212..661bf0130 100755 --- a/src/main/java/us/tastybento/bskyblock/database/mongodb/MongoDBDatabase.java +++ b/src/main/java/world/bentobox/bbox/database/mongodb/MongoDBDatabase.java @@ -1,15 +1,15 @@ -package us.tastybento.bskyblock.database.mongodb; +package world.bentobox.bbox.database.mongodb; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.database.AbstractDatabaseHandler; -import us.tastybento.bskyblock.database.BSBDbSetup; -import us.tastybento.bskyblock.database.DatabaseConnectionSettingsImpl; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.database.AbstractDatabaseHandler; +import world.bentobox.bbox.database.BSBDbSetup; +import world.bentobox.bbox.database.DatabaseConnectionSettingsImpl; public class MongoDBDatabase extends BSBDbSetup{ @Override public AbstractDatabaseHandler getHandler(Class type) { - BSkyBlock plugin = BSkyBlock.getInstance(); + BentoBox plugin = BentoBox.getInstance(); // Check if the MongoDB plugin exists if (plugin.getServer().getPluginManager().getPlugin("BsbMongo") == null) { plugin.logError("You must install BsbMongo plugin for MongoDB support!"); diff --git a/src/main/java/us/tastybento/bskyblock/database/mongodb/MongoDBDatabaseConnecter.java b/src/main/java/world/bentobox/bbox/database/mongodb/MongoDBDatabaseConnecter.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/database/mongodb/MongoDBDatabaseConnecter.java rename to src/main/java/world/bentobox/bbox/database/mongodb/MongoDBDatabaseConnecter.java index 8e0b5c583..14e7c8954 100644 --- a/src/main/java/us/tastybento/bskyblock/database/mongodb/MongoDBDatabaseConnecter.java +++ b/src/main/java/world/bentobox/bbox/database/mongodb/MongoDBDatabaseConnecter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.mongodb; +package world.bentobox.bbox.database.mongodb; import java.util.Map; @@ -10,8 +10,8 @@ import com.mongodb.MongoCredential; import com.mongodb.ServerAddress; import com.mongodb.client.MongoDatabase; -import us.tastybento.bskyblock.database.DatabaseConnecter; -import us.tastybento.bskyblock.database.DatabaseConnectionSettingsImpl; +import world.bentobox.bbox.database.DatabaseConnecter; +import world.bentobox.bbox.database.DatabaseConnectionSettingsImpl; public class MongoDBDatabaseConnecter implements DatabaseConnecter { diff --git a/src/main/java/us/tastybento/bskyblock/database/mongodb/MongoDBDatabaseHandler.java b/src/main/java/world/bentobox/bbox/database/mongodb/MongoDBDatabaseHandler.java similarity index 84% rename from src/main/java/us/tastybento/bskyblock/database/mongodb/MongoDBDatabaseHandler.java rename to src/main/java/world/bentobox/bbox/database/mongodb/MongoDBDatabaseHandler.java index d439064ff..ba4f09d94 100644 --- a/src/main/java/us/tastybento/bskyblock/database/mongodb/MongoDBDatabaseHandler.java +++ b/src/main/java/world/bentobox/bbox/database/mongodb/MongoDBDatabaseHandler.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.mongodb; +package world.bentobox.bbox.database.mongodb; import java.util.ArrayList; import java.util.List; @@ -18,15 +18,15 @@ import com.mongodb.client.model.IndexOptions; import com.mongodb.client.model.Indexes; import com.mongodb.util.JSON; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.database.AbstractDatabaseHandler; -import us.tastybento.bskyblock.database.DatabaseConnecter; -import us.tastybento.bskyblock.database.mysql.adapters.FlagAdapter; -import us.tastybento.bskyblock.database.mysql.adapters.LocationAdapter; -import us.tastybento.bskyblock.database.mysql.adapters.PotionEffectTypeAdapter; -import us.tastybento.bskyblock.database.mysql.adapters.WorldAdapter; -import us.tastybento.bskyblock.database.objects.DataObject; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.database.AbstractDatabaseHandler; +import world.bentobox.bbox.database.DatabaseConnecter; +import world.bentobox.bbox.database.mysql.adapters.FlagAdapter; +import world.bentobox.bbox.database.mysql.adapters.LocationAdapter; +import world.bentobox.bbox.database.mysql.adapters.PotionEffectTypeAdapter; +import world.bentobox.bbox.database.mysql.adapters.WorldAdapter; +import world.bentobox.bbox.database.objects.DataObject; /** * @@ -45,7 +45,6 @@ public class MongoDBDatabaseHandler extends AbstractDatabaseHandler { private MongoCollection collection; private DatabaseConnecter dbConnecter; - private BSkyBlock bskyblock; /** * Handles the connection to the database and creation of the initial database schema (tables) for @@ -54,17 +53,16 @@ public class MongoDBDatabaseHandler extends AbstractDatabaseHandler { * @param type - the type of class to be stored in the database. Must inherit DataObject * @param dbConnecter - authentication details for the database */ - public MongoDBDatabaseHandler(BSkyBlock plugin, Class type, DatabaseConnecter dbConnecter) { + public MongoDBDatabaseHandler(BentoBox plugin, Class type, DatabaseConnecter dbConnecter) { super(plugin, type, dbConnecter); - this.bskyblock = plugin; this.dbConnecter = dbConnecter; /* Connection to the database - */ + */ MongoDatabase database = (MongoDatabase) dbConnecter.createConnection(); collection = database.getCollection(dataObject.getCanonicalName()); IndexOptions indexOptions = new IndexOptions().unique(true); - collection.createIndex(Indexes.text(UNIQUEID), indexOptions); + collection.createIndex(Indexes.text(UNIQUEID), indexOptions); } // Gets the GSON builder @@ -75,7 +73,7 @@ public class MongoDBDatabaseHandler extends AbstractDatabaseHandler { // Register adapters builder.registerTypeAdapter(Location.class, new LocationAdapter(plugin)) ; builder.registerTypeAdapter(World.class, new WorldAdapter(plugin)); - builder.registerTypeAdapter(Flag.class, new FlagAdapter(bskyblock)); + builder.registerTypeAdapter(Flag.class, new FlagAdapter(plugin)); builder.registerTypeAdapter(PotionEffectType.class, new PotionEffectTypeAdapter()); // Keep null in the database builder.serializeNulls(); @@ -98,7 +96,7 @@ public class MongoDBDatabaseHandler extends AbstractDatabaseHandler { } @Override - public T loadObject(String uniqueId) { + public T loadObject(String uniqueId) { Document doc = collection.find(new Document(MONGO_ID, uniqueId)).limit(1).first(); if (doc != null) { Gson gson = getGSON(); @@ -147,9 +145,6 @@ public class MongoDBDatabaseHandler extends AbstractDatabaseHandler { } } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler#objectExists(java.lang.String) - */ @Override public boolean objectExists(String uniqueId) { return collection.find(new Document(MONGO_ID, uniqueId)).first() != null; diff --git a/src/main/java/us/tastybento/bskyblock/database/mysql/MySQLDatabase.java b/src/main/java/world/bentobox/bbox/database/mysql/MySQLDatabase.java similarity index 61% rename from src/main/java/us/tastybento/bskyblock/database/mysql/MySQLDatabase.java rename to src/main/java/world/bentobox/bbox/database/mysql/MySQLDatabase.java index 0a92c7164..b39d45690 100755 --- a/src/main/java/us/tastybento/bskyblock/database/mysql/MySQLDatabase.java +++ b/src/main/java/world/bentobox/bbox/database/mysql/MySQLDatabase.java @@ -1,15 +1,15 @@ -package us.tastybento.bskyblock.database.mysql; +package world.bentobox.bbox.database.mysql; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.database.AbstractDatabaseHandler; -import us.tastybento.bskyblock.database.BSBDbSetup; -import us.tastybento.bskyblock.database.DatabaseConnectionSettingsImpl; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.database.AbstractDatabaseHandler; +import world.bentobox.bbox.database.BSBDbSetup; +import world.bentobox.bbox.database.DatabaseConnectionSettingsImpl; public class MySQLDatabase extends BSBDbSetup{ @Override public AbstractDatabaseHandler getHandler(Class type) { - BSkyBlock plugin = BSkyBlock.getInstance(); + BentoBox plugin = BentoBox.getInstance(); return new MySQLDatabaseHandler<>(plugin, type, new MySQLDatabaseConnecter(new DatabaseConnectionSettingsImpl( plugin.getSettings().getDbHost(), plugin.getSettings().getDbPort(), diff --git a/src/main/java/us/tastybento/bskyblock/database/mysql/MySQLDatabaseConnecter.java b/src/main/java/world/bentobox/bbox/database/mysql/MySQLDatabaseConnecter.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/database/mysql/MySQLDatabaseConnecter.java rename to src/main/java/world/bentobox/bbox/database/mysql/MySQLDatabaseConnecter.java index a1588a06d..001d8bb5d 100644 --- a/src/main/java/us/tastybento/bskyblock/database/mysql/MySQLDatabaseConnecter.java +++ b/src/main/java/world/bentobox/bbox/database/mysql/MySQLDatabaseConnecter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.mysql; +package world.bentobox.bbox.database.mysql; import java.sql.Connection; import java.sql.DriverManager; @@ -8,8 +8,8 @@ import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; -import us.tastybento.bskyblock.database.DatabaseConnecter; -import us.tastybento.bskyblock.database.DatabaseConnectionSettingsImpl; +import world.bentobox.bbox.database.DatabaseConnecter; +import world.bentobox.bbox.database.DatabaseConnectionSettingsImpl; public class MySQLDatabaseConnecter implements DatabaseConnecter { diff --git a/src/main/java/us/tastybento/bskyblock/database/mysql/MySQLDatabaseHandler.java b/src/main/java/world/bentobox/bbox/database/mysql/MySQLDatabaseHandler.java similarity index 88% rename from src/main/java/us/tastybento/bskyblock/database/mysql/MySQLDatabaseHandler.java rename to src/main/java/world/bentobox/bbox/database/mysql/MySQLDatabaseHandler.java index 5552b68ab..c3ca8fc86 100644 --- a/src/main/java/us/tastybento/bskyblock/database/mysql/MySQLDatabaseHandler.java +++ b/src/main/java/world/bentobox/bbox/database/mysql/MySQLDatabaseHandler.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.mysql; +package world.bentobox.bbox.database.mysql; import java.lang.reflect.Method; import java.sql.Connection; @@ -16,15 +16,15 @@ import org.bukkit.potion.PotionEffectType; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.database.AbstractDatabaseHandler; -import us.tastybento.bskyblock.database.DatabaseConnecter; -import us.tastybento.bskyblock.database.mysql.adapters.FlagAdapter; -import us.tastybento.bskyblock.database.mysql.adapters.LocationAdapter; -import us.tastybento.bskyblock.database.mysql.adapters.PotionEffectTypeAdapter; -import us.tastybento.bskyblock.database.mysql.adapters.WorldAdapter; -import us.tastybento.bskyblock.database.objects.DataObject; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.database.AbstractDatabaseHandler; +import world.bentobox.bbox.database.DatabaseConnecter; +import world.bentobox.bbox.database.mysql.adapters.FlagAdapter; +import world.bentobox.bbox.database.mysql.adapters.LocationAdapter; +import world.bentobox.bbox.database.mysql.adapters.PotionEffectTypeAdapter; +import world.bentobox.bbox.database.mysql.adapters.WorldAdapter; +import world.bentobox.bbox.database.objects.DataObject; /** * @@ -41,7 +41,6 @@ public class MySQLDatabaseHandler extends AbstractDatabaseHandler { */ private Connection connection; - private BSkyBlock bskyblock; /** * Handles the connection to the database and creation of the initial database schema (tables) for @@ -50,9 +49,8 @@ public class MySQLDatabaseHandler extends AbstractDatabaseHandler { * @param type - the type of class to be stored in the database. Must inherit DataObject * @param dbConnecter - authentication details for the database */ - public MySQLDatabaseHandler(BSkyBlock plugin, Class type, DatabaseConnecter dbConnecter) { + public MySQLDatabaseHandler(BentoBox plugin, Class type, DatabaseConnecter dbConnecter) { super(plugin, type, dbConnecter); - this.bskyblock = plugin; connection = (Connection)dbConnecter.createConnection(); // Check if the table exists in the database and if not, create it createSchema(); @@ -81,7 +79,7 @@ public class MySQLDatabaseHandler extends AbstractDatabaseHandler { // Register adapters builder.registerTypeAdapter(Location.class, new LocationAdapter(plugin)) ; builder.registerTypeAdapter(World.class, new WorldAdapter(plugin)); - builder.registerTypeAdapter(Flag.class, new FlagAdapter(bskyblock)); + builder.registerTypeAdapter(Flag.class, new FlagAdapter(plugin)); builder.registerTypeAdapter(PotionEffectType.class, new PotionEffectTypeAdapter()); // Keep null in the database builder.serializeNulls(); @@ -149,7 +147,7 @@ public class MySQLDatabaseHandler extends AbstractDatabaseHandler { String toStore = gson.toJson(instance); preparedStatement.setString(1, toStore); preparedStatement.setString(2, toStore); - preparedStatement.execute(); + preparedStatement.execute(); } catch (SQLException e) { plugin.logError("Could not save object " + instance.getClass().getName() + " " + e.getMessage()); } @@ -174,9 +172,6 @@ public class MySQLDatabaseHandler extends AbstractDatabaseHandler { } } - /* (non-Javadoc) - * @see us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler#objectExists(java.lang.String) - */ @Override public boolean objectExists(String uniqueId) { // Create the query to see if this key exists diff --git a/src/main/java/us/tastybento/bskyblock/database/mysql/adapters/FlagAdapter.java b/src/main/java/world/bentobox/bbox/database/mysql/adapters/FlagAdapter.java similarity index 77% rename from src/main/java/us/tastybento/bskyblock/database/mysql/adapters/FlagAdapter.java rename to src/main/java/world/bentobox/bbox/database/mysql/adapters/FlagAdapter.java index 4e2f0889b..b89c962ce 100644 --- a/src/main/java/us/tastybento/bskyblock/database/mysql/adapters/FlagAdapter.java +++ b/src/main/java/world/bentobox/bbox/database/mysql/adapters/FlagAdapter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.mysql.adapters; +package world.bentobox.bbox.database.mysql.adapters; import java.io.IOException; @@ -7,14 +7,14 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; public class FlagAdapter extends TypeAdapter { - private BSkyBlock plugin; + private BentoBox plugin; - public FlagAdapter(BSkyBlock plugin) { + public FlagAdapter(BentoBox plugin) { this.plugin = plugin; } diff --git a/src/main/java/us/tastybento/bskyblock/database/mysql/adapters/LocationAdapter.java b/src/main/java/world/bentobox/bbox/database/mysql/adapters/LocationAdapter.java similarity index 96% rename from src/main/java/us/tastybento/bskyblock/database/mysql/adapters/LocationAdapter.java rename to src/main/java/world/bentobox/bbox/database/mysql/adapters/LocationAdapter.java index cab2dbdd8..7d534216d 100644 --- a/src/main/java/us/tastybento/bskyblock/database/mysql/adapters/LocationAdapter.java +++ b/src/main/java/world/bentobox/bbox/database/mysql/adapters/LocationAdapter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.mysql.adapters; +package world.bentobox.bbox.database.mysql.adapters; import java.io.IOException; diff --git a/src/main/java/us/tastybento/bskyblock/database/mysql/adapters/PotionEffectTypeAdapter.java b/src/main/java/world/bentobox/bbox/database/mysql/adapters/PotionEffectTypeAdapter.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/database/mysql/adapters/PotionEffectTypeAdapter.java rename to src/main/java/world/bentobox/bbox/database/mysql/adapters/PotionEffectTypeAdapter.java index df6b24eb9..7a3bde4c5 100644 --- a/src/main/java/us/tastybento/bskyblock/database/mysql/adapters/PotionEffectTypeAdapter.java +++ b/src/main/java/world/bentobox/bbox/database/mysql/adapters/PotionEffectTypeAdapter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.mysql.adapters; +package world.bentobox.bbox.database.mysql.adapters; import java.io.IOException; diff --git a/src/main/java/us/tastybento/bskyblock/database/mysql/adapters/WorldAdapter.java b/src/main/java/world/bentobox/bbox/database/mysql/adapters/WorldAdapter.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/database/mysql/adapters/WorldAdapter.java rename to src/main/java/world/bentobox/bbox/database/mysql/adapters/WorldAdapter.java index f9ee60c16..e1535ac83 100644 --- a/src/main/java/us/tastybento/bskyblock/database/mysql/adapters/WorldAdapter.java +++ b/src/main/java/world/bentobox/bbox/database/mysql/adapters/WorldAdapter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.mysql.adapters; +package world.bentobox.bbox.database.mysql.adapters; import java.io.IOException; diff --git a/src/main/java/us/tastybento/bskyblock/database/objects/DataObject.java b/src/main/java/world/bentobox/bbox/database/objects/DataObject.java similarity index 64% rename from src/main/java/us/tastybento/bskyblock/database/objects/DataObject.java rename to src/main/java/world/bentobox/bbox/database/objects/DataObject.java index a45871308..7ea039305 100644 --- a/src/main/java/us/tastybento/bskyblock/database/objects/DataObject.java +++ b/src/main/java/world/bentobox/bbox/database/objects/DataObject.java @@ -1,6 +1,6 @@ -package us.tastybento.bskyblock.database.objects; +package world.bentobox.bbox.database.objects; -import us.tastybento.bskyblock.BSkyBlock; +import world.bentobox.bbox.BentoBox; /** * Contains fields that must be in any data object @@ -9,8 +9,8 @@ import us.tastybento.bskyblock.BSkyBlock; */ public interface DataObject { - default BSkyBlock getPlugin() { - return BSkyBlock.getInstance(); + default BentoBox getPlugin() { + return BentoBox.getInstance(); } /** diff --git a/src/main/java/us/tastybento/bskyblock/database/objects/Island.java b/src/main/java/world/bentobox/bbox/database/objects/Island.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/database/objects/Island.java rename to src/main/java/world/bentobox/bbox/database/objects/Island.java index d540b6273..299cae441 100755 --- a/src/main/java/us/tastybento/bskyblock/database/objects/Island.java +++ b/src/main/java/world/bentobox/bbox/database/objects/Island.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.objects; +package world.bentobox.bbox.database.objects; import java.util.Date; import java.util.EnumMap; @@ -18,16 +18,16 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; import com.google.gson.annotations.Expose; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.adapters.Adapter; -import us.tastybento.bskyblock.database.objects.adapters.FlagSerializer; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.RanksManager; -import us.tastybento.bskyblock.util.Pair; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.adapters.Adapter; +import world.bentobox.bbox.database.objects.adapters.FlagSerializer; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.RanksManager; +import world.bentobox.bbox.util.Pair; +import world.bentobox.bbox.util.Util; /** * Stores all the info about an island @@ -101,7 +101,7 @@ public class Island implements DataObject { world = location.getWorld(); // Make a copy of the location center = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ()); - range = BSkyBlock.getInstance().getIWM().getIslandDistance(world); + range = BentoBox.getInstance().getIWM().getIslandDistance(world); this.protectionRange = protectionRange; } @@ -403,7 +403,7 @@ public class Island implements DataObject { /** * Removes a player from the team member map. Do not call this directly. - * Use {@link us.tastybento.bskyblock.managers.IslandsManager#removePlayer(World, UUID)} + * Use {@link world.bentobox.bbox.managers.IslandsManager#removePlayer(World, UUID)} * @param playerUUID - uuid of player */ public void removeMember(UUID playerUUID) { @@ -450,9 +450,9 @@ public class Island implements DataObject { public void setFlagsDefaults() { Map result = new HashMap<>(); Flags.values().stream().filter(f -> f.getType().equals(Flag.Type.PROTECTION)) - .forEach(f -> result.put(f, BSkyBlock.getInstance().getIWM().getDefaultIslandFlags(world).getOrDefault(f, f.getDefaultRank()))); + .forEach(f -> result.put(f, BentoBox.getInstance().getIWM().getDefaultIslandFlags(world).getOrDefault(f, f.getDefaultRank()))); Flags.values().stream().filter(f -> f.getType().equals(Flag.Type.SETTING)) - .forEach(f -> result.put(f, BSkyBlock.getInstance().getIWM().getDefaultIslandSettings(world).getOrDefault(f, f.getDefaultRank()))); + .forEach(f -> result.put(f, BentoBox.getInstance().getIWM().getDefaultIslandSettings(world).getOrDefault(f, f.getDefaultRank()))); this.setFlags(result); } @@ -590,7 +590,7 @@ public class Island implements DataObject { * @param world - world to check * @return true always */ - public boolean showInfo(BSkyBlock plugin, User user, World world) { + public boolean showInfo(BentoBox plugin, User user, World world) { user.sendMessage("commands.admin.info.title"); if (owner == null) { user.sendMessage("commands.admin.info.unowned"); @@ -599,9 +599,9 @@ public class Island implements DataObject { Date d = new Date(plugin.getServer().getOfflinePlayer(owner).getLastPlayed()); user.sendMessage("commands.admin.info.last-login","[date]", d.toString()); - user.sendMessage("commands.admin.info.deaths", "[number]", String.valueOf(plugin.getPlayers().getDeaths(owner))); + user.sendMessage("commands.admin.info.deaths", "[number]", String.valueOf(plugin.getPlayers().getDeaths(world, owner))); String resets = String.valueOf(plugin.getPlayers().getResets(world, owner)); - String total = plugin.getSettings().getResetLimit() < 0 ? "Unlimited" : String.valueOf(plugin.getSettings().getResetLimit()); + String total = plugin.getIWM().getResetLimit(world) < 0 ? "Unlimited" : String.valueOf(plugin.getIWM().getResetLimit(world)); user.sendMessage("commands.admin.info.resets-left", "[number]", resets, "[total]", total); // Show team members showMembers(plugin, user, world); @@ -632,7 +632,7 @@ public class Island implements DataObject { * @param user - user who is requesting * @param world - world to check */ - public void showMembers(BSkyBlock plugin, User user, World world) { + public void showMembers(BentoBox plugin, User user, World world) { if (plugin.getIslands().inTeam(world, user.getUniqueId())) { user.sendMessage("commands.admin.info.team-members-title"); members.forEach((u, i) -> { diff --git a/src/main/java/us/tastybento/bskyblock/database/objects/Names.java b/src/main/java/world/bentobox/bbox/database/objects/Names.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/database/objects/Names.java rename to src/main/java/world/bentobox/bbox/database/objects/Names.java index 30e462328..96b3277db 100644 --- a/src/main/java/us/tastybento/bskyblock/database/objects/Names.java +++ b/src/main/java/world/bentobox/bbox/database/objects/Names.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.objects; +package world.bentobox.bbox.database.objects; import java.util.UUID; diff --git a/src/main/java/us/tastybento/bskyblock/database/objects/Players.java b/src/main/java/world/bentobox/bbox/database/objects/Players.java similarity index 87% rename from src/main/java/us/tastybento/bskyblock/database/objects/Players.java rename to src/main/java/world/bentobox/bbox/database/objects/Players.java index 44e81225f..720e79720 100755 --- a/src/main/java/us/tastybento/bskyblock/database/objects/Players.java +++ b/src/main/java/world/bentobox/bbox/database/objects/Players.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.objects; +package world.bentobox.bbox.database.objects; import java.util.Calendar; import java.util.Date; @@ -14,8 +14,8 @@ import org.bukkit.entity.Player; import com.google.gson.annotations.Expose; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.util.Util; /** * Tracks the following info on the player @@ -34,7 +34,7 @@ public class Players implements DataObject { @Expose private String locale = ""; @Expose - private int deaths; + private Map deaths = new HashMap<>(); @Expose private Map kickedList = new HashMap<>(); @@ -49,7 +49,7 @@ public class Players implements DataObject { * Constructor - initializes the state variables * */ - public Players(BSkyBlock plugin, UUID uniqueId) { + public Players(BentoBox plugin, UUID uniqueId) { this.uniqueId = uniqueId.toString(); homeLocations = new HashMap<>(); locale = ""; @@ -226,23 +226,25 @@ public class Players implements DataObject { /** * @return the deaths */ - public int getDeaths() { + public Map getDeaths() { return deaths; } /** + * @param world * @param deaths the deaths to set */ - public void setDeaths(int deaths) { - this.deaths = deaths > getPlugin().getSettings().getDeathsMax() ? getPlugin().getSettings().getDeathsMax() : deaths; + public void setDeaths(World world, int deaths) { + this.deaths.put(world.getName(), deaths > getPlugin().getIWM().getDeathsMax(world) ? getPlugin().getIWM().getDeathsMax(world) : deaths); } /** * Add death */ - public void addDeath() { - if (deaths < getPlugin().getSettings().getDeathsMax()) { - deaths++; + public void addDeath(World world) { + deaths.putIfAbsent(world.getName(), 0); + if (deaths.get(world.getName()) < getPlugin().getIWM().getDeathsMax(world)) { + deaths.put(world.getName(), deaths.get(world.getName()) + 1); } } @@ -305,4 +307,20 @@ public class Players implements DataObject { resets.merge(world.getName(), 1, Integer::sum); } + /** + * Get the number of deaths in this world + * @param world - world + * @return number of deaths + */ + public int getDeaths(World world) { + return deaths.getOrDefault(world.getName(), 0); + } + + /** + * @param deaths the deaths to set + */ + public void setDeaths(Map deaths) { + this.deaths = deaths; + } + } diff --git a/src/main/java/us/tastybento/bskyblock/database/objects/adapters/Adapter.java b/src/main/java/world/bentobox/bbox/database/objects/adapters/Adapter.java similarity index 86% rename from src/main/java/us/tastybento/bskyblock/database/objects/adapters/Adapter.java rename to src/main/java/world/bentobox/bbox/database/objects/adapters/Adapter.java index 666ca5bb4..5e6087ad4 100644 --- a/src/main/java/us/tastybento/bskyblock/database/objects/adapters/Adapter.java +++ b/src/main/java/world/bentobox/bbox/database/objects/adapters/Adapter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.objects.adapters; +package world.bentobox.bbox.database.objects.adapters; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/us/tastybento/bskyblock/database/objects/adapters/AdapterInterface.java b/src/main/java/world/bentobox/bbox/database/objects/adapters/AdapterInterface.java similarity index 88% rename from src/main/java/us/tastybento/bskyblock/database/objects/adapters/AdapterInterface.java rename to src/main/java/world/bentobox/bbox/database/objects/adapters/AdapterInterface.java index 4fc75b850..75f6a706e 100644 --- a/src/main/java/us/tastybento/bskyblock/database/objects/adapters/AdapterInterface.java +++ b/src/main/java/world/bentobox/bbox/database/objects/adapters/AdapterInterface.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.objects.adapters; +package world.bentobox.bbox.database.objects.adapters; /** diff --git a/src/main/java/us/tastybento/bskyblock/database/objects/adapters/FlagSerializer.java b/src/main/java/world/bentobox/bbox/database/objects/adapters/FlagSerializer.java similarity index 67% rename from src/main/java/us/tastybento/bskyblock/database/objects/adapters/FlagSerializer.java rename to src/main/java/world/bentobox/bbox/database/objects/adapters/FlagSerializer.java index 9a4e50fb4..37eea2489 100644 --- a/src/main/java/us/tastybento/bskyblock/database/objects/adapters/FlagSerializer.java +++ b/src/main/java/world/bentobox/bbox/database/objects/adapters/FlagSerializer.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.objects.adapters; +package world.bentobox.bbox.database.objects.adapters; import java.util.HashMap; import java.util.Map; @@ -6,13 +6,13 @@ import java.util.Map.Entry; import org.bukkit.configuration.MemorySection; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; /** - * Serializes the {@link us.tastybento.bskyblock.database.objects.Island#getFlags() getFlags()} and - * {@link us.tastybento.bskyblock.database.objects.Island#setFlags(Map)} () setFlags()} - * in {@link us.tastybento.bskyblock.database.objects.Island} + * Serializes the {@link world.bentobox.bbox.database.objects.Island#getFlags() getFlags()} and + * {@link world.bentobox.bbox.database.objects.Island#setFlags(Map)} () setFlags()} + * in {@link world.bentobox.bbox.database.objects.Island} * @author tastybento * */ @@ -29,11 +29,11 @@ public class FlagSerializer implements AdapterInterface, Map< if (object instanceof MemorySection) { MemorySection section = (MemorySection) object; for (String key : section.getKeys(false)) { - result.put(BSkyBlock.getInstance().getFlagsManager().getFlagByID(key), section.getInt(key)); + result.put(BentoBox.getInstance().getFlagsManager().getFlagByID(key), section.getInt(key)); } } else { for (Entry en : ((Map)object).entrySet()) { - result.put(BSkyBlock.getInstance().getFlagsManager().getFlagByID(en.getKey()), en.getValue()); + result.put(BentoBox.getInstance().getFlagsManager().getFlagByID(en.getKey()), en.getValue()); } } return result; diff --git a/src/main/java/us/tastybento/bskyblock/database/objects/adapters/FlagSerializer2.java b/src/main/java/world/bentobox/bbox/database/objects/adapters/FlagSerializer2.java similarity index 76% rename from src/main/java/us/tastybento/bskyblock/database/objects/adapters/FlagSerializer2.java rename to src/main/java/world/bentobox/bbox/database/objects/adapters/FlagSerializer2.java index 13be63f03..a46efe55f 100644 --- a/src/main/java/us/tastybento/bskyblock/database/objects/adapters/FlagSerializer2.java +++ b/src/main/java/world/bentobox/bbox/database/objects/adapters/FlagSerializer2.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.objects.adapters; +package world.bentobox.bbox.database.objects.adapters; import java.util.HashMap; import java.util.Map; @@ -6,8 +6,8 @@ import java.util.Map.Entry; import org.bukkit.configuration.MemorySection; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; /** * @author tastybento @@ -26,11 +26,11 @@ public class FlagSerializer2 implements AdapterInterface, Map if (object instanceof MemorySection) { MemorySection section = (MemorySection) object; for (String key : section.getKeys(false)) { - result.put(BSkyBlock.getInstance().getFlagsManager().getFlagByID(key), section.getBoolean(key) ? 0 : -1); + result.put(BentoBox.getInstance().getFlagsManager().getFlagByID(key), section.getBoolean(key) ? 0 : -1); } } else { for (Entry en : ((Map)object).entrySet()) { - result.put(BSkyBlock.getInstance().getFlagsManager().getFlagByID(en.getKey()), en.getValue() ? 0 : -1); + result.put(BentoBox.getInstance().getFlagsManager().getFlagByID(en.getKey()), en.getValue() ? 0 : -1); } } return result; diff --git a/src/main/java/us/tastybento/bskyblock/database/objects/adapters/PotionEffectListAdapter.java b/src/main/java/world/bentobox/bbox/database/objects/adapters/PotionEffectListAdapter.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/database/objects/adapters/PotionEffectListAdapter.java rename to src/main/java/world/bentobox/bbox/database/objects/adapters/PotionEffectListAdapter.java index 4efdcc366..6b751ba0f 100644 --- a/src/main/java/us/tastybento/bskyblock/database/objects/adapters/PotionEffectListAdapter.java +++ b/src/main/java/world/bentobox/bbox/database/objects/adapters/PotionEffectListAdapter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.objects.adapters; +package world.bentobox.bbox.database.objects.adapters; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/us/tastybento/bskyblock/island/builders/Clipboard.java b/src/main/java/world/bentobox/bbox/island/builders/Clipboard.java similarity index 98% rename from src/main/java/us/tastybento/bskyblock/island/builders/Clipboard.java rename to src/main/java/world/bentobox/bbox/island/builders/Clipboard.java index ab5428168..d1828d830 100644 --- a/src/main/java/us/tastybento/bskyblock/island/builders/Clipboard.java +++ b/src/main/java/world/bentobox/bbox/island/builders/Clipboard.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.island.builders; +package world.bentobox.bbox.island.builders; import java.io.BufferedOutputStream; import java.io.File; @@ -55,11 +55,11 @@ import org.bukkit.material.Redstone; import org.bukkit.material.Stairs; import org.bukkit.util.Vector; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.util.Util; public class Clipboard { @@ -94,12 +94,12 @@ public class Clipboard { private Location pos1; private Location pos2; private Location origin; - private BSkyBlock plugin; + private BentoBox plugin; private boolean copied; private File schemFolder; - public Clipboard(BSkyBlock plugin, File schemFolder) { + public Clipboard(BentoBox plugin, File schemFolder) { super(); this.plugin = plugin; if (!schemFolder.exists()) { diff --git a/src/main/java/us/tastybento/bskyblock/listeners/BannedVisitorCommands.java b/src/main/java/world/bentobox/bbox/listeners/BannedVisitorCommands.java similarity index 84% rename from src/main/java/us/tastybento/bskyblock/listeners/BannedVisitorCommands.java rename to src/main/java/world/bentobox/bbox/listeners/BannedVisitorCommands.java index 4a77bc915..5f678faad 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/BannedVisitorCommands.java +++ b/src/main/java/world/bentobox/bbox/listeners/BannedVisitorCommands.java @@ -1,13 +1,13 @@ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; /** * Blocks visitors from executing commands that they should not in the island world @@ -16,12 +16,12 @@ import us.tastybento.bskyblock.api.user.User; */ public class BannedVisitorCommands implements Listener { - private BSkyBlock plugin; + private BentoBox plugin; /** * @param plugin - plugin */ - public BannedVisitorCommands(BSkyBlock plugin) { + public BannedVisitorCommands(BentoBox plugin) { this.plugin = plugin; } diff --git a/src/main/java/us/tastybento/bskyblock/listeners/BlockEndDragon.java b/src/main/java/world/bentobox/bbox/listeners/BlockEndDragon.java similarity index 84% rename from src/main/java/us/tastybento/bskyblock/listeners/BlockEndDragon.java rename to src/main/java/world/bentobox/bbox/listeners/BlockEndDragon.java index 17652b900..59fb638ab 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/BlockEndDragon.java +++ b/src/main/java/world/bentobox/bbox/listeners/BlockEndDragon.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; @@ -6,12 +6,12 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.CreatureSpawnEvent; -import us.tastybento.bskyblock.BSkyBlock; +import world.bentobox.bbox.BentoBox; public class BlockEndDragon implements Listener { - private BSkyBlock plugin; + private BentoBox plugin; - public BlockEndDragon(BSkyBlock plugin) { + public BlockEndDragon(BentoBox plugin) { this.plugin = plugin; } diff --git a/src/main/java/us/tastybento/bskyblock/listeners/JoinLeaveListener.java b/src/main/java/world/bentobox/bbox/listeners/JoinLeaveListener.java similarity index 86% rename from src/main/java/us/tastybento/bskyblock/listeners/JoinLeaveListener.java rename to src/main/java/world/bentobox/bbox/listeners/JoinLeaveListener.java index 92ba35e10..5730526c8 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/JoinLeaveListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/JoinLeaveListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import java.util.UUID; @@ -8,20 +8,20 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.PlayersManager; public class JoinLeaveListener implements Listener { - private BSkyBlock plugin; + private BentoBox plugin; private PlayersManager players; /** * @param plugin - BSkyBlock plugin object */ - public JoinLeaveListener(BSkyBlock plugin) { + public JoinLeaveListener(BentoBox plugin) { this.plugin = plugin; players = plugin.getPlayers(); } diff --git a/src/main/java/us/tastybento/bskyblock/listeners/NetherPortals.java b/src/main/java/world/bentobox/bbox/listeners/NetherPortals.java similarity index 96% rename from src/main/java/us/tastybento/bskyblock/listeners/NetherPortals.java rename to src/main/java/world/bentobox/bbox/listeners/NetherPortals.java index 2c35b7719..1c128c51c 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/NetherPortals.java +++ b/src/main/java/world/bentobox/bbox/listeners/NetherPortals.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import org.bukkit.Location; import org.bukkit.Material; @@ -20,16 +20,16 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.util.Vector; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; -import us.tastybento.bskyblock.util.teleport.SafeTeleportBuilder; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; +import world.bentobox.bbox.util.teleport.SafeTeleportBuilder; public class NetherPortals implements Listener { private static final String ERROR_NO_PERMISSION = "general.errors.no-permission"; - private final BSkyBlock plugin; + private final BentoBox plugin; - public NetherPortals(BSkyBlock plugin) { + public NetherPortals(BentoBox plugin) { this.plugin = plugin; } diff --git a/src/main/java/us/tastybento/bskyblock/listeners/ObsidianToLava.java b/src/main/java/world/bentobox/bbox/listeners/ObsidianToLava.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/listeners/ObsidianToLava.java rename to src/main/java/world/bentobox/bbox/listeners/ObsidianToLava.java index 5b9bb23c0..699d39f94 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/ObsidianToLava.java +++ b/src/main/java/world/bentobox/bbox/listeners/ObsidianToLava.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import java.util.ArrayList; import java.util.List; @@ -13,8 +13,8 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; /** * Enables changing of obsidian back into lava @@ -23,12 +23,12 @@ import us.tastybento.bskyblock.api.user.User; */ public class ObsidianToLava implements Listener { - private BSkyBlock plugin; + private BentoBox plugin; /** * @param plugin - plugin */ - public ObsidianToLava(BSkyBlock plugin) { + public ObsidianToLava(BentoBox plugin) { this.plugin = plugin; } diff --git a/src/main/java/us/tastybento/bskyblock/listeners/PanelListenerManager.java b/src/main/java/world/bentobox/bbox/listeners/PanelListenerManager.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/listeners/PanelListenerManager.java rename to src/main/java/world/bentobox/bbox/listeners/PanelListenerManager.java index ffa796135..457af6544 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/PanelListenerManager.java +++ b/src/main/java/world/bentobox/bbox/listeners/PanelListenerManager.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import java.util.HashMap; import java.util.Map; @@ -13,10 +13,10 @@ import org.bukkit.event.inventory.InventoryType.SlotType; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.Inventory; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.user.User; public class PanelListenerManager implements Listener { @@ -25,7 +25,7 @@ public class PanelListenerManager implements Listener { @EventHandler(priority = EventPriority.LOWEST) public void onInventoryClick(InventoryClickEvent event) { // Close inventory if clicked outside and if setting is true - if (BSkyBlock.getInstance().getSettings().isClosePanelOnClickOutside() && event.getSlotType().equals(SlotType.OUTSIDE)) { + if (BentoBox.getInstance().getSettings().isClosePanelOnClickOutside() && event.getSlotType().equals(SlotType.OUTSIDE)) { event.getWhoClicked().closeInventory(); return; } diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/BlockInteractionListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/BlockInteractionListener.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/BlockInteractionListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/BlockInteractionListener.java index 6d87c7e6f..3f690d9f8 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/BlockInteractionListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/BlockInteractionListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Material; import org.bukkit.block.FlowerPot; @@ -7,8 +7,8 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * @author tastybento diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/BreakBlocksListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/BreakBlocksListener.java similarity index 95% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/BreakBlocksListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/BreakBlocksListener.java index 05083b55c..df6cb6f54 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/BreakBlocksListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/BreakBlocksListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Material; import org.bukkit.World.Environment; @@ -17,9 +17,9 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.util.BlockIterator; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; public class BreakBlocksListener extends AbstractFlagListener { diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/BreedingListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/BreedingListener.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/BreedingListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/BreedingListener.java index c7e22e49b..2e7d03f23 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/BreedingListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/BreedingListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import java.util.Arrays; import java.util.List; @@ -11,8 +11,8 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Handles breeding protection diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/BucketListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/BucketListener.java similarity index 92% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/BucketListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/BucketListener.java index 6eacf763c..bf71c0f86 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/BucketListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/BucketListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Material; import org.bukkit.block.Block; @@ -7,8 +7,8 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketFillEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Handles interaction with beds diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/ChestDamageListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/ChestDamageListener.java similarity index 82% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/ChestDamageListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/ChestDamageListener.java index 45a81810a..7150c45c3 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/ChestDamageListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/ChestDamageListener.java @@ -1,15 +1,15 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityExplodeEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * @author tastybento diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/CleanSuperFlatListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/CleanSuperFlatListener.java similarity index 84% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/CleanSuperFlatListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/CleanSuperFlatListener.java index 196152c30..c96fc8da5 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/CleanSuperFlatListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/CleanSuperFlatListener.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Material; import org.bukkit.World; @@ -10,9 +10,9 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.world.ChunkLoadEvent; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Cleans super-flat world chunks or normal nether chunks if they generate accidentally @@ -23,7 +23,7 @@ import us.tastybento.bskyblock.lists.Flags; public class CleanSuperFlatListener extends AbstractFlagListener { @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onChunkLoad(ChunkLoadEvent e) { - BSkyBlock plugin = BSkyBlock.getInstance(); + BentoBox plugin = BentoBox.getInstance(); World world = e.getWorld(); if (!e.getChunk().getBlock(0, 0, 0).getType().equals(Material.BEDROCK) || !Flags.CLEAN_SUPER_FLAT.isSetForWorld(world) diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/CreeperListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/CreeperListener.java similarity index 80% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/CreeperListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/CreeperListener.java index 13590e7da..0a42969af 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/CreeperListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/CreeperListener.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.entity.Creeper; import org.bukkit.entity.EntityType; @@ -10,15 +10,15 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityExplodeEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * Listens for creepers hsssssssh! - * For the {@link us.tastybento.bskyblock.lists.Flags#CREEPER_DAMAGE} - * and {@link us.tastybento.bskyblock.lists.Flags#CREEPER_GRIEFING} flags. + * For the {@link world.bentobox.bbox.lists.Flags#CREEPER_DAMAGE} + * and {@link world.bentobox.bbox.lists.Flags#CREEPER_GRIEFING} flags. * @author tastybento * */ diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/EggListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/EggListener.java similarity index 79% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/EggListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/EggListener.java index 1b97296e6..4bbc6d40e 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/EggListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/EggListener.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerEggThrowEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Handles throwing regular eggs (not spawn eggs) diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/EnderChestListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/EnderChestListener.java similarity index 87% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/EnderChestListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/EnderChestListener.java index 6a437cee0..43ca29f82 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/EnderChestListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/EnderChestListener.java @@ -1,7 +1,7 @@ /* */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -11,10 +11,10 @@ import org.bukkit.event.block.Action; import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.player.PlayerInteractEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * Prevents enderchest use and creation in world if it is not allowed diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/EndermanListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/EndermanListener.java similarity index 84% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/EndermanListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/EndermanListener.java index f7da1d7f1..539b2d715 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/EndermanListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/EndermanListener.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Material; import org.bukkit.entity.Enderman; @@ -11,13 +11,13 @@ import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.material.MaterialData; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Listens for Endermen - * For the {@link us.tastybento.bskyblock.lists.Flags#ENDERMAN_GRIEFING} - * and {@link us.tastybento.bskyblock.lists.Flags#CREEPER_GRIEFING} flags. + * For the {@link world.bentobox.bbox.lists.Flags#ENDERMAN_GRIEFING} + * and {@link world.bentobox.bbox.lists.Flags#CREEPER_GRIEFING} flags. * @author tastybento * */ diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/EnterExitListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/EnterExitListener.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/EnterExitListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/EnterExitListener.java index 35e4bd921..6534cb0d0 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/EnterExitListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/EnterExitListener.java @@ -1,7 +1,7 @@ /* */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import java.util.Optional; @@ -10,10 +10,10 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.util.Vector; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; /** * The Enter/Exit messages flag is a global flag and applies everywhere diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/EntityInteractListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/EntityInteractListener.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/EntityInteractListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/EntityInteractListener.java index f826b3665..739c25e4f 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/EntityInteractListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/EntityInteractListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.entity.Animals; import org.bukkit.entity.ArmorStand; @@ -9,8 +9,8 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Handles interaction with entities like armor stands diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/FireListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/FireListener.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/FireListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/FireListener.java index eb6c43f5a..2446b39b5 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/FireListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/FireListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Location; import org.bukkit.Material; @@ -13,9 +13,9 @@ import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.BlockIterator; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.lists.Flags; /** * Handles fire diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/GeoLimitClickListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/GeoLimitClickListener.java similarity index 82% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/GeoLimitClickListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/GeoLimitClickListener.java index 550d1b70e..7df6daca6 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/GeoLimitClickListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/GeoLimitClickListener.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import java.util.Arrays; import java.util.Comparator; @@ -13,15 +13,15 @@ import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.event.inventory.ClickType; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler; -import us.tastybento.bskyblock.api.panels.builders.PanelBuilder; -import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.panels.PanelItem.ClickHandler; +import world.bentobox.bbox.api.panels.builders.PanelBuilder; +import world.bentobox.bbox.api.panels.builders.PanelItemBuilder; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.util.Util; /** * Provide geo limiting to mobs - removed them if they go outside island bounds @@ -46,7 +46,7 @@ public class GeoLimitClickListener implements ClickHandler { user.sendMessage("general.errors.wrong-world"); return true; } - IslandWorldManager iwm = BSkyBlock.getInstance().getIWM(); + IslandWorldManager iwm = BentoBox.getInstance().getIWM(); String reqPerm = iwm.getPermissionPrefix(Util.getWorld(user.getWorld())) + ".admin.settings.GEO_LIMIT_MOBS"; if (!user.hasPermission(reqPerm)) { user.sendMessage("general.errors.no-permission"); @@ -90,7 +90,7 @@ public class GeoLimitClickListener implements ClickHandler { PanelItemBuilder pib = new PanelItemBuilder(); pib.name(Util.prettifyText(c.toString())); pib.clickHandler(this); - if (BSkyBlock.getInstance().getIWM().getGeoLimitSettings(user.getWorld()).contains(c.name())) { + if (BentoBox.getInstance().getIWM().getGeoLimitSettings(user.getWorld()).contains(c.name())) { pib.icon(Material.GREEN_SHULKER_BOX); pib.description(user.getTranslation("protection.panel.flag-item.setting-active")); } else { diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/GeoLimitMobsListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/GeoLimitMobsListener.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/GeoLimitMobsListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/GeoLimitMobsListener.java index fa9ce21dc..e57b92542 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/GeoLimitMobsListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/GeoLimitMobsListener.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import java.util.Map; import java.util.WeakHashMap; @@ -16,9 +16,9 @@ import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.projectiles.ProjectileSource; -import us.tastybento.bskyblock.api.events.BSBReadyEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.api.events.BentoBoxReadyEvent; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.database.objects.Island; /** * Provide geo limiting to mobs - removed them if they go outside island bounds @@ -33,7 +33,7 @@ public class GeoLimitMobsListener extends AbstractFlagListener { * Start the tracker when the plugin is loaded */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) - public void pluginReady(BSBReadyEvent event) { + public void pluginReady(BentoBoxReadyEvent event) { // Kick off the task to remove entities that go outside island boundaries Bukkit.getScheduler().runTaskTimer(getPlugin(), () -> { mobSpawnTracker.entrySet().stream() diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/HurtingListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/HurtingListener.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/HurtingListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/HurtingListener.java index 05beec93f..c5ae2cdf6 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/HurtingListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/HurtingListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import java.util.HashMap; import java.util.UUID; @@ -27,10 +27,10 @@ import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.potion.PotionEffect; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * Handles hurting of monsters and animals directly and indirectly diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/InventoryListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/InventoryListener.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/InventoryListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/InventoryListener.java index 755e7c1e7..a2c9c15a7 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/InventoryListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/InventoryListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.block.Beacon; import org.bukkit.block.BrewingStand; @@ -13,9 +13,9 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.inventory.InventoryClickEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * Handles inventory protection diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/InvincibleVisitorsListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/InvincibleVisitorsListener.java similarity index 88% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/InvincibleVisitorsListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/InvincibleVisitorsListener.java index 087056c13..3bf01c778 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/InvincibleVisitorsListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/InvincibleVisitorsListener.java @@ -1,7 +1,7 @@ /* */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import java.util.Arrays; @@ -16,15 +16,15 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.inventory.ClickType; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler; -import us.tastybento.bskyblock.api.panels.builders.PanelBuilder; -import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; -import us.tastybento.bskyblock.util.teleport.SafeTeleportBuilder; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.panels.PanelItem.ClickHandler; +import world.bentobox.bbox.api.panels.builders.PanelBuilder; +import world.bentobox.bbox.api.panels.builders.PanelItemBuilder; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.Util; +import world.bentobox.bbox.util.teleport.SafeTeleportBuilder; /** * Listener for invincible visitor settings. Handles click listening and damage events diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/IslandRespawnListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/IslandRespawnListener.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/IslandRespawnListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/IslandRespawnListener.java index 0309bb8de..7fce5e5d1 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/IslandRespawnListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/IslandRespawnListener.java @@ -1,7 +1,7 @@ /* */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import java.util.HashMap; import java.util.Map; @@ -14,9 +14,9 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerRespawnEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * Handles respawning back on island diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/ItemDropPickUpListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/ItemDropPickUpListener.java similarity index 83% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/ItemDropPickUpListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/ItemDropPickUpListener.java index 28078b131..a1b1ca52b 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/ItemDropPickUpListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/ItemDropPickUpListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -6,9 +6,9 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.player.PlayerDropItemEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * @author tastybento diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/ItemFrameListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/ItemFrameListener.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/ItemFrameListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/ItemFrameListener.java index 1722607b4..d4a532e23 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/ItemFrameListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/ItemFrameListener.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.entity.Entity; import org.bukkit.entity.ItemFrame; @@ -13,8 +13,8 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Protects item frames from damage by mobs diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/LeashListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/LeashListener.java similarity index 89% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/LeashListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/LeashListener.java index 6db8c7795..5037d48aa 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/LeashListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/LeashListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; @@ -7,8 +7,8 @@ import org.bukkit.event.entity.PlayerLeashEntityEvent; import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.player.PlayerUnleashEntityEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * @author tastybento diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/LockAndBanListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/LockAndBanListener.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/LockAndBanListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/LockAndBanListener.java index 46f83f1a4..6d0c8241c 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/LockAndBanListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/LockAndBanListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -14,9 +14,9 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.vehicle.VehicleMoveEvent; import org.bukkit.util.Vector; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * Listener for the lock flag @@ -56,7 +56,7 @@ public class LockAndBanListener implements Listener { // Check from - just in case the player is inside the island if (!check(e.getPlayer(), e.getFrom()).equals(CheckResult.OPEN)) { // Has to be done 1 tick later otherwise it doesn't happen for some reason... - Bukkit.getScheduler().runTask(BSkyBlock.getInstance(), () -> eject(e.getPlayer())); + Bukkit.getScheduler().runTask(BentoBox.getInstance(), () -> eject(e.getPlayer())); } } @@ -93,7 +93,7 @@ public class LockAndBanListener implements Listener { * @return CheckResult LOCKED, BANNED or OPEN. If an island is locked, that will take priority over banned */ private CheckResult check(Player player, Location loc) { - BSkyBlock plugin = BSkyBlock.getInstance(); + BentoBox plugin = BentoBox.getInstance(); // Ops are allowed everywhere if (player.isOp()) { return CheckResult.OPEN; @@ -139,8 +139,8 @@ public class LockAndBanListener implements Listener { private void eject(Player player) { player.setGameMode(GameMode.SPECTATOR); // Teleport player to their home - if (BSkyBlock.getInstance().getIslands().hasIsland(player.getWorld(), player.getUniqueId())) { - BSkyBlock.getInstance().getIslands().homeTeleport(player.getWorld(), player); + if (BentoBox.getInstance().getIslands().hasIsland(player.getWorld(), player.getUniqueId())) { + BentoBox.getInstance().getIslands().homeTeleport(player.getWorld(), player); } // else, TODO: teleport somewhere else? } diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/MobSpawnListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/MobSpawnListener.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/MobSpawnListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/MobSpawnListener.java index 26b7b9656..15ea69849 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/MobSpawnListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/MobSpawnListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import java.util.Optional; @@ -10,9 +10,9 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; /** * Handles natural mob spawning. diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/OfflineRedstoneListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/OfflineRedstoneListener.java similarity index 85% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/OfflineRedstoneListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/OfflineRedstoneListener.java index 60f7b9cbd..7ef51d866 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/OfflineRedstoneListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/OfflineRedstoneListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import java.util.UUID; @@ -7,8 +7,8 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockRedstoneEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; public class OfflineRedstoneListener extends AbstractFlagListener { @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/PVPListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/PVPListener.java similarity index 96% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/PVPListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/PVPListener.java index e4cf6a5da..6ab3f5164 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/PVPListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/PVPListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import java.util.HashMap; import java.util.UUID; @@ -20,10 +20,10 @@ import org.bukkit.event.entity.LingeringPotionSplashEvent; import org.bukkit.event.entity.PotionSplashEvent; import org.bukkit.event.player.PlayerFishEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * Handles PVP diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/PhysicalInteractionListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/PhysicalInteractionListener.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/PhysicalInteractionListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/PhysicalInteractionListener.java index b3da1023e..7d129ab24 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/PhysicalInteractionListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/PhysicalInteractionListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; @@ -8,9 +8,9 @@ import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityInteractEvent; import org.bukkit.event.player.PlayerInteractEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * @author tastybento diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/PistonPushListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/PistonPushListener.java similarity index 87% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/PistonPushListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/PistonPushListener.java index 7fa745f4c..b2a1533f5 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/PistonPushListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/PistonPushListener.java @@ -1,14 +1,14 @@ /* */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockPistonExtendEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Prevents pistons from pushing blocks outside island protection range diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/PlaceBlocksListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/PlaceBlocksListener.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/PlaceBlocksListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/PlaceBlocksListener.java index 1d05d234f..030e656e6 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/PlaceBlocksListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/PlaceBlocksListener.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -11,9 +11,9 @@ import org.bukkit.event.block.EntityBlockFormEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * @author tastybento diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/PortalListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/PortalListener.java similarity index 84% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/PortalListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/PortalListener.java index f9a30e73b..b7266772c 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/PortalListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/PortalListener.java @@ -1,12 +1,12 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Handles portal protection diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/RemoveMobsListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/RemoveMobsListener.java similarity index 80% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/RemoveMobsListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/RemoveMobsListener.java index 7292312e1..0147a004d 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/RemoveMobsListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/RemoveMobsListener.java @@ -1,14 +1,14 @@ /* */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerTeleportEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Removes mobs when teleporting to an island diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/ShearingListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/ShearingListener.java similarity index 74% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/ShearingListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/ShearingListener.java index 7e0b3acf0..3be804de9 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/ShearingListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/ShearingListener.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerShearEntityEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Handles shearing diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/TNTListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/TNTListener.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/TNTListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/TNTListener.java index 671165488..f272acd4a 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/TNTListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/TNTListener.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -14,9 +14,9 @@ import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerInteractEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; /** * Protects islands from visitors blowing things up diff --git a/src/main/java/us/tastybento/bskyblock/listeners/flags/TeleportationListener.java b/src/main/java/world/bentobox/bbox/listeners/flags/TeleportationListener.java similarity index 85% rename from src/main/java/us/tastybento/bskyblock/listeners/flags/TeleportationListener.java rename to src/main/java/world/bentobox/bbox/listeners/flags/TeleportationListener.java index a9375049e..101ed1bcf 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/flags/TeleportationListener.java +++ b/src/main/java/world/bentobox/bbox/listeners/flags/TeleportationListener.java @@ -1,12 +1,12 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.lists.Flags; /** * Handles teleporting due to enderpearl or chorus fruit. diff --git a/src/main/java/us/tastybento/bskyblock/listeners/protection/FlyingMobEvents.java b/src/main/java/world/bentobox/bbox/listeners/protection/FlyingMobEvents.java similarity index 96% rename from src/main/java/us/tastybento/bskyblock/listeners/protection/FlyingMobEvents.java rename to src/main/java/world/bentobox/bbox/listeners/protection/FlyingMobEvents.java index d73189574..37af36a31 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/protection/FlyingMobEvents.java +++ b/src/main/java/world/bentobox/bbox/listeners/protection/FlyingMobEvents.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.protection; +package world.bentobox.bbox.listeners.protection; import java.util.Iterator; import java.util.Map.Entry; @@ -19,8 +19,8 @@ import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.database.objects.Island; /** * This class manages flying mobs. If they exist the spawned island's limits they will be removed. @@ -29,13 +29,13 @@ import us.tastybento.bskyblock.database.objects.Island; * */ public class FlyingMobEvents implements Listener { - private BSkyBlock plugin; + private BentoBox plugin; private WeakHashMap mobSpawnInfo; /** * @param plugin - BSkyBlock plugin object */ - public FlyingMobEvents(BSkyBlock plugin) { + public FlyingMobEvents(BentoBox plugin) { this.plugin = plugin; mobSpawnInfo = new WeakHashMap<>(); diff --git a/src/main/java/us/tastybento/bskyblock/listeners/protection/InventorySave.java b/src/main/java/world/bentobox/bbox/listeners/protection/InventorySave.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/listeners/protection/InventorySave.java rename to src/main/java/world/bentobox/bbox/listeners/protection/InventorySave.java index 46fb173e9..a0b839ef5 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/protection/InventorySave.java +++ b/src/main/java/world/bentobox/bbox/listeners/protection/InventorySave.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.protection; +package world.bentobox.bbox.listeners.protection; import java.util.HashMap; import java.util.UUID; diff --git a/src/main/java/us/tastybento/bskyblock/listeners/protection/InventoryStore.java b/src/main/java/world/bentobox/bbox/listeners/protection/InventoryStore.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/listeners/protection/InventoryStore.java rename to src/main/java/world/bentobox/bbox/listeners/protection/InventoryStore.java index af4fdbe7b..4fc0584e2 100644 --- a/src/main/java/us/tastybento/bskyblock/listeners/protection/InventoryStore.java +++ b/src/main/java/world/bentobox/bbox/listeners/protection/InventoryStore.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.protection; +package world.bentobox.bbox.listeners.protection; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/us/tastybento/bskyblock/lists/Flags.java b/src/main/java/world/bentobox/bbox/lists/Flags.java similarity index 83% rename from src/main/java/us/tastybento/bskyblock/lists/Flags.java rename to src/main/java/world/bentobox/bbox/lists/Flags.java index 4960900a7..15b5334da 100644 --- a/src/main/java/us/tastybento/bskyblock/lists/Flags.java +++ b/src/main/java/world/bentobox/bbox/lists/Flags.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.lists; +package world.bentobox.bbox.lists; import java.util.Arrays; import java.util.List; @@ -7,44 +7,44 @@ import java.util.stream.Collectors; import org.bukkit.Bukkit; import org.bukkit.Material; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.flags.Flag.Type; -import us.tastybento.bskyblock.api.flags.FlagBuilder; -import us.tastybento.bskyblock.listeners.flags.BlockInteractionListener; -import us.tastybento.bskyblock.listeners.flags.BreakBlocksListener; -import us.tastybento.bskyblock.listeners.flags.BreedingListener; -import us.tastybento.bskyblock.listeners.flags.BucketListener; -import us.tastybento.bskyblock.listeners.flags.ChestDamageListener; -import us.tastybento.bskyblock.listeners.flags.CleanSuperFlatListener; -import us.tastybento.bskyblock.listeners.flags.CreeperListener; -import us.tastybento.bskyblock.listeners.flags.EggListener; -import us.tastybento.bskyblock.listeners.flags.EnderChestListener; -import us.tastybento.bskyblock.listeners.flags.EndermanListener; -import us.tastybento.bskyblock.listeners.flags.EnterExitListener; -import us.tastybento.bskyblock.listeners.flags.EntityInteractListener; -import us.tastybento.bskyblock.listeners.flags.FireListener; -import us.tastybento.bskyblock.listeners.flags.GeoLimitClickListener; -import us.tastybento.bskyblock.listeners.flags.GeoLimitMobsListener; -import us.tastybento.bskyblock.listeners.flags.HurtingListener; -import us.tastybento.bskyblock.listeners.flags.InventoryListener; -import us.tastybento.bskyblock.listeners.flags.InvincibleVisitorsListener; -import us.tastybento.bskyblock.listeners.flags.IslandRespawnListener; -import us.tastybento.bskyblock.listeners.flags.ItemDropPickUpListener; -import us.tastybento.bskyblock.listeners.flags.ItemFrameListener; -import us.tastybento.bskyblock.listeners.flags.LeashListener; -import us.tastybento.bskyblock.listeners.flags.LockAndBanListener; -import us.tastybento.bskyblock.listeners.flags.MobSpawnListener; -import us.tastybento.bskyblock.listeners.flags.OfflineRedstoneListener; -import us.tastybento.bskyblock.listeners.flags.PVPListener; -import us.tastybento.bskyblock.listeners.flags.PhysicalInteractionListener; -import us.tastybento.bskyblock.listeners.flags.PistonPushListener; -import us.tastybento.bskyblock.listeners.flags.PlaceBlocksListener; -import us.tastybento.bskyblock.listeners.flags.PortalListener; -import us.tastybento.bskyblock.listeners.flags.RemoveMobsListener; -import us.tastybento.bskyblock.listeners.flags.ShearingListener; -import us.tastybento.bskyblock.listeners.flags.TNTListener; -import us.tastybento.bskyblock.listeners.flags.TeleportationListener; -import us.tastybento.bskyblock.managers.RanksManager; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.flags.FlagBuilder; +import world.bentobox.bbox.api.flags.Flag.Type; +import world.bentobox.bbox.listeners.flags.BlockInteractionListener; +import world.bentobox.bbox.listeners.flags.BreakBlocksListener; +import world.bentobox.bbox.listeners.flags.BreedingListener; +import world.bentobox.bbox.listeners.flags.BucketListener; +import world.bentobox.bbox.listeners.flags.ChestDamageListener; +import world.bentobox.bbox.listeners.flags.CleanSuperFlatListener; +import world.bentobox.bbox.listeners.flags.CreeperListener; +import world.bentobox.bbox.listeners.flags.EggListener; +import world.bentobox.bbox.listeners.flags.EnderChestListener; +import world.bentobox.bbox.listeners.flags.EndermanListener; +import world.bentobox.bbox.listeners.flags.EnterExitListener; +import world.bentobox.bbox.listeners.flags.EntityInteractListener; +import world.bentobox.bbox.listeners.flags.FireListener; +import world.bentobox.bbox.listeners.flags.GeoLimitClickListener; +import world.bentobox.bbox.listeners.flags.GeoLimitMobsListener; +import world.bentobox.bbox.listeners.flags.HurtingListener; +import world.bentobox.bbox.listeners.flags.InventoryListener; +import world.bentobox.bbox.listeners.flags.InvincibleVisitorsListener; +import world.bentobox.bbox.listeners.flags.IslandRespawnListener; +import world.bentobox.bbox.listeners.flags.ItemDropPickUpListener; +import world.bentobox.bbox.listeners.flags.ItemFrameListener; +import world.bentobox.bbox.listeners.flags.LeashListener; +import world.bentobox.bbox.listeners.flags.LockAndBanListener; +import world.bentobox.bbox.listeners.flags.MobSpawnListener; +import world.bentobox.bbox.listeners.flags.OfflineRedstoneListener; +import world.bentobox.bbox.listeners.flags.PVPListener; +import world.bentobox.bbox.listeners.flags.PhysicalInteractionListener; +import world.bentobox.bbox.listeners.flags.PistonPushListener; +import world.bentobox.bbox.listeners.flags.PlaceBlocksListener; +import world.bentobox.bbox.listeners.flags.PortalListener; +import world.bentobox.bbox.listeners.flags.RemoveMobsListener; +import world.bentobox.bbox.listeners.flags.ShearingListener; +import world.bentobox.bbox.listeners.flags.TNTListener; +import world.bentobox.bbox.listeners.flags.TeleportationListener; +import world.bentobox.bbox.managers.RanksManager; public class Flags { diff --git a/src/main/java/us/tastybento/bskyblock/lists/Placeholders.java b/src/main/java/world/bentobox/bbox/lists/Placeholders.java similarity index 72% rename from src/main/java/us/tastybento/bskyblock/lists/Placeholders.java rename to src/main/java/world/bentobox/bbox/lists/Placeholders.java index 8cad6bcf9..2ec515c3b 100644 --- a/src/main/java/us/tastybento/bskyblock/lists/Placeholders.java +++ b/src/main/java/world/bentobox/bbox/lists/Placeholders.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.lists; +package world.bentobox.bbox.lists; import java.util.Arrays; import java.util.List; @@ -6,16 +6,16 @@ import java.util.stream.Collectors; import org.bukkit.Bukkit; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.placeholders.Placeholder; -import us.tastybento.bskyblock.api.placeholders.PlaceholderBuilder; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.placeholders.Placeholder; +import world.bentobox.bbox.api.placeholders.PlaceholderBuilder; public class Placeholders { // Utility classes, which are collections of static members, are not meant to be instantiated. private Placeholders() {} - public static final Placeholder PLUGIN_NAME = new PlaceholderBuilder().identifier("bsb_plugin_name").value(user -> BSkyBlock.getInstance().getDescription().getName()).build(); + public static final Placeholder PLUGIN_NAME = new PlaceholderBuilder().identifier("bsb_plugin_name").value(user -> BentoBox.getInstance().getDescription().getName()).build(); /** * @return List of all the flags in this class diff --git a/src/main/java/us/tastybento/bskyblock/managers/AddonsManager.java b/src/main/java/world/bentobox/bbox/managers/AddonsManager.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/managers/AddonsManager.java rename to src/main/java/world/bentobox/bbox/managers/AddonsManager.java index 3509bb38c..3963f22a1 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/AddonsManager.java +++ b/src/main/java/world/bentobox/bbox/managers/AddonsManager.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import java.io.BufferedReader; import java.io.File; @@ -18,11 +18,11 @@ import java.util.jar.JarFile; import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.addons.Addon; -import us.tastybento.bskyblock.api.addons.AddonClassLoader; -import us.tastybento.bskyblock.api.addons.exception.InvalidAddonFormatException; -import us.tastybento.bskyblock.api.events.addon.AddonEvent; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.addons.Addon; +import world.bentobox.bbox.api.addons.AddonClassLoader; +import world.bentobox.bbox.api.addons.exception.InvalidAddonFormatException; +import world.bentobox.bbox.api.events.addon.AddonEvent; /** * @author Tastybento, ComminQ @@ -34,9 +34,9 @@ public class AddonsManager { private List addons; private List loader; private final Map> classes = new HashMap<>(); - private BSkyBlock plugin; + private BentoBox plugin; - public AddonsManager(BSkyBlock plugin) { + public AddonsManager(BentoBox plugin) { this.plugin = plugin; addons = new ArrayList<>(); loader = new ArrayList<>(); diff --git a/src/main/java/us/tastybento/bskyblock/managers/CommandsManager.java b/src/main/java/world/bentobox/bbox/managers/CommandsManager.java similarity index 71% rename from src/main/java/us/tastybento/bskyblock/managers/CommandsManager.java rename to src/main/java/world/bentobox/bbox/managers/CommandsManager.java index 20452f315..76fc00507 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/CommandsManager.java +++ b/src/main/java/world/bentobox/bbox/managers/CommandsManager.java @@ -1,12 +1,13 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import java.lang.reflect.Field; import java.util.HashMap; +import java.util.Set; import org.bukkit.Bukkit; import org.bukkit.command.CommandMap; -import us.tastybento.bskyblock.api.commands.CompositeCommand; +import world.bentobox.bbox.api.commands.CompositeCommand; public class CommandsManager { @@ -26,12 +27,21 @@ public class CommandsManager { } } + /** + * Try to get a registered command. + * @param command - command string + * @return CompositeCommand or null if it does not exist + */ public CompositeCommand getCommand(String command) { return commands.get(command); } - public String listCommands() { - return commands.keySet().toString(); + /** + * List all commands registered so far + * @return set of commands + */ + public Set listCommands() { + return commands.keySet(); } } diff --git a/src/main/java/us/tastybento/bskyblock/managers/FlagsManager.java b/src/main/java/world/bentobox/bbox/managers/FlagsManager.java similarity index 87% rename from src/main/java/us/tastybento/bskyblock/managers/FlagsManager.java rename to src/main/java/world/bentobox/bbox/managers/FlagsManager.java index f7ad11d88..4784516c1 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/FlagsManager.java +++ b/src/main/java/world/bentobox/bbox/managers/FlagsManager.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import java.util.ArrayList; import java.util.HashMap; @@ -8,9 +8,9 @@ import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.event.Listener; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.lists.Flags; /** * @author Poslovitch @@ -18,7 +18,7 @@ import us.tastybento.bskyblock.lists.Flags; */ public class FlagsManager { - private BSkyBlock plugin; + private BentoBox plugin; private List flags = new ArrayList<>(); /** @@ -27,7 +27,7 @@ public class FlagsManager { */ private Map registeredListeners = new HashMap<>(); - public FlagsManager(BSkyBlock plugin) { + public FlagsManager(BentoBox plugin) { this.plugin = plugin; // Register default flags @@ -65,7 +65,7 @@ public class FlagsManager { */ private void registerListener(Listener l) { registeredListeners.putIfAbsent(l, false); - if (BSkyBlock.getInstance().isLoaded() && !registeredListeners.get(l)) { + if (BentoBox.getInstance().isLoaded() && !registeredListeners.get(l)) { Bukkit.getServer().getPluginManager().registerEvents(l, plugin); registeredListeners.put(l, true); } diff --git a/src/main/java/us/tastybento/bskyblock/managers/IslandWorldManager.java b/src/main/java/world/bentobox/bbox/managers/IslandWorldManager.java similarity index 79% rename from src/main/java/us/tastybento/bskyblock/managers/IslandWorldManager.java rename to src/main/java/world/bentobox/bbox/managers/IslandWorldManager.java index 551fae369..ea7304ce5 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/IslandWorldManager.java +++ b/src/main/java/world/bentobox/bbox/managers/IslandWorldManager.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import java.io.File; import java.util.HashMap; @@ -14,18 +14,15 @@ import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.World.Environment; -import org.bukkit.WorldCreator; -import org.bukkit.WorldType; import org.bukkit.entity.EntityType; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.addons.Addon; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.generators.ChunkGeneratorWorld; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.addons.Addon; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.util.Util; /** * Handles registration and management of worlds @@ -39,78 +36,18 @@ public class IslandWorldManager { private static final String MULTIVERSE_IMPORT = "mv import "; private static final String NETHER = "_nether"; private static final String THE_END = "_the_end"; - private static final String CREATING = "Creating "; - private BSkyBlock plugin; - private World islandWorld; - private World netherWorld; - private World endWorld; + private BentoBox plugin; private Map worlds; private Map worldSettings; /** * Generates the Skyblock worlds. */ - public IslandWorldManager(BSkyBlock plugin) { + public IslandWorldManager(BentoBox plugin) { this.plugin = plugin; worlds = new HashMap<>(); worldSettings = new HashMap<>(); - if (plugin.getSettings().isUseOwnGenerator()) { - plugin.log("Default world generator disabled."); - islandWorld = Bukkit.getWorld(plugin.getSettings().getWorldName()); - if (plugin.getSettings().isNetherGenerate()) { - netherWorld = plugin.getServer().getWorld(plugin.getSettings().getWorldName() + NETHER); - if (netherWorld == null) { - plugin.logError("Island nether world does not exist - you must create it manually"); - } - } - if (plugin.getSettings().isEndGenerate()) { - endWorld = plugin.getServer().getWorld(plugin.getSettings().getWorldName() + THE_END); - if (endWorld == null) { - plugin.logError("Island end world does not exist - you must create it manually"); - } - } - if (islandWorld != null) { - addWorld(islandWorld, plugin.getSettings()); - } else { - plugin.logError("Island world does not exist - you must create it manually"); - } - return; - } - if (plugin.getServer().getWorld(plugin.getSettings().getWorldName()) == null) { - plugin.log(CREATING + plugin.getName() + "'s Island World..."); - } - // Create the world if it does not exist - islandWorld = WorldCreator.name(plugin.getSettings().getWorldName()).type(WorldType.FLAT) - .environment(World.Environment.NORMAL).generator(new ChunkGeneratorWorld(plugin)).createWorld(); - addWorld(islandWorld, plugin.getSettings()); - // Make the nether if it does not exist - if (plugin.getSettings().isNetherGenerate()) { - if (plugin.getServer().getWorld(plugin.getSettings().getWorldName() + NETHER) == null) { - plugin.log(CREATING + plugin.getName() + "'s Nether..."); - } - if (!plugin.getSettings().isNetherIslands()) { - netherWorld = WorldCreator.name(plugin.getSettings().getWorldName() + NETHER).type(WorldType.NORMAL) - .environment(World.Environment.NETHER).createWorld(); - } else { - netherWorld = WorldCreator.name(plugin.getSettings().getWorldName() + NETHER).type(WorldType.FLAT) - .generator(new ChunkGeneratorWorld(plugin)).environment(World.Environment.NETHER).createWorld(); - } - } - // Make the end if it does not exist - if (plugin.getSettings().isEndGenerate()) { - if (plugin.getServer().getWorld(plugin.getSettings().getWorldName() + THE_END) == null) { - plugin.log(CREATING + plugin.getName() + "'s End World..."); - } - if (!plugin.getSettings().isEndIslands()) { - endWorld = WorldCreator.name(plugin.getSettings().getWorldName() + THE_END).type(WorldType.NORMAL) - .environment(World.Environment.THE_END).createWorld(); - } else { - endWorld = WorldCreator.name(plugin.getSettings().getWorldName() + THE_END).type(WorldType.FLAT) - .generator(new ChunkGeneratorWorld(plugin)).environment(World.Environment.THE_END) - .createWorld(); - } - } } /** @@ -133,42 +70,6 @@ public class IslandWorldManager { } } - /** - * Should only be used by BSB-specific functions - * - * @return the islandWorld - */ - public World getBSBIslandWorld() { - if (plugin.getSettings().isUseOwnGenerator()) { - return Bukkit.getServer().getWorld(plugin.getSettings().getWorldName()); - } - return islandWorld; - } - - /** - * Should only be used by BSB-specific functions - * - * @return the netherWorld - */ - public World getBSBNetherWorld() { - if (plugin.getSettings().isUseOwnGenerator()) { - return Bukkit.getServer().getWorld(plugin.getSettings().getWorldName() + NETHER); - } - return netherWorld; - } - - /** - * Should only be used by BSB-specific functions - * - * @return the endWorld - */ - public World getBSBEndWorld() { - if (plugin.getSettings().isUseOwnGenerator()) { - return Bukkit.getServer().getWorld(plugin.getSettings().getWorldName() + THE_END); - } - return endWorld; - } - /** * Checks if a location is in any of the island worlds * @@ -760,4 +661,17 @@ public class IslandWorldManager { public void setResetEpoch(World world) { worldSettings.get(Util.getWorld(world)).setResetEpoch(System.currentTimeMillis()); } + + public boolean isTeamJoinDeathReset(World world) { + return worldSettings.get(Util.getWorld(world)).isTeamJoinDeathReset(); + } + + /** + * Get the maximum number of deaths allowed in this world + * @param world - world + * @return max deaths + */ + public int getDeathsMax(World world) { + return worldSettings.get(Util.getWorld(world)).getDeathsMax(); + } } diff --git a/src/main/java/us/tastybento/bskyblock/managers/IslandsManager.java b/src/main/java/world/bentobox/bbox/managers/IslandsManager.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/managers/IslandsManager.java rename to src/main/java/world/bentobox/bbox/managers/IslandsManager.java index d3f9aab8e..85aebf4c4 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/IslandsManager.java +++ b/src/main/java/world/bentobox/bbox/managers/IslandsManager.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import java.util.Collection; import java.util.HashMap; @@ -24,16 +24,16 @@ import org.bukkit.material.SimpleAttachableMaterialData; import org.bukkit.material.TrapDoor; import org.bukkit.util.Vector; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Constants; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.BSBDatabase; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.island.IslandCache; -import us.tastybento.bskyblock.util.DeleteIslandChunks; -import us.tastybento.bskyblock.util.Util; -import us.tastybento.bskyblock.util.teleport.SafeTeleportBuilder; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Constants; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.BSBDatabase; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.island.IslandCache; +import world.bentobox.bbox.util.DeleteIslandChunks; +import world.bentobox.bbox.util.Util; +import world.bentobox.bbox.util.teleport.SafeTeleportBuilder; /** * The job of this class is manage all island related data. @@ -44,7 +44,7 @@ import us.tastybento.bskyblock.util.teleport.SafeTeleportBuilder; */ public class IslandsManager { - private BSkyBlock plugin; + private BentoBox plugin; /** * One island can be spawn, this is the one - otherwise, this value is null @@ -71,7 +71,7 @@ public class IslandsManager { * Islands Manager * @param plugin - plugin */ - public IslandsManager(BSkyBlock plugin){ + public IslandsManager(BentoBox plugin){ this.plugin = plugin; // Set up the database handler to store and retrieve Island classes handler = new BSBDatabase<>(plugin, Island.class); diff --git a/src/main/java/us/tastybento/bskyblock/managers/LocalesManager.java b/src/main/java/world/bentobox/bbox/managers/LocalesManager.java similarity index 87% rename from src/main/java/us/tastybento/bskyblock/managers/LocalesManager.java rename to src/main/java/world/bentobox/bbox/managers/LocalesManager.java index b3951616a..7d52dbe35 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/LocalesManager.java +++ b/src/main/java/world/bentobox/bbox/managers/LocalesManager.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import java.io.File; import java.io.FilenameFilter; @@ -13,21 +13,22 @@ import java.util.Map; import java.util.Objects; import org.bukkit.configuration.file.YamlConfiguration; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.localization.BSBLocale; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.FileLister; + +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.localization.BentoBoxLocale; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.util.FileLister; /** * @author tastybento, Poslovitch */ public class LocalesManager { - private BSkyBlock plugin; - private Map languages = new HashMap<>(); + private BentoBox plugin; + private Map languages = new HashMap<>(); private static final String LOCALE_FOLDER = "locales"; - public LocalesManager(BSkyBlock plugin) { + public LocalesManager(BentoBox plugin) { this.plugin = plugin; loadLocales("BSkyBlock"); // Default } @@ -39,7 +40,7 @@ public class LocalesManager { * @return the translated string, or if the translation does not exist, the default language version, or if that does not exist null */ public String get(User user, String reference) { - BSBLocale locale = languages.get(user.getLocale()); + BentoBoxLocale locale = languages.get(user.getLocale()); if (locale != null && locale.contains(reference)) { return locale.get(reference); } @@ -95,10 +96,10 @@ public class LocalesManager { languages.get(localeObject).merge(languageYaml); } else { // New language - languages.put(localeObject, new BSBLocale(localeObject, languageYaml)); + languages.put(localeObject, new BentoBoxLocale(localeObject, languageYaml)); } } catch (Exception e) { - BSkyBlock.getInstance().logError("Could not load '" + language.getName() + "' : " + e.getMessage() + BentoBox.getInstance().logError("Could not load '" + language.getName() + "' : " + e.getMessage() + " with the following cause '" + e.getCause() + "'." + " The file has likely an invalid YML format or has been made unreadable during the process." ); @@ -133,7 +134,7 @@ public class LocalesManager { } } - public Map getLanguages() { + public Map getLanguages() { return this.languages; } } diff --git a/src/main/java/us/tastybento/bskyblock/managers/PlayersManager.java b/src/main/java/world/bentobox/bbox/managers/PlayersManager.java similarity index 93% rename from src/main/java/us/tastybento/bskyblock/managers/PlayersManager.java rename to src/main/java/world/bentobox/bbox/managers/PlayersManager.java index 8789976e6..4117d125a 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/PlayersManager.java +++ b/src/main/java/world/bentobox/bbox/managers/PlayersManager.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import java.util.Collection; import java.util.Collections; @@ -12,15 +12,15 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.BSBDatabase; -import us.tastybento.bskyblock.database.objects.Names; -import us.tastybento.bskyblock.database.objects.Players; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.BSBDatabase; +import world.bentobox.bbox.database.objects.Names; +import world.bentobox.bbox.database.objects.Players; public class PlayersManager { - private BSkyBlock plugin; + private BentoBox plugin; private BSBDatabase handler; private BSBDatabase names; @@ -34,7 +34,7 @@ public class PlayersManager { * * @param plugin - BSkyBlock plugin object */ - public PlayersManager(BSkyBlock plugin){ + public PlayersManager(BentoBox plugin){ this.plugin = plugin; // Set up the database handler to store and retrieve Players classes handler = new BSBDatabase<>(plugin, Players.class); @@ -360,31 +360,34 @@ public class PlayersManager { /** * Add death to player + * @param world - world * @param playerUUID - the player's UUID */ - public void addDeath(UUID playerUUID) { + public void addDeath(World world, UUID playerUUID) { addPlayer(playerUUID); - playerCache.get(playerUUID).addDeath(); + playerCache.get(playerUUID).addDeath(world); } /** * Set death number for player + * @param world * @param playerUUID - the player's UUID * @param deaths - number of deaths */ - public void setDeaths(UUID playerUUID, int deaths) { + public void setDeaths(World world, UUID playerUUID, int deaths) { addPlayer(playerUUID); - playerCache.get(playerUUID).setDeaths(deaths); + playerCache.get(playerUUID).setDeaths(world, deaths); } /** - * Get number of times player has died in BSkyBlock worlds since counting began + * Get number of times player has died since counting began + * @param world - world * @param playerUUID - the player's UUID * @return number of deaths */ - public int getDeaths(UUID playerUUID) { + public int getDeaths(World world, UUID playerUUID) { addPlayer(playerUUID); - return playerCache.get(playerUUID).getDeaths(); + return playerCache.get(playerUUID).getDeaths(world); } /** diff --git a/src/main/java/us/tastybento/bskyblock/managers/RanksManager.java b/src/main/java/world/bentobox/bbox/managers/RanksManager.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/managers/RanksManager.java rename to src/main/java/world/bentobox/bbox/managers/RanksManager.java index 747d3f62b..35cc3512d 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/RanksManager.java +++ b/src/main/java/world/bentobox/bbox/managers/RanksManager.java @@ -1,11 +1,11 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.stream.Collectors; -import us.tastybento.bskyblock.BSkyBlock; +import world.bentobox.bbox.BentoBox; public class RanksManager { @@ -23,7 +23,7 @@ public class RanksManager { public static final int VISITOR_RANK = 0; public static final int BANNED_RANK = -1; - private BSkyBlock plugin; + private BentoBox plugin; // The store of ranks private LinkedHashMap ranks = new LinkedHashMap<>(); @@ -31,7 +31,7 @@ public class RanksManager { /** * @param plugin - BSkyBlock plugin object */ - public RanksManager(BSkyBlock plugin) { + public RanksManager(BentoBox plugin) { super(); this.plugin = plugin; // Hard coded ranks diff --git a/src/main/java/us/tastybento/bskyblock/managers/SchemsManager.java b/src/main/java/world/bentobox/bbox/managers/SchemsManager.java similarity index 91% rename from src/main/java/us/tastybento/bskyblock/managers/SchemsManager.java rename to src/main/java/world/bentobox/bbox/managers/SchemsManager.java index d176d2242..f4531601c 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/SchemsManager.java +++ b/src/main/java/world/bentobox/bbox/managers/SchemsManager.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import java.io.File; import java.io.IOException; @@ -9,20 +9,20 @@ import java.util.Optional; import org.bukkit.World; import org.bukkit.configuration.InvalidConfigurationException; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.addons.Addon; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.island.builders.Clipboard; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.addons.Addon; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.island.builders.Clipboard; public class SchemsManager { - private BSkyBlock plugin; + private BentoBox plugin; private Map islandSchems; /** * @param plugin */ - public SchemsManager(BSkyBlock plugin) { + public SchemsManager(BentoBox plugin) { this.plugin = plugin; islandSchems = new HashMap<>(); } diff --git a/src/main/java/us/tastybento/bskyblock/managers/island/IslandCache.java b/src/main/java/world/bentobox/bbox/managers/island/IslandCache.java similarity index 98% rename from src/main/java/us/tastybento/bskyblock/managers/island/IslandCache.java rename to src/main/java/world/bentobox/bbox/managers/island/IslandCache.java index 4282acbbf..3dbe54a09 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/island/IslandCache.java +++ b/src/main/java/world/bentobox/bbox/managers/island/IslandCache.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers.island; +package world.bentobox.bbox.managers.island; import java.util.Collection; import java.util.Collections; @@ -11,8 +11,8 @@ import java.util.UUID; import org.bukkit.Location; import org.bukkit.World; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.util.Util; public class IslandCache { private Map islandsByLocation; diff --git a/src/main/java/us/tastybento/bskyblock/managers/island/IslandGrid.java b/src/main/java/world/bentobox/bbox/managers/island/IslandGrid.java similarity index 96% rename from src/main/java/us/tastybento/bskyblock/managers/island/IslandGrid.java rename to src/main/java/world/bentobox/bbox/managers/island/IslandGrid.java index f2124ff76..153fc116c 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/island/IslandGrid.java +++ b/src/main/java/world/bentobox/bbox/managers/island/IslandGrid.java @@ -1,9 +1,10 @@ -package us.tastybento.bskyblock.managers.island; +package world.bentobox.bbox.managers.island; import java.util.Map.Entry; -import java.util.TreeMap; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.database.objects.Island; + +import java.util.TreeMap; /** * Handles the island location grid for each world diff --git a/src/main/java/us/tastybento/bskyblock/managers/island/NewIsland.java b/src/main/java/world/bentobox/bbox/managers/island/NewIsland.java similarity index 94% rename from src/main/java/us/tastybento/bskyblock/managers/island/NewIsland.java rename to src/main/java/world/bentobox/bbox/managers/island/NewIsland.java index 72bc3bb14..40dbaf45c 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/island/NewIsland.java +++ b/src/main/java/world/bentobox/bbox/managers/island/NewIsland.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers.island; +package world.bentobox.bbox.managers.island; import java.io.IOException; import java.util.EnumMap; @@ -9,13 +9,13 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.World.Environment; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.api.events.island.IslandEvent; -import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.api.events.island.IslandEvent; +import world.bentobox.bbox.api.events.island.IslandEvent.Reason; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.util.Util; /** * Create and paste a new island @@ -24,7 +24,7 @@ import us.tastybento.bskyblock.util.Util; */ public class NewIsland { private static final Integer MAX_UNOWNED_ISLANDS = 10; - private BSkyBlock plugin; + private BentoBox plugin; private Island island; private final User user; private final Reason reason; @@ -38,7 +38,7 @@ public class NewIsland { private NewIsland(Island oldIsland, User user, Reason reason, World world) { super(); - plugin = BSkyBlock.getInstance(); + plugin = BentoBox.getInstance(); this.user = user; this.reason = reason; this.world = world; diff --git a/src/main/java/us/tastybento/bskyblock/panels/LanguagePanel.java b/src/main/java/world/bentobox/bbox/panels/LanguagePanel.java similarity index 78% rename from src/main/java/us/tastybento/bskyblock/panels/LanguagePanel.java rename to src/main/java/world/bentobox/bbox/panels/LanguagePanel.java index e5b55e648..8adb73bb2 100644 --- a/src/main/java/us/tastybento/bskyblock/panels/LanguagePanel.java +++ b/src/main/java/world/bentobox/bbox/panels/LanguagePanel.java @@ -1,14 +1,14 @@ -package us.tastybento.bskyblock.panels; +package world.bentobox.bbox.panels; import java.util.Locale; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.panels.builders.PanelBuilder; -import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.panels.builders.PanelBuilder; +import world.bentobox.bbox.api.panels.builders.PanelItemBuilder; +import world.bentobox.bbox.api.user.User; /** * @author Poslovitch @@ -25,10 +25,10 @@ public class LanguagePanel { PanelBuilder panelBuilder = new PanelBuilder() .name(user.getTranslation("language.panel-title")); - for (Locale locale : BSkyBlock.getInstance().getLocalesManager().getAvailableLocales(true)) { + for (Locale locale : BentoBox.getInstance().getLocalesManager().getAvailableLocales(true)) { PanelItemBuilder localeIcon = new PanelItemBuilder(); - ItemStack localeBanner = BSkyBlock.getInstance().getLocalesManager().getLanguages().get(locale).getBanner(); + ItemStack localeBanner = BentoBox.getInstance().getLocalesManager().getLanguages().get(locale).getBanner(); if (localeBanner != null) { localeIcon.icon(localeBanner); } else { @@ -37,7 +37,7 @@ public class LanguagePanel { localeIcon.name(fancyLocaleDisplayName(user, locale)) .clickHandler((panel, u, click, slot) -> { - BSkyBlock.getInstance().getPlayers().setLocale(u.getUniqueId(), locale.toLanguageTag()); + BentoBox.getInstance().getPlayers().setLocale(u.getUniqueId(), locale.toLanguageTag()); u.sendMessage("language.edited", "[lang]", fancyLocaleDisplayName(u, locale)); openPanel(u); return true; diff --git a/src/main/java/us/tastybento/bskyblock/panels/SettingsPanel.java b/src/main/java/world/bentobox/bbox/panels/SettingsPanel.java similarity index 80% rename from src/main/java/us/tastybento/bskyblock/panels/SettingsPanel.java rename to src/main/java/world/bentobox/bbox/panels/SettingsPanel.java index 0b4bd2c96..61a2613c1 100644 --- a/src/main/java/us/tastybento/bskyblock/panels/SettingsPanel.java +++ b/src/main/java/world/bentobox/bbox/panels/SettingsPanel.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.panels; +package world.bentobox.bbox.panels; import java.util.Comparator; @@ -6,12 +6,12 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.inventory.ItemStack; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.panels.builders.PanelBuilder; -import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.panels.builders.PanelBuilder; +import world.bentobox.bbox.api.panels.builders.PanelItemBuilder; +import world.bentobox.bbox.api.user.User; /** * Creates settings panels @@ -28,7 +28,7 @@ public class SettingsPanel { * @param plugin - plugin * @param user the User to show the panel to */ - public static void openPanel(BSkyBlock plugin, User user, Flag.Type flagType, World world) { + public static void openPanel(BentoBox plugin, User user, Flag.Type flagType, World world) { String friendlyWorldName = plugin.getIWM().getFriendlyName(world); // Create the panel PanelBuilder panelBuilder = new PanelBuilder() @@ -54,7 +54,7 @@ public class SettingsPanel { .glow(flagType.equals(currentFlagType)) .clickHandler((panel, user1, clickType, slot1) -> { if (!flagType.equals(currentFlagType)) { - openPanel(BSkyBlock.getInstance(), user, flagType, world); + openPanel(BentoBox.getInstance(), user, flagType, world); } return true; }) diff --git a/src/main/java/us/tastybento/bskyblock/util/DeleteIslandChunks.java b/src/main/java/world/bentobox/bbox/util/DeleteIslandChunks.java similarity index 79% rename from src/main/java/us/tastybento/bskyblock/util/DeleteIslandChunks.java rename to src/main/java/world/bentobox/bbox/util/DeleteIslandChunks.java index ea46d5a53..e01ee8c39 100644 --- a/src/main/java/us/tastybento/bskyblock/util/DeleteIslandChunks.java +++ b/src/main/java/world/bentobox/bbox/util/DeleteIslandChunks.java @@ -1,12 +1,12 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; import org.bukkit.World; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.api.events.island.IslandEvent; -import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.api.events.island.IslandEvent; +import world.bentobox.bbox.api.events.island.IslandEvent.Reason; +import world.bentobox.bbox.database.objects.Island; /** * Deletes islands fast using chunk regeneration @@ -21,7 +21,7 @@ public class DeleteIslandChunks { * @param plugin - BSkyBlock plugin object * @param island - island to delete */ - public DeleteIslandChunks(final BSkyBlock plugin, final Island island) { + public DeleteIslandChunks(final BentoBox plugin, final Island island) { // Fire event IslandBaseEvent event = IslandEvent.builder().island(island).reason(Reason.DELETE).build(); if (event.isCancelled()) { diff --git a/src/main/java/us/tastybento/bskyblock/util/FileLister.java b/src/main/java/world/bentobox/bbox/util/FileLister.java similarity index 98% rename from src/main/java/us/tastybento/bskyblock/util/FileLister.java rename to src/main/java/world/bentobox/bbox/util/FileLister.java index e2dfb17bf..28d1fbadd 100755 --- a/src/main/java/us/tastybento/bskyblock/util/FileLister.java +++ b/src/main/java/world/bentobox/bbox/util/FileLister.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; import java.io.File; import java.io.FilenameFilter; diff --git a/src/main/java/us/tastybento/bskyblock/util/HeadGetter.java b/src/main/java/world/bentobox/bbox/util/HeadGetter.java similarity index 92% rename from src/main/java/us/tastybento/bskyblock/util/HeadGetter.java rename to src/main/java/world/bentobox/bbox/util/HeadGetter.java index d78eb5be2..1f491a848 100644 --- a/src/main/java/us/tastybento/bskyblock/util/HeadGetter.java +++ b/src/main/java/world/bentobox/bbox/util/HeadGetter.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; import java.util.HashMap; import java.util.HashSet; @@ -11,19 +11,19 @@ import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.panels.PanelItem; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.panels.PanelItem; public class HeadGetter { private static Map cachedHeads = new HashMap<>(); private static final Map names = new HashMap<>(); - private BSkyBlock plugin; + private BentoBox plugin; private static Map> headRequesters = new HashMap<>(); /** * @param plugin - plugin */ - public HeadGetter(BSkyBlock plugin) { + public HeadGetter(BentoBox plugin) { super(); this.plugin = plugin; runPlayerHeadGetter(); diff --git a/src/main/java/us/tastybento/bskyblock/util/HeadRequester.java b/src/main/java/world/bentobox/bbox/util/HeadRequester.java similarity index 57% rename from src/main/java/us/tastybento/bskyblock/util/HeadRequester.java rename to src/main/java/world/bentobox/bbox/util/HeadRequester.java index 1091291bd..e8d07fff5 100644 --- a/src/main/java/us/tastybento/bskyblock/util/HeadRequester.java +++ b/src/main/java/world/bentobox/bbox/util/HeadRequester.java @@ -1,6 +1,6 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; -import us.tastybento.bskyblock.api.panels.PanelItem; +import world.bentobox.bbox.api.panels.PanelItem; public interface HeadRequester { diff --git a/src/main/java/us/tastybento/bskyblock/util/ItemParser.java b/src/main/java/world/bentobox/bbox/util/ItemParser.java similarity index 99% rename from src/main/java/us/tastybento/bskyblock/util/ItemParser.java rename to src/main/java/world/bentobox/bbox/util/ItemParser.java index 443715eff..2f1270db4 100644 --- a/src/main/java/us/tastybento/bskyblock/util/ItemParser.java +++ b/src/main/java/world/bentobox/bbox/util/ItemParser.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; import org.apache.commons.lang.StringUtils; import org.bukkit.DyeColor; diff --git a/src/main/java/us/tastybento/bskyblock/util/Pair.java b/src/main/java/world/bentobox/bbox/util/Pair.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/util/Pair.java rename to src/main/java/world/bentobox/bbox/util/Pair.java index 577a8a131..ce26c4677 100644 --- a/src/main/java/us/tastybento/bskyblock/util/Pair.java +++ b/src/main/java/world/bentobox/bbox/util/Pair.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; public class Pair { diff --git a/src/main/java/us/tastybento/bskyblock/util/Util.java b/src/main/java/world/bentobox/bbox/util/Util.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/util/Util.java rename to src/main/java/world/bentobox/bbox/util/Util.java index f99a02b38..1b4f2da0f 100755 --- a/src/main/java/us/tastybento/bskyblock/util/Util.java +++ b/src/main/java/world/bentobox/bbox/util/Util.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; import java.util.ArrayList; import java.util.List; @@ -14,8 +14,8 @@ import org.bukkit.entity.Player; import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.util.Vector; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; /** * A set of utility methods @@ -28,11 +28,11 @@ public class Util { private static final String NETHER = "_nether"; private static final String THE_END = "_the_end"; private static String serverVersion = null; - private static BSkyBlock plugin = BSkyBlock.getInstance(); + private static BentoBox plugin = BentoBox.getInstance(); private Util() {} - public static void setPlugin(BSkyBlock p) { + public static void setPlugin(BentoBox p) { plugin = p; } diff --git a/src/main/java/us/tastybento/bskyblock/util/YmlCommentParser.java b/src/main/java/world/bentobox/bbox/util/YmlCommentParser.java similarity index 99% rename from src/main/java/us/tastybento/bskyblock/util/YmlCommentParser.java rename to src/main/java/world/bentobox/bbox/util/YmlCommentParser.java index 5fc19c178..172e0b61d 100644 --- a/src/main/java/us/tastybento/bskyblock/util/YmlCommentParser.java +++ b/src/main/java/world/bentobox/bbox/util/YmlCommentParser.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; import java.io.BufferedReader; import java.io.IOException; diff --git a/src/main/java/us/tastybento/bskyblock/util/YmlConfiguration.java b/src/main/java/world/bentobox/bbox/util/YmlConfiguration.java similarity index 97% rename from src/main/java/us/tastybento/bskyblock/util/YmlConfiguration.java rename to src/main/java/world/bentobox/bbox/util/YmlConfiguration.java index 8ca1b6769..2e040283c 100644 --- a/src/main/java/us/tastybento/bskyblock/util/YmlConfiguration.java +++ b/src/main/java/world/bentobox/bbox/util/YmlConfiguration.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; import java.util.Map; diff --git a/src/main/java/us/tastybento/bskyblock/util/teleport/SafeSpotTeleport.java b/src/main/java/world/bentobox/bbox/util/teleport/SafeSpotTeleport.java similarity index 96% rename from src/main/java/us/tastybento/bskyblock/util/teleport/SafeSpotTeleport.java rename to src/main/java/world/bentobox/bbox/util/teleport/SafeSpotTeleport.java index 34e226b24..239adbdf6 100644 --- a/src/main/java/us/tastybento/bskyblock/util/teleport/SafeSpotTeleport.java +++ b/src/main/java/world/bentobox/bbox/util/teleport/SafeSpotTeleport.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util.teleport; +package world.bentobox.bbox.util.teleport; import java.util.ArrayList; import java.util.Iterator; @@ -16,10 +16,10 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitTask; import org.bukkit.util.Vector; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.util.Pair; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.util.Pair; /** * A class that calculates finds a safe spot asynchronously and then teleports the player there. @@ -43,7 +43,7 @@ public class SafeSpotTeleport { // Locations private Location bestSpot; - private BSkyBlock plugin; + private BentoBox plugin; private List> chunksToScan; /** @@ -55,7 +55,7 @@ public class SafeSpotTeleport { * @param portal - true if this is a portal teleport * @param homeNumber - home number to go to */ - protected SafeSpotTeleport(BSkyBlock plugin, final Entity entity, final Location location, final String failureMessage, boolean portal, + protected SafeSpotTeleport(BentoBox plugin, final Entity entity, final Location location, final String failureMessage, boolean portal, int homeNumber) { this.plugin = plugin; this.entity = entity; diff --git a/src/main/java/us/tastybento/bskyblock/util/teleport/SafeTeleportBuilder.java b/src/main/java/world/bentobox/bbox/util/teleport/SafeTeleportBuilder.java similarity index 90% rename from src/main/java/us/tastybento/bskyblock/util/teleport/SafeTeleportBuilder.java rename to src/main/java/world/bentobox/bbox/util/teleport/SafeTeleportBuilder.java index 8209d7d80..9d6eb989f 100644 --- a/src/main/java/us/tastybento/bskyblock/util/teleport/SafeTeleportBuilder.java +++ b/src/main/java/world/bentobox/bbox/util/teleport/SafeTeleportBuilder.java @@ -1,16 +1,16 @@ -package us.tastybento.bskyblock.util.teleport; +package world.bentobox.bbox.util.teleport; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; public class SafeTeleportBuilder { - private BSkyBlock plugin; + private BentoBox plugin; private Entity entity; private int homeNumber = 0; private boolean portal = false; @@ -18,7 +18,7 @@ public class SafeTeleportBuilder { private Location location; - public SafeTeleportBuilder(BSkyBlock plugin) { + public SafeTeleportBuilder(BentoBox plugin) { this.plugin = plugin; } diff --git a/src/test/java/bskyblock/TestBSkyBlock.java b/src/test/java/bskyblock/TestBSkyBlock.java index 1b219166a..82e7bbdc7 100644 --- a/src/test/java/bskyblock/TestBSkyBlock.java +++ b/src/test/java/bskyblock/TestBSkyBlock.java @@ -48,26 +48,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.commands.CompositeCommand; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.api.events.team.TeamEvent; -import us.tastybento.bskyblock.api.flags.AbstractFlagListener; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.flags.FlagBuilder; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.RanksManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.events.IslandBaseEvent; +import world.bentobox.bbox.api.events.team.TeamEvent; +import world.bentobox.bbox.api.flags.AbstractFlagListener; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.flags.FlagBuilder; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.RanksManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({ BSkyBlock.class, Flags.class, Util.class, Bukkit.class}) +@PrepareForTest({ BentoBox.class, Flags.class, Util.class, Bukkit.class}) public class TestBSkyBlock { private static final UUID MEMBER_UUID = UUID.randomUUID(); private static final UUID OWNER_UUID = UUID.randomUUID(); @@ -76,7 +76,7 @@ public class TestBSkyBlock { private static CommandSender sender; private static Player player; private static Location location; - private static BSkyBlock plugin; + private static BentoBox plugin; private static FlagsManager flagsManager; private static Block block; private static Player ownerOfIsland; @@ -85,9 +85,9 @@ public class TestBSkyBlock { @Before public void setUp() { // Set up plugin - plugin = mock(BSkyBlock.class); + plugin = mock(BentoBox.class); when(plugin.getCommandsManager()).thenReturn(mock(CommandsManager.class)); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); Server server = mock(Server.class); World world = mock(World.class); @@ -146,9 +146,6 @@ public class TestBSkyBlock { // Worlds IslandWorldManager iwm = mock(IslandWorldManager.class); Mockito.when(plugin.getIWM()).thenReturn(iwm); - Mockito.when(iwm.getBSBIslandWorld()).thenReturn(world); - Mockito.when(iwm.getBSBNetherWorld()).thenReturn(world); - Mockito.when(iwm.getBSBEndWorld()).thenReturn(world); when(iwm.inWorld(any())).thenReturn(true); PowerMockito.mockStatic(Util.class); when(Util.getWorld(Mockito.any())).thenReturn(world); @@ -519,7 +516,7 @@ public class TestBSkyBlock { * */ private class FlagListener extends AbstractFlagListener { - FlagListener(BSkyBlock plugin) { + FlagListener(BentoBox plugin) { // Set the plugin explicitly setPlugin(plugin); } diff --git a/src/test/java/us/tastybento/bskyblock/commands/AdminCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/AdminCommandTest.java deleted file mode 100644 index 4b94165a3..000000000 --- a/src/test/java/us/tastybento/bskyblock/commands/AdminCommandTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * - */ -package us.tastybento.bskyblock.commands; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.logging.Logger; - -import org.bukkit.Bukkit; -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.plugin.PluginManager; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.reflect.Whitebox; - -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; - -/** - * @author tastybento - * - */ -@RunWith(PowerMockRunner.class) -@PrepareForTest( { BSkyBlock.class }) -public class AdminCommandTest { - - @Mock - static BSkyBlock plugin; - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - Server server = mock(Server.class); - World world = mock(World.class); - when(server.getLogger()).thenReturn(Logger.getAnonymousLogger()); - when(server.getWorld("world")).thenReturn(world); - when(server.getVersion()).thenReturn("BSB_Mocking"); - - PluginManager pluginManager = mock(PluginManager.class); - when(server.getPluginManager()).thenReturn(pluginManager); - - Bukkit.setServer(server); - - when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger()); - - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); - - IslandWorldManager iwm = mock(IslandWorldManager.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(plugin.getIWM()).thenReturn(iwm); - - } - - /** - * Test method for {@link us.tastybento.bskyblock.commands.AdminCommand#AdminCommand()}. - */ - @Test - public void testAdminCommand() { - CommandsManager cm = mock(CommandsManager.class); - when(plugin.getCommandsManager()).thenReturn(cm); - assertNotNull(new AdminCommand()); - // Verify the command has been registered - Mockito.verify(cm).registerCommand(Mockito.any()); - } - - /** - * Test method for {@link us.tastybento.bskyblock.commands.AdminCommand#setup()}. - */ - @Test - public void testSetup() { - CommandsManager cm = mock(CommandsManager.class); - when(plugin.getCommandsManager()).thenReturn(cm); - AdminCommand ac = new AdminCommand(); - ac.setup(); - assertEquals("bskyblock.admin.*", ac.getPermission()); - assertFalse(ac.isOnlyPlayer()); - assertEquals("commands.admin.help.parameters", ac.getParameters()); - assertEquals("commands.admin.help.description", ac.getDescription()); - } - - /** - * Test method for {@link us.tastybento.bskyblock.commands.AdminCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. - */ - @Test - public void testExecuteUserListOfString() { - CommandsManager cm = mock(CommandsManager.class); - when(plugin.getCommandsManager()).thenReturn(cm); - AdminCommand ac = new AdminCommand(); - assertTrue(ac.execute(mock(User.class), ac.getLabel(), new ArrayList<>())); - - // No such command - String[] args2 = {"random", "junk"}; - assertFalse(ac.execute(mock(User.class), ac.getLabel(), Arrays.asList(args2))); - } - -} diff --git a/src/test/java/us/tastybento/bskyblock/commands/IslandCommandTest.java b/src/test/java/us/tastybento/bskyblock/commands/IslandCommandTest.java deleted file mode 100644 index 3c8dd8c4a..000000000 --- a/src/test/java/us/tastybento/bskyblock/commands/IslandCommandTest.java +++ /dev/null @@ -1,163 +0,0 @@ -package us.tastybento.bskyblock.commands; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.UUID; -import java.util.logging.Logger; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.plugin.PluginManager; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.reflect.Whitebox; - -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.events.IslandBaseEvent; -import us.tastybento.bskyblock.api.events.island.IslandEvent; -import us.tastybento.bskyblock.api.events.island.IslandEvent.IslandEventBuilder; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.managers.island.NewIsland; -import us.tastybento.bskyblock.managers.island.NewIsland.Builder; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, NewIsland.class, IslandEvent.class }) -public class IslandCommandTest { - - @Mock - static BSkyBlock plugin; - private static World world; - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - Server server = mock(Server.class); - world = mock(World.class); - when(world.getName()).thenReturn("BSkyBlock_test_world"); - when(server.getLogger()).thenReturn(Logger.getAnonymousLogger()); - when(server.getWorld("world")).thenReturn(world); - when(server.getVersion()).thenReturn("BSB_Mocking"); - - PluginManager pluginManager = mock(PluginManager.class); - when(server.getPluginManager()).thenReturn(pluginManager); - - PowerMockito.mockStatic(Bukkit.class); - when(Bukkit.getServer()).thenReturn(server); - - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); - - } - - @Before - public void setup() { - // Island World Manager - IslandWorldManager iwm = mock(IslandWorldManager.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(iwm.getWorld(Mockito.anyString())).thenReturn(world); - when(plugin.getIWM()).thenReturn(iwm); - } - - @Test - public void testIslandCommand() { - CommandsManager cm = mock(CommandsManager.class); - when(plugin.getCommandsManager()).thenReturn(cm); - assertNotNull(new IslandCommand()); - // Verify the command has been registered - Mockito.verify(cm).registerCommand(Mockito.any()); - } - - @Test - public void testSetup() { - CommandsManager cm = mock(CommandsManager.class); - when(plugin.getCommandsManager()).thenReturn(cm); - IslandCommand ic = new IslandCommand(); - assertEquals("commands.island.help.description", ic.getDescription()); - assertTrue(ic.isOnlyPlayer()); - // Permission - assertEquals("bskyblock.island", ic.getPermission()); - - } - - @Test - public void testExecuteUserListOfString() throws IOException { - PowerMockito.mockStatic(NewIsland.class); - Builder builder = mock(Builder.class); - Island island = mock(Island.class); - when(builder.build()).thenReturn(island); - when(builder.oldIsland(Mockito.any())).thenReturn(builder); - when(builder.player(Mockito.any())).thenReturn(builder); - when(builder.reason(Mockito.any())).thenReturn(builder); - when(builder.world(Mockito.any())).thenReturn(builder); - when(NewIsland.builder()).thenReturn(builder); - - PowerMockito.mockStatic(IslandEvent.class); - IslandEventBuilder ieb = mock(IslandEventBuilder.class); - when(ieb.admin(Mockito.anyBoolean())).thenReturn(ieb); - IslandBaseEvent event = mock(IslandBaseEvent.class); - when(ieb.build()).thenReturn(event); - when(ieb.involvedPlayer(Mockito.any())).thenReturn(ieb); - when(ieb.island(Mockito.any())).thenReturn(ieb); - when(ieb.location(Mockito.any())).thenReturn(ieb); - when(ieb.reason(Mockito.any())).thenReturn(ieb); - when(IslandEvent.builder()).thenReturn(ieb); - - CommandsManager cm = mock(CommandsManager.class); - when(plugin.getCommandsManager()).thenReturn(cm); - // Setup - IslandCommand ic = new IslandCommand(); - assertFalse(ic.execute(null, ic.getLabel(), new ArrayList<>())); - IslandsManager im = mock(IslandsManager.class); - when(plugin.getIslands()).thenReturn(im); - User user = mock(User.class); - UUID uuid = UUID.randomUUID(); - Player player = mock(Player.class); - when(user.getPlayer()).thenReturn(player); - when(user.getUniqueId()).thenReturn(uuid); - PlayersManager pm = mock(PlayersManager.class); - when(plugin.getPlayers()).thenReturn(pm); - Settings settings = mock(Settings.class); - when(plugin.getSettings()).thenReturn(settings); - - // User has an island - so go there! - when(im.getIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(island); - assertTrue(ic.execute(user, ic.getLabel(), new ArrayList<>())); - when(user.getWorld()).thenReturn(world); - - - Location location = mock(Location.class); - when(island.getCenter()).thenReturn(location); - // No island yet, one will be created - when(im.createIsland(Mockito.any(), Mockito.any())).thenReturn(island); - when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false); - assertTrue(ic.execute(user, ic.getLabel(), new ArrayList<>())); - - // No such command - String[] args2 = {"random", "junk"}; - assertFalse(ic.execute(user, ic.getLabel(), Arrays.asList(args2))); - } - -} diff --git a/src/test/java/us/tastybento/bskyblock/api/addons/AddonTest.java b/src/test/java/world/bentobox/bbox/api/addons/AddonTest.java similarity index 93% rename from src/test/java/us/tastybento/bskyblock/api/addons/AddonTest.java rename to src/test/java/world/bentobox/bbox/api/addons/AddonTest.java index 5887beab0..d9676307e 100644 --- a/src/test/java/us/tastybento/bskyblock/api/addons/AddonTest.java +++ b/src/test/java/world/bentobox/bbox/api/addons/AddonTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.addons; +package world.bentobox.bbox.api.addons; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -30,17 +30,19 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.managers.AddonsManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.addons.Addon; +import world.bentobox.bbox.api.addons.AddonDescription; +import world.bentobox.bbox.managers.AddonsManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.PlayersManager; @RunWith(PowerMockRunner.class) -@PrepareForTest( { BSkyBlock.class }) +@PrepareForTest( { BentoBox.class }) public class AddonTest { @Mock - static BSkyBlock plugin; + static BentoBox plugin; static JavaPlugin javaPlugin; @@ -59,8 +61,8 @@ public class AddonTest { when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger()); - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Mock item factory (for itemstacks) ItemFactory itemFactory = mock(ItemFactory.class); diff --git a/src/test/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommandTest.java b/src/test/java/world/bentobox/bbox/api/commands/DefaultHelpCommandTest.java similarity index 88% rename from src/test/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommandTest.java rename to src/test/java/world/bentobox/bbox/api/commands/DefaultHelpCommandTest.java index 775e1da86..0dca11bf2 100644 --- a/src/test/java/us/tastybento/bskyblock/api/commands/DefaultHelpCommandTest.java +++ b/src/test/java/world/bentobox/bbox/api/commands/DefaultHelpCommandTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.commands; +package world.bentobox.bbox.api.commands; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.mock; @@ -21,18 +21,17 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.events.command.CommandEvent; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.IslandCommand; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.events.command.CommandEvent; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.PlayersManager; @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, CommandEvent.class}) +@PrepareForTest({Bukkit.class, BentoBox.class, CommandEvent.class}) public class DefaultHelpCommandTest { private User user; @@ -43,19 +42,18 @@ public class DefaultHelpCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); - + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); + // Command manager CommandsManager cm = mock(CommandsManager.class); when(plugin.getCommandsManager()).thenReturn(cm); - + // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); - + // Player Player player = mock(Player.class); // Sometimes use: Mockito.withSettings().verboseLogging() @@ -67,9 +65,9 @@ public class DefaultHelpCommandTest { User.setPlugin(plugin); // Set up user already User.getInstance(player); - + // Parent command has no aliases - IslandCommand ic = mock(IslandCommand.class); + CompositeCommand ic = mock(CompositeCommand.class); when(ic.getSubCommandAliases()).thenReturn(new HashMap<>()); // No island for player to begin with (set it later in the tests) @@ -88,14 +86,14 @@ public class DefaultHelpCommandTest { BukkitScheduler sch = mock(BukkitScheduler.class); PowerMockito.mockStatic(Bukkit.class); when(Bukkit.getScheduler()).thenReturn(sch); - + // IWM friendly name IslandWorldManager iwm = mock(IslandWorldManager.class); when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock"); when(plugin.getIWM()).thenReturn(iwm); } - + class FakeParent extends CompositeCommand { public FakeParent() { @@ -110,16 +108,16 @@ public class DefaultHelpCommandTest { public boolean execute(User user, String label, List args) { return false; } - + } @Test public void testDefaultHelpCommand() throws Exception { CompositeCommand cc = mock(CompositeCommand.class); - + DefaultHelpCommand dhc = new DefaultHelpCommand(cc); assertNotNull(dhc); - Mockito.verify(cc).getSubCommands(); + Mockito.verify(cc).getSubCommands(); } @Test @@ -158,10 +156,10 @@ public class DefaultHelpCommandTest { "", "[description]", "the main island command" - ); + ); Mockito.verify(user).sendMessage("commands.help.end"); } - + @Test public void testExecuteSecondLevelHelp() { CompositeCommand parent = mock(CompositeCommand.class); @@ -189,7 +187,7 @@ public class DefaultHelpCommandTest { "", "[description]", "the main island command" - ); + ); } @Test @@ -222,7 +220,7 @@ public class DefaultHelpCommandTest { "help-parameters", "[description]", "the help command" - ); + ); } } diff --git a/src/test/java/us/tastybento/bskyblock/api/flags/FlagTest.java b/src/test/java/world/bentobox/bbox/api/flags/FlagTest.java similarity index 91% rename from src/test/java/us/tastybento/bskyblock/api/flags/FlagTest.java rename to src/test/java/world/bentobox/bbox/api/flags/FlagTest.java index 1f0cc80a4..40f7f8c99 100644 --- a/src/test/java/us/tastybento/bskyblock/api/flags/FlagTest.java +++ b/src/test/java/world/bentobox/bbox/api/flags/FlagTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.flags; +package world.bentobox.bbox.api.flags; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -33,19 +33,20 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.flags.Flag.Type; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.RanksManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.flags.Flag.Type; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.RanksManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({ BSkyBlock.class, Util.class, Bukkit.class }) +@PrepareForTest({ BentoBox.class, Util.class, Bukkit.class }) public class FlagTest { @BeforeClass @@ -55,8 +56,8 @@ public class FlagTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); PowerMockito.mockStatic(Util.class); when(Util.getWorld(Mockito.any())).thenReturn(mock(World.class)); @@ -181,7 +182,7 @@ public class FlagTest { @Test public void testToPanelItem() throws Exception { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); IslandsManager im = mock(IslandsManager.class); diff --git a/src/test/java/us/tastybento/bskyblock/api/flags/clicklisteners/CycleClickTest.java b/src/test/java/world/bentobox/bbox/api/flags/clicklisteners/CycleClickTest.java similarity index 90% rename from src/test/java/us/tastybento/bskyblock/api/flags/clicklisteners/CycleClickTest.java rename to src/test/java/world/bentobox/bbox/api/flags/clicklisteners/CycleClickTest.java index cf9d38ed5..688f20dda 100644 --- a/src/test/java/us/tastybento/bskyblock/api/flags/clicklisteners/CycleClickTest.java +++ b/src/test/java/world/bentobox/bbox/api/flags/clicklisteners/CycleClickTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.flags.clicklisteners; +package world.bentobox.bbox.api.flags.clicklisteners; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -28,31 +28,31 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.user.Notifier; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.managers.RanksManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.user.Notifier; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.managers.RanksManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class, Util.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class, Util.class }) public class CycleClickTest { private static final Integer PROTECTION_RANGE = 200; private static final Integer X = 600; private static final Integer Y = 120; private static final Integer Z = 10000; - private BSkyBlock plugin; + private BentoBox plugin; private UUID uuid; private User user; private IslandsManager im; @@ -69,8 +69,8 @@ public class CycleClickTest { public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // World World world = mock(World.class); @@ -78,7 +78,6 @@ public class CycleClickTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/us/tastybento/bskyblock/api/flags/clicklisteners/IslandToggleClickTest.java b/src/test/java/world/bentobox/bbox/api/flags/clicklisteners/IslandToggleClickTest.java similarity index 84% rename from src/test/java/us/tastybento/bskyblock/api/flags/clicklisteners/IslandToggleClickTest.java rename to src/test/java/world/bentobox/bbox/api/flags/clicklisteners/IslandToggleClickTest.java index 240abbf8e..12ce4794e 100644 --- a/src/test/java/us/tastybento/bskyblock/api/flags/clicklisteners/IslandToggleClickTest.java +++ b/src/test/java/world/bentobox/bbox/api/flags/clicklisteners/IslandToggleClickTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.flags.clicklisteners; +package world.bentobox.bbox.api.flags.clicklisteners; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -20,19 +20,20 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.flags.clicklisteners.IslandToggleClick; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({BSkyBlock.class, Util.class }) +@PrepareForTest({BentoBox.class, Util.class }) public class IslandToggleClickTest { private IslandWorldManager iwm; @@ -51,8 +52,8 @@ public class IslandToggleClickTest { public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Island World Manager iwm = mock(IslandWorldManager.class); when(iwm.inWorld(Mockito.any())).thenReturn(true); diff --git a/src/test/java/us/tastybento/bskyblock/api/flags/clicklisteners/WorldToggleClickTest.java b/src/test/java/world/bentobox/bbox/api/flags/clicklisteners/WorldToggleClickTest.java similarity index 83% rename from src/test/java/us/tastybento/bskyblock/api/flags/clicklisteners/WorldToggleClickTest.java rename to src/test/java/world/bentobox/bbox/api/flags/clicklisteners/WorldToggleClickTest.java index e8b9ff235..fe5658fd6 100644 --- a/src/test/java/us/tastybento/bskyblock/api/flags/clicklisteners/WorldToggleClickTest.java +++ b/src/test/java/world/bentobox/bbox/api/flags/clicklisteners/WorldToggleClickTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.flags.clicklisteners; +package world.bentobox.bbox.api.flags.clicklisteners; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -18,17 +18,18 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.flags.clicklisteners.WorldToggleClick; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({BSkyBlock.class, Util.class }) +@PrepareForTest({BentoBox.class, Util.class }) public class WorldToggleClickTest { private IslandWorldManager iwm; @@ -44,8 +45,8 @@ public class WorldToggleClickTest { public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Island World Manager iwm = mock(IslandWorldManager.class); when(iwm.inWorld(Mockito.any())).thenReturn(true); diff --git a/src/test/java/us/tastybento/bskyblock/api/panels/builders/PanelItemBuilderTest.java b/src/test/java/world/bentobox/bbox/api/panels/builders/PanelItemBuilderTest.java similarity index 95% rename from src/test/java/us/tastybento/bskyblock/api/panels/builders/PanelItemBuilderTest.java rename to src/test/java/world/bentobox/bbox/api/panels/builders/PanelItemBuilderTest.java index 5cb2322b7..7199fe690 100644 --- a/src/test/java/us/tastybento/bskyblock/api/panels/builders/PanelItemBuilderTest.java +++ b/src/test/java/world/bentobox/bbox/api/panels/builders/PanelItemBuilderTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.panels.builders; +package world.bentobox.bbox.api.panels.builders; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -29,9 +29,10 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.powermock.modules.junit4.PowerMockRunner; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.user.User; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.panels.builders.PanelItemBuilder; +import world.bentobox.bbox.api.user.User; @RunWith(PowerMockRunner.class) public class PanelItemBuilderTest { diff --git a/src/test/java/us/tastybento/bskyblock/api/user/UserTest.java b/src/test/java/world/bentobox/bbox/api/user/UserTest.java similarity index 94% rename from src/test/java/us/tastybento/bskyblock/api/user/UserTest.java rename to src/test/java/world/bentobox/bbox/api/user/UserTest.java index cab7b2b6d..93ff99af2 100644 --- a/src/test/java/us/tastybento/bskyblock/api/user/UserTest.java +++ b/src/test/java/world/bentobox/bbox/api/user/UserTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.api.user; +package world.bentobox.bbox.api.user; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -34,10 +34,12 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.powermock.modules.junit4.PowerMockRunner; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.user.Notifier; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; @RunWith(PowerMockRunner.class) @@ -108,7 +110,7 @@ public class UserTest { @Test public void testSetPlugin() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); } @@ -203,7 +205,7 @@ public class UserTest { @Test public void testGetTranslation() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); // Locales - final LocalesManager lm = mock(LocalesManager.class); @@ -222,7 +224,7 @@ public class UserTest { @Test public void testGetTranslationOrNothing() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); // Locales - final LocalesManager lm = mock(LocalesManager.class); @@ -237,7 +239,7 @@ public class UserTest { @Test public void testSendMessage() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); // Locales - final LocalesManager lm = mock(LocalesManager.class); @@ -254,7 +256,7 @@ public class UserTest { @Test public void testSendMessageNullUser() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); // Locales - final LocalesManager lm = mock(LocalesManager.class); @@ -272,7 +274,7 @@ public class UserTest { @Test public void testSendMessageBlankTranslation() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); // Locales - final LocalesManager lm = mock(LocalesManager.class); @@ -289,7 +291,7 @@ public class UserTest { @Test public void testSendMessageOnlyColors() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); // Locales - final LocalesManager lm = mock(LocalesManager.class); @@ -311,7 +313,7 @@ public class UserTest { @Test public void testSendRawMessage() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); String raw = ChatColor.RED + "" + ChatColor.BOLD + "test message"; @@ -326,7 +328,7 @@ public class UserTest { @Test public void testSendRawMessageNullUser() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); String raw = ChatColor.RED + "" + ChatColor.BOLD + "test message"; @@ -340,7 +342,7 @@ public class UserTest { @Test public void testNotifyStringStringArrayNotifyOK() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); Notifier notifier = mock(Notifier.class); when(plugin.getNotifier()).thenReturn(notifier); @@ -405,7 +407,7 @@ public class UserTest { @Test public void testGetLocalePlayer() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); PlayersManager pm = mock(PlayersManager.class); when(plugin.getPlayers()).thenReturn(pm); @@ -420,7 +422,7 @@ public class UserTest { @Test public void testGetLocaleConsole() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); User.setPlugin(plugin); PlayersManager pm = mock(PlayersManager.class); when(plugin.getPlayers()).thenReturn(pm); diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsAllCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/AdminClearResetsAllCommandTest.java similarity index 74% rename from src/test/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsAllCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/AdminClearResetsAllCommandTest.java index ff218ea86..890c3f46b 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsAllCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/AdminClearResetsAllCommandTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import static org.junit.Assert.assertFalse; import static org.mockito.Mockito.mock; @@ -9,7 +9,6 @@ import java.util.HashMap; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import org.junit.Before; @@ -21,21 +20,21 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminClearResetsAllCommandTest { - private AdminCommand ac; + private CompositeCommand ac; private User user; private IslandsManager im; private PlayersManager pm; @@ -47,8 +46,8 @@ public class AdminClearResetsAllCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -57,7 +56,6 @@ public class AdminClearResetsAllCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -76,17 +74,14 @@ public class AdminClearResetsAllCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(plugin.getIWM()).thenReturn(iwm); - - // Player has island to begin with + // Player has island to begin with im = mock(IslandsManager.class); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true); @@ -94,7 +89,7 @@ public class AdminClearResetsAllCommandTest { when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid); when(plugin.getIslands()).thenReturn(im); - // Has team + // Has team pm = mock(PlayersManager.class); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); @@ -110,9 +105,9 @@ public class AdminClearResetsAllCommandTest { when(lm.get(Mockito.any(), Mockito.any())).thenReturn("mock translation"); when(plugin.getLocalesManager()).thenReturn(lm); } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminClearResetsAllCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.AdminClearResetsAllCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteCheckConfirm() { diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/AdminClearResetsCommandTest.java similarity index 75% rename from src/test/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/AdminClearResetsCommandTest.java index ae915ad8e..07b867a45 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminClearResetsCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/AdminClearResetsCommandTest.java @@ -1,7 +1,7 @@ /** - * + * */ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -14,7 +14,6 @@ import java.util.HashMap; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import org.junit.Before; @@ -26,25 +25,25 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author ben * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminClearResetsCommandTest { - private AdminCommand ac; + private CompositeCommand ac; private User user; private IslandsManager im; private PlayersManager pm; @@ -56,8 +55,8 @@ public class AdminClearResetsCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -66,7 +65,6 @@ public class AdminClearResetsCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -85,17 +83,14 @@ public class AdminClearResetsCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(plugin.getIWM()).thenReturn(iwm); - - // Player has island to begin with + // Player has island to begin with im = mock(IslandsManager.class); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true); @@ -103,7 +98,7 @@ public class AdminClearResetsCommandTest { when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid); when(plugin.getIslands()).thenReturn(im); - // Has team + // Has team pm = mock(PlayersManager.class); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); @@ -120,8 +115,8 @@ public class AdminClearResetsCommandTest { when(plugin.getLocalesManager()).thenReturn(lm); } - /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminClearResetsCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + /** + * Test method for {@link world.bentobox.bbox.commands.admin.AdminClearResetsCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoTarget() { @@ -132,7 +127,7 @@ public class AdminClearResetsCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminClearResetsCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.AdminClearResetsCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteUnknownPlayer() { @@ -144,7 +139,7 @@ public class AdminClearResetsCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminClearResetsCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.AdminClearResetsCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecutePlayerNoIsland() { @@ -155,9 +150,9 @@ public class AdminClearResetsCommandTest { assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.player-has-no-island")); } - + /** - * Test method for {@link us.AdminClearResetsCommand.tastybento.bskyblock.commands.admin.AdminClearResetCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.AdminClearResetsCommand.tastybento.bskyblock.commands.admin.AdminClearResetCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteSuccess() { diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/AdminInfoCommandTest.java similarity index 78% rename from src/test/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/AdminInfoCommandTest.java index 6bd3f74dd..02cc0dd0c 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminInfoCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/AdminInfoCommandTest.java @@ -1,15 +1,19 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; @@ -22,27 +26,27 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminInfoCommandTest { - private BSkyBlock plugin; - private AdminCommand ac; + private BentoBox plugin; + private CompositeCommand ac; private UUID uuid; private User user; private IslandsManager im; @@ -55,8 +59,8 @@ public class AdminInfoCommandTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -65,7 +69,6 @@ public class AdminInfoCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -84,18 +87,16 @@ public class AdminInfoCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock"); when(plugin.getIWM()).thenReturn(iwm); - // Player has island to begin with + // Player has island to begin with im = mock(IslandsManager.class); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true); @@ -103,7 +104,7 @@ public class AdminInfoCommandTest { when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid); when(plugin.getIslands()).thenReturn(im); - // Has team + // Has team pm = mock(PlayersManager.class); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); @@ -120,7 +121,7 @@ public class AdminInfoCommandTest { when(plugin.getLocalesManager()).thenReturn(lm); } - + /** * Test method for {@link AdminInfoCommand#execute(User, String, List)}. */ @@ -134,7 +135,7 @@ public class AdminInfoCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminInfoCommand#execute(User, String, List)} . + * Test method for {@link world.bentobox.bbox.commands.admin.AdminInfoCommand#execute(User, String, List)} . */ @Test public void testExecuteUnknownPlayer() { @@ -146,7 +147,7 @@ public class AdminInfoCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminInfoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.AdminInfoCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecutePlayerHasNoIsland() { @@ -158,9 +159,9 @@ public class AdminInfoCommandTest { assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.player-has-no-island")); } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminInfoCommand#execute(User, String, List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.AdminInfoCommand#execute(User, String, List)}. */ @Test public void testExecuteSuccess() { @@ -173,9 +174,9 @@ public class AdminInfoCommandTest { assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(is).showInfo(Mockito.eq(plugin), Mockito.eq(user), Mockito.any()); } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminInfoCommand#execute(User, String, List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.AdminInfoCommand#execute(User, String, List)}. */ @Test public void testExecuteUserNotOnIsland() { @@ -187,16 +188,16 @@ public class AdminInfoCommandTest { // Confirm other verifications Mockito.verify(user).sendMessage("commands.admin.info.no-island"); } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.AdminInfoCommand#execute(User, String, List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.AdminInfoCommand#execute(User, String, List)}. */ @Test public void testExecuteSuccessUserOnIsland() { when(user.isPlayer()).thenReturn(true); AdminInfoCommand itl = new AdminInfoCommand(ac); Location loc = mock(Location.class); - + // Island has owner Island is = mock(Island.class); when(is.getOwner()).thenReturn(uuid); @@ -204,8 +205,8 @@ public class AdminInfoCommandTest { Optional opi = Optional.of(is); when(im.getIslandAt(Mockito.any())).thenReturn(opi); when(user.getLocation()).thenReturn(loc); - - + + assertTrue(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Confirm other verifications Mockito.verify(is).showInfo(Mockito.eq(plugin), Mockito.eq(user), Mockito.any()); diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/AdminRegisterCommandTest.java similarity index 77% rename from src/test/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/AdminRegisterCommandTest.java index 8f3a22ead..0d43fc890 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminRegisterCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/AdminRegisterCommandTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -13,7 +13,6 @@ import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.util.Vector; @@ -26,16 +25,16 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** @@ -43,10 +42,10 @@ import us.tastybento.bskyblock.managers.PlayersManager; * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminRegisterCommandTest { - private AdminCommand ac; + private CompositeCommand ac; private UUID uuid; private User user; private IslandsManager im; @@ -59,8 +58,8 @@ public class AdminRegisterCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -69,7 +68,6 @@ public class AdminRegisterCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -88,17 +86,15 @@ public class AdminRegisterCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(plugin.getIWM()).thenReturn(iwm); - // Player has island to begin with + // Player has island to begin with im = mock(IslandsManager.class); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true); @@ -106,7 +102,7 @@ public class AdminRegisterCommandTest { when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid); when(plugin.getIslands()).thenReturn(im); - // Has team + // Has team pm = mock(PlayersManager.class); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); @@ -125,7 +121,7 @@ public class AdminRegisterCommandTest { /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminRegisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminRegisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoTarget() { @@ -135,7 +131,7 @@ public class AdminRegisterCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminRegisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminRegisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteUnknownPlayer() { @@ -147,7 +143,7 @@ public class AdminRegisterCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminRegisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminRegisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecutePlayerHasIsland() { @@ -159,9 +155,9 @@ public class AdminRegisterCommandTest { assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.player-has-island")); } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminRegisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminRegisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteInTeam() { @@ -173,9 +169,9 @@ public class AdminRegisterCommandTest { assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.register.cannot-register-team-player"); } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminRegisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminRegisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteAlreadyOwnedIsland() { @@ -184,7 +180,7 @@ public class AdminRegisterCommandTest { String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); Location loc = mock(Location.class); - + // Island has owner Island is = mock(Island.class); when(is.getOwner()).thenReturn(uuid); @@ -197,7 +193,7 @@ public class AdminRegisterCommandTest { } /** - * Test method for {@link us.us.tastybento.bskyblock.commands.admin.teams.AdminRegisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.world.bentobox.bbox.commands.admin.teams.AdminRegisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteSuccess() { diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/AdminUnregisterCommandTest.java similarity index 75% rename from src/test/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/AdminUnregisterCommandTest.java index ecdd540b4..e20265eb0 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/AdminUnregisterCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/AdminUnregisterCommandTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin; +package world.bentobox.bbox.commands.admin; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -12,7 +12,6 @@ import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.util.Vector; @@ -25,16 +24,16 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** @@ -42,10 +41,10 @@ import us.tastybento.bskyblock.managers.PlayersManager; * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminUnregisterCommandTest { - private AdminCommand ac; + private CompositeCommand ac; private User user; private IslandsManager im; private PlayersManager pm; @@ -57,8 +56,8 @@ public class AdminUnregisterCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -67,7 +66,6 @@ public class AdminUnregisterCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -86,17 +84,15 @@ public class AdminUnregisterCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(plugin.getIWM()).thenReturn(iwm); - // Player has island to begin with + // Player has island to begin with im = mock(IslandsManager.class); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true); @@ -104,7 +100,7 @@ public class AdminUnregisterCommandTest { when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid); when(plugin.getIslands()).thenReturn(im); - // Has team + // Has team pm = mock(PlayersManager.class); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); @@ -123,7 +119,7 @@ public class AdminUnregisterCommandTest { /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminUnregisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminUnregisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoTarget() { @@ -133,7 +129,7 @@ public class AdminUnregisterCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminUnregisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminUnregisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteUnknownPlayer() { @@ -145,7 +141,7 @@ public class AdminUnregisterCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminUnregisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminUnregisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecutePlayerNoIsland() { @@ -156,9 +152,9 @@ public class AdminUnregisterCommandTest { assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.player-has-no-island")); } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminUnregisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminUnregisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteInTeam() { @@ -171,7 +167,7 @@ public class AdminUnregisterCommandTest { } /** - * Test method for {@link us.us.tastybento.bskyblock.commands.admin.teams.AdminUnregisterCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link us.world.bentobox.bbox.commands.admin.teams.AdminUnregisterCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteSuccess() { diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeCommandTest.java similarity index 81% rename from src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeCommandTest.java index 2fb58a1b4..664492dc5 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeCommandTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin.range; +package world.bentobox.bbox.commands.admin.range; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -8,7 +8,6 @@ import java.util.HashMap; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; @@ -23,22 +22,22 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminRangeCommandTest { - private BSkyBlock plugin; - private AdminCommand ac; + private BentoBox plugin; + private CompositeCommand ac; private UUID uuid; private User user; private IslandsManager im; @@ -52,8 +51,8 @@ public class AdminRangeCommandTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -62,7 +61,6 @@ public class AdminRangeCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -81,13 +79,11 @@ public class AdminRangeCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock"); when(plugin.getIWM()).thenReturn(iwm); diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeDisplayCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeDisplayCommandTest.java similarity index 77% rename from src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeDisplayCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeDisplayCommandTest.java index c42d2c51a..7e0fc5322 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeDisplayCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeDisplayCommandTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.commands.admin.range; +package world.bentobox.bbox.commands.admin.range; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -11,7 +11,6 @@ import java.util.HashMap; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import org.junit.Before; @@ -25,26 +24,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminRangeDisplayCommandTest { - private BSkyBlock plugin; - private AdminCommand ac; + private BentoBox plugin; + private CompositeCommand ac; private UUID uuid; private User user; private IslandsManager im; @@ -58,8 +57,8 @@ public class AdminRangeDisplayCommandTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -68,7 +67,6 @@ public class AdminRangeDisplayCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -87,13 +85,11 @@ public class AdminRangeDisplayCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock"); when(plugin.getIWM()).thenReturn(iwm); @@ -130,7 +126,7 @@ public class AdminRangeDisplayCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeDisplayCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeDisplayCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecutePlayerDisplayArgs() { @@ -146,7 +142,7 @@ public class AdminRangeDisplayCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeDisplayCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeDisplayCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecutePlayeShowArgs() { @@ -163,7 +159,7 @@ public class AdminRangeDisplayCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeDisplayCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeDisplayCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecutePlayeHideArgs() { diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeResetCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeResetCommandTest.java similarity index 74% rename from src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeResetCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeResetCommandTest.java index 5c477e710..61426d420 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeResetCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeResetCommandTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.commands.admin.range; +package world.bentobox.bbox.commands.admin.range; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -12,7 +12,6 @@ import java.util.List; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; @@ -27,28 +26,28 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminRangeResetCommandTest { - private BSkyBlock plugin; - private AdminCommand ac; + private BentoBox plugin; + private CompositeCommand ac; private UUID uuid; private User user; private IslandsManager im; @@ -62,8 +61,8 @@ public class AdminRangeResetCommandTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -72,7 +71,6 @@ public class AdminRangeResetCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -91,13 +89,11 @@ public class AdminRangeResetCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock"); when(iwm.getIslandProtectionRange(Mockito.any())).thenReturn(200); when(plugin.getIWM()).thenReturn(iwm); @@ -140,7 +136,7 @@ public class AdminRangeResetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeResetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeResetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteConsoleNoArgs() { @@ -153,7 +149,7 @@ public class AdminRangeResetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeResetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeResetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecutePlayerNoArgs() { @@ -165,7 +161,7 @@ public class AdminRangeResetCommandTest { /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeResetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeResetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteUnknownPlayer() { @@ -177,7 +173,7 @@ public class AdminRangeResetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeResetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeResetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteKnownPlayerNoIsland() { @@ -191,7 +187,7 @@ public class AdminRangeResetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeResetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeResetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteKnownPlayer() { diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeSetCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeSetCommandTest.java similarity index 74% rename from src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeSetCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeSetCommandTest.java index 1fa40c15d..477389815 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/range/AdminRangeSetCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/range/AdminRangeSetCommandTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.commands.admin.range; +package world.bentobox.bbox.commands.admin.range; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -12,7 +12,6 @@ import java.util.List; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; @@ -27,28 +26,28 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminRangeSetCommandTest { - private BSkyBlock plugin; - private AdminCommand ac; + private BentoBox plugin; + private CompositeCommand ac; private UUID uuid; private User user; private IslandsManager im; @@ -62,8 +61,8 @@ public class AdminRangeSetCommandTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -72,7 +71,6 @@ public class AdminRangeSetCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -91,13 +89,11 @@ public class AdminRangeSetCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock"); when(iwm.getIslandProtectionRange(Mockito.any())).thenReturn(200); when(plugin.getIWM()).thenReturn(iwm); @@ -142,7 +138,7 @@ public class AdminRangeSetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteConsoleNoArgs() { @@ -155,7 +151,7 @@ public class AdminRangeSetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecutePlayerNoArgs() { @@ -167,7 +163,7 @@ public class AdminRangeSetCommandTest { /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteUnknownPlayer() { @@ -180,7 +176,7 @@ public class AdminRangeSetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteKnownPlayerNoIsland() { @@ -195,7 +191,7 @@ public class AdminRangeSetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteTooHigh() { @@ -209,7 +205,7 @@ public class AdminRangeSetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteNotANumber() { @@ -223,7 +219,7 @@ public class AdminRangeSetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteDoubleNumber() { @@ -237,7 +233,7 @@ public class AdminRangeSetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteZero() { @@ -251,7 +247,7 @@ public class AdminRangeSetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteNegNumber() { @@ -265,7 +261,7 @@ public class AdminRangeSetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecuteSame() { @@ -279,7 +275,7 @@ public class AdminRangeSetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.range.AdminRangeSetCommand#execute(us.tastybento.bskyblock.api.user.User, java.lang.String, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.range.AdminRangeSetCommand#execute(world.bentobox.bbox.api.user.User, java.lang.String, java.util.List)}. */ @Test public void testExecute() { diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamAddCommandTest.java similarity index 86% rename from src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamAddCommandTest.java index a3a6c7733..437ba08f3 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamAddCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamAddCommandTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.commands.admin.team; +package world.bentobox.bbox.commands.admin.team; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -12,7 +12,6 @@ import java.util.List; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import org.junit.Before; @@ -24,27 +23,27 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminTeamAddCommandTest { - private BSkyBlock plugin; - private AdminCommand ac; + private BentoBox plugin; + private CompositeCommand ac; private UUID uuid; private User user; private IslandsManager im; @@ -57,8 +56,8 @@ public class AdminTeamAddCommandTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -67,7 +66,6 @@ public class AdminTeamAddCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -86,11 +84,11 @@ public class AdminTeamAddCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); when(ac.getTopLabel()).thenReturn("bsb"); - // Player has island to begin with + // Player has island to begin with im = mock(IslandsManager.class); when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); @@ -98,10 +96,10 @@ public class AdminTeamAddCommandTest { when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid); when(plugin.getIslands()).thenReturn(im); - // Has team + // Has team pm = mock(PlayersManager.class); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); - + when(plugin.getPlayers()).thenReturn(pm); // Server & Scheduler @@ -113,11 +111,9 @@ public class AdminTeamAddCommandTest { LocalesManager lm = mock(LocalesManager.class); when(lm.get(Mockito.any(), Mockito.any())).thenReturn("mock translation"); when(plugin.getLocalesManager()).thenReturn(lm); - + // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock"); when(plugin.getIWM()).thenReturn(iwm); } @@ -134,13 +130,13 @@ public class AdminTeamAddCommandTest { // Show help args.add("arg1"); assertFalse(itl.execute(user, itl.getLabel(), args)); - // Show help + // Show help args.add("args2"); args.add("args3"); assertFalse(itl.execute(user, itl.getLabel(), args)); - // Show help + // Show help } - + /** * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @@ -148,20 +144,20 @@ public class AdminTeamAddCommandTest { public void testExecuteUnknownPlayer() { AdminTeamAddCommand itl = new AdminTeamAddCommand(ac); String[] name = {"tastybento", "poslovich"}; - + // Unknown leader when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(null); when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID); assertFalse(itl.execute(user, ac.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("general.errors.unknown-player-name", "[name]", "tastybento"); - + // Unknown target when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid); when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(null); assertFalse(itl.execute(user, ac.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("general.errors.unknown-player-name", "[name]", "poslovich"); } - + /** * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @@ -169,17 +165,17 @@ public class AdminTeamAddCommandTest { public void testExecuteTargetTargetInTeam() { AdminTeamAddCommand itl = new AdminTeamAddCommand(ac); String[] name = {"tastybento", "poslovich"}; - + when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid); when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID); - + when(im.inTeam(Mockito.any(), Mockito.eq(notUUID))).thenReturn(true); - + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("commands.island.team.invite.errors.already-on-team")); } - + /** * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @@ -187,18 +183,18 @@ public class AdminTeamAddCommandTest { public void testExecuteAddNoIsland() { AdminTeamAddCommand itl = new AdminTeamAddCommand(ac); String[] name = {"tastybento", "poslovich"}; - + when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid); when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID); - + // No island, when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(false); - + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("general.errors.player-has-no-island"); - + } - + /** * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @@ -206,24 +202,24 @@ public class AdminTeamAddCommandTest { public void testExecuteAddNotLeader() { AdminTeamAddCommand itl = new AdminTeamAddCommand(ac); String[] name = {"tastybento", "poslovich"}; - + when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid); when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID); - + // Has island, has team, but not a leader when(im.hasIsland(Mockito.any(),Mockito.eq(uuid))).thenReturn(true); when(im.inTeam(Mockito.any(),Mockito.eq(uuid))).thenReturn(true); when(im.getTeamLeader(Mockito.any(),Mockito.eq(uuid))).thenReturn(notUUID); - + // Island Island island = mock(Island.class); when(im.getIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(island); - + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.team.add.name-not-leader", "[name]", "tastybento"); Mockito.verify(island).showMembers(Mockito.eq(plugin), Mockito.any(), Mockito.any()); } - + /** * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @@ -231,23 +227,23 @@ public class AdminTeamAddCommandTest { public void testExecuteAddTargetHasIsland() { AdminTeamAddCommand itl = new AdminTeamAddCommand(ac); String[] name = {"tastybento", "poslovich"}; - + when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid); when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID); - + // Has island, has team, is leader when(im.hasIsland(Mockito.any(),Mockito.eq(uuid))).thenReturn(true); when(im.inTeam(Mockito.any(),Mockito.eq(uuid))).thenReturn(true); when(im.getTeamLeader(Mockito.any(), Mockito.eq(uuid))).thenReturn(uuid); - + // Target has island when(im.hasIsland(Mockito.any(), Mockito.eq(notUUID))).thenReturn(true); - + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.team.add.name-has-island", "[name]", "poslovich"); - + } - + /** * Test method for {@link AdminTeamAddCommand#execute(User, String, List)}. */ @@ -255,40 +251,40 @@ public class AdminTeamAddCommandTest { public void testExecuteAddTargetHasIslandNoTeam() { AdminTeamAddCommand itl = new AdminTeamAddCommand(ac); String[] name = {"tastybento", "poslovich"}; - + when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid); when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID); - + // Has island, no team when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(false); - + // Target has island when(im.hasIsland(Mockito.any(), Mockito.eq(notUUID))).thenReturn(true); - + assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.team.add.name-has-island", "[name]", "poslovich"); - + } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminTeamAddCommand#execute(User, String, List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminTeamAddCommand#execute(User, String, List)}. */ @Test public void testExecuteSuccess() { AdminTeamAddCommand itl = new AdminTeamAddCommand(ac); - String[] name = {"tastybento", "poslovich"}; - + String[] name = {"tastybento", "poslovich"}; + when(pm.getUUID(Mockito.eq("tastybento"))).thenReturn(uuid); when(pm.getUUID(Mockito.eq("poslovich"))).thenReturn(notUUID); - + // Has island, no team when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(false); - + // Target has no island when(im.hasIsland(Mockito.any(), Mockito.eq(notUUID))).thenReturn(false); - + // Island Island island = mock(Island.class); when(im.getIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(island); @@ -297,11 +293,11 @@ public class AdminTeamAddCommandTest { when(pm.getName(Mockito.eq(uuid))).thenReturn("tastybento"); when(pm.getName(Mockito.eq(notUUID))).thenReturn("poslovich"); when(plugin.getPlayers()).thenReturn(pm); - + // Success assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(island).addMember(notUUID); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); } - + } diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamDisbandCommandTest.java similarity index 83% rename from src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamDisbandCommandTest.java index 163700642..ba61c8a47 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamDisbandCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamDisbandCommandTest.java @@ -1,14 +1,19 @@ -package us.tastybento.bskyblock.commands.admin.team; +package world.bentobox.bbox.commands.admin.team; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import org.junit.Before; @@ -20,26 +25,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminTeamDisbandCommandTest { - private AdminCommand ac; + private CompositeCommand ac; private UUID uuid; private User user; private IslandsManager im; @@ -52,8 +57,8 @@ public class AdminTeamDisbandCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -62,7 +67,6 @@ public class AdminTeamDisbandCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -81,17 +85,15 @@ public class AdminTeamDisbandCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); - + // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(plugin.getIWM()).thenReturn(iwm); - // Player has island to begin with + // Player has island to begin with im = mock(IslandsManager.class); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true); @@ -99,10 +101,10 @@ public class AdminTeamDisbandCommandTest { when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid); when(plugin.getIslands()).thenReturn(im); - // Has team + // Has team pm = mock(PlayersManager.class); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); - + when(plugin.getPlayers()).thenReturn(pm); // Server & Scheduler @@ -125,7 +127,7 @@ public class AdminTeamDisbandCommandTest { AdminTeamDisbandCommand itl = new AdminTeamDisbandCommand(ac); assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); } - + /** * Test method for {@link AdminTeamDisbandCommand#execute(User, String, List)}. */ @@ -137,7 +139,7 @@ public class AdminTeamDisbandCommandTest { assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } - + /** * Test method for {@link AdminTeamDisbandCommand#execute(User, String, List)}. */ @@ -161,17 +163,17 @@ public class AdminTeamDisbandCommandTest { when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); - + when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid); when(pm.getName(Mockito.any())).thenReturn("leader"); - + AdminTeamDisbandCommand itl = new AdminTeamDisbandCommand(ac); assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.team.disband.use-disband-leader", "[leader]", "leader"); } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminTeamDisbandCommand#execute(User, String, List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminTeamDisbandCommand#execute(User, String, List)}. */ @Test public void testExecuteSuccess() { @@ -187,12 +189,12 @@ public class AdminTeamDisbandCommandTest { members.add(uuid); members.add(notUUID); when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(members); - + AdminTeamDisbandCommand itl = new AdminTeamDisbandCommand(ac); assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(im, Mockito.never()).setLeaveTeam(Mockito.any(), Mockito.eq(notUUID)); Mockito.verify(im).setLeaveTeam(Mockito.any(), Mockito.eq(uuid)); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); } - + } diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamKickCommandTest.java similarity index 82% rename from src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamKickCommandTest.java index bea3bfa3f..5277cfcc7 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamKickCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamKickCommandTest.java @@ -1,17 +1,21 @@ /** - * + * */ -package us.tastybento.bskyblock.commands.admin.team; +package world.bentobox.bbox.commands.admin.team; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import org.junit.Before; @@ -23,27 +27,27 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminTeamKickCommandTest { - - private BSkyBlock plugin; - private AdminCommand ac; + + private BentoBox plugin; + private CompositeCommand ac; private UUID uuid; private User user; private IslandsManager im; @@ -56,8 +60,8 @@ public class AdminTeamKickCommandTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -66,7 +70,6 @@ public class AdminTeamKickCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -85,17 +88,15 @@ public class AdminTeamKickCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(plugin.getIWM()).thenReturn(iwm); - // Player has island to begin with + // Player has island to begin with im = mock(IslandsManager.class); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true); @@ -103,10 +104,10 @@ public class AdminTeamKickCommandTest { when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid); when(plugin.getIslands()).thenReturn(im); - // Has team + // Has team pm = mock(PlayersManager.class); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); - + when(plugin.getPlayers()).thenReturn(pm); // Server & Scheduler @@ -130,7 +131,7 @@ public class AdminTeamKickCommandTest { assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Show help } - + /** * Test method for {@link AdminTeamKickCommand#execute(User, String, List)}. */ @@ -142,7 +143,7 @@ public class AdminTeamKickCommandTest { assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } - + /** * Test method for {@link AdminTeamKickCommand#execute(User, String, List)}. */ @@ -166,17 +167,17 @@ public class AdminTeamKickCommandTest { when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); - + when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID); - + AdminTeamKickCommand itl = new AdminTeamKickCommand(ac); assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("commands.admin.team.kick.cannot-kick-leader")); Mockito.verify(is).showMembers(Mockito.any(), Mockito.any(), Mockito.any()); } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminTeamKickCommand#execute(User, String, List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminTeamKickCommand#execute(User, String, List)}. */ @Test public void testExecute() { @@ -185,9 +186,9 @@ public class AdminTeamKickCommandTest { when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); - + when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(uuid); - + AdminTeamKickCommand itl = new AdminTeamKickCommand(ac); assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(im).removePlayer(Mockito.any(), Mockito.eq(notUUID)); diff --git a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommandTest.java b/src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamMakeLeaderCommandTest.java similarity index 83% rename from src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamMakeLeaderCommandTest.java index 3eb174408..260b957e3 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/admin/team/AdminTeamMakeLeaderCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/admin/team/AdminTeamMakeLeaderCommandTest.java @@ -1,14 +1,19 @@ -package us.tastybento.bskyblock.commands.admin.team; +package world.bentobox.bbox.commands.admin.team; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitScheduler; import org.junit.Before; @@ -20,26 +25,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.AdminCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class AdminTeamMakeLeaderCommandTest { - private AdminCommand ac; + private CompositeCommand ac; private UUID uuid; private User user; private IslandsManager im; @@ -52,8 +57,8 @@ public class AdminTeamMakeLeaderCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -62,7 +67,6 @@ public class AdminTeamMakeLeaderCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -81,17 +85,15 @@ public class AdminTeamMakeLeaderCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ac = mock(AdminCommand.class); + ac = mock(CompositeCommand.class); when(ac.getSubCommandAliases()).thenReturn(new HashMap<>()); // Island World Manager IslandWorldManager iwm = mock(IslandWorldManager.class); - World world = mock(World.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); when(plugin.getIWM()).thenReturn(iwm); - // Player has island to begin with + // Player has island to begin with im = mock(IslandsManager.class); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); when(im.hasIsland(Mockito.any(), Mockito.any(User.class))).thenReturn(true); @@ -99,10 +101,10 @@ public class AdminTeamMakeLeaderCommandTest { when(im.getTeamLeader(Mockito.any(),Mockito.any())).thenReturn(uuid); when(plugin.getIslands()).thenReturn(im); - // Has team + // Has team pm = mock(PlayersManager.class); when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); - + when(plugin.getPlayers()).thenReturn(pm); // Server & Scheduler @@ -126,7 +128,7 @@ public class AdminTeamMakeLeaderCommandTest { assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Show help } - + /** * Test method for {@link AdminTeamMakeLeaderCommand#execute(User, String, List)}. */ @@ -138,7 +140,7 @@ public class AdminTeamMakeLeaderCommandTest { assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } - + /** * Test method for {@link AdminTeamMakeLeaderCommand#execute(User, String, List)}. */ @@ -162,16 +164,16 @@ public class AdminTeamMakeLeaderCommandTest { when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(is); String[] name = {"tastybento"}; when(pm.getUUID(Mockito.any())).thenReturn(notUUID); - + when(im.getTeamLeader(Mockito.any(), Mockito.eq(notUUID))).thenReturn(notUUID); - + AdminTeamMakeLeaderCommand itl = new AdminTeamMakeLeaderCommand(ac); assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage("commands.admin.team.makeleader.already-leader"); } - + /** - * Test method for {@link us.tastybento.bskyblock.commands.admin.team.AdminTeamMakeLeaderCommand#execute(User, String, List)}. + * Test method for {@link world.bentobox.bbox.commands.admin.team.AdminTeamMakeLeaderCommand#execute(User, String, List)}. */ @Test public void testExecuteSuccess() { @@ -188,12 +190,12 @@ public class AdminTeamMakeLeaderCommandTest { members.add(uuid); members.add(notUUID); when(im.getMembers(Mockito.any(), Mockito.any())).thenReturn(members); - + AdminTeamMakeLeaderCommand itl = new AdminTeamMakeLeaderCommand(ac); assertTrue(itl.execute(user, itl.getLabel(), Arrays.asList(name))); // Add other verifications Mockito.verify(im).makeLeader(Mockito.any(), Mockito.eq(user), Mockito.eq(notUUID), Mockito.any()); Mockito.verify(user).sendMessage(Mockito.eq("general.success")); } - + } diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanCommandTest.java b/src/test/java/world/bentobox/bbox/commands/island/IslandBanCommandTest.java similarity index 92% rename from src/test/java/us/tastybento/bskyblock/commands/island/IslandBanCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/island/IslandBanCommandTest.java index dd53d4133..e7a329978 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/island/IslandBanCommandTest.java @@ -1,7 +1,7 @@ /** - * + * */ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -34,26 +34,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.IslandCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class IslandBanCommandTest { - private IslandCommand ic; + private CompositeCommand ic; private UUID uuid; private User user; private IslandsManager im; @@ -66,8 +66,8 @@ public class IslandBanCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -76,7 +76,6 @@ public class IslandBanCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); when(plugin.getSettings()).thenReturn(s); // Player @@ -90,7 +89,7 @@ public class IslandBanCommandTest { when(user.getName()).thenReturn("tastybento"); // Parent command has no aliases - ic = mock(IslandCommand.class); + ic = mock(CompositeCommand.class); when(ic.getSubCommandAliases()).thenReturn(new HashMap<>()); // No island for player to begin with (set it later in the tests) @@ -114,7 +113,7 @@ public class IslandBanCommandTest { when(island.getBanned()).thenReturn(new HashSet<>()); when(island.isBanned(Mockito.any())).thenReturn(false); when(im.getIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(island); - + // IWM friendly name IslandWorldManager iwm = mock(IslandWorldManager.class); when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock"); @@ -123,7 +122,7 @@ public class IslandBanCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandBanCommand#execute(User, String, List)}. + * Test method for {@link world.bentobox.bbox.commands.island.IslandBanCommand#execute(User, String, List)}. */ // Island ban command by itself @@ -145,7 +144,7 @@ public class IslandBanCommandTest { IslandBanCommand ibc = new IslandBanCommand(ic); assertFalse(ibc.execute(user, ibc.getLabel(), new ArrayList<>())); } - + @Test public void testNoIsland() { IslandBanCommand ibc = new IslandBanCommand(ic); @@ -230,17 +229,17 @@ public class IslandBanCommandTest { when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); when(im.isOwner(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); UUID targetUuid = UUID.randomUUID(); - when(pm.getUUID(Mockito.anyString())).thenReturn(targetUuid); + when(pm.getUUID(Mockito.anyString())).thenReturn(targetUuid); PowerMockito.mockStatic(User.class); User targetUser = mock(User.class); when(targetUser.isOp()).thenReturn(false); when(targetUser.isPlayer()).thenReturn(true); when(targetUser.isOnline()).thenReturn(false); when(User.getInstance(Mockito.any(UUID.class))).thenReturn(targetUser); - + // Allow adding to ban list when(island.addToBanList(Mockito.any())).thenReturn(true); - + assertTrue(ibc.execute(user, ibc.getLabel(), Arrays.asList("bill"))); Mockito.verify(user).sendMessage("general.success"); Mockito.verify(targetUser).sendMessage("commands.island.ban.owner-banned-you", TextVariables.NAME, user.getName()); @@ -266,7 +265,7 @@ public class IslandBanCommandTest { Mockito.verify(user).sendMessage("general.success"); Mockito.verify(targetUser).sendMessage("commands.island.ban.owner-banned-you", TextVariables.NAME, user.getName()); } - + @Test public void testCancelledBan() { IslandBanCommand ibc = new IslandBanCommand(ic); @@ -287,13 +286,13 @@ public class IslandBanCommandTest { Mockito.verify(user, Mockito.never()).sendMessage("general.success"); Mockito.verify(targetUser, Mockito.never()).sendMessage("commands.island.ban.owner-banned-you", "[owner]", user.getName()); } - + @Test public void testTabComplete() { - + String[] names = {"adam", "ben", "cara", "dave", "ed", "frank", "freddy", "george", "harry", "ian", "joe"}; Map online = new HashMap<>(); - + Set banned = new HashSet<>(); Set onlinePlayers = new HashSet<>(); for (int j = 0; j < names.length; j++) { @@ -308,14 +307,14 @@ public class IslandBanCommandTest { } onlinePlayers.add(p); } - + when(island.isBanned(Mockito.any(UUID.class))).thenAnswer(new Answer() { @Override public Boolean answer(InvocationOnMock invocation) throws Throwable { return banned.contains(invocation.getArgumentAt(0, UUID.class)); } - + }); // Create the names when(pm.getName(Mockito.any(UUID.class))).then(new Answer() { @@ -324,9 +323,9 @@ public class IslandBanCommandTest { public String answer(InvocationOnMock invocation) throws Throwable { return online.getOrDefault(invocation.getArgumentAt(0, UUID.class), "tastybento"); } - + }); - + // Return a set of online players PowerMockito.mockStatic(Bukkit.class); when(Bukkit.getOnlinePlayers()).then(new Answer>() { @@ -335,9 +334,9 @@ public class IslandBanCommandTest { public Set answer(InvocationOnMock invocation) throws Throwable { return onlinePlayers; } - + }); - + IslandBanCommand ibc = new IslandBanCommand(ic); // Set up the user User user = mock(User.class); @@ -354,11 +353,11 @@ public class IslandBanCommandTest { }); when(user.getPlayer()).thenReturn(player); - + // Get the tab-complete list with no argument Optional> result = ibc.tabComplete(user, "", new LinkedList<>()); assertFalse(result.isPresent()); - + // Get the tab-complete list with one argument LinkedList args = new LinkedList<>(); args.add(""); @@ -368,7 +367,7 @@ public class IslandBanCommandTest { // Compare the expected with the actual String[] expectedNames = {"dave", "ed", "frank", "freddy", "george", "harry", "joe"}; assertTrue(Arrays.equals(expectedNames, r.toArray())); - + // Get the tab-complete list with one letter argument args = new LinkedList<>(); args.add("d"); @@ -378,7 +377,7 @@ public class IslandBanCommandTest { // Compare the expected with the actual String[] expectedName = {"dave"}; assertTrue(Arrays.equals(expectedName, r.toArray())); - + // Get the tab-complete list with one letter argument args = new LinkedList<>(); args.add("fr"); diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommandTest.java b/src/test/java/world/bentobox/bbox/commands/island/IslandBanlistCommandTest.java similarity index 83% rename from src/test/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/island/IslandBanlistCommandTest.java index 5ffa26aa4..255b46a91 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/IslandBanlistCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/island/IslandBanlistCommandTest.java @@ -1,7 +1,7 @@ /** - * + * */ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -30,25 +30,25 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.IslandCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class IslandBanlistCommandTest { - private IslandCommand ic; + private CompositeCommand ic; private UUID uuid; private User user; private IslandsManager im; @@ -61,8 +61,8 @@ public class IslandBanlistCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -71,7 +71,7 @@ public class IslandBanlistCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); + when(plugin.getSettings()).thenReturn(s); // Player @@ -85,7 +85,7 @@ public class IslandBanlistCommandTest { when(user.getName()).thenReturn("tastybento"); // Parent command has no aliases - ic = mock(IslandCommand.class); + ic = mock(CompositeCommand.class); when(ic.getSubCommandAliases()).thenReturn(new HashMap<>()); when(ic.getTopLabel()).thenReturn("island"); @@ -119,7 +119,7 @@ public class IslandBanlistCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandBanlistCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.island.IslandBanlistCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testWithArgs() { @@ -148,7 +148,7 @@ public class IslandBanlistCommandTest { IslandBanlistCommand iubc = new IslandBanlistCommand(ic); when(im.hasIsland(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); // Make a ban list - String[] names = {"adam", "ben", "cara", "dave", "ed", "frank", "freddy", "george", "harry", "ian", "joe"}; + String[] names = {"adam", "ben", "cara", "dave", "ed", "frank", "freddy", "george", "harry", "ian", "joe"}; Set banned = new HashSet<>(); Map uuidToName = new HashMap<>(); for (int j = 0; j < names.length; j++) { @@ -165,7 +165,7 @@ public class IslandBanlistCommandTest { return uuidToName.getOrDefault(invocation.getArgumentAt(0, UUID.class), "tastybento"); } - }); + }); assertTrue(iubc.execute(user, iubc.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage("commands.island.banlist.the-following"); } diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/IslandGoCommandTest.java b/src/test/java/world/bentobox/bbox/commands/island/IslandGoCommandTest.java similarity index 76% rename from src/test/java/us/tastybento/bskyblock/commands/island/IslandGoCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/island/IslandGoCommandTest.java index b8867edc2..9baf1890a 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/IslandGoCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/island/IslandGoCommandTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -26,17 +26,17 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.IslandCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.util.Util; /** * Test for island go command @@ -44,9 +44,9 @@ import us.tastybento.bskyblock.util.Util; * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, Util.class}) +@PrepareForTest({Bukkit.class, BentoBox.class, Util.class}) public class IslandGoCommandTest { - private IslandCommand ic; + private CompositeCommand ic; private UUID uuid; private User user; private IslandsManager im; @@ -61,8 +61,8 @@ public class IslandGoCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -71,7 +71,7 @@ public class IslandGoCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); + when(plugin.getSettings()).thenReturn(s); // Player @@ -85,7 +85,7 @@ public class IslandGoCommandTest { when(user.getName()).thenReturn("tastybento"); // Parent command has no aliases - ic = mock(IslandCommand.class); + ic = mock(CompositeCommand.class); when(ic.getSubCommandAliases()).thenReturn(new HashMap<>()); when(ic.getTopLabel()).thenReturn("island"); @@ -123,7 +123,7 @@ public class IslandGoCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandGoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.island.IslandGoCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoArgsNoIsland() { @@ -135,7 +135,7 @@ public class IslandGoCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandGoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.island.IslandGoCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoArgs() { @@ -145,7 +145,7 @@ public class IslandGoCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandGoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.island.IslandGoCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoArgsMultipleHomes() { @@ -156,7 +156,7 @@ public class IslandGoCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandGoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.island.IslandGoCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteArgs1MultipleHomes() { @@ -169,7 +169,7 @@ public class IslandGoCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandGoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.island.IslandGoCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteArgs2MultipleHomes() { @@ -184,7 +184,7 @@ public class IslandGoCommandTest { /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandGoCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.island.IslandGoCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteArgsJunkMultipleHomes() { diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/IslandResetCommandTest.java b/src/test/java/world/bentobox/bbox/commands/island/IslandResetCommandTest.java similarity index 92% rename from src/test/java/us/tastybento/bskyblock/commands/island/IslandResetCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/island/IslandResetCommandTest.java index 276d2ebe7..ec2666c72 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/IslandResetCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/island/IslandResetCommandTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -27,26 +27,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.IslandCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.managers.island.NewIsland; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.managers.island.NewIsland; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, NewIsland.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, NewIsland.class }) public class IslandResetCommandTest { - private IslandCommand ic; + private CompositeCommand ic; private UUID uuid; private User user; private Settings s; @@ -61,8 +61,8 @@ public class IslandResetCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -71,7 +71,7 @@ public class IslandResetCommandTest { // Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); + when(plugin.getSettings()).thenReturn(s); // Player @@ -84,7 +84,7 @@ public class IslandResetCommandTest { when(user.getPlayer()).thenReturn(p); // Parent command has no aliases - ic = mock(IslandCommand.class); + ic = mock(CompositeCommand.class); when(ic.getSubCommandAliases()).thenReturn(new HashMap<>()); when(ic.getTopLabel()).thenReturn("island"); // World @@ -122,7 +122,7 @@ public class IslandResetCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandResetCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.island.IslandResetCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. * @throws IOException */ @Test diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommandTest.java b/src/test/java/world/bentobox/bbox/commands/island/IslandUnbanCommandTest.java similarity index 89% rename from src/test/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/island/IslandUnbanCommandTest.java index d4064d554..c924cc8aa 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/IslandUnbanCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/island/IslandUnbanCommandTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.commands.island; +package world.bentobox.bbox.commands.island; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -30,26 +30,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.localization.TextVariables; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.IslandCommand; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.localization.TextVariables; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class IslandUnbanCommandTest { - private IslandCommand ic; + private CompositeCommand ic; private UUID uuid; private User user; private IslandsManager im; @@ -62,8 +62,8 @@ public class IslandUnbanCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -72,7 +72,7 @@ public class IslandUnbanCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); + when(plugin.getSettings()).thenReturn(s); // Player @@ -86,7 +86,7 @@ public class IslandUnbanCommandTest { when(user.getName()).thenReturn("tastybento"); // Parent command has no aliases - ic = mock(IslandCommand.class); + ic = mock(CompositeCommand.class); when(ic.getSubCommandAliases()).thenReturn(new HashMap<>()); // No island for player to begin with (set it later in the tests) @@ -118,7 +118,7 @@ public class IslandUnbanCommandTest { } /** - * Test method for {@link us.tastybento.bskyblock.commands.island.IslandUnbanCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link world.bentobox.bbox.commands.island.IslandUnbanCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ // Island ban command by itself diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommandTest.java b/src/test/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteCommandTest.java similarity index 78% rename from src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteCommandTest.java index bba1e7eff..11c7b4f9a 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamInviteCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/island/team/IslandTeamInviteCommandTest.java @@ -1,7 +1,7 @@ /** - * + * */ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import static org.junit.Assert.assertFalse; import static org.mockito.Mockito.mock; @@ -24,25 +24,25 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.IslandCommand; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class IslandTeamInviteCommandTest { - private IslandCommand ic; + private CompositeCommand ic; private UUID uuid; private User user; private IslandsManager im; @@ -55,8 +55,8 @@ public class IslandTeamInviteCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -65,7 +65,7 @@ public class IslandTeamInviteCommandTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); + when(plugin.getSettings()).thenReturn(s); // Player @@ -84,19 +84,19 @@ public class IslandTeamInviteCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ic = mock(IslandCommand.class); + ic = mock(CompositeCommand.class); when(ic.getSubCommandAliases()).thenReturn(new HashMap<>()); - // Player has island to begin with + // Player has island to begin with im = mock(IslandsManager.class); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(true); when(im.isOwner(Mockito.any(), Mockito.any())).thenReturn(true); when(im.getTeamLeader(Mockito.any(), Mockito.any())).thenReturn(uuid); when(plugin.getIslands()).thenReturn(im); - // Has team + // Has team when(im.inTeam(Mockito.any(), Mockito.eq(uuid))).thenReturn(true); - + // Player Manager pm = mock(PlayersManager.class); @@ -111,7 +111,7 @@ public class IslandTeamInviteCommandTest { LocalesManager lm = mock(LocalesManager.class); when(lm.get(Mockito.any(), Mockito.any())).thenReturn("mock translation"); when(plugin.getLocalesManager()).thenReturn(lm); - + // IWM friendly name IslandWorldManager iwm = mock(IslandWorldManager.class); when(iwm.getFriendlyName(Mockito.any())).thenReturn("BSkyBlock"); @@ -119,7 +119,7 @@ public class IslandTeamInviteCommandTest { } /** - * Test method for {@link IslandTeamInviteCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamInviteCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoIsland() { @@ -128,9 +128,9 @@ public class IslandTeamInviteCommandTest { assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.no-island")); } - + /** - * Test method for {@link IslandTeamInviteCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamInviteCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNotTeamLeader() { @@ -139,9 +139,9 @@ public class IslandTeamInviteCommandTest { assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.not-leader")); } - + /** - * Test method for {@link IslandTeamInviteCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamInviteCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoTarget() { @@ -149,9 +149,9 @@ public class IslandTeamInviteCommandTest { assertFalse(itl.execute(user, itl.getLabel(), new ArrayList<>())); // Show help } - + /** - * Test method for {@link IslandTeamInviteCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamInviteCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteUnknownPlayer() { @@ -161,10 +161,10 @@ public class IslandTeamInviteCommandTest { assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("general.errors.unknown-player")); } - - + + /** - * Test method for {@link IslandTeamInviteCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamInviteCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteOfflinePlayer() { @@ -179,7 +179,7 @@ public class IslandTeamInviteCommandTest { } /** - * Test method for {@link IslandTeamInviteCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamInviteCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteSamePlayer() { @@ -192,10 +192,10 @@ public class IslandTeamInviteCommandTest { assertFalse(itl.execute(user, itl.getLabel(), Arrays.asList(name))); Mockito.verify(user).sendMessage(Mockito.eq("commands.island.team.invite.cannot-invite-self")); } - - + + /** - * Test method for {@link IslandTeamInviteCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamInviteCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteDifferentPlayerInTeam() { diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommandTest.java b/src/test/java/world/bentobox/bbox/commands/island/team/IslandTeamKickCommandTest.java similarity index 81% rename from src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/island/team/IslandTeamKickCommandTest.java index c47da8458..405d036ca 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamKickCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/island/team/IslandTeamKickCommandTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -29,25 +29,25 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.IslandCommand; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class IslandTeamKickCommandTest { - private IslandCommand ic; + private CompositeCommand ic; private UUID uuid; private User user; private Settings s; @@ -63,8 +63,8 @@ public class IslandTeamKickCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -73,7 +73,7 @@ public class IslandTeamKickCommandTest { // Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); + when(plugin.getSettings()).thenReturn(s); // Player @@ -92,7 +92,7 @@ public class IslandTeamKickCommandTest { User.setPlugin(plugin); // Parent command has no aliases - ic = mock(IslandCommand.class); + ic = mock(CompositeCommand.class); when(ic.getSubCommandAliases()).thenReturn(new HashMap<>()); // Player has island to begin with @@ -125,7 +125,7 @@ public class IslandTeamKickCommandTest { } /** - * Test method for {@link IslandTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamKickCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoTeam() { @@ -136,7 +136,7 @@ public class IslandTeamKickCommandTest { } /** - * Test method for {@link IslandTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamKickCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNotTeamLeader() { @@ -147,7 +147,7 @@ public class IslandTeamKickCommandTest { } /** - * Test method for {@link IslandTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamKickCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoTarget() { @@ -157,7 +157,7 @@ public class IslandTeamKickCommandTest { } /** - * Test method for {@link IslandTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamKickCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteUnknownPlayer() { @@ -169,7 +169,7 @@ public class IslandTeamKickCommandTest { } /** - * Test method for {@link IslandTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamKickCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteSamePlayer() { @@ -182,7 +182,7 @@ public class IslandTeamKickCommandTest { /** - * Test method for {@link IslandTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamKickCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteDifferentPlayerNotInTeam() { @@ -195,7 +195,7 @@ public class IslandTeamKickCommandTest { } /** - * Test method for {@link IslandTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamKickCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoConfirmation() { @@ -215,7 +215,7 @@ public class IslandTeamKickCommandTest { } /** - * Test method for {@link IslandTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamKickCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteWithConfirmation() { @@ -235,7 +235,7 @@ public class IslandTeamKickCommandTest { } /** - * Test method for {@link IslandTeamKickCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamKickCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteTestResets() { diff --git a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommandTest.java b/src/test/java/world/bentobox/bbox/commands/island/team/IslandTeamLeaveCommandTest.java similarity index 82% rename from src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommandTest.java rename to src/test/java/world/bentobox/bbox/commands/island/team/IslandTeamLeaveCommandTest.java index b5df3c960..ae4435702 100644 --- a/src/test/java/us/tastybento/bskyblock/commands/island/team/IslandTeamLeaveCommandTest.java +++ b/src/test/java/world/bentobox/bbox/commands/island/team/IslandTeamLeaveCommandTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.commands.island.team; +package world.bentobox.bbox.commands.island.team; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -26,24 +26,24 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.commands.IslandCommand; -import us.tastybento.bskyblock.managers.CommandsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.commands.CompositeCommand; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.CommandsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.PlayersManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class IslandTeamLeaveCommandTest { - private IslandCommand ic; + private CompositeCommand ic; private UUID uuid; private User user; private Settings s; @@ -57,8 +57,8 @@ public class IslandTeamLeaveCommandTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -67,7 +67,7 @@ public class IslandTeamLeaveCommandTest { // Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); + when(plugin.getSettings()).thenReturn(s); // Player @@ -81,7 +81,7 @@ public class IslandTeamLeaveCommandTest { when(user.getName()).thenReturn("tastybento"); // Parent command has no aliases - ic = mock(IslandCommand.class); + ic = mock(CompositeCommand.class); when(ic.getSubCommandAliases()).thenReturn(new HashMap<>()); // Player has island to begin with @@ -106,7 +106,7 @@ public class IslandTeamLeaveCommandTest { } /** - * Test method for {@link IslandTeamLeaveCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamLeaveCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoTeam() { @@ -117,7 +117,7 @@ public class IslandTeamLeaveCommandTest { } /** - * Test method for {@link IslandTeamLeaveCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamLeaveCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteInTeamLeader() { @@ -127,7 +127,7 @@ public class IslandTeamLeaveCommandTest { } /** - * Test method for {@link IslandTeamLeaveCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamLeaveCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteNoConfirmation() { @@ -144,7 +144,7 @@ public class IslandTeamLeaveCommandTest { } /** - * Test method for {@link IslandTeamLeaveCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamLeaveCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteWithConfirmation() { @@ -163,7 +163,7 @@ public class IslandTeamLeaveCommandTest { } /** - * Test method for {@link IslandTeamLeaveCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)}. + * Test method for {@link IslandTeamLeaveCommand#execute(world.bentobox.bbox.api.user.User, java.util.List)}. */ @Test public void testExecuteTestResets() { diff --git a/src/test/java/us/tastybento/bskyblock/database/mysql/MySQLDatabaseHandlerTest.java b/src/test/java/world/bentobox/bbox/database/mysql/MySQLDatabaseHandlerTest.java similarity index 84% rename from src/test/java/us/tastybento/bskyblock/database/mysql/MySQLDatabaseHandlerTest.java rename to src/test/java/world/bentobox/bbox/database/mysql/MySQLDatabaseHandlerTest.java index 2e507c820..b0c86b004 100644 --- a/src/test/java/us/tastybento/bskyblock/database/mysql/MySQLDatabaseHandlerTest.java +++ b/src/test/java/world/bentobox/bbox/database/mysql/MySQLDatabaseHandlerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.mysql; +package world.bentobox.bbox.database.mysql; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -29,16 +29,17 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.database.objects.Players; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.database.objects.Players; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest( { BSkyBlock.class, Util.class }) +@PrepareForTest( { BentoBox.class, Util.class }) public class MySQLDatabaseHandlerTest { private static MySQLDatabaseHandler handler; @@ -47,7 +48,8 @@ public class MySQLDatabaseHandlerTest { private static MySQLDatabaseConnecter dbConn; private static World world; @Mock - static BSkyBlock plugin = mock(BSkyBlock.class); + static BentoBox plugin = mock(BentoBox.class); + private static IslandWorldManager iwm; @BeforeClass @@ -68,12 +70,15 @@ public class MySQLDatabaseHandlerTest { when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger()); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); Settings settings = mock(Settings.class); when(plugin.getSettings()).thenReturn(settings); - when(settings.getDeathsMax()).thenReturn(10); + + iwm = mock(IslandWorldManager.class); + when(iwm.getDeathsMax(Mockito.any())).thenReturn(10); + when(plugin.getIWM()).thenReturn(iwm); when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger()); dbConn = mock(MySQLDatabaseConnecter.class); @@ -98,13 +103,13 @@ public class MySQLDatabaseHandlerTest { @Test public void testSaveObject() { handler.saveObject(instance); - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); Settings settings = mock(Settings.class); when(plugin.getSettings()).thenReturn(settings); - when(settings.getDeathsMax()).thenReturn(10); + when(iwm.getDeathsMax(Mockito.any())).thenReturn(10); Players players = new Players(); players.setUniqueId(UUID.randomUUID().toString()); - players.setDeaths(23); + players.setDeaths(world, 23); Location location = mock(Location.class); Mockito.when(location.getWorld()).thenReturn(world); Mockito.when(location.getBlockX()).thenReturn(0); diff --git a/src/test/java/us/tastybento/bskyblock/database/objects/NamesTest.java b/src/test/java/world/bentobox/bbox/database/objects/NamesTest.java similarity index 68% rename from src/test/java/us/tastybento/bskyblock/database/objects/NamesTest.java rename to src/test/java/world/bentobox/bbox/database/objects/NamesTest.java index 1e275c070..fedb8a5a8 100644 --- a/src/test/java/us/tastybento/bskyblock/database/objects/NamesTest.java +++ b/src/test/java/world/bentobox/bbox/database/objects/NamesTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.database.objects; +package world.bentobox.bbox.database.objects; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -11,6 +11,8 @@ import java.util.UUID; import org.junit.Test; +import world.bentobox.bbox.database.objects.Names; + /** * @author tastybento * @@ -18,7 +20,7 @@ import org.junit.Test; public class NamesTest { /** - * Test method for {@link us.tastybento.bskyblock.database.objects.Names#Names()}. + * Test method for {@link world.bentobox.bbox.database.objects.Names#Names()}. */ @Test public void testNames() { @@ -26,7 +28,7 @@ public class NamesTest { } /** - * Test method for {@link us.tastybento.bskyblock.database.objects.Names#Names(java.lang.String, java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.database.objects.Names#Names(java.lang.String, java.util.UUID)}. */ @Test public void testNamesStringUUID() { @@ -34,7 +36,7 @@ public class NamesTest { } /** - * Test method for {@link us.tastybento.bskyblock.database.objects.Names#getUniqueId()}. + * Test method for {@link world.bentobox.bbox.database.objects.Names#getUniqueId()}. */ @Test public void testGetUniqueId() { @@ -44,7 +46,7 @@ public class NamesTest { assertEquals("random", name.getUniqueId()); } /** - * Test method for {@link us.tastybento.bskyblock.database.objects.Names#getUuid()}. + * Test method for {@link world.bentobox.bbox.database.objects.Names#getUuid()}. */ @Test public void testGetUuid() { diff --git a/src/test/java/us/tastybento/bskyblock/database/objects/PlayersTest.java b/src/test/java/world/bentobox/bbox/database/objects/PlayersTest.java similarity index 64% rename from src/test/java/us/tastybento/bskyblock/database/objects/PlayersTest.java rename to src/test/java/world/bentobox/bbox/database/objects/PlayersTest.java index 2a2f7135a..5dab2f748 100644 --- a/src/test/java/us/tastybento/bskyblock/database/objects/PlayersTest.java +++ b/src/test/java/world/bentobox/bbox/database/objects/PlayersTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.database.objects; +package world.bentobox.bbox.database.objects; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; @@ -23,14 +23,15 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.managers.IslandWorldManager; @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class}) +@PrepareForTest({Bukkit.class, BentoBox.class}) public class PlayersTest { - - private Settings s; + + private IslandWorldManager s; /** * @throws java.lang.Exception @@ -38,13 +39,13 @@ public class PlayersTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); - s = mock(Settings.class); - when(s.getResetLimit()).thenReturn(3); - when(s.getDeathsMax()).thenReturn(3); - when(plugin.getSettings()).thenReturn(s); - + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); + s = mock(IslandWorldManager.class); + + when(s.getDeathsMax(Mockito.any())).thenReturn(3); + when(plugin.getIWM()).thenReturn(s); + Server server = mock(Server.class); PowerMockito.mockStatic(Bukkit.class); when(Bukkit.getServer()).thenReturn(server); @@ -53,8 +54,8 @@ public class PlayersTest { when(server.getOfflinePlayer(Mockito.any(UUID.class))).thenReturn(olp); } - - private BSkyBlock plugin; + + private BentoBox plugin; @Test public void testPlayersBSkyBlockUUID() { @@ -78,26 +79,30 @@ public class PlayersTest { @Test public void testDeaths() { Players p = new Players(plugin, UUID.randomUUID()); - assertTrue(p.getDeaths() == 0); - p.addDeath(); - assertTrue(p.getDeaths() == 1); - p.addDeath(); - assertTrue(p.getDeaths() == 2); - p.addDeath(); - assertTrue(p.getDeaths() == 3); - p.addDeath(); - assertTrue(p.getDeaths() == 3); - p.addDeath(); - assertTrue(p.getDeaths() == 3); - p.setDeaths(10); - assertTrue(p.getDeaths() == 3); - p.setDeaths(0); - assertTrue(p.getDeaths() == 0); + World world = mock(World.class); + when(world.getName()).thenReturn("world_name"); + assertTrue(p.getDeaths(world) == 0); + p.addDeath(world); + assertTrue(p.getDeaths(world) == 1); + p.addDeath(world); + assertTrue(p.getDeaths(world) == 2); + p.addDeath(world); + assertTrue(p.getDeaths(world) == 3); + p.addDeath(world); + assertTrue(p.getDeaths(world) == 3); + p.addDeath(world); + assertTrue(p.getDeaths(world) == 3); + p.setDeaths(world, 10); + assertTrue(p.getDeaths(world) == 3); + p.setDeaths(world, 0); + assertTrue(p.getDeaths(world) == 0); } @Test public void testInviteCoolDownTime() throws InterruptedException { - when(s.getInviteWait()).thenReturn(1); + Settings settings = mock(Settings.class); + when(settings.getInviteWait()).thenReturn(1); + when(plugin.getSettings()).thenReturn(settings); Players p = new Players(plugin, UUID.randomUUID()); // Check a null location assertTrue(p.getInviteCoolDownTime(null) == 0); @@ -106,7 +111,7 @@ public class PlayersTest { // Should be no cooldown assertTrue(p.getInviteCoolDownTime(l) == 0); // Start the timer - p.startInviteCoolDownTimer(l); + p.startInviteCoolDownTimer(l); // More than 0 cooldown assertTrue(p.getInviteCoolDownTime(l) > 0); } diff --git a/src/test/java/us/tastybento/bskyblock/listeners/BannedVisitorCommandsTest.java b/src/test/java/world/bentobox/bbox/listeners/BannedVisitorCommandsTest.java similarity index 92% rename from src/test/java/us/tastybento/bskyblock/listeners/BannedVisitorCommandsTest.java rename to src/test/java/world/bentobox/bbox/listeners/BannedVisitorCommandsTest.java index ec2a20518..4588a2ce3 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/BannedVisitorCommandsTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/BannedVisitorCommandsTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -29,28 +29,29 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.Notifier; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.Notifier; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.listeners.BannedVisitorCommands; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({BSkyBlock.class, Util.class, Bukkit.class }) +@PrepareForTest({BentoBox.class, Util.class, Bukkit.class }) public class BannedVisitorCommandsTest { private IslandWorldManager iwm; private Player player; - private BSkyBlock plugin; + private BentoBox plugin; private IslandsManager im; @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Island World Manager iwm = mock(IslandWorldManager.class); when(iwm.inWorld(Mockito.any())).thenReturn(true); diff --git a/src/test/java/us/tastybento/bskyblock/listeners/BlockEndDragonTest.java b/src/test/java/world/bentobox/bbox/listeners/BlockEndDragonTest.java similarity index 85% rename from src/test/java/us/tastybento/bskyblock/listeners/BlockEndDragonTest.java rename to src/test/java/world/bentobox/bbox/listeners/BlockEndDragonTest.java index 82a26d852..70c489f27 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/BlockEndDragonTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/BlockEndDragonTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -16,18 +16,19 @@ import org.mockito.Mockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.listeners.BlockEndDragon; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class, Util.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class, Util.class }) public class BlockEndDragonTest { @Test public void testBlockEndDragon() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); assertNotNull(new BlockEndDragon(plugin)); } @@ -36,7 +37,7 @@ public class BlockEndDragonTest { LivingEntity le = mock(LivingEntity.class); when(le.getType()).thenReturn(EntityType.AREA_EFFECT_CLOUD); CreatureSpawnEvent event = new CreatureSpawnEvent(le, null); - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); IslandWorldManager iwm = mock(IslandWorldManager.class); when(plugin.getIWM()).thenReturn(iwm); // allow dragon spawn @@ -51,7 +52,7 @@ public class BlockEndDragonTest { LivingEntity le = mock(LivingEntity.class); when(le.getType()).thenReturn(EntityType.AREA_EFFECT_CLOUD); CreatureSpawnEvent event = new CreatureSpawnEvent(le, null); - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); IslandWorldManager iwm = mock(IslandWorldManager.class); when(plugin.getIWM()).thenReturn(iwm); // allow dragon spawn @@ -66,7 +67,7 @@ public class BlockEndDragonTest { LivingEntity le = mock(LivingEntity.class); when(le.getType()).thenReturn(EntityType.ENDER_DRAGON); CreatureSpawnEvent event = new CreatureSpawnEvent(le, null); - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); IslandWorldManager iwm = mock(IslandWorldManager.class); when(plugin.getIWM()).thenReturn(iwm); // allow dragon spawn @@ -81,7 +82,7 @@ public class BlockEndDragonTest { LivingEntity le = mock(LivingEntity.class); when(le.getType()).thenReturn(EntityType.ENDER_DRAGON); CreatureSpawnEvent event = new CreatureSpawnEvent(le, null); - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); IslandWorldManager iwm = mock(IslandWorldManager.class); when(plugin.getIWM()).thenReturn(iwm); // allow dragon spawn diff --git a/src/test/java/us/tastybento/bskyblock/listeners/NetherPortalsTest.java b/src/test/java/world/bentobox/bbox/listeners/NetherPortalsTest.java similarity index 88% rename from src/test/java/us/tastybento/bskyblock/listeners/NetherPortalsTest.java rename to src/test/java/world/bentobox/bbox/listeners/NetherPortalsTest.java index 46e4f84e9..7d7d8b5dc 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/NetherPortalsTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/NetherPortalsTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -44,25 +44,25 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.util.Util; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class, Util.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class, Util.class }) public class NetherPortalsTest { - private BSkyBlock plugin; + private BentoBox plugin; private IslandsManager im; private PlayersManager pm; private IslandWorldManager iwm; @@ -76,8 +76,8 @@ public class NetherPortalsTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // island world mgr iwm = mock(IslandWorldManager.class); @@ -89,7 +89,7 @@ public class NetherPortalsTest { end = mock(World.class); when(end.getEnvironment()).thenReturn(Environment.THE_END); when(iwm.getEndWorld(Mockito.any())).thenReturn(end); - when(iwm.getBSBIslandWorld()).thenReturn(world); + when(iwm.getIslandWorld(Mockito.any())).thenReturn(world); when(iwm.getNetherWorld(Mockito.any())).thenReturn(nether); when(iwm.inWorld(any())).thenReturn(true); when(iwm.getNetherSpawnRadius(Mockito.any())).thenReturn(100); @@ -148,7 +148,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#NetherPortals(us.tastybento.bskyblock.BSkyBlock)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#NetherPortals(world.bentobox.bbox.BentoBox)}. */ @Test public void testNetherPortals() { @@ -156,7 +156,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onBlockBreak(org.bukkit.event.block.BlockBreakEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onBlockBreak(org.bukkit.event.block.BlockBreakEvent)}. */ @Test public void testOnBlockBreakNoAction() { @@ -192,7 +192,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onBlockBreak(org.bukkit.event.block.BlockBreakEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onBlockBreak(org.bukkit.event.block.BlockBreakEvent)}. */ @Test public void testOnBlockBreakActionAwayFromSpawn() { @@ -213,7 +213,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onBlockBreak(org.bukkit.event.block.BlockBreakEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onBlockBreak(org.bukkit.event.block.BlockBreakEvent)}. */ @Test public void testOnBlockBreakActionAtSpawn() { @@ -235,7 +235,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onBucketEmpty(org.bukkit.event.player.PlayerBucketEmptyEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onBucketEmpty(org.bukkit.event.player.PlayerBucketEmptyEvent)}. */ @Test public void testOnBucketEmpty() { @@ -257,7 +257,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onEndIslandPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onEndIslandPortal(org.bukkit.event.player.PlayerPortalEvent)}. */ @Test public void testOnEndIslandPortalNotEnd() { @@ -269,7 +269,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onEndIslandPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onEndIslandPortal(org.bukkit.event.player.PlayerPortalEvent)}. */ @Test public void testOnEndIslandPortalWrongWorld() { @@ -286,7 +286,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onEndIslandPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onEndIslandPortal(org.bukkit.event.player.PlayerPortalEvent)}. */ @Test public void testOnEndIslandPortalHome() { @@ -312,7 +312,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onEntityPortal(org.bukkit.event.entity.EntityPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onEntityPortal(org.bukkit.event.entity.EntityPortalEvent)}. */ @Test public void testOnEntityPortal() { @@ -333,7 +333,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. */ @Test public void testOnExplosionNotInWorld() { @@ -497,7 +497,7 @@ public class NetherPortalsTest { /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. */ @Test public void testOnNetherPortalNotPortal() { @@ -507,7 +507,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. */ @Test public void testOnNetherPortalWrongWorld() { @@ -520,7 +520,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. */ @Test public void testOnNetherPortalFromWorldToNetherIsland() { @@ -543,7 +543,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. */ @Test public void testOnNetherPortalFromWorldToNetherIslandWithSpawnDefined() { @@ -575,7 +575,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. */ @Test public void testOnNetherPortalFromWorldToNetherIslandWithNoSpawnDefined() { @@ -606,7 +606,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. */ @Test public void testOnNetherPortalFromWorldToNetherStandard() { @@ -628,7 +628,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. * @throws Exception */ @Test @@ -656,7 +656,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onNetherPortal(org.bukkit.event.player.PlayerPortalEvent)}. */ @Test public void testOnNetherPortalFromNetherIsland() { @@ -678,7 +678,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onPlayerBlockPlace(org.bukkit.event.block.BlockPlaceEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onPlayerBlockPlace(org.bukkit.event.block.BlockPlaceEvent)}. */ @Test public void testOnPlayerBlockPlace() { @@ -700,7 +700,7 @@ public class NetherPortalsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.NetherPortals#onTreeGrow(org.bukkit.event.world.StructureGrowEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.NetherPortals#onTreeGrow(org.bukkit.event.world.StructureGrowEvent)}. */ @Test public void testOnTreeGrow() { diff --git a/src/test/java/us/tastybento/bskyblock/listeners/ObsidianToLavaTest.java b/src/test/java/world/bentobox/bbox/listeners/ObsidianToLavaTest.java similarity index 92% rename from src/test/java/us/tastybento/bskyblock/listeners/ObsidianToLavaTest.java rename to src/test/java/world/bentobox/bbox/listeners/ObsidianToLavaTest.java index f76a20400..ce8a98cdc 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/ObsidianToLavaTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/ObsidianToLavaTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -30,12 +30,12 @@ import org.mockito.Mockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; @RunWith(PowerMockRunner.class) @PrepareForTest({PlayerEvent.class, PlayerInteractEvent.class}) @@ -45,7 +45,7 @@ public class ObsidianToLavaTest { @Test public void testObsidianToLava() { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); assertNotNull(new ObsidianToLava(plugin)); } @@ -71,7 +71,7 @@ public class ObsidianToLavaTest { Bukkit.setServer(server); // Mock plugin - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); // Create new object ObsidianToLava listener = new ObsidianToLava(plugin); @@ -97,7 +97,7 @@ public class ObsidianToLavaTest { // Worlds IslandWorldManager iwm = mock(IslandWorldManager.class); when(plugin.getIWM()).thenReturn(iwm); - when(iwm.getBSBIslandWorld()).thenReturn(world); + when(iwm.getIslandWorld(Mockito.any())).thenReturn(world); when(iwm.getNetherWorld(Mockito.any())).thenReturn(world); when(iwm.getEndWorld(Mockito.any())).thenReturn(world); @@ -187,7 +187,7 @@ public class ObsidianToLavaTest { } - private void testEvent(BSkyBlock plugin, Player who, Action action, ItemStack item, Block clickedBlock) { + private void testEvent(BentoBox plugin, Player who, Action action, ItemStack item, Block clickedBlock) { Block obsidianBlock = mock(Block.class); when(obsidianBlock.getType()).thenReturn(Material.OBSIDIAN); Block airBlock = mock(Block.class); diff --git a/src/test/java/us/tastybento/bskyblock/listeners/PanelListenerManagerTest.java b/src/test/java/world/bentobox/bbox/listeners/PanelListenerManagerTest.java similarity index 79% rename from src/test/java/us/tastybento/bskyblock/listeners/PanelListenerManagerTest.java rename to src/test/java/world/bentobox/bbox/listeners/PanelListenerManagerTest.java index 4180ce1ff..cbb429e39 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/PanelListenerManagerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/PanelListenerManagerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners; +package world.bentobox.bbox.listeners; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -32,14 +32,15 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler; -import us.tastybento.bskyblock.api.panels.PanelListener; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.panels.PanelListener; +import world.bentobox.bbox.api.panels.PanelItem.ClickHandler; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.listeners.PanelListenerManager; +import world.bentobox.bbox.util.Util; /** * Test class for PanelListenerManager.java @@ -47,7 +48,7 @@ import us.tastybento.bskyblock.util.Util; * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({BSkyBlock.class, Util.class, Bukkit.class }) +@PrepareForTest({BentoBox.class, Util.class, Bukkit.class }) public class PanelListenerManagerTest { private Player player; @@ -70,8 +71,8 @@ public class PanelListenerManagerTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Settings settings = mock(Settings.class); when(plugin.getSettings()).thenReturn(settings); @@ -120,7 +121,7 @@ public class PanelListenerManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}. */ @Test public void testOnInventoryClickOutside() { @@ -131,7 +132,7 @@ public class PanelListenerManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}. */ @Test public void testOnInventoryClickNoOpenPanels() { @@ -142,7 +143,7 @@ public class PanelListenerManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}. */ @Test public void testOnInventoryClickOpenPanelsWrongPanel() { @@ -155,7 +156,7 @@ public class PanelListenerManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}. */ @Test public void testOnInventoryClickOpenPanelsRightPanelWrongSlot() { @@ -168,7 +169,7 @@ public class PanelListenerManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.PanelListenerManager#onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent)}. */ @Test public void testOnInventoryClickOpenPanelsRightPanelRightSlot() { @@ -182,7 +183,7 @@ public class PanelListenerManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.PanelListenerManager#onInventoryClose(org.bukkit.event.inventory.InventoryCloseEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.PanelListenerManager#onInventoryClose(org.bukkit.event.inventory.InventoryCloseEvent)}. */ @Test public void testOnInventoryCloseNoPanels() { @@ -195,7 +196,7 @@ public class PanelListenerManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.PanelListenerManager#onInventoryClose(org.bukkit.event.inventory.InventoryCloseEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.PanelListenerManager#onInventoryClose(org.bukkit.event.inventory.InventoryCloseEvent)}. */ @Test public void testOnInventoryClosePanels() { @@ -209,7 +210,7 @@ public class PanelListenerManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.PanelListenerManager#onLogOut(org.bukkit.event.player.PlayerQuitEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.PanelListenerManager#onLogOut(org.bukkit.event.player.PlayerQuitEvent)}. */ @Test public void testOnLogOut() { @@ -230,7 +231,7 @@ public class PanelListenerManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.PanelListenerManager#getOpenPanels()}. + * Test method for {@link world.bentobox.bbox.listeners.PanelListenerManager#getOpenPanels()}. */ @Test public void testGetOpenPanels() { diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/ChestDamageListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/ChestDamageListenerTest.java similarity index 85% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/ChestDamageListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/ChestDamageListenerTest.java index 2254ecb0e..66ed1ec5e 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/ChestDamageListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/ChestDamageListenerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -46,29 +46,29 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.util.Util; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest( {BSkyBlock.class, Flags.class, Util.class} ) +@PrepareForTest( {BentoBox.class, Flags.class, Util.class} ) public class ChestDamageListenerTest { private static Location location; - private static BSkyBlock plugin; + private static BentoBox plugin; private static IslandWorldManager iwm; private static IslandsManager im; private static World world; @@ -76,8 +76,8 @@ public class ChestDamageListenerTest { @BeforeClass public static void setUpClass() { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); Server server = mock(Server.class); world = mock(World.class); @@ -110,9 +110,6 @@ public class ChestDamageListenerTest { // Worlds iwm = mock(IslandWorldManager.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(iwm.getBSBNetherWorld()).thenReturn(world); - when(iwm.getBSBEndWorld()).thenReturn(world); when(iwm.inWorld(any())).thenReturn(true); when(plugin.getIWM()).thenReturn(iwm); @@ -176,7 +173,7 @@ public class ChestDamageListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.ChestDamageListener#onExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.ChestDamageListener#onExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. */ @Test public void testOnExplosionChestDamageNotAllowed() { @@ -207,7 +204,7 @@ public class ChestDamageListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.ChestDamageListener#onExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.ChestDamageListener#onExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. */ @Test public void testOnExplosionChestDamageAllowed() { diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/CleanSuperFlatListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/CleanSuperFlatListenerTest.java similarity index 81% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/CleanSuperFlatListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/CleanSuperFlatListenerTest.java index 86b5d2d9d..800659d3a 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/CleanSuperFlatListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/CleanSuperFlatListenerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -26,25 +26,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.listeners.flags.CleanSuperFlatListener; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.util.Util; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, Util.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, Util.class }) public class CleanSuperFlatListenerTest { private World world; private Block block; private Chunk chunk; private IslandWorldManager iwm; - private BSkyBlock plugin; + private BentoBox plugin; /** * @throws java.lang.Exception @@ -53,8 +54,8 @@ public class CleanSuperFlatListenerTest { public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); when(plugin.isLoaded()).thenReturn(true); @@ -95,7 +96,7 @@ public class CleanSuperFlatListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. */ @Test public void testOnChunkLoadNotBedrockNoFlsg() { @@ -108,7 +109,7 @@ public class CleanSuperFlatListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. */ @Test public void testOnChunkLoadBedrock() { @@ -118,7 +119,7 @@ public class CleanSuperFlatListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. */ @Test public void testOnChunkLoadBedrockNoClean() { @@ -130,7 +131,7 @@ public class CleanSuperFlatListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. */ @Test public void testOnChunkLoadBedrockNether() { @@ -149,7 +150,7 @@ public class CleanSuperFlatListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.CleanSuperFlatListener#onChunkLoad(org.bukkit.event.world.ChunkLoadEvent)}. */ @Test public void testOnChunkLoadBedrockEnd() { diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/EnderChestListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/EnderChestListenerTest.java similarity index 93% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/EnderChestListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/EnderChestListenerTest.java index ad85ce706..95dcca9d6 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/EnderChestListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/EnderChestListenerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -38,18 +38,19 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.listeners.flags.EnderChestListener; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({BSkyBlock.class, Util.class, User.class }) +@PrepareForTest({BentoBox.class, Util.class, User.class }) public class EnderChestListenerTest { private Island island; @@ -63,8 +64,8 @@ public class EnderChestListenerTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // World world = mock(World.class); diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/EndermanListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/EndermanListenerTest.java similarity index 79% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/EndermanListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/EndermanListenerTest.java index a1614ba3d..e6711966d 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/EndermanListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/EndermanListenerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -40,15 +40,15 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.util.Util; /** * Tests enderman related listeners @@ -56,11 +56,11 @@ import us.tastybento.bskyblock.util.Util; * */ @RunWith(PowerMockRunner.class) -@PrepareForTest( {BSkyBlock.class, Flags.class, Util.class, Bukkit.class} ) +@PrepareForTest( {BentoBox.class, Flags.class, Util.class, Bukkit.class} ) public class EndermanListenerTest { private static Location location; - private static BSkyBlock plugin; + private static BentoBox plugin; private static IslandWorldManager iwm; private static IslandsManager im; private static World world; @@ -70,8 +70,8 @@ public class EndermanListenerTest { @Before public void setUp() { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); Server server = mock(Server.class); world = mock(World.class); @@ -105,9 +105,6 @@ public class EndermanListenerTest { // Worlds iwm = mock(IslandWorldManager.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(iwm.getBSBNetherWorld()).thenReturn(world); - when(iwm.getBSBEndWorld()).thenReturn(world); when(iwm.inWorld(any())).thenReturn(true); when(plugin.getIWM()).thenReturn(iwm); @@ -148,7 +145,7 @@ public class EndermanListenerTest { /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EndermanListener#onEndermanGrief(org.bukkit.event.entity.EntityChangeBlockEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EndermanListener#onEndermanGrief(org.bukkit.event.entity.EntityChangeBlockEvent)}. */ @Test public void testNotEnderman() { @@ -163,7 +160,7 @@ public class EndermanListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EndermanListener#onEndermanGrief(org.bukkit.event.entity.EntityChangeBlockEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EndermanListener#onEndermanGrief(org.bukkit.event.entity.EntityChangeBlockEvent)}. */ @Test public void testOnEndermanGriefWrongWorld() { @@ -179,7 +176,7 @@ public class EndermanListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EndermanListener#onEndermanGrief(org.bukkit.event.entity.EntityChangeBlockEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EndermanListener#onEndermanGrief(org.bukkit.event.entity.EntityChangeBlockEvent)}. */ @Test public void testOnEndermanGriefAllowed() { @@ -195,7 +192,7 @@ public class EndermanListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EndermanListener#onEndermanGrief(org.bukkit.event.entity.EntityChangeBlockEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EndermanListener#onEndermanGrief(org.bukkit.event.entity.EntityChangeBlockEvent)}. */ @Test public void testOnEndermanGrief() { @@ -210,7 +207,7 @@ public class EndermanListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EndermanListener#onEndermanDeath(org.bukkit.event.entity.EntityDeathEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EndermanListener#onEndermanDeath(org.bukkit.event.entity.EntityDeathEvent)}. */ @Test public void testOnNotEndermanDeath() { @@ -222,7 +219,7 @@ public class EndermanListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EndermanListener#onEndermanDeath(org.bukkit.event.entity.EntityDeathEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EndermanListener#onEndermanDeath(org.bukkit.event.entity.EntityDeathEvent)}. */ @Test public void testOnEndermanDeathCarryAir() { @@ -234,7 +231,7 @@ public class EndermanListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EndermanListener#onEndermanDeath(org.bukkit.event.entity.EntityDeathEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EndermanListener#onEndermanDeath(org.bukkit.event.entity.EntityDeathEvent)}. */ @Test public void testOnEndermanDeathNotInWorld() { @@ -247,7 +244,7 @@ public class EndermanListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EndermanListener#onEndermanDeath(org.bukkit.event.entity.EntityDeathEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EndermanListener#onEndermanDeath(org.bukkit.event.entity.EntityDeathEvent)}. */ @Test public void testOnEndermanDeathNoFlag() { @@ -260,7 +257,7 @@ public class EndermanListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EndermanListener#onEndermanDeath(org.bukkit.event.entity.EntityDeathEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EndermanListener#onEndermanDeath(org.bukkit.event.entity.EntityDeathEvent)}. */ @Test public void testOnEndermanDeath() { diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/EnterExitListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/EnterExitListenerTest.java similarity index 83% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/EnterExitListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/EnterExitListenerTest.java index aa19e932d..595bf94ec 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/EnterExitListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/EnterExitListenerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; @@ -27,24 +27,25 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.user.Notifier; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.user.Notifier; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.listeners.flags.EnterExitListener; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.util.Util; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, Util.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, Util.class }) public class EnterExitListenerTest { private static final Integer PROTECTION_RANGE = 200; @@ -69,8 +70,8 @@ public class EnterExitListenerTest { public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // World world = mock(World.class); @@ -167,7 +168,7 @@ public class EnterExitListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. */ @Test public void testOnMoveInsideIsland() { @@ -178,7 +179,7 @@ public class EnterExitListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. */ @Test public void testOnMoveOutsideIsland() { @@ -189,7 +190,7 @@ public class EnterExitListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. */ @Test public void testOnGoingIntoIslandEmptyIslandName() { @@ -203,7 +204,7 @@ public class EnterExitListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. */ @Test public void testOnGoingIntoIslandWithIslandName() { @@ -218,7 +219,7 @@ public class EnterExitListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. */ @Test public void testExitingIslandEmptyIslandName() { @@ -232,7 +233,7 @@ public class EnterExitListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.EnterExitListener#onMove(org.bukkit.event.player.PlayerMoveEvent)}. */ @Test public void testExitingIslandWithIslandName() { diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/FireListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/FireListenerTest.java similarity index 91% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/FireListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/FireListenerTest.java index 54e7cba03..6e9013a9e 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/FireListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/FireListenerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -38,32 +38,32 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest( {BSkyBlock.class, Flags.class, Util.class} ) +@PrepareForTest( {BentoBox.class, Flags.class, Util.class} ) public class FireListenerTest { private static Location location; - private static BSkyBlock plugin; + private static BentoBox plugin; private static IslandWorldManager iwm; @BeforeClass public static void setUpClass() { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); Server server = mock(Server.class); World world = mock(World.class); @@ -96,9 +96,6 @@ public class FireListenerTest { // Worlds iwm = mock(IslandWorldManager.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(iwm.getBSBNetherWorld()).thenReturn(world); - when(iwm.getBSBEndWorld()).thenReturn(world); when(iwm.inWorld(any())).thenReturn(true); when(plugin.getIWM()).thenReturn(iwm); diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/InvincibleVisitorsListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/InvincibleVisitorsListenerTest.java similarity index 91% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/InvincibleVisitorsListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/InvincibleVisitorsListenerTest.java index 189c62e3f..f192ad9be 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/InvincibleVisitorsListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/InvincibleVisitorsListenerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -31,19 +31,20 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.listeners.flags.InvincibleVisitorsListener; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({BSkyBlock.class, Util.class, Bukkit.class }) +@PrepareForTest({BentoBox.class, Util.class, Bukkit.class }) public class InvincibleVisitorsListenerTest { private IslandWorldManager iwm; @@ -64,8 +65,8 @@ public class InvincibleVisitorsListenerTest { public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Island World Manager iwm = mock(IslandWorldManager.class); when(iwm.inWorld(Mockito.any())).thenReturn(true); diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/IslandRespawnListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/IslandRespawnListenerTest.java similarity index 80% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/IslandRespawnListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/IslandRespawnListenerTest.java index dc4eeab7f..952e57768 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/IslandRespawnListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/IslandRespawnListenerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; @@ -28,21 +28,22 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.listeners.flags.IslandRespawnListener; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.util.Util; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest( {BSkyBlock.class, Flags.class, Util.class }) +@PrepareForTest( {BentoBox.class, Flags.class, Util.class }) public class IslandRespawnListenerTest { private World world; @@ -57,8 +58,8 @@ public class IslandRespawnListenerTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // World world = mock(World.class); @@ -101,7 +102,7 @@ public class IslandRespawnListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.IslandRespawnListener#onPlayerDeath(org.bukkit.event.entity.PlayerDeathEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.IslandRespawnListener#onPlayerDeath(org.bukkit.event.entity.PlayerDeathEvent)}. */ @Test public void testOnPlayerDeath() { @@ -111,7 +112,7 @@ public class IslandRespawnListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.IslandRespawnListener#onPlayerRespawn(org.bukkit.event.player.PlayerRespawnEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.IslandRespawnListener#onPlayerRespawn(org.bukkit.event.player.PlayerRespawnEvent)}. */ @Test public void testOnPlayerRespawn() { @@ -131,7 +132,7 @@ public class IslandRespawnListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.IslandRespawnListener#onPlayerRespawn(org.bukkit.event.player.PlayerRespawnEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.IslandRespawnListener#onPlayerRespawn(org.bukkit.event.player.PlayerRespawnEvent)}. */ @Test public void testOnPlayerRespawnWithoutDeath() { @@ -148,7 +149,7 @@ public class IslandRespawnListenerTest { /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.IslandRespawnListener#onPlayerRespawn(org.bukkit.event.player.PlayerRespawnEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.IslandRespawnListener#onPlayerRespawn(org.bukkit.event.player.PlayerRespawnEvent)}. */ @Test public void testOnPlayerRespawnWrongWorld() { @@ -169,7 +170,7 @@ public class IslandRespawnListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.IslandRespawnListener#onPlayerRespawn(org.bukkit.event.player.PlayerRespawnEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.IslandRespawnListener#onPlayerRespawn(org.bukkit.event.player.PlayerRespawnEvent)}. */ @Test public void testOnPlayerRespawnFlagNotSet() { diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/ItemFrameListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/ItemFrameListenerTest.java similarity index 80% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/ItemFrameListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/ItemFrameListenerTest.java index f67bfa2ae..200e17c4f 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/ItemFrameListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/ItemFrameListenerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -44,26 +44,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.util.Util; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest( {BSkyBlock.class, Flags.class, Util.class, Bukkit.class} ) +@PrepareForTest( {BentoBox.class, Flags.class, Util.class, Bukkit.class} ) public class ItemFrameListenerTest { private static Location location; - private static BSkyBlock plugin; + private static BentoBox plugin; private static IslandWorldManager iwm; private static IslandsManager im; private static World world; @@ -73,8 +73,8 @@ public class ItemFrameListenerTest { @Before public void setUp() { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); Server server = mock(Server.class); world = mock(World.class); @@ -108,9 +108,6 @@ public class ItemFrameListenerTest { // Worlds iwm = mock(IslandWorldManager.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(iwm.getBSBNetherWorld()).thenReturn(world); - when(iwm.getBSBEndWorld()).thenReturn(world); when(iwm.inWorld(any())).thenReturn(true); when(plugin.getIWM()).thenReturn(iwm); @@ -148,7 +145,7 @@ public class ItemFrameListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.ItemFrameListener#onItemFrameDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.ItemFrameListener#onItemFrameDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnItemFrameDamageEntityDamageByEntityEvent() { @@ -162,7 +159,7 @@ public class ItemFrameListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.ItemFrameListener#onItemFrameDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.ItemFrameListener#onItemFrameDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testNotItemFrame() { @@ -176,7 +173,7 @@ public class ItemFrameListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.ItemFrameListener#onItemFrameDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.ItemFrameListener#onItemFrameDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testProjectile() { @@ -192,7 +189,7 @@ public class ItemFrameListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.ItemFrameListener#onItemFrameDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.ItemFrameListener#onItemFrameDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testPlayerProjectile() { @@ -209,7 +206,7 @@ public class ItemFrameListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.ItemFrameListener#onItemFrameDamage(org.bukkit.event.hanging.HangingBreakByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.ItemFrameListener#onItemFrameDamage(org.bukkit.event.hanging.HangingBreakByEntityEvent)}. */ @Test public void testOnItemFrameDamageHangingBreakByEntityEvent() { diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/LockAndBanListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/LockAndBanListenerTest.java similarity index 97% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/LockAndBanListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/LockAndBanListenerTest.java index 27be9adc8..07181cb6e 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/LockAndBanListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/LockAndBanListenerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -34,19 +34,20 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.Notifier; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.user.Notifier; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.listeners.flags.LockAndBanListener; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class }) public class LockAndBanListenerTest { private static final Integer PROTECTION_RANGE = 200; @@ -73,8 +74,8 @@ public class LockAndBanListenerTest { public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // World world = mock(World.class); @@ -88,7 +89,7 @@ public class LockAndBanListenerTest { // Settings Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); + when(plugin.getSettings()).thenReturn(s); // Player diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/MobSpawnListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/MobSpawnListenerTest.java similarity index 92% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/MobSpawnListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/MobSpawnListenerTest.java index b8c41f7d8..d835c2dc5 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/MobSpawnListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/MobSpawnListenerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -35,21 +35,21 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest( {BSkyBlock.class, Flags.class, Util.class }) +@PrepareForTest( {BentoBox.class, Flags.class, Util.class }) public class MobSpawnListenerTest { private static Location location; - private static BSkyBlock plugin; + private static BentoBox plugin; private static Zombie zombie; private static Slime slime; private static Cow cow; @@ -59,8 +59,8 @@ public class MobSpawnListenerTest { @BeforeClass public static void setUpBeforeClass() { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); IslandsManager im = mock(IslandsManager.class); when(plugin.getIslands()).thenReturn(im); @@ -108,9 +108,6 @@ public class MobSpawnListenerTest { // Worlds iwm = mock(IslandWorldManager.class); when(plugin.getIWM()).thenReturn(iwm); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(iwm.getBSBNetherWorld()).thenReturn(world); - when(iwm.getBSBEndWorld()).thenReturn(world); when(iwm.inWorld(any(Location.class))).thenReturn(true); when(plugin.getIWM()).thenReturn(iwm); diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/OfflineRedstoneListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/OfflineRedstoneListenerTest.java similarity index 88% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/OfflineRedstoneListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/OfflineRedstoneListenerTest.java index 01c55676e..a7e0f369e 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/OfflineRedstoneListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/OfflineRedstoneListenerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; @@ -27,15 +27,16 @@ import org.powermock.reflect.Whitebox; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.listeners.flags.OfflineRedstoneListener; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({BSkyBlock.class, Util.class, Bukkit.class }) +@PrepareForTest({BentoBox.class, Util.class, Bukkit.class }) public class OfflineRedstoneListenerTest { private World world; @@ -48,8 +49,8 @@ public class OfflineRedstoneListenerTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // World world = mock(World.class); diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/PVPListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/PVPListenerTest.java similarity index 88% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/PVPListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/PVPListenerTest.java index 0ed703999..476a76a16 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/PVPListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/PVPListenerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -59,20 +59,21 @@ import com.google.common.base.Function; import com.google.common.base.Functions; import com.google.common.collect.ImmutableMap; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.panels.Panel; -import us.tastybento.bskyblock.api.panels.PanelItem; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.panels.Panel; +import world.bentobox.bbox.api.panels.PanelItem; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.listeners.flags.PVPListener; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.util.Util; /** * @author tastybento @@ -80,7 +81,7 @@ import us.tastybento.bskyblock.util.Util; */ @SuppressWarnings("deprecation") @RunWith(PowerMockRunner.class) -@PrepareForTest({BSkyBlock.class, Util.class, Bukkit.class }) +@PrepareForTest({BentoBox.class, Util.class, Bukkit.class }) public class PVPListenerTest { private IslandWorldManager iwm; @@ -102,8 +103,8 @@ public class PVPListenerTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Island World Manager iwm = mock(IslandWorldManager.class); when(iwm.inWorld(Mockito.any())).thenReturn(true); @@ -196,7 +197,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamageNotPlayer() { @@ -210,7 +211,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamageSelfDamage() { @@ -223,7 +224,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamageOnPlayerByZombie() { @@ -257,7 +258,7 @@ public class PVPListenerTest { /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamageOnPlayerByZombieVisitorProtected() { @@ -289,7 +290,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamageOnVisitorByZombieVisitorProtected() { @@ -322,7 +323,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamageOnVisitorByZombieVisitorProtectedWrongDamage() { @@ -352,7 +353,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamageOnVisitorByZombieVisitorNotProtected() { @@ -392,7 +393,7 @@ public class PVPListenerTest { /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamagePVPNotAllowed() { @@ -417,7 +418,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamageOnPVPAllowed() { @@ -443,7 +444,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamageOnPVPNotAllowedProjectile() { @@ -471,7 +472,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamageSelfDamageProjectile() { @@ -487,7 +488,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent)}. */ @Test public void testOnEntityDamagePVPAllowedProjectile() { @@ -517,7 +518,7 @@ public class PVPListenerTest { /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onFishing(org.bukkit.event.player.PlayerFishEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onFishing(org.bukkit.event.player.PlayerFishEvent)}. */ @Test public void testOnFishing() { @@ -562,7 +563,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onFishing(org.bukkit.event.player.PlayerFishEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onFishing(org.bukkit.event.player.PlayerFishEvent)}. */ @Test public void testOnFishingProtectVisitors() { @@ -585,7 +586,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onFishing(org.bukkit.event.player.PlayerFishEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onFishing(org.bukkit.event.player.PlayerFishEvent)}. */ @Test public void testOnFishingSelfDamage() { @@ -598,7 +599,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onFishing(org.bukkit.event.player.PlayerFishEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onFishing(org.bukkit.event.player.PlayerFishEvent)}. */ @Test public void testOnFishingNoPVPProtectVisitors() { @@ -621,7 +622,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. */ @Test public void testOnSplashPotionSplashWitch() { @@ -634,7 +635,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. */ @Test public void testOnSplashPotionSplashNoPlayers() { @@ -651,7 +652,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. */ @Test public void testOnSplashPotionSplash() { @@ -679,7 +680,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. */ @Test public void testOnSplashPotionSplashSelfInflicted() { @@ -706,7 +707,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. */ @Test public void testOnSplashPotionSplashAllowPVP() { @@ -729,7 +730,7 @@ public class PVPListenerTest { /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onSplashPotionSplash(org.bukkit.event.entity.PotionSplashEvent)}. */ @Test public void testOnSplashPotionSplashAllowPVPProtectVisitors() { @@ -763,7 +764,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onLingeringPotionSplash(org.bukkit.event.entity.LingeringPotionSplashEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onLingeringPotionSplash(org.bukkit.event.entity.LingeringPotionSplashEvent)}. */ @Test public void testOnLingeringPotionSplash() { @@ -781,7 +782,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onLingeringPotionSplash(org.bukkit.event.entity.LingeringPotionSplashEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onLingeringPotionSplash(org.bukkit.event.entity.LingeringPotionSplashEvent)}. */ @Test public void testOnLingeringPotionSplashNonHuman() { @@ -798,7 +799,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onLingeringPotionDamage(org.bukkit.event.entity.AreaEffectCloudApplyEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onLingeringPotionDamage(org.bukkit.event.entity.AreaEffectCloudApplyEvent)}. */ @Test public void testOnLingeringPotionDamageNoPVP() { @@ -834,7 +835,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onLingeringPotionDamage(org.bukkit.event.entity.AreaEffectCloudApplyEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onLingeringPotionDamage(org.bukkit.event.entity.AreaEffectCloudApplyEvent)}. */ @Test public void testOnLingeringPotionDamagePVP() { @@ -868,7 +869,7 @@ public class PVPListenerTest { /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onLingeringPotionDamage(org.bukkit.event.entity.AreaEffectCloudApplyEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onLingeringPotionDamage(org.bukkit.event.entity.AreaEffectCloudApplyEvent)}. */ @Test public void testOnLingeringPotionDamageNoPVPVisitor() { @@ -908,7 +909,7 @@ public class PVPListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.PVPListener#onLingeringPotionDamage(org.bukkit.event.entity.AreaEffectCloudApplyEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.PVPListener#onLingeringPotionDamage(org.bukkit.event.entity.AreaEffectCloudApplyEvent)}. */ @Test public void testOnLingeringPotionDamagePVPVisitor() { diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/PistonPushListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/PistonPushListenerTest.java similarity index 87% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/PistonPushListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/PistonPushListenerTest.java index cf4c46aaa..1cec71093 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/PistonPushListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/PistonPushListenerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -26,16 +26,17 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.listeners.flags.PistonPushListener; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest({BSkyBlock.class, Util.class }) +@PrepareForTest({BentoBox.class, Util.class }) public class PistonPushListenerTest { private Island island; @@ -50,8 +51,8 @@ public class PistonPushListenerTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // World world = mock(World.class); diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/RemoveMobsListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/RemoveMobsListenerTest.java similarity index 77% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/RemoveMobsListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/RemoveMobsListenerTest.java index 64967d2c5..bdffb219a 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/RemoveMobsListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/RemoveMobsListenerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -24,20 +24,21 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.listeners.flags.RemoveMobsListener; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.util.Util; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({BSkyBlock.class, Util.class }) +@PrepareForTest({BentoBox.class, Util.class }) public class RemoveMobsListenerTest { private Island island; @@ -53,8 +54,8 @@ public class RemoveMobsListenerTest { @Before public void setUp() throws Exception { // Set up plugin - BSkyBlock plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + BentoBox plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // World world = mock(World.class); @@ -98,7 +99,7 @@ public class RemoveMobsListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.RemoveMobsListener#onUserTeleport(org.bukkit.event.player.PlayerTeleportEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.RemoveMobsListener#onUserTeleport(org.bukkit.event.player.PlayerTeleportEvent)}. */ @Test public void testOnUserTeleport() { @@ -108,7 +109,7 @@ public class RemoveMobsListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.RemoveMobsListener#onUserTeleport(org.bukkit.event.player.PlayerTeleportEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.RemoveMobsListener#onUserTeleport(org.bukkit.event.player.PlayerTeleportEvent)}. */ @Test public void testOnUserTeleportDoNotRemove() { @@ -119,7 +120,7 @@ public class RemoveMobsListenerTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.flags.RemoveMobsListener#onUserTeleport(org.bukkit.event.player.PlayerTeleportEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.flags.RemoveMobsListener#onUserTeleport(org.bukkit.event.player.PlayerTeleportEvent)}. */ @Test public void testOnUserTeleportToNotIsland() { diff --git a/src/test/java/us/tastybento/bskyblock/listeners/flags/TNTListenerTest.java b/src/test/java/world/bentobox/bbox/listeners/flags/TNTListenerTest.java similarity index 90% rename from src/test/java/us/tastybento/bskyblock/listeners/flags/TNTListenerTest.java rename to src/test/java/world/bentobox/bbox/listeners/flags/TNTListenerTest.java index dd1df219c..ebeb5e8df 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/flags/TNTListenerTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/flags/TNTListenerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.listeners.flags; +package world.bentobox.bbox.listeners.flags; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -51,26 +51,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.user.Notifier; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.FlagsManager; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.user.Notifier; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest( {BSkyBlock.class, Flags.class, Util.class} ) +@PrepareForTest( {BentoBox.class, Flags.class, Util.class} ) public class TNTListenerTest { private static Location location; - private static BSkyBlock plugin; + private static BentoBox plugin; private static IslandWorldManager iwm; private static IslandsManager im; private static Notifier notifier; @@ -78,8 +78,8 @@ public class TNTListenerTest { @BeforeClass public static void setUpClass() { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); Server server = mock(Server.class); World world = mock(World.class); @@ -112,9 +112,6 @@ public class TNTListenerTest { // Worlds iwm = mock(IslandWorldManager.class); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(iwm.getBSBNetherWorld()).thenReturn(world); - when(iwm.getBSBEndWorld()).thenReturn(world); when(iwm.inWorld(any())).thenReturn(true); when(plugin.getIWM()).thenReturn(iwm); diff --git a/src/test/java/us/tastybento/bskyblock/listeners/protection/FlyingMobEventsTest.java b/src/test/java/world/bentobox/bbox/listeners/protection/FlyingMobEventsTest.java similarity index 84% rename from src/test/java/us/tastybento/bskyblock/listeners/protection/FlyingMobEventsTest.java rename to src/test/java/world/bentobox/bbox/listeners/protection/FlyingMobEventsTest.java index 9af5196fe..43d15ab08 100644 --- a/src/test/java/us/tastybento/bskyblock/listeners/protection/FlyingMobEventsTest.java +++ b/src/test/java/world/bentobox/bbox/listeners/protection/FlyingMobEventsTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.listeners.protection; +package world.bentobox.bbox.listeners.protection; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -41,25 +41,26 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; -import us.tastybento.bskyblock.managers.PlayersManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.listeners.protection.FlyingMobEvents; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.managers.PlayersManager; +import world.bentobox.bbox.util.Util; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class, Util.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class, Util.class }) public class FlyingMobEventsTest { - private BSkyBlock plugin; + private BentoBox plugin; private IslandsManager im; private PlayersManager pm; private BukkitScheduler sch; @@ -71,8 +72,8 @@ public class FlyingMobEventsTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Settings Settings s = mock(Settings.class); @@ -122,7 +123,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#FlyingMobEvents(us.tastybento.bskyblock.BSkyBlock)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#FlyingMobEvents(world.bentobox.bbox.BentoBox)}. */ @Test public void testFlyingMobEvents() { @@ -132,7 +133,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#onMobSpawn(org.bukkit.event.entity.CreatureSpawnEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#onMobSpawn(org.bukkit.event.entity.CreatureSpawnEvent)}. */ @Test public void testOnMobSpawnNotInWorld() { @@ -146,7 +147,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#onMobSpawn(org.bukkit.event.entity.CreatureSpawnEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#onMobSpawn(org.bukkit.event.entity.CreatureSpawnEvent)}. */ @Test public void testOnMobSpawnInWorldWrongType() { @@ -159,7 +160,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#onMobSpawn(org.bukkit.event.entity.CreatureSpawnEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#onMobSpawn(org.bukkit.event.entity.CreatureSpawnEvent)}. */ @Test public void testOnMobSpawnInWorldCorrectType() { @@ -186,7 +187,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#onMobExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#onMobExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. */ @Test public void testOnMobExplosionFail() { @@ -208,7 +209,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#onMobExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#onMobExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. */ @Test public void testOnMobExplosionOnIsland() { @@ -240,7 +241,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#onMobExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#onMobExplosion(org.bukkit.event.entity.EntityExplodeEvent)}. */ @Test public void testOnMobExplosionOffIsland() { @@ -272,7 +273,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#onWitherExplode(org.bukkit.event.entity.ExplosionPrimeEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#onWitherExplode(org.bukkit.event.entity.ExplosionPrimeEvent)}. */ @Test public void testOnWitherExplode() { @@ -298,7 +299,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#onWitherExplode(org.bukkit.event.entity.ExplosionPrimeEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#onWitherExplode(org.bukkit.event.entity.ExplosionPrimeEvent)}. */ @Test public void testOnWitherSkullExplode() { @@ -328,7 +329,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#onWitherChangeBlocks(org.bukkit.event.entity.EntityChangeBlockEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#onWitherChangeBlocks(org.bukkit.event.entity.EntityChangeBlockEvent)}. */ @Test public void testOnWitherChangeBlocks() { @@ -362,7 +363,7 @@ public class FlyingMobEventsTest { } /** - * Test method for {@link us.tastybento.bskyblock.listeners.protection.FlyingMobEvents#onMobDeath(org.bukkit.event.entity.EntityDeathEvent)}. + * Test method for {@link world.bentobox.bbox.listeners.protection.FlyingMobEvents#onMobDeath(org.bukkit.event.entity.EntityDeathEvent)}. */ @Test public void testOnMobDeath() { diff --git a/src/test/java/us/tastybento/bskyblock/managers/FlagsManagerTest.java b/src/test/java/world/bentobox/bbox/managers/FlagsManagerTest.java similarity index 89% rename from src/test/java/us/tastybento/bskyblock/managers/FlagsManagerTest.java rename to src/test/java/world/bentobox/bbox/managers/FlagsManagerTest.java index 7c51f7a5b..8f20a204f 100644 --- a/src/test/java/us/tastybento/bskyblock/managers/FlagsManagerTest.java +++ b/src/test/java/world/bentobox/bbox/managers/FlagsManagerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; @@ -31,25 +31,27 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.flags.Flag; -import us.tastybento.bskyblock.api.flags.FlagBuilder; -import us.tastybento.bskyblock.listeners.flags.BreakBlocksListener; -import us.tastybento.bskyblock.lists.Flags; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.flags.Flag; +import world.bentobox.bbox.api.flags.FlagBuilder; +import world.bentobox.bbox.listeners.flags.BreakBlocksListener; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.FlagsManager; +import world.bentobox.bbox.managers.IslandsManager; @RunWith(PowerMockRunner.class) -@PrepareForTest( {BSkyBlock.class, Flags.class, Bukkit.class} ) +@PrepareForTest( {BentoBox.class, Flags.class, Bukkit.class} ) public class FlagsManagerTest { - private static BSkyBlock plugin; + private static BentoBox plugin; private static Server server; @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Plugin is loaded when(plugin.isLoaded()).thenReturn(true); diff --git a/src/test/java/us/tastybento/bskyblock/managers/IslandsManagerTest.java b/src/test/java/world/bentobox/bbox/managers/IslandsManagerTest.java similarity index 83% rename from src/test/java/us/tastybento/bskyblock/managers/IslandsManagerTest.java rename to src/test/java/world/bentobox/bbox/managers/IslandsManagerTest.java index cda8975bf..db6ab5e47 100644 --- a/src/test/java/us/tastybento/bskyblock/managers/IslandsManagerTest.java +++ b/src/test/java/world/bentobox/bbox/managers/IslandsManagerTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -52,20 +52,20 @@ import org.powermock.reflect.Whitebox; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.configuration.WorldSettings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.lists.Flags; -import us.tastybento.bskyblock.managers.island.IslandCache; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.configuration.WorldSettings; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.lists.Flags; +import world.bentobox.bbox.managers.island.IslandCache; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) -@PrepareForTest( { Bukkit.class, BSkyBlock.class, IslandsManager.class, Util.class, Location.class }) +@PrepareForTest( { Bukkit.class, BentoBox.class, IslandsManager.class, Util.class, Location.class }) public class IslandsManagerTest { - private static BSkyBlock plugin; + private static BentoBox plugin; private UUID uuid; private User user; private Settings s; @@ -88,8 +88,8 @@ public class IslandsManagerTest { // World world = mock(World.class); // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // Command manager CommandsManager cm = mock(CommandsManager.class); @@ -98,7 +98,7 @@ public class IslandsManagerTest { // Settings s = mock(Settings.class); when(s.getResetWait()).thenReturn(0L); - when(s.getResetLimit()).thenReturn(3); + when(plugin.getSettings()).thenReturn(s); // Player @@ -165,9 +165,6 @@ public class IslandsManagerTest { // Worlds iwm = mock(IslandWorldManager.class); when(plugin.getIWM()).thenReturn(iwm); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(iwm.getBSBNetherWorld()).thenReturn(world); - when(iwm.getBSBEndWorld()).thenReturn(world); when(iwm.inWorld(any())).thenReturn(true); PowerMockito.mockStatic(Util.class); @@ -179,7 +176,7 @@ public class IslandsManagerTest { /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. */ @Test public void testIsSafeLocationSafe() { @@ -188,7 +185,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. */ @Test public void testIsSafeLocationNull() { @@ -197,7 +194,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. */ @Test public void testIsSafeLocationNonSolidGround() { @@ -206,7 +203,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. */ @Test public void testIsSafeLocationSubmerged() { @@ -217,7 +214,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. */ @Test public void testIsSafeLocationPortals() { @@ -248,7 +245,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. */ @Test public void testIsSafeLocationLava() { @@ -279,7 +276,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. */ @Test public void testTrapDoor() { @@ -302,7 +299,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. */ @Test public void testBadBlocks() { @@ -326,7 +323,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isSafeLocation(org.bukkit.Location)}. */ @Test public void testSolidBlocks() { @@ -355,7 +352,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#IslandsManager(us.tastybento.bskyblock.BSkyBlock)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#IslandsManager(world.bentobox.bbox.BentoBox)}. */ @Test public void testIslandsManager() { @@ -363,7 +360,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#bigScan(org.bukkit.Location, int)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#bigScan(org.bukkit.Location, int)}. */ @Test public void testBigScan() throws Exception { @@ -373,8 +370,6 @@ public class IslandsManagerTest { IslandWorldManager iwm = mock(IslandWorldManager.class); when(plugin.getIWM()).thenReturn(iwm); - when(iwm.getBSBIslandWorld()).thenReturn(world); - IslandsManager manager = new IslandsManager(plugin); @@ -410,7 +405,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#createIsland(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#createIsland(org.bukkit.Location)}. */ @Test public void testCreateIslandLocation() { @@ -421,7 +416,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#createIsland(org.bukkit.Location, java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#createIsland(org.bukkit.Location, java.util.UUID)}. */ @Test public void testCreateIslandLocationUUID() { @@ -434,7 +429,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#deleteIsland(us.tastybento.bskyblock.database.objects.Island, boolean)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#deleteIsland(world.bentobox.bbox.database.objects.Island, boolean)}. */ @Test public void testDeleteIslandIslandBoolean() { @@ -450,7 +445,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#getCount()}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#getCount()}. */ @Test public void testGetCount() { @@ -461,7 +456,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#getIsland(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#getIsland(java.util.UUID)}. */ @Test public void testGetIsland() { @@ -473,7 +468,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#getIslandAt(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#getIslandAt(org.bukkit.Location)}. * @throws Exception */ @Test @@ -502,7 +497,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#getIslandLocation(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#getIslandLocation(java.util.UUID)}. */ @Test public void testGetIslandLocation() { @@ -513,7 +508,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#getLast()}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#getLast()}. */ @Test public void testGetLast() { @@ -524,7 +519,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#getMembers(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#getMembers(java.util.UUID)}. * @throws Exception */ @Test @@ -542,7 +537,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#getProtectedIslandAt(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#getProtectedIslandAt(org.bukkit.Location)}. * @throws Exception */ @Test @@ -577,7 +572,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#getSafeHomeLocation(java.util.UUID, int)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#getSafeHomeLocation(java.util.UUID, int)}. */ @Test public void testGetSafeHomeLocation() { @@ -590,7 +585,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#getSpawnPoint()}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#getSpawnPoint()}. */ @Test public void testGetSpawnPoint() { @@ -607,7 +602,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#homeTeleport(org.bukkit.entity.Player, int)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#homeTeleport(org.bukkit.entity.Player, int)}. */ @Test public void testHomeTeleportPlayerInt() { @@ -623,7 +618,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#homeTeleport(org.bukkit.entity.Player, int)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#homeTeleport(org.bukkit.entity.Player, int)}. */ @Test public void testHomeTeleportPlayerIntDifferentGameMode() { @@ -639,7 +634,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isAtSpawn(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isAtSpawn(org.bukkit.Location)}. */ @Test public void testIsAtSpawn() { @@ -653,7 +648,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#isOwner(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#isOwner(java.util.UUID)}. * @throws Exception */ @Test @@ -685,7 +680,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#load()}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#load()}. */ @Test public void testLoad() { @@ -695,7 +690,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#locationIsOnIsland(org.bukkit.entity.Player, org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#locationIsOnIsland(org.bukkit.entity.Player, org.bukkit.Location)}. * @throws Exception */ @Test @@ -734,7 +729,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#userIsOnIsland(us.tastybento.bskyblock.api.user.User)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#userIsOnIsland(world.bentobox.bbox.api.user.User)}. * @throws Exception */ @Test @@ -758,7 +753,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#removePlayer(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#removePlayer(java.util.UUID)}. */ @Test public void testRemovePlayer() { @@ -767,7 +762,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#removePlayersFromIsland(us.tastybento.bskyblock.database.objects.Island)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#removePlayersFromIsland(world.bentobox.bbox.database.objects.Island)}. */ @Test public void testRemovePlayersFromIsland() { @@ -777,7 +772,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#save(boolean)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#save(boolean)}. */ @Test public void testSave() { @@ -785,7 +780,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#setIslandName(java.util.UUID, java.lang.String)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#setIslandName(java.util.UUID, java.lang.String)}. */ @Test public void testSetIslandName() { @@ -793,7 +788,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#setJoinTeam(us.tastybento.bskyblock.database.objects.Island, java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#setJoinTeam(world.bentobox.bbox.database.objects.Island, java.util.UUID)}. */ @Test public void testSetJoinTeam() { @@ -801,7 +796,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#setLast(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#setLast(org.bukkit.Location)}. */ @Test public void testSetLast() { @@ -809,7 +804,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#setLeaveTeam(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#setLeaveTeam(java.util.UUID)}. */ @Test public void testSetLeaveTeam() { @@ -817,7 +812,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#shutdown()}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#shutdown()}. */ @Test public void testShutdown() { @@ -825,7 +820,7 @@ public class IslandsManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.IslandsManager#clearArea(Location)}. + * Test method for {@link world.bentobox.bbox.managers.IslandsManager#clearArea(Location)}. */ @Test public void testClearArea() { diff --git a/src/test/java/us/tastybento/bskyblock/managers/PlayersManagerTest.java b/src/test/java/world/bentobox/bbox/managers/PlayersManagerTest.java similarity index 82% rename from src/test/java/us/tastybento/bskyblock/managers/PlayersManagerTest.java rename to src/test/java/world/bentobox/bbox/managers/PlayersManagerTest.java index 28e47fd57..1ee0aabd4 100644 --- a/src/test/java/us/tastybento/bskyblock/managers/PlayersManagerTest.java +++ b/src/test/java/world/bentobox/bbox/managers/PlayersManagerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -33,23 +33,23 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.BSBDatabase; -import us.tastybento.bskyblock.database.objects.Names; -import us.tastybento.bskyblock.database.objects.Players; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.BSBDatabase; +import world.bentobox.bbox.database.objects.Names; +import world.bentobox.bbox.database.objects.Players; +import world.bentobox.bbox.util.Util; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest({Bukkit.class, BSkyBlock.class, User.class, Util.class, PlayersManager.class }) +@PrepareForTest({Bukkit.class, BentoBox.class, User.class, Util.class, PlayersManager.class }) public class PlayersManagerTest { - private BSkyBlock plugin; + private BentoBox plugin; private UUID uuid; private User user; private UUID notUUID; @@ -64,8 +64,8 @@ public class PlayersManagerTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); + plugin = mock(BentoBox.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); // island world mgr IslandWorldManager iwm = mock(IslandWorldManager.class); @@ -75,9 +75,6 @@ public class PlayersManagerTest { when(nether.getName()).thenReturn("world_nether"); end = mock(World.class); when(end.getName()).thenReturn("world_the_end"); - when(iwm.getBSBEndWorld()).thenReturn(end); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(iwm.getBSBNetherWorld()).thenReturn(nether); when(iwm.inWorld(any())).thenReturn(true); when(plugin.getIWM()).thenReturn(iwm); @@ -89,7 +86,7 @@ public class PlayersManagerTest { Location netherSpawn = mock(Location.class); when(netherSpawn.toVector()).thenReturn(new Vector(0,0,0)); when(nether.getSpawnLocation()).thenReturn(netherSpawn); - when(s.getNetherSpawnRadius()).thenReturn(100); + when(iwm.getNetherSpawnRadius(Mockito.any())).thenReturn(100); // Player Player p = mock(Player.class); @@ -133,7 +130,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#PlayersManager(us.tastybento.bskyblock.BSkyBlock)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#PlayersManager(world.bentobox.bbox.BentoBox)}. */ @Test public void testPlayersManager() { @@ -142,7 +139,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#load()}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#load()}. */ @Test public void testLoad() { @@ -151,7 +148,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#save(boolean)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#save(boolean)}. */ @Test public void testSaveBoolean() { @@ -161,7 +158,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#shutdown()}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#shutdown()}. */ @Test public void testShutdown() { @@ -170,7 +167,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#getPlayer(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#getPlayer(java.util.UUID)}. */ @Test public void testGetPlayer() { @@ -186,7 +183,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#addPlayer(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#addPlayer(java.util.UUID)}. */ @Test public void testAddPlayer() { @@ -206,7 +203,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#removeOnlinePlayer(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#removeOnlinePlayer(java.util.UUID)}. */ @Test public void testRemoveOnlinePlayer() { @@ -226,7 +223,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#removeAllPlayers()}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#removeAllPlayers()}. */ @Test public void testRemoveAllPlayers() { @@ -244,7 +241,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#isKnown(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#isKnown(java.util.UUID)}. */ @Test public void testIsKnown() { @@ -264,7 +261,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#setHomeLocation(User, org.bukkit.Location, int)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#setHomeLocation(User, org.bukkit.Location, int)}. */ @Test public void testSetAndGetHomeLocationUserLocationInt() { @@ -292,7 +289,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#clearHomeLocations(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#clearHomeLocations(java.util.UUID)}. */ @Test public void testClearHomeLocations() { @@ -318,7 +315,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#getUUID(java.lang.String)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#getUUID(java.lang.String)}. */ @Test public void testGetUUID() { @@ -349,7 +346,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#setPlayerName(us.tastybento.bskyblock.api.user.User)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#setPlayerName(world.bentobox.bbox.api.user.User)}. */ @Test public void testSetandGetPlayerName() { @@ -368,7 +365,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#getResets(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#getResets(java.util.UUID)}. */ @Test public void testGetSetResetsLeft() { @@ -387,7 +384,7 @@ public class PlayersManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.PlayersManager#save(java.util.UUID)}. + * Test method for {@link world.bentobox.bbox.managers.PlayersManager#save(java.util.UUID)}. */ @Test public void testSaveUUID() { diff --git a/src/test/java/us/tastybento/bskyblock/managers/RanksManagerTest.java b/src/test/java/world/bentobox/bbox/managers/RanksManagerTest.java similarity index 80% rename from src/test/java/us/tastybento/bskyblock/managers/RanksManagerTest.java rename to src/test/java/world/bentobox/bbox/managers/RanksManagerTest.java index 454120a26..e85a904f6 100644 --- a/src/test/java/us/tastybento/bskyblock/managers/RanksManagerTest.java +++ b/src/test/java/world/bentobox/bbox/managers/RanksManagerTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.managers; +package world.bentobox.bbox.managers; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -15,8 +15,9 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.Settings; +import world.bentobox.bbox.managers.RanksManager; /** * @author tastybento @@ -31,7 +32,7 @@ public class RanksManagerTest { */ @Before public void setUp() throws Exception { - BSkyBlock plugin = mock(BSkyBlock.class); + BentoBox plugin = mock(BentoBox.class); Settings settings = mock(Settings.class); // Blank ranks for now Map customRanks = new HashMap<>(); @@ -43,7 +44,7 @@ public class RanksManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.RanksManager#addRank(java.lang.String, int)}. + * Test method for {@link world.bentobox.bbox.managers.RanksManager#addRank(java.lang.String, int)}. */ @Test public void testAddRank() { @@ -51,7 +52,7 @@ public class RanksManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.RanksManager#removeRank(java.lang.String)}. + * Test method for {@link world.bentobox.bbox.managers.RanksManager#removeRank(java.lang.String)}. */ @Test public void testRemoveRank() { @@ -62,7 +63,7 @@ public class RanksManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.RanksManager#getRankValue(java.lang.String)}. + * Test method for {@link world.bentobox.bbox.managers.RanksManager#getRankValue(java.lang.String)}. */ @Test public void testGetRankValue() { @@ -71,7 +72,7 @@ public class RanksManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.RanksManager#getRanks()}. + * Test method for {@link world.bentobox.bbox.managers.RanksManager#getRanks()}. */ @Test public void testGetRanks() { @@ -83,7 +84,7 @@ public class RanksManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.RanksManager#getRankUpValue(int)}. + * Test method for {@link world.bentobox.bbox.managers.RanksManager#getRankUpValue(int)}. */ @Test public void testGetNextRankValue() { @@ -96,7 +97,7 @@ public class RanksManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.RanksManager#getRankDownValue(int)}. + * Test method for {@link world.bentobox.bbox.managers.RanksManager#getRankDownValue(int)}. */ @Test public void testGetPreviousRankValue() { @@ -108,7 +109,7 @@ public class RanksManagerTest { } /** - * Test method for {@link us.tastybento.bskyblock.managers.RanksManager#getRank(int)}. + * Test method for {@link world.bentobox.bbox.managers.RanksManager#getRank(int)}. */ @Test public void testGetRank() { diff --git a/src/test/java/us/tastybento/bskyblock/managers/island/IslandCacheTest.java b/src/test/java/world/bentobox/bbox/managers/island/IslandCacheTest.java similarity index 94% rename from src/test/java/us/tastybento/bskyblock/managers/island/IslandCacheTest.java rename to src/test/java/world/bentobox/bbox/managers/island/IslandCacheTest.java index 58bc0909f..e187d7b69 100644 --- a/src/test/java/us/tastybento/bskyblock/managers/island/IslandCacheTest.java +++ b/src/test/java/world/bentobox/bbox/managers/island/IslandCacheTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.managers.island; +package world.bentobox.bbox.managers.island; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -25,17 +25,17 @@ import org.powermock.modules.junit4.PowerMockRunner; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.util.Util; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.util.Util; @RunWith(PowerMockRunner.class) @PrepareForTest(Util.class) public class IslandCacheTest { - BSkyBlock plugin; + BentoBox plugin; private static World world; Island island; @@ -45,16 +45,13 @@ public class IslandCacheTest { @Before public void setUp() throws Exception { - plugin = mock(BSkyBlock.class); + plugin = mock(BentoBox.class); world = mock(World.class); // Worlds IslandWorldManager iwm = mock(IslandWorldManager.class); when(plugin.getIWM()).thenReturn(iwm); - when(iwm.getBSBIslandWorld()).thenReturn(world); - when(iwm.getBSBNetherWorld()).thenReturn(world); - when(iwm.getBSBEndWorld()).thenReturn(world); when(iwm.inWorld(any())).thenReturn(true); PowerMockito.mockStatic(Util.class); diff --git a/src/test/java/us/tastybento/bskyblock/util/ItemParserTest.java b/src/test/java/world/bentobox/bbox/util/ItemParserTest.java similarity index 99% rename from src/test/java/us/tastybento/bskyblock/util/ItemParserTest.java rename to src/test/java/world/bentobox/bbox/util/ItemParserTest.java index 22d4de255..ef6e9d769 100644 --- a/src/test/java/us/tastybento/bskyblock/util/ItemParserTest.java +++ b/src/test/java/world/bentobox/bbox/util/ItemParserTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -28,6 +28,8 @@ import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; +import world.bentobox.bbox.util.ItemParser; + @RunWith(PowerMockRunner.class) @PrepareForTest({Bukkit.class}) public class ItemParserTest { diff --git a/src/test/java/us/tastybento/bskyblock/util/PairTest.java b/src/test/java/world/bentobox/bbox/util/PairTest.java similarity index 95% rename from src/test/java/us/tastybento/bskyblock/util/PairTest.java rename to src/test/java/world/bentobox/bbox/util/PairTest.java index b363001a7..0234d0864 100644 --- a/src/test/java/us/tastybento/bskyblock/util/PairTest.java +++ b/src/test/java/world/bentobox/bbox/util/PairTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -7,6 +7,8 @@ import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; +import world.bentobox.bbox.util.Pair; + public class PairTest { @Before diff --git a/src/test/java/us/tastybento/bskyblock/util/UtilTest.java b/src/test/java/world/bentobox/bbox/util/UtilTest.java similarity index 76% rename from src/test/java/us/tastybento/bskyblock/util/UtilTest.java rename to src/test/java/world/bentobox/bbox/util/UtilTest.java index 92e4c7175..90fa97d7b 100644 --- a/src/test/java/us/tastybento/bskyblock/util/UtilTest.java +++ b/src/test/java/world/bentobox/bbox/util/UtilTest.java @@ -1,7 +1,7 @@ /** * */ -package us.tastybento.bskyblock.util; +package world.bentobox.bbox.util; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -21,8 +21,9 @@ import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.managers.IslandWorldManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.util.Util; /** * @author tastybento @@ -32,7 +33,7 @@ import us.tastybento.bskyblock.managers.IslandWorldManager; @PrepareForTest( { Bukkit.class }) public class UtilTest { - private BSkyBlock plugin; + private BentoBox plugin; private World world; private IslandWorldManager iwm; private Location location; @@ -44,7 +45,7 @@ public class UtilTest { @Before public void setUp() throws Exception { // Set up plugin - plugin = mock(BSkyBlock.class); + plugin = mock(BentoBox.class); Util.setPlugin(plugin); // World world = mock(World.class); @@ -70,7 +71,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#getServerVersion()}. + * Test method for {@link world.bentobox.bbox.util.Util#getServerVersion()}. */ @Test public void testGetServerVersion() { @@ -78,7 +79,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#getClosestIsland(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.util.Util#getClosestIsland(org.bukkit.Location)}. */ @Test public void testGetClosestIsland() throws Exception { @@ -96,7 +97,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#getLocationString(java.lang.String)}. + * Test method for {@link world.bentobox.bbox.util.Util#getLocationString(java.lang.String)}. */ @Test public void testGetLocationString() { @@ -113,7 +114,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#getStringLocation(org.bukkit.Location)}. + * Test method for {@link world.bentobox.bbox.util.Util#getStringLocation(org.bukkit.Location)}. */ @Test public void testGetStringLocation() { @@ -125,7 +126,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#prettifyText(java.lang.String)}. + * Test method for {@link world.bentobox.bbox.util.Util#prettifyText(java.lang.String)}. */ @Test public void testPrettifyText() { @@ -135,7 +136,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#getOnlinePlayerList(us.tastybento.bskyblock.api.user.User)}. + * Test method for {@link world.bentobox.bbox.util.Util#getOnlinePlayerList(world.bentobox.bbox.api.user.User)}. */ @Test public void testGetOnlinePlayerList() { @@ -143,7 +144,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#tabLimit(java.util.List, java.lang.String)}. + * Test method for {@link world.bentobox.bbox.util.Util#tabLimit(java.util.List, java.lang.String)}. */ @Test public void testTabLimit() { @@ -151,7 +152,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#getPermValue(org.bukkit.entity.Player, java.lang.String, int)}. + * Test method for {@link world.bentobox.bbox.util.Util#getPermValue(org.bukkit.entity.Player, java.lang.String, int)}. */ @Test public void testGetPermValue() { @@ -159,7 +160,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#xyz(org.bukkit.util.Vector)}. + * Test method for {@link world.bentobox.bbox.util.Util#xyz(org.bukkit.util.Vector)}. */ @Test public void testXyz() { @@ -167,7 +168,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#sameWorld(org.bukkit.World, org.bukkit.World)}. + * Test method for {@link world.bentobox.bbox.util.Util#sameWorld(org.bukkit.World, org.bukkit.World)}. */ @Test public void testSameWorld() { @@ -175,7 +176,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#getWorld(org.bukkit.World)}. + * Test method for {@link world.bentobox.bbox.util.Util#getWorld(org.bukkit.World)}. */ @Test public void testGetWorld() { @@ -183,7 +184,7 @@ public class UtilTest { } /** - * Test method for {@link us.tastybento.bskyblock.util.Util#blockFaceToFloat(org.bukkit.block.BlockFace)}. + * Test method for {@link world.bentobox.bbox.util.Util#blockFaceToFloat(org.bukkit.block.BlockFace)}. */ @Test public void testBlockFaceToFloat() { diff --git a/src/test/java/us/tastybento/bskyblock/util/teleport/SafeSpotTeleportTest.java b/src/test/java/world/bentobox/bbox/util/teleport/SafeSpotTeleportTest.java similarity index 73% rename from src/test/java/us/tastybento/bskyblock/util/teleport/SafeSpotTeleportTest.java rename to src/test/java/world/bentobox/bbox/util/teleport/SafeSpotTeleportTest.java index e4a306cf5..eb1ee5a98 100644 --- a/src/test/java/us/tastybento/bskyblock/util/teleport/SafeSpotTeleportTest.java +++ b/src/test/java/world/bentobox/bbox/util/teleport/SafeSpotTeleportTest.java @@ -1,7 +1,7 @@ /** - * + * */ -package us.tastybento.bskyblock.util.teleport; +package world.bentobox.bbox.util.teleport; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; @@ -28,29 +28,28 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.Settings; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.IslandWorldManager; -import us.tastybento.bskyblock.managers.IslandsManager; -import us.tastybento.bskyblock.managers.LocalesManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.IslandWorldManager; +import world.bentobox.bbox.managers.IslandsManager; +import world.bentobox.bbox.managers.LocalesManager; /** * @author tastybento * */ @RunWith(PowerMockRunner.class) -@PrepareForTest( { BSkyBlock.class }) +@PrepareForTest( { BentoBox.class }) public class SafeSpotTeleportTest { @Mock - static BSkyBlock plugin; + static BentoBox plugin; @Mock private static World world; @Mock private static BukkitScheduler sch; - + @BeforeClass public static void setUpBeforeClass() throws Exception { world = mock(World.class); @@ -58,7 +57,7 @@ public class SafeSpotTeleportTest { when(server.getLogger()).thenReturn(Logger.getAnonymousLogger()); when(server.getWorld("world")).thenReturn(world); when(server.getVersion()).thenReturn("BSB_Mocking"); - + PluginManager pluginManager = mock(PluginManager.class); when(server.getPluginManager()).thenReturn(pluginManager); @@ -66,49 +65,44 @@ public class SafeSpotTeleportTest { when(Bukkit.getLogger()).thenReturn(Logger.getAnonymousLogger()); - Whitebox.setInternalState(BSkyBlock.class, "instance", plugin); - - plugin = mock(BSkyBlock.class); + Whitebox.setInternalState(BentoBox.class, "instance", plugin); + + plugin = mock(BentoBox.class); // Users User.setPlugin(plugin); - // Locales - final + // Locales - final LocalesManager lm = mock(LocalesManager.class); when(plugin.getLocalesManager()).thenReturn(lm); when(lm.get(any(), any())).thenReturn("mock translation"); - + // Island Manager IslandsManager im = mock(IslandsManager.class); when(plugin.getIslands()).thenReturn(im); - + Island island = mock(Island.class); when(island.getCenter()).thenReturn(mock(Location.class)); - + // Default is that there is no island around here Optional oi = Optional.empty(); when(im.getIslandAt(Mockito.any())).thenReturn(oi); - - // Settings - Settings settings = mock(Settings.class); - when(settings.getIslandProtectionRange()).thenReturn(1); - when(plugin.getSettings()).thenReturn(settings); - + // Island world manager IslandWorldManager iwm = mock(IslandWorldManager.class); when(iwm.getIslandProtectionRange(Mockito.any())).thenReturn(1); when(plugin.getIWM()).thenReturn(iwm); - + // Server & Scheduler sch = mock(BukkitScheduler.class); when(server.getScheduler()).thenReturn(sch); - + } - + /** - * Test method for {@link us.tastybento.bskyblock.util.teleport.SafeSpotTeleport#SafeSpotTeleport(us.tastybento.bskyblock.BSkyBlock, org.bukkit.entity.Entity, org.bukkit.Location, java.lang.String, boolean, int)}. + * Test method for {@link world.bentobox.bbox.util.teleport.SafeSpotTeleport#SafeSpotTeleport(world.bentobox.bbox.BentoBox, org.bukkit.entity.Entity, org.bukkit.Location, java.lang.String, boolean, int)}. */ @Test public void testSafeSpotTeleport() throws Exception { - + Player player = mock(Player.class); when(player.getGameMode()).thenReturn(GameMode.SURVIVAL); Location loc = mock(Location.class); @@ -121,7 +115,7 @@ public class SafeSpotTeleportTest { boolean portal = false; int homeNumber = 1; new SafeSpotTeleport(plugin, player, loc, "failure message", portal, homeNumber); - + } } diff --git a/src/test/java/us/tastybento/bskyblock/util/teleport/SafeTeleportBuilderTest.java b/src/test/java/world/bentobox/bbox/util/teleport/SafeTeleportBuilderTest.java similarity index 91% rename from src/test/java/us/tastybento/bskyblock/util/teleport/SafeTeleportBuilderTest.java rename to src/test/java/world/bentobox/bbox/util/teleport/SafeTeleportBuilderTest.java index 6a6491c2a..e62dea61a 100644 --- a/src/test/java/us/tastybento/bskyblock/util/teleport/SafeTeleportBuilderTest.java +++ b/src/test/java/world/bentobox/bbox/util/teleport/SafeTeleportBuilderTest.java @@ -1,4 +1,4 @@ -package us.tastybento.bskyblock.util.teleport; +package world.bentobox.bbox.util.teleport; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -17,10 +17,12 @@ import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import us.tastybento.bskyblock.BSkyBlock; -import us.tastybento.bskyblock.api.user.User; -import us.tastybento.bskyblock.database.objects.Island; -import us.tastybento.bskyblock.managers.LocalesManager; +import world.bentobox.bbox.BentoBox; +import world.bentobox.bbox.api.user.User; +import world.bentobox.bbox.database.objects.Island; +import world.bentobox.bbox.managers.LocalesManager; +import world.bentobox.bbox.util.teleport.SafeSpotTeleport; +import world.bentobox.bbox.util.teleport.SafeTeleportBuilder; @RunWith(PowerMockRunner.class) @PrepareForTest(SafeTeleportBuilder.class) @@ -29,7 +31,7 @@ public class SafeTeleportBuilderTest { @Mock private SafeSpotTeleport sst; @Mock - private BSkyBlock plugin; + private BentoBox plugin; @Mock private Player player; @Mock