Cleaned up some code, changed WorldEdit to be world-aware (finally).

This commit is contained in:
sk89q
2011-01-01 10:33:18 -08:00
parent 6d172891e2
commit ac4e6e8ddf
12 changed files with 783 additions and 442 deletions

View File

@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
import java.util.logging.Level;
import java.util.logging.Logger;
@ -31,22 +31,28 @@ public class WorldEdit extends Plugin {
/**
* Logger.
*/
private static final Logger logger = Logger.getLogger("Minecraft.WorldEdit");
/**
* WorldEditLibrary instance.
*/
private static HMWorldEditListener listener;
private static final Logger logger = Logger
.getLogger("Minecraft.WorldEdit");
/**
* WorldEdit version, fetched from the .jar's manifest. Used to print the
* WorldEdit version in various places.
* The event listener for WorldEdit an hMod. Configuration and such is
* also loaded here as well, although the core of the WorldEdit is
* actually in com.sk89q.worldedit.WorldEditController and is merely
* loaded by this listener.
*/
private final HMWorldEditListener listener;
/**
* WorldEdit version, fetched from the .jar's manifest.
*/
private String version;
public WorldEdit() {
ServerInterface.setup(new HMServerInterface());
listener = new HMWorldEditListener();
}
/**
* Construct an instance of the plugin.
*/
public WorldEdit() {
listener = new HMWorldEditListener(new HMServerInterface());
}
/**
* Initializes the plugin.
@ -91,25 +97,25 @@ public class WorldEdit extends Plugin {
/**
* Get the CraftBook version.
*
*
* @return
*/
public String getVersion() {
if (version != null) {
return version;
}
Package p = WorldEdit.class.getPackage();
if (p == null) {
p = Package.getPackage("com.sk89q.worldedit");
}
if (p == null) {
version = "(unknown)";
} else {
version = p.getImplementationVersion();
if (version == null) {
version = "(unknown)";
}
@ -117,13 +123,4 @@ public class WorldEdit extends Plugin {
return version;
}
/**
* Returns the listener.
*
* @return
*/
public HMWorldEditListener getListener() {
return listener;
}
}