org.spongepowered.api.event.game.state.GameInitializationEvent Java Examples

The following examples show how to use org.spongepowered.api.event.game.state.GameInitializationEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpongePlugin.java    From ViaVersion with MIT License 6 votes vote down vote up
@Listener
public void onGameStart(GameInitializationEvent event) {
    // Setup Logger
    logger = new LoggerWrapper(container.getLogger());
    // Setup Plugin
    conf = new SpongeViaConfig(container, spongeConfig.getParentFile());
    SpongeCommandHandler commandHandler = new SpongeCommandHandler();
    game.getCommandManager().register(this, commandHandler, "viaversion", "viaver", "vvsponge");
    logger.info("ViaVersion " + getPluginVersion() + " is now loaded!");

    // Init platform
    Via.init(ViaManager.builder()
            .platform(this)
            .commandHandler(commandHandler)
            .injector(new SpongeViaInjector())
            .loader(new SpongeViaLoader(this))
            .build());
}
 
Example #2
Source File: FlyModule.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    //Config
    config = new RawModuleConfig("fly");
    //Commands
    UltimateCore.get().getCommandService().register(new FlyCommand());
    UltimateCore.get().getCommandService().register(new FlyspeedCommand());
    UltimateCore.get().getCommandService().register(new WalkspeedCommand());
    UltimateCore.get().getCommandService().register(new SpeedCommand());

    //Listeners
    if (config.get().getNode("enable-autofly").getBoolean(false)) {
        Sponge.getEventManager().registerListeners(UltimateCore.get(), new FlyListeners());
    }
    //Register permissions
    new FlyPermissions();
}
 
Example #3
Source File: SpawnModule.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    config = new RawModuleConfig("spawn");

    UltimateCore.get().getCommandService().register(new DelfirstspawnCommand());
    UltimateCore.get().getCommandService().register(new DelglobalspawnCommand());
    UltimateCore.get().getCommandService().register(new DelgroupspawnCommand());
    UltimateCore.get().getCommandService().register(new SetfirstspawnCommand());
    UltimateCore.get().getCommandService().register(new SetglobalspawnCommand());
    UltimateCore.get().getCommandService().register(new SetgroupspawnCommand());
    UltimateCore.get().getCommandService().register(new GlobalspawnCommand());
    UltimateCore.get().getCommandService().register(new FirstspawnCommand());
    UltimateCore.get().getCommandService().register(new GroupspawnCommand());
    UltimateCore.get().getCommandService().register(new SpawnCommand());

    Sponge.getEventManager().registerListeners(UltimateCore.get(), new SpawnListener());

    //Register permissions
    new SpawnPermissions();
}
 
Example #4
Source File: AfkModule.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    //Config
    config = new RawModuleConfig("afk");
    //Commands
    UltimateCore.get().getCommandService().register(new AfkCommand());
    //Listeners
    Sponge.getEventManager().registerListeners(UltimateCore.get(), new AfkSwitchListener());
    AfkDetectionListener.start();
    //Runnables
    if (config.get().getNode("title", "enabled").getBoolean(true)) {
        Sponge.getScheduler().createTaskBuilder().intervalTicks(config.get().getNode("title", "subtitle-refresh").getLong()).name("UC afk title task").execute(new AfkTitleTask()).submit(UltimateCore.get());

    }
    //Register permissions
    new AfkPermissions();
}
 
Example #5
Source File: ChangeSkinSponge.java    From ChangeSkin with MIT License 6 votes vote down vote up
@Listener
public void onInit(GameInitializationEvent initEvent) {
    if (!initialized)
        return;

    CommandManager cmdManager = Sponge.getCommandManager();

    //command and event register
    cmdManager.register(this, injector.getInstance(SelectCommand.class).buildSpec(), "skin-select", "skinselect");
    cmdManager.register(this, injector.getInstance(InfoCommand.class).buildSpec(), "skin-info");
    cmdManager.register(this, injector.getInstance(UploadCommand.class).buildSpec(), "skin-upload");
    cmdManager.register(this, injector.getInstance(SetCommand.class).buildSpec(), "changeskin", "setskin", "skin");
    cmdManager.register(this, injector.getInstance(InvalidateCommand.class)
            .buildSpec(), "skininvalidate", "skin-invalidate");

    Sponge.getEventManager().registerListeners(this, injector.getInstance(LoginListener.class));

    //incoming channel
    ChannelRegistrar channelReg = Sponge.getChannelRegistrar();
    String updateChannelName = new NamespaceKey(ARTIFACT_ID, UPDATE_SKIN_CHANNEL).getCombinedName();
    String permissionChannelName = new NamespaceKey(ARTIFACT_ID, CHECK_PERM_CHANNEL).getCombinedName();
    RawDataChannel updateChannel = channelReg.getOrCreateRaw(this, updateChannelName);
    RawDataChannel permChannel = channelReg.getOrCreateRaw(this, permissionChannelName);
    updateChannel.addListener(Type.SERVER, injector.getInstance(UpdateSkinListener.class));
    permChannel.addListener(Type.SERVER, injector.getInstance(CheckPermissionListener.class));
}
 
Example #6
Source File: TeleportModule.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    Sponge.getEventManager().registerListeners(UltimateCore.get(), this);
    UltimateCore.get().getCommandService().registerLater(new TeleportCommand(), TeleportPermissions::new);
    UltimateCore.get().getCommandService().register(new TeleportaskCommand());
    UltimateCore.get().getCommandService().register(new TeleportaskhereCommand());
    UltimateCore.get().getCommandService().register(new TeleportacceptCommand());
    UltimateCore.get().getCommandService().register(new TeleportdenyCommand());
    UltimateCore.get().getCommandService().register(new TeleporthereCommand());
    UltimateCore.get().getCommandService().register(new TeleportallCommand());
    UltimateCore.get().getCommandService().register(new TeleportaskallhereCommand());

    UltimateCore.get().getCommandService().register(new RandomTeleportCommand());
    UltimateCore.get().getCommandService().register(new BiomeTeleportCommand());
    UltimateCore.get().getCommandService().register(new TopCommand());

    new TeleportPermissions();
}
 
Example #7
Source File: JailModule.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    this.config = new RawModuleConfig("jail");

    UltimateCore.get().getCommandService().register(new SetjailCommand());
    UltimateCore.get().getCommandService().register(new DeljailCommand());
    UltimateCore.get().getCommandService().register(new JaillistCommand());
    UltimateCore.get().getCommandService().register(new JailCommand());
    UltimateCore.get().getCommandService().register(new UnjailCommand());
    UltimateCore.get().getCommandService().register(new JailtpCommand());

    Sponge.getEventManager().registerListeners(UltimateCore.get(), new JailListener());
    UltimateCore.get().getTickService().addRunnable("jail", new JailTickRunnable());

    new JailPermissions();
}
 
Example #8
Source File: GodModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    UltimateCore.get().getCommandService().register(new GodCommand());
    Sponge.getEventManager().registerListeners(UltimateCore.get(), new GodListener());
    //Register permissions
    new GodPermissions();
}
 
Example #9
Source File: TimeModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    UltimateCore.get().getCommandService().register(new TimeCommand());
    UltimateCore.get().getCommandService().register(new DayCommand());
    UltimateCore.get().getCommandService().register(new NightCommand());
    //Register permissions
    new TimePermissions();
}
 
Example #10
Source File: PokeModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    //Config
    config = new RawModuleConfig("poke");
    //Listeners
    Sponge.getEventManager().registerListeners(UltimateCore.get(), new PokeListener());
}
 
Example #11
Source File: SpongePlugin.java    From ViaRewind with MIT License 5 votes vote down vote up
@Listener(order = Order.LATE)
public void onGameStart(GameInitializationEvent e) {
	// Setup Logger
	this.logger = new LoggerWrapper(loggerSlf4j);
	// Init!
	ViaRewindConfigImpl conf = new ViaRewindConfigImpl(configDir.resolve("config.yml").toFile());
	conf.reloadConfig();
	this.init(conf);
}
 
Example #12
Source File: PlayerinfoModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    this.config = new RawModuleConfig("playerinfo");

    UltimateCore.get().getCommandService().register(new PingCommand());
    UltimateCore.get().getCommandService().register(new UuidCommand());
    UltimateCore.get().getCommandService().register(new ListCommand());
}
 
Example #13
Source File: KitModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    this.config = new RawModuleConfig("kit");

    //Commands
    UltimateCore.get().getCommandService().register(new KitCommand());
    UltimateCore.get().getCommandService().register(new KitlistCommand());
    UltimateCore.get().getCommandService().register(new CreatekitCommand());
    UltimateCore.get().getCommandService().register(new RemovekitCommand());

    //Register permissions
    new KitPermissions();
}
 
Example #14
Source File: FlexibleLogin.java    From FlexibleLogin with MIT License 5 votes vote down vote up
@Listener //Commands register + events
public void onInit(GameInitializationEvent initEvent) {
    //register commands
    registerCommands();

    //register events
    eventManager.registerListeners(this, protectionManager);
    eventManager.registerListeners(this, injector.getInstance(ConnectionListener.class));
    eventManager.registerListeners(this, injector.getInstance(PreventListener.class));
    eventManager.registerListeners(this, injector.getInstance(ChatLoggerListener.class));
    if (pluginManager.isLoaded("GriefPrevention")) {
        eventManager.registerListeners(this, injector.getInstance(GriefPreventListener.class));
    }
}
 
Example #15
Source File: DeafModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    UltimateCore.get().getCommandService().register(new DeafCommand());
    UltimateCore.get().getCommandService().register(new UndeafCommand());
    Sponge.getEventManager().registerListeners(UltimateCore.get(), new DeafListener());
    UltimateCore.get().getTickService().addRunnable("deaf", new DeafTickRunnable());
    //Register permissions
    new DeafPermissions();
}
 
Example #16
Source File: TablistModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    config = new RawModuleConfig("tablist");
    int delay = config.get().getNode("refresh").getInt();
    runnable = new NamesHandler();
    Sponge.getScheduler().createTaskBuilder().execute(runnable::update).name("UltimateCore tablist task").delayTicks(delay).intervalTicks(delay).submit(UltimateCore.get());
    Sponge.getEventManager().registerListeners(UltimateCore.get(), new TablistListener());
}
 
Example #17
Source File: EssentialCmds.java    From EssentialCmds with MIT License 5 votes vote down vote up
@Listener
public void onServerInit(GameInitializationEvent event)
{
	getLogger().info(PluginInfo.NAME + " loading...");

	Utils.readMutes();
	Utils.readMail();
	Utils.startAFKService();

	// Register all commands.
	CommandLoader.registerCommands();

	getGame().getEventManager().registerListeners(this, new SignChangeListener());
	getGame().getEventManager().registerListeners(this, new PlayerJoinListener());
	getGame().getEventManager().registerListeners(this, new MessageSinkListener());
	getGame().getEventManager().registerListeners(this, new PlayerClickListener());
	getGame().getEventManager().registerListeners(this, new PlayerInteractListener());
	getGame().getEventManager().registerListeners(this, new PlayerMoveListener());
	getGame().getEventManager().registerListeners(this, new PlayerDeathListener());
	getGame().getEventManager().registerListeners(this, new TPAListener(this));
	getGame().getEventManager().registerListeners(this, new MailListener());
	getGame().getEventManager().registerListeners(this, new PlayerDisconnectListener());
	getGame().getEventManager().registerListeners(this, new WeatherChangeListener());
	getGame().getEventManager().registerListeners(this, new BlacklistListener());
	getGame().getEventManager().registerListeners(this, new CommandListener());
	getGame().getEventManager().registerListeners(this, new ChangeBlockListener());
	getGame().getEventManager().registerListeners(this, new PlayerDamageListener());
	getGame().getEventManager().registerListeners(this, new CommandSentListener());

	getLogger().info("-----------------------------");
	getLogger().info("EssentialCmds was made by HassanS6000!");
	getLogger().info("Please post all errors on the Sponge Thread or on GitHub!");
	getLogger().info("Have fun, and enjoy! :D");
	getLogger().info("-----------------------------");
	getLogger().info("EssentialCmds loaded!");
}
 
Example #18
Source File: AutomessageModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    //Config
    TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Automessage.class), new AutomessageSerializer());
    config = new RawModuleConfig("automessage");
    //Runnables
    try {
        for (Automessage message : config.get().getNode("automessages").getList(TypeToken.of(Automessage.class))) {
            message.start();
        }
    } catch (ObjectMappingException e) {
        ErrorLogger.log(e, "Failed to load automessages from config.");
    }
}
 
Example #19
Source File: KickModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    UltimateCore.get().getCommandService().register(new KickCommand());
    UltimateCore.get().getCommandService().register(new KickallCommand());
    //Register permissions
    new KickPermissions();
}
 
Example #20
Source File: WarpModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    //Commands
    UltimateCore.get().getCommandService().register(new WarpCommand());
    UltimateCore.get().getCommandService().register(new SetwarpCommand());
    UltimateCore.get().getCommandService().register(new DelwarpCommand());
    UltimateCore.get().getCommandService().register(new WarplistCommand());
    //Signs
    Optional<SignService> serv = UltimateCore.get().getSignService();
    if (serv.isPresent()) {
        serv.get().registerSign(new WarpSign());
    }
    //Register permissions
    new WarpPermissions();
}
 
Example #21
Source File: BlockprotectionModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
    public void onInit(GameInitializationEvent event) {
//        lockTypeRegistry.registerDefaults();
//        TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Protection.class), new Protection.ProtectionSerializer());
//        config = new RawModuleConfig("blockprotection");
//        onReload(null);
//
//        UltimateCore.get().getCommandService().register(new LockCommand());
    }
 
Example #22
Source File: WeatherModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    //Config
    config = new RawModuleConfig("weather");
    //Commands
    UltimateCore.get().getCommandService().register(new WeatherCommand());
    UltimateCore.get().getCommandService().register(new SunCommand());
    UltimateCore.get().getCommandService().register(new RainCommand());
    UltimateCore.get().getCommandService().register(new ThunderCommand());
    //Listeners
    Sponge.getEventManager().registerListeners(UltimateCore.get(), new WeatherListener());
    //Register permissions
    new WeatherPermissions();
}
 
Example #23
Source File: GamemodeModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    UltimateCore.get().getCommandService().register(new GamemodeCommand());
    UltimateCore.get().getCommandService().register(new SurvivalCommand());
    UltimateCore.get().getCommandService().register(new CreativeCommand());
    UltimateCore.get().getCommandService().register(new AdventureCommand());
    UltimateCore.get().getCommandService().register(new SpectatorCommand());
    //Register permissions
    new GamemodePermissions();
}
 
Example #24
Source File: HealModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    //commands
    UltimateCore.get().getCommandService().register(new HealCommand());
    UltimateCore.get().getCommandService().register(new SethealthCommand());
    UltimateCore.get().getCommandService().register(new SetmaxhealthCommand());
    //Register permissions
    new HealPermissions();
}
 
Example #25
Source File: MuteModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    UltimateCore.get().getCommandService().register(new MuteCommand());
    UltimateCore.get().getCommandService().register(new UnmuteCommand());
    Sponge.getEventManager().registerListeners(UltimateCore.get(), new MuteListener());
    UltimateCore.get().getTickService().addRunnable("mute", new MuteTickRunnable());
    //Register permissions
    new MutePermissions();
}
 
Example #26
Source File: InventoryModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    UltimateCore.get().getCommandService().register(new WorkbenchCommand());
    UltimateCore.get().getCommandService().register(new InvseeCommand());
    UltimateCore.get().getCommandService().registerLater(new ClearinventoryCommand(), () -> {
    });

    Sponge.getEventManager().registerListeners(UltimateCore.get(), new InventoryListener());
}
 
Example #27
Source File: BackModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    UltimateCore.get().getTeleportService().addHandler(new BackTeleportHandler());
    UltimateCore.get().getCommandService().register(new BackCommand());
    //Register permissions
    new BackPermissions();
}
 
Example #28
Source File: SpyModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    UltimateCore.get().getCommandService().register(new CommandspyCommand());
    UltimateCore.get().getCommandService().register(new MessagespyCommand());
    Sponge.getEventManager().registerListeners(UltimateCore.get(), new SpyListener());
    //Register permissions
    new SpyPermissions();
}
 
Example #29
Source File: PersonalmessageModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    UltimateCore.get().getCommandService().register(new PersonalmessageCommand());
    UltimateCore.get().getCommandService().register(new ReplyCommand());
    //Register permissions
    new PersonalmessagePermissions();
}
 
Example #30
Source File: GeoipModule.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public void onInit(GameInitializationEvent event) {
    config = new RawModuleConfig("geoip");
    GeoipHandler.init(true, false);
    UltimateCore.get().getVariableService().register(new GeoipVariable());

    UltimateCore.get().getCommandService().register(new CountryCommand());
}