Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,15 @@ tasks.processResources {
// This allows version info to be read at runtime by the plugin
filesMatching(listOf("plugin.yml", "config.yml")) {
filter { line ->
line.replace("\${mysql.version}", mysqlVersion)
.replace("\${mariadb.version}", mariadbVersion)
.replace("\${postgresql.version}", postgresqlVersion)
.replace("\${mongodb.version}", mongodbVersion)
.replace("\${hikaricp.version}", hikaricpVersion)
.replace("\${build.number}", finalBuildNumber)
.replace("\${project.version}", project.version.toString())
.replace("\${project.description}", project.description ?: "")
.replace("\${revision}", project.version.toString())
line.replace($$"${mysql.version}", mysqlVersion)
.replace($$"${mariadb.version}", mariadbVersion)
.replace($$"${postgresql.version}", postgresqlVersion)
.replace($$"${mongodb.version}", mongodbVersion)
.replace($$"${hikaricp.version}", hikaricpVersion)
.replace($$"${build.number}", finalBuildNumber)
.replace($$"${project.version}", project.version.toString())
.replace($$"${project.description}", project.description ?: "")
.replace($$"${revision}", project.version.toString())
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/world/bentobox/bentobox/BStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void registerPlayersPerServerChart() {
int players = this.connectedPlayerSet.size();
this.connectedPlayerSet.clear();

if (players <= 0) return "0";
if (players == 0) return "0";
else if (players <= 10) return "1-10";
else if (players <= 30) return "11-30";
else if (players <= 50) return "31-50";
Expand Down
20 changes: 3 additions & 17 deletions src/main/java/world/bentobox/bentobox/BentoBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
Expand Down Expand Up @@ -151,7 +149,7 @@ public void onEnable(){
saveConfig();

// Set up click timeout
lastClick = new ExpiringMap<Pair<UUID, String>, Boolean>(getSettings().getClickCooldownMs(), TimeUnit.MILLISECONDS);
lastClick = new ExpiringMap<>(getSettings().getClickCooldownMs(), TimeUnit.MILLISECONDS);

// Start Database managers
playersManager = new PlayersManager(this);
Expand Down Expand Up @@ -376,18 +374,6 @@ public void onDisable() {

}

@EventHandler
public void onServerStop(ServerCommandEvent e) {
/* This is no longer needed as with https://github.com/Multiverse/Multiverse-Core/releases/tag/4.3.12 (or maybe earlier) the issue
* is fixed where the generator was not remembered across reboots.
*/
/*
if (islandWorldManager != null && (e.getCommand().equalsIgnoreCase("stop") || e.getCommand().equalsIgnoreCase("restart"))) {
// Unregister any MV worlds if () {
//islandWorldManager.registerWorldsToMultiverse(false);
}*/
}

/**
* Returns the player manager
* @return the player manager
Expand Down Expand Up @@ -675,11 +661,11 @@ public boolean isShutdown() {
* @return false if they can click and the timeout is started, otherwise true.
*/
public boolean onTimeout(User user, Panel panel) {
if (lastClick.containsKey(new Pair<UUID, String>(user.getUniqueId(), panel.getName()))) {
if (lastClick.containsKey(new Pair<>(user.getUniqueId(), panel.getName()))) {
user.notify("general.errors.slow-down");
return true;
}
lastClick.put(new Pair<UUID, String>(user.getUniqueId(), panel.getName()), true);
lastClick.put(new Pair<>(user.getUniqueId(), panel.getName()), true);
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* Each addon is loaded with its own {@link AddonClassLoader}, which allows for
* class isolation and management. This loader also facilitates inter-addon
* class sharing by coordinating with the {@link AddonsManager}.
*
* <p>
* This approach is now rarely used as most addons are now Plugin-based and so are loaded by the server as plugins.
*
* @author tastybento, ComminQ
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
* This package contains classes and interfaces related to BentoBox addons.
*
* <p>
* Addons are modular extensions that enhance BentoBox functionality. Game-specific
* addons (e.g., BSkyBlock, AcidIsland) as well as generic addons (e.g., Challenges, Warps)
* are supported by this system. Developers can create custom addons to introduce
* new features or gamemodes.
*
* <p>
* Since BentoBox was created, server tech has changed and code remapping is done and that
* is usually only applied when a Plugin is loaded, so developers should use Pladdons
* which are a wrapper for Addons in a Plugin.
*
* <p>
* Key components:
* - AddonLoader: Manages the lifecycle of addons.
* - AddonConfig: Handles addon-specific configurations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private boolean checkReserved(User user, List<Island> islands) {

@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
String lastArg = !args.isEmpty() ? args.getLast() : "";

return Optional.of(Util.tabLimit(new ArrayList<>(getNameIslandMap(user, getWorld()).keySet()), lastArg));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public boolean execute(User user, String label, List<String> args) {
* - Must be at least member rank
* For demotion:
* - Decreases rank but not below member
*
* <p>
* Fires IslandEvent.Reason.RANK_CHANGE on success
*
* @param user command issuer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* This package contains classes and handlers for BentoBox commands.
*
* <p>
* Commands allow players and administrators to interact with BentoBox, including
* managing islands, settings, and other in-game features. This package ensures
* smooth integration and execution of commands within the plugin.
Expand All @@ -15,7 +15,7 @@
* their own custom help if required, but most of the time it is not.
* </p>
* @author tastybento
*
* <p>
* Key features:
* - Command registration and parsing.
* - Support for custom addon-specific commands.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
*/
public interface ConfigObject extends DataObject {

@Override
default BentoBox getPlugin() {
return BentoBox.getInstance();
}

/**
* @return the uniqueId
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* This package defines events used within the BentoBox framework.
*
* <p>
* Events are triggered during key gameplay actions, such as island creation,
* deletion, or player interactions. Developers can use these events to customize
* behaviors or respond to actions in their addons.
*
* <p>
* Key features:
* - Custom event classes (e.g., IslandCreateEvent, PlayerJoinEvent).
* - Integration with Bukkit's event system.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* This package provides the core API for interacting with the BentoBox framework.
*
* <p>
* It enables developers to integrate their custom plugins or addons with BentoBox,
* offering simplified access to common functionalities like:
* - Island management (creation, deletion, permissions).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@
* @since 1.17.3
*/
public record ItemTemplateRecord(
/**
* ItemStack of the Item
/*
ItemStack of the Item
*/
@Nullable ItemStack icon,
/**
* Title of the item
/*
Title of the item
*/
@Nullable String title,
/**
* Lore message of the item
/*
Lore message of the item
*/
@Nullable String description,
/**
* List of Actions for a button
/*
List of Actions for a button
*/
@NonNull List<ActionRecords> actions,
/**
* DataMap that links additional objects for a button.
/*
DataMap that links additional objects for a button.
*/
@NonNull Map<String, Object> dataMap,
/**
* FallBack item if current one is not possible to generate.
/*
FallBack item if current one is not possible to generate.
*/
@Nullable ItemTemplateRecord fallback) {

Expand Down Expand Up @@ -96,20 +96,20 @@ public void addAction(ActionRecords actionData) {
* @param tooltip the tooltip of action
*/
public record ActionRecords(
/**
* the click type
/*
the click type
*/
ClickType clickType,
/**
* the string that represents action type
/*
the string that represents action type
*/
String actionType,
/**
* the content of the action
/*
the content of the action
*/
String content,
/**
* the tooltip of action
/*
the tooltip of action
*/
String tooltip) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public class BlueprintClipboard {
private final Map<Vector, BlueprintBlock> bpAttachable = new LinkedHashMap<>();
private final Map<Vector, BlueprintBlock> bpBlocks = new LinkedHashMap<>();
private final BentoBox plugin = BentoBox.getInstance();
private Optional<MythicMobsHook> mmh;
private Optional<FancyNpcsHook> npc;
private Optional<ZNPCsPlusHook> znpc;
private final Optional<MythicMobsHook> mmh;
private final Optional<FancyNpcsHook> npc;
private final Optional<ZNPCsPlusHook> znpc;


/**
Expand Down Expand Up @@ -148,14 +148,10 @@ private void copyAsync(World world, User user, List<Vector> vectorsToCopy, int s
boolean copyBiome, boolean noWater) {
copying = false;
// FancyNpcs
if (npc.isPresent()) {
// Add all the citizens for the area in one go. This is pretty fast.
bpEntities.putAll(npc.get().getNpcsInArea(world, vectorsToCopy, origin));
}
// Add all the citizens for the area in one go. This is pretty fast.
npc.ifPresent(fancyNpcsHook -> bpEntities.putAll(fancyNpcsHook.getNpcsInArea(world, vectorsToCopy, origin)));
// ZNPCsPlus NPCs
if (znpc.isPresent()) {
bpEntities.putAll(znpc.get().getNpcsInArea(world, vectorsToCopy, origin));
}
znpc.ifPresent(znpCsPlusHook -> bpEntities.putAll(znpCsPlusHook.getNpcsInArea(world, vectorsToCopy, origin)));

// Repeating copy task
copyTask = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,32 +131,32 @@ public BlueprintPaster(@NonNull BentoBox plugin, @NonNull Blueprint bp, World wo
* Consists of blocks, attached blocks, entities, iterators for the blocks and a speed
*/
private record Bits(
/**
* Basic blocks to the pasted (not attached blocks)
/*
Basic blocks to the pasted (not attached blocks)
*/
Map<Vector, BlueprintBlock> blocks,
/**
* Attached blocks
/*
Attached blocks
*/
Map<Vector, BlueprintBlock> attached,
/**
* Entities to be pasted
/*
Entities to be pasted
*/
Map<Vector, List<BlueprintEntity>> entities,
/**
* Basic block pasting iterator
/*
Basic block pasting iterator
*/
Iterator<Entry<Vector, BlueprintBlock>> it,
/**
* Attached block pasting iterator
/*
Attached block pasting iterator
*/
Iterator<Entry<Vector, BlueprintBlock>> it2,
/**
* Entity pasting iterator
/*
Entity pasting iterator
*/
Iterator<Entry<Vector, List<BlueprintEntity>>> it3,
/**
* Paste speed
/*
Paste speed
*/
int pasteSpeed) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@

/**
* Provides a listener for the Display Objects pasted when a hologram is interacted with
* https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerInteractAtEntityEvent.html
* <a href="https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerInteractAtEntityEvent.html">...</a>
*/
public class DisplayListener implements Listener {

@EventHandler
public void onPlayerInteractEntity(PlayerInteractAtEntityEvent event) {
if (event.getRightClicked() instanceof ArmorStand) {
ArmorStand armorStand = (ArmorStand) event.getRightClicked();
if (event.getRightClicked() instanceof ArmorStand armorStand) {
NamespacedKey key = new NamespacedKey(BentoBox.getInstance(), "associatedDisplayEntity");

if (armorStand.getPersistentDataContainer().has(key, PersistentDataType.STRING)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public Optional<List<String>> tabComplete(User user, String alias, List<String>
return Optional.empty();
}
firstElement = args.get(1);
if (args.size() <= 2) {
if (args.size() == 2) {
return Optional.of(List.of("add", REMOVE, "list"));
}
if (args.size() > 1 && "add".equals(firstElement)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Database<T> {

private final AbstractDatabaseHandler<T> handler;
private final Logger logger;
private DatabaseSetup databaseSetup = DatabaseSetup.getDatabase();
private DatabaseSetup databaseSetup = DatabaseSetup.getDatabase(); // Do not make this final due to tests
private static final Set<Class<? extends DataObject>> dataObjects = new HashSet<>();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ public void setPurgeProtected(boolean purgeProtected) {
* {@link world.bentobox.bentobox.api.addons.GameModeAddon#isEnforceEqualRanges()}
* to {@code false}, and also likely set {@link world.bentobox.bentobox.api.addons.GameModeAddon#isFixIslandCenter()}
* to {@code false} too.
*
* <p>
* The protection range can be set to be bigger than this, but will never report as being bigger than this.
*
* @param range the range to set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import world.bentobox.bentobox.util.Util;

/**
* Provides copy and pasting of ZNPCS Plus in blueprints https://github.com/Pyrbu/ZNPCsPlus
* Provides copy and pasting of ZNPCS Plus in blueprints <a href="https://github.com/Pyrbu/ZNPCsPlus">...</a>
*
* @author tastybento
* @since 3.2.0
Expand Down Expand Up @@ -120,7 +120,7 @@ public List<String> getNPCsInChunk(Chunk chunk) {
return NpcApiProvider.get().getNpcRegistry().getAll().stream()
.filter(npc -> npc.getNpc().getWorld().equals(chunk.getWorld())) // Only NPCs in this world
.filter(npc -> npc.getNpc().getLocation().toBukkitLocation(chunk.getWorld()).getChunk().equals(chunk)) // Only in this chunk
.map(npc -> npc.getId()) // IDs
.map(NpcEntry::getId) // IDs
.toList();
}

Expand Down
Loading