Added class to access WorldEdit from other plugins.

This commit is contained in:
sk89q 2010-11-05 17:54:18 -07:00
parent 138787c1e2
commit 97a49d4492
3 changed files with 57 additions and 0 deletions

View File

@ -96,4 +96,13 @@ public class WorldEdit extends Plugin {
return "(unknown)";
}
}
/**
* Returns the listener.
*
* @return
*/
public WorldEditListener getListener() {
return listener;
}
}

View File

@ -1371,4 +1371,23 @@ public class WorldEditListener extends PluginListener {
etc.getInstance().removeCommand(key);
}
}
/**
* Gets the WorldEditLibrary session for a player. Used for the bridge.
*
* @param player
* @return
*/
public WorldEditSession _bridgeSession(Player pl) {
WorldEditPlayer player = new WorldEditPlayer(pl);
if (sessions.containsKey(player)) {
return sessions.get(player);
} else {
WorldEditSession session = new WorldEditSession();
session.setBlockChangeLimit(defaultChangeLimit);
sessions.put(player, session);
return session;
}
}
}

View File

@ -0,0 +1,29 @@
// $Id$
/*
* WorldEdit
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit;
/**
* Raised when WorldEdit is not installed.
*
* @author Albert
*/
public class WorldEditNotInstalled extends WorldEditException {
}