Java Reference
In-Depth Information
Create a double (floating-point) variable named “dayOnIo” and set it to
152853.5047 . That's how many seconds a day lasts on Jupiter's moon, Io. 3
Create a string named myName and set it to your name.
Display each of these values by sending a chat message to the player, using string msg ) . For example, to display your name, type this: "My name is " + myName);
State each message with a string (like "My name is " ) and the plus sign. Then
add your variable. Don't forget the semicolon at the end of each statement.
Finally, add lines to play a sound effect at your location, using the float values
you just declared:
Location loc = me.getLocation();
playSound(loc, SoundEffect.Type.GHAST_SCREAM, volume, pitch);
Save the file and then run the in the Simple directory. (Make sure to
stop your server if you've left it running; some operating systems will throw
errors if you try to install fresh jars while the server is still running.)
$ cd Desktop
$ cd Simple
$ ./
Compiling with javac...
Creating jar file...
Deploying jar to /Users/andy/Desktop/server/plugins...
Completed Successfully.
Stop and restart your server, then connect from the Minecraft client. Run
your new command, /simple , and marvel at the messages on your console (and
the sound effect!).
Once that works, try changing the values for volume and pitch . Crank volume
up to 1.0f for a terrifying scream. For pitch, try a very low value, like 0.1f for
more of a growl, and higher ( 10.0f ?) for a piercing shriek.
After you type the new value in the Java source code, don't forget to take
these steps:
Save the file.
Compile and install with ./ .
Stop and restart the server.
Reconnect your Minecraft client.
Type /simple in the client and enjoy the display and sound effect.
Io is pretty cool. It has more than 400 active volcanoes. See .
Search WWH ::

Custom Search