mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
fix some invalid flags / improved regenallroads command
This commit is contained in:
parent
7b85a28fb4
commit
20a4dec7fe
@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
||||
public class RegenAllRoads extends SubCommand {
|
||||
|
||||
public RegenAllRoads() {
|
||||
super(Command.REGENALLROADS, "Regenerate all roads in the map", "regenallroads", CommandCategory.DEBUG, false);
|
||||
super(Command.REGENALLROADS, "Regenerate all roads in the map using the set road schematic", "regenallroads", CommandCategory.DEBUG, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -65,6 +65,8 @@ public class RegenAllRoads extends SubCommand {
|
||||
World world = Bukkit.getWorld(name);
|
||||
ArrayList<ChunkLoc> chunks = hpm.getChunkChunks(world);
|
||||
|
||||
PlotMain.sendConsoleSenderMessage("&cIf no schematic is set, the following will not do anything");
|
||||
PlotMain.sendConsoleSenderMessage("&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
|
||||
PlotMain.sendConsoleSenderMessage("&6Potential chunks to update: &7"+ (chunks.size() * 256));
|
||||
PlotMain.sendConsoleSenderMessage("&6Estimated time: &7"+ (chunks.size()) + " seconds");
|
||||
|
||||
|
@ -62,7 +62,12 @@ public class AbstractFlag {
|
||||
}
|
||||
|
||||
public Object parseValueRaw(final String value) {
|
||||
return this.value.parse(value);
|
||||
try {
|
||||
return this.value.parse(value);
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String toString(final Object t) {
|
||||
|
@ -333,13 +333,23 @@ public abstract class FlagValue<T> {
|
||||
|
||||
@Override
|
||||
public void add(Object t, String value) {
|
||||
((HashSet<PlotBlock>)t).addAll(parse(value));
|
||||
try {
|
||||
((HashSet<PlotBlock>)t).addAll(parse(value));
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Object t, String value) {
|
||||
for (PlotBlock item : parse(value)) {
|
||||
((HashSet<PlotBlock>)t).remove(item);
|
||||
try {
|
||||
for (PlotBlock item : parse(value)) {
|
||||
((HashSet<PlotBlock>)t).remove(item);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ package com.intellectualcrafters.plot.generator;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
@ -204,6 +205,16 @@ import com.intellectualcrafters.plot.util.SendChunk;
|
||||
int sx = loc.x << 4;
|
||||
int sz = loc.z << 4;
|
||||
|
||||
HashSet<Chunk> chunks = new HashSet<Chunk>();
|
||||
|
||||
for (int x = sx; x < sx + 16; x++) {
|
||||
for (int z = sz; z < sz + 16; z++) {
|
||||
Chunk chunk = world.getChunkAt(x, z);
|
||||
chunk.load(false);
|
||||
chunks.add(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = sx; x < sx + 16; x++) {
|
||||
for (int z = sz; z < sz + 16; z++) {
|
||||
Chunk chunk = world.getChunkAt(x, z);
|
||||
|
Loading…
Reference in New Issue
Block a user