Skip to content

Commit b6443d7

Browse files
committed
Add option to auto-import worlds created by other plugins
1 parent 05a8a43 commit b6443d7

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

multiworld-api/multiworld-api-bukkit/src/main/java/com/dev7ex/multiworld/api/bukkit/MultiWorldBukkitApiConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public enum Entry {
2828
SETTINGS_AUTO_UNLOAD_LOAD_DELAY("settings.auto-unload-load-delay", 300, false),
2929
SETTINGS_AUTO_UNLOAD_SYSTEM_DELAY("settings.auto-unload-system-delay", 1800, false),
3030
SETTINGS_AUTO_UNLOAD_SYSTEM_ENABLED("settings.auto-unload-system-enabled", true, false),
31+
SETTINGS_AUTO_WORLD_IMPORT_ENABLED("settings.auto-world-import", true, false),
3132

3233
SETTINGS_DEFAULTS_AUTO_LOAD_ENABLED("settings.defaults.auto-load-enabled", false, false),
3334
SETTINGS_DEFAULTS_AUTO_UNLOAD_ENABLED("settings.defaults.auto-unload-enabled", false, false),

multiworld-api/multiworld-api-core/src/main/java/com/dev7ex/multiworld/api/MultiWorldApiConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public interface MultiWorldApiConfiguration {
117117

118118
long getAutoUnloadLoadDelay();
119119

120+
boolean isAutoWorldImportEnabled();
120121

121122
/**
122123
* Retrieves the default properties for worlds.

multiworld-bukkit/src/main/java/com/dev7ex/multiworld/MultiWorldConfiguration.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ public long getAutoUnloadLoadDelay() {
101101
return super.getLong(Entry.SETTINGS_AUTO_UNLOAD_LOAD_DELAY.getPath());
102102
}
103103

104+
@Override
105+
public boolean isAutoWorldImportEnabled() {
106+
return super.getBoolean(Entry.SETTINGS_AUTO_WORLD_IMPORT_ENABLED.getPath());
107+
}
108+
104109
@Override
105110
public boolean canNetherWorldAccessViaCommand() {
106111
return super.getBoolean(Entry.SETTINGS_ACCESS_NETHER_WORLD_VIA_COMMAND.getPath());

multiworld-bukkit/src/main/java/com/dev7ex/multiworld/MultiWorldPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ public void registerListeners() {
114114

115115
super.registerListener(new WorldActivityListener(this));
116116
super.registerListener(new WorldFlagListener(this));
117-
super.registerListener(new WorldInitializeListener(this));
117+
super.registerListenerIf(new WorldInitializeListener(this),
118+
enableIf -> this.configuration.isAutoWorldImportEnabled());
118119
}
119120

120121
@Override

multiworld-bukkit/src/main/resources/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ settings:
2222
auto-unload-system-delay: 1800
2323
# Enables automatic unloading of inactive worlds.
2424
auto-unload-system-enabled: true
25+
# Whether to automatically detect and import newly created or loaded worlds.
26+
# If false, new worlds must be manually added.
27+
auto-world-import: false
2528
# Standard values for new worlds
2629
defaults:
2730
# Specifies whether the server should automatically load the worlds upon starting

0 commit comments

Comments
 (0)