Skip to content

Commit 48d0c56

Browse files
authored
Merge pull request #80 from TheNextLvl-net/de-lombok
Remove Lombok dependency and inline generated methods
2 parents 6c47e64 + 3e2a439 commit 48d0c56

29 files changed

+421
-108
lines changed

api/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ repositories {
2525
}
2626

2727
dependencies {
28-
compileOnly("org.projectlombok:lombok:1.18.36")
2928
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
3029

3130
compileOnlyApi(platform("com.intellectualsites.bom:bom-newest:1.51"))
@@ -36,8 +35,6 @@ dependencies {
3635

3736
api("net.thenextlvl.core:i18n:1.0.20")
3837
api("net.thenextlvl.core:paper:2.0.3")
39-
40-
annotationProcessor("org.projectlombok:lombok:1.18.36")
4138
}
4239

4340
publishing {

api/src/main/java/net/thenextlvl/gopaint/api/brush/PatternBrush.java

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
import com.sk89q.worldedit.entity.Player;
77
import com.sk89q.worldedit.function.pattern.Pattern;
88
import com.sk89q.worldedit.math.BlockVector3;
9-
import lombok.EqualsAndHashCode;
10-
import lombok.Getter;
11-
import lombok.RequiredArgsConstructor;
12-
import lombok.ToString;
13-
import lombok.experimental.Accessors;
149
import net.kyori.adventure.audience.Audience;
1510
import net.kyori.adventure.key.Key;
1611
import net.kyori.adventure.key.Keyed;
@@ -19,14 +14,12 @@
1914
import org.jspecify.annotations.NonNull;
2015
import org.jspecify.annotations.NullMarked;
2116

17+
import java.util.Objects;
18+
2219
/**
2320
* This interface represents a brush used for painting blocks in a world.
2421
*/
25-
@Getter
26-
@ToString
2722
@NullMarked
28-
@EqualsAndHashCode
29-
@RequiredArgsConstructor
3023
public abstract class PatternBrush implements Comparable<PatternBrush>, Keyed, Brush {
3124
/**
3225
* Retrieves the base64 head value.
@@ -35,7 +28,12 @@ public abstract class PatternBrush implements Comparable<PatternBrush>, Keyed, B
3528
/**
3629
* The key that identifies this brush
3730
*/
38-
private final @Accessors(fluent = true) Key key;
31+
private final Key key;
32+
33+
public PatternBrush(String headValue, Key key) {
34+
this.headValue = headValue;
35+
this.key = key;
36+
}
3937

4038
/**
4139
* Retrieves the localized name of this brush.
@@ -76,8 +74,36 @@ public abstract class PatternBrush implements Comparable<PatternBrush>, Keyed, B
7674
@Override
7775
public abstract void build(EditSession session, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException;
7876

77+
public String getHeadValue() {
78+
return headValue;
79+
}
80+
81+
@Override
82+
public Key key() {
83+
return key;
84+
}
85+
7986
@Override
8087
public int compareTo(@NonNull PatternBrush brush) {
8188
return key().compareTo(brush.key());
8289
}
90+
91+
@Override
92+
public boolean equals(Object o) {
93+
if (o == null || getClass() != o.getClass()) return false;
94+
PatternBrush that = (PatternBrush) o;
95+
return Objects.equals(key, that.key);
96+
}
97+
98+
@Override
99+
public int hashCode() {
100+
return Objects.hashCode(key);
101+
}
102+
103+
@Override
104+
public String toString() {
105+
return "PatternBrush{" +
106+
"key=" + key +
107+
'}';
108+
}
83109
}

api/src/main/java/net/thenextlvl/gopaint/api/math/curve/BezierSpline.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020

2121
import com.fastasyncworldedit.core.math.MutableBlockVector3;
2222
import com.sk89q.worldedit.math.BlockVector3;
23-
import lombok.Getter;
2423
import org.jetbrains.annotations.Contract;
2524
import org.jspecify.annotations.NullMarked;
2625

2726
import java.util.Arrays;
2827
import java.util.List;
2928
import java.util.OptionalDouble;
3029

31-
@Getter
3230
@NullMarked
3331
public class BezierSpline {
3432

@@ -148,6 +146,18 @@ public void calculateControlPoints() {
148146
zFlat.ifPresent(value -> Arrays.stream(segments).forEach(segment -> segment.setZ(value)));
149147
}
150148

149+
public BezierSplineSegment[] getSegments() {
150+
return segments;
151+
}
152+
153+
public MutableBlockVector3[] getKnots() {
154+
return knots;
155+
}
156+
157+
public double getCurveLength() {
158+
return curveLength;
159+
}
160+
151161
@Override
152162
public String toString() {
153163
return knots.length + " points.";

api/src/main/java/net/thenextlvl/gopaint/api/math/curve/BezierSplineSegment.java

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,13 @@
2020

2121
import com.fastasyncworldedit.core.math.MutableBlockVector3;
2222
import com.sk89q.worldedit.math.BlockVector3;
23-
import lombok.Getter;
24-
import lombok.RequiredArgsConstructor;
25-
import lombok.Setter;
2623
import org.jetbrains.annotations.Contract;
2724
import org.jspecify.annotations.NullMarked;
2825
import org.jspecify.annotations.Nullable;
2926

3027
import java.util.Objects;
3128

32-
@Getter
33-
@Setter
3429
@NullMarked
35-
@RequiredArgsConstructor
3630
public class BezierSplineSegment {
3731

3832
private final MutableBlockVector3 startPoint;
@@ -49,6 +43,11 @@ public class BezierSplineSegment {
4943

5044
private MutableBlockVector3 result = MutableBlockVector3.at(0, 0, 0);
5145

46+
public BezierSplineSegment(MutableBlockVector3 startPoint, MutableBlockVector3 endPoint) {
47+
this.startPoint = startPoint;
48+
this.endPoint = endPoint;
49+
}
50+
5251
public void setX(double xFlat) {
5352
startPoint.mutX(xFlat);
5453
intermediatePoint1.mutX(xFlat);
@@ -104,4 +103,84 @@ private double calculatePoint(double factor, double startPoint, double intermedi
104103
return (Math.pow(1 - factor, 3) * startPoint) + (3 * Math.pow(1 - factor, 2) * factor * intermediatePoint1)
105104
+ (3 * (1 - factor) * factor * factor * intermediatePoint2) + (Math.pow(factor, 3) * endPoint);
106105
}
106+
107+
public MutableBlockVector3 getStartPoint() {
108+
return startPoint;
109+
}
110+
111+
public MutableBlockVector3 getEndPoint() {
112+
return endPoint;
113+
}
114+
115+
public MutableBlockVector3 getResult() {
116+
return result;
117+
}
118+
119+
public MutableBlockVector3 getIntermediatePoint1() {
120+
return intermediatePoint1;
121+
}
122+
123+
public MutableBlockVector3 getIntermediatePoint2() {
124+
return intermediatePoint2;
125+
}
126+
127+
public float getCoefficient1() {
128+
return coefficient1;
129+
}
130+
131+
public float getCoefficient2() {
132+
return coefficient2;
133+
}
134+
135+
public float getCoefficient3() {
136+
return coefficient3;
137+
}
138+
139+
public @Nullable Double getXFlat() {
140+
return xFlat;
141+
}
142+
143+
public @Nullable Double getYFlat() {
144+
return yFlat;
145+
}
146+
147+
public @Nullable Double getZFlat() {
148+
return zFlat;
149+
}
150+
151+
public void setResult(MutableBlockVector3 result) {
152+
this.result = result;
153+
}
154+
155+
public void setIntermediatePoint1(MutableBlockVector3 intermediatePoint1) {
156+
this.intermediatePoint1 = intermediatePoint1;
157+
}
158+
159+
public void setIntermediatePoint2(MutableBlockVector3 intermediatePoint2) {
160+
this.intermediatePoint2 = intermediatePoint2;
161+
}
162+
163+
public void setCoefficient1(float coefficient1) {
164+
this.coefficient1 = coefficient1;
165+
}
166+
167+
public void setCoefficient2(float coefficient2) {
168+
this.coefficient2 = coefficient2;
169+
}
170+
171+
public void setCoefficient3(float coefficient3) {
172+
this.coefficient3 = coefficient3;
173+
}
174+
175+
public void setXFlat(@Nullable Double xFlat) {
176+
this.xFlat = xFlat;
177+
}
178+
179+
public void setYFlat(@Nullable Double yFlat) {
180+
this.yFlat = yFlat;
181+
}
182+
183+
public void setZFlat(@Nullable Double zFlat) {
184+
this.zFlat = zFlat;
185+
}
107186
}

api/src/main/java/net/thenextlvl/gopaint/api/model/SurfaceMode.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
package net.thenextlvl.gopaint.api.model;
22

33
import com.fastasyncworldedit.core.function.mask.SurfaceMask;
4-
import lombok.Getter;
5-
import lombok.RequiredArgsConstructor;
6-
import lombok.experimental.Accessors;
74
import net.kyori.adventure.translation.Translatable;
85
import net.thenextlvl.gopaint.api.brush.mask.VisibleMask;
96
import org.jspecify.annotations.NullMarked;
107

11-
@Getter
128
@NullMarked
13-
@RequiredArgsConstructor
14-
@Accessors(fluent = true)
159
public enum SurfaceMode implements Translatable {
1610
/**
1711
* This enumeration represents that surface mode is disabled.
@@ -31,4 +25,13 @@ public enum SurfaceMode implements Translatable {
3125
VISIBLE("surface.mode.visible");
3226

3327
private final String translationKey;
28+
29+
SurfaceMode(String translationKey) {
30+
this.translationKey = translationKey;
31+
}
32+
33+
@Override
34+
public String translationKey() {
35+
return translationKey;
36+
}
3437
}

build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@ repositories {
2222
}
2323

2424
dependencies {
25-
compileOnly("org.projectlombok:lombok:1.18.36")
2625
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
2726

2827
implementation("net.thenextlvl.core:adapters:2.0.1")
2928
implementation("org.bstats:bstats-bukkit:3.1.0")
3029
implementation(project(":api"))
31-
32-
annotationProcessor("org.projectlombok:lombok:1.18.36")
3330
}
3431

3532
paper {

src/main/java/net/thenextlvl/gopaint/GoPaintPlugin.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import core.io.IO;
88
import core.paper.adapters.inventory.MaterialAdapter;
99
import core.paper.adapters.key.KeyAdapter;
10-
import lombok.Getter;
11-
import lombok.experimental.Accessors;
1210
import net.kyori.adventure.key.Key;
1311
import net.kyori.adventure.text.minimessage.MiniMessage;
1412
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
@@ -29,7 +27,6 @@
2927
import org.bukkit.Axis;
3028
import org.bukkit.Bukkit;
3129
import org.bukkit.Material;
32-
import org.bukkit.NamespacedKey;
3330
import org.bukkit.entity.Player;
3431
import org.bukkit.plugin.ServicePriority;
3532
import org.bukkit.plugin.java.JavaPlugin;
@@ -41,11 +38,9 @@
4138
import java.util.Set;
4239

4340
@NullMarked
44-
@Accessors(fluent = true)
4541
public class GoPaintPlugin extends JavaPlugin implements GoPaintProvider {
46-
4742
private final File translations = new File(getDataFolder(), "translations");
48-
private final @Getter ComponentBundle bundle = new ComponentBundle(translations, audience ->
43+
private final ComponentBundle bundle = new ComponentBundle(translations, audience ->
4944
audience instanceof Player player ? player.locale() : Locale.US)
5045
.register("messages", Locale.US)
5146
.register("messages_german", Locale.GERMANY)
@@ -54,11 +49,11 @@ public class GoPaintPlugin extends JavaPlugin implements GoPaintProvider {
5449
Placeholder.component("prefix", bundle.component(Locale.US, "prefix"))
5550
)).build());
5651

57-
private final @Getter BrushController brushController = new CraftBrushController(this);
58-
private final @Getter BrushRegistry brushRegistry = new CraftBrushRegistry(this);
52+
private final BrushController brushController = new CraftBrushController(this);
53+
private final BrushRegistry brushRegistry = new CraftBrushRegistry(this);
5954

6055
private final FileIO<PluginConfig> configFile = new GsonFile<>(IO.of(getDataFolder(), "config.json"), new PluginConfig(
61-
new PluginConfig.BrushConfig(Material.FEATHER, new NamespacedKey("gopaint", "sphere_brush"), 100, 10, 50,
56+
new PluginConfig.BrushConfig(Material.FEATHER, Key.key("gopaint", "sphere_brush"), 100, 10, 50,
6257
Axis.Y, 50, 50, Set.of("disabled"), true, Material.SPONGE, true, SurfaceMode.EXPOSED,
6358
List.of(Material.STONE)),
6459
new PluginConfig.ThicknessConfig(1, 5),
@@ -117,4 +112,16 @@ private void registerCommands() {
117112
public PluginConfig config() {
118113
return configFile.getRoot();
119114
}
115+
116+
public ComponentBundle bundle() {
117+
return this.bundle;
118+
}
119+
120+
public BrushController brushController() {
121+
return this.brushController;
122+
}
123+
124+
public BrushRegistry brushRegistry() {
125+
return this.brushRegistry;
126+
}
120127
}

0 commit comments

Comments
 (0)