[Solved] Problem with WorldCreationSettings and its Staticness

Sponge:3.0.0 Snapshot
Forge:Haven’t tested yet/project wont complile yet
Java Version: J2SE-1.5 (Java SE 8 [1.8.0_65])
Plugin Source: The File In Question

Hey Guys,
So I’ve been chatting with the lovely folks on the IRC Chat, and no one seems to be able to solve this problem I’ve been running into.

I’m trying to add custom WorldGenModifiers to a world, then force build it on the GamePreInitEvent as per the example in the CookBooks (which I actually compiled in Eclipse as a separate project for quick reference :smiley: )

Well, there’s this annoying error which pops up thats preventing me from even testing out my project. Lines 90 and 91 both give me the error “This static method of interface WorldCreationSettings can only be accessed as WorldCreationSettings.builder.”

I’m betting it has something to do with the use of the final keyword, but I’ve no idea how to fix this.

Thoughts?

A couple issues:

  1. You’re trying to create worlds before the server has started (during GamePreInitializationEvent). Use GameStartingServerEvent or GameStartedServerEvent instead. (See the comment in lines 77-81.)
  2. Line 91 automatically creates and loads the world. You don’t need to have createAndLoadWorld.
  3. Once you’ve fixed #2, you no longer need line 90.
  4. How do you still have Java 5.0 installed? It’s been unsupported for 6 years…
    Anyways, Sponge requires Java 8, which added support for static methods in interfaces; make sure your compiler is set to it (or the experimental JDK 9).
1 Like

Well that fixed it.
Note to self: learn what all the serial numbers in the Java versions mean. I’ve no idea why Eclipse defaults to Java 5.0 o-o.