spring-cleaning, update all the dependencies

This commit is contained in:
nossr50 2024-05-19 13:48:25 -07:00
parent 32ff8c6818
commit 364d4cd6e7
15 changed files with 64 additions and 70 deletions

View File

@ -1,5 +1,6 @@
Version 2.2.013 Version 2.2.013
mcMMO now requires Java 21 (see notes) mcMMO now requires Java 21 (see notes)
Modified the RNG for dropping non-ore blocks from Blast Mining to yield about 50% of what was destroyed
(API) Deprecated com.gmail.nossr50.mcMMO.getPlaceStore (API) Deprecated com.gmail.nossr50.mcMMO.getPlaceStore
(API) Added com.gmail.nossr50.mcMMO.getUserBlockTracker (API) Added com.gmail.nossr50.mcMMO.getUserBlockTracker
(API) Added com.gmail.nossr50.mcMMO.getChunkManager (API) Added com.gmail.nossr50.mcMMO.getChunkManager

41
pom.xml
View File

@ -75,7 +75,7 @@
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version> <version>3.2.5</version>
<configuration> <configuration>
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName> <junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
@ -85,7 +85,7 @@
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M7</version> <version>3.2.5</version>
<configuration> <configuration>
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName> <junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
@ -113,6 +113,7 @@
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration> <configuration>
<descriptors> <descriptors>
<descriptor>src/main/assembly/package.xml</descriptor> <descriptor>src/main/assembly/package.xml</descriptor>
@ -304,42 +305,42 @@
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId> <artifactId>adventure-text-serializer-gson</artifactId>
<version>4.16.0</version> <version>4.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson-legacy-impl</artifactId> <artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
<version>4.16.0</version> <version>4.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-json</artifactId> <artifactId>adventure-text-serializer-json</artifactId>
<version>4.16.0</version> <version>4.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-json-legacy-impl</artifactId> <artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
<version>4.16.0</version> <version>4.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId> <artifactId>adventure-api</artifactId>
<version>4.16.0</version> <version>4.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-nbt</artifactId> <artifactId>adventure-nbt</artifactId>
<version>4.16.0</version> <version>4.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-key</artifactId> <artifactId>adventure-key</artifactId>
<version>4.16.0</version> <version>4.17.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-platform-api</artifactId> <artifactId>adventure-platform-api</artifactId>
<version>4.3.2</version> <version>4.3.3-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
@ -349,12 +350,12 @@
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-platform-facet</artifactId> <artifactId>adventure-platform-facet</artifactId>
<version>4.3.2</version> <version>4.3.3-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-platform-viaversion</artifactId> <artifactId>adventure-platform-viaversion</artifactId>
<version>4.3.2</version> <version>4.3.3-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
@ -364,12 +365,12 @@
<dependency> <dependency>
<groupId>org.apache.maven.scm</groupId> <groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId> <artifactId>maven-scm-provider-gitexe</artifactId>
<version>2.0.0-M1</version> <version>2.1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bstats</groupId> <groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId> <artifactId>bstats-bukkit</artifactId>
<version>3.0.0</version> <version>3.0.2</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -411,36 +412,36 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId> <artifactId>junit-jupiter</artifactId>
<version>5.9.0</version> <version>5.11.0-M2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
<version>4.6.1</version> <version>5.12.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId> <artifactId>mockito-inline</artifactId>
<version>4.6.1</version> <version>5.2.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.tomcat</groupId> <groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId> <artifactId>tomcat-jdbc</artifactId>
<version>10.1.0-M17</version> <version>10.1.24</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jetbrains</groupId> <groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId> <artifactId>annotations</artifactId>
<version>23.0.0</version> <version>24.1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>32.1.1-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using --> <version>33.2.0-jre</version> <!-- At this time Spigot is including 29.0 Guava classes that we are using -->
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -3,7 +3,7 @@ package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask; import com.gmail.nossr50.runnables.commands.McRankCommandAsyncTask;
import com.gmail.nossr50.util.MetadataConstants; import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
@ -111,7 +111,7 @@ public class McrankCommand implements TabExecutor {
boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard()); boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard());
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat(); boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat();
mcMMO.p.getFoliaLib().getImpl().runAsync(new McrankCommandAsyncTask(playerName, sender, useBoard, useChat)); mcMMO.p.getFoliaLib().getImpl().runAsync(new McRankCommandAsyncTask(playerName, sender, useBoard, useChat));
} }
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) { private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {

View File

@ -4,7 +4,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask; import com.gmail.nossr50.runnables.commands.McTopCommandAsyncTask;
import com.gmail.nossr50.util.MetadataConstants; import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
@ -115,7 +115,7 @@ public class MctopCommand implements TabExecutor {
boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard()); boolean useBoard = (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat(); boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
mcMMO.p.getFoliaLib().getImpl().runAsync(new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat)); mcMMO.p.getFoliaLib().getImpl().runAsync(new McTopCommandAsyncTask(page, skill, sender, useBoard, useChat));
} }
private PrimarySkillType extractSkill(CommandSender sender, String skillName) { private PrimarySkillType extractSkill(CommandSender sender, String skillName) {

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.config.mods;
import com.gmail.nossr50.config.LegacyConfigLoader; import com.gmail.nossr50.config.LegacyConfigLoader;
import com.gmail.nossr50.datatypes.mods.CustomEntity; import com.gmail.nossr50.datatypes.mods.CustomEntity;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import org.apache.commons.lang.ClassUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -30,7 +29,7 @@ public class CustomEntityLegacyConfig extends LegacyConfigLoader {
String className = config.getString(entityName + ".Class", ""); String className = config.getString(entityName + ".Class", "");
try { try {
clazz = ClassUtils.getClass(className); clazz = Class.forName(className);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
mcMMO.p.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + "."); mcMMO.p.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + ".");
mcMMO.p.getLogger().warning("This custom entity may not function properly."); mcMMO.p.getLogger().warning("This custom entity may not function properly.");

View File

@ -300,7 +300,7 @@ public class FlatFileDataProcessor {
//We add a trailing : as it is needed for some reason (is it?) //We add a trailing : as it is needed for some reason (is it?)
//TODO: Is the trailing ":" actually necessary? //TODO: Is the trailing ":" actually necessary?
String fromSplit = org.apache.commons.lang.StringUtils.join(splitData, ":") + ":"; String fromSplit = org.apache.commons.lang3.StringUtils.join(splitData, ":") + ":";
stringBuilder.append(fromSplit).append("\r\n"); stringBuilder.append(fromSplit).append("\r\n");
} }

View File

@ -234,7 +234,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
if (rewrite) { if (rewrite) {
// Rewrite their data with a valid time // Rewrite their data with a valid time
character[OVERHAUL_LAST_LOGIN] = Long.toString(lastPlayed); character[OVERHAUL_LAST_LOGIN] = Long.toString(lastPlayed);
String newLine = org.apache.commons.lang.StringUtils.join(character, ":"); String newLine = org.apache.commons.lang3.StringUtils.join(character, ":");
writer.append(newLine).append("\r\n"); writer.append(newLine).append("\r\n");
} else { } else {
writer.append(line).append("\r\n"); writer.append(line).append("\r\n");
@ -905,7 +905,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
} }
character[UUID_INDEX] = fetchedUUIDs.remove(character[USERNAME_INDEX]).toString(); character[UUID_INDEX] = fetchedUUIDs.remove(character[USERNAME_INDEX]).toString();
line = org.apache.commons.lang.StringUtils.join(character, ":") + ":"; line = org.apache.commons.lang3.StringUtils.join(character, ":") + ":";
} }
i++; i++;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.placeholders; package com.gmail.nossr50.placeholders;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class PartyLeaderPlaceholder implements Placeholder { public class PartyLeaderPlaceholder implements Placeholder {
@ -12,7 +12,7 @@ public class PartyLeaderPlaceholder implements Placeholder {
@Override @Override
public String process(Player player, String params) { public String process(Player player, String params) {
return StringUtils.stripToEmpty(papiExpansion.getPartyLeader(player)); return StringUtils.trimToEmpty(papiExpansion.getPartyLeader(player));
} }
@Override @Override

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.placeholders; package com.gmail.nossr50.placeholders;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class PartyNamePlaceholder implements Placeholder { public class PartyNamePlaceholder implements Placeholder {
@ -12,7 +12,7 @@ public class PartyNamePlaceholder implements Placeholder {
@Override @Override
public String process(Player player, String params) { public String process(Player player, String params) {
return StringUtils.stripToEmpty(papiExpansion.getPartyName(player)); return StringUtils.trimToEmpty(papiExpansion.getPartyName(player));
} }
@Override @Override

View File

@ -3,18 +3,18 @@ package com.gmail.nossr50.runnables.commands;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.CancellableRunnable;
import org.apache.commons.lang.Validate; import org.apache.commons.lang3.Validate;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Map; import java.util.Map;
public class McrankCommandAsyncTask extends CancellableRunnable { public class McRankCommandAsyncTask extends CancellableRunnable {
private final String playerName; private final String playerName;
private final CommandSender sender; private final CommandSender sender;
private final boolean useBoard, useChat; private final boolean useBoard, useChat;
public McrankCommandAsyncTask(String playerName, CommandSender sender, boolean useBoard, boolean useChat) { public McRankCommandAsyncTask(String playerName, CommandSender sender, boolean useBoard, boolean useChat) {
Validate.isTrue(useBoard || useChat, "Attempted to start a rank retrieval with both board and chat off"); Validate.isTrue(useBoard || useChat, "Attempted to start a rank retrieval with both board and chat off");
Validate.notNull(sender, "Attempted to start a rank retrieval with no recipient"); Validate.notNull(sender, "Attempted to start a rank retrieval with no recipient");

View File

@ -4,19 +4,19 @@ import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.CancellableRunnable; import com.gmail.nossr50.util.CancellableRunnable;
import org.apache.commons.lang.Validate; import org.apache.commons.lang3.Validate;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
public class MctopCommandAsyncTask extends CancellableRunnable { public class McTopCommandAsyncTask extends CancellableRunnable {
private final CommandSender sender; private final CommandSender sender;
private final PrimarySkillType skill; private final PrimarySkillType skill;
private final int page; private final int page;
private final boolean useBoard, useChat; private final boolean useBoard, useChat;
public MctopCommandAsyncTask(int page, PrimarySkillType skill, CommandSender sender, boolean useBoard, boolean useChat) { public McTopCommandAsyncTask(int page, PrimarySkillType skill, CommandSender sender, boolean useBoard, boolean useChat) {
Validate.isTrue(useBoard || useChat, "Attempted to start a rank retrieval with both board and chat off"); Validate.isTrue(useBoard || useChat, "Attempted to start a rank retrieval with both board and chat off");
Validate.notNull(sender, "Attempted to start a rank retrieval with no recipient"); Validate.notNull(sender, "Attempted to start a rank retrieval with no recipient");

View File

@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
/** /**
* Display the results of {@link MctopCommandAsyncTask} to the sender. * Display the results of {@link McTopCommandAsyncTask} to the sender.
*/ */
public class MctopCommandDisplayTask extends CancellableRunnable { public class MctopCommandDisplayTask extends CancellableRunnable {
private final List<PlayerStat> userStats; private final List<PlayerStat> userStats;

View File

@ -13,10 +13,11 @@ import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.*; import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.random.Probability;
import com.gmail.nossr50.util.random.ProbabilityUtil; import com.gmail.nossr50.util.random.ProbabilityUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import org.apache.commons.lang.math.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@ -202,7 +203,7 @@ public class MiningManager extends SkillManager {
if (isDropIllegal(blockState.getType())) if (isDropIllegal(blockState.getType()))
continue; continue;
if (RandomUtils.nextFloat() < debrisYield) { if (Probability.ofPercent(50).evaluate()) {
Misc.spawnItem(getPlayer(), Misc.getBlockCenter(blockState), new ItemStack(blockState.getType()), ItemSpawnReason.BLAST_MINING_DEBRIS_NON_ORES); // Initial block that would have been dropped Misc.spawnItem(getPlayer(), Misc.getBlockCenter(blockState), new ItemStack(blockState.getType()), ItemSpawnReason.BLAST_MINING_DEBRIS_NON_ORES); // Initial block that would have been dropped
} }
} }

View File

@ -18,7 +18,6 @@ import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager.SidebarType; import com.gmail.nossr50.util.scoreboards.ScoreboardManager.SidebarType;
import com.gmail.nossr50.util.skills.SkillTools; import com.gmail.nossr50.util.skills.SkillTools;
import com.tcoded.folialib.wrapper.task.WrappedTask; import com.tcoded.folialib.wrapper.task.WrappedTask;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.DisplaySlot;
@ -30,6 +29,8 @@ import org.jetbrains.annotations.NotNull;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.Objects.requireNonNull;
public class ScoreboardWrapper { public class ScoreboardWrapper {
public static final String SIDE_OBJECTIVE = "mcMMO_sideObjective"; public static final String SIDE_OBJECTIVE = "mcMMO_sideObjective";
public static final String POWER_OBJECTIVE = "mcMMO_powerObjective"; public static final String POWER_OBJECTIVE = "mcMMO_powerObjective";
@ -485,7 +486,7 @@ public class ScoreboardWrapper {
break; break;
case SKILL_BOARD: case SKILL_BOARD:
Validate.notNull(targetSkill); requireNonNull(targetSkill);
if (!SkillTools.isChildSkill(targetSkill)) { if (!SkillTools.isChildSkill(targetSkill)) {
int currentXP = mcMMOPlayer.getSkillXpLevel(targetSkill); int currentXP = mcMMOPlayer.getSkillXpLevel(targetSkill);

View File

@ -3,7 +3,7 @@ package com.gmail.nossr50.util.skills;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType; import com.gmail.nossr50.util.sounds.SoundType;
import org.apache.commons.lang.math.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -42,31 +42,22 @@ public final class ParticleEffectUtils {
double offSetVal = 0.3D; double offSetVal = 0.3D;
switch(RandomUtils.nextInt(10)) { return switch (RandomUtils.nextInt(0, 10)) {
case 0 -> new Location(world, x - offSetVal, y, z);
case 0: case 1 -> new Location(world, x + offSetVal, y, z);
return new Location(world, x - offSetVal, y, z); case 2 -> new Location(world, x, y + offSetVal, z);
case 1: case 3 -> new Location(world, x, y - offSetVal, z);
return new Location(world, x + offSetVal, y, z); case 4 -> {
case 2: Location locE = new Location(world, x, y, z + offSetVal);
return new Location(world, x, y + offSetVal, z); yield new Location(world, x, y, z - offSetVal);
case 3:
return new Location(world, x, y - offSetVal, z);
case 4: Location locE = new Location(world, x, y, z + offSetVal);
return new Location(world, x, y, z - offSetVal);
case 5:
return new Location(world, x + offSetVal, y, z + offSetVal);
case 6:
return new Location(world, x - offSetVal, y, z - offSetVal);
case 7:
return new Location(world, x - offSetVal, y - offSetVal, z - offSetVal);
case 8:
return new Location(world, x + offSetVal, y - offSetVal, z + offSetVal);
case 9:
return new Location(world, x - offSetVal, y + offSetVal, z - offSetVal);
default:
return new Location(world, x + offSetVal, y + offSetVal, z - offSetVal);
} }
case 5 -> new Location(world, x + offSetVal, y, z + offSetVal);
case 6 -> new Location(world, x - offSetVal, y, z - offSetVal);
case 7 -> new Location(world, x - offSetVal, y - offSetVal, z - offSetVal);
case 8 -> new Location(world, x + offSetVal, y - offSetVal, z + offSetVal);
case 9 -> new Location(world, x - offSetVal, y + offSetVal, z - offSetVal);
default -> new Location(world, x + offSetVal, y + offSetVal, z - offSetVal);
};
} }
public static void playDodgeEffect(Player player) { public static void playDodgeEffect(Player player) {