2020-10-11 16:02:26 +02:00
|
|
|
package demo;
|
2020-02-17 17:33:53 +01:00
|
|
|
|
2020-10-11 16:02:26 +02:00
|
|
|
import demo.blocks.BurningTorchBlock;
|
2020-12-14 05:43:10 +01:00
|
|
|
import demo.blocks.CustomBlockSample;
|
2020-10-11 16:02:26 +02:00
|
|
|
import demo.blocks.UpdatableBlockDemo;
|
2020-11-12 03:09:36 +01:00
|
|
|
import demo.commands.*;
|
2021-03-25 14:20:58 +01:00
|
|
|
import net.kyori.adventure.text.Component;
|
|
|
|
import net.kyori.adventure.text.format.NamedTextColor;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.MinecraftServer;
|
|
|
|
import net.minestom.server.command.CommandManager;
|
2020-11-14 04:09:38 +01:00
|
|
|
import net.minestom.server.extras.optifine.OptifineSupport;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.instance.block.BlockManager;
|
|
|
|
import net.minestom.server.instance.block.rule.vanilla.RedstonePlacementRule;
|
2020-05-04 18:15:29 +02:00
|
|
|
import net.minestom.server.storage.StorageManager;
|
|
|
|
import net.minestom.server.storage.systems.FileStorageSystem;
|
2020-04-24 03:25:58 +02:00
|
|
|
import net.minestom.server.utils.time.TimeUnit;
|
|
|
|
import net.minestom.server.utils.time.UpdateOption;
|
2020-04-01 13:16:18 +02:00
|
|
|
|
2020-02-17 17:33:53 +01:00
|
|
|
|
|
|
|
public class Main {
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
MinecraftServer minecraftServer = MinecraftServer.init();
|
|
|
|
|
2020-12-06 20:20:05 +01:00
|
|
|
// MinecraftServer.setShouldProcessNettyErrors(true);
|
2020-11-18 19:39:06 +01:00
|
|
|
|
2020-02-17 17:33:53 +01:00
|
|
|
BlockManager blockManager = MinecraftServer.getBlockManager();
|
2020-12-14 05:43:10 +01:00
|
|
|
blockManager.registerCustomBlock(new CustomBlockSample());
|
2020-04-01 13:16:18 +02:00
|
|
|
blockManager.registerCustomBlock(new UpdatableBlockDemo());
|
2020-05-05 15:55:21 +02:00
|
|
|
blockManager.registerCustomBlock(new BurningTorchBlock());
|
2020-04-01 13:16:18 +02:00
|
|
|
|
2020-04-12 10:24:25 +02:00
|
|
|
blockManager.registerBlockPlacementRule(new RedstonePlacementRule());
|
|
|
|
|
2020-04-01 13:16:18 +02:00
|
|
|
CommandManager commandManager = MinecraftServer.getCommandManager();
|
2020-07-14 13:35:07 +02:00
|
|
|
commandManager.register(new TestCommand());
|
2021-03-11 00:11:29 +01:00
|
|
|
commandManager.register(new GamemodeCommand());
|
2020-11-12 03:09:36 +01:00
|
|
|
commandManager.register(new EntitySelectorCommand());
|
2020-11-02 02:53:12 +01:00
|
|
|
commandManager.register(new HealthCommand());
|
2021-03-11 03:31:25 +01:00
|
|
|
commandManager.register(new LegacyCommand());
|
2020-07-24 01:03:24 +02:00
|
|
|
commandManager.register(new DimensionCommand());
|
2020-07-29 05:03:07 +02:00
|
|
|
commandManager.register(new ShutdownCommand());
|
2020-11-12 03:09:36 +01:00
|
|
|
commandManager.register(new TeleportCommand());
|
2020-11-18 19:39:06 +01:00
|
|
|
commandManager.register(new PlayersCommand());
|
2020-12-31 00:12:03 +01:00
|
|
|
commandManager.register(new PotionCommand());
|
2020-12-31 19:50:26 +01:00
|
|
|
commandManager.register(new TitleCommand());
|
2021-01-09 03:40:22 +01:00
|
|
|
commandManager.register(new BookCommand());
|
2021-02-22 12:42:46 +01:00
|
|
|
commandManager.register(new ShootCommand());
|
2021-03-11 00:11:29 +01:00
|
|
|
commandManager.register(new HorseCommand());
|
2021-03-25 14:20:58 +01:00
|
|
|
commandManager.register(new EchoCommand());
|
2021-03-26 21:32:58 +01:00
|
|
|
commandManager.register(new SummonCommand());
|
|
|
|
commandManager.register(new RemoveCommand());
|
2020-04-01 13:16:18 +02:00
|
|
|
|
2021-03-25 14:20:58 +01:00
|
|
|
commandManager.setUnknownCommandCallback((sender, command) -> sender.sendMessage(Component.text("Unknown command", NamedTextColor.RED)));
|
2020-11-02 04:13:43 +01:00
|
|
|
|
2020-08-21 01:32:59 +02:00
|
|
|
|
2020-05-04 18:15:29 +02:00
|
|
|
StorageManager storageManager = MinecraftServer.getStorageManager();
|
2020-05-06 22:35:32 +02:00
|
|
|
storageManager.defineDefaultStorageSystem(FileStorageSystem::new);
|
2020-05-04 18:15:29 +02:00
|
|
|
|
2020-04-17 21:34:01 +02:00
|
|
|
MinecraftServer.getBenchmarkManager().enable(new UpdateOption(10 * 1000, TimeUnit.MILLISECOND));
|
2020-02-17 17:33:53 +01:00
|
|
|
|
2020-07-31 20:44:58 +02:00
|
|
|
MinecraftServer.getSchedulerManager().buildShutdownTask(() -> System.out.println("Good night")).schedule();
|
2020-04-28 19:22:54 +02:00
|
|
|
|
2020-03-20 19:50:22 +01:00
|
|
|
PlayerInit.init();
|
|
|
|
|
2020-11-14 04:09:38 +01:00
|
|
|
OptifineSupport.enable();
|
|
|
|
|
2020-11-14 23:18:52 +01:00
|
|
|
//VelocityProxy.enable("rBeJJ79W4MVU");
|
2020-11-15 08:03:33 +01:00
|
|
|
//BungeeCordProxy.enable();
|
2020-11-09 23:48:34 +01:00
|
|
|
|
2020-11-16 17:02:40 +01:00
|
|
|
//MojangAuth.init();
|
2020-06-22 00:57:53 +02:00
|
|
|
|
2020-08-11 01:41:14 +02:00
|
|
|
minecraftServer.start("0.0.0.0", 25565, PlayerInit.getResponseDataConsumer());
|
2020-12-06 20:20:05 +01:00
|
|
|
//Runtime.getRuntime().addShutdownHook(new Thread(MinecraftServer::stopCleanly));
|
2020-02-17 17:33:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|