Skip to content

Instantly share code, notes, and snippets.

@anna-is-cute
Last active August 9, 2016 00:16
Show Gist options
  • Save anna-is-cute/e749c309e82b0a6c4670faf08509c823 to your computer and use it in GitHub Desktop.
Save anna-is-cute/e749c309e82b0a6c4670faf08509c823 to your computer and use it in GitHub Desktop.
[18:45:32 INFO]: Starting minecraft server version 1.10.2
[18:45:32 INFO] [Sponge]: Loading Sponge...
[18:45:33 INFO] [Sponge]: Loading plugins...
[18:45:33 INFO] [Sponge]: Loaded plugin: spongejni 1.0.0-SNAPSHOT (from mods/spongejni-1.0.0-SNAPSHOT.jar)
[18:45:33 INFO] [Sponge]: Initializing plugins...
[18:45:33 INFO]: Loading properties
[18:45:33 INFO]: Default game type: SURVIVAL
[18:45:33 INFO]: Generating keypair
[18:45:33 INFO]: Starting Minecraft server on *:25565
[18:45:33 INFO]: Using default channel type
[18:45:33 INFO] [Sponge]: Successfully loaded and initialized plugins.
[18:45:33 INFO]: Preparing level "world"
[18:45:33 INFO] [Sponge]: Checking for worlds that need to be migrated...
[18:45:33 INFO] [Sponge]: No worlds were found in need of migration.
[18:45:34 INFO] [Sponge]: Loading world [world] (Overworld)
[18:45:34 INFO] [Sponge]: Loading world [DIM-1] (Nether)
[18:45:34 INFO] [Sponge]: Loading world [DIM1] (The End)
[18:45:34 INFO]: Preparing start region for level 0 (world)
[18:45:35 INFO]: Preparing spawn area: 35%
[18:45:35 INFO]: Preparing start region for level -1 (DIM-1)
[18:45:36 INFO]: Preparing start region for level 1 (DIM1)
> The max number of players is 20
Seed for default world is -5095462419283824123
[18:45:36 INFO]: Done (2.872s)! For help, type "help" or "?"
[18:45:36 INFO] [Sponge]: Timings Reset
#[allow(non_snake_case)]
#[no_mangle]
pub extern fn Java_me_kyleclemens_spongejni_SpongeJNIShim_jniShim(env: *mut JNIEnv, this: jobject, game: jobject) -> jboolean {
// check that game object passed to us by the shim isn't null
if game.is_null() {
// return false to shim if it is, indicating an error
return 0;
}
// wrap the game object in a rust struct
let game = generated_types::Game {
env: env,
object: game
};
// get the server
let server = game.get_server();
// print out the max number of players the server allows
println!("The max number of players is {}", server.get_max_players());
// match against Option<world_storage_WorldProperties>
let world = match server.get_default_world() {
// if there is a value
Some(world) => world,
// if there isn't a value
None => {
// print error message
println!("No default world!");
// return false to indicate an error
return 0;
}
};
// print out the default world's seed
println!("Seed for default world is {}", world.get_seed());
// return true to the shim, indicating success
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment