Commit Graph

36 Commits

Author SHA1 Message Date
tastybento
aa7fbabf82 Fixed bugs with NPEs in non-island worlds. 2018-06-10 22:34:01 -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
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
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
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
f5b5426327 Created TextVariables class that contains common text placeholders 2018-06-03 10:07:58 +02:00
tastybento
e7649f19d4 Added cycling click to protection flags. 2018-06-02 11:27:51 -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
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
Florian CUNY
ecb630fac3 Fixed some code smells 2018-04-25 13:48:58 +02:00
Tastybento
b20fbd55a4 Cleaned up imports and unneeded exceptions 2018-03-11 15:59:03 -07: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
f648c936ad Continued working on the SettingsPanel. Did minor fixes in PanelItemBuilder 2018-02-26 20:18:09 +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
Tastybento
97491b1d89 Removed unused imports 2018-02-25 18:21:42 -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
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
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
ffbf938a32 WIP trying out moving flags into flag manager. 2018-02-05 14:30:35 -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
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
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
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
ae0dc7c538 Implemented basic Flags API
Removed Island's SettingsFlags
Fixed Island#toggleFlag()
2018-01-01 01:41:19 +01:00