2525import net .kyori .adventure .text .format .NamedTextColor ;
2626import net .kyori .adventure .text .format .Style ;
2727import net .kyori .adventure .text .format .TextDecoration ;
28+ import net .thenextlvl .gopaint .GoPaintPlugin ;
2829import net .thenextlvl .gopaint .objects .brush .*;
29- import net .thenextlvl .gopaint .objects .other .Settings ;
3030import net .thenextlvl .gopaint .objects .other .SurfaceMode ;
3131import net .thenextlvl .gopaint .utils .GUI ;
3232import org .bukkit .Axis ;
5050@ Accessors (fluent = true )
5151public final class PlayerBrush implements BrushSettings {
5252
53- private final PlayerBrushManager brushManager ;
53+ private final GoPaintPlugin plugin ;
5454 private final Random random = new SecureRandom ();
5555
5656 private boolean maskEnabled ;
@@ -72,23 +72,23 @@ public final class PlayerBrush implements BrushSettings {
7272
7373 private final Inventory gui ;
7474
75- public PlayerBrush (PlayerBrushManager brushManager ) {
76- this .brushManager = brushManager ;
77-
78- surfaceMode = Settings . settings ().GENERIC . SURFACE_MODE ;
79- maskEnabled = Settings . settings ().GENERIC . MASK_ENABLED ;
80- enabled = Settings . settings ().GENERIC . ENABLED_BY_DEFAULT ;
81- chance = Settings . settings ().GENERIC . DEFAULT_CHANCE ;
82- thickness = Settings . settings ().THICKNESS . DEFAULT_THICKNESS ;
83- fractureDistance = Settings . settings ().FRACTURE . DEFAULT_FRACTURE_DISTANCE ;
84- angleDistance = Settings . settings ().ANGLE . DEFAULT_ANGLE_DISTANCE ;
85- angleHeightDifference = Settings . settings ().ANGLE . DEFAULT_ANGLE_HEIGHT_DIFFERENCE ;
86- falloffStrength = Settings . settings ().GENERIC . DEFAULT_FALLOFF_STRENGTH ;
87- mixingStrength = Settings . settings ().GENERIC . DEFAULT_MIXING_STRENGTH ;
88- axis = Settings . settings ().GENERIC . DEFAULT_AXIS ;
89- size = Settings . settings ().GENERIC . DEFAULT_SIZE ;
90- mask = Settings . settings ().GENERIC . DEFAULT_MASK ;
91- brush = brushManager .cycleForward (null );
75+ public PlayerBrush (GoPaintPlugin plugin ) {
76+ this .plugin = plugin ;
77+
78+ surfaceMode = plugin . config ().generic (). surfaceMode () ;
79+ maskEnabled = plugin . config ().generic (). maskEnabled () ;
80+ enabled = plugin . config ().generic (). enabledByDefault () ;
81+ chance = plugin . config ().generic (). defaultChance () ;
82+ thickness = plugin . config ().thickness (). defaultThickness () ;
83+ fractureDistance = plugin . config ().fracture (). defaultFractureDistance () ;
84+ angleDistance = plugin . config ().angle (). defaultAngleDistance () ;
85+ angleHeightDifference = plugin . config ().angle (). defaultAngleHeightDifference () ;
86+ falloffStrength = plugin . config ().generic (). defaultFalloffStrength () ;
87+ mixingStrength = plugin . config ().generic (). defaultMixingStrength () ;
88+ axis = plugin . config ().generic (). defaultAxis () ;
89+ size = plugin . config ().generic (). defaultSize () ;
90+ mask = plugin . config ().generic (). defaultMask () ;
91+ brush = plugin . brushManager () .cycleForward (null );
9292 blocks .add (Material .STONE );
9393 gui = GUI .create (this );
9494 }
@@ -151,20 +151,20 @@ public void removeBlock(int slot) {
151151 }
152152
153153 public void cycleBrushForward () {
154- brush = brushManager .cycleForward (brush );
154+ brush = plugin . brushManager () .cycleForward (brush );
155155 updateInventory ();
156156 }
157157
158158 public void cycleBrushBackwards () {
159- brush = brushManager .cycleBack (brush );
159+ brush = plugin . brushManager () .cycleBack (brush );
160160 updateInventory ();
161161 }
162162
163163 public void setSize (int size ) {
164- if (size <= Settings . settings ().GENERIC . MAX_SIZE && size > 0 ) {
164+ if (size <= plugin . config ().generic (). maxSize () && size > 0 ) {
165165 this .size = size ;
166- } else if (size > Settings . settings ().GENERIC . MAX_SIZE ) {
167- this .size = Settings . settings ().GENERIC . MAX_SIZE ;
166+ } else if (size > plugin . config ().generic (). maxSize () ) {
167+ this .size = plugin . config ().generic (). maxSize () ;
168168 } else {
169169 this .size = 1 ;
170170 }
@@ -177,13 +177,13 @@ public Inventory getInventory() {
177177
178178 public void increaseBrushSize (boolean x10 ) {
179179 if (x10 ) {
180- if (size + 10 <= Settings . settings ().GENERIC . MAX_SIZE ) {
180+ if (size + 10 <= plugin . config ().generic (). maxSize () ) {
181181 size += 10 ;
182182 } else {
183- size = Settings . settings ().GENERIC . MAX_SIZE ;
183+ size = plugin . config ().generic (). maxSize () ;
184184 }
185185 } else {
186- if (size < Settings . settings ().GENERIC . MAX_SIZE ) {
186+ if (size < plugin . config ().generic (). maxSize () ) {
187187 size += 1 ;
188188 }
189189 }
@@ -226,7 +226,7 @@ public void decreaseChance() {
226226 }
227227
228228 public void increaseThickness () {
229- if (thickness < Settings . settings ().THICKNESS . MAX_THICKNESS ) {
229+ if (thickness < plugin . config ().thickness (). maxThickness () ) {
230230 thickness += 1 ;
231231 }
232232 updateInventory ();
@@ -240,7 +240,7 @@ public void decreaseThickness() {
240240 }
241241
242242 public void increaseAngleDistance () {
243- if (angleDistance < Settings . settings ().ANGLE . MAX_ANGLE_DISTANCE ) {
243+ if (angleDistance < plugin . config ().angle (). maxAngleDistance () ) {
244244 angleDistance += 1 ;
245245 }
246246 updateInventory ();
@@ -254,7 +254,7 @@ public void decreaseAngleDistance() {
254254 }
255255
256256 public void increaseFractureDistance () {
257- if (this .fractureDistance < Settings . settings ().FRACTURE . MAX_FRACTURE_DISTANCE ) {
257+ if (this .fractureDistance < plugin . config ().fracture (). maxFractureDistance () ) {
258258 this .fractureDistance += 1 ;
259259 }
260260 updateInventory ();
@@ -273,8 +273,8 @@ public void increaseAngleHeightDifference(boolean d15) {
273273 } else {
274274 angleHeightDifference += 5.0 ;
275275 }
276- if (angleHeightDifference > Settings . settings ().ANGLE . MAX_ANGLE_HEIGHT_DIFFERENCE ) {
277- angleHeightDifference = Settings . settings ().ANGLE . MAX_ANGLE_HEIGHT_DIFFERENCE ;
276+ if (angleHeightDifference > plugin . config ().angle (). maxAngleHeightDifference () ) {
277+ angleHeightDifference = plugin . config ().angle (). maxAngleHeightDifference () ;
278278 }
279279 updateInventory ();
280280 }
@@ -285,8 +285,8 @@ public void decreaseAngleHeightDifference(boolean d15) {
285285 } else {
286286 angleHeightDifference -= 5.0 ;
287287 }
288- if (angleHeightDifference < Settings . settings ().ANGLE . MIN_ANGLE_HEIGHT_DIFFERENCE ) {
289- angleHeightDifference = Settings . settings ().ANGLE . MIN_ANGLE_HEIGHT_DIFFERENCE ;
288+ if (angleHeightDifference < plugin . config ().angle (). minAngleHeightDifference () ) {
289+ angleHeightDifference = plugin . config ().angle (). minAngleHeightDifference () ;
290290 }
291291 updateInventory ();
292292 }
0 commit comments