2020-04-24 03:25:58 +02:00
|
|
|
package net.minestom.server;
|
2019-08-03 15:25:24 +02:00
|
|
|
|
2020-08-05 10:56:16 +02:00
|
|
|
import net.minestom.server.advancements.AdvancementManager;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.benchmark.BenchmarkManager;
|
|
|
|
import net.minestom.server.command.CommandManager;
|
|
|
|
import net.minestom.server.data.DataManager;
|
2020-08-15 13:32:36 +02:00
|
|
|
import net.minestom.server.data.DataType;
|
|
|
|
import net.minestom.server.data.SerializableData;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.entity.EntityManager;
|
2020-07-06 23:20:20 +02:00
|
|
|
import net.minestom.server.entity.EntityType;
|
2020-10-31 19:44:22 +01:00
|
|
|
import net.minestom.server.entity.Player;
|
2020-08-18 14:18:12 +02:00
|
|
|
import net.minestom.server.extensions.Extension;
|
|
|
|
import net.minestom.server.extensions.ExtensionManager;
|
2020-07-06 23:20:20 +02:00
|
|
|
import net.minestom.server.fluids.Fluid;
|
2020-05-18 21:11:59 +02:00
|
|
|
import net.minestom.server.gamedata.loottables.LootTableManager;
|
2020-06-23 18:17:02 +02:00
|
|
|
import net.minestom.server.gamedata.tags.TagManager;
|
2020-10-31 19:44:22 +01:00
|
|
|
import net.minestom.server.instance.Chunk;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.instance.InstanceManager;
|
2020-07-06 23:20:20 +02:00
|
|
|
import net.minestom.server.instance.block.Block;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.instance.block.BlockManager;
|
2020-08-15 13:32:36 +02:00
|
|
|
import net.minestom.server.instance.block.CustomBlock;
|
|
|
|
import net.minestom.server.instance.block.rule.BlockPlacementRule;
|
2020-07-06 23:20:20 +02:00
|
|
|
import net.minestom.server.item.Enchantment;
|
|
|
|
import net.minestom.server.item.Material;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.listener.manager.PacketListenerManager;
|
|
|
|
import net.minestom.server.network.ConnectionManager;
|
|
|
|
import net.minestom.server.network.PacketProcessor;
|
|
|
|
import net.minestom.server.network.netty.NettyServer;
|
2020-07-02 15:56:43 +02:00
|
|
|
import net.minestom.server.network.packet.server.play.PluginMessagePacket;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.network.packet.server.play.ServerDifficultyPacket;
|
2020-10-31 19:44:22 +01:00
|
|
|
import net.minestom.server.network.packet.server.play.UpdateViewDistancePacket;
|
2020-07-06 23:20:20 +02:00
|
|
|
import net.minestom.server.particle.Particle;
|
2020-04-28 02:33:15 +02:00
|
|
|
import net.minestom.server.ping.ResponseDataConsumer;
|
2020-10-15 05:29:48 +02:00
|
|
|
import net.minestom.server.potion.PotionEffect;
|
2020-07-06 23:20:20 +02:00
|
|
|
import net.minestom.server.potion.PotionType;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.recipe.RecipeManager;
|
2020-05-01 21:29:34 +02:00
|
|
|
import net.minestom.server.registry.ResourceGatherer;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.scoreboard.TeamManager;
|
2020-07-06 23:20:20 +02:00
|
|
|
import net.minestom.server.sound.Sound;
|
|
|
|
import net.minestom.server.stat.StatisticType;
|
2020-08-31 00:41:19 +02:00
|
|
|
import net.minestom.server.storage.StorageLocation;
|
2020-05-04 18:15:29 +02:00
|
|
|
import net.minestom.server.storage.StorageManager;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.timer.SchedulerManager;
|
2020-10-31 19:44:22 +01:00
|
|
|
import net.minestom.server.utils.MathUtils;
|
2020-11-13 07:43:35 +01:00
|
|
|
import net.minestom.server.utils.PacketUtils;
|
2020-11-20 11:14:15 +01:00
|
|
|
import net.minestom.server.utils.cache.TemporaryCache;
|
2020-07-01 21:03:53 +02:00
|
|
|
import net.minestom.server.utils.thread.MinestomThread;
|
2020-07-02 15:56:43 +02:00
|
|
|
import net.minestom.server.utils.validate.Check;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.world.Difficulty;
|
2020-07-13 14:12:21 +02:00
|
|
|
import net.minestom.server.world.DimensionTypeManager;
|
2020-08-12 19:08:04 +02:00
|
|
|
import net.minestom.server.world.biomes.BiomeManager;
|
2020-11-09 23:48:34 +01:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
2020-10-26 15:15:56 +01:00
|
|
|
import org.jetbrains.annotations.Nullable;
|
2020-05-10 16:02:49 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
2019-08-03 15:25:24 +02:00
|
|
|
|
2020-05-01 21:29:34 +02:00
|
|
|
import java.io.IOException;
|
2020-10-31 19:44:22 +01:00
|
|
|
import java.util.Collection;
|
2020-05-01 21:29:34 +02:00
|
|
|
|
2020-10-17 16:54:35 +02:00
|
|
|
/**
|
|
|
|
* The main server class used to start the server and retrieve all the managers.
|
|
|
|
* <p>
|
|
|
|
* The server needs to be initialized with {@link #init()} and started with {@link #start(String, int)}.
|
|
|
|
* You should register all of your dimensions, biomes, commands, events, etc... in-between.
|
|
|
|
*/
|
2020-11-10 07:42:11 +01:00
|
|
|
public final class MinecraftServer {
|
2020-10-26 15:15:56 +01:00
|
|
|
|
2020-11-16 03:10:51 +01:00
|
|
|
public final static Logger LOGGER = LoggerFactory.getLogger(MinecraftServer.class);
|
2019-08-03 15:25:24 +02:00
|
|
|
|
2020-11-03 02:16:32 +01:00
|
|
|
public static final String VERSION_NAME = "1.16.4";
|
|
|
|
public static final int PROTOCOL_VERSION = 754;
|
2020-05-10 19:39:25 +02:00
|
|
|
|
2020-04-13 17:17:21 +02:00
|
|
|
// Threads
|
|
|
|
public static final String THREAD_NAME_BENCHMARK = "Ms-Benchmark";
|
|
|
|
|
2020-07-03 16:44:21 +02:00
|
|
|
public static final String THREAD_NAME_TICK = "Ms-Tick";
|
|
|
|
|
2020-04-13 17:17:21 +02:00
|
|
|
public static final String THREAD_NAME_BLOCK_BATCH = "Ms-BlockBatchPool";
|
2020-11-19 08:11:09 +01:00
|
|
|
public static final int THREAD_COUNT_BLOCK_BATCH = 4;
|
2020-04-13 17:17:21 +02:00
|
|
|
|
|
|
|
public static final String THREAD_NAME_SCHEDULER = "Ms-SchedulerPool";
|
|
|
|
public static final int THREAD_COUNT_SCHEDULER = 1;
|
|
|
|
|
2020-07-07 13:55:43 +02:00
|
|
|
public static final String THREAD_NAME_PARALLEL_CHUNK_SAVING = "Ms-ParallelChunkSaving";
|
|
|
|
public static final int THREAD_COUNT_PARALLEL_CHUNK_SAVING = 4;
|
|
|
|
|
2020-02-17 17:33:53 +01:00
|
|
|
// Config
|
2020-08-15 13:32:36 +02:00
|
|
|
// Can be modified at performance cost when increased
|
|
|
|
public static final int TICK_PER_SECOND = 20;
|
2020-02-09 15:34:09 +01:00
|
|
|
private static final int MS_TO_SEC = 1000;
|
2020-08-15 13:32:36 +02:00
|
|
|
public static final int TICK_MS = MS_TO_SEC / TICK_PER_SECOND;
|
2020-03-29 20:58:30 +02:00
|
|
|
|
2020-11-13 03:26:35 +01:00
|
|
|
// Network monitoring
|
2020-11-13 02:07:01 +01:00
|
|
|
private static int rateLimit = 300;
|
2020-11-13 01:34:25 +01:00
|
|
|
private static int maxPacketSize = 30_000;
|
2020-11-13 03:26:35 +01:00
|
|
|
// Network
|
2019-08-20 17:41:07 +02:00
|
|
|
private static PacketListenerManager packetListenerManager;
|
2020-11-14 00:20:19 +01:00
|
|
|
private static PacketProcessor packetProcessor;
|
2020-04-17 01:16:02 +02:00
|
|
|
private static NettyServer nettyServer;
|
2020-11-29 17:49:02 +01:00
|
|
|
private static int nettyThreadCount = Runtime.getRuntime().availableProcessors();
|
2020-11-19 02:28:56 +01:00
|
|
|
private static boolean processNettyErrors = true;
|
2019-08-03 15:25:24 +02:00
|
|
|
|
2019-08-11 00:36:20 +02:00
|
|
|
// In-Game Manager
|
2020-04-15 16:35:25 +02:00
|
|
|
private static ConnectionManager connectionManager;
|
2019-08-11 07:42:56 +02:00
|
|
|
private static InstanceManager instanceManager;
|
2019-08-18 23:52:11 +02:00
|
|
|
private static BlockManager blockManager;
|
2019-08-11 00:36:20 +02:00
|
|
|
private static EntityManager entityManager;
|
2020-04-01 13:16:18 +02:00
|
|
|
private static CommandManager commandManager;
|
|
|
|
private static RecipeManager recipeManager;
|
2020-05-04 18:15:29 +02:00
|
|
|
private static StorageManager storageManager;
|
2019-09-01 06:18:41 +02:00
|
|
|
private static DataManager dataManager;
|
2019-09-21 20:42:27 +02:00
|
|
|
private static TeamManager teamManager;
|
2019-09-23 19:56:08 +02:00
|
|
|
private static SchedulerManager schedulerManager;
|
2020-04-13 17:17:21 +02:00
|
|
|
private static BenchmarkManager benchmarkManager;
|
2020-07-13 14:12:21 +02:00
|
|
|
private static DimensionTypeManager dimensionTypeManager;
|
2020-08-12 19:08:04 +02:00
|
|
|
private static BiomeManager biomeManager;
|
2020-08-05 10:56:16 +02:00
|
|
|
private static AdvancementManager advancementManager;
|
2019-08-03 15:25:24 +02:00
|
|
|
|
2020-08-18 14:18:12 +02:00
|
|
|
private static ExtensionManager extensionManager;
|
2020-08-10 23:30:56 +02:00
|
|
|
|
2020-04-17 01:16:02 +02:00
|
|
|
private static UpdateManager updateManager;
|
2020-02-17 17:33:53 +01:00
|
|
|
private static MinecraftServer minecraftServer;
|
|
|
|
|
2020-04-15 16:35:25 +02:00
|
|
|
// Data
|
2020-10-26 15:15:56 +01:00
|
|
|
private static boolean initialized;
|
2020-10-25 16:48:14 +01:00
|
|
|
private static boolean started;
|
|
|
|
|
2020-11-19 07:00:41 +01:00
|
|
|
private static int chunkViewDistance = 8;
|
2020-10-25 16:48:14 +01:00
|
|
|
private static int entityViewDistance = 5;
|
|
|
|
private static int compressionThreshold = 256;
|
2020-11-21 10:26:25 +01:00
|
|
|
private static boolean packetCaching = true;
|
2020-04-28 02:33:15 +02:00
|
|
|
private static ResponseDataConsumer responseDataConsumer;
|
2020-07-02 15:56:43 +02:00
|
|
|
private static String brandName = "Minestom";
|
2020-04-15 16:35:25 +02:00
|
|
|
private static Difficulty difficulty = Difficulty.NORMAL;
|
2020-05-18 21:11:59 +02:00
|
|
|
private static LootTableManager lootTableManager;
|
2020-06-23 18:17:02 +02:00
|
|
|
private static TagManager tagManager;
|
2020-04-15 16:35:25 +02:00
|
|
|
|
2020-02-17 17:33:53 +01:00
|
|
|
public static MinecraftServer init() {
|
2020-08-12 07:46:07 +02:00
|
|
|
if (minecraftServer != null) // don't init twice
|
2020-08-10 14:50:39 +02:00
|
|
|
return minecraftServer;
|
2020-08-20 02:06:58 +02:00
|
|
|
extensionManager = new ExtensionManager();
|
|
|
|
extensionManager.loadExtensions();
|
|
|
|
|
2020-07-06 23:20:20 +02:00
|
|
|
// warmup/force-init registries
|
|
|
|
// without this line, registry types that are not loaded explicitly will have an internal empty registry in Registries
|
|
|
|
// That can happen with PotionType for instance, if no code tries to access a PotionType field
|
|
|
|
// TODO: automate (probably with code generation)
|
|
|
|
Block.values();
|
|
|
|
Material.values();
|
|
|
|
PotionType.values();
|
2020-10-15 05:29:48 +02:00
|
|
|
PotionEffect.values();
|
2020-07-06 23:20:20 +02:00
|
|
|
Enchantment.values();
|
|
|
|
EntityType.values();
|
|
|
|
Sound.values();
|
|
|
|
Particle.values();
|
|
|
|
StatisticType.values();
|
|
|
|
Fluid.values();
|
|
|
|
|
2019-08-03 15:25:24 +02:00
|
|
|
connectionManager = new ConnectionManager();
|
2020-08-19 01:24:51 +02:00
|
|
|
// Networking
|
2020-11-14 00:20:19 +01:00
|
|
|
packetProcessor = new PacketProcessor();
|
2019-08-20 17:41:07 +02:00
|
|
|
packetListenerManager = new PacketListenerManager();
|
2019-08-11 00:36:20 +02:00
|
|
|
|
2019-08-11 07:42:56 +02:00
|
|
|
instanceManager = new InstanceManager();
|
2019-08-18 23:52:11 +02:00
|
|
|
blockManager = new BlockManager();
|
2019-08-11 00:36:20 +02:00
|
|
|
entityManager = new EntityManager();
|
2020-04-01 13:16:18 +02:00
|
|
|
commandManager = new CommandManager();
|
|
|
|
recipeManager = new RecipeManager();
|
2020-05-04 18:15:29 +02:00
|
|
|
storageManager = new StorageManager();
|
2019-09-01 06:18:41 +02:00
|
|
|
dataManager = new DataManager();
|
2019-09-21 20:42:27 +02:00
|
|
|
teamManager = new TeamManager();
|
2019-09-23 19:56:08 +02:00
|
|
|
schedulerManager = new SchedulerManager();
|
2020-04-13 17:17:21 +02:00
|
|
|
benchmarkManager = new BenchmarkManager();
|
2020-07-13 14:12:21 +02:00
|
|
|
dimensionTypeManager = new DimensionTypeManager();
|
2020-08-12 19:08:04 +02:00
|
|
|
biomeManager = new BiomeManager();
|
2020-08-05 10:56:16 +02:00
|
|
|
advancementManager = new AdvancementManager();
|
2019-08-03 15:25:24 +02:00
|
|
|
|
2020-04-17 01:16:02 +02:00
|
|
|
updateManager = new UpdateManager();
|
|
|
|
|
2020-05-18 21:11:59 +02:00
|
|
|
lootTableManager = new LootTableManager();
|
2020-06-23 18:17:02 +02:00
|
|
|
tagManager = new TagManager();
|
2020-05-18 21:11:59 +02:00
|
|
|
|
2020-04-17 01:16:02 +02:00
|
|
|
nettyServer = new NettyServer(packetProcessor);
|
2019-09-02 06:02:12 +02:00
|
|
|
|
2020-04-10 10:31:49 +02:00
|
|
|
// Registry
|
2020-05-01 21:29:34 +02:00
|
|
|
try {
|
2020-09-25 18:39:43 +02:00
|
|
|
ResourceGatherer.ensureResourcesArePresent(VERSION_NAME);
|
2020-05-01 21:29:34 +02:00
|
|
|
} catch (IOException e) {
|
2020-05-10 16:02:49 +02:00
|
|
|
LOGGER.error("An error happened during resource gathering. Minestom will attempt to load anyway, but things may not work, and crashes can happen.", e);
|
2020-05-01 21:29:34 +02:00
|
|
|
}
|
2020-04-10 10:31:49 +02:00
|
|
|
|
2020-10-26 15:15:56 +01:00
|
|
|
initialized = true;
|
|
|
|
|
2020-02-17 17:33:53 +01:00
|
|
|
minecraftServer = new MinecraftServer();
|
|
|
|
|
|
|
|
return minecraftServer;
|
|
|
|
}
|
|
|
|
|
2020-07-02 15:56:43 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the current server brand name.
|
2020-07-02 15:56:43 +02:00
|
|
|
*
|
|
|
|
* @return the server brand name
|
|
|
|
*/
|
2020-11-09 23:48:34 +01:00
|
|
|
@NotNull
|
2020-07-02 15:56:43 +02:00
|
|
|
public static String getBrandName() {
|
|
|
|
return brandName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-11-09 23:48:34 +01:00
|
|
|
* Changes the server brand name and send the change to all connected players.
|
2020-07-02 15:56:43 +02:00
|
|
|
*
|
2020-08-07 09:14:50 +02:00
|
|
|
* @param brandName the server brand name
|
2020-11-09 23:48:34 +01:00
|
|
|
* @throws NullPointerException if {@code brandName} is null
|
2020-07-02 15:56:43 +02:00
|
|
|
*/
|
2020-11-12 00:56:36 +01:00
|
|
|
public static void setBrandName(@NotNull String brandName) {
|
2020-07-02 15:56:43 +02:00
|
|
|
Check.notNull(brandName, "The brand name cannot be null");
|
|
|
|
MinecraftServer.brandName = brandName;
|
|
|
|
|
2020-11-13 07:43:35 +01:00
|
|
|
PacketUtils.sendGroupedPacket(connectionManager.getOnlinePlayers(), PluginMessagePacket.getBrandPacket());
|
2020-07-02 15:56:43 +02:00
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-11-13 01:53:55 +01:00
|
|
|
* Gets the maximum number of packets a client can send over 1 second.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
2020-11-13 01:34:25 +01:00
|
|
|
* @return the packet count limit over 1 second, 0 if not enabled
|
2020-08-15 13:32:36 +02:00
|
|
|
*/
|
|
|
|
public static int getRateLimit() {
|
|
|
|
return rateLimit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Changes the number of packet a client can send over 1 second without being disconnected.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @param rateLimit the number of packet, 0 to disable
|
|
|
|
*/
|
|
|
|
public static void setRateLimit(int rateLimit) {
|
|
|
|
MinecraftServer.rateLimit = rateLimit;
|
|
|
|
}
|
|
|
|
|
2020-11-13 01:34:25 +01:00
|
|
|
/**
|
|
|
|
* Gets the maximum packet size (in bytes) that a client can send without getting disconnected.
|
|
|
|
*
|
|
|
|
* @return the maximum packet size
|
|
|
|
*/
|
|
|
|
public static int getMaxPacketSize() {
|
|
|
|
return maxPacketSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the maximum packet size (in bytes) that a client can send without getting disconnected.
|
|
|
|
*
|
|
|
|
* @param maxPacketSize the new max packet size
|
|
|
|
*/
|
|
|
|
public static void setMaxPacketSize(int maxPacketSize) {
|
|
|
|
MinecraftServer.maxPacketSize = maxPacketSize;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the server difficulty showed in game option.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the server difficulty
|
|
|
|
*/
|
2020-11-09 23:48:34 +01:00
|
|
|
@NotNull
|
2020-04-15 16:35:25 +02:00
|
|
|
public static Difficulty getDifficulty() {
|
|
|
|
return difficulty;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Changes the server difficulty and send the appropriate packet to all connected clients.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @param difficulty the new server difficulty
|
|
|
|
*/
|
2020-11-09 23:48:34 +01:00
|
|
|
public static void setDifficulty(@NotNull Difficulty difficulty) {
|
|
|
|
Check.notNull(difficulty, "The server difficulty cannot be null.");
|
2020-04-15 16:35:25 +02:00
|
|
|
MinecraftServer.difficulty = difficulty;
|
2020-08-15 13:32:36 +02:00
|
|
|
|
2020-11-13 07:43:35 +01:00
|
|
|
// Send the packet to all online players
|
2020-08-15 13:32:36 +02:00
|
|
|
ServerDifficultyPacket serverDifficultyPacket = new ServerDifficultyPacket();
|
|
|
|
serverDifficultyPacket.difficulty = difficulty;
|
2020-11-10 07:42:11 +01:00
|
|
|
serverDifficultyPacket.locked = true; // Can only be modified on single-player
|
2020-11-13 07:43:35 +01:00
|
|
|
PacketUtils.sendGroupedPacket(connectionManager.getOnlinePlayers(), serverDifficultyPacket);
|
2020-04-15 16:35:25 +02:00
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling all incoming packets
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the packet listener manager
|
|
|
|
*/
|
2020-02-17 17:33:53 +01:00
|
|
|
public static PacketListenerManager getPacketListenerManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(packetListenerManager);
|
2020-02-17 17:33:53 +01:00
|
|
|
return packetListenerManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the netty server.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the netty server
|
|
|
|
*/
|
2020-04-17 01:16:02 +02:00
|
|
|
public static NettyServer getNettyServer() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(nettyServer);
|
2020-04-17 01:16:02 +02:00
|
|
|
return nettyServer;
|
2020-02-17 17:33:53 +01:00
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling all registered instances.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the instance manager
|
|
|
|
*/
|
2020-02-17 17:33:53 +01:00
|
|
|
public static InstanceManager getInstanceManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(instanceManager);
|
2020-02-17 17:33:53 +01:00
|
|
|
return instanceManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling {@link CustomBlock} and {@link BlockPlacementRule}.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the block manager
|
|
|
|
*/
|
2020-02-17 17:33:53 +01:00
|
|
|
public static BlockManager getBlockManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(blockManager);
|
2020-02-17 17:33:53 +01:00
|
|
|
return blockManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling waiting players.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the entity manager
|
|
|
|
*/
|
2020-02-17 17:33:53 +01:00
|
|
|
public static EntityManager getEntityManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(entityManager);
|
2020-02-17 17:33:53 +01:00
|
|
|
return entityManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling commands.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the command manager
|
|
|
|
*/
|
2020-04-01 13:16:18 +02:00
|
|
|
public static CommandManager getCommandManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(commandManager);
|
2020-04-01 13:16:18 +02:00
|
|
|
return commandManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling recipes show to the clients.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the recipe manager
|
|
|
|
*/
|
2020-04-01 13:16:18 +02:00
|
|
|
public static RecipeManager getRecipeManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(recipeManager);
|
2020-04-01 13:16:18 +02:00
|
|
|
return recipeManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling storage.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the storage manager
|
|
|
|
*/
|
2020-05-04 18:15:29 +02:00
|
|
|
public static StorageManager getStorageManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(storageManager);
|
2020-05-04 18:15:29 +02:00
|
|
|
return storageManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling {@link DataType} used by {@link SerializableData}.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the data manager
|
|
|
|
*/
|
2020-02-17 17:33:53 +01:00
|
|
|
public static DataManager getDataManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(dataManager);
|
2020-02-17 17:33:53 +01:00
|
|
|
return dataManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling teams.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the team manager
|
|
|
|
*/
|
2020-02-17 17:33:53 +01:00
|
|
|
public static TeamManager getTeamManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(teamManager);
|
2020-02-17 17:33:53 +01:00
|
|
|
return teamManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling scheduled tasks.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the scheduler manager
|
|
|
|
*/
|
2020-02-17 17:33:53 +01:00
|
|
|
public static SchedulerManager getSchedulerManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(schedulerManager);
|
2020-02-17 17:33:53 +01:00
|
|
|
return schedulerManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling server monitoring.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the benchmark manager
|
|
|
|
*/
|
2020-04-13 17:17:21 +02:00
|
|
|
public static BenchmarkManager getBenchmarkManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(benchmarkManager);
|
2020-04-13 17:17:21 +02:00
|
|
|
return benchmarkManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling server connections.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the connection manager
|
|
|
|
*/
|
2020-02-17 17:33:53 +01:00
|
|
|
public static ConnectionManager getConnectionManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(connectionManager);
|
2020-02-17 17:33:53 +01:00
|
|
|
return connectionManager;
|
|
|
|
}
|
|
|
|
|
2020-11-14 00:20:19 +01:00
|
|
|
/**
|
|
|
|
* Gets the object handling the client packets processing.
|
|
|
|
* <p>
|
|
|
|
* Can be used if you want to convert a buffer to a client packet object.
|
|
|
|
*
|
|
|
|
* @return the packet processor
|
|
|
|
*/
|
|
|
|
public static PacketProcessor getPacketProcessor() {
|
|
|
|
checkInitStatus(packetProcessor);
|
|
|
|
return packetProcessor;
|
|
|
|
}
|
|
|
|
|
2020-10-25 16:48:14 +01:00
|
|
|
/**
|
|
|
|
* Gets if the server is up and running.
|
|
|
|
*
|
|
|
|
* @return true if the server is started
|
|
|
|
*/
|
|
|
|
public static boolean isStarted() {
|
|
|
|
return started;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the chunk view distance of the server.
|
|
|
|
*
|
|
|
|
* @return the chunk view distance
|
|
|
|
*/
|
|
|
|
public static int getChunkViewDistance() {
|
|
|
|
return chunkViewDistance;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the chunk view distance of the server.
|
|
|
|
*
|
|
|
|
* @param chunkViewDistance the new chunk view distance
|
2020-11-04 19:14:04 +01:00
|
|
|
* @throws IllegalArgumentException if {@code chunkViewDistance} is not between 2 and 32
|
2020-10-25 16:48:14 +01:00
|
|
|
*/
|
|
|
|
public static void setChunkViewDistance(int chunkViewDistance) {
|
2020-11-04 19:14:04 +01:00
|
|
|
Check.argCondition(!MathUtils.isBetween(chunkViewDistance, 2, 32),
|
|
|
|
"The chunk view distance must be between 2 and 32");
|
2020-10-25 16:48:14 +01:00
|
|
|
MinecraftServer.chunkViewDistance = chunkViewDistance;
|
2020-10-31 19:44:22 +01:00
|
|
|
if (started) {
|
|
|
|
|
|
|
|
final Collection<Player> players = connectionManager.getOnlinePlayers();
|
|
|
|
|
2020-11-13 07:43:35 +01:00
|
|
|
players.forEach(player -> {
|
2020-10-31 19:44:22 +01:00
|
|
|
final Chunk playerChunk = player.getChunk();
|
|
|
|
if (playerChunk != null) {
|
2020-11-22 13:23:53 +01:00
|
|
|
|
|
|
|
UpdateViewDistancePacket updateViewDistancePacket = new UpdateViewDistancePacket();
|
|
|
|
updateViewDistancePacket.viewDistance = player.getChunkRange();
|
|
|
|
player.getPlayerConnection().sendPacket(updateViewDistancePacket);
|
|
|
|
|
2020-10-31 19:44:22 +01:00
|
|
|
player.refreshVisibleChunks(playerChunk);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-10-25 16:48:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the entity view distance of the server.
|
|
|
|
*
|
|
|
|
* @return the entity view distance
|
|
|
|
*/
|
|
|
|
public static int getEntityViewDistance() {
|
|
|
|
return entityViewDistance;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the entity view distance of the server.
|
|
|
|
*
|
|
|
|
* @param entityViewDistance the new entity view distance
|
2020-11-04 19:14:04 +01:00
|
|
|
* @throws IllegalArgumentException if {@code entityViewDistance} is not between 0 and 32
|
2020-10-25 16:48:14 +01:00
|
|
|
*/
|
|
|
|
public static void setEntityViewDistance(int entityViewDistance) {
|
2020-11-04 19:14:04 +01:00
|
|
|
Check.argCondition(!MathUtils.isBetween(entityViewDistance, 0, 32),
|
|
|
|
"The entity view distance must be between 0 and 32");
|
2020-10-25 16:48:14 +01:00
|
|
|
MinecraftServer.entityViewDistance = entityViewDistance;
|
2020-11-04 19:14:04 +01:00
|
|
|
if (started) {
|
|
|
|
connectionManager.getOnlinePlayers().forEach(player -> {
|
|
|
|
final Chunk playerChunk = player.getChunk();
|
|
|
|
if (playerChunk != null) {
|
|
|
|
player.refreshVisibleEntities(playerChunk);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-10-25 16:48:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the compression threshold of the server.
|
|
|
|
*
|
|
|
|
* @return the compression threshold, 0 means that compression is disabled
|
|
|
|
*/
|
|
|
|
public static int getCompressionThreshold() {
|
|
|
|
return compressionThreshold;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the compression threshold of the server.
|
|
|
|
* <p>
|
|
|
|
* WARNING: this need to be called before {@link #start(String, int, ResponseDataConsumer)}.
|
|
|
|
*
|
|
|
|
* @param compressionThreshold the new compression threshold, 0 to disable compression
|
|
|
|
* @throws IllegalStateException if this is called after the server started
|
|
|
|
*/
|
|
|
|
public static void setCompressionThreshold(int compressionThreshold) {
|
|
|
|
Check.stateCondition(started, "The compression threshold cannot be changed after the server has been started.");
|
|
|
|
MinecraftServer.compressionThreshold = compressionThreshold;
|
|
|
|
}
|
|
|
|
|
2020-11-21 10:26:25 +01:00
|
|
|
/**
|
|
|
|
* Gets if the packet caching feature is enabled.
|
|
|
|
* <p>
|
|
|
|
* This feature allows some packets (implementing the {@link net.minestom.server.utils.cache.CacheablePacket} to be cached
|
2020-11-21 10:27:39 +01:00
|
|
|
* in order to do not have to be written and compressed over and over again), this is especially useful for chunk and light packets.
|
2020-11-21 10:26:25 +01:00
|
|
|
* <p>
|
|
|
|
* It is enabled by default and it is our recommendation, you should only disable it if you want to focus on low memory usage
|
|
|
|
* at the cost of many packet writing and compression.
|
|
|
|
*
|
|
|
|
* @return true if the packet caching feature is enabled, false otherwise
|
|
|
|
*/
|
|
|
|
public static boolean hasPacketCaching() {
|
|
|
|
return packetCaching;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enables or disable packet caching.
|
|
|
|
*
|
|
|
|
* @param packetCaching true to enable packet caching
|
|
|
|
* @throws IllegalStateException if this is called after the server started
|
|
|
|
* @see #hasPacketCaching()
|
|
|
|
*/
|
|
|
|
public static void setPacketCaching(boolean packetCaching) {
|
|
|
|
Check.stateCondition(started, "You cannot change the packet caching value after the server has been started.");
|
|
|
|
MinecraftServer.packetCaching = packetCaching;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the consumer executed to show server-list data.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the response data consumer
|
|
|
|
*/
|
2020-04-28 02:33:15 +02:00
|
|
|
public static ResponseDataConsumer getResponseDataConsumer() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(responseDataConsumer);
|
2020-04-28 02:33:15 +02:00
|
|
|
return responseDataConsumer;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling loot tables.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the loot table manager
|
|
|
|
*/
|
2020-05-18 21:11:59 +02:00
|
|
|
public static LootTableManager getLootTableManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(lootTableManager);
|
2020-05-18 21:11:59 +02:00
|
|
|
return lootTableManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling dimensions.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the dimension manager
|
|
|
|
*/
|
2020-07-13 14:12:21 +02:00
|
|
|
public static DimensionTypeManager getDimensionTypeManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(dimensionTypeManager);
|
2020-07-13 14:12:21 +02:00
|
|
|
return dimensionTypeManager;
|
|
|
|
}
|
|
|
|
|
2020-10-17 16:54:35 +02:00
|
|
|
/**
|
|
|
|
* Gets the manager handling biomes.
|
|
|
|
*
|
|
|
|
* @return the biome manager
|
|
|
|
*/
|
2020-08-12 19:08:04 +02:00
|
|
|
public static BiomeManager getBiomeManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(biomeManager);
|
2020-08-12 19:08:04 +02:00
|
|
|
return biomeManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling advancements.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the advancement manager
|
|
|
|
*/
|
2020-08-05 10:56:16 +02:00
|
|
|
public static AdvancementManager getAdvancementManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(advancementManager);
|
2020-08-05 10:56:16 +02:00
|
|
|
return advancementManager;
|
|
|
|
}
|
|
|
|
|
2020-10-17 16:30:37 +02:00
|
|
|
/**
|
|
|
|
* Get the manager handling {@link Extension}.
|
|
|
|
*
|
|
|
|
* @return the extension manager
|
|
|
|
*/
|
|
|
|
public static ExtensionManager getExtensionManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(extensionManager);
|
2020-10-17 16:30:37 +02:00
|
|
|
return extensionManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling tags.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the tag manager
|
|
|
|
*/
|
2020-06-23 18:17:02 +02:00
|
|
|
public static TagManager getTagManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(tagManager);
|
2020-06-23 18:17:02 +02:00
|
|
|
return tagManager;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Gets the manager handling the server ticks.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @return the update manager
|
|
|
|
*/
|
2020-08-06 16:28:04 +02:00
|
|
|
public static UpdateManager getUpdateManager() {
|
2020-10-26 15:15:56 +01:00
|
|
|
checkInitStatus(updateManager);
|
2020-08-06 16:28:04 +02:00
|
|
|
return updateManager;
|
|
|
|
}
|
|
|
|
|
2020-11-29 17:49:02 +01:00
|
|
|
/**
|
|
|
|
* Gets the number of threads used by Netty.
|
|
|
|
* <p>
|
|
|
|
* Is the number of vCPU by default.
|
|
|
|
*
|
|
|
|
* @return the number of netty threads
|
|
|
|
*/
|
|
|
|
public static int getNettyThreadCount() {
|
|
|
|
return nettyThreadCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the number of threads used by Netty.
|
|
|
|
*
|
|
|
|
* @param nettyThreadCount the number of threads
|
|
|
|
* @throws IllegalStateException if the server is already started
|
|
|
|
*/
|
|
|
|
public static void setNettyThreadCount(int nettyThreadCount) {
|
|
|
|
Check.stateCondition(started, "Netty thread count can only be changed before the server starts!");
|
|
|
|
MinecraftServer.nettyThreadCount = nettyThreadCount;
|
|
|
|
}
|
|
|
|
|
2020-11-19 02:28:56 +01:00
|
|
|
/**
|
|
|
|
* Gets if the server should process netty errors and other unnecessary netty events
|
|
|
|
*
|
|
|
|
* @return should process netty errors
|
|
|
|
*/
|
2020-11-21 19:09:03 +01:00
|
|
|
public static boolean shouldProcessNettyErrors() {
|
2020-11-19 02:28:56 +01:00
|
|
|
return processNettyErrors;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets if the server should process netty errors and other unnecessary netty events
|
|
|
|
* false is faster
|
|
|
|
*
|
|
|
|
* @param processNettyErrors should process netty errors
|
|
|
|
*/
|
|
|
|
public static void setShouldProcessNettyErrors(boolean processNettyErrors) {
|
|
|
|
MinecraftServer.processNettyErrors = processNettyErrors;
|
|
|
|
}
|
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Starts the server.
|
2020-11-07 04:42:48 +01:00
|
|
|
* <p>
|
|
|
|
* It should be called after {@link #init()} and probably your own initialization code.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @param address the server address
|
|
|
|
* @param port the server port
|
|
|
|
* @param responseDataConsumer the response data consumer, can be null
|
2020-11-07 04:42:48 +01:00
|
|
|
* @throws IllegalStateException if called before {@link #init()} or if the server is already running
|
2020-08-15 13:32:36 +02:00
|
|
|
*/
|
2020-11-09 23:48:34 +01:00
|
|
|
public void start(@NotNull String address, int port, @Nullable ResponseDataConsumer responseDataConsumer) {
|
2020-10-26 15:15:56 +01:00
|
|
|
Check.stateCondition(!initialized, "#start can only be called after #init");
|
|
|
|
Check.stateCondition(started, "The server is already started");
|
|
|
|
|
2020-11-29 17:49:02 +01:00
|
|
|
MinecraftServer.started = true;
|
|
|
|
|
2020-05-10 16:02:49 +02:00
|
|
|
LOGGER.info("Starting Minestom server.");
|
2020-04-28 02:33:15 +02:00
|
|
|
MinecraftServer.responseDataConsumer = responseDataConsumer;
|
2020-11-29 17:49:02 +01:00
|
|
|
|
2020-04-17 01:16:02 +02:00
|
|
|
updateManager.start();
|
2020-11-29 17:49:02 +01:00
|
|
|
|
|
|
|
// Init & start the TCP server
|
|
|
|
nettyServer.init();
|
2020-04-17 01:16:02 +02:00
|
|
|
nettyServer.start(address, port);
|
2020-11-29 17:49:02 +01:00
|
|
|
|
|
|
|
final long t1 = -System.nanoTime();
|
2020-08-18 14:18:12 +02:00
|
|
|
// Init extensions
|
|
|
|
// TODO: Extensions should handle depending on each other and have a load-order.
|
|
|
|
extensionManager.getExtensions().forEach(Extension::preInitialize);
|
|
|
|
extensionManager.getExtensions().forEach(Extension::initialize);
|
|
|
|
extensionManager.getExtensions().forEach(Extension::postInitialize);
|
|
|
|
|
2020-11-04 18:27:18 +01:00
|
|
|
final double loadTime = MathUtils.round((t1 + System.nanoTime()) / 1_000_000D, 2);
|
|
|
|
LOGGER.info("Extensions loaded in " + loadTime + "ms");
|
2020-11-29 17:49:02 +01:00
|
|
|
|
2020-05-10 16:02:49 +02:00
|
|
|
LOGGER.info("Minestom server started successfully.");
|
2019-08-10 04:47:19 +02:00
|
|
|
}
|
2019-08-10 08:44:35 +02:00
|
|
|
|
2020-08-15 13:32:36 +02:00
|
|
|
/**
|
2020-10-15 21:16:31 +02:00
|
|
|
* Starts the server.
|
2020-08-15 13:32:36 +02:00
|
|
|
*
|
|
|
|
* @param address the server address
|
|
|
|
* @param port the server port
|
2020-11-07 04:42:48 +01:00
|
|
|
* @see #start(String, int, ResponseDataConsumer)
|
2020-08-15 13:32:36 +02:00
|
|
|
*/
|
2020-11-09 23:48:34 +01:00
|
|
|
public void start(@NotNull String address, int port) {
|
2020-05-10 19:39:25 +02:00
|
|
|
start(address, port, null);
|
|
|
|
}
|
|
|
|
|
2020-04-28 19:22:54 +02:00
|
|
|
/**
|
|
|
|
* Stops this server properly (saves if needed, kicking players, etc.)
|
|
|
|
*/
|
|
|
|
public static void stopCleanly() {
|
2020-05-10 16:02:49 +02:00
|
|
|
LOGGER.info("Stopping Minestom server.");
|
2020-04-28 19:22:54 +02:00
|
|
|
updateManager.stop();
|
|
|
|
schedulerManager.shutdown();
|
2020-12-02 20:55:05 +01:00
|
|
|
nettyServer.stop();
|
2020-08-31 00:41:19 +02:00
|
|
|
storageManager.getLoadedLocations().forEach(StorageLocation::close);
|
2020-07-01 21:03:53 +02:00
|
|
|
LOGGER.info("Shutting down all thread pools.");
|
|
|
|
benchmarkManager.disable();
|
|
|
|
commandManager.stopConsoleThread();
|
2020-11-20 11:14:15 +01:00
|
|
|
TemporaryCache.REMOVER_SERVICE.shutdown();
|
2020-07-01 22:17:35 +02:00
|
|
|
MinestomThread.shutdownAll();
|
2020-05-10 16:02:49 +02:00
|
|
|
LOGGER.info("Minestom server stopped successfully.");
|
2020-04-28 19:22:54 +02:00
|
|
|
}
|
|
|
|
|
2020-10-26 15:15:56 +01:00
|
|
|
private static void checkInitStatus(@Nullable Object object) {
|
2020-10-28 13:19:34 +01:00
|
|
|
/*Check.stateCondition(Objects.isNull(object),
|
2020-10-26 15:15:56 +01:00
|
|
|
"You cannot access the manager before MinecraftServer#init, " +
|
2020-10-28 13:19:34 +01:00
|
|
|
"if you are developing an extension be sure to retrieve them at least after Extension#preInitialize");*/
|
2020-10-26 15:15:56 +01:00
|
|
|
}
|
|
|
|
|
2019-08-03 15:25:24 +02:00
|
|
|
}
|