Commit Graph

213 Commits

Author SHA1 Message Date
Tastybento
ea089b5b7d Moved hasTeam and hasIsland from PlayersManager to IslandsManager
Added IslandTeamInviteCommandTest.
2018-05-06 16:26:40 -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
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
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
0bdc146da3 Added confirmation to IslandResetCommand
Added test class.
2018-04-28 12: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
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
ecb630fac3 Fixed some code smells 2018-04-25 13:48:58 +02:00
Florian CUNY
5ebbc2e374 Created the language panel. It is currently not localized. 2018-04-23 21:16:08 +02: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
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
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
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
cf792779f9 Now using JSON-based data for MySQL
Large number of changes to improve database functions.
2018-03-12 04:08:19 +09: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
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
Florian CUNY
f648c936ad Continued working on the SettingsPanel. Did minor fixes in PanelItemBuilder 2018-02-26 20:18:09 +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
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
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