Merge branch 'develop' into fancynpc

This commit is contained in:
tastybento 2024-12-04 19:44:14 -08:00
commit 0961538ab1
17 changed files with 104 additions and 268 deletions

View File

@ -239,6 +239,12 @@
<version>${spigot.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc......</groupId>
<artifactId>spigot</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc.....</groupId>
<artifactId>spigot</artifactId>

View File

@ -1,12 +1,20 @@
/**
* 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>
* This package contains classes and interfaces related to BentoBox addons.
*
* 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.
*
* 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.
*
* Key components:
* - AddonLoader: Manages the lifecycle of addons.
* - AddonConfig: Handles addon-specific configurations.
*
* @since 1.0
* @author tastybento
*
*/
package world.bentobox.bentobox.api.addons;

View File

@ -1,7 +1,9 @@
/**
* API for BentoBox commands
*/
/**
* This package contains classes and handlers for BentoBox commands.
*
* 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.
* <p>
* The workhorse class is the abstract class CompositeCommand. It provides all the functionality for
* a command including automatic help, sub-commands, convenience methods, etc. See examples of how to use
@ -13,6 +15,10 @@
* their own custom help if required, but most of the time it is not.
* </p>
* @author tastybento
*
*
* Key features:
* - Command registration and parsing.
* - Support for custom addon-specific commands.
* - Error handling and permission validation.
*/
package world.bentobox.bentobox.api.commands;

View File

@ -1,4 +1,6 @@
/**
* Contains API related to configurations.
* Provides classes and interfaces for managing configuration settings within the BentoBox API.
* This package enables the definition, access, and manipulation of configuration options,
* facilitating the customization and extension of BentoBox's functionality.
*/
package world.bentobox.bentobox.api.configuration;

View File

@ -1,7 +1,14 @@
/**
* API for all the events that BentoBox generates
*/
/**
* This package defines events used within the BentoBox framework.
*
* 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.
*
* Key features:
* - Custom event classes (e.g., IslandCreateEvent, PlayerJoinEvent).
* - Integration with Bukkit's event system.
*
* @author tastybento
*
*/

View File

@ -0,0 +1,10 @@
/**
* This package provides the core API for interacting with the BentoBox framework.
*
* It enables developers to integrate their custom plugins or addons with BentoBox,
* offering simplified access to common functionalities like:
* - Island management (creation, deletion, permissions).
* - Player interactions within island-based games.
* - Events and hooks for extending core behavior.
*/
package world.bentobox.bentobox.api;

View File

@ -1,52 +0,0 @@
package world.bentobox.bentobox.nms.v1_20_0_R0_1_SNAPSHOT;
import java.util.concurrent.CompletableFuture;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.chunk.Chunk;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.nms.PasteHandler;
import world.bentobox.bentobox.util.DefaultPasteUtil;
import world.bentobox.bentobox.util.Util;
public class PasteHandlerImpl implements PasteHandler {
protected static final IBlockData AIR = ((CraftBlockData) AIR_BLOCKDATA).getState();
/**
* Set the block to the location
*
* @param island - island
* @param location - location
* @param bpBlock - blueprint block
*/
public CompletableFuture<Void> setBlock(Island island, Location location, BlueprintBlock bpBlock) {
return Util.getChunkAtAsync(location).thenRun(() -> {
Block block = location.getBlock();
// Set the block data - default is AIR
BlockData bd = DefaultPasteUtil.createBlockData(bpBlock);
CraftBlockData craft = (CraftBlockData) bd;
net.minecraft.world.level.World nmsWorld = ((CraftWorld) location.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(location.getBlockX() >> 4, location.getBlockZ() >> 4);
BlockPosition bp = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
// Setting the block to air before setting to another state prevents some console errors
nmsChunk.a(bp, AIR, false);
nmsChunk.a(bp, craft.getState(), false);
block.setBlockData(bd, false);
DefaultPasteUtil.setBlockState(island, block, bpBlock);
// Set biome
if (bpBlock.getBiome() != null) {
block.setBiome(bpBlock.getBiome());
}
});
}
}

View File

@ -1,26 +0,0 @@
package world.bentobox.bentobox.nms.v1_20_0_R0_1_SNAPSHOT;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.World;
import net.minecraft.world.level.chunk.Chunk;
import world.bentobox.bentobox.nms.CopyWorldRegenerator;
public class WorldRegeneratorImpl extends CopyWorldRegenerator {
@Override
public void setBlockInNativeChunk(org.bukkit.Chunk chunk, int x, int y, int z, BlockData blockData,
boolean applyPhysics) {
CraftBlockData craft = (CraftBlockData) blockData;
World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ());
BlockPosition bp = new BlockPosition((chunk.getX() << 4) + x, y, (chunk.getZ() << 4) + z);
// Setting the block to air before setting to another state prevents some console errors
nmsChunk.a(bp, PasteHandlerImpl.AIR, applyPhysics);
nmsChunk.a(bp, craft.getState(), applyPhysics);
}
}

View File

@ -1,51 +0,0 @@
package world.bentobox.bentobox.nms.v1_20_1_R0_1_SNAPSHOT;
import java.util.concurrent.CompletableFuture;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.chunk.Chunk;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.nms.PasteHandler;
import world.bentobox.bentobox.util.DefaultPasteUtil;
import world.bentobox.bentobox.util.Util;
public class PasteHandlerImpl implements PasteHandler {
protected static final IBlockData AIR = ((CraftBlockData) AIR_BLOCKDATA).getState();
/**
* Set the block to the location
*
* @param island - island
* @param location - location
* @param bpBlock - blueprint block
*/
public CompletableFuture<Void> setBlock(Island island, Location location, BlueprintBlock bpBlock) {
return Util.getChunkAtAsync(location).thenRun(() -> {
Block block = location.getBlock();
// Set the block data - default is AIR
BlockData bd = DefaultPasteUtil.createBlockData(bpBlock);
CraftBlockData craft = (CraftBlockData) bd;
net.minecraft.world.level.World nmsWorld = ((CraftWorld) location.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(location.getBlockX() >> 4, location.getBlockZ() >> 4);
BlockPosition bp = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
// Setting the block to air before setting to another state prevents some console errors
nmsChunk.a(bp, AIR, false);
nmsChunk.a(bp, craft.getState(), false);
block.setBlockData(bd, false);
DefaultPasteUtil.setBlockState(island, block, bpBlock);
// Set biome
if (bpBlock.getBiome() != null) {
block.setBiome(bpBlock.getBiome());
}
});
}
}

View File

@ -1,26 +0,0 @@
package world.bentobox.bentobox.nms.v1_20_1_R0_1_SNAPSHOT;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.World;
import net.minecraft.world.level.chunk.Chunk;
import world.bentobox.bentobox.nms.CopyWorldRegenerator;
public class WorldRegeneratorImpl extends CopyWorldRegenerator {
@Override
public void setBlockInNativeChunk(org.bukkit.Chunk chunk, int x, int y, int z, BlockData blockData,
boolean applyPhysics) {
CraftBlockData craft = (CraftBlockData) blockData;
World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ());
BlockPosition bp = new BlockPosition((chunk.getX() << 4) + x, y, (chunk.getZ() << 4) + z);
// Setting the block to air before setting to another state prevents some console errors
nmsChunk.a(bp, PasteHandlerImpl.AIR, applyPhysics);
nmsChunk.a(bp, craft.getState(), applyPhysics);
}
}

View File

@ -1,52 +0,0 @@
package world.bentobox.bentobox.nms.v1_20_6_R0_1_SNAPSHOT;
import java.util.concurrent.CompletableFuture;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R4.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.chunk.Chunk;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.nms.PasteHandler;
import world.bentobox.bentobox.util.DefaultPasteUtil;
import world.bentobox.bentobox.util.Util;
public class PasteHandlerImpl implements PasteHandler {
protected static final IBlockData AIR = ((CraftBlockData) AIR_BLOCKDATA).getState();
/**
* Set the block to the location
*
* @param island - island
* @param location - location
* @param bpBlock - blueprint block
*/
@Override
public CompletableFuture<Void> setBlock(Island island, Location location, BlueprintBlock bpBlock) {
return Util.getChunkAtAsync(location).thenRun(() -> {
Block block = location.getBlock();
// Set the block data - default is AIR
BlockData bd = DefaultPasteUtil.createBlockData(bpBlock);
CraftBlockData craft = (CraftBlockData) bd;
net.minecraft.world.level.World nmsWorld = ((CraftWorld) location.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(location.getBlockX() >> 4, location.getBlockZ() >> 4);
BlockPosition bp = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
// Setting the block to air before setting to another state prevents some console errors
nmsChunk.a(bp, AIR, false);
nmsChunk.a(bp, craft.getState(), false);
block.setBlockData(bd, false);
DefaultPasteUtil.setBlockState(island, block, bpBlock);
// Set biome
if (bpBlock.getBiome() != null) {
block.setBiome(bpBlock.getBiome());
}
});
}
}

View File

@ -1,26 +0,0 @@
package world.bentobox.bentobox.nms.v1_20_6_R0_1_SNAPSHOT;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R4.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.World;
import net.minecraft.world.level.chunk.Chunk;
import world.bentobox.bentobox.nms.CopyWorldRegenerator;
public class WorldRegeneratorImpl extends CopyWorldRegenerator {
@Override
public void setBlockInNativeChunk(org.bukkit.Chunk chunk, int x, int y, int z, BlockData blockData,
boolean applyPhysics) {
CraftBlockData craft = (CraftBlockData) blockData;
World nmsWorld = ((CraftWorld) chunk.getWorld()).getHandle();
Chunk nmsChunk = nmsWorld.d(chunk.getX(), chunk.getZ());
BlockPosition bp = new BlockPosition((chunk.getX() << 4) + x, y, (chunk.getZ() << 4) + z);
// Setting the block to air before setting to another state prevents some console errors
nmsChunk.a(bp, PasteHandlerImpl.AIR, applyPhysics);
nmsChunk.a(bp, craft.getState(), applyPhysics);
}
}

View File

@ -1,12 +1,12 @@
package world.bentobox.bentobox.nms.v1_20_4_R0_1_SNAPSHOT;
package world.bentobox.bentobox.nms.v1_21_4_R0_1_SNAPSHOT;
import java.util.concurrent.CompletableFuture;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_21_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_21_R3.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.block.state.IBlockData;

View File

@ -1,8 +1,8 @@
package world.bentobox.bentobox.nms.v1_20_4_R0_1_SNAPSHOT;
package world.bentobox.bentobox.nms.v1_21_4_R0_1_SNAPSHOT;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_21_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_21_R3.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.World;

View File

@ -0,0 +1,14 @@
/**
* The core package for the BentoBox plugin.
*
* This package provides the foundational framework for island-based games like SkyBlock,
* AcidIsland, and others. It manages core plugin features such as the addon system,
* configuration, and APIs used by developers to create custom addons or extend
* the functionality of BentoBox.
*
* Key features:
* - A modular addon system to mix and match features and game modes.
* - Comprehensive APIs for island protection, GUIs, team management, and more.
* - Cross-compatibility with various game modes.
*/
package world.bentobox.bentobox;

View File

@ -5,7 +5,13 @@
* Look here before you write your own utility function. If it isn't here, but would be useful
* the submit a PR so others can avoid duplicating code!
* </p>
*
*
* This package provides utility classes and helpers for common tasks within BentoBox.
*
* These utilities simplify repetitive tasks like file handling, configuration management,
* and mathematical calculations. They are used throughout the framework and can be
* leveraged by addon developers.
*
* @author various
*
*/

View File

@ -197,23 +197,23 @@ public class ServerCompatibility {
/**
* @since 1.21.0
*/
V1_19(Compatibility.COMPATIBLE),
V1_19(Compatibility.INCOMPATIBLE),
/**
* @since 1.21.0
*/
V1_19_1(Compatibility.COMPATIBLE),
V1_19_1(Compatibility.INCOMPATIBLE),
/**
* @since 1.21.0
*/
V1_19_2(Compatibility.COMPATIBLE),
V1_19_2(Compatibility.INCOMPATIBLE),
/**
* @since 1.22.0
*/
V1_19_3(Compatibility.COMPATIBLE),
V1_19_3(Compatibility.INCOMPATIBLE),
/**
* @since 1.22.1
*/
V1_19_4(Compatibility.COMPATIBLE),
V1_19_4(Compatibility.INCOMPATIBLE),
/**
* @since 1.24.0
*/
@ -221,40 +221,50 @@ public class ServerCompatibility {
/**
* @since 1.24.0
*/
V1_20_1(Compatibility.COMPATIBLE),
V1_20_1(Compatibility.INCOMPATIBLE),
/**
* @since 2.0.0
*/
V1_20_2(Compatibility.COMPATIBLE),
V1_20_2(Compatibility.INCOMPATIBLE),
/**
* @since 2.0.0
*/
V1_20_3(Compatibility.COMPATIBLE),
V1_20_3(Compatibility.INCOMPATIBLE),
/**
* @since 2.0.0
*/
V1_20_4(Compatibility.COMPATIBLE),
V1_20_4(Compatibility.INCOMPATIBLE),
/**
* @since 2.4.0
*/
V1_20_5(Compatibility.COMPATIBLE),
V1_20_5(Compatibility.INCOMPATIBLE),
/**
* @since 2.4.0
*/
V1_20_6(Compatibility.COMPATIBLE),
V1_20_6(Compatibility.INCOMPATIBLE),
/**
* @since 2.4.0
*/
V1_21(Compatibility.COMPATIBLE),
V1_21(Compatibility.INCOMPATIBLE),
/**
* @since 2.5.0
*/
V1_21_1(Compatibility.COMPATIBLE),
V1_21_1(Compatibility.INCOMPATIBLE),
/**
* @since 2.7.0
*/
V1_21_2(Compatibility.INCOMPATIBLE), V1_21_3(Compatibility.COMPATIBLE);
V1_21_2(Compatibility.INCOMPATIBLE),
/**
* @since 3.0.0
*/
V1_21_3(Compatibility.COMPATIBLE),
/**
* @since 3.0.1
*/
V1_21_4(Compatibility.COMPATIBLE),;
private final Compatibility compatibility;