Compare commits

...

13 commits
v1.4 ... master

Author SHA1 Message Date
Norbi Peti 9b7192c091
1.16.4 release 2021-03-03 18:04:21 +01:00
Norbi Peti 416393ea77
Update version and use 1.16.3 2021-03-03 17:58:38 +01:00
Norbi Peti 8770debfef
Add bStats metrics 2021-03-03 16:48:43 +01:00
Norbi Peti d70fb4f812
Add support for custom world names 2020-12-21 01:05:53 +01:00
Norbi Peti 28b3965582
Merge pull request #6 from Kas-tle/master
Load before hyperverse and create automatic releases
2020-12-21 00:14:15 +01:00
Kastle 415fa6b5d2
Action should say 11; my bad 2020-12-03 19:47:28 -08:00
Kastle 1798960183
Update pom.xml 2020-12-03 19:45:47 -08:00
Kastle 722ddffdd2
Run buildtools so that we may access NMS.
This will need to be manually updated to use the current version supported by the plugin for the moment.
2020-12-03 19:44:47 -08:00
Kas-tle c54880e5c2
Bump version and go semantic 2020-12-03 18:15:39 -08:00
Kas-tle 914f4a5b31
Add maven build badge 2020-12-03 18:14:32 -08:00
Kas-tle b43ca07722
Automate building with Maven action 2020-12-03 18:12:41 -08:00
Kas-tle d637797628
Load before Hyperverse as well
Hyperverse is an alternate world management plugin that is being developed by some of the FAWE devs. See https://github.com/Incendo/Hyperverse. Assuming the implementation here is just load the world in a separate folder, don't think there should be any issues beyond this.
2020-12-03 17:59:30 -08:00
Norbi Peti 501d5912b9
Update version in README 2020-11-16 16:16:24 +01:00
5 changed files with 115 additions and 11 deletions

57
.github/workflows/maven.yml vendored Normal file
View 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 }}

View file

@ -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/)

32
pom.xml
View file

@ -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>
@ -76,4 +104,4 @@
</build>
</profile>
</profiles>
</project>
</project>

View file

@ -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,
Convertable convertable, DedicatedServer console, org.bukkit.World mainWorld) throws IOException {
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;
}
}
}

View file

@ -1,6 +1,7 @@
name: CustomDimensions
main: buttondevteam.customdimensions.CustomDimensions
version: '1.4'
version: '1.6'
api-version: '1.16'
loadbefore:
- Multiverse-Core
- Multiverse-Core
- Hyperverse