Problems with server starting after Sponge Update

Hey guys,

had no time for developing my plugins for about 14 days.
I tried to start my dev server with the actual version and BAM … problems with the starting handler.

What happened there?

[21:12:28] [Server thread/ERROR] [Sponge]: [Plugin Class: me.kaiserslin.rawr.Rawr][Handler: onServerStart]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
at org.spongepowered.mod.plugin.SpongeModPluginContainer.handleModStateEvent(SpongeModPluginContainer.java:127) [SpongeModPluginContainer.class:1.8-1515-2.1DEV-686+spongeproject-ci-b686.git-a7538fcfe7b64fcd1ec72abf4264f433e6d4ef3a]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) [minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) [LoadController.class:?]
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190) [LoadController.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [minecraft_server.1.8.jar:?]
at com.google.common.eventbus.EventBus.post(EventBus.java:275) [minecraft_server.1.8.jar:?]
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?]
at net.minecraftforge.fml.common.Loader.serverStarting(Loader.java:781) [Loader.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:319) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:286) [po.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_60]
Caused by: java.lang.NoSuchMethodError: org.spongepowered.api.service.command.CommandService.register(Ljava/lang/Object;Lorg/spongepowered/api/util/command/CommandCallable;[Ljava/lang/String;)Lcom/google/common/base/Optional;
at me.kaiserslin.rawr.Rawr.onServerStart(Rawr.java:39) ~[Rawr.class:?]
… 31 more

Code:

public void onServerStart(GameStartedServerEvent event) {

Java 8 problems?

The return type is java.util.Optional not com.google.common.base.Optional since the recent SpongeAPI update to Java 8

2 Likes

So there is no Optional, Optional etc object anymore?

Optional<Entity> optional = extent.createEntity(EntityTypes.SKELETON, location.getPosition());

There is, it’s just not the same type.

Sponge recently made the push to update to Java 8, wherein an Optional object already exists. However, because the new Optional object being used belongs to java.util.Optional and not com.google.common.base.Optional, any parts making use of the latter needs to be changed over to the former.

1 Like