geforkt von Mirrors/FastAsyncWorldEdit
Added super pick axe and /..
Dieser Commit ist enthalten in:
Ursprung
598f4aa6cd
Commit
23b24b3615
@ -71,6 +71,7 @@ public class WorldEdit {
|
||||
commands.put("/editpos2", "Set editing position #2");
|
||||
commands.put("/editwand", "Gives you the \"edit wand\"");
|
||||
commands.put("/toggleeditwand", "Toggles edit wand selection");
|
||||
commands.put("/.", "Toggles super pick axe.");
|
||||
commands.put("/editundo", "Undo");
|
||||
commands.put("/editredo", "Redo");
|
||||
commands.put("/clearhistory", "Clear history");
|
||||
@ -259,6 +260,16 @@ public class WorldEdit {
|
||||
}
|
||||
return true;
|
||||
|
||||
// Toggle super pick axe
|
||||
} else if (split[0].equalsIgnoreCase("/.")) {
|
||||
checkArgs(split, 0, 0, split[0]);
|
||||
if (session.toggleSuperPickAxe()) {
|
||||
player.print("Super pick axe enabled.");
|
||||
} else {
|
||||
player.print("Super pick axe disabled.");
|
||||
}
|
||||
return true;
|
||||
|
||||
// Set max number of blocks to change at a time
|
||||
} else if (split[0].equalsIgnoreCase("/editlimit")) {
|
||||
checkArgs(split, 1, 1, split[0]);
|
||||
|
@ -98,6 +98,17 @@ public class WorldEditPlayer {
|
||||
return player.getItemInHand();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the player is holding a pick axe.
|
||||
*
|
||||
* @return whether a pick axe is held
|
||||
*/
|
||||
public boolean isHoldingPickAxe() {
|
||||
int item = getItemInHand();
|
||||
return item == 271 || item == 270 || item == 274 || item == 278
|
||||
|| item == 285;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the player's cardinal direction (N, W, NW, etc.).
|
||||
*
|
||||
|
@ -91,29 +91,35 @@ public class WorldEditSMListener extends PluginListener {
|
||||
*/
|
||||
@Override
|
||||
public boolean onBlockDestroy(Player modPlayer, Block blockClicked) {
|
||||
WorldEditPlayer player = new WorldEditPlayer(modPlayer);
|
||||
|
||||
if (player.getItemInHand() != 271) { return false; }
|
||||
if (!modPlayer.canUseCommand("/editpos1")) { return false; }
|
||||
if (!modPlayer.canUseCommand("/editpos1")
|
||||
&& !modPlayer.canUseCommand("/.")) { return false; }
|
||||
|
||||
WorldEditPlayer player = new WorldEditPlayer(modPlayer);
|
||||
WorldEditSession session = worldEdit.getSession(player);
|
||||
|
||||
if (session.isToolControlEnabled()) {
|
||||
Vector cur = Vector.toBlockPoint(blockClicked.getX(),
|
||||
blockClicked.getY(),
|
||||
blockClicked.getZ());
|
||||
|
||||
try {
|
||||
if (session.getPos1().equals(cur)) {
|
||||
return false;
|
||||
}
|
||||
} catch (IncompleteRegionException e) {
|
||||
if (player.isHoldingPickAxe()) {
|
||||
if (session.hasSuperPickAxe()) {
|
||||
return etc.getMCServer().e.d(blockClicked.getX(),
|
||||
blockClicked.getY(), blockClicked.getZ(), 0);
|
||||
}
|
||||
} else if (player.getItemInHand() == 271) {
|
||||
if (session.isToolControlEnabled()) {
|
||||
Vector cur = Vector.toBlockPoint(blockClicked.getX(),
|
||||
blockClicked.getY(),
|
||||
blockClicked.getZ());
|
||||
|
||||
session.setPos1(cur);
|
||||
player.print("First edit position set.");
|
||||
try {
|
||||
if (session.getPos1().equals(cur)) {
|
||||
return false;
|
||||
}
|
||||
} catch (IncompleteRegionException e) {
|
||||
}
|
||||
|
||||
return true;
|
||||
session.setPos1(cur);
|
||||
player.print("First edit position set.");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -32,6 +32,7 @@ public class WorldEditSession {
|
||||
private int historyPointer = 0;
|
||||
private CuboidClipboard clipboard;
|
||||
private boolean toolControl = true;
|
||||
private boolean superPickAxe = false;
|
||||
private int maxBlocksChanged = -1;
|
||||
|
||||
/**
|
||||
@ -242,4 +243,41 @@ public class WorldEditSession {
|
||||
public void setBlockChangeLimit(int maxBlocksChanged) {
|
||||
this.maxBlocksChanged = maxBlocksChanged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the super pick axe is enabled.
|
||||
*
|
||||
* @return status
|
||||
*/
|
||||
public boolean hasSuperPickAxe() {
|
||||
return superPickAxe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable super pick axe.
|
||||
*
|
||||
* @param superPickAxe
|
||||
*/
|
||||
public void enableSuperPickAxe() {
|
||||
superPickAxe = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable super pick axe.
|
||||
*
|
||||
* @param superPickAxe
|
||||
*/
|
||||
public void disableSuperPickAxe() {
|
||||
superPickAxe = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the super pick axe.
|
||||
*
|
||||
* @return status
|
||||
*/
|
||||
public boolean toggleSuperPickAxe() {
|
||||
superPickAxe = !superPickAxe;
|
||||
return superPickAxe;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren