Skip to content

Commit 3e2a439

Browse files
author
david
committed
Refactor brush settings to remove Lombok and add constructors.
Replaced Lombok annotations with explicit getter methods and constructors for better control and readability. Updated `CraftItemBrushSettings` to use a constructor instead of a builder, affecting its initialization structure. Adjusted related code to align with these changes.
1 parent f895a1c commit 3e2a439

File tree

3 files changed

+162
-21
lines changed

3 files changed

+162
-21
lines changed

src/main/java/net/thenextlvl/gopaint/brush/CraftBrushController.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,8 @@ public Optional<ItemBrushSettings> parseBrushSettings(ItemStack itemStack) {
9898
.filter(Objects::nonNull)
9999
.toList();
100100

101-
return Optional.of(CraftItemBrushSettings.builder()
102-
.brushSize(brushSize)
103-
.maskEnabled(maskEnabled)
104-
.surfaceMode(surfaceMode)
105-
.brush(brush)
106-
.chance(chance)
107-
.thickness(thickness)
108-
.fractureStrength(fractureStrength)
109-
.angleDistance(angleDistance)
110-
.falloffStrength(falloffStrength)
111-
.mixingStrength(mixingStrength)
112-
.angleHeightDifference(angleHeightDifference)
113-
.axis(axis)
114-
.mask(mask)
115-
.blocks(blocks).build());
101+
return Optional.of(new CraftItemBrushSettings(brush, mask, blocks, axis, surfaceMode, maskEnabled, brushSize,
102+
chance, thickness, angleDistance, fractureStrength, falloffStrength, mixingStrength, angleHeightDifference));
116103
}
117104

118105
@Override

src/main/java/net/thenextlvl/gopaint/brush/setting/CraftItemBrushSettings.java

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
package net.thenextlvl.gopaint.brush.setting;
2020

21-
import lombok.Builder;
22-
import lombok.Getter;
2321
import net.thenextlvl.gopaint.api.brush.PatternBrush;
2422
import net.thenextlvl.gopaint.api.brush.setting.ItemBrushSettings;
2523
import net.thenextlvl.gopaint.api.model.SurfaceMode;
@@ -30,9 +28,7 @@
3028
import java.util.List;
3129
import java.util.Random;
3230

33-
@Getter
3431
@NullMarked
35-
@Builder(builderClassName = "Builder")
3632
public final class CraftItemBrushSettings implements ItemBrushSettings {
3733
private final PatternBrush brush;
3834
private final Material mask;
@@ -51,8 +47,96 @@ public final class CraftItemBrushSettings implements ItemBrushSettings {
5147

5248
private static final Random random = new Random();
5349

50+
public CraftItemBrushSettings(PatternBrush brush, Material mask, List<Material> blocks, Axis axis, SurfaceMode surfaceMode,
51+
boolean maskEnabled, int brushSize, int chance, int thickness, int angleDistance,
52+
int fractureStrength, int falloffStrength, int mixingStrength, double angleHeightDifference) {
53+
this.brush = brush;
54+
this.mask = mask;
55+
this.blocks = blocks;
56+
this.axis = axis;
57+
this.surfaceMode = surfaceMode;
58+
this.maskEnabled = maskEnabled;
59+
this.brushSize = brushSize;
60+
this.chance = chance;
61+
this.thickness = thickness;
62+
this.angleDistance = angleDistance;
63+
this.fractureStrength = fractureStrength;
64+
this.falloffStrength = falloffStrength;
65+
this.mixingStrength = mixingStrength;
66+
this.angleHeightDifference = angleHeightDifference;
67+
}
68+
5469
@Override
5570
public Random getRandom() {
5671
return random;
5772
}
73+
74+
public PatternBrush getBrush() {
75+
return this.brush;
76+
}
77+
78+
@Override
79+
public Material getMask() {
80+
return this.mask;
81+
}
82+
83+
@Override
84+
public List<Material> getBlocks() {
85+
return this.blocks;
86+
}
87+
88+
@Override
89+
public Axis getAxis() {
90+
return this.axis;
91+
}
92+
93+
@Override
94+
public SurfaceMode getSurfaceMode() {
95+
return this.surfaceMode;
96+
}
97+
98+
@Override
99+
public boolean isMaskEnabled() {
100+
return this.maskEnabled;
101+
}
102+
103+
@Override
104+
public int getBrushSize() {
105+
return this.brushSize;
106+
}
107+
108+
@Override
109+
public int getChance() {
110+
return this.chance;
111+
}
112+
113+
@Override
114+
public int getThickness() {
115+
return this.thickness;
116+
}
117+
118+
@Override
119+
public int getAngleDistance() {
120+
return this.angleDistance;
121+
}
122+
123+
@Override
124+
public int getFractureStrength() {
125+
return this.fractureStrength;
126+
}
127+
128+
@Override
129+
public int getFalloffStrength() {
130+
return this.falloffStrength;
131+
}
132+
133+
@Override
134+
public int getMixingStrength() {
135+
return this.mixingStrength;
136+
}
137+
138+
@Override
139+
public double getAngleHeightDifference() {
140+
return this.angleHeightDifference;
141+
}
58142
}

src/main/java/net/thenextlvl/gopaint/brush/setting/CraftPlayerBrushSettings.java

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import core.paper.gui.AbstractGUI;
2222
import io.papermc.paper.datacomponent.DataComponentTypes;
2323
import io.papermc.paper.datacomponent.item.ItemLore;
24-
import lombok.Getter;
2524
import net.kyori.adventure.key.Key;
2625
import net.kyori.adventure.text.Component;
2726
import net.kyori.adventure.text.JoinConfiguration;
@@ -57,7 +56,6 @@
5756
import java.util.Random;
5857
import java.util.stream.Collectors;
5958

60-
@Getter
6159
@NullMarked
6260
public final class CraftPlayerBrushSettings implements PlayerBrushSettings {
6361
private static final Random random = new Random();
@@ -344,4 +342,76 @@ public void importSettings(ItemBrushSettings settings) {
344342
setMask(settings.getMask());
345343
setBlocks(settings.getBlocks());
346344
}
345+
346+
public GoPaintPlugin getPlugin() {
347+
return this.plugin;
348+
}
349+
350+
public Player getPlayer() {
351+
return this.player;
352+
}
353+
354+
public boolean isEnabled() {
355+
return this.enabled;
356+
}
357+
358+
public int getBrushSize() {
359+
return this.brushSize;
360+
}
361+
362+
public int getChance() {
363+
return this.chance;
364+
}
365+
366+
public int getThickness() {
367+
return this.thickness;
368+
}
369+
370+
public int getFractureStrength() {
371+
return this.fractureStrength;
372+
}
373+
374+
public int getAngleDistance() {
375+
return this.angleDistance;
376+
}
377+
378+
public int getFalloffStrength() {
379+
return this.falloffStrength;
380+
}
381+
382+
public int getMixingStrength() {
383+
return this.mixingStrength;
384+
}
385+
386+
public double getAngleHeightDifference() {
387+
return this.angleHeightDifference;
388+
}
389+
390+
public Axis getAxis() {
391+
return this.axis;
392+
}
393+
394+
public boolean isMaskEnabled() {
395+
return this.maskEnabled;
396+
}
397+
398+
public SurfaceMode getSurfaceMode() {
399+
return this.surfaceMode;
400+
}
401+
402+
public PatternBrush getBrush() {
403+
return this.brush;
404+
}
405+
406+
public Material getMask() {
407+
return this.mask;
408+
}
409+
410+
public List<Material> getBlocks() {
411+
return this.blocks;
412+
}
413+
414+
public MainMenu getMainMenu() {
415+
return this.mainMenu;
416+
}
347417
}

0 commit comments

Comments
 (0)