Skip to content

Commit

Permalink
Release 1.17.3 (#1827)
Browse files Browse the repository at this point in the history
* Version 1.17.1

* Add homes command to default player options.

* Implements better online player counter. (#1791)

Current one is based on online player count when bStats sends data to the server.
This one will send data about amount of players who logged in the server.

* Add Boxed Gamemode to the list. (#1793)

* Add Bank addon (#1792)

* Add Holographic Displays as SoftDepend for AOneBlock (#1794)

* Custom date time format support for /<admin> info <player> (#1783)

Fixes #1720

* Parent/sub-flag support, split up and designate CONTAINER flag as parent flag (#1784)

* Split CONTAINER flag into multiple flags

CONTAINER split into
- CONTAINER (Chest/Minecart Chest)
- BARREL (Barrel)
- COMPOSTER (Composter)
- FLOWER_POT (Flower Pot)
- SHULKER_BOX (Shulker Box)
- TRAPPED_CHEST (Trapped Chest)

Fixes #1777

* Add subflag support

* Create container parent flag, chest subflag

* Remove extra string from when CHEST was CONTAINER

* Fix incorrect flag specified on fired event in IslandToggleClick

* Add missing world subflag event firing

* Remove extra import

* Add world setting flag for island visitors keep inventory (#1785)

* Implement 3 bar charts: addons, gamemodes, hooks (#1790)

BStats supports sending Bar chart data, however, it does not display it via their site directly.
It can be called manually, to view.

PieChart does not work very well for addons and hooks. BarChart however allows viewing each addon separately. 

This change allows sending data to the server about bar charts.

* Update action versions

* Declare distribution - adopt

* Cache Java Maven files differently.

* Try dependency for shade snapshot

* Add support for Minecraft 1.17.1

* Fix test by incrementing listener value check

There is a new listener now.

* Spigot 1.17.1

* Fix test for InventoryListener

* Re-order repos.

* Downgrading to 1.17 Spigot for now to enable building.

* Try pluginRespositories tag in POM to enable Github actions

* Version 1.17.2

* Add alternative Addon#getIslandManager method (#1797)

We have already done this to the main BentoBox class. But add-ons missed it, and it still has this weird structure: Addon#getIslands().getIslands().

This will just add the same method as it is already in BentoBox class.

* Fix bucket dupe (#1806)

Fix https://discord.com/channels/272499714048524288/310623455462686720/867790395442462760

* Removes unneeded exploit protection code for skulls (#1810)

This no longer seems to be required with 1.17.1

https://github.com/BentoBoxWorld/BSkyBlock/issues/430

* Quote filename of addon that cannot be loaded.

Provides a better understanding of which addon failed.

* Remove update when pasting chest.

* Version 1.17.3

* Java upgrade (#1814)

* Version 1.17.3

* Use Map.of and List.of instead of Immutable collections

* Replace explicit type argument.

* Replace lamba with method reference

* Replace condition with Objects.requireNonNullElseGet

* Use String.repeat

* Use new switch expressions

* Use instanceof patten variables which are more compact

* Fuse toUnmodifiableList into stream and return it.

* Remove unnecessary toString() calls.

* Remove unnecessary public

* Extracted common part from if

* Simplify conditional expressions

* Remove unused IOExceptions

* Cast to long

* Use Map.putAll

* Use primitives

* Clarify what is null or not

* Addedd @serial annotation introduced with Java 14.

* Use Optional.isEmpty instead of !isPresent

* Use flatMap then ifPresent

* Just use Arrays.stream

* Swap map and filter for null with Objects::nonNull

* Use expression lambda

* Update JavaDoc version to 16

* Make spawn protection area square instead of circle.

#1819

* Improve ItemParser code. (#1821)

* Improve ItemParser code.

Add ability to parse text if Material is just a single string.
Add ability to parse player heads.

Add comments to the code.

* Fixes failing test.

* Added deprecation suppression.

* Added Pladdon to loadbefore.

* Prevent bucket duping when scooping obsidian Part 35

#1825

* Warns visitors that PVP is active if they teleport to an island

#1780

* Prevents repeated portaling when nether is disabled. (#1826)

* Prevents repeated portaling when nether is disabled.

#1782

* Fix test

* Hex pr 1820 (#1822)

* Fix @SInCE for subflags. (#1831)

* Add Citizens to Softdepend list for NPC support (#1834)

* Fix color test.

* Set the default game mode when player makes island.

* Corrects JavaDocs link

Fixes #1838

* Update to 3.3.1-SNAPSHOT for shade plugin.

* Package info files for better JavaDocs (#1839)

* Added package info files for better JavaDocs

* Implement Flag icon changing via Locales file. (#1829)

This commit contains 2 changes:
- An option for Flag to use icon that is defined in locales after "icon" string.
- An option for ItemParser to parse icon or return given value, if parsing was not successful.

The flag option is not ideal, but it is simpler and easier to maintain then adding new config section where icons can be changed, as the locales file already contains a lot of info about each flag.

* Support glowing ink in blueprints (#1842)

Fixes #1837

* Panel template (#1841)

* Implement basic functionality to read data from template panels.

Create TemplateReader class that has static method which generates a PanelTemplateRecord. This record contains every necessary information from user created template file so everyone could use it to generate a functional panel.
These classes are just for reading templates and do not create actual panel.

* Add template clearing via bentobox reload command.

* Fix version command to show addon state.

* Fix German flag banner description.

Added more debug around error reporting.

* Make variables final if they can be. (#1843)

* Make variables final if they can be.

* Do not use final so that test can pass.

For testing, we use a trick to set this variable, but it won't work if
it is final. Right now, I'd like to keep the test.

* Static code analysis (#1844)

* StringBuffer (Java 5) may be declared as StringBuilder

* Replace map with flatMap

* Use instanceof naming

* No need to specify paramter types.

* Remove verbose code

* Fix JavaDoc issues

* Make internal class a record.

* Remove unused import.

* Make internal class a record.

* Made internal class a record.

* Removed unused import

* Fix typos

* Fix typo in test.

* Prevent home teleport when already home teleporting

Home teleporting is async so it's possible to issue the command multiple
times. This puts a flag in so that if a playeer is mid-teleport, then
issuing the go command will just repeat the text that the player is
teleporting home.

#1637

* Extracted island info from the Island object.

This is in preparation to have a different info for players than admins.

#1501

* Slimmer trimmer island info for players.

#1501

* Fixes coop and trust invites when team invites are not allowed

If a member or sub-owner has coop or trust invite capability and not
team invite rank, and confirm invites is on, then the invites were not
working.

Fixes #1452

* Remove invulnerable visitor protection if island is in PVP mode

We now have alerts if a player teleports to a PVP island.

#668

* Fixes NPE in admin tp if nether or end worlds don't exist.

* Adds arrow sound when teleporting into a PVP island.

* Fix PVPListenerTest

Visitors are no longer invincible when on a PVP island.

* Fix test failure in InvincibleVisitorsListenerTest

* Minor JavaDoc correction.

* Go command was not working second time.

* Prevents console errors for missing icons in locale files.

* Fixes PlAddon disabling issue. (#1847)

There was a bug that did not unload PlAddon classes from JVM.
This change should fix it, as it will unload PlAddons via pluginLoader.

* Clear code - set worlds once on construction.

* Fixes a bug when Potion metadata was not applied (#1849)

There was missing potion meta data applying after creating an item. 
This affects both: Potions and Tipped arrows.

* Adds force-shown lines to the template. (#1850)

* Adds force-shown lines to the template.
Fixes a bug when template type was not selected correctly.
Changes "name" to "title" for border and background icons.

* Create TemplatedPanel and TemplatedPanelBuilder.

TemplatedPanel uses PanelTemplateRecord to create a functional panel.
Builder contains button builder callbacks that are used to create buttons with custom data.

* Use final vars for lambdas to avoid them changing async

The processes could run async, especially when chunk loading took a
while, so using fields that could change would result in blocks being
missed, especially in the nether or end. Switching to final vars avoids
this.

Fixes #1840

* Remove travis.

Co-authored-by: BONNe <[email protected]>
Co-authored-by: Fredthedoggy <[email protected]>
Co-authored-by: Justin <[email protected]>
Co-authored-by: gecko10000 <[email protected]>
  • Loading branch information
5 people authored Sep 11, 2021
1 parent 1a7b7cd commit a6d70d6
Show file tree
Hide file tree
Showing 224 changed files with 3,493 additions and 1,631 deletions.
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ There are also plenty of other official or community-made Addons you can try and
## Documentation

* Start reading: [https://docs.bentobox.world](https://docs.bentobox.world)
* For developers: [Javadocs](https://bentoboxworld.github.io/BentoBox/)
* For developers: [Javadocs](https://ci.codemc.io/job/BentoBoxWorld/job/BentoBox/ws/target/apidocs/index.html)

## Downloads

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.17.2</build.version>
<build.version>1.17.3</build.version>
</properties>

<!-- Profiles will allow to automatically change build version. -->
Expand Down Expand Up @@ -353,7 +353,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<source>8</source>
<source>16</source>
<show>private</show>
<failOnError>false</failOnError>
<additionalJOption>-Xdoclint:none</additionalJOption>
Expand Down Expand Up @@ -387,7 +387,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>3.3.1-SNAPSHOT</version>
<configuration>
<minimizeJar>true</minimizeJar>
<relocations>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/world/bentobox/bentobox/BentoBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ private void completeSetup(long loadTime) {
}

private void fireCriticalError(String message, String error) {
logError("*****************CRITIAL ERROR!******************");
logError("*****************CRITICAL ERROR!******************");
logError(message);
logError(error + " Disabling BentoBox...");
logError("*************************************************");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public abstract class Addon {
private FileConfiguration config;
private File dataFolder;
private File file;
private Map<String, AddonRequestHandler> requestHandlers = new HashMap<>();
private final Map<String, AddonRequestHandler> requestHandlers = new HashMap<>();

protected Addon() {
state = State.DISABLED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
public class AddonClassLoader extends URLClassLoader {

private final Map<String, Class<?>> classes = new HashMap<>();
private Addon addon;
private AddonsManager loader;
private final Addon addon;
private final AddonsManager loader;

public AddonClassLoader(AddonsManager addonsManager, YamlConfiguration data, File jarFile, ClassLoader parent)
throws InvalidAddonInheritException,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,12 @@ public ConfigurationSection getPermissions() {
}

public static class Builder {
private @NonNull String main;
private @NonNull String name;
private @NonNull String version;
private @NonNull
final String main;
private @NonNull
final String name;
private @NonNull
final String version;
private @NonNull String description = "";
private @NonNull List<String> authors = new ArrayList<>();
private @NonNull List<String> dependencies = new ArrayList<>();
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/world/bentobox/bentobox/api/addons/Pladdon.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,13 @@ protected void moveJar() {
}

}


/**
* This method enables marks pladdons as enabled.
* By default, enable status is not set because onEnable and onLoad is not triggered.
*/
public void setEnabled() {
this.setEnabled(true);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package world.bentobox.bentobox.api.addons.exceptions;

import java.io.Serial;

public abstract class AddonException extends Exception {

/**
*
*/
@Serial
private static final long serialVersionUID = 4203162022348693854L;

protected AddonException(String errorMessage){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package world.bentobox.bentobox.api.addons.exceptions;

import java.io.Serial;

public class AddonRequestException extends AddonException
{
private static final long serialVersionUID = -5698456013070166174L;
@Serial
private static final long serialVersionUID = -5698456013070166174L;

public AddonRequestException(String errorMessage) {
super(errorMessage);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package world.bentobox.bentobox.api.addons.exceptions;

import java.io.Serial;

/**
* @since 1.11.0
*/
Expand All @@ -8,6 +10,7 @@ public class InvalidAddonDescriptionException extends AddonException {
/**
*
*/
@Serial
private static final long serialVersionUID = 7741502900847049986L;

public InvalidAddonDescriptionException(String errorMessage) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package world.bentobox.bentobox.api.addons.exceptions;

import java.io.Serial;
import java.util.logging.Level;

import org.bukkit.Bukkit;
Expand All @@ -9,6 +10,7 @@ public class InvalidAddonFormatException extends AddonException {
/**
*
*/
@Serial
private static final long serialVersionUID = 7741502900847049986L;

public InvalidAddonFormatException(String errorMessage) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package world.bentobox.bentobox.api.addons.exceptions;

import java.io.Serial;

public class InvalidAddonInheritException extends AddonException {

/**
*
*/
@Serial
private static final long serialVersionUID = -5847358994397613244L;

public InvalidAddonInheritException(String errorMessage) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* This package covers Addon exceptions
* <p>
* These exceptions can be thrown when the addon is loaded.
* </p>
*
* @since 1.0
* @author tastybento
*/
package world.bentobox.bentobox.api.addons.exceptions;
12 changes: 12 additions & 0 deletions src/main/java/world/bentobox/bentobox/api/addons/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* This package covers all addon-specific API
* <p>
* The Addon class and the associated Pladdon are like Bukkit plugins
* but contain extra API specific for BentoBox games.
* </p>
*
* @since 1.0
* @author tastybento
*
*/
package world.bentobox.bentobox.api.addons;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class AddonRequestBuilder
{
private String addonName;
private String requestLabel;
private Map<String, Object> metaData = new HashMap<>();
private final Map<String, Object> metaData = new HashMap<>();

/**
* Define the addon you wish to request.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* API to enable plugins to request data from addons.
* <p>
* Addons can expose data that they want to expose. To access it, call this class with the appropriate addon name,
* the label for the data that is requested and if required, a map of key-value pairs that will be given to the addon.
*
* <b>Note</b> Since BentoBox 1.17.0, Addons can be declared as Pladdons and be loaded by the Bukkit classloader. This
* enables Plugins to access Addon methods directly so this API is not required.
* </p>
*
* @author tastybento
*/
package world.bentobox.bentobox.api.addons.request;
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import world.bentobox.bentobox.util.Util;

/**
* BSB composite command
* BentoBox composite command. Provides an abstract implementation of a command.
* @author tastybento
* @author Poslovitch
*/
Expand Down Expand Up @@ -78,12 +78,12 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
/**
* Map of sub commands
*/
private Map<String, CompositeCommand> subCommands;
private final Map<String, CompositeCommand> subCommands;

/**
* Map of aliases for subcommands
*/
private Map<String, CompositeCommand> subCommandAliases;
private final Map<String, CompositeCommand> subCommandAliases;
/**
* The command chain from the very top, e.g., island team promote
*/
Expand All @@ -93,7 +93,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* The prefix to be used in this command
*/
@Nullable
private String permissionPrefix;
private final String permissionPrefix;

/**
* The world that this command operates in. This is an overworld and will cover any associated nether or end
Expand All @@ -104,17 +104,17 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
/**
* The addon creating this command, if any
*/
private Addon addon;
private final Addon addon;

/**
* The top level label
*/
private String topLabel;
private final String topLabel;

/**
* Cool down tracker
*/
private Map<String, Map<String, Long>> cooldowns = new HashMap<>();
private final Map<String, Map<String, Long>> cooldowns = new HashMap<>();

/**
* Top level command
Expand Down Expand Up @@ -144,7 +144,7 @@ protected CompositeCommand(Addon addon, String label, String... aliases) {

// Run setup
setup();
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
if (getSubCommand("help").isEmpty() && !label.equals("help")) {
new DefaultHelpCommand(this);
}
}
Expand Down Expand Up @@ -204,11 +204,11 @@ protected CompositeCommand(Addon addon, CompositeCommand parent, String label, S
p = p.getParent();
index++;
}
setDescription(COMMANDS + reference.toString() + ".description");
setParametersHelp(COMMANDS + reference.toString() + ".parameters");
setDescription(COMMANDS + reference + ".description");
setParametersHelp(COMMANDS + reference + ".parameters");
setup();
// If this command does not define its own help class, then use the default help command
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
if (getSubCommand("help").isEmpty() && !label.equals("help")) {
new DefaultHelpCommand(this);
}
}
Expand Down Expand Up @@ -278,7 +278,7 @@ private CompositeCommand getCommandFromArgs(String[] args) {
// get the subcommand corresponding to the arg
if (subCommand.hasSubCommands()) {
Optional<CompositeCommand> sub = subCommand.getSubCommand(arg);
if (!sub.isPresent()) {
if (sub.isEmpty()) {
return subCommand;
}
// Step down one
Expand Down Expand Up @@ -602,7 +602,7 @@ public List<String> tabComplete(final CommandSender sender, final String alias,
return options;
}
// Add any tab completion from the subcommand
options.addAll(command.tabComplete(User.getInstance(sender), alias, new LinkedList<>(Arrays.asList(args))).orElseGet(() -> new ArrayList<>()));
options.addAll(command.tabComplete(User.getInstance(sender), alias, new LinkedList<>(Arrays.asList(args))).orElseGet(ArrayList::new));
if (command.hasSubCommands()) {
options.addAll(getSubCommandLabels(sender, command));
}
Expand Down Expand Up @@ -701,7 +701,7 @@ public String getTopLabel() {
* @since 1.5.0
*/
public void setCooldown(String uniqueId, String targetUUID, int timeInSeconds) {
cooldowns.computeIfAbsent(uniqueId, k -> new HashMap<>()).put(targetUUID, System.currentTimeMillis() + timeInSeconds * 1000);
cooldowns.computeIfAbsent(uniqueId, k -> new HashMap<>()).put(targetUUID, System.currentTimeMillis() + timeInSeconds * 1000L);
}

/**
Expand All @@ -711,7 +711,7 @@ public void setCooldown(String uniqueId, String targetUUID, int timeInSeconds) {
* @param timeInSeconds - time in seconds to cool down
*/
public void setCooldown(UUID uniqueId, UUID targetUUID, int timeInSeconds) {
cooldowns.computeIfAbsent(uniqueId.toString(), k -> new HashMap<>()).put(targetUUID == null ? null : targetUUID.toString(), System.currentTimeMillis() + timeInSeconds * 1000);
cooldowns.computeIfAbsent(uniqueId.toString(), k -> new HashMap<>()).put(targetUUID == null ? null : targetUUID.toString(), System.currentTimeMillis() + timeInSeconds * 1000L);
}

/**
Expand Down
Loading

0 comments on commit a6d70d6

Please sign in to comment.