Skip to content

Commit 392fc0d

Browse files
committed
feat(package): Changed package name
1 parent 256c38c commit 392fc0d

30 files changed

+573
-584
lines changed

src/main/java/xyz/xenondevs/particle/ParticleBuilder.java src/main/java/com/georgev22/particle/ParticleBuilder.java

+51-51
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
* SOFTWARE.
2323
*/
2424

25-
package xyz.xenondevs.particle;
25+
package com.georgev22.particle;
2626

27+
import com.georgev22.particle.data.ParticleData;
28+
import com.georgev22.particle.data.color.RegularColor;
29+
import com.georgev22.particle.utils.ReflectionUtils;
2730
import org.bukkit.Bukkit;
2831
import org.bukkit.Location;
2932
import org.bukkit.entity.Player;
3033
import org.bukkit.util.Vector;
31-
import xyz.xenondevs.particle.data.ParticleData;
32-
import xyz.xenondevs.particle.data.color.RegularColor;
33-
import xyz.xenondevs.particle.utils.ReflectionUtils;
3434

3535
import java.awt.*;
3636
import java.util.Arrays;
@@ -142,17 +142,6 @@ public ParticleEffect getParticle() {
142142
return particle;
143143
}
144144

145-
/**
146-
* Sets the {@link Location} of the particle.
147-
*
148-
* @param location The new {@link Location} of the particle.
149-
* @return the current instance to support building operations
150-
*/
151-
public ParticleBuilder setLocation(Location location) {
152-
this.location = location;
153-
return this;
154-
}
155-
156145
/**
157146
* The {@link Location} of the particle.
158147
*/
@@ -161,13 +150,13 @@ public Location getLocation() {
161150
}
162151

163152
/**
164-
* Sets the X offset.
153+
* Sets the {@link Location} of the particle.
165154
*
166-
* @param offsetX The new value of the {@link #offsetX} field
155+
* @param location The new {@link Location} of the particle.
167156
* @return the current instance to support building operations
168157
*/
169-
public ParticleBuilder setOffsetX(float offsetX) {
170-
this.offsetX = offsetX;
158+
public ParticleBuilder setLocation(Location location) {
159+
this.location = location;
171160
return this;
172161
}
173162

@@ -189,13 +178,13 @@ public float getOffsetX() {
189178
}
190179

191180
/**
192-
* Sets the Y offset.
181+
* Sets the X offset.
193182
*
194-
* @param offsetY The new value of the {@link #offsetY} field
183+
* @param offsetX The new value of the {@link #offsetX} field
195184
* @return the current instance to support building operations
196185
*/
197-
public ParticleBuilder setOffsetY(float offsetY) {
198-
this.offsetY = offsetY;
186+
public ParticleBuilder setOffsetX(float offsetX) {
187+
this.offsetX = offsetX;
199188
return this;
200189
}
201190

@@ -232,26 +221,26 @@ public float getOffsetY() {
232221
}
233222

234223
/**
235-
* Sets the offset.
224+
* Sets the Y offset.
236225
*
237-
* @param offset a {@link Vector} containing the offset values.
226+
* @param offsetY The new value of the {@link #offsetY} field
238227
* @return the current instance to support building operations
239228
*/
240-
public ParticleBuilder setOffset(Vector offset) {
241-
this.offsetX = (float) offset.getX();
242-
this.offsetY = (float) offset.getY();
243-
this.offsetZ = (float) offset.getZ();
229+
public ParticleBuilder setOffsetY(float offsetY) {
230+
this.offsetY = offsetY;
244231
return this;
245232
}
246233

247234
/**
248-
* Sets the Z offset.
235+
* Sets the offset.
249236
*
250-
* @param offsetZ The new value of the {@link #offsetZ} field
237+
* @param offset a {@link Vector} containing the offset values.
251238
* @return the current instance to support building operations
252239
*/
253-
public ParticleBuilder setOffsetZ(float offsetZ) {
254-
this.offsetZ = offsetZ;
240+
public ParticleBuilder setOffset(Vector offset) {
241+
this.offsetX = (float) offset.getX();
242+
this.offsetY = (float) offset.getY();
243+
this.offsetZ = (float) offset.getZ();
255244
return this;
256245
}
257246

@@ -273,13 +262,13 @@ public float getOffsetZ() {
273262
}
274263

275264
/**
276-
* Sets the speed.
265+
* Sets the Z offset.
277266
*
278-
* @param speed The new value of the {@link #speed} field
267+
* @param offsetZ The new value of the {@link #offsetZ} field
279268
* @return the current instance to support building operations
280269
*/
281-
public ParticleBuilder setSpeed(float speed) {
282-
this.speed = speed;
270+
public ParticleBuilder setOffsetZ(float offsetZ) {
271+
this.offsetZ = offsetZ;
283272
return this;
284273
}
285274

@@ -293,13 +282,13 @@ public float getSpeed() {
293282
}
294283

295284
/**
296-
* Sets the amount.
285+
* Sets the speed.
297286
*
298-
* @param amount The new value of the {@link #amount} field
287+
* @param speed The new value of the {@link #speed} field
299288
* @return the current instance to support building operations
300289
*/
301-
public ParticleBuilder setAmount(int amount) {
302-
this.amount = amount;
290+
public ParticleBuilder setSpeed(float speed) {
291+
this.speed = speed;
303292
return this;
304293
}
305294

@@ -312,13 +301,13 @@ public int getAmount() {
312301
}
313302

314303
/**
315-
* Sets the particleData.
304+
* Sets the amount.
316305
*
317-
* @param particleData The new value of the {@link #particleData} field
306+
* @param amount The new value of the {@link #amount} field
318307
* @return the current instance to support building operations
319308
*/
320-
public ParticleBuilder setParticleData(ParticleData particleData) {
321-
this.particleData = particleData;
309+
public ParticleBuilder setAmount(int amount) {
310+
this.amount = amount;
322311
return this;
323312
}
324313

@@ -330,6 +319,17 @@ public ParticleData getParticleData() {
330319
return particleData;
331320
}
332321

322+
/**
323+
* Sets the particleData.
324+
*
325+
* @param particleData The new value of the {@link #particleData} field
326+
* @return the current instance to support building operations
327+
*/
328+
public ParticleBuilder setParticleData(ParticleData particleData) {
329+
this.particleData = particleData;
330+
return this;
331+
}
332+
333333
/**
334334
* Sets the color of the particle. Note that particle
335335
* needs the {@link PropertyType#COLORABLE} PropertyType
@@ -365,7 +365,7 @@ public Object toPacket() {
365365
public void display() {
366366
Object packet = toPacket();
367367
Objects.requireNonNull(location.getWorld()).getPlayers()
368-
.forEach(p -> ReflectionUtils.sendPacket(p, packet));
368+
.forEach(p -> ReflectionUtils.sendPacket(p, packet));
369369
}
370370

371371
/**
@@ -386,9 +386,9 @@ public void display(Player... players) {
386386
public void display(Predicate<Player> filter) {
387387
Object packet = toPacket();
388388
Bukkit.getOnlinePlayers()
389-
.stream()
390-
.filter(p -> filter.test(p) && p.getWorld().equals(location.getWorld()))
391-
.forEach(p -> ReflectionUtils.sendPacket(p, packet));
389+
.stream()
390+
.filter(p -> filter.test(p) && p.getWorld().equals(location.getWorld()))
391+
.forEach(p -> ReflectionUtils.sendPacket(p, packet));
392392
}
393393

394394
/**
@@ -399,8 +399,8 @@ public void display(Predicate<Player> filter) {
399399
public void display(Collection<? extends Player> players) {
400400
Object packet = toPacket();
401401
players.stream()
402-
.filter(p -> p.getWorld().equals(location.getWorld()))
403-
.forEach(p -> ReflectionUtils.sendPacket(p, packet));
402+
.filter(p -> p.getWorld().equals(location.getWorld()))
403+
.forEach(p -> ReflectionUtils.sendPacket(p, packet));
404404
}
405405

406406
}

src/main/java/xyz/xenondevs/particle/ParticleConstants.java src/main/java/com/georgev22/particle/ParticleConstants.java

+34-34
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
* SOFTWARE.
2323
*/
2424

25-
package xyz.xenondevs.particle;
25+
package com.georgev22.particle;
2626

2727
import org.bukkit.inventory.ItemStack;
2828

2929
import java.lang.reflect.Constructor;
3030
import java.lang.reflect.Field;
3131
import java.lang.reflect.Method;
3232

33-
import static xyz.xenondevs.particle.ParticleMappings.*;
34-
import static xyz.xenondevs.particle.utils.ReflectionUtils.*;
33+
import static com.georgev22.particle.ParticleMappings.*;
34+
import static com.georgev22.particle.utils.ReflectionUtils.*;
3535

3636
/**
3737
* Constants for particles.
@@ -40,9 +40,9 @@
4040
* @since 10.06.2019
4141
*/
4242
public final class ParticleConstants {
43-
43+
4444
/* ---------------- Classes ---------------- */
45-
45+
4646
/**
4747
* Represents the ItemStack class.
4848
*/
@@ -167,9 +167,9 @@ public final class ParticleConstants {
167167
* Represents the ParticleParamSculkCharge class.
168168
*/
169169
public static final Class PARTICLE_PARAM_SCULK_CHARGE_CLASS;
170-
170+
171171
/* ---------------- Methods ---------------- */
172-
172+
173173
/**
174174
* Represents the IRegistry#get(MinecraftKey) method.
175175
*/
@@ -194,16 +194,16 @@ public final class ParticleConstants {
194194
* Represents the CraftItemStack#asNMSCopy(); method.
195195
*/
196196
public static final Method CRAFT_ITEM_STACK_AS_NMS_COPY_METHOD;
197-
197+
198198
/* ---------------- Fields ---------------- */
199-
199+
200200
/**
201201
* Represents the EntityPlayer#playerConnection field.
202202
*/
203203
public static final Field ENTITY_PLAYER_PLAYER_CONNECTION_FIELD;
204-
204+
205205
/* ---------------- Constructor ---------------- */
206-
206+
207207
/**
208208
* Represents the PacketPlayOutWorldParticles constructor.
209209
*/
@@ -260,10 +260,10 @@ public final class ParticleConstants {
260260
* Represents the ParticleParamSculkCharge constructor.
261261
*/
262262
public static final Constructor PARTICLE_PARAM_SCULK_CHARGE_CONSTRUCTOR;
263-
264-
263+
264+
265265
/* ---------------- Object constants ---------------- */
266-
266+
267267
/**
268268
* Represents the ParticleType Registry.
269269
*/
@@ -272,12 +272,12 @@ public final class ParticleConstants {
272272
* Represents the Block Registry.
273273
*/
274274
public static final Object BLOCK_REGISTRY;
275-
275+
276276
/* ---------------- INIT ---------------- */
277-
277+
278278
static {
279279
double version = MINECRAFT_VERSION;
280-
280+
281281
// Classes
282282
ITEM_STACK_CLASS = getMappedClass("ItemStack");
283283
PACKET_CLASS = getMappedClass("Packet");
@@ -310,26 +310,26 @@ public final class ParticleConstants {
310310
PARTICLE_PARAM_VIBRATION_CLASS = getMappedClass("ParticleParamVibration");
311311
PARTICLE_PARAM_SHRIEK_CLASS = getMappedClass("ParticleParamShriek");
312312
PARTICLE_PARAM_SCULK_CHARGE_CLASS = getMappedClass("ParticleParamSculkCharge");
313-
313+
314314
// Methods
315315
REGISTRY_GET_METHOD = getMappedMethod(REGISTRY_CLASS, "Registry.get", MINECRAFT_KEY_CLASS);
316316
PLAYER_CONNECTION_SEND_PACKET_METHOD = getMappedMethod(PLAYER_CONNECTION_CLASS, "PlayerConnection.sendPacket", PACKET_CLASS);
317317
CRAFT_ENTITY_GET_HANDLE_METHOD = getMethodOrNull(CRAFT_ENTITY_CLASS, "getHandle");
318318
CRAFT_PLAYER_GET_HANDLE_METHOD = getMethodOrNull(CRAFT_PLAYER_CLASS, "getHandle");
319319
BLOCK_GET_BLOCK_DATA_METHOD = getMappedMethod(BLOCK_CLASS, "Block.getBlockData");
320320
CRAFT_ITEM_STACK_AS_NMS_COPY_METHOD = getMethodOrNull(CRAFT_ITEM_STACK_CLASS, "asNMSCopy", ItemStack.class);
321-
321+
322322
// Fields
323323
ENTITY_PLAYER_PLAYER_CONNECTION_FIELD = getMappedField(ENTITY_PLAYER_CLASS, "EntityPlayer.playerConnection", false);
324-
324+
325325
// Constructors
326326
if (version < 13)
327327
PACKET_PLAY_OUT_WORLD_PARTICLES_CONSTRUCTOR = getConstructorOrNull(PACKET_PLAY_OUT_WORLD_PARTICLES_CLASS, PARTICLE_ENUM, boolean.class, float.class, float.class, float.class, float.class, float.class, float.class, float.class, int.class, int[].class);
328328
else if (version < 15)
329329
PACKET_PLAY_OUT_WORLD_PARTICLES_CONSTRUCTOR = getConstructorOrNull(PACKET_PLAY_OUT_WORLD_PARTICLES_CLASS, PARTICLE_PARAM_CLASS, boolean.class, float.class, float.class, float.class, float.class, float.class, float.class, float.class, int.class);
330330
else
331331
PACKET_PLAY_OUT_WORLD_PARTICLES_CONSTRUCTOR = getConstructorOrNull(PACKET_PLAY_OUT_WORLD_PARTICLES_CLASS, PARTICLE_PARAM_CLASS, boolean.class, double.class, double.class, double.class, float.class, float.class, float.class, float.class, int.class);
332-
332+
333333
MINECRAFT_KEY_CONSTRUCTOR = getConstructorOrNull(MINECRAFT_KEY_CLASS, String.class);
334334
VECTOR_3FA_CONSTRUCTOR = getConstructorOrNull(VECTOR_3FA_CLASS, float.class, float.class, float.class);
335335
BLOCK_POSITION_CONSTRUCTOR = getConstructorOrNull(BLOCK_POSITION_CLASS, double.class, double.class, double.class);
@@ -340,16 +340,16 @@ else if (version < 19)
340340
ENTITY_POSITION_SOURCE_CONSTRUCTOR = getConstructorOrNull(ENTITY_POSITION_SOURCE_CLASS, int.class);
341341
else
342342
ENTITY_POSITION_SOURCE_CONSTRUCTOR = getConstructorOrNull(ENTITY_POSITION_SOURCE_CLASS, ENTITY_CLASS, float.class);
343-
343+
344344
VIBRATION_PATH_CONSTRUCTOR = version < 17 ? null : getConstructorOrNull(VIBRATION_PATH_CLASS, BLOCK_POSITION_CLASS, POSITION_SOURCE_CLASS, int.class);
345-
345+
346346
if (version < 13)
347347
PARTICLE_PARAM_REDSTONE_CONSTRUCTOR = null;
348348
else if (version < 17)
349349
PARTICLE_PARAM_REDSTONE_CONSTRUCTOR = getConstructorOrNull(PARTICLE_PARAM_REDSTONE_CLASS, float.class, float.class, float.class, float.class);
350350
else
351351
PARTICLE_PARAM_REDSTONE_CONSTRUCTOR = getConstructorOrNull(PARTICLE_PARAM_REDSTONE_CLASS, VECTOR_3FA_CLASS, float.class);
352-
352+
353353
PARTICLE_PARAM_DUST_COLOR_TRANSITION_CONSTRUCTOR = version < 17 ? null : getConstructorOrNull(PARTICLE_PARAM_DUST_COLOR_TRANSITION_CLASS, VECTOR_3FA_CLASS, VECTOR_3FA_CLASS, float.class);
354354
PARTICLE_PARAM_BLOCK_CONSTRUCTOR = version < 13 ? null : getConstructorOrNull(PARTICLE_PARAM_BLOCK_CLASS, PARTICLE_CLASS, BLOCK_DATA_INTERFACE);
355355
PARTICLE_PARAM_ITEM_CONSTRUCTOR = version < 13 ? null : getConstructorOrNull(PARTICLE_PARAM_ITEM_CLASS, PARTICLE_CLASS, ITEM_STACK_CLASS);
@@ -361,18 +361,18 @@ else if (version < 19)
361361
PARTICLE_PARAM_VIBRATION_CONSTRUCTOR = getConstructorOrNull(PARTICLE_PARAM_VIBRATION_CLASS, POSITION_SOURCE_CLASS, int.class);
362362
PARTICLE_PARAM_SHRIEK_CONSTRUCTOR = version < 19 ? null : getConstructorOrNull(PARTICLE_PARAM_SHRIEK_CLASS, int.class);
363363
PARTICLE_PARAM_SCULK_CHARGE_CONSTRUCTOR = version < 19 ? null : getConstructorOrNull(PARTICLE_PARAM_SCULK_CHARGE_CLASS, float.class);
364-
364+
365365
// Constants
366366
PARTICLE_TYPE_REGISTRY = readField(
367-
version < 19.3
368-
? getMappedField(REGISTRY_CLASS, "Registry.ParticleTypeRegistry", false)
369-
: getMappedField(BUILT_IN_REGISTRIES_CLASS, "BuiltInRegistries.ParticleTypeRegistry", false),
370-
null);
367+
version < 19.3
368+
? getMappedField(REGISTRY_CLASS, "Registry.ParticleTypeRegistry", false)
369+
: getMappedField(BUILT_IN_REGISTRIES_CLASS, "BuiltInRegistries.ParticleTypeRegistry", false),
370+
null);
371371
BLOCK_REGISTRY = readField(
372-
version < 19.3
373-
? getMappedField(REGISTRY_CLASS, "Registry.BlockRegistry", false)
374-
: getMappedField(BUILT_IN_REGISTRIES_CLASS, "BuiltInRegistries.BlockRegistry", false),
375-
null);
372+
version < 19.3
373+
? getMappedField(REGISTRY_CLASS, "Registry.BlockRegistry", false)
374+
: getMappedField(BUILT_IN_REGISTRIES_CLASS, "BuiltInRegistries.BlockRegistry", false),
375+
null);
376376
}
377-
377+
378378
}

0 commit comments

Comments
 (0)