Java Reference
In-Depth Information
This plugin will listen for events to keep track of where you've been, and let
you return to previous locations in order.
package backcmd;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Stack;
import net.canarymod.plugin.Plugin;
import net.canarymod.logger.Logman;
import net.canarymod.Canary;
import net.canarymod.commandsys.*;
import net.canarymod.hook.HookHandler;
import net.canarymod.hook.player.TeleportHook;
import net.canarymod.plugin.PluginListener;
import com.pragprog.ahmine.ez.EZPlugin;
public class BackCmd extends EZPlugin implements PluginListener {
private static List <Player> isTeleporting = new ArrayList <Player>();
private static HashMap < String , Stack <Location>> playerTeleports =
new HashMap < String , Stack <Location>>();
public boolean enable() {
Canary.hooks().registerListener(this, this);
return super.enable(); // Call parent class's version too.
public boolean equalsIsh(Location loc1, Location loc2) {
return (( int ) loc1.getX()) == (( int ) loc2.getX()) &&
(( int ) loc1.getZ()) == (( int ) loc2.getZ());
public void onTeleport(TeleportHook event) {
Player player = event.getPlayer();
if (isTeleporting.contains(player)) {
} else {
Stack <Location> locs = playerTeleports.get(player.getName());
if (locs == null) {
locs = new Stack <Location>();
Search WWH ::

Custom Search