Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Plugin(id = "esiniacore", name = "Esinia Core", version = "1.0")
- public class Esinia {
- @Inject
- @DefaultConfig(sharedRoot = true)
- private ConfigurationNode root;
- @Inject
- @DefaultConfig(sharedRoot = true)
- private Path defaultConfig;
- @Inject
- @DefaultConfig(sharedRoot = true)
- ConfigurationLoader<CommentedConfigurationNode> configManager;
- @Inject
- @ConfigDir(sharedRoot = false)
- private Path privateConfigDir;
- @Inject
- Game game;
- @Inject
- private Logger logger;
- public Logger getLogger(){
- return logger;
- }
- @Listener
- public void onServerStart(GameStartedServerEvent event) {
- if (!Files.exists(defaultConfig)) {
- try {
- Files.createFile(defaultConfig);
- } catch (IOException e) {
- e.printStackTrace();
- }
- try {
- root = configManager.load();
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- }
- this.getLogger().info("Loading...");
- CommandSpec esiniaCommandSpec = CommandSpec.builder()
- .description(Text.of("Says different things based on the source"))
- .executor(new EsiniaCoreExecutor())
- .build();
- CommandSpec esiniaItemTyperCommandSpec = CommandSpec.builder()
- .description(Text.of("Says the item type of held item"))
- .executor(new EsiniaCoreItemTyper())
- .build();
- CommandSpec esiniaitemnamerCommandSpec = CommandSpec.builder()
- .description(Text.of("Changes the name of player's held item."))
- .arguments(
- GenericArguments.catalogedElement(Text.of("color"), CatalogTypes.TEXT_COLOR),
- GenericArguments.remainingJoinedStrings(Text.of("name")))
- .executor(new EsiniaCoreItemNamer())
- .build();
- CommandSpec esinialorenamerCommandSpec = CommandSpec.builder()
- .description(Text.of("Changes the lore of player's held item."))
- .arguments(
- GenericArguments.allOf(GenericArguments.string(Text.of("lore"))))
- .executor(new EsiniaCoreLoreNamer())
- .build();
- //Commands
- Sponge.getCommandManager().register(this, esiniaCommandSpec, Lists.newArrayList("Esinia"));
- Sponge.getCommandManager().register(this, esiniaItemTyperCommandSpec, Lists.newArrayList("ItemTyper"));
- Sponge.getCommandManager().register(this, esiniaitemnamerCommandSpec, Lists.newArrayList("ItemNamer"));
- Sponge.getCommandManager().register(this, esinialorenamerCommandSpec, Lists.newArrayList("LoreNamer"));
- //Events
- game.getEventManager().registerListeners(this, new EventBlockBreak());
- game.getEventManager().registerListeners(this, new EventBlockPlace());
- game.getEventManager().registerListeners(this, new EventDecay());
- game.getEventManager().registerListeners(this, new EventItemDrop());
- game.getEventManager().registerListeners(this, new EventSpawnEntity());
- game.getEventManager().registerListeners(this, new EventRightClick());
- game.getEventManager().registerListeners(this, new EventInventoryClick());
- game.getEventManager().registerListeners(this, new EventInventoryOpen());
- //Anvils
- game.getEventManager().registerListeners(this, new AnvilStone());
- //Anvil Inventories
- game.getEventManager().registerListeners(this, new AnvilStoneInventory());
- //Crafting Tables
- game.getEventManager().registerListeners(this, new CraftingTablesRudimentary());
- //Crafting Table Inventories
- game.getEventManager().registerListeners(this, new CraftingTablesRudimentaryInventory());
- this.getLogger().info("Hello World");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement