https://github.com/BentoBoxWorld/BentoBox/issues/523
Uses safe-spot teleport to teleport players.
The spawn point of an island was not being set by the setspawn command.
The spawn point on the spawn island can now be reset using the setspawn
command.
If the spawn point does not exist, a safe spot will be found.
Added AdminSetspawnCommand test class.
The reason the test was failing was because the check on whether the
player had an island or not was not being done. I added the check back
in. So now, if a player has no island, the portal will just do nothing.
* WIP - adds admin commands to handle damaged island db
Trash, purge, etc.
DO NOT MERGE YET
https://github.com/BentoBoxWorld/BentoBox/issues/505
* Prefixes the island uniqueId with the game mode name.
This enables manual removal of old game mode island files from the
database by admins if required.
* Adds Admin trash and empty trash commands
* Adds various commands for trash management
* Remove unused imports
* Forgot the javadoc in IslandsManager
* WIP - See FlagListener.java for changes
Makes declaring the player mandatory for checkIsland method so it cannot
be forgotten and will be fresh every check.
See BlockInteractionListener for how it will look.
* Update src/main/java/world/bentobox/bentobox/api/flags/FlagListener.java
Co-Authored-By: tastybento <tastybento@users.noreply.github.com>
* Update src/main/java/world/bentobox/bentobox/api/flags/FlagListener.java
Co-Authored-By: tastybento <tastybento@users.noreply.github.com>
* Adjusted all the flags to new API
https://github.com/BentoBoxWorld/BentoBox/issues/535
due to race conditions with task timers and incorrectly shared field
variables, islands would not paste completely if pasted every tick.
Now pasting is handled in its own class with a new instance created with
each paste.
A lot of the commands were not firing events. These events are now
needed by addons.
Added new JOINED, REGISTERED, UNREGISTERED reasons for events.
Switched to using Bukkit.getServer() instead of plugin.getServer() in a
number of classes because the former can be mocked but the latter cannot
be because it's marked as a final method in JavaPlugin.
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/506
Also, admin unregister was blocking unregistration of team players, but
that is an artificial constraint, so I enabled it. Without it, it would
not be possible to correct weird team issues like this one after they
happen.
https://github.com/BentoBoxWorld/BentoBox/issues/486
Includes an autofixer for corrupted files and test for the adapter.
LogEntry was changed to just store strings instead of arbitrary types.
Unless the log serializer were to store hints as to what type of data
was being stored, it is impossible to deseralize. To make it all
simpler, we just store strings. If the UUIDs need to be converted back
to players are some point, that can be done based on the type of the log
stored.
Previous the Flags class was being used to grab all flags. This is wrong
because it may not contain all the flags that may exists, for example
ones registered by other addons. The correct way is to request flags
using the getFlag() method in the flags manager class.
This change was to prepare for the time when addons will register their
own flags with BentoBox.
Note: If using the User class in a test, you MUST set the mock plugin object using the User.setPlugin() method otherwise each test will use the wrong plugin object and verifications will not work.
Island deletion is done a few chunks at a time per tick. Current speed
is 5 chunks per tick per world (e.g., 15 chunks per tick if nether and
end islands are used).
Chunks are deleted based on the all-time maximum protection range of the
island. This is because the protection range can grow bigger or smaller
over the island's lifetime. To ensure all possible chunks are erased,
the largest every protection range is remembered and used.
Very large protection ranges will take a long time to fully delete.
Info on islands that are being deleted is stored in the database. If the
server shuts down mid-deletion, deletion will restart when the server
restarts.
While an island is being deleted, new islands cannot occupy that spot
and the spot cannot be reserved by the admin.
In addition, async approaches to island saving and player saving were
removed. Async will be implemented another way.
Now, instead of saving the full island or player database, individual
database entries are saved instead to be more efficient.
They respectively got renamed to Island#ban() and Island#unban(). They now require the UUID of an issuer (which can be null, but it's better to provide one)
AddonDescriptionBuilder has been renamed to AddonDescription.Builder ; and there is no longer public constructors in this class.
This change is obviously API breaking, but it's relatively "internal", so hopefully people didn't use it.
Speed of schem pasting is in the config.yml of BentoBox.
Old schems will work and paste async, but attached blocks, e.g.,
torches, may fall off due to being pasted ticks before the supporting
block is pasted. Newer schems will not have this issue.
Further work is needed to optimize entity pasting.
Known issue: if a player logs out during the pasting, things go wrong
until the next reload. Needs investigation and mitigation.
There's no mitigation against the server shutting down or crashing
mid-paste.
This was a bigger job than expected. I moved the addon loading locale
stuff into the LocalesManager class from the AddonsManager and put a jar
file lister in Utils. There could be some more combining of plugin jar
and addon jar file finding there. Finally, I added a sophisticated test
that creates a temporary addon jar with a locale file and checks that it
is saved correctly. Phew!
Flag was marked as deprecated, which may be okay, but because it caused
a lot of warnings in the tests because they bypass the builder I removed
the deprecation but kept the warning in the JavaDoc.
This will load all schems in an add-on's schem folder if it exists and
associate them with this world set (overworld, nether and end). Schems
can be named anything, but the partner nether or end worlds must be
pre-fixed with "nether-" or "end-" in the filename.
Additional schems can be added by the admin into the schem folder, or
they can be stored in the jar file of the add-on. Both are supported.
No changes are required to current add-ons. I.e., there is no API
breakage here, but I would like to rename the SchemsManager method
loadIslands(World world) to be loadSchems(World world) in the future.
Related issues/PR:
https://github.com/BentoBoxWorld/BentoBox/issues/104https://github.com/BentoBoxWorld/BentoBox/issues/207https://github.com/BentoBoxWorld/BentoBox/issues/378https://github.com/BentoBoxWorld/BentoBox/pull/408
This will improve the consistency of the code, as well as the Javadocs.
Locales (and some other files) still need to be updated to remove these references to team leader.
Fixes#281
Replaced Addon#setEnabled(boolean) with Addon#setState(Addon.State).
Now, if an exception gets thrown while enabling an addon, it'll automatically stop enabling it and set its state to "INCOMPATIBLE" or "ERROR". These values could later be get to be displayed in the version command.
I edited it so it only happens on BentoBox's panels. Having it closing "every" inventory was causing issues with vanilla inventories (crafting table, etc...)
I could not fix the related tests though : PanelListenerManagerTest#testOnInventoryClickOutside (PanelListenerManagerTest.java:128) is failing every time.
Removed purge-related settings.
Renamed all database-related settings and methods to replace `db` with `database`.
Moved confirmationTime to `island.confirmation.time`.
Renamed inviteWait, banWait and resetWait to inviteCooldown, banCooldown, resetCooldown. Also moved them under `island.cooldown.x`.
Removed kickWait and leaveWait, using confirmationTime instead.
Moved `island.require-confirmation.<command>` to `island.confirmation.commands.<command>`.
Updated tests.
Updated getters and setters using code automation. Sadly, this wiped out all the Javadoc.
Also commented out CellState.RESERVED.
That was a tough one. I had to rewrite IslandGrid#getIslandAt(int, int) quite a few times before using the stream() thing. I tested it a bit - it seems it is working like a charm.
I just hope that it won't be something useless - another plumbing change that adds nothing. It shouldn't - because of the "RESERVED" thing - but, well... it's been quite a hard thing!
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...
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.
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.
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.
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).
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)
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.
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.
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.
Removed constructor from LockAndBanListener. Due to loading order, some
manager objects are null. Flags load very early so must assume
everything is null.
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.
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.
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.
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.
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.
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.
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.
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!
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.
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!
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.
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).
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
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?
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
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.
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).
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.
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!
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.
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
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.
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. :-)
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
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.
Sub commands work, tab complete works. See the TestIslandCommand.java
test command for how to use the API and unit tests.
Still need to do the auto-help.
Commands work and tab complete works somewhat.
Help still needs to be done. Added in NotSetup And PluginConfig to just
make the plugin work. It's fine to remove them when there is a working
alternative.