Commit Graph

837 Commits

Author SHA1 Message Date
tastybento
58253eb7d7 Implements gamemode-specific flags API (#541)
* Implements gamemode flags API

https://github.com/BentoBoxWorld/BentoBox/issues/406

* New and improved
2019-02-13 07:58:33 +01:00
tastybento
f89419f3d8 Made declaring the player mandatory when calling FlagListener#checkIsland(...) (#543)
* WIP - See FlagListener.java for changes

Makes declaring the player mandatory for checkIsland method so it cannot
be forgotten and will be fresh every check.

See BlockInteractionListener for how it will look.

* Update src/main/java/world/bentobox/bentobox/api/flags/FlagListener.java

Co-Authored-By: tastybento <tastybento@users.noreply.github.com>

* Update src/main/java/world/bentobox/bentobox/api/flags/FlagListener.java

Co-Authored-By: tastybento <tastybento@users.noreply.github.com>

* Adjusted all the flags to new API
2019-02-13 07:55:36 +01:00
tastybento
75c9f6fb2c Enables dragon to be summoned using /summon command
https://github.com/BentoBoxWorld/BentoBox/issues/522
2019-02-11 19:11:48 -08:00
tastybento
179a71b548 Get island by its UUID API added
https://github.com/BentoBoxWorld/BentoBox/issues/341
2019-02-11 19:01:44 -08:00
tastybento
9dfb0573d9 Adds test class for Island Sethome command.
Refactors some of IslandSethomeCommand class to use the new canExecute
method.
2019-02-11 15:54:15 -08:00
tastybento
ac2e3596f7 Made admin unregister command confirmable.
Uses new canExecute API.
Also correctly removes any island members from the island.
2019-02-10 21:57:58 -08:00
tastybento
04e4b2dbe5 Merge branch 'develop' of https://github.com/BentoBoxWorld/bentobox.git into develop 2019-02-10 15:36:46 -08:00
tastybento
8334de8cba Fixes island pasting issue when pasting clipboard every tick.
https://github.com/BentoBoxWorld/BentoBox/issues/535

due to race conditions with task timers and incorrectly shared field
variables, islands would not paste completely if pasted every tick.
Now pasting is handled in its own class with a new instance created with
each paste.
2019-02-10 15:36:37 -08:00
Florian CUNY
a2607c913f Fixed AdminDeleteCommand tests (oopsie) 2019-02-10 22:59:03 +01:00
Florian CUNY
0fd043df23 Partially fixed island owner losing inventory on /is team kick
Partially fixes #521.
See https://github.com/BentoBoxWorld/BentoBox/issues/521#issuecomment-462128961 for reference.
2019-02-10 13:34:17 +01:00
Florian CUNY
b8afd1919f Added Flags#TREES_GROWING_OUTSIDE_RANGE
#512
2019-02-09 11:39:12 +01:00
Florian CUNY
af96055753 Added testHasNotPermissionButIsOp in UserTest 2019-02-08 21:25:40 +01:00
tastybento
446028fbae Revert "Reworks how dragons are removed."
This reverts commit af9de5580a.
2019-02-05 22:54:48 -08:00
tastybento
af9de5580a Reworks how dragons are removed.
Enables manual summoning of end dragons

https://github.com/BentoBoxWorld/BentoBox/issues/522
2019-02-05 18:37:05 -08:00
tastybento
3ccd19bf9c Fix locales to show correctly based on GameMode and locations
Fixes console translations too.

https://github.com/BentoBoxWorld/BentoBox/issues/519
2019-02-04 23:02:07 -08:00
tastybento
fd882c018b Fixes enderchest world setting
It was being double handled by two listeners.

Fixes:
https://github.com/BentoBoxWorld/BentoBox/issues/516
2019-02-04 22:01:43 -08:00
tastybento
f4c149dd6f Moved test classes to match src packages 2019-02-04 20:39:21 -08:00
tastybento
7c099d941f Added IslandWorldManager test class
Fixed bugs found in IWM
2019-02-03 19:13:14 -08:00
Florian CUNY
1c06584131 Added Flags#LIQUIDS_FLOWING_OUT
Also fixed some Javadoc in Flags, and I've also done my very first test unit!

#511
2019-02-03 14:05:28 +01:00
Florian CUNY
30fb7820fc Minor modifications to ObsidianScoopingListenerTest 2019-02-03 13:59:00 +01:00
Florian CUNY
ea12d8c167 Moved all the flags listeners to subpackages 2019-02-03 10:22:44 +01:00
tastybento
f60a39a543 Fires team and island events. Adds new events.
A lot of the commands were not firing events. These events are now
needed by addons.

Added new JOINED, REGISTERED, UNREGISTERED reasons for events.

Switched to using Bukkit.getServer() instead of plugin.getServer() in a
number of classes because the former can be mocked but the latter cannot
be because it's marked as a final method in JavaPlugin.
2019-02-02 20:40:44 -08:00
Florian CUNY
18eba5725c Uncommented out a failing test and added a Ignore annotation to it 2019-02-02 14:04:01 +01:00
Florian CUNY
de69c9c571 Removed deprecated FlagsManager#getFlagByID(String)
This method was actually still used in some classes, so I had to fix them as well.
2019-02-02 11:06:59 +01:00
tastybento
f983aa5f44 Fixed permission bug with custom schems and reset
https://github.com/BentoBoxWorld/BentoBox/issues/509
2019-02-01 20:51:57 -08:00
tastybento
f351704e8a Prevent placing of armor stands
https://github.com/BentoBoxWorld/BentoBox/issues/507
2019-02-01 19:44:46 -08:00
tastybento
8dbf7ec231 Admin team add command was not adding players correctly.
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/506

Also, admin unregister was blocking unregistration of team players, but
that is an artificial constraint, so I enabled it. Without it, it would
not be possible to correct weird team issues like this one after they
happen.
2019-01-30 17:27:53 -08:00
tastybento
46cc901c23 Adds support for ItemStack storage in non-YAML databases.
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/501
2019-01-28 18:29:17 -08:00
tastybento
04fa7fab80 Fixes issue with missing user assignment of potion thrown
Adds test for throwing potion class.

https://github.com/BentoBoxWorld/BentoBox/issues/493
2019-01-27 19:51:03 -08:00
tastybento
db932dd836 Fix for LogEntry serialization.
https://github.com/BentoBoxWorld/BentoBox/issues/486

Includes an autofixer for corrupted files and test for the adapter.

LogEntry was changed to just store strings instead of arbitrary types.
Unless the log serializer were to store hints as to what type of data
was being stored, it is impossible to deseralize. To make it all
simpler, we just store strings. If the UUIDs need to be converted back
to players are some point, that can be done based on the type of the log
stored.
2019-01-26 15:32:52 -08:00
tastybento
4e81baf45e Flags are requested from FlagManager not statically
Previous the Flags class was being used to grab all flags. This is wrong
because it may not contain all the flags that may exists, for example
ones registered by other addons. The correct way is to request flags
using the getFlag() method in the flags manager class.
This change was to prepare for the time when addons will register their
own flags with BentoBox.
2019-01-26 09:39:34 -08:00
Florian CUNY
5a573bdbbe Fixed tests 2019-01-20 10:00:17 +01:00
tastybento
2df5d2a916 Added FlagAdapterTest and fixed deprecation 2019-01-19 08:30:42 -08:00
Florian CUNY
5ce8362fd5 Added addons metrics chart + added AddonDescription#isMetrics so that addons need to explicitely opt in
Deprecated AddonDescription.Builder#Builder(String, String) and AddonDescription.Builder#version(String).
Added AddonDescription.Builder#Builder(String, String, String).
Updated tests
2019-01-18 22:06:06 +01:00
Florian CUNY
0f5b5b5693 Fixed IslandResetCommand tests 2019-01-18 21:24:46 +01:00
Florian CUNY
d57f9544f3 Added NonNull/Nullable annotations to IslandsManager and IslandCache 2019-01-18 11:33:29 +01:00
tastybento
49d2365f85 Removed unneeded commented out code 2019-01-15 15:46:59 -08:00
tastybento
016c502b66 Added explicit test for addon locale override 2019-01-15 15:43:37 -08:00
tastybento
0636532bb4 Fixed code and tests.
Test failures in the User test were right - I had a bug in my code.
2019-01-15 15:23:17 -08:00
tastybento
fa8c0ec0c8 Implements async superflat cleaning
Should avoid crashes when there's a lot of cleaning to do.

https://github.com/BentoBoxWorld/BentoBox/issues/431
2019-01-13 15:53:12 -08:00
tastybento
96639792b8 Fixed random test failures.
Note: If using the User class in a test, you MUST set the mock plugin object using the User.setPlugin() method otherwise each test will use the wrong plugin object and verifications will not work.
2019-01-13 14:19:23 -08:00
tastybento
5f990b9103 Fix for PhysicalInteractionListenerTest
Sometimes would randomly fail. This should fix it. (He says...)
2019-01-13 09:07:05 -08:00
tastybento
8a1b487a58 Fix test cases for ban commands. 2019-01-13 08:52:57 -08:00
Florian CUNY
0f253c35ef Renamed IslandDeleteManager to IslandDeletionManager 2019-01-13 10:09:35 +01:00
tastybento
501c3257ed Island delete enhancements
Island deletion is done a few chunks at a time per tick. Current speed
is 5 chunks per tick per world (e.g., 15 chunks per tick if nether and
end islands are used).

Chunks are deleted based on the all-time maximum protection range of the
island. This is because the protection range can grow bigger or smaller
over the island's lifetime. To ensure all possible chunks are erased,
the largest every protection range is remembered and used.

Very large protection ranges will take a long time to fully delete.

Info on islands that are being deleted is stored in the database. If the
server shuts down mid-deletion, deletion will restart when the server
restarts.

While an island is being deleted, new islands cannot occupy that spot
and the spot cannot be reserved by the admin.

In addition, async approaches to island saving and player saving were
removed. Async will be implemented another way.

Now, instead of saving the full island or player database, individual
database entries are saved instead to be more efficient.
2019-01-12 17:12:30 -08:00
tastybento
b51178518a Fixes admin setowner and info commands for team members
https://github.com/BentoBoxWorld/BentoBox/issues/452
2019-01-07 21:37:37 -08:00
tastybento
cd4f0c2561 Fixes Invincible Visitors Settings GUI bug
https://github.com/BentoBoxWorld/BentoBox/issues/450

Added enhanced test to this class too.
2019-01-07 21:03:02 -08:00
tastybento
acb6cd5650 Added defensive null checking code to DB
Relates to https://github.com/BentoBoxWorld/BentoBox/issues/447
2019-01-07 07:46:59 -08:00
Florian CUNY
8da1dc1590 Ignoring IslandBan- & IslandUnbanCommand tests for now
I could not get them to work again
2019-01-05 10:58:32 +01:00
Florian CUNY
f75de015a2 Started working on AddonsManagerTest 2019-01-04 21:31:22 +01:00
tastybento
d13ae470d5 Removed unused imports. 2019-01-03 10:25:03 -08:00
tastybento
5351b162c5 Moved obsidian scooping to be a world flag in settings 2019-01-03 09:46:56 -08:00
Florian CUNY
9f676636e0 Fixed some code smells 2019-01-03 17:09:27 +01:00
Florian CUNY
2e2c7c69de Removed deprecated classes 2019-01-03 16:51:57 +01:00
Florian CUNY
708c014d14 Moved allowObsidianScooping to WorldSettings and renamed ObsidianToLava to ObsidianScoopingListener
#432
2019-01-03 16:30:36 +01:00
Florian CUNY
c549d969a4 Removed 'island.custom-ranks' from config
#432
2019-01-03 16:17:01 +01:00
Florian CUNY
369600e4d5 Renamed Island#addToBanList() and Island#removeFromBanList() + added log in them
They respectively got renamed to Island#ban() and Island#unban(). They now require the UUID of an issuer (which can be null, but it's better to provide one)
2019-01-03 15:59:24 +01:00
tastybento
5f193b19f5 Merge remote-tracking branch 'origin/develop' into async-paste2 2019-01-02 10:44:50 -08:00
Florian CUNY
c7a85c2b5a Fixed AddonDescription to use a valid Builder pattern
AddonDescriptionBuilder has been renamed to AddonDescription.Builder ; and there is no longer public constructors in this class.

This change is obviously API breaking, but it's relatively "internal", so hopefully people didn't use it.
2019-01-02 17:28:11 +01:00
Florian CUNY
01b7ace0be Fixed code smells 2019-01-02 14:48:17 +01:00
Florian CUNY
c078d8dce6 Added ban limit (#getBanLimit() in WorldSettings)
Closes #423.

I had some trouble with unit testings, that's why I didn't update them to test the new features :(
2019-01-02 14:37:52 +01:00
tastybento
9b44dbb113 Fixes tests.
I made pasting the clipboard async as well so this affected the test.
2019-01-01 14:11:41 -08:00
tastybento
2528442d6b Rewrote using state approach to be easier to understand.
Backwards compatible with current schems. New schems required to avoid
torch popping etc. Look for updates to AcidIsland and BSB.
2018-12-31 11:24:24 -08:00
tastybento
38e82ee617 WIP: Enables async-style pasting of schems.
Speed of schem pasting is in the config.yml of BentoBox.

Old schems will work and paste async, but attached blocks, e.g.,
torches, may fall off due to being pasted ticks before the supporting
block is pasted. Newer schems will not have this issue.

Further work is needed to optimize entity pasting.

Known issue: if a player logs out during the pasting, things go wrong
until the next reload. Needs investigation and mitigation.

There's no mitigation against the server shutting down or crashing
mid-paste.
2018-12-30 20:34:50 -08:00
tastybento
c4a5eb2c88 WIP pastes but attachments fall when split across paste boundaries 2018-12-30 18:09:56 -08:00
tastybento
d7851b923e Fixes reload of locales from addons
This was a bigger job than expected. I moved the addon loading locale
stuff into the LocalesManager class from the AddonsManager and put a jar
file lister in Utils. There could be some more combining of plugin jar
and addon jar file finding there. Finally, I added a sophisticated test
that creates a temporary addon jar with a locale file and checks that it
is saved correctly. Phew!
2018-12-25 23:17:06 -08:00
Florian CUNY
d24d61480b
Merge pull request #409 from BentoBoxWorld/flag-builder-v2
Nesting Flag builder in Flag
2018-12-24 09:32:09 +01:00
tastybento
68d6b008f4 Fixed tests by fixing the default rank value.
Flag was marked as deprecated, which may be okay, but because it caused
a lot of warnings in the tests because they bypass the builder I removed
the deprecation but kept the warning in the JavaDoc.
2018-12-23 22:15:37 -08:00
tastybento
0adc2e3078 Uses current API to enable multiple schems.
This will load all schems in an add-on's schem folder if it exists and
associate them with this world set (overworld, nether and end). Schems
can be named anything, but the partner nether or end worlds must be
pre-fixed with "nether-" or "end-" in the filename.
Additional schems can be added by the admin into the schem folder, or
they can be stored in the jar file of the add-on. Both are supported.

No changes are required to current add-ons. I.e., there is no API
breakage here, but I would like to rename the SchemsManager method
loadIslands(World world) to be loadSchems(World world) in the future.

Related issues/PR:
https://github.com/BentoBoxWorld/BentoBox/issues/104
https://github.com/BentoBoxWorld/BentoBox/issues/207
https://github.com/BentoBoxWorld/BentoBox/issues/378
https://github.com/BentoBoxWorld/BentoBox/pull/408
2018-12-23 19:31:00 -08:00
tastybento
d907506fda Adds ability for the start sign to use a locale file set by the addon
https://github.com/BentoBoxWorld/bentobox/issues/372

Signs must have [start] as their first line to be converted.
2018-12-20 14:01:42 -08:00
tastybento
a7365ef805 Fixes chunk deletion bug and corrects chunk calculations elsewhere.
https://github.com/BentoBoxWorld/bentobox/issues/405

Adds test class for DeleteIslandChunks class.
2018-12-19 22:15:38 -08:00
tastybento
ee4a0d7cfc Added tests for LocalesManager
Covers https://github.com/BentoBoxWorld/bentobox/issues/385
2018-12-16 00:35:25 -08:00
tastybento
b556b7160e Fixes reload bug when locale folder is missing.
https://github.com/BentoBoxWorld/bentobox/issues/385
2018-12-15 23:38:20 -08:00
Florian CUNY
7dd06b9d9b Fixed tests
They were broken as of 8a16940e14
2018-12-15 10:30:17 +01:00
Florian CUNY
fa5c7905da Deprecated Island#showInfo() and Island#showMembers() that were using useless parameters
Replaced them with equivalents only requiring an User as parameter.
2018-12-13 10:10:05 +01:00
tastybento
01b0c2004b Added ExperiencePickupListener unit test. 2018-12-13 08:48:40 +09:00
tastybento
1a1fe14775 Merge branch 'develop' of https://github.com/BentoBoxWorld/bentobox.git into develop 2018-12-09 22:54:44 -08:00
tastybento
3e07554d3b Fixed bug where animals could be bred or fed to grow up.
https://github.com/BentoBoxWorld/bentobox/issues/366
2018-12-09 14:09:53 -08:00
Florian CUNY
b20ef00853 Updated locales to replace all references of "leader" to "owner"
The island owner is no longer both known as "owner" or "team leader" depending on the methods you're using : it's "owner" everywhere now. Period. 🎉
2018-12-09 13:41:09 +01:00
Florian CUNY
607db5b07f Removed some 'throws IOException' in IslandResetCommandTest 2018-12-09 13:20:49 +01:00
Florian CUNY
ae23ad913a Renamed general.errors.not-leader to general.errors.not-owner 2018-12-09 13:18:24 +01:00
Florian CUNY
a04a0cb3d0 Replace code referencing "teamleader" to "owner"
This will improve the consistency of the code, as well as the Javadocs.

Locales (and some other files) still need to be updated to remove these references to team leader.
2018-12-09 11:28:31 +01:00
tastybento
33c374c52d Fixed NPE on portal use when there is no Nether world
https://github.com/BentoBoxWorld/bentobox/issues/365
2018-12-08 19:24:31 -08:00
tastybento
693c6ab17e Completes turtle protection update.
https://github.com/BentoBoxWorld/bentobox/issues/348
2018-12-01 10:51:20 -08:00
tastybento
46bb958a6d Added protection against turtle egg crushing.
Added test class for physical interactions.

EWR -> DEN
2018-11-30 18:49:58 -05:00
tastybento
c88ea31237 Fixes tab complete error with no island.
EWR ->  DEN
2018-11-30 17:39:24 -05:00
tastybento
0bd800ac09 Added test class for BentoBoxLocale
United flight LAS -> EWR almost in New York
2018-11-29 13:05:32 -08:00
tastybento
98264f03d0 Fixed armor stand moving by rods.
https://github.com/BentoBoxWorld/bentobox/issues/350

Added test cases, but more to add.
2018-11-20 14:29:56 -08:00
tastybento
ffd1af5867 Removes coop on logout of cooped player or server shutdown.
https://github.com/BentoBoxWorld/bentobox/issues/335
2018-11-20 12:52:12 -08:00
Florian CUNY
0322ffe0ce Deprecated #getTeamLeader(...) methods
These have been deprecated in CompositeCommand, IslandCache and IslandsManager and they got replaced by #getOwner(...).
2018-11-18 11:12:54 +01:00
Florian CUNY
c3ca82e12a Fixed the ENDER_CHEST flag not using the Notifier 2018-11-11 10:37:08 +01:00
tastybento
c2e9490bb0 Added min/max options for cycle click and restricted lock flag.
https://github.com/BentoBoxWorld/bentobox/issues/332
2018-11-10 19:28:46 -08:00
tastybento
68873e033f Added defensive code to handle island adding to grid.
When an island cannot be added to the grid, it should show some helpful
console error.

Related to https://github.com/BentoBoxWorld/bentobox/issues/326
2018-11-10 10:04:37 -08:00
Florian CUNY
d507efbe77 Fixed obsidian scooping replacing whole bucket stack with lava buckets
Fixes #338.
2018-11-10 10:04:10 +01:00
Florian CUNY
09905ab018 Renamed AbstractFlagListener to FlagListener 2018-11-04 16:40:20 +01:00
Florian CUNY
3e284b90eb Fixed protection listeners not being registered to Bukkit
Basically removed the "plugin loaded" limitation.
2018-11-03 11:31:08 +01:00
Florian CUNY
480d3f78d9 Added world condition in IslandsManager#userIsOnIsland
The world parameter was previously unused.
I also updated javadocs ; as well as the tests. Everything seems to be working fine.
2018-11-01 16:34:19 +01:00
tastybento
d9783c8d73 Fix for issue where team members are sometimes not recognized.
https://github.com/BentoBoxWorld/bentobox/issues/318
2018-10-30 13:21:27 -07:00
Florian CUNY
0dc9de9c37 Fixed broken file renaming
Well... Hopefully it'll fix it
2018-10-28 14:33:36 +01:00
Florian CUNY
6dd02a15b7 Made use of Addon.State
Fixes #281
Replaced Addon#setEnabled(boolean) with Addon#setState(Addon.State).

Now, if an exception gets thrown while enabling an addon, it'll automatically stop enabling it and set its state to "INCOMPATIBLE" or "ERROR". These values could later be get to be displayed in the version command.
2018-10-28 11:12:00 +01:00
Florian CUNY
e930510243 Renamed TestBSkyBlock to TestBentoBox 2018-10-28 10:34:22 +01:00
Florian CUNY
14a794a5b1 Lowercased some command class names to better fit how they are actually working in game 2018-10-28 10:27:01 +01:00
Florian CUNY
13c483e5eb Renamed AdminTeamMakeLeaderCommand to AdminTeamSetOwnerCommand 2018-10-28 10:19:14 +01:00
Florian CUNY
20b6c4a7cb Fixed tests and commands relying on previously broken API
Mistakenly pushed the previous changes on develop before committing these fixes.
2018-10-27 16:52:07 +02:00
Florian CUNY
95bfab916e Replaced Util#getPermValue(Player, String, int) with User#getPermissionValue(String, int) 2018-10-20 11:32:42 +02:00
tastybento
84a79fe1de Fixed and added tests for new deathCount option
Fixes test failures from commit a6d25d68a9

I added some more tests to check for in world as well as death count
being on/off.
2018-10-07 18:28:48 -07:00
tastybento
14b7a3aa82 Fixed teleporting to an island by using a member's name
https://github.com/BentoBoxWorld/bentobox/issues/300
2018-10-07 18:15:18 -07:00
tastybento
b83e5d4a56 Fixed tests for Invincible visitors. 2018-10-05 17:34:21 -07:00
tastybento
0f5ab8ab7d Added inWorld(World.class) to IWM
This had a ripple affect through the tests because now there are two
inWorld() methods - one for Location and one for World.
2018-09-29 09:01:20 -07:00
tastybento
2df049f70d Implements protection for standard Nether and End
This was missing so it needed to be added.

Related to: https://github.com/BentoBoxWorld/addon-bskyblock/issues/9
2018-09-25 22:20:30 -07:00
tastybento
86d40ca126 Fixed issue where standard Nether is protected.
Also applies to standard End.

https://github.com/BentoBoxWorld/addon-bskyblock/issues/9
2018-09-25 20:45:43 -07:00
tastybento
0f371f4800 Removed unneeded imports and code. 2018-09-25 20:05:23 -07:00
Florian CUNY
58de346dc9 Various changes to SafeSpotTeleport
* Replaced SafeTeleportBuilder by SafeSpotTeleport.Builder
* Added "overrideGamemode" parameter
* AdminTeleportCommand no longer overrides the player's gamemode when teleporting (fixes #262 )
2018-09-15 12:38:51 +02:00
Florian CUNY
02be048192 Removed "general.errors.unknown-player-name" : added a "[name]" textvariable in "general.errors.unknown-player"
Closes #263
2018-09-15 10:39:16 +02:00
tastybento
d744b58638 Fixed tests
Created two new tests:

1. A test that closing inventory does not happen unless it is a known
panel.
2. A test that verifies known panels are closed.
2018-09-08 10:35:40 -07:00
Florian CUNY
918f6de782 Fixed clicking outside of inventory closing it
I edited it so it only happens on BentoBox's panels. Having it closing "every" inventory was causing issues with vanilla inventories (crafting table, etc...)

I could not fix the related tests though : PanelListenerManagerTest#testOnInventoryClickOutside (PanelListenerManagerTest.java:128) is failing every time.
2018-09-08 17:12:15 +02:00
tastybento
505624b45c Fixes tests. Also fixes a bug.
https://github.com/BentoBoxWorld/bentobox/issues/258
2018-09-02 20:45:31 -07:00
Florian CUNY
a12eec7a6b Fixed Invincible Visitors unit testing 2018-08-31 21:12:44 +02:00
Florian CUNY
24d783be24 Cleanup in Settings
Removed purge-related settings.
Renamed all database-related settings and methods to replace `db` with `database`.
Moved confirmationTime to `island.confirmation.time`.
Renamed inviteWait, banWait and resetWait to inviteCooldown, banCooldown, resetCooldown. Also moved them under `island.cooldown.x`.
Removed kickWait and leaveWait, using confirmationTime instead.
Moved `island.require-confirmation.<command>` to `island.confirmation.commands.<command>`.
Updated tests.
Updated getters and setters using code automation. Sadly, this wiped out all the Javadoc.
2018-08-31 11:06:37 +02:00
tastybento
4eadd259f7 Added PanelBuilderTest and fixed bug in PanelBuilder
nextSlot() was not giving next slot after an assigned slot.

11600ft and descending into SFO. 14 miles out.
2018-08-31 07:28:02 +09:00
tastybento
f3bd4fa621 Removed unused import 2018-08-25 12:27:32 -07:00
tastybento
06f7b754b7 Removed enderman death drop flag. 1.13 drops blocks anyway. 2018-08-25 12:27:21 -07:00
tastybento
9e2c2c7dbc Adjusted remove rank test 2018-08-25 12:27:00 -07:00
tastybento
474de77ce2 Added death listener.
Counts player deaths in any game world.

Fixes https://github.com/BentoBoxWorld/addon-level/issues/18
2018-08-22 23:46:24 -04:00
tastybento
9b1c7f10ab Added Clipboard test class and improved Clipboard robustness
Flight # 2533
RDU to PHX
Above Memphis, TN
Altitude
38,006 ft
Ground speed
464 mph
2018-08-22 18:40:44 -04:00
tastybento
9847235df1 Fixes MySQL exists and delete functions. 2018-08-18 09:53:21 -07:00
tastybento
ec005569a1 Fixed tests for EnterExitListenerTest 2018-08-16 10:38:35 -07:00
tastybento
3f7198da25 NPE's fixed. Tests need to be fixed now. 2018-08-16 08:53:31 -07:00
tastybento
68624d2879 Removed unused imports. Removed unused classes InventorySave/Store 2018-08-15 20:30:34 -07:00
Florian CUNY
7815c837dd Deleted FlyingMobEvents (duplicate of GeoLimitMobs)
And also fixed a code smell with metrics method names in IslandsManager
2018-08-15 10:52:10 +02:00
Florian CUNY
82ebc8b018 Revert "Fixed IslandCacheTest"
This reverts commit 8fb4e58994.
2018-08-15 09:51:41 +02:00
Florian CUNY
539d2a0516 Fixed some code smells 2018-08-15 09:43:28 +02:00
Florian CUNY
e11f173ca3 Made /is reset use the command cooldown API + switched "wait" settings to int
Aaaand had to update some tests. Lots of tests.
2018-08-14 21:11:46 +02:00
Florian CUNY
8fb4e58994 Fixed IslandCacheTest
Also commented out CellState.RESERVED.

That was a tough one. I had to rewrite IslandGrid#getIslandAt(int, int) quite a few times before using the stream() thing. I tested it a bit - it seems it is working like a charm.
I just hope that it won't be something useless - another plumbing change that adds nothing. It shouldn't - because of the "RESERVED" thing - but, well... it's been quite a hard thing!
2018-08-14 11:38:44 +02:00
Florian CUNY
4af03ee939 Fixed EnterExitListenerTest 2018-08-14 11:04:28 +02:00
Florian CUNY
2c16f88013 Updated tests 2018-08-13 21:05:47 +02:00
tastybento
6eeff3f383 Added test classes for coop, uncoop, trust and untrust commands. 2018-08-12 17:15:11 -07:00
tastybento
c1a6a233a9 Added team coop, uncoop, trust and untrust commands. 2018-08-12 16:43:47 -07:00
tastybento
82c35f9aa9 Fixed test breaks. 2018-08-12 14:28:25 -07:00
tastybento
bcb44c4cce Fixed PlayerManager tests. 2018-08-12 04:14:07 +09:00
Florian CUNY
9c240fbf54 Fixed tests in DefaultHelpCommandTest 2018-08-11 14:39:12 +02:00
tastybento
ea0f64a770 WIP added AdminDeleteCommand 2018-08-09 05:13:54 +09:00
Florian CUNY
cd7f8ddf24 Commented the failing test out, so Travis builds again 2018-08-07 16:02:54 +02:00
Florian CUNY
90a868bc40 Updated ItemParser to use the new banner materials 2018-08-07 16:02:29 +02:00
Florian CUNY
e232452f65 Fixed 2 out of 3 tests 2018-08-07 10:44:13 +02:00
Florian CUNY
cfbf3df1c3 BREAKING: Renamed [...]DatabaseConnecter to [...]DatabaseConnector
It was a typo shown by IntelliJ
2018-08-06 15:32:15 +02:00
Florian CUNY
5fa8f3997f BREAKING: Renamed a few API classes to a more generic name
`BBConfig` to `Config`.
`BBDatabase` to `Database`.
`BBDbSetup` to `DatabaseSetup`.

Sorry @tastybento, hope it won't bother you too much :/
2018-08-06 15:19:06 +02:00
tastybento
ba557a1068 API Breaker: renamed BSB classes to be just BB
Hopefully, this is the last API breaker. I renamed the classes that
started with BSB to be just BB (bentobox). I now have to fix all the
add-ons I just broke...
2018-08-05 20:08:03 -07:00
tastybento
cfdabbb176 Removed AboutCommand test to get a clean build.
Please see my comment on the commit. Final classes can't be mocked (as
far as I know) so it's kinda impossible to make a test for this one.
2018-08-05 20:00:23 -07:00
Florian CUNY
f8366cafec Started a test unit for AboutCommand 2018-08-05 10:56:15 +02:00
tastybento
765268aa25 Code cleanup using Intellij 2018-08-04 21:50:10 -07:00
tastybento
1256b0ee22 Added a bentobox command
Added reference about and info commands. These command run across worlds
and currently have no perms associated with them.

The main point was to enable BentoBox to have is own commands.
2018-08-04 20:43:38 -07:00
tastybento
783caf985f Added generic cooldown methods to CompositeCommand
This API enables any command to have a cool down and to have that cool
down called by another command. For example, the Kick command sets the
cool down on the Invite command. It is possible for commands to set cool
downs on themselves too.
Currently, cool downs are not stored persistently in the database so
they disappear if the server is reloaded. This should be okay for now.
2018-08-04 18:45:13 -07:00
tastybento
2cc6d36997 Reworked test classes for managers
There are some weird NPE's that I couldn't work out in the test classes.
They do not occur when the class is run by itself, only when it is run
with all the others so I don't know why it is happening.
2018-08-04 10:13:08 -07:00
tastybento
25164d824b Rewrote IslandsManager test class 2018-08-04 09:37:21 -07:00
tastybento
08604fc27d Rewrote PlayersManagerTest class 2018-08-04 09:21:24 -07:00
tastybento
53f28eb68d Changed island team kick to use confirm API
Fix for:
https://github.com/BentoBoxWorld/bentobox/issues/214
2018-08-03 19:22:35 -07:00
tastybento
bad870d3da Reapplied commit to improve Maven.
Fixed test class failure.
2018-08-03 19:10:09 -07:00
tastybento
3c74ef0694 Moved admin and island commands into API package 2018-08-02 19:26:46 -07:00
tastybento
4a1dede795 Removed deprecated calls from IslandsManager for trapdoor check 2018-08-02 19:01:23 -07:00
tastybento
a9da00478d Fixed EndermanListenerTest class to use BlockData properly. 2018-08-01 18:19:47 -04:00
tastybento
df5d63acf0 Clean up on the test classes for 1.13. 2018-08-01 10:12:43 -07:00
tastybento
4fab167d10 Fixed build errors.
Reverted back the generic commands for use by addons.

WIP - some tests need fixing for 1.13.
2018-08-01 08:55:48 -07:00
tastybento
cbc27ae715 Revert "Removed commands test units"
This reverts commit efb2adb455.
2018-08-01 08:29:20 -07:00
Florian CUNY
138b8e7568 Updated test units to 1.13 API 2018-08-01 11:21:29 +02:00
Florian CUNY
efb2adb455 Removed commands test units 2018-08-01 11:02:13 +02:00
Florian CUNY
3473fb48e6 Renamed 'world.bentobox.bbox' to 'world.bentobox.bentobox' 2018-07-31 18:03:32 +02:00
tastybento
c7ff1bbae4 Converted references of BSkyBlock to BentoBox 2018-07-29 17:09:48 -07:00
tastybento
f2831c7258 Improved addon loading error reporting
Fixed a bug in the team invite error strings.
2018-07-29 16:56:14 -07:00
tastybento
6d22f199ee Rewrote to try to make test pass on Travis
It works locally!
2018-07-29 14:28:28 -07:00
tastybento
bc1a73975e Make flag explicitly set to false for test. 2018-07-29 13:58:12 -07:00
tastybento
268a301a47 Switch to BentoBox 2018-07-29 13:21:46 -07:00
tastybento
9c41ceb5f2 Added clear resets and clear reset all admin commands.
Clear reset all uses a timestamp stored in config.yml. If a player logs
in and the last time they logged in was before that timestamp, then
their resets are cleared. Note that as opposed to ASkyBlock, the player
object stores the number of resets done for a world and not the number
of resets left. This is a better design because it means that admins can
change the max number  of resets and every player file does not have to
be adjusted.

Location of commit (30,000ft above Nevada desert, just coming into Las
Vegas).
2018-07-25 09:47:57 -07:00
tastybento
541ee35256 WIP - clear reset all command 2018-07-25 07:04:40 -07:00
tastybento
944ab36488 Finished ItemFrameListener and test. 2018-07-21 21:48:22 -07:00
tastybento
984de1cd07 Added ItemFrame protection from mobs flag and test class. 2018-07-21 21:10:07 -07:00
tastybento
71e79db0a9 Added Enderman protection flags and tests. 2018-07-21 16:48:53 -07:00
tastybento
1251ea60d1 Added chest damage listener test class. 2018-07-21 14:18:35 -07:00
tastybento
b72d1853b5 Added Range command tests and put in some locale messages. 2018-07-21 14:06:40 -07:00
Florian CUNY
f10c2da7d3 Code smells ; minor code format issues 2018-07-20 14:37:11 +02:00
Florian CUNY
a5a1ccb7e5 Fixed bug with protection range (in Island)
minX, minZ, minProtectedX and minProtectedZ are no longer variables : to get them, we have to use the related methods. As they get recalculated at each call, it ensures they follow the changes (especially with the protectionRange)
2018-07-19 12:58:59 +02:00
Florian CUNY
2e26c6a20c BREAKING CHANGE: now BSBCommand#execute(User, String, List<String>) !!! 2018-07-18 15:36:57 +02:00
Florian CUNY
0f61049502 Moved commands/island/teams to commands/island/team 2018-07-18 14:45:14 +02:00
Florian CUNY
fd36b0a9eb Renamed commands/admin/teams to commands/admin/team 2018-07-18 14:13:43 +02:00
tastybento
720e6bbe6b Added WaterIsNotSafe setting to WorldSettings
This flag is used to indicate whether being waste-deep in water is a
safe home location or not. On SkyBlock is it fine, on AcidIsland it is
not. So that's why this definition is required.

Removed unused @deprecation header. I assume switching to Spigot API
made these superfluous.
2018-07-17 18:48:50 -07:00
tastybento
b1a131fa84 Delay registering flag listeners until plugin is loaded.
Reworked test classes to avoid running the Bukkit server.
2018-07-17 18:32:28 -07:00
tastybento
ee440b4f0d Fix for null entities.
https://github.com/tastybento/bskyblock/issues/206
2018-07-17 07:54:22 -07:00
tastybento
5572875257 Added global TNT on/off flag
Protects against visitors priming TNT too.
Test class is just "happy path".

Fixed bugs with other flags around fire extinguish.
2018-07-16 19:00:12 -07:00
tastybento
ec0a6bdd73 Fixed issue with dots in map keys for YAML saving
YAML cannot handle dots in keys, so they need to be converted to
something else. I chose :dot:. This issue occurred because location
coordinates were saved with .'s in them. Actually, there is no
real value in saving such accurate locations, so in addition to
keeping the dot escape system (just in case), I changed locations
to just save as ints and then when they are loaded, x and z have
0.5D added to them to center the location. This should be
sufficient accuracy for any location storage and it also reduces
the file size a lot.
2018-07-14 11:14:51 -07:00
tastybento
2b024d035b Removed unused imports 2018-07-14 09:14:42 -07:00
tastybento
b431b9a092 Added lock and ban bypass via Op or perms.
https://github.com/tastybento/bskyblock/issues/201
2018-07-13 17:27:03 -07:00
tastybento
26200ae951 Fixed issues with self-inflicted damage.
https://github.com/tastybento/bskyblock/issues/203
2018-07-13 17:02:57 -07:00
tastybento
4003f839ed Added Island Go test.
https://github.com/tastybento/bskyblock/issues/205
2018-07-13 16:39:02 -07:00
Florian CUNY
712e335814 Renamed ClickListeners and made most of them setup "by default" to avoid boilerplate code 2018-07-13 17:29:17 +02:00
tastybento
451756bc81 Added clean super-flat world setting and test 2018-07-12 21:25:07 -07:00
tastybento
c64ecf76af Fixed admin command tab complete for Ops
Tab complete values are sorted now too.
2018-07-12 08:15:24 -07:00
tastybento
60a0c486f3 Added Banned Visitor Commands and test 2018-07-11 21:55:00 -07:00
tastybento
94bc2355ac Fixed test failures.
Fixed bug where spawn locs could be null.
2018-07-10 21:42:05 -07:00
tastybento
9021df099a Added permissions to settings.
Added test for Inv Visitors.

Default perms need to be added to plugin.yml or addon.yml for settings.
2018-07-08 16:45:17 -07:00
tastybento
13a246df59 Fixed bugs
Admin tp was not tp'ing to correct world
Dragon Eggs were unprotected.
Changed name of BSB getWorld methods to be more specific so they are not
used accidentally to get the general world.
2018-07-07 15:52:47 -07:00
tastybento
4963ea573c Added offline redstone world flag
Removed constructor from LockAndBanListener. Due to loading order, some
manager objects are null. Flags load very early so must assume
everything is null.
2018-07-06 10:05:00 -07:00
tastybento
2b5664c7ff New island checking improved to avoid infinite loop
If a world has the generator malfunctioning the server can crash if
there's no clear spot for an island. This limits the number of spots to
find an island to 10.
2018-07-05 17:25:21 -07:00
tastybento
3657dda094 Ops and mod.bypassprotect perms can bypass protection.
Moved AbstractFlagListener and clicklisteners into API package
2018-07-04 14:55:34 -07:00
tastybento
284839c6a4 Added 2 more tests to banner parsing 2018-07-03 09:51:21 -07:00
tastybento
d725a3e1d8 Schems: sign placeholders for names and spawn location 2018-07-02 11:21:10 -07:00
tastybento
11d257c64a Added reset for inventory and enderchests.
Money is to do because it required Vault integration.
2018-06-25 15:17:16 -07:00
tastybento
eb855edfeb Adds white list for remove mobs to settings. 2018-06-24 17:57:31 -07:00
tastybento
8125ec52af Added default Game Mode to world settings.
https://github.com/tastybento/bskyblock/issues/179

Removed references to acid from settings for BSB.
2018-06-24 16:22:44 -07:00
tastybento
045855f6ad Removed code smells. 2018-06-23 18:38:48 -07:00
tastybento
729706f69d Reduced complexity of Flag constructor.
Added constructor to TextVariables.
2018-06-23 17:06:17 -07:00
tastybento
9b8d42f692 Added island registration/unregistration.
Island center was not correctly being kept as immutable.
2018-06-23 15:45:09 -07:00
tastybento
12a1700848 Added Respawn On Island world flag.
Renamed getIslandWorldManaget to getIWM() in AbstractFlagListener.
2018-06-19 22:30:23 -07:00
tastybento
f32c661133 Added ItemParser test 2018-06-18 20:57:39 -07:00
tastybento
108d099156 Added EnderChest protection.
Enderchests are an explout because they allow transfer of items between
worlds. These additions enable usage to be switched on/off at the world
level. Also prevents ender chest crafting. These protections can be
bypassed via a permission or via Op.

Also, I fixed some settings issues in general around default settings.
2018-06-17 21:37:50 -07:00
tastybento
c03c1e3ecc Fixes tests that broke by #158 bug fix.
b45a3160c7
2018-06-17 17:09:52 -07:00
tastybento
c8dfd4a242 Removed admin world command because world settings are back in general
settings command as a panel.
2018-06-16 19:28:53 -07:00
Florian CUNY
62a321caf1 Tried to fix SettingsToggleClickListenerTest 2018-06-16 23:44:08 +02:00
Florian CUNY
b410d49c2b Made the SettingsPanel fancier (well, I tried xD)
Had to remove the "MENU" FlagType, which I replaced by the "subPanel" argument in the Flag itself.
2018-06-16 17:10:00 +02:00
tastybento
e5cfab50f7 Fix PanelListenerManager tests.
Added JavaDoc and adjusted boolean method name.
2018-06-16 10:52:44 +09:00
tastybento
9202cacb12 Removed verbose logging from FlagTest. 2018-06-10 22:35:56 -07:00
tastybento
10d5c262ca Added test class for PanelListenerManager
Refactored some code to be more streamlined.
2018-06-10 21:10:02 -07:00
tastybento
92a7b0e596 Added admin "world" command.
This is used to set world settings.
2018-06-10 17:23:48 -07:00
tastybento
1240cd266e Implemented remove mobs on teleport
I simplified this to just remove mobs on login and island teleport. The
mobs to keep are currently hard coded. They could be taken from settings
in the future.
2018-06-09 23:06:59 -07:00
tastybento
90563dac35 World Flags are saved in the config.yml file.
Previously, world settings (world setting flags) were not actually being
saved anywhere. They are now saved in the config.yml.

WIP: RemoveMobsListener.java

Improved the FlagTest.
2018-06-09 22:09:20 -07:00
tastybento
db3344c8b9 Completed Invincible Visitors and PVP listeners.
This was a lot more work than I expected, but in the end the test class
was the best approach to cover all the edge cases.
2018-06-09 15:54:09 -07:00
tastybento
4534c16416 Fixed enter/exit messages for unowned islands and tests. 2018-06-08 08:26:07 -07:00
tastybento
9a666e29ca Added specific WORLD_SETTING flag.
This flag is separate from island SETTING flags. The settings are done
in a different way and rather than try and work out which type is which,
it is better to specify them at the start.

Also added a SUB_MENU settings type.
2018-06-08 08:20:16 -07:00
tastybento
aed648e6e7 Added Piston Push setting.
Allows/Disallows piston pushing outside an island.
This is a worldwide setting for admins.

https://github.com/tastybento/bskyblock/projects/3#card-10260101
2018-06-04 19:24:11 -07:00
tastybento
5904ef9194 Added Enter/Exit messages
This required adding support for world-specific toggle settings.

This also affected some other listeners.
2018-06-03 20:54:37 -07:00
tastybento
1289060bd4 Merge branch 'confirmation' into develop
Conflicts:
	locales/en-US.yml
	src/main/java/us/tastybento/bskyblock/commands/island/IslandResetCommand.java
2018-06-03 14:03:46 -07:00
Florian CUNY
884df8f07d Fixed tests to use the TextVariables 2018-06-03 10:31:22 +02:00
Florian CUNY
08e11e90fa Made CycleClick handle right click 2018-06-02 21:42:14 +02:00
tastybento
e7649f19d4 Added cycling click to protection flags. 2018-06-02 11:27:51 -07:00
tastybento
320c9a9f43 Fixes help permissions. 2018-06-02 08:39:45 -07:00
tastybento
d94477034a Performed code cleanup using Intellij. 2018-05-31 18:52:05 -07:00
tastybento
d34ad5dce3 Fix bug with sethome not replacing previous homes. 2018-05-28 20:23:15 -07:00
tastybento
3404fac8f2 Arrays can stream directly. 2018-05-27 08:50:14 -07:00
tastybento
60eac8e54e Fixed bugs
Fixed issues where Settings were used instead of WorldSettings.
Added getWorld to the Admin team commands.
2018-05-27 00:05:36 -07:00
tastybento
66d9ef857d Removed constants that reference the island and admin commands.
Fixed bug where addon onLoad was being called twice.
2018-05-26 18:20:02 -07:00
tastybento
a5a75c6854 Fixed tests. 2018-05-26 15:50:10 -07:00
tastybento
007a9af025 Redid API for multiworld.
Now AcidIsland uses its own command instead of island.

Added a world element to commands so they can operate only in specific
worlds.
2018-05-26 13:08:35 -07:00
tastybento
6d17d48bde Removed AbstractIslandTeamCommand
This was using static data structure that would not work well when other
addons use the command.
2018-05-26 11:43:22 -07:00
tastybento
35b715ff80 Fixed tests. 2018-05-25 17:58:07 -07:00
tastybento
6a18cc4ccc More multi-world work.
This handles multiworld operation. Test with AcidIsland addon.
2018-05-25 12:19:46 -07:00
tastybento
82ee6d746e Added an Island World Manager that handles worlds
Still a WIP but it's gradually coming along.
2018-05-20 16:09:57 -07:00
tastybento
df696fb4a0 Reworked world checking.
Worlds are checked by the IslandWord class. Additional worlds can be
added to the list of worlds covered by BSB by Addons.
2018-05-18 23:08:18 -07:00
tastybento
9f6819bd3b WIP: Converted to a mutli-world/mutli-game type model
This branch adds a world aspect to almost all commands. Although the
Bukkit World class is used for reference, the world includes any nether
or end worlds too. By enabling multiworld, things like the protection
grid will operate independently in different world groups. The idea is
to enable one plugin to run mutliple worlds. For example run AcidIsland,
ASkyGrid and BSkyBlock at the same time.

In addition to this big change, I added an admin command to copy and
paste "simple" schematics that I called "schems". It does not work
completely correctly right now, especially for chest contents.
2018-05-17 21:25:12 -07:00
tastybento
21aa1691a5 Added Names database object to enable name->UUID lookup.
Added test classes for Players, Names and PlayersManager.
Debugged a number of issues with these classes.
2018-05-13 17:02:24 -07:00
tastybento
dd0770cf8c Added NetherPortalsTest class 2018-05-12 09:06:46 -07:00
tastybento
060549b5ec Switched to List from LinkedList for tab complete.
Added FlyingMobs test.
2018-05-11 21:05:19 -07:00
tastybento
366690116b Added test for Admin Info command 2018-05-09 16:37:12 -07:00
tastybento
a8cdce5d18 Added admin register command and test.
Unit tests pass, not tested in-game yet. Still no WiFi.

North Platte, Nebraska. 1856km to San Francisco. 800kph ground speed.
107kph headwind. -56C outside temperature. 12035m altitude.
2018-05-09 00:14:20 -04:00
tastybento
4f9c3e49df Added admin unregister island command and test.
Unit test passes. Not tested in-game yet.
2474km to San Francisco. 11552m high above Des Moines, Iowa.
2018-05-08 23:26:01 -04:00
tastybento
62d8249468 Added admin Make Leader command and test.
Unit test passes. Not tested in-game because I'm 9930m above Chicago,
it's 2858km to San Francisco, it's dark, I'm wearing sunglasses, and I
have no Wi-Fi!
2018-05-08 22:56:24 -04:00
tastybento
5eb6447f01 Added admin team add command
Unit tests pass, but not tested on real server yet.
2018-05-07 20:11:03 -07:00
tastybento
354aff14f4 Added team admin commands kick and disband. 2018-05-07 15:55:35 -07:00
Tastybento
ea089b5b7d Moved hasTeam and hasIsland from PlayersManager to IslandsManager
Added IslandTeamInviteCommandTest.
2018-05-06 16:26:40 -07:00
Tastybento
030e7e44ca Added test classes for Team Kick and Leave.
Fixed bugs in the team classes.

Completed the Island Info command.
2018-05-06 15:24:32 -07:00
Tastybento
c7d9fed400 Added a lot of tests to IslandManagerTest class. 2018-05-05 22:26:25 -07:00
Tastybento
0eae384b97 Added DefaultHelpCommandTest
Changed CompositeCommand to use a StringBuilder for better efficiency.
2018-05-02 19:15:07 -07:00
Tastybento
de85f85bbe Enabled settings flag clicks to work.
A listener can be added to a flag. This listener is the same as a panel
item listener. When the settings flag is clicked, it'll call the
listener. There is a default listener. Right now the default is called
UpDownClick.java. This makes the rank go up when you left click and down
when you right click. Another implementation may be to just have the
rank loop around with left clicks.

I added two more ranks - Admin and Mod. These are special ranks that
have a value above owner. If a player is given this rank, they can
bypass protections. This will avoid the need to use permissions and also
enable islands to be set up that for example, only Admins can edit, but
Mods cannot.

So, it's now possible for an owner to lock out team members from the
island as well as visitors. This is a bit weird and so more click
classes should be created. For example, one that just toggles between
Owner and Visitor.

Currently, only an island owner can change settings, but this could be
expanded to allow members. Also, it will need to be expanded to allow
Admins.
2018-05-01 22:56:10 -07:00
Tastybento
6e810747f4 Added island lock class and test class
Island lock is combined with island ban in terms of the Listener. It is
LockAndBanListener. It is a flag because after thinking about it, it
made sense to be just like any other island setting. Also, island owners
can now (in theory) lock out others by rank.

Although the test class says everything works, the Settings GUI needs to
enable toggling so that players can lock the island.

Enjoy banning players!
2018-04-30 01:12:32 -07:00
Tastybento
41631e8a18 Fixed a few code smells for tests. 2018-04-29 19:01:30 -07:00
Tastybento
3cbcf52319 Added ban enforcement class and test class.
This prevents players from entering islands when they are banned. In the
future, it should also be extended to enable island locking.

Still needs a bit of work around Ops and bypass perms.
2018-04-29 18:48:38 -07:00
Tastybento
76711f5d09 Added /island banlist command and test class.
Note that preventing players from entering banned islands must still be
implemented.
2018-04-29 11:17:12 -07:00
Tastybento
729974c1be Added unban command and test class
Added ban and unban to the island command.

Added class and tests for tabComplete for both commands.

Tested.
2018-04-28 23:05:49 -07:00
Tastybento
08023c6dbf Added Island Ban command and test classes. 2018-04-28 18:17:12 -07:00
Tastybento
673c404719 Finished up /island reset confirm 2018-04-28 16:32:34 -07:00
Tastybento
0bdc146da3 Added confirmation to IslandResetCommand
Added test class.
2018-04-28 12:50:07 -07:00
Tastybento
72306035f6 Added test for SafeSpotTeleport
It's not a great test.
2018-04-28 10:32:03 -07:00
Tastybento
26eb6c275e Added test for SafeTeleportBuilder. 2018-04-28 09:50:07 -07:00
tastybento
1e50b9e4cf Added AdminCommand test.
Added "no such command" error message when trying a command that does
not exist.

Removed unnecessary imports.
2018-04-28 14:36:17 +09:00
tastybento
aad5239ba3 Added logging methods to BSkyBlock to avoid plugin.getLogger()
plugin.getLogger() is a final class and so cannot be mocked. It was
making development of tests very hard. By making three logging methods
in BSkyBlock.java, they default to do nothing when BSkyBlock is mocked.
Previously, every time there was a use of logger in testing it was
throwing NPE's because plugin.getLogger() was returning null and the
getLogger() method could not be made not null by mocking because it was
final (in JavaPlugin).
2018-04-28 13:02:15 +09:00
tastybento
b2e68c22d4 Added Addon class unit tests. 2018-04-27 16:34:17 +09:00
tastybento
5cc71c2a2f WIP AddonTest class 2018-04-27 11:29:15 +09:00
tastybento
8fb9512f16 Filled in a few more User class tests. 2018-04-27 10:26:50 +09:00
tastybento
ca5fdbd71d Implemented User class JUnit tests.
Fixed some bugs in User, Notifier.
2018-04-27 09:20:51 +09:00
tastybento
135f35131c Finished IslandCacheTest. 2018-04-24 14:22:33 -07:00
tastybento
bf5a30e7a1 Added IslandCacheTest WIP
Cleaned up IslandCache, IslandsManager and Island.
2018-04-24 13:18:22 -07:00
Tastybento
6ff8c1a3d8 Added obsidian scooping.
In ordeer to test, I needed to change a few other classes.
2018-04-21 09:03:39 -07:00
Tastybento
0a9e9c2916 Removed stack print and added a test. 2018-04-04 19:25:13 -07:00
Tastybento
e09cb30cb5 Made head getting async for panels. 2018-03-31 18:34:49 -07:00
Tastybento
3bdf029b1d Added test for safe teleport. 2018-03-11 17:21:15 -07:00
Tastybento
b20fbd55a4 Cleaned up imports and unneeded exceptions 2018-03-11 15:59:03 -07:00
tastybento
8e97186caf Fixed merge conflicts. 2018-03-12 05:11:02 +09:00
tastybento
c10f413173 Added PotionEffectTypeAdapter for GSON 2018-03-12 04:09:05 +09:00
tastybento
cf792779f9 Now using JSON-based data for MySQL
Large number of changes to improve database functions.
2018-03-12 04:08:19 +09:00
tastybento
6626a9a4b0 Merge branch 'develop' into jsondb 2018-03-10 16:08:17 +09:00
Florian CUNY
e1f3da9449 Minor changes to existing Flags
Splited TRAPDOOR from DOOR
Splited HURT_VILLAGERS from HURT_ANIMALS
Renamed HURT_MOBS to HURT_ANIMALS
Renamed MOB_SPAWN to ANIMAL_SPAWN
Made FIRE_SPREAD a SETTING type Flag
Fixed MobSpawnListener with mishandling of ANIMAL/MONSTER spawn
2018-03-02 15:37:01 +01:00
Florian CUNY
f511e54429 Unit testing is working greatly, fixed CompositeCommand 2018-03-01 15:12:31 +01:00
Florian CUNY
e4cedb58d0 Removed useless constructor in CompositeCommand + updated unit tests 2018-03-01 14:43:33 +01:00
Florian CUNY
6ba27eef4e Moved User to its own package + added Notifier to avoid massive "Island protected" spam 2018-03-01 14:25:09 +01:00
Florian CUNY
1a233e3e83 Added test for glow() in PanelItemBuilder 2018-03-01 11:14:58 +01:00
Tastybento
fcede01a11 WIP using JSON and GSON for database.
Causes stack overflow right now. In the middle of debugging, but I need
this in github so I can grab it elsewhere.
2018-02-28 08:38:56 -08:00
Florian CUNY
c6c7e0b4ee Removed FlagsManager#getFlagByIcon() as it is useless 2018-02-26 10:07:25 +01:00
Tastybento
9db2602f78 Added FlagsManagerTest class to test the flags manager.
Added some code to the Flag, Flags and FlagManager classes to enable
passing the tests.
Realized that some flags had duplicate icons. This means that the
getFlagByIcon() method doesn't work because there could be more than
one. If we want to allow duplicate icons then we need to change the
manager. Also, do we need to getFlagByIcon method?
2018-02-25 19:48:01 -08:00
Florian CUNY
a885247c85 Implemented basic SettingsPanel + MAJOR changes in Panel/Flag API
It currently just displays a panel with all the flags in it. And throws exception when clicking on an item :P

Flag no longer have a PanelItem but Material instead as the icon.
Added a toPanelItem() method in Flag
Made the Panel(Builder) not using the Optional as fields anymore
2018-02-25 17:09:46 +01:00
Florian CUNY
6edc9555ad Renamed FlagType -> Flag and Flag -> Flags
Don't know when nor why it has been changed. Flag means the object, the flag itself, while Flags means the list of pre-defined Flag(s).
2018-02-25 16:01:30 +01:00
Tastybento
a3200265d4 Including missing firelistener test. 2018-02-20 14:06:29 -08:00
Tastybento
b25d17fa78 Renamed flags to Flag because it was confusing.
Had to rename the class to FlagType as a result.

Rewrote FireListener to be simpler.

Wrote test case for fire listener.
2018-02-20 14:06:09 -08:00
Tastybento
6c4a7d6f97 Added test case for MobSpawnListener
Rewrote MobSpawnListener to be testable and to improve the code.
2018-02-19 22:32:00 -08:00
Tastybento
81e8d7da67 Added Pair junit test 2018-02-19 20:10:39 -08:00
Tastybento
023a68546c Changes made due to addon development.
Added a method to easily get named addons from other addons.

Fixed bugs with addonclassloader.

Added ignores to some unavoidable line items

Added auto-cancel to panels so that items cannot be taken from them by
default.
2018-02-19 13:05:36 -08:00
Tastybento
382f195015 Added tests to PanelItemBuilder and fixed bugs.
Cleared up the description settings methods. Using these will add to the
description of the item.

Temporarily removed JavaDoc and Source jar creation from the POM to save
time when compiling. Will put it back when we need it.

Also, I worked out how to run the Bukkit server setup for tests. See the
setUp method in the tests. This works (at last).
2018-02-19 09:57:19 -08:00
Tastybento
f64dc0aaea Javadoc cleanup. 2018-02-17 17:01:25 -08:00
Tastybento
80c2f4178d Improved CommandsManager to use CompositeCommand
This removes the requirement for addons to cast to CompositeCommand when
getting commands from the CommandsManager.

Removed unused imports.
2018-02-14 22:38:43 -08:00
Tastybento
5ac66edb6a Fixed teams.
Added test cases for RanksManager.
2018-02-11 20:26:09 -08:00
Tastybento
84e3ae3e8b Removed imports
Fixed vulnerability issue with Pair

Fixed database connection issue with MySQLDatabaseHandler
2018-02-10 13:51:11 -08:00
tastybento
f8da3fbc61 Fixed bugs with MySQLDatabaseHandler
Code clean up, fixed bugs. Added automated tests.
2018-02-09 17:06:32 -08:00
Tastybento
c916bbf827 Automated code cleanup.
Removes spaces, adds {} to if statements, etc.
2018-02-08 20:08:46 -08:00
Tastybento
ace6294e23 Came full circle - kept Flags as final statics
This approach simulates an enum, but one that can be extended by others
to add custom flags. I added a handy values() method that uses
reflection to provide a list of all the flags in the class.

See TestBSkyBlock.java test classes for the tests of the default flag
registration and the custom flag registration.
2018-02-05 23:53:07 -08:00
tastybento
be5404e9c2 Added Setting type to flags.
Flags can be Protection type or Setting Type.

Still needs testing for PVP.
2018-02-05 17:39:04 -08:00
tastybento
645b4eb610 Implements flags as enum so flags are protected. 2018-02-05 14:51:03 -08:00
Tastybento
83d0848429 Fixed bugs with protection.
Added serializer adapter for the Flags hashmap in Island.

Teams don't work. Need to work out why.
PVP doesn't work correctly. It allows members to hit visitors anytime,
but visitors can only hit others if PVP is off. This isn't how it is
supposed to work!
2018-02-03 20:42:12 -08:00
Tastybento
6c2078fbec Added event tests.
Fixed bug with user being retained after a checkIsland.
2018-02-03 19:25:53 -08:00
Tastybento
c648409858 Reworked code so it can be tested using automated unit tests.
See TestBSkyBlock.java class for protection tests.

More to come!
2018-02-03 15:26:13 -08:00
Tastybento
0d645600fc Fixed bugs with start up and flag registration.
Protection does not work yet. Still need more debugging.
2018-02-02 08:18:56 -08:00
tastybento
177023f314 Added code to support protection flag listeners.
Made getIslandsAt() Optional to enable better code structures in the
listeners.

Created an abstract class to simplify flag protection listeners.

Added default setting for flags that will be able to be set by config.
This default is used for any space in the worlds not occupied by an
island.
2018-01-30 16:59:10 -08:00
Tastybento
f7b6898559 Added protection methods. 2018-01-28 20:44:57 -08:00
Tastybento
ba62989788 Shifted some constants around. 2018-01-28 18:13:45 -08:00
Tastybento
eec4e99172 Added ranks to island members. More to do! 2018-01-28 11:48:54 -08:00
Tastybento
92af75e602 Converted to using the Settings loaded by the database handler.
Removed a lot of static references.

Constants have their own class.
2018-01-06 15:23:01 -08:00
Florian CUNY
1430eda5ce ConfigAPI - Implementing the basic functionnalities
a lot of unused/useless Settings has been removed
Settings class has been moved to the main package, because the config package would then only contain it

I need feedback about it
2018-01-04 16:57:12 +01:00
Tastybento
6ef6416c5a Fixed test class to not assert on /test. 2018-01-03 08:24:50 -08:00
Florian CUNY
44742d8946 Made use of "commands.help.syntax" for help
This is a more flexible and natural way to provide the display for the help, especially for the colors.

I had to remove the "/" from the usage though. If you think it should be there, re-add it but remove it from the locale then.
2018-01-03 16:11:45 +01:00
Tastybento
452311fb69 Boom! NMS is gone! (Again) Will it come back?
Used reflection to get the command map from the server instead of using
the NMS call.

Also, more importantly, this commit enables CompositeCommands to
auto-register their top-level command in the constructor. No need to
separately obtain the command manager object. Yes, easy API. :-)
2017-12-28 20:36:04 -08:00
Florian CUNY
390d58cc8b AddonsAPI & Events changes
Moved PremadeEvent to api/events
Made use of PremadeEvent for all existing events
Renamed TeamReason to Reason in TeamEvent
Made the addon events follow the used builder pattern
Renamed #loadAddons() to #enableAddons() in AddonsManager
Added #disableAddons() in AddonsManager
2017-12-28 15:29:32 +01:00
Tastybento
2825f9535e Command API and Help done.
Commands now require a setup to define their permission, player/console
status, description and any parameters they have. This is also where any
subcommands are created if they exist.

Each command automatically has a help subcommand. This is used to
display help. This will also recursively go to any other sub commands
and get help from them. 

Note that getUsage() now *only* shows the command and any sub commands.
It turns out that Bukkit requires this to start with a / because it
actually uses this in its own help system and the server will not start
if it is not in the right format. Therefore I split off parameters into
their own string. This also enables them to be translatable. 

Everything should work at this point. It's just waiting on the locale
system to work to display the strings in the locale files.
2017-12-27 12:09:08 -08:00
Tastybento
f22065fd2c Fixed help and usage descriptions.
Known issue - the help shown when doing a parent help is not using the
child's custom help class for usage/description.
2017-12-26 11:09:00 -08:00
Tastybento
2effa48c8f Made Test class cleaner. 2017-12-24 10:12:04 -08:00
Tastybento
5a5aff32c0 Removed unused import. 2017-12-23 22:02:15 -08:00
Tastybento
9b5a7c887c Made parent Optional in CompositeCommand to avoid null checks. 2017-12-23 21:58:32 -08:00
Tastybento
f8ac04a779 Implemented the auto command help.
The help command is a default subcommand of every command. It will
display the usage info for the command and any subcommands.
2017-12-23 21:35:10 -08:00
Tastybento
eeb4e2a9ee Lots of work done on the command API.
Sub commands work, tab complete works. See the TestIslandCommand.java
test command for how to use the API and unit tests.

Still need to do the auto-help.
2017-12-23 19:14:35 -08:00
Tastybento
c5262e8faa Commands API implemented. Still a WIP.
Commands work and tab complete works somewhat. 
Help still needs to be done. Added in NotSetup And PluginConfig to just
make the plugin work. It's fine to remove them when there is a working
alternative.
2017-12-22 17:26:05 -08:00
Tastybento
18ad604b7b Changed TeamEvent to fire off class-specific events. 2017-12-17 12:38:52 -08:00
Tastybento
323720598a Removed schematics. 2017-12-09 10:44:09 -08:00