Remove bstats
This commit is contained in:
1 parent
059fccc2cc
commit
b19c86464b
5 files changed
+32
-409
No files matched your search
+30
-71
@@ -1,7 +1,7 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
|
||||
plugins {
|
||||
java
|
||||
@@ -21,13 +21,10 @@ java {
|
||||
}
|
||||
}
|
||||
|
||||
val paperVersions = listOf(
|
||||
"1.16.5",
|
||||
)
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
maven("https://repo.purpurmc.org/snapshots")
|
||||
maven("https://jitpack.io/")
|
||||
}
|
||||
|
||||
@@ -38,10 +35,9 @@ configurations.named("implementation") {
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.jetbrains:annotations:25.0.0")
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT")
|
||||
compileOnly("com.google.guava:guava:33.3.1-jre")
|
||||
|
||||
implementation("com.google.guava:guava:33.3.1-jre")
|
||||
|
||||
shade("org.bstats:bstats-bukkit:3.1.0")
|
||||
shade("org.json:json:20240303")
|
||||
shade("org.tukaani:xz:1.10")
|
||||
shade("com.github.technicallycoded:FoliaLib:v0.4.3")
|
||||
@@ -49,73 +45,36 @@ dependencies {
|
||||
testImplementation("junit:junit:4.11")
|
||||
}
|
||||
|
||||
paperVersions.forEach { mcVersion ->
|
||||
val taskSuffix = mcVersion.replace('.', '_')
|
||||
val taskName = "buildJar_$taskSuffix"
|
||||
val outputDir = file("build/libs/$mcVersion")
|
||||
|
||||
val apiVersion = mcVersion.split('.').take(2).joinToString(".")
|
||||
|
||||
val sourceSetName = "main"
|
||||
|
||||
// Custom processResources task per version
|
||||
val processTask = tasks.register<Copy>("processResources_$taskSuffix") {
|
||||
val srcSets = project.extensions.getByName("sourceSets") as SourceSetContainer
|
||||
from(srcSets[sourceSetName].resources.srcDirs)
|
||||
into(layout.buildDirectory.dir("resources-processed/$mcVersion"))
|
||||
|
||||
include("**/*.yml")
|
||||
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
filesMatching("plugin.yml") {
|
||||
expand(
|
||||
mapOf(
|
||||
"version" to project.version,
|
||||
"version" to project.version.toString(),
|
||||
"mainClass" to "no.jckf.dhsupport.bukkit.DhSupportBukkitPlugin",
|
||||
"mcApiVersion" to apiVersion,
|
||||
"mcApiVersion" to "1.19"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
configurations.maybeCreate("compileOnly$mcVersion").apply {
|
||||
isCanBeResolved = true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
add("compileOnly", "com.destroystokyo.paper:paper-api:${mcVersion}-R0.1-SNAPSHOT")
|
||||
//compileOnly("io.papermc.paper:paper-api:${mcVersion}-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
tasks.register<ShadowJar>(taskName) {
|
||||
group = "build"
|
||||
|
||||
archiveBaseName.set("DistantHorizonsSupport")
|
||||
archiveVersion.set(version.toString())
|
||||
destinationDirectory.set(outputDir)
|
||||
|
||||
// Use processed resources as input
|
||||
// Exclude raw YAML to avoid unprocessed plugin.yml in final JAR
|
||||
val srcSets = project.extensions.getByName("sourceSets") as SourceSetContainer
|
||||
from(srcSets["main"].output) {
|
||||
exclude("**/*.yml")
|
||||
}
|
||||
|
||||
from(layout.buildDirectory.dir("resources-processed/$mcVersion"))
|
||||
|
||||
configurations = listOf(project.configurations.getByName("shade"))
|
||||
|
||||
relocate("org.bstats", "no.jckf.dhsupport.bstats")
|
||||
relocate("org.json", "no.jckf.dhsupport.json")
|
||||
relocate("org.tukaani.xz", "no.jckf.dhsupport.xz")
|
||||
relocate("com.tcoded.folialib", "no.jckf.dhsupport.folialib")
|
||||
|
||||
exclude("org/jetbrains/**")
|
||||
exclude("org/intellij/**")
|
||||
|
||||
dependsOn(processTask)
|
||||
}
|
||||
|
||||
tasks.named("build") {
|
||||
dependsOn(taskName)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
archiveFileName.set("Distant-Horizons-Server.jar")
|
||||
|
||||
configurations = listOf(project.configurations.getByName("shade"))
|
||||
|
||||
relocate("org.bstats", "no.jckf.dhsupport.bstats")
|
||||
relocate("org.json", "no.jckf.dhsupport.json")
|
||||
relocate("org.tukaani.xz", "no.jckf.dhsupport.xz")
|
||||
relocate("com.tcoded.folialib", "no.jckf.dhsupport.folialib")
|
||||
|
||||
exclude("org/jetbrains/**")
|
||||
exclude("org/intellij/**")
|
||||
}
|
||||
|
||||
tasks.named("build") {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import no.jckf.dhsupport.bukkit.handler.PluginMessageProxy;
|
||||
import no.jckf.dhsupport.bukkit.handler.WorldHandler;
|
||||
import no.jckf.dhsupport.core.DhSupport;
|
||||
import no.jckf.dhsupport.core.configuration.DhsConfig;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@@ -38,8 +37,6 @@ public class DhSupportBukkitPlugin extends JavaPlugin
|
||||
{
|
||||
protected DhSupport dhSupport;
|
||||
|
||||
protected Metrics metrics;
|
||||
|
||||
protected ConfigLoader configLoader;
|
||||
|
||||
protected PluginMessageProxy pluginMessageProxy;
|
||||
@@ -66,8 +63,6 @@ public class DhSupportBukkitPlugin extends JavaPlugin
|
||||
this.dhSupport.setLogger(this.getLogger());
|
||||
this.dhSupport.setDataDirectory(this.getDataFolder().getAbsolutePath());
|
||||
|
||||
this.metrics = new Metrics(this, 21843);
|
||||
|
||||
this.loadDhsConfig();
|
||||
|
||||
this.pluginMessageProxy = new PluginMessageProxy(this);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: DHSupport
|
||||
name: Distant-Horizons-Server
|
||||
version: ${version}
|
||||
main: ${mainClass}
|
||||
api-version: 1.19
|
||||
api-version: ${mcApiVersion}
|
||||
prefix: DHS
|
||||
folia-supported: false
|
||||
author: Jckf
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
/*
|
||||
* DH Support, server-side support for Distant Horizons.
|
||||
* Copyright (C) 2024 Jim C K Flaten
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import no.jckf.dhsupport.core.Utils;
|
||||
import no.jckf.dhsupport.core.bytestream.Decoder;
|
||||
import no.jckf.dhsupport.core.bytestream.Encoder;
|
||||
import no.jckf.dhsupport.core.dataobject.DataPoint;
|
||||
|
||||
public class DataPointTest extends TestCase
|
||||
{
|
||||
private DataPoint dataPoint = new DataPoint();
|
||||
|
||||
public void testMappingId()
|
||||
{
|
||||
int randomNumber = (int) Math.floor(Math.random() * 100);
|
||||
|
||||
this.dataPoint.setMappingId(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.dataPoint.getMappingId());
|
||||
}
|
||||
|
||||
public void testMappingIdAgain()
|
||||
{
|
||||
this.testMappingId();
|
||||
}
|
||||
|
||||
public void testHeight()
|
||||
{
|
||||
int randomNumber = (int) Math.floor(Math.random() * 10);
|
||||
|
||||
this.dataPoint.setHeight(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.dataPoint.getHeight());
|
||||
}
|
||||
|
||||
public void testHeightAgain()
|
||||
{
|
||||
this.testHeight();
|
||||
}
|
||||
|
||||
public void testPositiveStartY()
|
||||
{
|
||||
int randomNumber = (int) Math.floor(Math.random() * 100);
|
||||
|
||||
this.dataPoint.setStartY(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.dataPoint.getStartY());
|
||||
}
|
||||
|
||||
public void testNegativeStartY()
|
||||
{
|
||||
int randomNumber = (int) Math.floor(0 - Math.random() * 100);
|
||||
|
||||
this.dataPoint.setStartY(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.dataPoint.getStartY());
|
||||
}
|
||||
|
||||
public void testStartYAgain()
|
||||
{
|
||||
this.testPositiveStartY();
|
||||
}
|
||||
|
||||
public void testSkyLight()
|
||||
{
|
||||
byte randomNumber = (byte) Math.floor(Math.random() * 15);
|
||||
|
||||
this.dataPoint.setSkyLight(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.dataPoint.getSkyLight());
|
||||
}
|
||||
|
||||
public void testSkyLightAgain()
|
||||
{
|
||||
this.testSkyLight();
|
||||
}
|
||||
|
||||
public void testBlockLight()
|
||||
{
|
||||
byte randomNumber = (byte) Math.floor(Math.random() * 15);
|
||||
|
||||
this.dataPoint.setBlockLight(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.dataPoint.getBlockLight());
|
||||
}
|
||||
|
||||
public void testBlockLightAgain()
|
||||
{
|
||||
this.testBlockLight();
|
||||
}
|
||||
|
||||
public void testEncodeDecode()
|
||||
{
|
||||
int mappingId = (int) Math.floor(Math.random() * 100);
|
||||
int height = (int) Math.floor(Math.random() * 10);
|
||||
int startY = (int) Math.floor(Math.random() * 100);
|
||||
byte skyLight = (byte) Math.floor(Math.random() * 15);
|
||||
byte blockLight = (byte) Math.floor(Math.random() * 15);
|
||||
|
||||
// Set them in reverse order of how they appear in the packed long. This will reveal any accidental overwrites.
|
||||
this.dataPoint.setBlockLight(blockLight);
|
||||
this.dataPoint.setSkyLight(skyLight);
|
||||
this.dataPoint.setStartY(startY);
|
||||
this.dataPoint.setHeight(height);
|
||||
this.dataPoint.setMappingId(mappingId);
|
||||
|
||||
Encoder encoder = new Encoder();
|
||||
|
||||
this.dataPoint.encode(encoder);
|
||||
|
||||
this.dataPoint = new DataPoint();
|
||||
|
||||
Decoder decoder = new Decoder(encoder.toByteArray());
|
||||
|
||||
this.dataPoint.decode(decoder);
|
||||
|
||||
assertEquals("Block light", blockLight, this.dataPoint.getBlockLight());
|
||||
assertEquals("Sky light", skyLight, this.dataPoint.getSkyLight());
|
||||
assertEquals("Start Y", startY, this.dataPoint.getStartY());
|
||||
assertEquals("Height", height, this.dataPoint.getHeight());
|
||||
assertEquals("Mapping ID", mappingId, this.dataPoint.getMappingId());
|
||||
}
|
||||
|
||||
public void testBinary()
|
||||
{
|
||||
this.dataPoint = new DataPoint();
|
||||
|
||||
this.dataPoint.setMappingId(1);
|
||||
Encoder mappingIdEncoder = new Encoder();
|
||||
this.dataPoint.encode(mappingIdEncoder);
|
||||
this.dataPoint.setMappingId(0);
|
||||
|
||||
this.dataPoint.setHeight(1);
|
||||
Encoder heightEncoder = new Encoder();
|
||||
this.dataPoint.encode(heightEncoder);
|
||||
this.dataPoint.setHeight(0);
|
||||
|
||||
this.dataPoint.setStartY(1);
|
||||
Encoder startYEncoder = new Encoder();
|
||||
this.dataPoint.encode(startYEncoder);
|
||||
this.dataPoint.setStartY(0);
|
||||
|
||||
this.dataPoint.setSkyLight((byte) 1);
|
||||
Encoder skyLightEncoder = new Encoder();
|
||||
this.dataPoint.encode(skyLightEncoder);
|
||||
this.dataPoint.setSkyLight((byte) 0);
|
||||
|
||||
this.dataPoint.setBlockLight((byte) 1);
|
||||
Encoder blockLightEncoder = new Encoder();
|
||||
this.dataPoint.encode(blockLightEncoder);
|
||||
this.dataPoint.setBlockLight((byte) 0);
|
||||
|
||||
// | Blk| Sky| Start Y| Height| Mapping ID|
|
||||
assertEquals("Mapping ID", "0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001", Utils.bytesToBin(mappingIdEncoder.toByteArray()));
|
||||
assertEquals("Height", "0000 0000 0000 0000 0000 0000 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000", Utils.bytesToBin(heightEncoder.toByteArray()));
|
||||
assertEquals("StartY", "0000 0000 0000 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000", Utils.bytesToBin(startYEncoder.toByteArray()));
|
||||
assertEquals("Sky light", "0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000", Utils.bytesToBin(skyLightEncoder.toByteArray()));
|
||||
assertEquals("Block light", "0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000", Utils.bytesToBin(blockLightEncoder.toByteArray()));
|
||||
}
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
/*
|
||||
* DH Support, server-side support for Distant Horizons.
|
||||
* Copyright (C) 2024 Jim C K Flaten
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import no.jckf.dhsupport.core.Utils;
|
||||
import no.jckf.dhsupport.core.bytestream.Decoder;
|
||||
import no.jckf.dhsupport.core.bytestream.Encoder;
|
||||
import no.jckf.dhsupport.core.dataobject.SectionPosition;
|
||||
|
||||
public class SectionPositionTest extends TestCase
|
||||
{
|
||||
protected SectionPosition sectionPosition = new SectionPosition();
|
||||
|
||||
public void testDetailLevel()
|
||||
{
|
||||
int randomNumber = (int) Math.ceil(Math.random() * 6);
|
||||
|
||||
this.sectionPosition.setDetailLevel(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.sectionPosition.getDetailLevel());
|
||||
}
|
||||
|
||||
public void testDetailLevelAgain()
|
||||
{
|
||||
this.testDetailLevel();
|
||||
}
|
||||
|
||||
public void testPositiveX()
|
||||
{
|
||||
int randomNumber = (int) Math.ceil(Math.random() * 100000);
|
||||
|
||||
this.sectionPosition.setX(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.sectionPosition.getX());
|
||||
}
|
||||
|
||||
public void testNegativeX()
|
||||
{
|
||||
int randomNumber = (int) Math.ceil(0 - Math.random() * 100000);
|
||||
|
||||
this.sectionPosition.setX(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.sectionPosition.getX());
|
||||
}
|
||||
|
||||
public void testXAgain()
|
||||
{
|
||||
this.testPositiveX();
|
||||
}
|
||||
|
||||
public void testPositiveZ()
|
||||
{
|
||||
int randomNumber = (int) Math.ceil(Math.random() * 100000);
|
||||
|
||||
this.sectionPosition.setZ(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.sectionPosition.getZ());
|
||||
}
|
||||
|
||||
public void testNegativeZ()
|
||||
{
|
||||
int randomNumber = (int) Math.ceil(0 - Math.random() * 100000);
|
||||
|
||||
this.sectionPosition.setZ(randomNumber);
|
||||
|
||||
assertEquals(randomNumber, this.sectionPosition.getZ());
|
||||
}
|
||||
|
||||
public void testZAgain()
|
||||
{
|
||||
this.testPositiveZ();
|
||||
}
|
||||
|
||||
public void testEncodeDecode()
|
||||
{
|
||||
int detailLevel = (int) Math.ceil(Math.random() * 6);
|
||||
int x = (int) Math.ceil(Math.random() * 100000);
|
||||
int z = (int) Math.ceil(Math.random() * 100000);
|
||||
|
||||
this.sectionPosition.setDetailLevel(detailLevel);
|
||||
this.sectionPosition.setX(x);
|
||||
this.sectionPosition.setZ(z);
|
||||
|
||||
Encoder encoder = new Encoder();
|
||||
|
||||
this.sectionPosition.encode(encoder);
|
||||
|
||||
this.sectionPosition = new SectionPosition();
|
||||
|
||||
Decoder decoder = new Decoder(encoder.toByteArray());
|
||||
|
||||
this.sectionPosition.decode(decoder);
|
||||
|
||||
assertEquals("Detail level", detailLevel, this.sectionPosition.getDetailLevel());
|
||||
assertEquals("X coordinate", x, this.sectionPosition.getX());
|
||||
assertEquals("Z coordinate", z, this.sectionPosition.getZ());
|
||||
}
|
||||
|
||||
public void testBinary()
|
||||
{
|
||||
this.sectionPosition = new SectionPosition();
|
||||
|
||||
this.sectionPosition.setDetailLevel(1);
|
||||
Encoder detailLevelEncoder = new Encoder();
|
||||
this.sectionPosition.encode(detailLevelEncoder);
|
||||
byte[] detailLevelBytes = detailLevelEncoder.toByteArray();
|
||||
this.sectionPosition.setDetailLevel(0);
|
||||
|
||||
this.sectionPosition.setX(1);
|
||||
Encoder xEncoder = new Encoder();
|
||||
this.sectionPosition.encode(xEncoder);
|
||||
byte[] xBytes = xEncoder.toByteArray();
|
||||
this.sectionPosition.setX(0);
|
||||
|
||||
this.sectionPosition.setX(-1);
|
||||
Encoder negativeXEncoder = new Encoder();
|
||||
this.sectionPosition.encode(negativeXEncoder);
|
||||
byte[] negativeXBytes = negativeXEncoder.toByteArray();
|
||||
this.sectionPosition.setX(0);
|
||||
|
||||
this.sectionPosition.setZ(1);
|
||||
Encoder zEncoder = new Encoder();
|
||||
this.sectionPosition.encode(zEncoder);
|
||||
byte[] zBytes = zEncoder.toByteArray();
|
||||
this.sectionPosition.setZ(0);
|
||||
|
||||
this.sectionPosition.setZ(-1);
|
||||
Encoder negativeZEncoder = new Encoder();
|
||||
this.sectionPosition.encode(negativeZEncoder);
|
||||
byte[] negativeZBytes = negativeZEncoder.toByteArray();
|
||||
this.sectionPosition.setZ(0);
|
||||
|
||||
// | Z| X| Detail|
|
||||
assertEquals("Detail level", "0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001", Utils.bytesToBin(detailLevelBytes));
|
||||
assertEquals("X coordinate", "0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 0000 0000", Utils.bytesToBin(xBytes));
|
||||
assertEquals("Negative X coordinate", "0000 0000 0000 0000 0000 0000 0000 1111 1111 1111 1111 1111 1111 1111 0000 0000", Utils.bytesToBin(negativeXBytes));
|
||||
assertEquals("Z coordinate", "0000 0000 0000 0000 0000 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000", Utils.bytesToBin(zBytes));
|
||||
assertEquals("Negative Z coordinate", "1111 1111 1111 1111 1111 1111 1111 0000 0000 0000 0000 0000 0000 0000 0000 0000", Utils.bytesToBin(negativeZBytes));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user