Compare commits
No commits in common. "master" and "1.5.0" have entirely different histories.
3 changed files with 7 additions and 50 deletions
30
pom.xml
30
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>com.github.TBMCPlugins</groupId>
|
||||
<artifactId>CustomDimensions</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<version>1.5.0</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
@ -23,28 +23,6 @@
|
|||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>buttondevteam.customdimensions.bstats</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -72,12 +50,6 @@
|
|||
<version>0.3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -3,11 +3,8 @@ package buttondevteam.customdimensions;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.util.concurrent.Callables;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import net.minecraft.server.v1_16_R3.*;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bstats.charts.SimplePie;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
|
||||
|
@ -21,11 +18,8 @@ import java.io.IOException;
|
|||
import java.util.*;
|
||||
|
||||
public class CustomDimensions extends JavaPlugin implements Listener {
|
||||
private Metrics metrics;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
metrics = new Metrics(this, 10545);
|
||||
getLogger().info("Loading custom dimensions...");
|
||||
try {
|
||||
load();
|
||||
|
@ -52,33 +46,26 @@ public class CustomDimensions extends JavaPlugin implements Listener {
|
|||
saveConfig();
|
||||
}
|
||||
var ignored = getConfig().getStringList("ignored");
|
||||
int allCount = -3, loadedCount = 0, ignoredCount = 0; //-3: overworld, nether, end
|
||||
for (var dimEntry : dimensionRegistry.d()) {
|
||||
allCount++;
|
||||
if (ignored.contains(dimEntry.getKey().a().getKey())) {
|
||||
getLogger().info(dimEntry.getKey() + " is on the ignore list");
|
||||
ignoredCount++;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
if (loadDimension(dimEntry.getKey(), dimEntry.getValue(), convertable, console, mainWorld))
|
||||
loadedCount++;
|
||||
loadDimension(dimEntry.getKey(), dimEntry.getValue(), convertable, console, mainWorld);
|
||||
} catch (Exception e) {
|
||||
getLogger().warning("Failed to load dimension " + dimEntry.getKey());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
metrics.addCustomChart(new SimplePie("all_custom_dimensions", Callables.returning(allCount + "")));
|
||||
metrics.addCustomChart(new SimplePie("loaded_custom_dimensions", Callables.returning(loadedCount + "")));
|
||||
metrics.addCustomChart(new SimplePie("ignored_custom_dimensions", Callables.returning(ignoredCount + "")));
|
||||
}
|
||||
|
||||
private boolean loadDimension(ResourceKey<WorldDimension> dimKey, WorldDimension dimension,
|
||||
Convertable convertable, DedicatedServer console, org.bukkit.World mainWorld) throws IOException {
|
||||
private void loadDimension(ResourceKey<WorldDimension> dimKey, WorldDimension dimension,
|
||||
Convertable convertable, DedicatedServer console, org.bukkit.World mainWorld) throws IOException {
|
||||
if (dimKey == WorldDimension.OVERWORLD //The default dimensions are already loaded
|
||||
|| dimKey == WorldDimension.THE_NETHER
|
||||
|| dimKey == WorldDimension.THE_END)
|
||||
return false;
|
||||
return;
|
||||
ResourceKey<World> worldKey = ResourceKey.a(IRegistry.L, dimKey.a());
|
||||
DimensionManager dimensionmanager = dimension.b();
|
||||
ChunkGenerator chunkgenerator = dimension.c();
|
||||
|
@ -87,7 +74,7 @@ public class CustomDimensions extends JavaPlugin implements Listener {
|
|||
name = dimKey.a().getKey();
|
||||
if (Bukkit.getWorld(name) != null) {
|
||||
getLogger().info(name + " already loaded");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
getLogger().info("Loading " + name);
|
||||
var session = convertable.new ConversionSession(name, dimKey) { //The original session isn't prepared for custom dimensions
|
||||
|
@ -148,7 +135,6 @@ public class CustomDimensions extends JavaPlugin implements Listener {
|
|||
|
||||
if (Bukkit.getWorld(name.toLowerCase(Locale.ENGLISH)) == null) {
|
||||
getLogger().warning("Failed to load custom dimension " + name);
|
||||
return false;
|
||||
} else {
|
||||
console.initWorld(worldserver, worlddata, worlddata, worlddata.getGeneratorSettings());
|
||||
worldserver.setSpawnFlags(true, true);
|
||||
|
@ -156,7 +142,6 @@ public class CustomDimensions extends JavaPlugin implements Listener {
|
|||
Bukkit.getPluginManager().callEvent(new WorldInitEvent(worldserver.getWorld()));
|
||||
console.loadSpawn(worldserver.getChunkProvider().playerChunkMap.worldLoadListener, worldserver);
|
||||
Bukkit.getPluginManager().callEvent(new WorldLoadEvent(worldserver.getWorld()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: CustomDimensions
|
||||
main: buttondevteam.customdimensions.CustomDimensions
|
||||
version: '1.6'
|
||||
version: '1.5'
|
||||
api-version: '1.16'
|
||||
loadbefore:
|
||||
- Multiverse-Core
|
||||
|
|
Loading…
Reference in a new issue