Minestom/src/test/java/demo/Main.java

77 lines
3.1 KiB
Java
Raw Normal View History

package demo;
2020-02-17 17:33:53 +01:00
import demo.blocks.BurningTorchBlock;
2020-12-14 05:43:10 +01:00
import demo.blocks.CustomBlockSample;
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;
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());
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();
commandManager.register(new TestCommand());
commandManager.register(new GamemodeCommand());
2020-11-12 03:09:36 +01:00
commandManager.register(new EntitySelectorCommand());
commandManager.register(new HealthCommand());
commandManager.register(new LegacyCommand());
2020-07-24 01:03:24 +02:00
commandManager.register(new DimensionCommand());
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());
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());
commandManager.register(new HorseCommand());
2021-03-25 14:20:58 +01:00
commandManager.register(new EchoCommand());
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
StorageManager storageManager = MinecraftServer.getStorageManager();
storageManager.defineDefaultStorageSystem(FileStorageSystem::new);
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
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");
//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
}
}