Java Reference
In-Depth Information
if (loc != null) {
isTeleporting.add(me);
me.teleportTo(loc);
} else {
me.chat( "You have not teleported yet." );
}
}
}
}
(I renamed the command to be “dback” so it would be different from the
existing BackCmd . You're welcome to rename it also, or just use it instead of
the old “back.”)
Now compile and install the whole mess with build.sh , and you're good to go.
Test It
Assuming everything worked, you should be able to test it:
1.
Start the server.
2.
Connect from your client.
3.
Teleport to a new place, either by using the /tp command or by throwing
an Ender Pearl. Do this a few times.
4.
Disconnect and shut down the server.
5.
Restart and reconnect.
6.
Now type the /back command in the client. Your history was saved and
reloaded from disk, and you should be able to go back to each teleport
point.
w00t.
Try This Yourself
You know what we need? A “clearback” command so that we can clear out
our teleport history (Canary already provides a “clear” command, so you need
to call it something other than that).
Go ahead and implement that. It's a new command, so you'll need a new
@Command section and function. In the code, all you need to do is to clear out
the stack for the player and save it back to the database.
 
 
Search WWH ::




Custom Search