mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-15 23:26:33 +01:00
Add allowed extents section to config
This commit is contained in:
parent
04e281e72d
commit
72933df640
@ -6,6 +6,7 @@ import com.boydti.fawe.object.FawePlayer;
|
|||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -30,6 +31,7 @@ public class Settings {
|
|||||||
public static int QUEUE_SIZE = 64;
|
public static int QUEUE_SIZE = 64;
|
||||||
public static int QUEUE_MAX_WAIT = 1000;
|
public static int QUEUE_MAX_WAIT = 1000;
|
||||||
public static int QUEUE_DISCARD_AFTER = 60000;
|
public static int QUEUE_DISCARD_AFTER = 60000;
|
||||||
|
public static List<String> ALLOWED_3RDPARTY_EXTENTS;
|
||||||
|
|
||||||
public static HashMap<String, FaweLimit> limits;
|
public static HashMap<String, FaweLimit> limits;
|
||||||
|
|
||||||
@ -79,6 +81,7 @@ public class Settings {
|
|||||||
options.put("queue.target-size", QUEUE_SIZE);
|
options.put("queue.target-size", QUEUE_SIZE);
|
||||||
options.put("queue.max-wait-ms", QUEUE_MAX_WAIT);
|
options.put("queue.max-wait-ms", QUEUE_MAX_WAIT);
|
||||||
options.put("queue.discard-after-ms", QUEUE_DISCARD_AFTER);
|
options.put("queue.discard-after-ms", QUEUE_DISCARD_AFTER);
|
||||||
|
options.put("extent.allowed-plugins", new ArrayList<String>());
|
||||||
options.put("metrics", METRICS);
|
options.put("metrics", METRICS);
|
||||||
|
|
||||||
// Default limit
|
// Default limit
|
||||||
@ -111,6 +114,9 @@ public class Settings {
|
|||||||
QUEUE_SIZE = config.getInt("queue.target-size");
|
QUEUE_SIZE = config.getInt("queue.target-size");
|
||||||
QUEUE_MAX_WAIT = config.getInt("queue.max-wait-ms");
|
QUEUE_MAX_WAIT = config.getInt("queue.max-wait-ms");
|
||||||
QUEUE_DISCARD_AFTER = config.getInt("queue.discard-after-ms");
|
QUEUE_DISCARD_AFTER = config.getInt("queue.discard-after-ms");
|
||||||
|
|
||||||
|
ALLOWED_3RDPARTY_EXTENTS = config.getStringList("extent.allowed-plugins");
|
||||||
|
|
||||||
if (STORE_HISTORY_ON_DISK = config.getBoolean("history.use-disk")) {
|
if (STORE_HISTORY_ON_DISK = config.getBoolean("history.use-disk")) {
|
||||||
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
|
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
@ -354,6 +354,12 @@ public class EditSession implements Extent {
|
|||||||
eventBus.post(event);
|
eventBus.post(event);
|
||||||
final Extent toReturn = event.getExtent();
|
final Extent toReturn = event.getExtent();
|
||||||
if (toReturn != extent) {
|
if (toReturn != extent) {
|
||||||
|
String className = toReturn.getClass().getName().toLowerCase();
|
||||||
|
for (String allowed : Settings.ALLOWED_3RDPARTY_EXTENTS) {
|
||||||
|
if (className.contains(allowed.toLowerCase())) {
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
}
|
||||||
Fawe.debug("&cPotentially inefficient WorldEdit extent: " + toReturn.getClass().getCanonicalName());
|
Fawe.debug("&cPotentially inefficient WorldEdit extent: " + toReturn.getClass().getCanonicalName());
|
||||||
Fawe.debug("&8 - &7For area restrictions, it is recommended to use the FaweAPI");
|
Fawe.debug("&8 - &7For area restrictions, it is recommended to use the FaweAPI");
|
||||||
Fawe.debug("&8 - &7Ignore this if not an area restriction");
|
Fawe.debug("&8 - &7Ignore this if not an area restriction");
|
||||||
|
Loading…
Reference in New Issue
Block a user