Commit Graph

1236 Commits

Author SHA1 Message Date
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
7d04d8acc2 Renamed /bbox info to /bbox version 2018-08-07 10:43:38 +02:00
Florian CUNY
2e75c8b4b4 Removed IslandSpawnCommand (unused) 2018-08-06 18:01:00 +02:00
Florian CUNY
16e864f495 Fixed some code smells 2018-08-06 18:00:47 +02:00
Florian CUNY
28cf3ca278 Removed unused settings from Settings
recoverSuperFlat (is a flag) and muteDeathMessages (an external plugin can do it)
2018-08-06 16:08:45 +02:00
Florian CUNY
e22cdf0b36 Made Config use ConfigHandler instead of FlatFileDatabaseHandler 2018-08-06 15:59:38 +02:00
Florian CUNY
7f0dc2f6d3 Prepared handling of the other ConfigEntry fields for Config loading 2018-08-06 15:59:06 +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
492a0b9105 Added ban/unban cooldown 2018-08-04 21:10:51 -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
93c3d3ce47 Removed code smells. 2018-08-03 23:31:02 -07:00
tastybento
5c46265771 Fixed code smells. 2018-08-03 21:30:06 -07:00
tastybento
683aca7043 Adjusted Clipboard to remove code smell and renamed package 2018-08-03 21:19:15 -07:00
tastybento
1c29dfca6b Removed generic wildcard type code smell 2018-08-03 21:02:55 -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
7aa2f33eab Put default settings for command desc and parameters back in
These should work now. No infinite loop.
2018-08-03 17:43:42 -07:00
tastybento
3e7307a56c Merge branch 'master' into develop 2018-08-03 08:25:40 -07:00
tastybento
48883bb75f Removed constants class for now. It's not needed. 2018-08-03 08:24:40 -07:00
tastybento
4d4c8da912 Revert "Maven cleanup, fix readme links"
This reverts commit 450786aea3.
2018-08-03 08:06:28 -07:00
tastybento
5d27ea8fc6 Fixed spawners in schems. 2018-08-02 20:39:57 -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
d3b5411b1b Fix for tab complete in game. 2018-08-02 18:39:10 -07:00
Gabriele C
450786aea3 Maven cleanup, fix readme links 2018-08-02 23:00:58 +02:00
tastybento
02e528cdc7 Debug 2018-08-02 08:11:46 -07:00
tastybento
2d75a92700 Fixed 1.13 schems 2018-08-01 22:02:53 -07:00
tastybento
ae3a341b89 WIP - using blockdata - doesn't work completely yet. 2018-08-01 17:24:52 -07:00
tastybento
acbcd27142 Temporary fix for island schem pasting.
Note that blocks are not pasted properly. The Clipboard class needs
rewriting to 1.13.
2018-08-01 16:40:21 -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
733fc3d1c9 Fixed Endermen listener for 1.13 2018-08-01 09:35:31 -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
tastybento
422fd7b0e8 Revert "Removed /is and /bsbadmin commands"
This reverts commit c6e2ba6418.
2018-08-01 08:29:09 -07:00
Florian CUNY
138b8e7568 Updated test units to 1.13 API 2018-08-01 11:21:29 +02:00
Florian CUNY
e6418f0957 Finished updating source code to 1.13 API
Test units still need to be updated.
2018-08-01 11:03:03 +02:00
Florian CUNY
efb2adb455 Removed commands test units 2018-08-01 11:02:13 +02:00
Florian CUNY
1a63b2431e CompositeCommand : added defaults for setDescription and setParameters 2018-08-01 10:36:38 +02:00
Florian CUNY
b600dacbdd Continued 1.13 support 2018-08-01 10:18:37 +02:00
Florian CUNY
c6e2ba6418 Removed /is and /bsbadmin commands 2018-08-01 10:16:57 +02:00
Florian CUNY
46f22e5467 WIP - Updating to full 1.13. Will not build. 2018-07-31 21:17:10 +02:00
Florian CUNY
5fa0f590f1 Made TNT a PROTECTION flag instead of SETTING 2018-07-31 20:04:47 +02:00
Florian CUNY
84515642bf Removed GameType in Constants (useless) 2018-07-31 18:19:36 +02:00
Florian CUNY
2210cdc2e8 Javadoc and line spacing in BentoBox 2018-07-31 18:14:57 +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
da04246a50 Removed acid-related events. 2018-07-28 13:39:18 -07:00
Florian CUNY
96c68957c5 Added a better exception handling when loading locales 2018-07-28 10:15:36 +02: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
342387cf09 Adjusted to run in 1.13-pre7
Removed references to STATIONARY_WATER as this does not exist in 1.13.
2018-07-23 23:14:51 -07:00
tastybento
b40023bcf9 Added GeoLimit for mobs - world setting.
Adds a world menu for preventing mobs from exiting an island.
Defaults are for flying mobs.

Adds an event that is called when the plugin loads.

Test classes are still to be developed.
2018-07-22 16:17:34 -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
tastybento
f8da453a29 Added chest damage listener
Also fixed a bug with creeper listener to only apply to island worlds.

Made TNT flag an island settings. Woohoo!
2018-07-19 19:55:32 -07:00
tastybento
c61b87628f Added view distance limit to range particles 2018-07-19 19:43:13 -07:00
tastybento
d4305efabe Removed place blocks debug 2018-07-19 19:28:50 -07:00
tastybento
acaf126978 Removed unused imports 2018-07-19 19:12:19 -07:00
Florian CUNY
e9d39148ef Removed useless Island#getTileEntityCount(Material, World) 2018-07-19 21:18:09 +02:00
Florian CUNY
e15ed63899 Added /bsb range reset <player> 2018-07-19 13:31:47 +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
09c0eb846e /bsb range set : allow to set a value which is = to the max range 2018-07-19 12:55:47 +02:00
Florian CUNY
4df9f89e3e Fixed /bsb info not displaying the actual protectionRange 2018-07-19 12:45:02 +02:00
Florian CUNY
d75cc70083 Documented #getRange() and #setRange(int) in Island 2018-07-19 12:23:22 +02:00
Florian CUNY
b37df7ef7c Fixed some code smells in AdminGetRankCommand 2018-07-19 12:22:36 +02:00
Florian CUNY
90be5e5de6 Added /bsb range set <player> <range> 2018-07-19 12:22:01 +02:00
Florian CUNY
04db135f60 Added #getUser(UUID) in PlayersManager
I didn't find a real use right now, but that might be helpful for an addon etc
2018-07-19 12:21:31 +02:00
Florian CUNY
c693c32f30 /bsb range display : now 30 ticks instead of 20
Again, it is mainly to make it looks better and avoid having too much barrier particles when moving
2018-07-19 12:20:40 +02:00
Florian CUNY
918793fa43 /bsb range display : each 20 ticks instead of 15
BARRIER particles are lasting longer than the other ones. In order to avoid huge load of barrier icons (which becomes quite laggy very fast) in case the player is moving, I decided to slightly increase the amount of time between each zone-drawing.
2018-07-19 10:37:49 +02:00
tastybento
3b4aa2dd48 Fixed range display command to be just player only 2018-07-18 23:04:32 -07:00
tastybento
d093925938 Added text strings for localization. 2018-07-18 22:42:50 -07:00
tastybento
3210c7873b Fixes bug where boats could not be broken by the island owner 2018-07-18 22:28:03 -07:00
tastybento
0b77225f06 Fixed bug where Ops could not see admin help by default. 2018-07-18 21:28:15 -07:00
Florian CUNY
9920e31abb Added (finished) /bsb range <display/show/hide> 2018-07-18 22:28:50 +02:00
Florian CUNY
89b4b80208 Fixes an ArrayOutOfBoundsException when command was at "top" level 2018-07-18 15:49:05 +02:00
Florian CUNY
f8a7c1af48 Started /bsb range display 2018-07-18 15:37:20 +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
Florian CUNY
66b33addfb Added convenience methods in CompositeCommand to ignore the Help subcommand if it exists
It might look useless at first, but it can have practical uses such as placeholders, display and so on.
It is also needed for my in-project new help display.
2018-07-18 13:46:40 +02:00
tastybento
d8f783999b Added creeper listener. Fixed bugs with listener reg. 2018-07-17 22:38:47 -07:00
tastybento
4f5b6a25b6 Renamed method to isWaterUnsafe to sound better. 2018-07-17 18:50:42 -07: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
65b656b95c Added a bit more info on super-flat chunk regen 2018-07-14 12:36:37 -07:00
tastybento
dedaebc2b6 Added setting in config for world difficulty.
Added ability to add comments to the top of the config file.
2018-07-14 12:29:59 -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
ac4611e66f Minor code smells and code format fixes 2018-07-14 00:55:00 +02:00
Florian CUNY
bfe059f191 Fixes "Unknown command" when using uppercase characters in commands
Fixes #204.
2018-07-14 00:54:37 +02:00
Florian CUNY
5ec5a59dd4 Minor spacing/typo in AbstractDatabaseHandler 2018-07-13 17:29:57 +02: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
Florian CUNY
59e58e8592 Fixed invalid Flag ID in ANIMAL_SPAWN's clicklistener 2018-07-13 13:38:50 +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
31455a033d Fixed code smells and bugs, added flower pot protection 2018-07-11 22:49:20 -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
a663395a13 Players will teleport faster
Players will teleport to a spawn point if it is safe and marked.

https://github.com/tastybento/bskyblock/projects/3#card-11060603
2018-07-10 21:28:11 -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
6781beb3ca Settings clean up. 2018-07-06 10:31:49 -07:00
tastybento
c1e6aa7350 Removed console spam around schem saving/loading 2018-07-06 10:22:40 -07:00
tastybento
4c4a72718e Fixed world_name placeholder for settings titles. 2018-07-06 10:14:07 -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
a60bcc8a22 Fixed settings. Implemented useowngenerator 2018-07-06 08:07:37 -07:00
tastybento
a72a49975f Added default island flags and settings to config.yml
These are specified per-world so go in the world section.
2018-07-05 21:10:47 -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
66f3b5032d Added protection for plates and buttons from arrows
Added button text for flag.
2018-07-04 18:32:43 -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
aa1ef9bcbd Added new island and nether island schems
Fixed bugs with schem pasting, especially empty chests.
2018-07-03 17:51:01 -07:00
tastybento
265f05529b Schems save in the respective addon data folders 2018-07-03 11:05:14 -07:00
tastybento
284839c6a4 Added 2 more tests to banner parsing 2018-07-03 09:51:21 -07:00
tastybento
4245ebaa33 Fix banner parsing issue 2018-07-03 09:41:09 -07:00
Florian CUNY
9f3e4e22dc Tells how much time it took to fully load BSkyBlock 2018-07-03 11:20:52 +02:00
Florian CUNY
0cb21d8468 Fixed NPE when the ItemParser returns null when the locale banner is an invalid String or does not exist 2018-07-03 11:19:48 +02:00
tastybento
693625ab9a Added placement based on bedrock. 2018-07-02 22:01:37 -07:00
tastybento
35247965fa WIP - still need to fix bedrock saving in schem 2018-07-02 20:35:21 -07:00
tastybento
c430d910b2 Added SchemsManager to handle global schems 2018-07-02 18:51:18 -07:00
tastybento
d725a3e1d8 Schems: sign placeholders for names and spawn location 2018-07-02 11:21:10 -07:00
tastybento
afa21d25ed Fixes schem issues.
https://github.com/tastybento/bskyblock/issues/192
2018-07-01 15:47:29 -07:00
tastybento
bc39e82dd2 Fixed stairs orientation. 2018-07-01 15:28:53 -07:00
tastybento
947853061e Added entities to schems. 2018-06-30 10:08:16 -07:00
tastybento
dd2a65bef4 Moved some settings. 2018-06-30 08:25:44 -07:00
tastybento
70c6b75992 Added island schems
These are pasted as the default islands. I think better ones can be
made!
2018-06-25 20:13:39 -07:00
tastybento
56d63dc9c8 Added resets for island joining. 2018-06-25 16:40:28 -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
638712566a Added leave and join settings for money, inventory 2018-06-25 14:35:31 -07:00
tastybento
9450bc8da1 Moved team leave confirm to api. 2018-06-25 14:34:52 -07:00
tastybento
ae1eeec7cf Fix for NPE on safe teleport when location cannot be found. 2018-06-24 18:23:57 -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
617fc712aa Code clean up 2018-06-23 19:25:39 -07:00
tastybento
dec162744c Code clean up 2018-06-23 19:20:02 -07:00
tastybento
e3731994b3 Removed duplicate code 2018-06-23 19:19:53 -07:00
tastybento
0e1ee335ea Code clean up. 2018-06-23 18:56:21 -07:00
tastybento
045855f6ad Removed code smells. 2018-06-23 18:38:48 -07:00
tastybento
bb4c199487 Removed code smells. 2018-06-23 18:20:27 -07:00
tastybento
4fc63b6de0 Changed move file to copy and delete in FlatFile. 2018-06-23 17:54:51 -07:00
tastybento
21c259f628 Made constructor private. 2018-06-23 17:06:47 -07:00
tastybento
729706f69d Reduced complexity of Flag constructor.
Added constructor to TextVariables.
2018-06-23 17:06:17 -07:00
tastybento
f12bc17ca3 Removed code duplication in Composite Command constructor 2018-06-23 16:32:53 -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
97cf9b4132 WIP - testing register/unregister admim commands
JUnit tests do not pass, so bypass for now.
2018-06-21 22:30: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
daf01ccd8d Switched to non-locale-based decimal place setting.
https://github.com/tastybento/bskyblock/issues/186
2018-06-18 08:12:21 -07:00
tastybento
d4951a5873 Added stack trace print for debugging
https://github.com/tastybento/bskyblock/issues/186
2018-06-18 07:45:50 -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
fba05ecc81 Fixed bug where database saving was every 5 ticks.
Changed to calculate minutes for database backup time.
2018-06-17 18:18:35 -07:00
tastybento
8353d266a5 Saved YML files then move for reliability reasons
Instead of saving on top of a YML file, we now save to a tmp file and if
it is saved successfully, then it is moved on top of the old file in an
atomic move. This helps avoid data loss if the file write fails.
2018-06-17 17:15:44 -07:00
tastybento
c03c1e3ecc Fixes tests that broke by #158 bug fix.
b45a3160c7
2018-06-17 17:09:52 -07:00
Florian CUNY
a71eee537d Print a kind message in console when the plugin is fully loaded 😄 2018-06-17 14:49:19 +02:00
Florian CUNY
45b4f32d78 Print more detailed info about addons loading in console 2018-06-17 14:48:53 +02:00
Florian CUNY
a8f2cabd82 Added support for banners in ItemParser & updated banners in locales 2018-06-17 14:39:40 +02:00
Florian CUNY
2249bc4864 Took ItemParser from the addon challenges 2018-06-17 11:48:35 +02:00
Florian CUNY
24a88e09ac Added ENDER_CHEST flag and splited LEVER_BUTTON into LEVER and BUTTON 2018-06-17 11:36:17 +02:00
Florian CUNY
b45a3160c7 Should fix #158 2018-06-17 11:35:46 +02:00
tastybento
45c0bc84da Removed debug lines. 2018-06-16 19:34:58 -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
tastybento
034015ee4d Switched back to using hard-coded islands while debugging.
Removed unused imports.
2018-06-16 19:06:08 -07:00
Florian CUNY
62a321caf1 Tried to fix SettingsToggleClickListenerTest 2018-06-16 23:44:08 +02:00
Florian CUNY
8ee42d3c47 Changed the description of the "Island protected" message to an "hint"
related to #184
2018-06-16 17:15:51 +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
Florian CUNY
4525a04324 Splited MUSIC flag into JUKEBOX and NOTE_BLOCK
It has been suggested in #182.
2018-06-16 16:46:01 +02:00
Florian CUNY
d4264a1c26 Fixed the click sound being also played to players nearby 2018-06-16 15:15:15 +02:00
Florian CUNY
c68c8d26cb Language Panel: sorts the languages differently 2018-06-16 15:03:52 +02:00
tastybento
e5cfab50f7 Fix PanelListenerManager tests.
Added JavaDoc and adjusted boolean method name.
2018-06-16 10:52:44 +09:00
tastybento
21601089f4 Merge remote-tracking branch 'origin/develop' into develop 2018-06-16 10:44:13 +09:00
tastybento
ce65d34cb4 WIP - switching to using simple schems instead of hardcoded islands 2018-06-16 10:44:04 +09:00
Florian CUNY
d2697e1525 Added a description variable to the "Island protected" message
Added "[description]" in TextVariables
added getName- and getDescriptionReference() in Flag
2018-06-11 15:55:01 +02:00
Florian CUNY
63dd2d95b2 Added option to close panel on click outside of it
This is related to commit #8d596c5f1d24ea2e319e5172b2c954a8caa46f67
2018-06-11 12:19:14 +02:00
tastybento
9202cacb12 Removed verbose logging from FlagTest. 2018-06-10 22:35:56 -07:00
tastybento
aa7fbabf82 Fixed bugs with NPEs in non-island worlds. 2018-06-10 22:34:01 -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
8d596c5f1d Closes panels when clicked outside.
https://github.com/tastybento/bskyblock/issues/180
2018-06-10 20:10:41 -07:00
tastybento
92a7b0e596 Added admin "world" command.
This is used to set world settings.
2018-06-10 17:23:48 -07:00
tastybento
d364c006b0 Improvide code readability. 2018-06-10 15:42:21 -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
1fc1780fd1 Fixed flag text and descriptions. 2018-06-09 17:22:38 -07:00
tastybento
27639f673a JavaDoc clean up. 2018-06-09 16:40:38 -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
8a339f755a Added Invincible Visitor settings.
This led to work to enable saving of the config.yml file with comments.
I added the ability to have multiple lines of comments as annotations.
I also enabled comments to align with the exact path of the field.
To do this I used BSBConfig for the Settings class and retired ISettings
When the plugin disables, it now saves the config.yml with comments and
the Invincible Visitor settings.

Note that any settings in the config.yml stored in the jar will still
exist in the file and stay there unless they are manually deleted. They
just will not have any comments on them after saving.
2018-06-05 00:06:55 -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
beafb5dd4c Fixes frost walker console spam.
https://github.com/tastybento/bskyblock/issues/181
2018-06-03 15:48:52 -07:00
tastybento
f3472815c9 Fixed schems
The admin command "schem" now works very like WorldEdit.
You set the pos1 and pos2, copy to clipboard and paste
You can save and load. Schems go into the schems folder.
2018-06-03 15:33:45 -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
tastybento
2ea268f90f Added confirmation code to CompositeCommand
How does this look?
2018-06-03 13:36:48 -07:00
Florian CUNY
433efcf6c0 Might a fix a NPE when loading Players from Flatfile database 2018-06-03 16:04:45 +02:00
Florian CUNY
884df8f07d Fixed tests to use the TextVariables 2018-06-03 10:31:22 +02:00
Florian CUNY
4897d8ef77 Fixed some code smells 2018-06-03 10:23:45 +02:00
Florian CUNY
3d7ef58323 Removed unused argument in InventorySave constructor 2018-06-03 10:09:31 +02:00
Florian CUNY
3ab2c46eed Reduced notification delay to 4 seconds 2018-06-03 10:08:50 +02:00
Florian CUNY
f5b5426327 Created TextVariables class that contains common text placeholders 2018-06-03 10:07:58 +02:00
tastybento
b87b00d887 Cleaned up some code smells. 2018-06-02 19:54:41 -07:00
tastybento
e69971d73c Cleaned up some config settings. 2018-06-02 19:21:59 -07:00
Florian CUNY
caa2501968 Removed the help item from the SettingsPanel 2018-06-02 22:01:05 +02:00
Florian CUNY
08e11e90fa Made CycleClick handle right click 2018-06-02 21:42:14 +02:00
Florian CUNY
d7b2c70b78 Fixed unaccurate logic in PanelBuilder#nextSlot() 2018-06-02 21:41:27 +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
bcc0028671 Removed debug 2018-05-30 20:27:41 -07:00
tastybento
53bd51e2f5 Fixed issue with adapter serializer
Serialize and deserialize were opposite

In deserializing in flatfile db, there was an odd extra bit of code that
undid the deserialization. I'm not sure why I put that in there and so
I've commented it out for now.
2018-05-30 20:23:05 -07:00
tastybento
6b6ec4c697 Fixed bug where worlds were not existing when islands loaded.
If islands are loaded before the world exists the island's world becomes
null. If an addon is creating an island then it must be loaded before
islands.

Also refactored some of the addon loading code.
2018-05-29 16:59:52 -07:00
tastybento
3b7b7fa557 Fixed bug with saving to flat file.
Must remember to include blank constructor so Beans can create the
object!
2018-05-29 14:57:01 -07:00
tastybento
d34ad5dce3 Fix bug with sethome not replacing previous homes. 2018-05-28 20:23:15 -07:00
tastybento
8f469eb339 Updated to work with addons like warps. 2018-05-28 15:46:07 -07:00
tastybento
b402450253 Cleaned up some vulnerabilities and code smells. 2018-05-27 21:37:00 -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
4bf0d8ec0f Fixed bug with island command and island go 2018-05-26 15:35:02 -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
74c86901d0 Fixed issue with player name not being set correctly. 2018-05-25 17:15:56 -07:00
tastybento
682d34849a Small change to clarify /island use outside of island worlds 2018-05-25 15:11:17 -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
576d9ff314 Merge remote-tracking branch 'origin/develop' into multigame 2018-05-20 14:18:38 -07:00
Florian CUNY
736ba10c53 Fixes https://github.com/tastybento/bskyblock/issues/166 2018-05-20 22:00:22 +02: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
0a17639529 WIP added some admin commands. Still not finished.
Get rank, set rank, info.
2018-05-02 21:23:02 -07:00
Tastybento
0eae384b97 Added DefaultHelpCommandTest
Changed CompositeCommand to use a StringBuilder for better efficiency.
2018-05-02 19:15:07 -07:00
Tastybento
fe26eeda2a Fixed copy and paste bug in previous commit.
Next time I'll remember to build before committing!
2018-05-01 23:25:49 -07:00
Tastybento
cccbf2d270 Removed code smells. 2018-05-01 23:20:13 -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
Florian CUNY
d0a66299de Edited some references and manually updated REFERENCES.md 2018-04-28 12:31:53 +02: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
a2a23d0771 Merge remote-tracking branch 'origin/develop' into develop 2018-04-27 09:21:03 +09:00
tastybento
ca5fdbd71d Implemented User class JUnit tests.
Fixed some bugs in User, Notifier.
2018-04-27 09:20:51 +09:00
Florian CUNY
9639872685
cleaned PVPListener from "us.tastybento.bskyblock.lists.Flags" 2018-04-26 16:06:47 +02:00
Florian CUNY
ecb630fac3 Fixed some code smells 2018-04-25 13:48:58 +02: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
Florian CUNY
0e45aa664d Finished and polished the Language Panel 2018-04-24 18:02:29 +02:00
Florian CUNY
175f832f41 Removed the sanity check, which could lead to weird issues 2018-04-24 17:04:29 +02:00
tastybento
0fe453c163 https://github.com/tastybento/bskyblock/issues/161 2018-04-23 16:51:18 -07:00
Florian CUNY
5ebbc2e374 Created the language panel. It is currently not localized. 2018-04-23 21:16:08 +02:00
Tastybento
45101901bd Fixed loadObject for MySQL.
The uniqueKey needs to be enclosed in quotes "" to work.
2018-04-21 11:41:48 -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
e881a5bd2b Removal of code smells.
Removed a lot of debug code.

Refactored some loops into lambas.
2018-04-18 19:07:20 -07:00
Tastybento
01aef76eb5 Removed debug from util. 2018-04-18 11:18:07 -07:00
Tastybento
1fd2b93ce8 Improved serialization and deserialization for flatfile db. 2018-04-18 10:51:32 -07:00
Tastybento
f98c5527bc Improved accuracy of location - string conversion. 2018-04-18 10:47:20 -07:00
Tastybento
2e1c055cd7 Made BSBDatabase much easier to use for addons
Now obtaining the database handler is easy and understandable.
2018-04-15 17:30:42 -07:00
Tastybento
a5cc4c20ea Updates due to Challenges development. 2018-04-08 19:54:37 -07:00
Tastybento
a95e869cc9 Now reads addon.yml as a YAML file
Also imports level 1 permissions, i.e., does not handle children.
2018-04-05 18:56:48 -07:00
Tastybento
0a9e9c2916 Removed stack print and added a test. 2018-04-04 19:25:13 -07:00
Tastybento
c49e2b07d3 Fixed issues with panels not scaling in size correctly. 2018-04-02 18:20:54 -07:00
Tastybento
e09cb30cb5 Made head getting async for panels. 2018-03-31 18:34:49 -07:00
Tastybento
f0d3a9ab5f Added in requirement for BsbMongo Plugin
BSkyBlock will disable itself gracefully if this plugin does not exist
but the database is sent to MONGO.

Finishes up https://github.com/tastybento/bskyblock/issues/155
2018-03-31 15:33:48 -07:00
Tastybento
a19b8bf836 Fixes issue with saving documents.
MongoDB seems to work now.
2018-03-31 15:17:58 -07:00
Tastybento
db58e29ffb Removed MongoDb shading.
Mongo users will need the BsbMongo plugin.
2018-03-31 09:24:00 -07:00
Tastybento
4100edd279 Adds support for MongoDB.
Needs more testing, but seems to work. The main problem is that it pulls
in the MongoDB Java driver which boosts the size of the JAR to 2.3MB. It
may be better to put the Mongo driver into an addon so that only Mongo
users have to have the larger JAR.
2018-03-18 21:54:24 -07:00
Tastybento
17ecb1c0d4 Tweaks to improve code. 2018-03-17 09:24:17 -07:00
Florian CUNY
b662080ffa Changed the question mark head to an MHF_ 2018-03-17 11:40:30 +01: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
eb4e086482 Renamed variable. Removed logger. 2018-03-12 04:41:45 +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
97b9543f15 Fixed some code smells 2018-03-01 14:57:35 +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
Florian CUNY
4a86784535 Fixes bug with nextSlot() not taking care of size if it was set 2018-03-01 11:05:19 +01:00
Florian CUNY
c60f92b7b3 MAJOR changes to Panel API
All methods in PanelBuilder follow the Builder pattern (no more "set...")
nextSlot() now returns the first unoccupied slot
2018-03-01 11:02:11 +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
f648c936ad Continued working on the SettingsPanel. Did minor fixes in PanelItemBuilder 2018-02-26 20:18:09 +01:00
Florian CUNY
c6c7e0b4ee Removed FlagsManager#getFlagByIcon() as it is useless 2018-02-26 10:07:25 +01:00
Tastybento
e598fa7c93 Cleaned up a vunerability and some code smells. 2018-02-25 23:05:21 -08:00
Tastybento
bdca10636e Added Config comment capability.
See the challenges addon for examples.
2018-02-25 22:44:22 -08:00
Tastybento
1315dd990c user or listener can be null, so need to us ofNullable. 2018-02-25 20:46:13 -08: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
Tastybento
97491b1d89 Removed unused imports 2018-02-25 18:21:42 -08:00
Tastybento
7fa038bfce Merge branch 'develop' of https://github.com/tastybento/bskyblock.git into develop 2018-02-25 18:20:01 -08:00
Tastybento
00121e7e37 Added a specific config class to store objects as YAML 2018-02-25 18:19:52 -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
b043e641a1 Added equals to User class
Added null check for FlatFileDB Handler.
2018-02-24 21:29:51 -08:00
Tastybento
5a3a557cf2 Made improvements while writing challenges addon
Improved enum error handling in flat file.
2018-02-24 11:28:21 -08:00
Tastybento
84f10d6790 Removed debug. 2018-02-20 14:16:40 -08: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
57cb919ebf Cleaned up code for FlatFileDatabaseHandler 2018-02-19 22:45:53 -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
44ed33bb26 Tweaks due to work on Challenges addon.
Enabled the overall panel listener to work.
2018-02-19 19:49:21 -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
49764c151d Reverted f3d7bf2af3
It breaks the addon class loading and using lamda functions doesn't end
up being neater because it must be able to throw a
ClassNotFoundExcepetion to the Bukkit code.
2018-02-19 12:05:59 -08:00
Tastybento
25b4f674bb Fixes infinite error with commit f14676f.
The lambdas were missing the input argument to the execute method so
were calling the parent's execute method.
2018-02-19 11:01:48 -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
7f0d71e25c Added support for player heads in PanelItemBuilder API 2018-02-19 07:55:57 -08:00
Florian CUNY
f14676f5c6 Minor code quality fixes in IslandCommand 2018-02-18 11:32:25 +01:00
Florian CUNY
43367300a4 Started working on the Settings Panel 2018-02-18 11:31:49 +01:00
Tastybento
f64dc0aaea Javadoc cleanup. 2018-02-17 17:01:25 -08:00
Tastybento
ca13f23918 Back ported SafeSpotTeleport from the ASkyBlock effort 2018-02-17 14:54:58 -08:00
Tastybento
9715811303 Removed @throws javadoc tag as it is not needed. 2018-02-17 14:54:36 -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
Florian CUNY
4aaf559704 Fixed some code smells 2018-02-13 21:38:19 +01:00
Florian CUNY
0b6da56e82 Fixed some code smells in FlatFileDatabaseHandler
These code smells were fixed according to sonarcloud analytics
2018-02-13 17:49:35 +01:00
Tastybento
effefae377 Updated readme
Removed unnecessary ; from RanksManager
2018-02-11 20:39:08 -08:00
Tastybento
5ac66edb6a Fixed teams.
Added test cases for RanksManager.
2018-02-11 20:26:09 -08:00
Tastybento
54dd9e87d4 Reduced the complexity of these commands.
By splitting up the methods, it makes it easier to understand and spot
bugs.
2018-02-11 15:22:03 -08:00
Tastybento
9f43f1e6fa Removed unneeded method. 2018-02-11 14:13:21 -08:00
Tastybento
f1ace6b242 Fixed bug with saving MySQL database table.
Issue was that the uniqueId was not being saved and the map table was
pointing to the wrong ?'s.
2018-02-11 12:26:25 -08:00
Tastybento
52b3f184db Fixed bug when creating new islands when there are islands in the world.
If there are unowned and unknown islands in the island spaces then
duplicate islands were being made when the search was done for new
islands.
2018-02-11 11:39:07 -08:00
Tastybento
c58fc0d07a Removed debug. 2018-02-11 11:24:51 -08:00
Tastybento
c07b649488 Completed nether portals
Also fixed some issues around admin commands and the teleport admin
commands in particular.
2018-02-11 11:12:56 -08:00
Tastybento
b9c262fd5c Fixed portals. Still has debug in it.
Need to add nether->overworld portal
2018-02-11 09:28:52 -08:00
Tastybento
5161de62db WIP adding Nether Portals 2018-02-11 08:18:50 -08:00
Tastybento
4b66811fb0 Removed debug 2018-02-10 14:50:52 -08:00
Tastybento
487328950b Fixed bug where new /island was doing /go as well. 2018-02-10 14:48:58 -08:00
Tastybento
921d25c2d5 Added private constructor because all methods are static. 2018-02-10 14:39:57 -08:00
Tastybento
d32a6f8ff1 Made code easier to understand 2018-02-10 14:32:13 -08:00
Tastybento
2b286ca58a Removed debug, cleaned up code 2018-02-10 14:10:25 -08:00
Tastybento
11c1ffc790 Removed unnecessary (int) 2018-02-10 14:06:20 -08:00
Tastybento
a9ea8e830d Code smells cleanup
Extract nested try block into a separate method.
2018-02-10 14:05:05 -08:00
Tastybento
180517cef3 Code smells cleanup 2018-02-10 14:00:40 -08:00
Tastybento
c76c854ed3 Code smells cleanup
Removed unnecessary cast in Island.
Combined if statement
Removed unnecessary {}
2018-02-10 13:56:44 -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
65d34f5842 Reverted change of coords to long because not needed.
Mincreaft max coords are +/- 30 million.
2018-02-10 13:19:54 -08:00
Tastybento
ed65aa421d Rewrote SafeSpotTeleport
Moved coords to longs instead of ints for island locations

Created a SafeTeleportBuilder class

Created a utility Pair class
2018-02-10 13:09:32 -08:00
Florian CUNY
4bd02a59ef Added description to /bsb (reload and version) + added some aliases 2018-02-10 17:03:57 +01:00
Florian CUNY
b04602302b Internal Placeholders are now working
It works, but it is more like a DIY patch thing. It has a few problems with the current implementation :
1. It doesn't suit our "code style" : it uses an Handler instead of a Manager, eg.
2. It is a bit laggy (I've got the feeling that it could be improved)
3. It doesn't hook to other Placeholder APIs for now
And a few other things.

I think this is more like a Proof of Concept : it will have to be improved in the next weeks.
2018-02-10 13:54:27 +01:00
Florian CUNY
65245a99f5 Fixes bug where the help could be seen even though not having the perms 2018-02-10 11:00:19 +01:00
tastybento
f8da3fbc61 Fixed bugs with MySQLDatabaseHandler
Code clean up, fixed bugs. Added automated tests.
2018-02-09 17:06:32 -08:00
Tastybento
aae4c6d0b2 Rewrote safe teleport.
Needs testing.
2018-02-08 23:47:11 -08:00
Tastybento
f3d7bf2af3 Refactored code to make it better to maintain and read. 2018-02-08 21:17:16 -08:00
Tastybento
80f0a78f08 Removed stack trace as exception already logged. 2018-02-08 20:12:23 -08:00
Tastybento
c916bbf827 Automated code cleanup.
Removes spaces, adds {} to if statements, etc.
2018-02-08 20:08:46 -08:00
Tastybento
98b49ea37a Fixed bug where if statement had a ; in it 2018-02-08 20:06:00 -08:00
Tastybento
5314f3618a Removed unused imports. 2018-02-07 21:33:55 -08:00
Tastybento
b253ff5c64 Code cleanup. 2018-02-07 21:33:36 -08:00
Tastybento
fc8876cf80 Fixed return values to match pass/fail. 2018-02-07 21:13:32 -08:00
Tastybento
2be005acb1 Removed vulnerabilities
Mainly leftover raw stacktrace prints in exceptions instead of propper
logging statements.
2018-02-07 21:11:23 -08:00
Tastybento
b833b17d22 Helped secure the prepared statement 2018-02-07 20:43:13 -08:00
Tastybento
41dd491f05 Code cleanup. 2018-02-07 19:44:10 -08:00
Tastybento
1d5086531d Removed performance hit of logging
Since Java 8, we can use Supplier for logger, which will be evaluated
lazily.

In general, the debug stuff should be removed when we have more
stability.
2018-02-07 19:39:00 -08:00
Tastybento
29d09922b9 Switched to use Files.delete
When File.delete fails, this boolean method simply returns false with no
indication of the cause. On the other hand, when Files.delete fails,
this void method returns one of a series of exception types to better
indicate the cause of the failure. More information is generally better
in a debugging situation, so I'll use this option.
2018-02-07 19:33:59 -08:00
Tastybento
08b2e2579b Reverted to using an explicit throw of all exceptions 2018-02-07 19:28:29 -08:00
Tastybento
e4fbc6fab1 Simplified code, no need for internal variable. 2018-02-07 19:16:05 -08:00
Tastybento
3f35afc76a Close is handled automatically. 2018-02-07 19:13:40 -08:00
Tastybento
7e7b259531 Converted Map to EnumMap
When all the keys of a Map are values from the same enum, the Map can be
replaced with an EnumMap, which can be much more efficient than other
sets because the underlying data structure is a simple array.
2018-02-07 19:12:23 -08:00
Florian CUNY
7b55ca70b2 Fixed some Flags and added a security check in FlagsManager
...to avoid duplicates of Listeners
2018-02-07 13:41:37 +01:00
Florian CUNY
f33fa2477a Use .equals() in #isBanned(UUID) in Island 2018-02-07 13:33:37 +01:00
Florian CUNY
12cac6b3aa Minor adjustments to ranks-related methods in Island 2018-02-07 13:29:19 +01:00
Florian CUNY
293ab2ccf9 Added default values to Settings 2018-02-07 13:16:09 +01:00
Tastybento
e5a87ccf7a Code cleanup and bug fixing.
This just cleans up a lot of code that could cause confusion or was
actually wrong.
2018-02-06 23:04:09 -08:00
Tastybento
1db21c10da Fixed bug with help that I introduced.
Added specific convenience showHelp() method to Composite command.
2018-02-06 22:45:21 -08:00
Tastybento
61f0a6f997 Made homeTeleport void because it does not return anything useful 2018-02-06 22:02:14 -08:00
Tastybento
ad50b04177 Removed unneeded method. 2018-02-06 21:59:15 -08:00
Tastybento
eefcd48c7c Fixed return values for execute. 2018-02-06 21:57:45 -08:00
Tastybento
af5c7e472e Fixed execute return values. 2018-02-06 21:48:59 -08:00
Tastybento
a9373a3eea Fixed return values - false = error 2018-02-06 21:46:59 -08:00
Tastybento
00470b1fc8 Return false if error. 2018-02-06 21:45:10 -08:00
Tastybento
3e2d2ec2d6 Return false if unsuccessful due to no island. 2018-02-06 21:44:40 -08:00
Tastybento
219d1e66ab Fixed brackets. 2018-02-06 21:43:31 -08:00
Tastybento
f4c7a3fe45 Made command return false if unsuccessful. 2018-02-06 21:40:29 -08:00
Tastybento
81b0543f25 Added missing break statement to switch. 2018-02-06 21:34:48 -08:00
Tastybento
574febb327 Added missing break statement in switch. 2018-02-06 21:34:20 -08:00
Tastybento
2e89a2654f Added more try-with-resource to auto-close prepared statement 2018-02-06 21:33:05 -08:00
Tastybento
fdc7a62990 Fixed issue where Optional was not being explicitly checked before get. 2018-02-06 21:31:59 -08:00
Tastybento
2d64070d3f Avoided setting static variable in non-static method. 2018-02-06 21:31:19 -08:00
Tastybento
5a5ae2d077 Used Java standard ordering of words 2018-02-06 21:30:56 -08:00
Tastybento
ed622dc9c0 Fixed switch break bug. 2018-02-06 21:30:35 -08:00
tastybento
bb404380f5 Replaced raw stack trace dumps with helpful error messages. 2018-02-06 16:37:34 -08:00
tastybento
aac17990bc Made description private. 2018-02-06 16:09:49 -08:00
tastybento
8b7d92d8e6 Added better error message for exception when loading addons. 2018-02-06 16:06:04 -08:00
tastybento
04a4394752 Make addon non-public and provide getter to address minor vulnerability. 2018-02-06 16:04:22 -08:00
tastybento
7e2f8052da Improved exception handling error messages. 2018-02-06 15:59:42 -08:00
tastybento
1e920825ef Added context to raw stack trace dump after exception. 2018-02-06 15:55:31 -08:00
tastybento
672d43fb67 Fixed unnecessary if statement and removed redundant code. 2018-02-06 14:11:10 -08:00
tastybento
56ff9f62e4 Used try-with-resources to ensure jar is closed. 2018-02-06 14:07:35 -08:00
tastybento
28b88763e6 Changed Optional map to ifPresent because return value is not needed. 2018-02-06 14:05:48 -08:00
tastybento
8743ac50ef Removed duplicate sub-expression in if statement. 2018-02-06 14:02:58 -08:00
tastybento
941d9d3dc5 Removed if/else change because it is not required. 2018-02-06 14:01:52 -08:00
tastybento
d2098c3dbe Check if Optional click handler exists before getting it. 2018-02-06 13:59:23 -08:00
tastybento
2c1d52761f Cast operand to double. 2018-02-06 13:54:23 -08:00
tastybento
06e61d858c Fixed a lot of unclosed prepared statements, connections and resultset 2018-02-06 13:52:25 -08:00
tastybento
84d36a1a24 Simplified some logic. 2018-02-06 13:35:17 -08:00
tastybento
f7c4e5a988 Added null checks. 2018-02-06 13:33:08 -08:00
tastybento
1ddf706c68 Bug fixes to avoid NPE's and Optional gets without isPresent 2018-02-06 13:21:08 -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
ffbf938a32 WIP trying out moving flags into flag manager. 2018-02-05 14:30:35 -08:00
tastybento
812594783e Made Adapter its own annotation. 2018-02-05 11:35:50 -08:00
Tastybento
26956d8386 Fixed missing locale text for invites.
Fixed config settings for teams.
2018-02-04 21:48:34 -08:00
Tastybento
fa1ccd0c99 Fixed bugs with MySQL saving and loading.
Added the adapter annotation to MySQL and fixed issues with empty
hashmaps causing null errors.

Added a flag serializer adapter for the protection flags so that flags
are saved and loaded correctly.

Renamed the Adapter notation class to be clearer about what it is doing.
2018-02-04 12:53:17 -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
df0ecca217 Added dependency injection (DI) for flag listeners for plugin.
This is required for automated testing (can't use static getInstance). I
really need automated testing of the protection classes, so even though
this adds a parameter to the classes, it's important to have it right
now.
2018-02-03 11:54:33 -08:00
Tastybento
1427f16bec Merge branch 'ranks' of https://github.com/tastybento/bskyblock.git into ranks 2018-02-02 08:22:00 -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
Florian CUNY
3d7b1bc647 Renamed PVP and Item Drop/pickup related flags
Also assigned the ItemDropPickUpListener() to the related events
2018-02-02 15:29:24 +01:00
Florian CUNY
5293d647c0 Removed duplicate listeners in Flags 2018-02-02 15:22:37 +01:00
Tastybento
72c99656cc Added the protection listeners. Took all day!
Generally these are very easy to understand. They use an abstract class
for common code.

I have not tested these in-game. I would like to see if I can create
some test classes but it may not be possible because of the static
BSkyBlock calls.
2018-02-01 20:30:57 -08:00
tastybento
4fe94bee3b Finished up the place and break block listeners.
There's a lot more that needs to be checked in these listeners! I moved
some common methods into the abstract class because they will be used
again and again by other listeners.

Added an anvil listener.

Added the flags. They were from ASkyBlock so may have name changes.
2018-01-31 15:46:38 -08:00
tastybento
5b087c83e7 Fixed comment. 2018-01-30 17:00:09 -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
417f767705 Added a Ranks Manager 2018-01-28 12:47:17 -08:00
Tastybento
eec4e99172 Added ranks to island members. More to do! 2018-01-28 11:48:54 -08:00
Tastybento
f1072e5984 Fixed flag optional aspect. 2018-01-28 09:47:51 -08:00
Florian CUNY
1d5b0ab8dd API Improvements on PanelItem and Flags
Their respective builders now have default values
Flags get automatically registered once built
Added some convenience methods
2018-01-28 13:31:07 +01:00
Tastybento
2b434bf93a Added ability for panel description to be just a string. 2018-01-27 15:58:15 -08:00
Tastybento
970711ca63 Merge branch 'develop' of https://github.com/tastybento/bskyblock.git into develop 2018-01-27 15:48:53 -08:00
Tastybento
67e05955f8 Made skyblock sky again. The sea water level was being set. 2018-01-27 15:48:44 -08:00
Florian CUNY
72c862c0d5 Starting to implement some Flags to test the API 2018-01-27 17:04:08 +01:00
Florian CUNY
6c08763cbb Made PanelItemBuilder methods' name suit the Builder style 2018-01-27 17:03:30 +01:00
Florian CUNY
9cc9518bc3 Fixed new-island.signs.line* locale entries 2018-01-27 16:47:30 +01:00
Florian CUNY
8b636a8ee3 Minor code quality fixes 2018-01-27 16:39:02 +01:00
Tastybento
475f9b1416 Made changes to fix events and support the FAWE addon. 2018-01-25 22:19:33 -08:00
Tastybento
9ce1dbf592 Added team kick and leave commands. Need full testing. 2018-01-24 20:49:08 -08:00
Tastybento
f6ca7f7866 Fixed subcommand aliases. Added admin tp command.
While writing the admin tp command, I realized that subcommand aliases
were not working. Also, it was not possible to tell what alias had been
used for a command. I added that capability. i.e., if the alias is used,
then the label of that command is set to the alias.
2018-01-21 12:58:35 -08:00
Tastybento
c3c0a87dbb Added block search when making a new island. Fixed sign text.
When finding a spot for a new island, the algorithm will ensure the
island location is on the grid and check around for any blocks that may
be there already. If they exist, then they will be added as unowned
islands to the database.
The sign text was not using the correct locale tags.
2018-01-20 10:30:26 -08:00
tastybento
1b1e30c125
Merge pull request #125 from tastybento/config-api-v2
Submitting a modular and automatic Config API
2018-01-08 11:27:01 -08:00
Tastybento
09b9d4dd49 Now uses the official config.yml in the BSkyBlock data folder.
Saves a backup of the config after validation in the database so it can
be checked.

To Be Done: Validation of the config when it is loaded against the
database version.
2018-01-07 14:43:37 -08:00
Tastybento
16bcb90127 Added saveSettings and loadSettings methods.
These methods are used specifically for loading and saving settings
classes (those use the ISettings interface). The saving saves a copy of
any settings class in the database for future reference. The loading
loads a copy from the database if it exists and checks if any fields are
different from the config file. If they are different and some action
needs to be taken, the action is taken. This is still be to be coded.

In other news, the saving of arrays is unsupported and currently should
be avoided. Use Lists or Sets instead.
2018-01-07 11:56:43 -08:00
Tastybento
2765e5f3ab Fixed code according to comments on last commit.
Reworked locales so they use a nice and pretty folder structure.

Added the ability to define adapters to serialize certain data
structures. Added the PotionType list adapter.

Saving and loading of configs basically works. Known issues:

1. The config.yml is saved and loaded to/from the database folder
2. More error handling is required for the config loading. e.g., a list
value with only one value in it is not read as a list. This could get
tricky.
3. Comments are not saved (yet)
2018-01-06 19:40:25 -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
Tastybento
2d447afa88 Added annotation handling to the flatfile database handler.
Currently it handles the @ConfigEntry path and specificTo fields.

Experimental: There is a class called Setting2.java. It has an
annotation that defines its filename as config.yml. Currently, it is
using the database folder as its location, but it could be the plugin's
datafolder in the future. By placing the config.yml file in the database
folder, it will be read. See the code in BSkyBlock onEnable() for how
that is done.

The main differences between Settings2.java and Settings.java are that
all fields are NOT static and therefore it is an object and uses getters
and setters. This is because it is a JavaBean. In other code, settings
should be queried using this config object.
2018-01-05 19:58:08 -08:00
Tastybento
478968dac7 Extended the config api annotations.
Added the concept of an adapter class that would convert the YAML input
to the setting type and value.
I included an example adapter class for Enum.

I fixed a number of the settings to match the config/yml or the other
way around.

After compiling and running, do /bsb reload to see the result.

This is a WIP and obviously not finished.
2018-01-04 19:58:04 -08:00
Florian CUNY
01dc515d57 Merge branch 'develop' of https://github.com/tastybento/bskyblock into develop 2018-01-04 20:35:12 +01: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
Florian CUNY
b7f1d68bcf Store the locale files in their own "parent" folder, so it looks nicer, instead of having a prefix
also renamed BSBLocale#add() to BSBLocale#merge()
and renamed the locale files as well
2018-01-04 14:14:18 +01:00
Tastybento
4aaab9f69f Added a depth limit to the help command. 2018-01-03 21:37:37 -08:00
Tastybento
b324e7d0e0 Fixed teleport to island message. 2018-01-03 20:43:58 -08:00
Florian CUNY
d56326feb0 Made /is about easier to read 2018-01-03 22:11:55 +01:00
Florian CUNY
afa292986d Removed the cache from BSBLocale
because YAMLConfiguration is a cache itself.
2018-01-03 21:57:32 +01:00
Florian CUNY
62480d7249 Fixed NPE in User when doing #getTranslation(reference, ...variables)
it was due to the null value possibly returned by the LocalesManager#get(user, reference) method when nothing has been found, leading the variables replacement to cause a NPE.

User#getTranslation(reference, ...variables) now does the check and return the reference if the translation found equals null BEFORE trying to replace variables.
User#getTranslationOrNothing(reference, ...variables) works the same as before, it just checks if the returned translation is the same than the reference (therefore it returns the blank String), otherwise it sends the translation.
2018-01-03 21:41:30 +01:00
Florian CUNY
f8c1dba503 Added localized message for "Creating your island" 2018-01-03 21:19:48 +01:00
Florian CUNY
c28853e301 Load ResetnameCommand before SethomeCommand
just because it looks nicer in the /is help 😛
2018-01-03 21:16:25 +01:00
Florian CUNY
351dfac3cd Fixed /is create creating an island even when the player already had one 2018-01-03 21:15:30 +01:00
Florian CUNY
7acc8d5401 Minor changes in CompositeCommand
Notably improved the #isPlayer(user) condition
2018-01-03 21:15:01 +01:00
Florian CUNY
b8dcc98a0c Removed useless accessibility keywords in BSBCommand interface 2018-01-03 21:14:11 +01:00
Florian CUNY
34f291b17f Minor changes in User and IslandBuilder
Mainly spacing but also optimized the User#hasPermission() condition
2018-01-03 21:06:28 +01:00
Florian CUNY
c6ea8ff4c4 Made LocalesManager final (so it cannot be extended)
also added authors :)
2018-01-03 20:51:20 +01:00
Tastybento
6ef6416c5a Fixed test class to not assert on /test. 2018-01-03 08:24:50 -08:00
Tastybento
7e9a287143 Added help text top and bottom
Fixed top-level-command weirdness. / is required in getUsage().
2018-01-03 08:21:49 -08:00
Tastybento
d86c763716 Fixed island multihome to match new syntax.
Renamed island multihome to start with "Custom" to make it clearer. This
class is as much an example as anything of how to override the default
help.

Renamed my author tag to be tastybento. :-)
2018-01-03 07:56:10 -08:00
Florian CUNY
a0cbb451fa Fixed IslandCommand description not being a valid reference 2018-01-03 16:12:08 +01: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
Florian CUNY
6536ff58cc Fixed user#getTranslation() not replacing variables 2018-01-03 16:09:54 +01:00
Tastybento
5aa3594f42 The color update!
Added colors to help text.
2018-01-02 19:36:53 -08:00
Tastybento
30fb087777 Implemented locales that include addons.
This is a first working version and can probably be improved.

Firstly, the plugin will save any BSkyBlock language files to the locale
folder from the BSkyBlock jar if and only if the locale folder does not
exist. It will then do the same for any addons as they are loaded. Addon
language files are prefixed with their addon name to keep them separate
and recongnizable.

Then the plugin loads the language files and merges common languages
together into a YAMLConfiguration that is held in memory. The combined
config is never saved out to the file system.

If a request is made for a particular reference to a language that does
not exist or if the reference does not exist, then the default language
is tried.
2018-01-01 18:32:59 -08:00
Tastybento
32794a5d3f Added comments for clarity. 2018-01-01 14:17:47 -08:00
Tastybento
037bf04836 Added methods to allow shared classes across multiple addons.
The original code did not allow addons to talk to each other in any way.
After trying loads of things with class path I studied the bukkit code
and saw that they override the findClass method in URLClassLoader. This
enables addons to find classes in other addons. All that was then needed
was a map in the AddonsManager of classes that this manager knows about
and a getter and setter method for them. After all that (3 hours) it
works.
2018-01-01 11:40:25 -08:00
Florian CUNY
df5434930c Renamed SettingChangeEvent to FlagChangeEvent and removed references to SettingsFlag 2018-01-01 01:53:03 +01:00
Florian CUNY
22ad8285a5 Replaced SettingsFlag references in config-related classes 2018-01-01 01:52:32 +01:00
Florian CUNY
ae0dc7c538 Implemented basic Flags API
Removed Island's SettingsFlags
Fixed Island#toggleFlag()
2018-01-01 01:41:19 +01:00
Florian CUNY
1d3c82d1c7 Minor change in PanelListenerManager to use Optional#ifPresent() 2018-01-01 01:18:43 +01:00
Tastybento
bfcbd44478 Minor changes around Optional. 2017-12-31 16:12:53 -08:00
Florian CUNY
131a8affca PanelsAPI - Fixed ambiguous logic with the cancellation of the clickevent 2018-01-01 00:55:53 +01:00
Florian CUNY
5ea46aea29 Removed useless accessibility keywords in Interfaces 2018-01-01 00:43:32 +01:00
Tastybento
b03d4552fd Added addons manager to BSKyBlock.class 2017-12-31 15:31:08 -08:00
Tastybento
002c54ef21 Fixed issues while implementing the warps addon. 2017-12-31 14:08:15 -08:00
Tastybento
5b6e3cec7e Fixed database bugs.
Made the code more robust by using isAssignableBy() to check super
classes.
2017-12-31 12:51:57 -08:00
Tastybento
109c0edca3 Panel additions or changes.
By working on the Warp addon I made changes to the Panel API.
2017-12-30 21:14:58 -08:00
Tastybento
06dec42029 Moved a method to use User instead of Player. 2017-12-30 17:28:25 -08:00
Tastybento
1f92c2b60e Added more around the Panel API. 2017-12-30 17:13:20 -08:00
Tastybento
1f57e1eb0b Fixed return type of getBSkyBlock() 2017-12-29 11:02:38 -08:00
Tastybento
4289a24c56 Improved the panel API.
I'm working on addons and realized it would be a better approach to be
able to register the listener for a panel explicitly for each panel.
This is optional. Also, added the ability to open the panel immediately
for a player.
2017-12-29 09:11:14 -08: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
Tastybento
9b0992c30d Removed perm checks for console. 2017-12-28 17:20:33 -08:00
Tastybento
4d7b5374e5 Bolstered error reporting for malformed addon.yml files. 2017-12-28 17:11:49 -08:00
Tastybento
6e6165a301 Merge branch 'develop' of https://github.com/tastybento/bskyblock.git into develop 2017-12-28 11:56:55 -08:00
Tastybento
a15b1b2371 Added saveResource method to AddOn save to a specific folder. 2017-12-28 11:56:45 -08:00
Florian CUNY
cb2d24c779 Removed useless AddonStates and added MISSING_DEPENDENCY 2017-12-28 20:50:24 +01:00
Tastybento
92213f20c1 Addon data folder name change. 2017-12-28 11:32:57 -08:00
Tastybento
d3490a6f24 Added comments to Addon. Added save config method. 2017-12-28 09:37:07 -08:00
Florian CUNY
c2271ae229 Removed TeamChatEvent, CoopJoinEvent and CoopLeaveEvent
because their related features won't be implemented in BSB
2017-12-28 15:30:18 +01: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
Florian CUNY
40c59f2f7e AddonsAPI - Polishing the API
Renamed all the classes
2017-12-28 14:50:02 +01:00
Florian CUNY
86ad00acab AddonsAPI - Polishing the API
Temporarily remove api/addons folder to rename files
2017-12-28 14:49:27 +01:00
Tastybento
687a71876d Completed the addons additions.
Everything seems to work okay.
2017-12-27 19:16:13 -08:00
Tastybento
f80a933c34 Merge branch 'develop' into addons 2017-12-27 14:03:52 -08:00
Tastybento
fcaa3514ac Fixed NPE bug when getting plugin. 2017-12-27 14:03:00 -08:00
Tastybento
4fc33cb9f7 Mid-work. 2017-12-27 13:59:27 -08:00
Tastybento
b1f798ae5b Comment fix. 2017-12-27 13:52:52 -08: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
Florian CUNY
bdbe271a83 Removed #sendSubtitle() and #sendTitle() from NMSAbstraction
because Spigot 1.12 supports it with Player :D
2017-12-26 21:10:39 +01: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
239cf50709 Switched to a getter for getPlugin() in CompositeCommand
Made internal variable protected.
2017-12-26 08:40:28 -08:00