Package be.seeseemelk.mockbukkit
Class ServerMock
java.lang.Object
org.bukkit.Server.Spigot
be.seeseemelk.mockbukkit.ServerMock
- All Implemented Interfaces:
net.kyori.adventure.audience.Audience,net.kyori.adventure.audience.ForwardingAudience,net.kyori.adventure.pointer.Pointered,PluginMessageRecipient,Server
Mock implementation of a
Server and Server.Spigot.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.kyori.adventure.audience.ForwardingAudience
net.kyori.adventure.audience.ForwardingAudience.SingleNested classes/interfaces inherited from interface org.bukkit.Server
Server.Spigot -
Field Summary
Fields inherited from interface org.bukkit.Server
BROADCAST_CHANNEL_ADMINISTRATIVE, BROADCAST_CHANNEL_USERS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull PlayerMockCreates a random player and adds it.voidaddPlayer(@NotNull PlayerMock player) Add a specific player to the set.@NotNull PlayerMockCreates a player with a given name and adds it.booleanboolean@NotNull WorldMockaddSimpleWorld(String name) Adds a very simple super flat world with a given name.voidaddTagRegistry(@NotNull TagRegistry registry) Adds a tag registry.voidAdds the given mocked world to this server.@NotNull Iterator<Advancement> @NotNull Iterable<? extends net.kyori.adventure.audience.Audience> voidvoidbanIP(@NotNull InetAddress address) intDeprecated.intbroadcast(@NotNull net.kyori.adventure.text.Component message) intvoidbroadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) Deprecated.voidbroadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) Deprecated.intbroadcastMessage(@NotNull String message) Deprecated.void@NotNull ItemStack@NotNull ItemStack@NotNull ItemCraftResultcraftItemResult(@NotNull ItemStack[] craftingMatrix, @NotNull World world) @NotNull ItemCraftResultcraftItemResult(@NotNull ItemStack[] craftingMatrix, @NotNull World world, @NotNull Player player) @NotNull BlockDatacreateBlockData(String data) @NotNull BlockDatacreateBlockData(@NotNull Material material) @NotNull BlockDatacreateBlockData(@NotNull Material material, @Nullable Consumer<? super BlockData> consumer) @NotNull BlockDatacreateBlockData(Material material, String data) @NotNull BossBarcreateBossBar(@NotNull String title, @NotNull BarColor color, @NotNull BarStyle style, BarFlag... flags) @NotNull KeyedBossBarcreateBossBar(@NotNull NamespacedKey key, @NotNull String title, @NotNull BarColor color, @NotNull BarStyle style, BarFlag... flags) @NotNull ChunkGenerator.ChunkDatacreateChunkData(@NotNull World world) @NotNull CommandSendercreateCommandSender(@NotNull Consumer<? super net.kyori.adventure.text.Component> feedback) @Nullable ItemStackcreateExplorerMap(@NotNull World world, @NotNull Location location, StructureType structureType, MapCursor.Type mapIcon, int radius, boolean findUnexplored) @NotNull ItemStackcreateExplorerMap(World world, Location location, StructureType structureType) @NotNull ItemStackcreateExplorerMap(World world, Location location, StructureType structureType, int radius, boolean findUnexplored) @NotNull InventoryMockcreateInventory(@Nullable InventoryHolder owner, int size, @NotNull net.kyori.adventure.text.Component title) @NotNull InventoryMockcreateInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull net.kyori.adventure.text.Component title) @NotNull InventoryMockcreateInventory(InventoryHolder owner, int size) @NotNull InventoryMockcreateInventory(InventoryHolder owner, int size, String title) Deprecated.@NotNull InventoryMockcreateInventory(InventoryHolder owner, @NotNull InventoryType type) @NotNull InventoryMockcreateInventory(InventoryHolder owner, @NotNull InventoryType type, String title) Deprecated.@NotNull InventoryMockcreateInventory(InventoryHolder owner, @NotNull InventoryType type, String title, int size) Deprecated.@NotNull MapViewMockcreateMaterialTag(@NotNull NamespacedKey key, @NotNull String registryKey, @NotNull Material... materials) This creates a new MockTagfor theMaterialclass.
Call this in advance before you are gonna accessgetTag(String, NamespacedKey, Class)or any of the constants defined inTag.@NotNull MerchantcreateMerchant(String title) Deprecated.@NotNull MerchantcreateMerchant(@Nullable net.kyori.adventure.text.Component title) @NotNull PlayerProfileMockcreatePlayerProfile(@NotNull String name) Deprecated.@NotNull PlayerProfileMockcreatePlayerProfile(@NotNull UUID uniqueId) Deprecated.@NotNull PlayerProfileMockcreatePlayerProfile(@Nullable UUID uniqueId, @Nullable String name) Deprecated.@NotNull PlayerProfileMockcreateProfile(@NotNull String name) @NotNull PlayerProfileMockcreateProfile(@NotNull UUID uuid) @NotNull PlayerProfileMockcreateProfile(@Nullable UUID uuid, @Nullable String name) @NotNull PlayerProfileMockcreateProfileExact(@Nullable UUID uuid, @Nullable String name) createWorld(@NotNull WorldCreator creator) @NotNull WorldBorderbooleandispatchCommand(@NotNull CommandSender sender, @NotNull String commandLine) @NotNull CommandResultexecute(@NotNull String command, CommandSender sender, String... args) Executes a command.@NotNull CommandResultexecute(@NotNull Command command, CommandSender sender, String... args) Executes a command.@NotNull CommandResultexecuteConsole(@NotNull String command, String... args) Executes a command as the console.@NotNull CommandResultexecuteConsole(@NotNull Command command, String... args) Executes a command as the console.@NotNull CommandResultexecutePlayer(@NotNull String command, String... args) Executes a command as a player.@NotNull CommandResultexecutePlayer(@NotNull Command command, String... args) Executes a command as a player.booleanbooleanbooleanintDeprecated.intDeprecated.@NotNull AsyncSchedulerdouble<B extends BanList<E>,E>
BgetBanList(@NotNull BanListType<B> type) @NotNull BanListgetBanList(@NotNull BanList.Type type) @NotNull Set<OfflinePlayer> getBossBar(NamespacedKey key) @NotNull Iterator<KeyedBossBar> @NotNull String@NotNull MockCommandMapgetCommandTabComplete(@NotNull CommandSender sender, @NotNull String commandLine) Gets the tab completion result for a command.@NotNull YamlConfigurationlong@NotNull ConsoleCommandSenderMock@Nullable RecipegetCraftingRecipe(@NotNull ItemStack[] craftingMatrix, @NotNull World world) protected longThis returns the current time of theServerin millisecondsint@NotNull DatapackManager@NotNull DataPackManagerDeprecated.@NotNull GameMode@NotNull Set<EntityMock> Returns a set of entities that exist on the server instance.@Nullable Entity@NotNull EntityFactoryboolean@NotNull GlobalRegionScheduler@NotNull HelpMapMockbooleanint@NotNull StringgetIp()@NotNull ItemFactory@NotNull LoggergetMap(int id) Deprecated.intintint@NotNull Messenger@NotNull String@NotNull MobGoalsintDeprecated.@NotNull StringgetMotd()Deprecated.@NotNull StringgetName()@NotNull OfflinePlayergetOfflinePlayer(@NotNull String name) Deprecated.@NotNull OfflinePlayergetOfflinePlayer(@NotNull UUID id) @Nullable OfflinePlayergetOfflinePlayerIfCached(@NotNull String name) OfflinePlayer @NotNull []boolean@NotNull Collection<? extends PlayerMock> @NotNull Set<OfflinePlayer> @NotNull String@NotNull PlayerMockgetPlayer(int num) Get a specific mock player.getPlayerExact(@NotNull String name) @NotNull MockPlayerListReturns theMockPlayerListinstance that is used by this server.@Nullable UUIDgetPlayerUniqueId(@NotNull String playerName) getPluginCommand(@NotNull String name) @NotNull PluginManagerMock@NotNull FileintgetPort()@NotNull PotionBrewer@Nullable RecipegetRecipe(@NotNull NamespacedKey key) getRecipesFor(@NotNull ItemStack item) @NotNull RegionSchedulergetRegistry(@NotNull Class<T> tClass) @NotNull String@NotNull String@NotNull String@NotNull BukkitSchedulerMock@NotNull CriteriagetScoreboardCriteria(@NotNull String name) @NotNull ScoreboardManagerMock@NotNull ServerConfigurationExposes theServerConfigurationof thisServerMock.@NotNull ServerLinks@Nullable ResourcePack@NotNull ServerTickManager@NotNull ServicesManagerMockDeprecated.intintgetSpawnLimit(@NotNull SpawnCategory spawnCategory) int@NotNull StructureManagergetTag(@NotNull String registryKey, @NotNull NamespacedKey key, @NotNull Class<T> clazz) intDeprecated.intDeprecated.intDeprecated.intgetTicksPerSpawns(@NotNull SpawnCategory spawnCategory) intintDeprecated.intDeprecated.@org.jetbrains.annotations.NotNull long[]@org.jetbrains.annotations.NotNull double[]getTPS()@NotNull MockUnsafeValuesDeprecated.@NotNull String@NotNull File@NotNull Stringint@NotNull Warning.WarningStateintDeprecated.intDeprecated.intDeprecated.@NotNull Set<OfflinePlayer> @Nullable WorldgetWorld(@NotNull net.kyori.adventure.key.Key key) @Nullable WorldgetWorld(@NotNull NamespacedKey worldKey) @NotNull File@NotNull StringbooleanbooleanbooleanbooleanbooleanbooleanChecks if we are on the main thread.booleanisOwnedByCurrentRegion(@NotNull Location location) booleanisOwnedByCurrentRegion(@NotNull Location location, int squareRadiusChunks) booleanisOwnedByCurrentRegion(@NotNull World world, int chunkX, int chunkZ) booleanisOwnedByCurrentRegion(@NotNull World world, int chunkX, int chunkZ, int squareRadiusChunks) booleanisOwnedByCurrentRegion(@NotNull World world, @NotNull Position position) booleanisOwnedByCurrentRegion(@NotNull World world, @NotNull Position position, int squareRadiusChunks) booleanisOwnedByCurrentRegion(@NotNull Entity entity) booleanbooleanbooleanbooleanboolean@NotNull CachedServerIconMockloadServerIcon(@NotNull BufferedImage image) @NotNull CachedServerIconMockloadServerIcon(@NotNull File file) matchPlayer(@NotNull String name) @NotNull net.kyori.adventure.text.Componentmotd()voidmotd(@NotNull net.kyori.adventure.text.Component motd) @NotNull net.kyori.adventure.text.ComponentvoidregisterEntity(@NotNull EntityMock entity) Registers an entity so that the server can track it more easily.static voidRegisters any classes that are serializable with the ConfigurationSerializable system of Bukkit.voidreload()booleanvoidvoidvoidbooleanbooleanremoveRecipe(@NotNull NamespacedKey key) booleanremoveRecipe(@NotNull NamespacedKey key, boolean resendRecipes) booleanremoveWorld(WorldMock world) Removes a mocked world from this server.voidvoidrestart()voidselectEntities(CommandSender sender, String selector) voidsendPluginMessage(@NotNull Plugin source, @NotNull String channel, byte[] message) voidsetAllowEnd(boolean allowEnd) Sets whether the End should be allowed.voidsetAllowFlight(boolean allowFlight) Sets whether the server should allow flight.voidsetAllowNether(boolean allowNether) Sets whether the Nether should be allowed.voidsetDefaultGameMode(GameMode mode) voidsetEnforcingSecureProfiles(boolean enforcingSecureProfiles) Sets whether the server should enforce secure profiles.voidsetGenerateStructures(boolean generateStructures) Sets whether structures should be generated.voidsetHardcore(boolean hardcore) Sets whether the server should be in hardcore mode.voidsetHideOnlinePlayers(boolean hideOnlinePlayers) Set whether to hide online playersvoidsetIdleTimeout(int threshold) voidSets the server listen IP.voidsetMaxChainedNeighborUpdates(int maxChainedNeighborUpdates) Sets the maximum number of chained neighbour updates before skipping additional ones.voidsetMaxPlayers(int maxPlayers) voidsetMaxWorldSize(int maxWorldSize) Set the maximum world sizevoidvoidsetOfflinePlayers(int num) Set the numbers of mock offline players that are on this server.voidsetOnlineMode(boolean onlineMode) Sets whether the server should be in online mode.voidsetPlayers(int num) Set the numbers of mock players that are on this server.voidsetPort(int port) Sets the server listen port.voidsetServerIcon(CachedServerIconMock serverIcon) Sets the return value ofgetServerIcon().voidsetShouldSendChatPreviews(boolean shouldSendChatPreviews) Deprecated, for removal: This API element is subject to removal in a future version.Chat previews were removed in 1.19.3.voidsetShutdownMessage(@NotNull net.kyori.adventure.text.Component shutdownMessage) Sets the shutdown message.voidsetSimulationDistance(int simulationDistance) Set the simulation distancevoidsetSpawnRadius(int spawnRadius) voidsetUpdateFolder(@NotNull String updateFolder) Sets the global update folder.voidsetViewDistance(int viewDistance) Sets the global view distance for all players.voidsetWarningState(@NotNull Warning.WarningState warningState) Sets the return value ofgetWarningState().voidsetWhitelist(boolean value) voidsetWhitelistEnforced(boolean value) voidsetWorldType(ServerConfiguration.LevelType worldType) Sets the global default World TypebooleanDeprecated, for removal: This API element is subject to removal in a future version.Chat previews were removed in 1.19.3.voidshutdown()@Nullable net.kyori.adventure.text.Component@NotNull Server.Spigotspigot()booleanvoidvoidunbanIP(@NotNull InetAddress address) booleanunloadWorld(String name, boolean save) booleanunloadWorld(World world, boolean save) voidunregisterEntity(@NotNull EntityMock entity) Unregisters an entity from the server.voidvoidMethods inherited from class org.bukkit.Server.Spigot
getBukkitConfig, getPaperConfig, getSpigotConfigMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.kyori.adventure.audience.Audience
deleteMessage, openBook, removeResourcePacks, removeResourcePacks, removeResourcePacks, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendResourcePacks, showTitle, stopSoundMethods inherited from interface net.kyori.adventure.audience.ForwardingAudience
clearResourcePacks, clearTitle, deleteMessage, filterAudience, forEachAudience, hideBossBar, openBook, playSound, playSound, playSound, pointers, removeResourcePacks, removeResourcePacks, resetTitle, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendResourcePacks, sendTitlePart, showBossBar, stopSoundMethods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFromMethods inherited from interface org.bukkit.Server
createExplorerMap, isOwnedByCurrentRegion
-
Constructor Details
-
ServerMock
public ServerMock()Constructs a new ServerMock and sets it up. Does NOT set the server returned fromBukkit.getServer().
-
-
Method Details
-
isOnMainThread
public boolean isOnMainThread()Checks if we are on the main thread. The main thread is the thread used to create this instance of the mock server.- Returns:
trueif we are on the main thread,falseif we are running on a different thread.
-
registerEntity
Registers an entity so that the server can track it more easily. Should only be used internally.- Parameters:
entity- The entity to register
-
unregisterEntity
Unregisters an entity from the server. Should only be used internally.- Parameters:
entity- The entity to unregister
-
getEntities
Returns a set of entities that exist on the server instance.- Returns:
- A set of entities that exist on this server instance.
-
addPlayer
Add a specific player to the set.- Parameters:
player- The player to add.
-
addPlayer
Creates a random player and adds it.- Returns:
- The player that was added.
-
addPlayer
Creates a player with a given name and adds it.- Parameters:
name- The name to give to the player.- Returns:
- The added player.
-
setPlayers
public void setPlayers(int num) Set the numbers of mock players that are on this server. Note that it will remove all players that are already on this server.- Parameters:
num- The number of players that are on this server.
-
setOfflinePlayers
public void setOfflinePlayers(int num) Set the numbers of mock offline players that are on this server. Note that even players that are online are also considered offline player because anOfflinePlayerreally just refers to anyone that has at some point in time played on the server.- Parameters:
num- The number of players that are on this server.
-
getPlayer
Get a specific mock player. A player's number will never change between invocations ofsetPlayers(int).- Parameters:
num- The number of the player to retrieve.- Returns:
- The chosen player.
-
getPlayerList
Returns theMockPlayerListinstance that is used by this server.- Returns:
- The
MockPlayerListinstance.
-
getPlayerUniqueId
- Specified by:
getPlayerUniqueIdin interfaceServer
-
addSimpleWorld
Adds a very simple super flat world with a given name.- Parameters:
name- The name to give to the world.- Returns:
- The
WorldMockthat has been created.
-
addWorld
Adds the given mocked world to this server.- Parameters:
world- The world to add.
-
removeWorld
Removes a mocked world from this server.- Parameters:
world- The world to remove.- Returns:
- true if the world was removed, otherwise false.
-
executeConsole
@NotNull public @NotNull CommandResult executeConsole(@NotNull @NotNull Command command, String... args) Executes a command as the console.- Parameters:
command- The command to execute.args- The arguments to pass to the commands.- Returns:
- The value returned by
Command.execute(org.bukkit.command.CommandSender, java.lang.String, java.lang.String[]).
-
executeConsole
@NotNull public @NotNull CommandResult executeConsole(@NotNull @NotNull String command, String... args) Executes a command as the console.- Parameters:
command- The command to execute.args- The arguments to pass to the commands.- Returns:
- The value returned by
Command.execute(org.bukkit.command.CommandSender, java.lang.String, java.lang.String[]).
-
executePlayer
@NotNull public @NotNull CommandResult executePlayer(@NotNull @NotNull Command command, String... args) Executes a command as a player.- Parameters:
command- The command to execute.args- The arguments to pass to the commands.- Returns:
- The value returned by
Command.execute(org.bukkit.command.CommandSender, java.lang.String, java.lang.String[]).
-
executePlayer
@NotNull public @NotNull CommandResult executePlayer(@NotNull @NotNull String command, String... args) Executes a command as a player.- Parameters:
command- The command to execute.args- The arguments to pass to the commands.- Returns:
- The value returned by
Command.execute(org.bukkit.command.CommandSender, java.lang.String, java.lang.String[]).
-
execute
@NotNull public @NotNull CommandResult execute(@NotNull @NotNull Command command, CommandSender sender, String... args) Executes a command.- Parameters:
command- The command to execute.sender- The person that executed the command.args- The arguments to pass to the commands.- Returns:
- The value returned by
Command.execute(org.bukkit.command.CommandSender, java.lang.String, java.lang.String[]).
-
execute
@NotNull public @NotNull CommandResult execute(@NotNull @NotNull String command, CommandSender sender, String... args) Executes a command.- Parameters:
command- The command to execute.sender- The person that executed the command.args- The arguments to pass to the commands.- Returns:
- The value returned by
Command.execute(org.bukkit.command.CommandSender, java.lang.String, java.lang.String[]).
-
getName
-
getVersion
- Specified by:
getVersionin interfaceServer
-
getBukkitVersion
- Specified by:
getBukkitVersionin interfaceServer
-
getMinecraftVersion
- Specified by:
getMinecraftVersionin interfaceServer
-
getOnlinePlayers
- Specified by:
getOnlinePlayersin interfaceServer
-
getOfflinePlayers
- Specified by:
getOfflinePlayersin interfaceServer
-
getOfflinePlayerIfCached
- Specified by:
getOfflinePlayerIfCachedin interfaceServer
-
getPlayer
-
getPlayerExact
- Specified by:
getPlayerExactin interfaceServer
-
matchPlayer
- Specified by:
matchPlayerin interfaceServer
-
getPlayer
-
getPluginManager
- Specified by:
getPluginManagerin interfaceServer
-
getCommandMap
- Specified by:
getCommandMapin interfaceServer
-
getPluginCommand
- Specified by:
getPluginCommandin interfaceServer
-
getLogger
-
getConsoleSender
- Specified by:
getConsoleSenderin interfaceServer
-
createCommandSender
@NotNull public @NotNull CommandSender createCommandSender(@NotNull @NotNull Consumer<? super net.kyori.adventure.text.Component> feedback) - Specified by:
createCommandSenderin interfaceServer
-
createInventory
@NotNull @Deprecated public @NotNull InventoryMock createInventory(InventoryHolder owner, @NotNull @NotNull InventoryType type, String title, int size) Deprecated.Creates an inventory with the provided parameters.- Parameters:
owner- The holder of the inventory.type- The type of the inventory.title- The title of the inventory view.size- The size of the inventory.- Returns:
- The created inventory.
- Throws:
IllegalArgumentException- If the InventoryType is not creatable.- See Also:
-
createInventory
@NotNull public @NotNull InventoryMock createInventory(InventoryHolder owner, @NotNull @NotNull InventoryType type) - Specified by:
createInventoryin interfaceServer
-
createInventory
@NotNull public @NotNull InventoryMock createInventory(@Nullable @Nullable InventoryHolder owner, @NotNull @NotNull InventoryType type, @NotNull @NotNull net.kyori.adventure.text.Component title) - Specified by:
createInventoryin interfaceServer
-
createInventory
@Deprecated @NotNull public @NotNull InventoryMock createInventory(InventoryHolder owner, @NotNull @NotNull InventoryType type, String title) Deprecated.- Specified by:
createInventoryin interfaceServer
-
createInventory
- Specified by:
createInventoryin interfaceServer
-
createInventory
@NotNull public @NotNull InventoryMock createInventory(@Nullable @Nullable InventoryHolder owner, int size, @NotNull @NotNull net.kyori.adventure.text.Component title) throws IllegalArgumentException - Specified by:
createInventoryin interfaceServer- Throws:
IllegalArgumentException
-
createInventory
@Deprecated @NotNull public @NotNull InventoryMock createInventory(InventoryHolder owner, int size, String title) Deprecated.- Specified by:
createInventoryin interfaceServer
-
createMerchant
@NotNull public @NotNull Merchant createMerchant(@Nullable @Nullable net.kyori.adventure.text.Component title) - Specified by:
createMerchantin interfaceServer
-
getItemFactory
- Specified by:
getItemFactoryin interfaceServer
-
getWorlds
-
isTickingWorlds
public boolean isTickingWorlds()- Specified by:
isTickingWorldsin interfaceServer
-
getWorld
-
getWorld
-
getWorld
-
getWorld
-
createWorldBorder
- Specified by:
createWorldBorderin interfaceServer
-
getScheduler
- Specified by:
getSchedulerin interfaceServer
-
getMaxPlayers
public int getMaxPlayers()- Specified by:
getMaxPlayersin interfaceServer
-
setMaxPlayers
public void setMaxPlayers(int maxPlayers) - Specified by:
setMaxPlayersin interfaceServer
-
getIPBans
-
banIP
-
unbanIP
-
banIP
-
unbanIP
-
getBanList
- Specified by:
getBanListin interfaceServer
-
getOperators
- Specified by:
getOperatorsin interfaceServer
-
getDefaultGameMode
- Specified by:
getDefaultGameModein interfaceServer
-
setDefaultGameMode
- Specified by:
setDefaultGameModein interfaceServer
-
broadcastMessage
Deprecated.- Specified by:
broadcastMessagein interfaceServer
-
broadcast
@Deprecated public int broadcast(@NotNull @NotNull String message, @NotNull @NotNull String permission) Deprecated. -
broadcast
public int broadcast(@NotNull @NotNull net.kyori.adventure.text.Component message) -
broadcast
public int broadcast(@NotNull @NotNull net.kyori.adventure.text.Component message, @NotNull @NotNull String permission) -
registerSerializables
public static void registerSerializables()Registers any classes that are serializable with the ConfigurationSerializable system of Bukkit. -
addRecipe
-
addRecipe
-
getRecipesFor
- Specified by:
getRecipesForin interfaceServer
-
getRecipe
-
getCraftingRecipe
@Nullable public @Nullable Recipe getCraftingRecipe(@NotNull @NotNull ItemStack[] craftingMatrix, @NotNull @NotNull World world) - Specified by:
getCraftingRecipein interfaceServer
-
craftItem
-
craftItemResult
@NotNull public @NotNull ItemCraftResult craftItemResult(@NotNull @NotNull ItemStack[] craftingMatrix, @NotNull @NotNull World world) - Specified by:
craftItemResultin interfaceServer
-
craftItemResult
@NotNull public @NotNull ItemCraftResult craftItemResult(@NotNull @NotNull ItemStack[] craftingMatrix, @NotNull @NotNull World world, @NotNull @NotNull Player player) - Specified by:
craftItemResultin interfaceServer
-
craftItem
-
removeRecipe
- Specified by:
removeRecipein interfaceServer
-
removeRecipe
- Specified by:
removeRecipein interfaceServer
-
recipeIterator
- Specified by:
recipeIteratorin interfaceServer
-
clearRecipes
public void clearRecipes()- Specified by:
clearRecipesin interfaceServer
-
dispatchCommand
public boolean dispatchCommand(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String commandLine) - Specified by:
dispatchCommandin interfaceServer
-
getCommandTabComplete
@NotNull public @NotNull List<String> getCommandTabComplete(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String commandLine) Gets the tab completion result for a command.- Parameters:
sender- The command sender.commandLine- The command string, without a leading slash.- Returns:
- The tab completion result, or an empty list.
-
getHelpMap
- Specified by:
getHelpMapin interfaceServer
-
sendPluginMessage
public void sendPluginMessage(@NotNull @NotNull Plugin source, @NotNull @NotNull String channel, byte[] message) - Specified by:
sendPluginMessagein interfacePluginMessageRecipient
-
getListeningPluginChannels
- Specified by:
getListeningPluginChannelsin interfacePluginMessageRecipient
-
getPort
public int getPort() -
setPort
public void setPort(int port) Sets the server listen port.- Parameters:
port- The server listen port.- See Also:
-
getViewDistance
public int getViewDistance()- Specified by:
getViewDistancein interfaceServer
-
setViewDistance
public void setViewDistance(int viewDistance) Sets the global view distance for all players.- Parameters:
viewDistance- The new view distance.- See Also:
-
getIp
-
setIp
Sets the server listen IP.- Parameters:
serverIp- The server listen IP.- See Also:
-
getWorldType
- Specified by:
getWorldTypein interfaceServer
-
setWorldType
Sets the global default World Type- Parameters:
worldType- The newServerConfiguration.LevelType- See Also:
-
getGenerateStructures
public boolean getGenerateStructures()- Specified by:
getGenerateStructuresin interfaceServer
-
setGenerateStructures
public void setGenerateStructures(boolean generateStructures) Sets whether structures should be generated.- Parameters:
generateStructures- Whether structures should be generated.- See Also:
-
getAllowEnd
public boolean getAllowEnd()- Specified by:
getAllowEndin interfaceServer
-
setAllowEnd
public void setAllowEnd(boolean allowEnd) Sets whether the End should be allowed.- Parameters:
allowEnd- Whether the End should be allowed.- See Also:
-
getAllowNether
public boolean getAllowNether()- Specified by:
getAllowNetherin interfaceServer
-
isLoggingIPs
public boolean isLoggingIPs()- Specified by:
isLoggingIPsin interfaceServer
-
getInitialEnabledPacks
- Specified by:
getInitialEnabledPacksin interfaceServer
-
getInitialDisabledPacks
- Specified by:
getInitialDisabledPacksin interfaceServer
-
getDataPackManager
Deprecated.- Specified by:
getDataPackManagerin interfaceServer
-
getServerTickManager
- Specified by:
getServerTickManagerin interfaceServer
-
getServerResourcePack
- Specified by:
getServerResourcePackin interfaceServer
-
setAllowNether
public void setAllowNether(boolean allowNether) Sets whether the Nether should be allowed.- Parameters:
allowNether- Whether the Nether should be allowed.- See Also:
-
getResourcePack
- Specified by:
getResourcePackin interfaceServer
-
getResourcePackHash
- Specified by:
getResourcePackHashin interfaceServer
-
getResourcePackPrompt
- Specified by:
getResourcePackPromptin interfaceServer
-
isResourcePackRequired
public boolean isResourcePackRequired()- Specified by:
isResourcePackRequiredin interfaceServer
-
hasWhitelist
public boolean hasWhitelist()- Specified by:
hasWhitelistin interfaceServer
-
setWhitelist
public void setWhitelist(boolean value) - Specified by:
setWhitelistin interfaceServer
-
isWhitelistEnforced
public boolean isWhitelistEnforced()- Specified by:
isWhitelistEnforcedin interfaceServer
-
setWhitelistEnforced
public void setWhitelistEnforced(boolean value) - Specified by:
setWhitelistEnforcedin interfaceServer
-
getWhitelistedPlayers
- Specified by:
getWhitelistedPlayersin interfaceServer
-
reloadWhitelist
public void reloadWhitelist()- Specified by:
reloadWhitelistin interfaceServer
-
getUpdateFolder
- Specified by:
getUpdateFolderin interfaceServer
-
setUpdateFolder
Sets the global update folder.- Parameters:
updateFolder- The new update folder.- See Also:
-
getUpdateFolderFile
- Specified by:
getUpdateFolderFilein interfaceServer
-
getConnectionThrottle
public long getConnectionThrottle()- Specified by:
getConnectionThrottlein interfaceServer
-
getTicksPerAnimalSpawns
Deprecated.- Specified by:
getTicksPerAnimalSpawnsin interfaceServer
-
getTicksPerMonsterSpawns
Deprecated.- Specified by:
getTicksPerMonsterSpawnsin interfaceServer
-
getServicesManager
- Specified by:
getServicesManagerin interfaceServer
-
createWorld
- Specified by:
createWorldin interfaceServer
-
unloadWorld
- Specified by:
unloadWorldin interfaceServer
-
unloadWorld
- Specified by:
unloadWorldin interfaceServer
-
createMap
-
reload
public void reload() -
reloadData
public void reloadData()- Specified by:
reloadDatain interfaceServer
-
updateResources
public void updateResources()- Specified by:
updateResourcesin interfaceServer
-
updateRecipes
public void updateRecipes()- Specified by:
updateRecipesin interfaceServer
-
savePlayers
public void savePlayers()- Specified by:
savePlayersin interfaceServer
-
resetRecipes
public void resetRecipes()- Specified by:
resetRecipesin interfaceServer
-
getCommandAliases
- Specified by:
getCommandAliasesin interfaceServer
-
getSpawnRadius
public int getSpawnRadius()- Specified by:
getSpawnRadiusin interfaceServer
-
setSpawnRadius
public void setSpawnRadius(int spawnRadius) - Specified by:
setSpawnRadiusin interfaceServer
-
shouldSendChatPreviews
Deprecated, for removal: This API element is subject to removal in a future version.Chat previews were removed in 1.19.3.- Specified by:
shouldSendChatPreviewsin interfaceServer- Returns:
- true if the server should send a preview, false otherwise
-
setShouldSendChatPreviews
Deprecated, for removal: This API element is subject to removal in a future version.Chat previews were removed in 1.19.3.Sets whether the server should send chat previews.- Parameters:
shouldSendChatPreviews- Whether the server should send chat previews.- See Also:
-
isEnforcingSecureProfiles
public boolean isEnforcingSecureProfiles()- Specified by:
isEnforcingSecureProfilesin interfaceServer
-
setEnforcingSecureProfiles
public void setEnforcingSecureProfiles(boolean enforcingSecureProfiles) Sets whether the server should enforce secure profiles.- Parameters:
enforcingSecureProfiles- Whether the server should enforce secure profiles.- See Also:
-
getOnlineMode
public boolean getOnlineMode()- Specified by:
getOnlineModein interfaceServer
-
setOnlineMode
public void setOnlineMode(boolean onlineMode) Sets whether the server should be in online mode.- Parameters:
onlineMode- Whether the server should be in online mode.- See Also:
-
getAllowFlight
public boolean getAllowFlight()- Specified by:
getAllowFlightin interfaceServer
-
setAllowFlight
public void setAllowFlight(boolean allowFlight) Sets whether the server should allow flight.- Parameters:
allowFlight- Whether the server should allow flight.- See Also:
-
isHardcore
public boolean isHardcore()- Specified by:
isHardcorein interfaceServer
-
setHardcore
public void setHardcore(boolean hardcore) Sets whether the server should be in hardcore mode.- Parameters:
hardcore- Whether the server should be in hardcore mode.- See Also:
-
shutdown
public void shutdown() -
getOfflinePlayer
Deprecated.- Specified by:
getOfflinePlayerin interfaceServer
-
getOfflinePlayer
- Specified by:
getOfflinePlayerin interfaceServer
-
getBannedPlayers
- Specified by:
getBannedPlayersin interfaceServer
-
getBanList
- Specified by:
getBanListin interfaceServer
-
getWorldContainer
- Specified by:
getWorldContainerin interfaceServer
-
getMessenger
- Specified by:
getMessengerin interfaceServer
-
createMerchant
Deprecated.- Specified by:
createMerchantin interfaceServer
-
getMaxChainedNeighborUpdates
public int getMaxChainedNeighborUpdates()- Specified by:
getMaxChainedNeighborUpdatesin interfaceServer
-
setMaxChainedNeighborUpdates
public void setMaxChainedNeighborUpdates(int maxChainedNeighborUpdates) Sets the maximum number of chained neighbour updates before skipping additional ones. Negative values remove the limit.- Parameters:
maxChainedNeighborUpdates- The maximum number of chained neighbour updates.- See Also:
-
getMonsterSpawnLimit
Deprecated.- Specified by:
getMonsterSpawnLimitin interfaceServer
-
getAnimalSpawnLimit
Deprecated.- Specified by:
getAnimalSpawnLimitin interfaceServer
-
getWaterAnimalSpawnLimit
Deprecated.- Specified by:
getWaterAnimalSpawnLimitin interfaceServer
-
getAmbientSpawnLimit
Deprecated.- Specified by:
getAmbientSpawnLimitin interfaceServer
-
isPrimaryThread
public boolean isPrimaryThread()- Specified by:
isPrimaryThreadin interfaceServer
-
motd
@NotNull public @NotNull net.kyori.adventure.text.Component motd() -
motd
public void motd(@NotNull @NotNull net.kyori.adventure.text.Component motd) -
getMotd
Deprecated. -
setMotd
-
getServerLinks
- Specified by:
getServerLinksin interfaceServer
-
shutdownMessage
@Nullable public @Nullable net.kyori.adventure.text.Component shutdownMessage()- Specified by:
shutdownMessagein interfaceServer
-
setShutdownMessage
public void setShutdownMessage(@NotNull @NotNull net.kyori.adventure.text.Component shutdownMessage) Sets the shutdown message.- Parameters:
shutdownMessage- The shutdown message.- See Also:
-
getShutdownMessage
Deprecated.- Specified by:
getShutdownMessagein interfaceServer
-
setWarningState
Sets the return value ofgetWarningState().- Parameters:
warningState- TheWarning.WarningStateto set.
-
getWarningState
- Specified by:
getWarningStatein interfaceServer
-
getScoreboardManager
- Specified by:
getScoreboardManagerin interfaceServer
-
getScoreboardCriteria
- Specified by:
getScoreboardCriteriain interfaceServer
-
setServerIcon
Sets the return value ofgetServerIcon().- Parameters:
serverIcon- The icon to set.
-
getServerIcon
- Specified by:
getServerIconin interfaceServer
-
loadServerIcon
@NotNull public @NotNull CachedServerIconMock loadServerIcon(@NotNull @NotNull File file) throws IOException - Specified by:
loadServerIconin interfaceServer- Throws:
IOException
-
loadServerIcon
@NotNull public @NotNull CachedServerIconMock loadServerIcon(@NotNull @NotNull BufferedImage image) throws IOException - Specified by:
loadServerIconin interfaceServer- Throws:
IOException
-
setIdleTimeout
public void setIdleTimeout(int threshold) - Specified by:
setIdleTimeoutin interfaceServer
-
getIdleTimeout
public int getIdleTimeout()- Specified by:
getIdleTimeoutin interfaceServer
-
createChunkData
- Specified by:
createChunkDatain interfaceServer
-
createBossBar
@NotNull public @NotNull BossBar createBossBar(@NotNull @NotNull String title, @NotNull @NotNull BarColor color, @NotNull @NotNull BarStyle style, BarFlag... flags) - Specified by:
createBossBarin interfaceServer
-
getEntity
-
getTPS
@NotNull public @org.jetbrains.annotations.NotNull double[] getTPS() -
getTickTimes
@NotNull public @org.jetbrains.annotations.NotNull long[] getTickTimes()- Specified by:
getTickTimesin interfaceServer
-
getAverageTickTime
public double getAverageTickTime()- Specified by:
getAverageTickTimein interfaceServer
-
getAdvancement
- Specified by:
getAdvancementin interfaceServer
-
advancementIterator
- Specified by:
advancementIteratorin interfaceServer
-
getUnsafe
Deprecated. -
createBlockData
- Specified by:
createBlockDatain interfaceServer
-
createBlockData
@NotNull public @NotNull BlockData createBlockData(@NotNull @NotNull Material material, @Nullable @Nullable Consumer<? super BlockData> consumer) - Specified by:
createBlockDatain interfaceServer
-
createBlockData
- Specified by:
createBlockDatain interfaceServer
-
createBlockData
- Specified by:
createBlockDatain interfaceServer
-
createMaterialTag
@NotNull public @NotNull Tag<Material> createMaterialTag(@NotNull @NotNull NamespacedKey key, @NotNull @NotNull String registryKey, @NotNull @NotNull Material... materials) This creates a new MockTagfor theMaterialclass.
Call this in advance before you are gonna accessgetTag(String, NamespacedKey, Class)or any of the constants defined inTag.- Parameters:
key- TheNamespacedKeyfor thisTagregistryKey- The name of theTagRegistry.materials-Materialswhich should be covered by thisTag- Returns:
- The newly created
Tag
-
addTagRegistry
Adds a tag registry.- Parameters:
registry- The registry to add.
-
getTag
public <T extends Keyed> Tag<T> getTag(@NotNull @NotNull String registryKey, @NotNull @NotNull NamespacedKey key, @NotNull @NotNull Class<T> clazz) -
getLootTable
- Specified by:
getLootTablein interfaceServer
-
createExplorerMap
@NotNull public @NotNull ItemStack createExplorerMap(World world, Location location, StructureType structureType) - Specified by:
createExplorerMapin interfaceServer
-
createExplorerMap
@NotNull public @NotNull ItemStack createExplorerMap(World world, Location location, StructureType structureType, int radius, boolean findUnexplored) - Specified by:
createExplorerMapin interfaceServer
-
createExplorerMap
@Nullable public @Nullable ItemStack createExplorerMap(@NotNull @NotNull World world, @NotNull @NotNull Location location, @NotNull StructureType structureType, @NotNull MapCursor.Type mapIcon, int radius, boolean findUnexplored) - Specified by:
createExplorerMapin interfaceServer
-
createBossBar
@NotNull public @NotNull KeyedBossBar createBossBar(@NotNull @NotNull NamespacedKey key, @NotNull @NotNull String title, @NotNull @NotNull BarColor color, @NotNull @NotNull BarStyle style, BarFlag... flags) - Specified by:
createBossBarin interfaceServer
-
getBossBars
- Specified by:
getBossBarsin interfaceServer
-
getBossBar
- Specified by:
getBossBarin interfaceServer
-
removeBossBar
- Specified by:
removeBossBarin interfaceServer
-
selectEntities
- Specified by:
selectEntitiesin interfaceServer
-
getStructureManager
- Specified by:
getStructureManagerin interfaceServer
-
getRegistry
@Nullable public <T extends Keyed> @Nullable Registry<T> getRegistry(@NotNull @NotNull Class<T> tClass) - Specified by:
getRegistryin interfaceServer
-
getMap
Deprecated. -
getTags
-
getTicksPerWaterSpawns
Deprecated.- Specified by:
getTicksPerWaterSpawnsin interfaceServer
-
getTicksPerAmbientSpawns
Deprecated.- Specified by:
getTicksPerAmbientSpawnsin interfaceServer
-
getCurrentServerTime
protected long getCurrentServerTime()This returns the current time of theServerin milliseconds- Returns:
- The current
Servertime
-
getTicksPerWaterAmbientSpawns
public int getTicksPerWaterAmbientSpawns()- Specified by:
getTicksPerWaterAmbientSpawnsin interfaceServer
-
getTicksPerWaterUndergroundCreatureSpawns
Deprecated.- Specified by:
getTicksPerWaterUndergroundCreatureSpawnsin interfaceServer
-
getWaterAmbientSpawnLimit
Deprecated.- Specified by:
getWaterAmbientSpawnLimitin interfaceServer
-
getWaterUndergroundCreatureSpawnLimit
Deprecated.- Specified by:
getWaterUndergroundCreatureSpawnLimitin interfaceServer
-
getMaxWorldSize
public int getMaxWorldSize()- Specified by:
getMaxWorldSizein interfaceServer
-
setMaxWorldSize
public void setMaxWorldSize(int maxWorldSize) Set the maximum world size- Parameters:
maxWorldSize- The maximum world size- See Also:
-
getSimulationDistance
public int getSimulationDistance()- Specified by:
getSimulationDistancein interfaceServer
-
setSimulationDistance
public void setSimulationDistance(int simulationDistance) Set the simulation distance- Parameters:
simulationDistance- The simulation distance- See Also:
-
getHideOnlinePlayers
public boolean getHideOnlinePlayers()- Specified by:
getHideOnlinePlayersin interfaceServer
-
setHideOnlinePlayers
public void setHideOnlinePlayers(boolean hideOnlinePlayers) Set whether to hide online players- Parameters:
hideOnlinePlayers- Whether to hide online players- See Also:
-
spigot
-
reloadPermissions
public void reloadPermissions()- Specified by:
reloadPermissionsin interfaceServer
-
reloadCommandAliases
public boolean reloadCommandAliases()- Specified by:
reloadCommandAliasesin interfaceServer
-
suggestPlayerNamesWhenNullTabCompletions
public boolean suggestPlayerNamesWhenNullTabCompletions()- Specified by:
suggestPlayerNamesWhenNullTabCompletionsin interfaceServer
-
getPermissionMessage
- Specified by:
getPermissionMessagein interfaceServer
-
permissionMessage
@NotNull public @NotNull net.kyori.adventure.text.Component permissionMessage()- Specified by:
permissionMessagein interfaceServer
-
createProfile
- Specified by:
createProfilein interfaceServer
-
createProfile
- Specified by:
createProfilein interfaceServer
-
createProfile
@NotNull public @NotNull PlayerProfileMock createProfile(@Nullable @Nullable UUID uuid, @Nullable @Nullable String name) - Specified by:
createProfilein interfaceServer
-
createProfileExact
@NotNull public @NotNull PlayerProfileMock createProfileExact(@Nullable @Nullable UUID uuid, @Nullable @Nullable String name) - Specified by:
createProfileExactin interfaceServer
-
getCurrentTick
public int getCurrentTick()- Specified by:
getCurrentTickin interfaceServer
-
isStopping
public boolean isStopping()- Specified by:
isStoppingin interfaceServer
-
getMobGoals
- Specified by:
getMobGoalsin interfaceServer
-
getDatapackManager
- Specified by:
getDatapackManagerin interfaceServer
-
getConfig
- Overrides:
getConfigin classServer.Spigot
-
broadcast
@Deprecated public void broadcast(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent component) Deprecated.- Specified by:
broadcastin interfaceServer- Overrides:
broadcastin classServer.Spigot
-
broadcast
@Deprecated public void broadcast(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent... components) Deprecated.- Specified by:
broadcastin interfaceServer- Overrides:
broadcastin classServer.Spigot
-
restart
public void restart()- Overrides:
restartin classServer.Spigot
-
getTicksPerSpawns
- Specified by:
getTicksPerSpawnsin interfaceServer
-
createPlayerProfile
@Deprecated @NotNull public @NotNull PlayerProfileMock createPlayerProfile(@Nullable @Nullable UUID uniqueId, @Nullable @Nullable String name) Deprecated.- Specified by:
createPlayerProfilein interfaceServer
-
createPlayerProfile
@Deprecated @NotNull public @NotNull PlayerProfileMock createPlayerProfile(@NotNull @NotNull UUID uniqueId) Deprecated.- Specified by:
createPlayerProfilein interfaceServer
-
createPlayerProfile
@Deprecated @NotNull public @NotNull PlayerProfileMock createPlayerProfile(@NotNull @NotNull String name) Deprecated.- Specified by:
createPlayerProfilein interfaceServer
-
getSpawnLimit
- Specified by:
getSpawnLimitin interfaceServer
-
getPotionBrewer
- Specified by:
getPotionBrewerin interfaceServer
-
getRegionScheduler
- Specified by:
getRegionSchedulerin interfaceServer
-
getAsyncScheduler
- Specified by:
getAsyncSchedulerin interfaceServer
-
getGlobalRegionScheduler
- Specified by:
getGlobalRegionSchedulerin interfaceServer
-
isOwnedByCurrentRegion
public boolean isOwnedByCurrentRegion(@NotNull @NotNull World world, @NotNull @NotNull Position position) - Specified by:
isOwnedByCurrentRegionin interfaceServer
-
isOwnedByCurrentRegion
public boolean isOwnedByCurrentRegion(@NotNull @NotNull World world, @NotNull @NotNull Position position, int squareRadiusChunks) - Specified by:
isOwnedByCurrentRegionin interfaceServer
-
isOwnedByCurrentRegion
- Specified by:
isOwnedByCurrentRegionin interfaceServer
-
isOwnedByCurrentRegion
- Specified by:
isOwnedByCurrentRegionin interfaceServer
-
isOwnedByCurrentRegion
- Specified by:
isOwnedByCurrentRegionin interfaceServer
-
isOwnedByCurrentRegion
public boolean isOwnedByCurrentRegion(@NotNull @NotNull World world, int chunkX, int chunkZ, int squareRadiusChunks) - Specified by:
isOwnedByCurrentRegionin interfaceServer
-
isOwnedByCurrentRegion
- Specified by:
isOwnedByCurrentRegionin interfaceServer
-
getPluginsFolder
- Specified by:
getPluginsFolderin interfaceServer
-
isAcceptingTransfers
public boolean isAcceptingTransfers()- Specified by:
isAcceptingTransfersin interfaceServer
-
getEntityFactory
- Specified by:
getEntityFactoryin interfaceServer
-
audiences
- Specified by:
audiencesin interfacenet.kyori.adventure.audience.ForwardingAudience
-
getServerConfiguration
Exposes theServerConfigurationof thisServerMock.- Returns:
- The
ServerConfigurationof thisServerMock.
-