Compare commits
13 commits
Author | SHA1 | Date | |
---|---|---|---|
9b7192c091 | |||
416393ea77 | |||
8770debfef | |||
d70fb4f812 | |||
28b3965582 | |||
|
415fa6b5d2 | ||
|
1798960183 | ||
|
722ddffdd2 | ||
|
c54880e5c2 | ||
|
914f4a5b31 | ||
|
b43ca07722 | ||
|
d637797628 | ||
501d5912b9 |
5 changed files with 115 additions and 11 deletions
57
.github/workflows/maven.yml
vendored
Normal file
57
.github/workflows/maven.yml
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
# This workflow will build a Java project with Maven
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
name: Java CI with Maven
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get version information
|
||||
id: version
|
||||
uses: ncipollo/semantic-version-action@v1
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
|
||||
architecture: x86 # (x64 or x86) - defaults to x64
|
||||
- run: wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
|
||||
- run: java -jar BuildTools.jar --rev 1.16.4
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
- name: Build with Maven
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: mvn -B package --file pom.xml
|
||||
- run: mkdir staging && cp target/*.jar staging
|
||||
- name: Generate release diff
|
||||
env:
|
||||
BEGIN_COMMIT: ${{ steps.version.outputs.previous_tag }}
|
||||
END_COMMIT: ${{ steps.version.outputs.tag }}
|
||||
run: git fetch --tags --force && git log --pretty=format:"* %s (%h)" ${BEGIN_COMMIT}..${END_COMMIT} > release_notes.md
|
||||
- name: Create release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: staging/*
|
||||
allowUpdates: true
|
||||
bodyFile: "release_notes.md"
|
||||
draft: false
|
||||
prerelease: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -1,5 +1,6 @@
|
|||
![Java CI with Maven](https://github.com/TBMCPlugins/CustomDimensions/workflows/Java%20CI%20with%20Maven/badge.svg)
|
||||
# CustomDimensions
|
||||
Custom dimension support for 1.16.3 Bukkit/Spigot/Paper servers
|
||||
Custom dimension support for 1.16.4 Bukkit/Spigot/Paper servers
|
||||
|
||||
## Usage
|
||||
See on [SpigotMC](https://www.spigotmc.org/resources/1-16-custom-dimensions.83731/)
|
||||
|
|
30
pom.xml
30
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>com.github.TBMCPlugins</groupId>
|
||||
<artifactId>CustomDimensions</artifactId>
|
||||
<version>1.4</version>
|
||||
<version>1.6.0</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
@ -23,6 +23,28 @@
|
|||
</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>
|
||||
|
||||
|
@ -50,6 +72,12 @@
|
|||
<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,8 +3,11 @@ 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;
|
||||
|
@ -18,8 +21,11 @@ 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();
|
||||
|
@ -46,33 +52,42 @@ 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 {
|
||||
loadDimension(dimEntry.getKey(), dimEntry.getValue(), convertable, console, mainWorld);
|
||||
if (loadDimension(dimEntry.getKey(), dimEntry.getValue(), convertable, console, mainWorld))
|
||||
loadedCount++;
|
||||
} 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 void loadDimension(ResourceKey<WorldDimension> dimKey, WorldDimension dimension,
|
||||
private boolean 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;
|
||||
return false;
|
||||
ResourceKey<World> worldKey = ResourceKey.a(IRegistry.L, dimKey.a());
|
||||
DimensionManager dimensionmanager = dimension.b();
|
||||
ChunkGenerator chunkgenerator = dimension.c();
|
||||
var name = dimKey.a().getKey();
|
||||
String name = getConfig().getString("worldNames." + dimKey.a());
|
||||
if (name == null)
|
||||
name = dimKey.a().getKey();
|
||||
if (Bukkit.getWorld(name) != null) {
|
||||
getLogger().info(name + " already loaded");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
getLogger().info("Loading " + name);
|
||||
var session = convertable.new ConversionSession(name, dimKey) { //The original session isn't prepared for custom dimensions
|
||||
|
@ -133,6 +148,7 @@ 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);
|
||||
|
@ -140,6 +156,7 @@ 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,7 @@
|
|||
name: CustomDimensions
|
||||
main: buttondevteam.customdimensions.CustomDimensions
|
||||
version: '1.4'
|
||||
version: '1.6'
|
||||
api-version: '1.16'
|
||||
loadbefore:
|
||||
- Multiverse-Core
|
||||
- Hyperverse
|
||||
|
|
Loading…
Reference in a new issue