Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-09 21:10:05 +01:00
Support for listing in expand, contract, and shift.
Support listing in these commands by replacing a single Vector with a List<Vector> and then iterating through it in a foreach loop. Region changes are still performed individually, no extra complicated math involved.
Dieser Commit ist enthalten in:
Ursprung
5f47ede05a
Commit
65c3614e7b
@ -334,7 +334,7 @@ public class SelectionCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector dir;
|
List<Vector> dirs = new ArrayList<Vector>();
|
||||||
int change = args.getInteger(0);
|
int change = args.getInteger(0);
|
||||||
int reverseChange = 0;
|
int reverseChange = 0;
|
||||||
|
|
||||||
@ -343,31 +343,50 @@ public class SelectionCommands {
|
|||||||
// Either a reverse amount or a direction
|
// Either a reverse amount or a direction
|
||||||
try {
|
try {
|
||||||
reverseChange = args.getInteger(1);
|
reverseChange = args.getInteger(1);
|
||||||
dir = we.getDirection(player, "me");
|
dirs.add(we.getDirection(player, "me"));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
dir = we.getDirection(player,
|
if (args.getString(1).contains(",")) {
|
||||||
args.getString(1).toLowerCase());
|
String[] split = args.getString(1).split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
dirs.add(we.getDirection(player, s.toLowerCase()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dirs.add(we.getDirection(player, args.getString(1).toLowerCase()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
// Both reverse amount and direction
|
// Both reverse amount and direction
|
||||||
reverseChange = args.getInteger(1);
|
reverseChange = args.getInteger(1);
|
||||||
dir = we.getDirection(player,
|
if (args.getString(2).contains(",")) {
|
||||||
args.getString(2).toLowerCase());
|
String[] split = args.getString(2).split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
dirs.add(we.getDirection(player, s.toLowerCase()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dirs.add(we.getDirection(player, args.getString(2).toLowerCase()));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dir = we.getDirection(player, "me");
|
dirs.add(we.getDirection(player, "me"));
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Region region = session.getSelection(player.getWorld());
|
Region region = session.getSelection(player.getWorld());
|
||||||
int oldSize = region.getArea();
|
int oldSize = region.getArea();
|
||||||
|
|
||||||
if (reverseChange == 0) {
|
if (reverseChange == 0) {
|
||||||
|
for (Vector dir : dirs) {
|
||||||
region.expand(dir.multiply(change));
|
region.expand(dir.multiply(change));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
for (Vector dir : dirs) {
|
||||||
region.expand(dir.multiply(change), dir.multiply(-reverseChange));
|
region.expand(dir.multiply(change), dir.multiply(-reverseChange));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||||
int newSize = region.getArea();
|
int newSize = region.getArea();
|
||||||
@ -389,7 +408,7 @@ public class SelectionCommands {
|
|||||||
public void contract(CommandContext args, LocalSession session, LocalPlayer player,
|
public void contract(CommandContext args, LocalSession session, LocalPlayer player,
|
||||||
EditSession editSession) throws WorldEditException {
|
EditSession editSession) throws WorldEditException {
|
||||||
|
|
||||||
Vector dir;
|
List<Vector> dirs = new ArrayList<Vector>();
|
||||||
int change = args.getInteger(0);
|
int change = args.getInteger(0);
|
||||||
int reverseChange = 0;
|
int reverseChange = 0;
|
||||||
|
|
||||||
@ -398,29 +417,49 @@ public class SelectionCommands {
|
|||||||
// Either a reverse amount or a direction
|
// Either a reverse amount or a direction
|
||||||
try {
|
try {
|
||||||
reverseChange = args.getInteger(1);
|
reverseChange = args.getInteger(1);
|
||||||
dir = we.getDirection(player, "me");
|
dirs.add(we.getDirection(player, "me"));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
dir = we.getDirection(player, args.getString(1).toLowerCase());
|
if (args.getString(1).contains(",")) {
|
||||||
|
String[] split = args.getString(1).split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
dirs.add(we.getDirection(player, s.toLowerCase()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dirs.add(we.getDirection(player, args.getString(1).toLowerCase()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
// Both reverse amount and direction
|
// Both reverse amount and direction
|
||||||
reverseChange = args.getInteger(1);
|
reverseChange = args.getInteger(1);
|
||||||
dir = we.getDirection(player, args.getString(2).toLowerCase());
|
if (args.getString(2).contains(",")) {
|
||||||
|
String[] split = args.getString(2).split(",");
|
||||||
|
for (String s : split) {
|
||||||
|
dirs.add(we.getDirection(player, s.toLowerCase()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dirs.add(we.getDirection(player, args.getString(2).toLowerCase()));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dir = we.getDirection(player, "me");
|
dirs.add(we.getDirection(player, "me"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Region region = session.getSelection(player.getWorld());
|
Region region = session.getSelection(player.getWorld());
|
||||||
int oldSize = region.getArea();
|
int oldSize = region.getArea();
|
||||||
if (reverseChange == 0) {
|
if (reverseChange == 0) {
|
||||||
|
for (Vector dir : dirs) {
|
||||||
region.contract(dir.multiply(change));
|
region.contract(dir.multiply(change));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
for (Vector dir : dirs) {
|
||||||
region.contract(dir.multiply(change), dir.multiply(-reverseChange));
|
region.contract(dir.multiply(change), dir.multiply(-reverseChange));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||||
int newSize = region.getArea();
|
int newSize = region.getArea();
|
||||||
|
|
||||||
@ -444,18 +483,28 @@ public class SelectionCommands {
|
|||||||
@CommandPermissions("worldedit.selection.shift")
|
@CommandPermissions("worldedit.selection.shift")
|
||||||
public void shift(CommandContext args, LocalSession session, LocalPlayer player,
|
public void shift(CommandContext args, LocalSession session, LocalPlayer player,
|
||||||
EditSession editSession) throws WorldEditException {
|
EditSession editSession) throws WorldEditException {
|
||||||
Vector dir;
|
|
||||||
|
|
||||||
|
List<Vector> dirs = new ArrayList<Vector>();
|
||||||
int change = args.getInteger(0);
|
int change = args.getInteger(0);
|
||||||
if (args.argsLength() == 2) {
|
if (args.argsLength() == 2) {
|
||||||
dir = we.getDirection(player, args.getString(1).toLowerCase());
|
if (args.getString(1).contains(",")) {
|
||||||
|
for (String s : args.getString(1).split(",")) {
|
||||||
|
dirs.add(we.getDirection(player, s.toLowerCase()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dir = we.getDirection(player, "me");
|
dirs.add(we.getDirection(player, args.getString(1).toLowerCase()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dirs.add(we.getDirection(player, "me"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Region region = session.getSelection(player.getWorld());
|
Region region = session.getSelection(player.getWorld());
|
||||||
|
|
||||||
|
for (Vector dir : dirs) {
|
||||||
region.shift(dir.multiply(change));
|
region.shift(dir.multiply(change));
|
||||||
|
}
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren