mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-13 10:34:09 +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 class RegenAllRoads extends SubCommand {
|
||||||
|
|
||||||
public RegenAllRoads() {
|
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
|
@Override
|
||||||
@ -65,6 +65,8 @@ public class RegenAllRoads extends SubCommand {
|
|||||||
World world = Bukkit.getWorld(name);
|
World world = Bukkit.getWorld(name);
|
||||||
ArrayList<ChunkLoc> chunks = hpm.getChunkChunks(world);
|
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("&6Potential chunks to update: &7"+ (chunks.size() * 256));
|
||||||
PlotMain.sendConsoleSenderMessage("&6Estimated time: &7"+ (chunks.size()) + " seconds");
|
PlotMain.sendConsoleSenderMessage("&6Estimated time: &7"+ (chunks.size()) + " seconds");
|
||||||
|
|
||||||
|
@ -62,7 +62,12 @@ public class AbstractFlag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Object parseValueRaw(final String value) {
|
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) {
|
public String toString(final Object t) {
|
||||||
|
@ -333,13 +333,23 @@ public abstract class FlagValue<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(Object t, String value) {
|
public void add(Object t, String value) {
|
||||||
((HashSet<PlotBlock>)t).addAll(parse(value));
|
try {
|
||||||
|
((HashSet<PlotBlock>)t).addAll(parse(value));
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(Object t, String value) {
|
public void remove(Object t, String value) {
|
||||||
for (PlotBlock item : parse(value)) {
|
try {
|
||||||
((HashSet<PlotBlock>)t).remove(item);
|
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.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -204,6 +205,16 @@ import com.intellectualcrafters.plot.util.SendChunk;
|
|||||||
int sx = loc.x << 4;
|
int sx = loc.x << 4;
|
||||||
int sz = loc.z << 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 x = sx; x < sx + 16; x++) {
|
||||||
for (int z = sz; z < sz + 16; z++) {
|
for (int z = sz; z < sz + 16; z++) {
|
||||||
Chunk chunk = world.getChunkAt(x, z);
|
Chunk chunk = world.getChunkAt(x, z);
|
||||||
|
Loading…
Reference in New Issue
Block a user