geforkt von Mirrors/FastAsyncWorldEdit
Renamed SMWorldEdit to WorldEdit to prevent confusion.
Dieser Commit ist enthalten in:
Ursprung
8670ef7554
Commit
28f76f869c
@ -1,6 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* WorldEditLibrary
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -96,7 +96,7 @@ public class EditSession {
|
||||
* Default constructor. There is no maximum blocks limit.
|
||||
*/
|
||||
public EditSession() {
|
||||
server = WorldEdit.getServer();
|
||||
server = WorldEditLibrary.getServer();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +108,7 @@ public class EditSession {
|
||||
}
|
||||
this.maxBlocks = maxBlocks;
|
||||
|
||||
server = WorldEdit.getServer();
|
||||
server = WorldEditLibrary.getServer();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@ import java.util.HashMap;
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class SMServerInterface implements ServerInterface {
|
||||
public class HmodServerInterface implements ServerInterface {
|
||||
/**
|
||||
* Set block type.
|
||||
*
|
@ -1,6 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* WorldEditLibrary
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -24,15 +24,15 @@ import com.sk89q.worldedit.*;
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class SMWorldEditListener extends PluginListener {
|
||||
public class HmodWorldEditListener extends PluginListener {
|
||||
/**
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
@Override
|
||||
public void onDisconnect(Player player) {
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
worldEdit.removeSession(new SMWorldEditPlayer(player));
|
||||
WorldEditLibrary worldEdit = WorldEditLibrary.getInstance();
|
||||
worldEdit.removeSession(new HmodWorldEditPlayer(player));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,8 +47,8 @@ public class SMWorldEditListener extends PluginListener {
|
||||
@Override
|
||||
public boolean onBlockCreate(Player modPlayer, Block blockPlaced,
|
||||
Block blockClicked, int itemInHand) {
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
WorldEditPlayer player = new SMWorldEditPlayer(modPlayer);
|
||||
WorldEditLibrary worldEdit = WorldEditLibrary.getInstance();
|
||||
WorldEditPlayer player = new HmodWorldEditPlayer(modPlayer);
|
||||
|
||||
if (itemInHand != 271) { return false; }
|
||||
if (!canUseCommand(modPlayer, "//pos2")) { return false; }
|
||||
@ -82,8 +82,8 @@ public class SMWorldEditListener extends PluginListener {
|
||||
if (!canUseCommand(modPlayer, "//pos1")
|
||||
&& !canUseCommand(modPlayer, "//")) { return false; }
|
||||
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
WorldEditPlayer player = new SMWorldEditPlayer(modPlayer);
|
||||
WorldEditLibrary worldEdit = WorldEditLibrary.getInstance();
|
||||
WorldEditPlayer player = new HmodWorldEditPlayer(modPlayer);
|
||||
WorldEditSession session = worldEdit.getSession(player);
|
||||
|
||||
if (player.getItemInHand() == 271) {
|
||||
@ -114,12 +114,12 @@ public class SMWorldEditListener extends PluginListener {
|
||||
if (session.hasSuperPickAxe()) {
|
||||
Vector pos = new Vector(blockClicked.getX(),
|
||||
blockClicked.getY(), blockClicked.getZ());
|
||||
if (WorldEdit.getServer().getBlockType(pos) == 7
|
||||
if (WorldEditLibrary.getServer().getBlockType(pos) == 7
|
||||
&& !canUseCommand(modPlayer, "/worldeditbedrock")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
WorldEdit.getServer().setBlockType(pos, 0);
|
||||
WorldEditLibrary.getServer().setBlockType(pos, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -136,7 +136,7 @@ public class SMWorldEditListener extends PluginListener {
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(Player modPlayer, String[] split) {
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
WorldEditLibrary worldEdit = WorldEditLibrary.getInstance();
|
||||
|
||||
try {
|
||||
// Legacy /, command
|
||||
@ -146,7 +146,7 @@ public class SMWorldEditListener extends PluginListener {
|
||||
|
||||
if (worldEdit.getCommands().containsKey(split[0].toLowerCase())) {
|
||||
if (canUseCommand(modPlayer, split[0])) {
|
||||
WorldEditPlayer player = new SMWorldEditPlayer(modPlayer);
|
||||
WorldEditPlayer player = new HmodWorldEditPlayer(modPlayer);
|
||||
WorldEditSession session = worldEdit.getSession(player);
|
||||
EditSession editSession =
|
||||
new EditSession(session.getBlockChangeLimit());
|
@ -24,7 +24,7 @@ import com.sk89q.worldedit.ServerInterface;
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class SMWorldEditPlayer extends WorldEditPlayer {
|
||||
public class HmodWorldEditPlayer extends WorldEditPlayer {
|
||||
private Player player;
|
||||
|
||||
/**
|
||||
@ -32,7 +32,7 @@ public class SMWorldEditPlayer extends WorldEditPlayer {
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public SMWorldEditPlayer(Player player) {
|
||||
public HmodWorldEditPlayer(Player player) {
|
||||
super();
|
||||
this.player = player;
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
// $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/>.
|
||||
*/
|
||||
|
||||
import com.sk89q.worldedit.snapshots.SnapshotRepository;
|
||||
import java.util.Map;
|
||||
import java.util.HashSet;
|
||||
import com.sk89q.worldedit.ServerInterface;
|
||||
|
||||
/**
|
||||
* Entry point for the plugin for hey0's mod.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class SMWorldEdit extends Plugin {
|
||||
/**
|
||||
* WorldEdit's properties file.
|
||||
*/
|
||||
private PropertiesFile properties;
|
||||
/**
|
||||
* WorldEdit instance.
|
||||
*/
|
||||
private static final WorldEdit worldEdit =
|
||||
WorldEdit.setup(new SMServerInterface());
|
||||
/**
|
||||
* Listener for the plugin system.
|
||||
*/
|
||||
private static final SMWorldEditListener listener =
|
||||
new SMWorldEditListener();
|
||||
|
||||
/**
|
||||
* Initializes the plugin.
|
||||
*/
|
||||
@Override
|
||||
public void initialize() {
|
||||
PluginLoader loader = etc.getLoader();
|
||||
|
||||
loader.addListener(PluginLoader.Hook.BLOCK_CREATED, listener, this,
|
||||
PluginListener.Priority.MEDIUM);
|
||||
loader.addListener(PluginLoader.Hook.BLOCK_DESTROYED, listener, this,
|
||||
PluginListener.Priority.MEDIUM);
|
||||
loader.addListener(PluginLoader.Hook.COMMAND, listener, this,
|
||||
PluginListener.Priority.MEDIUM);
|
||||
loader.addListener(PluginLoader.Hook.DISCONNECT, listener, this,
|
||||
PluginListener.Priority.MEDIUM);
|
||||
loader.addListener(PluginLoader.Hook.LOGIN, listener, this,
|
||||
PluginListener.Priority.MEDIUM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the plugin.
|
||||
*/
|
||||
@Override
|
||||
public void enable() {
|
||||
if (properties == null) {
|
||||
properties = new PropertiesFile("worldedit.properties");
|
||||
} else {
|
||||
properties.load();
|
||||
}
|
||||
|
||||
// Get allowed blocks
|
||||
HashSet<Integer> allowedBlocks = new HashSet<Integer>();
|
||||
for (String b : properties.getString("allowed-blocks",
|
||||
WorldEdit.getDefaultAllowedBlocks()).split(",")) {
|
||||
try {
|
||||
allowedBlocks.add(Integer.parseInt(b));
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
worldEdit.setAllowedBlocks(allowedBlocks);
|
||||
|
||||
worldEdit.setDefaultChangeLimit(
|
||||
Math.max(-1, properties.getInt("max-blocks-changed", -1)));
|
||||
|
||||
String snapshotsDir = properties.getString("snapshots-dir", "");
|
||||
if (!snapshotsDir.trim().equals("")) {
|
||||
worldEdit.setSnapshotRepository(new SnapshotRepository(snapshotsDir));
|
||||
}
|
||||
|
||||
String shellSaveType = properties.getString("shell-save-type", "").trim();
|
||||
worldEdit.setShellSaveType(shellSaveType.equals("") ? null : shellSaveType);
|
||||
|
||||
for (Map.Entry<String,String> entry : worldEdit.getCommands().entrySet()) {
|
||||
etc.getInstance().addCommand(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the plugin.
|
||||
*/
|
||||
@Override
|
||||
public void disable() {
|
||||
for (String key : worldEdit.getCommands().keySet()) {
|
||||
etc.getInstance().removeCommand(key);
|
||||
}
|
||||
|
||||
worldEdit.clearSessions();
|
||||
}
|
||||
}
|
1255
src/WorldEdit.java
1255
src/WorldEdit.java
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
1249
src/WorldEditLibrary.java
Normale Datei
1249
src/WorldEditLibrary.java
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1,6 +1,6 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* WorldEditLibrary
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -35,7 +35,7 @@ public abstract class WorldEditPlayer {
|
||||
* Construct the player.
|
||||
*/
|
||||
public WorldEditPlayer() {
|
||||
server = WorldEdit.getServer();
|
||||
server = WorldEditLibrary.getServer();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,14 +107,14 @@ public abstract class WorldEditPlayer {
|
||||
public abstract String getCardinalDirection();
|
||||
|
||||
/**
|
||||
* Print a WorldEdit message.
|
||||
* Print a WorldEditLibrary message.
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public abstract void print(String msg);
|
||||
|
||||
/**
|
||||
* Print a WorldEdit error.
|
||||
* Print a WorldEditLibrary error.
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren