use java8 to build

master
InkerBot 3 months ago
parent f1545e1e8d
commit 23f1ae53b5

@ -3,7 +3,7 @@ plugins {
id 'maven-publish' id 'maven-publish'
} }
group 'net.william278' group 'org.inksnow.husk'
version '1.0' version '1.0'
repositories { repositories {
@ -14,6 +14,12 @@ repositories {
} }
dependencies { dependencies {
// lombok
compileOnly 'org.projectlombok:lombok:1.18.34'
annotationProcessor 'org.projectlombok:lombok:1.18.34'
testCompileOnly 'org.projectlombok:lombok:1.18.34'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.34'
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
compileOnly 'org.jetbrains:annotations:23.0.0' compileOnly 'org.jetbrains:annotations:23.0.0'
@ -22,6 +28,16 @@ dependencies {
} }
publishing { publishing {
repositories {
maven {
name = 'husk-release'
url = findProperty("repository.huskrelease.url")
credentials {
username = findProperty("repository.huskrelease.username")
password = findProperty("repository.huskrelease.password")
}
}
}
publications { publications {
gpr(MavenPublication) { gpr(MavenPublication) {
from(components.java) from(components.java)

@ -0,0 +1,14 @@
lombok.accessors.fluent=true
lombok.accessors.chain=true
lombok.builder.className=Builder
lombok.log.fieldName=logger
lombok.log.custom.flagUsage=error
lombok.log.apacheCommons.flagUsage=error
lombok.log.flogger.flagUsage=error
lombok.log.jbosslog.flagUsage=error
lombok.log.javaUtilLogging.flagUsage=error
lombok.log.log4j.flagUsage=error
lombok.log.log4j2.flagUsage=error
lombok.log.xslf4j.flagUsage=error

@ -1,5 +1,8 @@
package me.william278.husksync.bukkit.data; package me.william278.husksync.bukkit.data;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.Value;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Statistic; import org.bukkit.Statistic;
import org.bukkit.World; import org.bukkit.World;
@ -19,38 +22,58 @@ public class DataSerializer {
* *
* @deprecated Old format - Use {@link AdvancementRecordDate} instead * @deprecated Old format - Use {@link AdvancementRecordDate} instead
*/ */
@Value
@Deprecated @Deprecated
@SuppressWarnings("DeprecatedIsStillUsed") @SuppressWarnings("DeprecatedIsStillUsed")
// Suppress deprecation warnings here (still used for backwards compatibility) // Suppress deprecation warnings here (still used for backwards compatibility)
public record AdvancementRecord(String advancementKey, public static class AdvancementRecord implements Serializable {
ArrayList<String> awardedAdvancementCriteria) implements Serializable { String advancementKey;
ArrayList<String> awardedAdvancementCriteria;
} }
/** /**
* A record used to store data for a player's statistics * A record used to store data for a player's statistics
*/ */
public record StatisticData(HashMap<Statistic, Integer> untypedStatisticValues, @Value
HashMap<Statistic, HashMap<Material, Integer>> blockStatisticValues, public static class StatisticData implements Serializable {
HashMap<Statistic, HashMap<Material, Integer>> itemStatisticValues, HashMap<Statistic, Integer> untypedStatisticValues;
HashMap<Statistic, HashMap<EntityType, Integer>> entityStatisticValues) implements Serializable { HashMap<Statistic, HashMap<Material, Integer>> blockStatisticValues;
HashMap<Statistic, HashMap<Material, Integer>> itemStatisticValues;
HashMap<Statistic, HashMap<EntityType, Integer>> entityStatisticValues;
} }
/** /**
* A record used to store data for native advancement synchronisation, tracking advancement date progress * A record used to store data for native advancement synchronisation, tracking advancement date progress
*/ */
public record AdvancementRecordDate(String key, Map<String, Date> criteriaMap) implements Serializable { @Value
@RequiredArgsConstructor
public static class AdvancementRecordDate implements Serializable {
String key;
Map<String, Date> criteriaMap;
public AdvancementRecordDate(String key, List<String> criteriaList) { public AdvancementRecordDate(String key, List<String> criteriaList) {
this(key, new HashMap<>() {{ this(key, fromStringList(criteriaList));
criteriaList.forEach(s -> put(s, Date.from(Instant.EPOCH))); }
}});
private static Map<String, Date> fromStringList(List<String> criteriaList) {
Map<String, Date> criteriaMap = new HashMap<>();
criteriaList.forEach(s -> criteriaMap.put(s, Date.from(Instant.EPOCH)));
return criteriaMap;
} }
} }
/** /**
* A record used to store data for a player's location * A record used to store data for a player's location
*/ */
public record PlayerLocation(double x, double y, double z, float yaw, float pitch, @Value
String worldName, World.Environment environment) implements Serializable { public static class PlayerLocation implements Serializable {
double x;
double y;
double z;
float yaw;
float pitch;
String worldName;
World.Environment environment;
} }
} }

@ -11,6 +11,7 @@ import java.util.ArrayList;
import java.util.Base64; import java.util.Base64;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
@ -80,7 +81,7 @@ public class HSLConverter {
.map(o -> new DataSerializer.AdvancementRecordDate( .map(o -> new DataSerializer.AdvancementRecordDate(
o.advancementKey(), o.advancementKey(),
o.awardedAdvancementCriteria() o.awardedAdvancementCriteria()
)).toList(); )).collect(Collectors.toList());
} }
return (List<DataSerializer.AdvancementRecordDate>) deserialize; return (List<DataSerializer.AdvancementRecordDate>) deserialize;

Loading…
Cancel
Save