Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-26 02:50:06 +01:00
Made the selection commands spit out the region size.
Dieser Commit ist enthalten in:
Ursprung
767c7de163
Commit
ff7df41823
@ -454,14 +454,24 @@ public class WorldEditListener extends PluginListener {
|
|||||||
} else if (split[0].equalsIgnoreCase("//pos1")) {
|
} else if (split[0].equalsIgnoreCase("//pos1")) {
|
||||||
checkArgs(split, 0, 0, split[0]);
|
checkArgs(split, 0, 0, split[0]);
|
||||||
session.setPos1(player.getBlockIn());
|
session.setPos1(player.getBlockIn());
|
||||||
player.print("First position set to " + player.getBlockIn() + " .");
|
if (session.isRegionDefined()) {
|
||||||
|
player.print("First position set to " + player.getBlockIn()
|
||||||
|
+ " (" + session.getRegion().getSize() + ").");
|
||||||
|
} else {
|
||||||
|
player.print("First position set to " + player.getBlockIn() + ".");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Set edit position #2
|
// Set edit position #2
|
||||||
} else if (split[0].equalsIgnoreCase("//pos2")) {
|
} else if (split[0].equalsIgnoreCase("//pos2")) {
|
||||||
checkArgs(split, 0, 0, split[0]);
|
checkArgs(split, 0, 0, split[0]);
|
||||||
session.setPos2(player.getBlockIn());
|
session.setPos2(player.getBlockIn());
|
||||||
player.print("Second position set to " + player.getBlockIn() + " .");
|
if (session.isRegionDefined()) {
|
||||||
|
player.print("Second position set to " + player.getBlockIn()
|
||||||
|
+ " (" + session.getRegion().getSize() + ").");
|
||||||
|
} else {
|
||||||
|
player.print("Second position set to " + player.getBlockIn() + " .");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Trace edit position #1
|
// Trace edit position #1
|
||||||
@ -470,7 +480,12 @@ public class WorldEditListener extends PluginListener {
|
|||||||
Vector pos = player.getBlockTrace(300);
|
Vector pos = player.getBlockTrace(300);
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
session.setPos1(pos);
|
session.setPos1(pos);
|
||||||
player.print("First position set to " + pos.toString() + " .");
|
if (session.isRegionDefined()) {
|
||||||
|
player.print("First position set to " + pos
|
||||||
|
+ " (" + session.getRegion().getSize() + ").");
|
||||||
|
} else {
|
||||||
|
player.print("First position set to " + pos.toString() + " .");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
player.printError("No block in sight!");
|
player.printError("No block in sight!");
|
||||||
}
|
}
|
||||||
@ -482,7 +497,12 @@ public class WorldEditListener extends PluginListener {
|
|||||||
Vector pos = player.getBlockTrace(300);
|
Vector pos = player.getBlockTrace(300);
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
session.setPos2(pos);
|
session.setPos2(pos);
|
||||||
player.print("Second position set to " + pos.toString() + " .");
|
if (session.isRegionDefined()) {
|
||||||
|
player.print("First position set to " + pos
|
||||||
|
+ " (" + session.getRegion().getSize() + ").");
|
||||||
|
} else {
|
||||||
|
player.print("Second position set to " + pos.toString() + " .");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
player.printError("No block in sight!");
|
player.printError("No block in sight!");
|
||||||
}
|
}
|
||||||
@ -1479,17 +1499,24 @@ public class WorldEditListener extends PluginListener {
|
|||||||
WorldEditPlayer player = new WorldEditPlayer(modPlayer);
|
WorldEditPlayer player = new WorldEditPlayer(modPlayer);
|
||||||
|
|
||||||
// This prevents needless sessions from being created
|
// This prevents needless sessions from being created
|
||||||
if (!hasSession(player)) { return false; }
|
if (!hasSession(player) && !(itemInHand == wandItem &&
|
||||||
|
canUseCommand(modPlayer, "//pos2"))) { return false; }
|
||||||
|
|
||||||
WorldEditSession session = getSession(player);
|
WorldEditSession session = getSession(player);
|
||||||
|
|
||||||
if (itemInHand == wandItem && session.isToolControlEnabled()) {
|
if (itemInHand == wandItem && session.isToolControlEnabled()
|
||||||
|
&& canUseCommand(modPlayer, "//pos2")) {
|
||||||
Vector cur = Vector.toBlockPoint(blockClicked.getX(),
|
Vector cur = Vector.toBlockPoint(blockClicked.getX(),
|
||||||
blockClicked.getY(),
|
blockClicked.getY(),
|
||||||
blockClicked.getZ());
|
blockClicked.getZ());
|
||||||
|
|
||||||
session.setPos2(cur);
|
session.setPos2(cur);
|
||||||
player.print("Second position set to " + cur + ".");
|
try {
|
||||||
|
player.print("Second position set to " + cur
|
||||||
|
+ " (" + session.getRegion().getSize() + ").");
|
||||||
|
} catch (IncompleteRegionException e) {
|
||||||
|
player.print("Second position set to " + cur + ".");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (player.isHoldingPickAxe()
|
} else if (player.isHoldingPickAxe()
|
||||||
@ -1551,7 +1578,12 @@ public class WorldEditListener extends PluginListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
session.setPos1(cur);
|
session.setPos1(cur);
|
||||||
player.print("First position set to " + cur + ".");
|
try {
|
||||||
|
player.print("First position set to " + cur
|
||||||
|
+ " (" + session.getRegion().getSize() + ").");
|
||||||
|
} catch (IncompleteRegionException e) {
|
||||||
|
player.print("First position set to " + cur + ".");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,15 @@ public class WorldEditSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the region is fully defined.
|
||||||
|
*
|
||||||
|
* @throws IncompleteRegionException
|
||||||
|
*/
|
||||||
|
public boolean isRegionDefined() {
|
||||||
|
return pos1 != null && pos2 != null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets defined position 1.
|
* Gets defined position 1.
|
||||||
*
|
*
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren