mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-28 18:15:28 +02:00
clean up if/else formatting
This commit is contained in:
@@ -113,8 +113,7 @@ public final class ChimaeraWing {
|
||||
if (warmup > 0) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new ChimaeraWingWarmup(mcMMOPlayer), 20 * warmup);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
chimaeraExecuteTeleport();
|
||||
}
|
||||
}
|
||||
@@ -125,14 +124,12 @@ public final class ChimaeraWing {
|
||||
if (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
||||
// player.teleport(player.getBedSpawnLocation());
|
||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getBedSpawnLocation());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Location spawnLocation = player.getWorld().getSpawnLocation();
|
||||
if (spawnLocation.getBlock().getType() == Material.AIR) {
|
||||
// player.teleport(spawnLocation);
|
||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, spawnLocation);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
||||
mcMMO.p.getFoliaLib().getImpl().teleportAsync(player, player.getWorld().getHighestBlockAt(spawnLocation).getLocation());
|
||||
}
|
||||
|
@@ -93,8 +93,7 @@ public final class EventUtils {
|
||||
* @param entity target entity
|
||||
* @return the associated McMMOPlayer for this entity
|
||||
*/
|
||||
public static McMMOPlayer getMcMMOPlayer(@NotNull Entity entity)
|
||||
{
|
||||
public static McMMOPlayer getMcMMOPlayer(@NotNull Entity entity) {
|
||||
return UserManager.getPlayer((Player)entity);
|
||||
}
|
||||
|
||||
@@ -111,8 +110,7 @@ public final class EventUtils {
|
||||
* @param entityDamageEvent
|
||||
* @return
|
||||
*/
|
||||
public static boolean isRealPlayerDamaged(@NotNull EntityDamageEvent entityDamageEvent)
|
||||
{
|
||||
public static boolean isRealPlayerDamaged(@NotNull EntityDamageEvent entityDamageEvent) {
|
||||
//Make sure the damage is above 0
|
||||
double damage = entityDamageEvent.getFinalDamage();
|
||||
|
||||
@@ -143,8 +141,7 @@ public final class EventUtils {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (mcMMOPlayer == null)
|
||||
{
|
||||
if (mcMMOPlayer == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -121,8 +121,7 @@ public final class HardcoreManager {
|
||||
if (totalLevelsStolen > 0) {
|
||||
NotificationManager.sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Success", String.valueOf(totalLevelsStolen), victim.getName());
|
||||
NotificationManager.sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Success", killer.getName(), String.valueOf(totalLevelsStolen));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
NotificationManager.sendPlayerInformation(killer, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Killer.Failure", victim.getName());
|
||||
NotificationManager.sendPlayerInformation(victim, NotificationType.HARDCORE_MODE, "Hardcore.Vampirism.Victim.Failure", killer.getName());
|
||||
}
|
||||
|
@@ -59,8 +59,7 @@ public class MaterialMapStore {
|
||||
private final @NotNull HashMap<String, Integer> tierValue;
|
||||
|
||||
|
||||
public MaterialMapStore()
|
||||
{
|
||||
public MaterialMapStore() {
|
||||
abilityBlackList = new HashSet<>();
|
||||
toolBlackList = new HashSet<>();
|
||||
mossyWhiteList = new HashSet<>();
|
||||
@@ -133,8 +132,7 @@ public class MaterialMapStore {
|
||||
fillTierMap();
|
||||
}
|
||||
|
||||
public boolean isMultiBlockPlant(@NotNull Material material)
|
||||
{
|
||||
public boolean isMultiBlockPlant(@NotNull Material material) {
|
||||
return multiBlockPlant.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
@@ -142,38 +140,31 @@ public class MaterialMapStore {
|
||||
return multiBlockHangingPlant.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
public boolean isAbilityActivationBlackListed(@NotNull Material material)
|
||||
{
|
||||
public boolean isAbilityActivationBlackListed(@NotNull Material material) {
|
||||
return abilityBlackList.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
public boolean isToolActivationBlackListed(@NotNull Material material)
|
||||
{
|
||||
public boolean isToolActivationBlackListed(@NotNull Material material) {
|
||||
return toolBlackList.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
public boolean isMossyWhiteListed(@NotNull Material material)
|
||||
{
|
||||
public boolean isMossyWhiteListed(@NotNull Material material) {
|
||||
return mossyWhiteList.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
public boolean isTreeFellerDestructible(@NotNull Material material)
|
||||
{
|
||||
public boolean isTreeFellerDestructible(@NotNull Material material) {
|
||||
return treeFellerDestructibleWhiteList.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
public boolean isHerbalismAbilityWhiteListed(@NotNull Material material)
|
||||
{
|
||||
public boolean isHerbalismAbilityWhiteListed(@NotNull Material material) {
|
||||
return herbalismAbilityBlackList.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
public boolean isBlockCrackerWhiteListed(@NotNull Material material)
|
||||
{
|
||||
public boolean isBlockCrackerWhiteListed(@NotNull Material material) {
|
||||
return blockCrackerWhiteList.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
public boolean isShroomyWhiteListed(@NotNull Material material)
|
||||
{
|
||||
public boolean isShroomyWhiteListed(@NotNull Material material) {
|
||||
return canMakeShroomyWhiteList.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
@@ -993,8 +984,7 @@ public class MaterialMapStore {
|
||||
return foodItemWhiteList.contains(material.getKey().getKey());
|
||||
}
|
||||
|
||||
private void fillMultiBlockPlantSet()
|
||||
{
|
||||
private void fillMultiBlockPlantSet() {
|
||||
//Multi-Block Plants
|
||||
multiBlockPlant.add("cactus");
|
||||
multiBlockPlant.add("chorus_plant");
|
||||
@@ -1014,30 +1004,26 @@ public class MaterialMapStore {
|
||||
multiBlockHangingPlant.add("cave_vines_plant");
|
||||
}
|
||||
|
||||
private void fillShroomyWhiteList()
|
||||
{
|
||||
private void fillShroomyWhiteList() {
|
||||
canMakeShroomyWhiteList.add("dirt");
|
||||
canMakeShroomyWhiteList.add("grass_block");
|
||||
canMakeShroomyWhiteList.add("dirt_path");
|
||||
}
|
||||
|
||||
private void fillBlockCrackerWhiteList()
|
||||
{
|
||||
private void fillBlockCrackerWhiteList() {
|
||||
blockCrackerWhiteList.add("stone_bricks");
|
||||
blockCrackerWhiteList.add("infested_stone_bricks");
|
||||
|
||||
}
|
||||
|
||||
private void fillHerbalismAbilityBlackList()
|
||||
{
|
||||
private void fillHerbalismAbilityBlackList() {
|
||||
herbalismAbilityBlackList.add("dirt");
|
||||
herbalismAbilityBlackList.add("grass_block");
|
||||
herbalismAbilityBlackList.add("dirt_path");
|
||||
herbalismAbilityBlackList.add("farmland");
|
||||
}
|
||||
|
||||
private void fillTreeFellerDestructibleWhiteList()
|
||||
{
|
||||
private void fillTreeFellerDestructibleWhiteList() {
|
||||
treeFellerDestructibleWhiteList.add("oak_leaves");
|
||||
treeFellerDestructibleWhiteList.add("cherry_leaves");
|
||||
treeFellerDestructibleWhiteList.add("acacia_leaves");
|
||||
@@ -1055,8 +1041,7 @@ public class MaterialMapStore {
|
||||
treeFellerDestructibleWhiteList.add("red_mushroom_block");
|
||||
}
|
||||
|
||||
private void fillMossyWhiteList()
|
||||
{
|
||||
private void fillMossyWhiteList() {
|
||||
mossyWhiteList.add("cobblestone");
|
||||
mossyWhiteList.add("dirt");
|
||||
mossyWhiteList.add("grass_path");
|
||||
@@ -1064,8 +1049,7 @@ public class MaterialMapStore {
|
||||
mossyWhiteList.add("cobblestone_wall");
|
||||
}
|
||||
|
||||
private void fillAbilityBlackList()
|
||||
{
|
||||
private void fillAbilityBlackList() {
|
||||
abilityBlackList.add("warped_fence_gate");
|
||||
abilityBlackList.add("crimson_fence_gate");
|
||||
abilityBlackList.add("warped_pressure_plate");
|
||||
@@ -1192,8 +1176,7 @@ public class MaterialMapStore {
|
||||
abilityBlackList.add("respawn_anchor");
|
||||
}
|
||||
|
||||
private void fillToolBlackList()
|
||||
{
|
||||
private void fillToolBlackList() {
|
||||
toolBlackList.add("chiseled_bookshelf");
|
||||
toolBlackList.add("black_bed");
|
||||
toolBlackList.add("blue_bed");
|
||||
@@ -1371,8 +1354,7 @@ public class MaterialMapStore {
|
||||
return tierValue.getOrDefault(id, 1); //1 for unknown items
|
||||
}
|
||||
|
||||
private void addToHashSet(@NotNull String string, @NotNull HashSet<String> stringHashSet)
|
||||
{
|
||||
private void addToHashSet(@NotNull String string, @NotNull HashSet<String> stringHashSet) {
|
||||
stringHashSet.add(string.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
}
|
||||
|
@@ -75,8 +75,7 @@ public final class MobHealthbarUtils {
|
||||
if (updateName) {
|
||||
target.setMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME, new FixedMetadataValue(mcMMO.p, oldName));
|
||||
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, oldNameVisible));
|
||||
}
|
||||
else if (!target.hasMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME)) {
|
||||
} else if (!target.hasMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME)) {
|
||||
target.setMetadata(MetadataConstants.METADATA_KEY_CUSTOM_NAME, new FixedMetadataValue(mcMMO.p, ""));
|
||||
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, false));
|
||||
}
|
||||
@@ -106,20 +105,15 @@ public final class MobHealthbarUtils {
|
||||
|
||||
if (healthPercentage >= 85) {
|
||||
color = ChatColor.DARK_GREEN;
|
||||
}
|
||||
else if (healthPercentage >= 70) {
|
||||
} else if (healthPercentage >= 70) {
|
||||
color = ChatColor.GREEN;
|
||||
}
|
||||
else if (healthPercentage >= 55) {
|
||||
} else if (healthPercentage >= 55) {
|
||||
color = ChatColor.GOLD;
|
||||
}
|
||||
else if (healthPercentage >= 40) {
|
||||
} else if (healthPercentage >= 40) {
|
||||
color = ChatColor.YELLOW;
|
||||
}
|
||||
else if (healthPercentage >= 25) {
|
||||
} else if (healthPercentage >= 25) {
|
||||
color = ChatColor.RED;
|
||||
}
|
||||
else if (healthPercentage >= 0) {
|
||||
} else if (healthPercentage >= 0) {
|
||||
color = ChatColor.DARK_RED;
|
||||
}
|
||||
|
||||
|
@@ -215,8 +215,7 @@ public class ModManager {
|
||||
catch (Exception e) {
|
||||
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
||||
customEntity = customEntityClassMap.get(entity.getClass().getName());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -256,8 +255,7 @@ public class ModManager {
|
||||
catch (Exception e) {
|
||||
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
||||
className = entity.getClass().getName();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@@ -118,8 +118,7 @@ public class BitSetChunkStore implements ChunkStore {
|
||||
return world.getMinHeight();
|
||||
}
|
||||
|
||||
private static int getWorldMax(@NotNull UUID worldUid)
|
||||
{
|
||||
private static int getWorldMax(@NotNull UUID worldUid) {
|
||||
World world = Bukkit.getWorld(worldUid);
|
||||
|
||||
// Not sure how this case could come up, but might as well handle it gracefully. Loading a chunkstore for an unloaded world?
|
||||
@@ -181,8 +180,7 @@ public class BitSetChunkStore implements ChunkStore {
|
||||
if (currentWorldMin > worldMin)
|
||||
stored = stored.get(currentWorldMin, stored.length()); // Because BitSet's aren't fixed size, a "substring" operation is equivalent to a left shift
|
||||
// Right shift store if world min has expanded
|
||||
if (currentWorldMin < worldMin)
|
||||
{
|
||||
if (currentWorldMin < worldMin) {
|
||||
int offset = (worldMin - currentWorldMin) * 16 * 16; // We are adding this many bits to the front
|
||||
// This isn't the most efficient way to do this, however, its a rare case to occur, and in the grand scheme of things, the small performance we could gain would cost us significant reduced readability of the code
|
||||
BitSet shifted = new BitSet();
|
||||
@@ -207,13 +205,12 @@ public class BitSetChunkStore implements ChunkStore {
|
||||
inputStream.mark(2);
|
||||
short magicNumber = inputStream.readShort();
|
||||
|
||||
if (magicNumber == ObjectStreamConstants.STREAM_MAGIC) // Java serializable, use legacy serialization
|
||||
{
|
||||
// Java serializable, use legacy serialization
|
||||
if (magicNumber == ObjectStreamConstants.STREAM_MAGIC) {
|
||||
// "Un-read" the magic number for Serializables, they need it to still be in the stream
|
||||
if (inputStream.markSupported())
|
||||
if (inputStream.markSupported()) {
|
||||
inputStream.reset(); // Pretend we never read those bytes
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// Creates a new stream with the two magic number bytes and then the rest of the original stream... Java is so dumb. I just wanted to look at two bytes.
|
||||
PushbackInputStream pushbackInputStream = new PushbackInputStream(inputStream, 2);
|
||||
pushbackInputStream.unread((magicNumber) & 0xFF);
|
||||
@@ -221,9 +218,8 @@ public class BitSetChunkStore implements ChunkStore {
|
||||
inputStream = new DataInputStream(pushbackInputStream);
|
||||
}
|
||||
return new LegacyDeserializationInputStream(inputStream).readLegacyChunkStore();
|
||||
}
|
||||
else if (magicNumber == STREAM_MAGIC) // Pure bytes format
|
||||
{
|
||||
} else if (magicNumber == STREAM_MAGIC) {
|
||||
// Pure bytes format
|
||||
return BitSetChunkStore.deserialize(inputStream);
|
||||
}
|
||||
throw new IOException("Bad Data Format");
|
||||
@@ -238,8 +234,7 @@ public class BitSetChunkStore implements ChunkStore {
|
||||
|
||||
// Handles loading the old serialized class
|
||||
private static class LegacyDeserializationInputStream extends ObjectInputStream {
|
||||
private static class LegacyChunkStoreDeserializer implements Serializable
|
||||
{
|
||||
private static class LegacyChunkStoreDeserializer implements Serializable {
|
||||
private static final long serialVersionUID = -1L;
|
||||
|
||||
private int cx;
|
||||
@@ -270,8 +265,7 @@ public class BitSetChunkStore implements ChunkStore {
|
||||
worldMax = store[0][0].length;
|
||||
}
|
||||
|
||||
public @NotNull BitSetChunkStore convert()
|
||||
{
|
||||
public @NotNull BitSetChunkStore convert() {
|
||||
int currentWorldMin = getWorldMin(worldUid);
|
||||
int currentWorldMax = getWorldMax(worldUid);
|
||||
|
||||
|
@@ -21,8 +21,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
@Override
|
||||
public synchronized void closeAll() {
|
||||
// Save all dirty chunkstores
|
||||
for (ChunkStore chunkStore : chunkMap.values())
|
||||
{
|
||||
for (ChunkStore chunkStore : chunkMap.values()) {
|
||||
if (!chunkStore.isDirty())
|
||||
continue;
|
||||
World world = Bukkit.getWorld(chunkStore.getWorldId());
|
||||
@@ -113,8 +112,8 @@ public class HashChunkManager implements ChunkManager {
|
||||
CoordinateKey regionKey = toRegionKey(world.getUID(), cx, cz);
|
||||
HashSet<CoordinateKey> chunkKeys = chunkUsageMap.get(regionKey);
|
||||
chunkKeys.remove(chunkKey); // remove from region file in-use set
|
||||
if (chunkKeys.isEmpty()) // If it was last chunk in region, close the region file and remove it from memory
|
||||
{
|
||||
// If it was last chunk in region, close the region file and remove it from memory
|
||||
if (chunkKeys.isEmpty()) {
|
||||
chunkUsageMap.remove(regionKey);
|
||||
regionMap.remove(regionKey).close();
|
||||
}
|
||||
@@ -224,8 +223,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
ChunkStore cStore = chunkMap.computeIfAbsent(chunkKey, k -> {
|
||||
// Load from file
|
||||
ChunkStore loaded = loadChunk(chunkKey.x, chunkKey.z, world);
|
||||
if (loaded != null)
|
||||
{
|
||||
if (loaded != null) {
|
||||
chunkUsageMap.computeIfAbsent(toRegionKey(chunkKey.worldID, chunkKey.x, chunkKey.z), j -> new HashSet<>()).add(chunkKey);
|
||||
return loaded;
|
||||
}
|
||||
|
@@ -181,8 +181,7 @@ public class McMMOSimpleRegionFile {
|
||||
int end = start + chunkNumSegments[index];
|
||||
|
||||
// If we are writing, assert we don't write over any in-use segments
|
||||
if (inUse)
|
||||
{
|
||||
if (inUse) {
|
||||
int nextSetBit = segments.nextSetBit(start);
|
||||
if (nextSetBit != -1 && nextSetBit < end)
|
||||
throw new IllegalStateException("Attempting to overwrite an in-use segment");
|
||||
|
@@ -265,8 +265,7 @@ public final class CommandUtils {
|
||||
if (matches.size() == 1) {
|
||||
partialName = matches.get(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Player player = mcMMO.p.getServer().getPlayer(partialName);
|
||||
|
||||
if (player != null) {
|
||||
|
@@ -28,8 +28,7 @@ public class ExperienceBarManager {
|
||||
private HashSet<PrimarySkillType> alwaysVisible;
|
||||
private HashSet<PrimarySkillType> disabledBars;
|
||||
|
||||
public ExperienceBarManager(McMMOPlayer mcMMOPlayer)
|
||||
{
|
||||
public ExperienceBarManager(McMMOPlayer mcMMOPlayer) {
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
init();
|
||||
}
|
||||
@@ -44,8 +43,7 @@ public class ExperienceBarManager {
|
||||
disabledBars = new HashSet<>();
|
||||
}
|
||||
|
||||
public void updateExperienceBar(PrimarySkillType primarySkillType, Plugin plugin)
|
||||
{
|
||||
public void updateExperienceBar(PrimarySkillType primarySkillType, Plugin plugin) {
|
||||
if (disabledBars.contains(primarySkillType)
|
||||
|| !ExperienceConfig.getInstance().isExperienceBarsEnabled()
|
||||
|| !ExperienceConfig.getInstance().isExperienceBarEnabled(primarySkillType))
|
||||
@@ -65,8 +63,7 @@ public class ExperienceBarManager {
|
||||
experienceBarWrapper.showExperienceBar();
|
||||
|
||||
//Setup Hide Bar Task
|
||||
if (experienceBarHideTaskHashMap.get(primarySkillType) != null)
|
||||
{
|
||||
if (experienceBarHideTaskHashMap.get(primarySkillType) != null) {
|
||||
experienceBarHideTaskHashMap.get(primarySkillType).cancel();
|
||||
}
|
||||
|
||||
@@ -82,14 +79,12 @@ public class ExperienceBarManager {
|
||||
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
|
||||
}
|
||||
|
||||
public void hideExperienceBar(PrimarySkillType primarySkillType)
|
||||
{
|
||||
public void hideExperienceBar(PrimarySkillType primarySkillType) {
|
||||
if (experienceBars.containsKey(primarySkillType))
|
||||
experienceBars.get(primarySkillType).hideExperienceBar();
|
||||
}
|
||||
|
||||
public void clearTask(PrimarySkillType primarySkillType)
|
||||
{
|
||||
public void clearTask(PrimarySkillType primarySkillType) {
|
||||
experienceBarHideTaskHashMap.remove(primarySkillType);
|
||||
}
|
||||
|
||||
|
@@ -29,8 +29,7 @@ public class ExperienceBarWrapper {
|
||||
protected String niceSkillName;
|
||||
protected String title;
|
||||
|
||||
public ExperienceBarWrapper(PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer)
|
||||
{
|
||||
public ExperienceBarWrapper(PrimarySkillType primarySkillType, McMMOPlayer mcMMOPlayer) {
|
||||
this.mcMMOPlayer = mcMMOPlayer;
|
||||
this.primarySkillType = primarySkillType;
|
||||
title = "";
|
||||
@@ -43,8 +42,7 @@ public class ExperienceBarWrapper {
|
||||
initBar();
|
||||
}
|
||||
|
||||
private void initBar()
|
||||
{
|
||||
private void initBar() {
|
||||
title = getTitleTemplate();
|
||||
createBossBar();
|
||||
}
|
||||
@@ -115,8 +113,7 @@ public class ExperienceBarWrapper {
|
||||
}
|
||||
|
||||
//Every time progress updates we need to check for a title update
|
||||
if (getLevel() != lastLevelUpdated || ExperienceConfig.getInstance().getDoExperienceBarsAlwaysUpdateTitle())
|
||||
{
|
||||
if (getLevel() != lastLevelUpdated || ExperienceConfig.getInstance().getDoExperienceBarsAlwaysUpdateTitle()) {
|
||||
updateTitle();
|
||||
lastLevelUpdated = getLevel();
|
||||
}
|
||||
@@ -134,23 +131,19 @@ public class ExperienceBarWrapper {
|
||||
return bossBar.isVisible();
|
||||
}
|
||||
|
||||
public void hideExperienceBar()
|
||||
{
|
||||
public void hideExperienceBar() {
|
||||
bossBar.setVisible(false);
|
||||
}
|
||||
|
||||
public void showExperienceBar()
|
||||
{
|
||||
public void showExperienceBar() {
|
||||
bossBar.setVisible(true);
|
||||
}
|
||||
|
||||
/*public NamespacedKey getKey()
|
||||
{
|
||||
/*public NamespacedKey getKey() {
|
||||
return bossBar
|
||||
}*/
|
||||
|
||||
private void createBossBar()
|
||||
{
|
||||
private void createBossBar() {
|
||||
bossBar = mcMMOPlayer.getPlayer().getServer().createBossBar(
|
||||
title,
|
||||
ExperienceConfig.getInstance().getExperienceBarColor(primarySkillType),
|
||||
|
@@ -135,8 +135,7 @@ public class FormulaManager {
|
||||
* @param formulaType target formulaType
|
||||
*/
|
||||
private int processXPToNextLevel(int level, FormulaType formulaType) {
|
||||
if (mcMMO.isRetroModeEnabled())
|
||||
{
|
||||
if (mcMMO.isRetroModeEnabled()) {
|
||||
return processXPRetroToNextLevel(level, formulaType);
|
||||
} else {
|
||||
return processStandardXPToNextLevel(level, formulaType);
|
||||
|
@@ -80,15 +80,12 @@ public class PlatformManager {
|
||||
return ServerSoftwareType.CRAFT_BUKKIT;
|
||||
}
|
||||
|
||||
public ServerSoftwareType getServerSoftware()
|
||||
{
|
||||
public ServerSoftwareType getServerSoftware() {
|
||||
return platform.getServerSoftwareType();
|
||||
}
|
||||
|
||||
public String getServerSoftwareStr()
|
||||
{
|
||||
switch(getServerSoftware())
|
||||
{
|
||||
public String getServerSoftwareStr() {
|
||||
switch(getServerSoftware()) {
|
||||
case PAPER:
|
||||
return "Paper";
|
||||
case SPIGOT:
|
||||
|
@@ -43,8 +43,7 @@ public class NotificationManager {
|
||||
* @param notificationType notifications defined type
|
||||
* @param key the locale key for the notifications defined message
|
||||
*/
|
||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key)
|
||||
{
|
||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key) {
|
||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
|
||||
@@ -59,8 +58,7 @@ public class NotificationManager {
|
||||
}
|
||||
|
||||
|
||||
public static boolean doesPlayerUseNotifications(Player player)
|
||||
{
|
||||
public static boolean doesPlayerUseNotifications(Player player) {
|
||||
if (UserManager.getPlayer(player) == null)
|
||||
return false;
|
||||
else
|
||||
@@ -77,13 +75,11 @@ public class NotificationManager {
|
||||
* @param values values to be injected into the locale string
|
||||
*/
|
||||
public static void sendNearbyPlayersInformation(Player targetPlayer, NotificationType notificationType, String key,
|
||||
String... values)
|
||||
{
|
||||
String... values) {
|
||||
sendPlayerInformation(targetPlayer, notificationType, key, values);
|
||||
}
|
||||
|
||||
public static void sendPlayerInformationChatOnly(Player player, String key, String... values)
|
||||
{
|
||||
public static void sendPlayerInformationChatOnly(Player player, String key, String... values) {
|
||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
|
||||
@@ -91,8 +87,7 @@ public class NotificationManager {
|
||||
player.sendMessage(preColoredString);
|
||||
}
|
||||
|
||||
public static void sendPlayerInformationChatOnlyPrefixed(Player player, String key, String... values)
|
||||
{
|
||||
public static void sendPlayerInformationChatOnlyPrefixed(Player player, String key, String... values) {
|
||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
|
||||
@@ -102,8 +97,7 @@ public class NotificationManager {
|
||||
}
|
||||
|
||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key,
|
||||
String... values)
|
||||
{
|
||||
String... values) {
|
||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
|
||||
@@ -156,8 +150,7 @@ public class NotificationManager {
|
||||
* @param newLevel new level of that skill
|
||||
*/
|
||||
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName,
|
||||
int levelsGained, int newLevel)
|
||||
{
|
||||
int levelsGained, int newLevel) {
|
||||
if (!mcMMOPlayer.useChatNotifications())
|
||||
return;
|
||||
|
||||
@@ -176,16 +169,13 @@ public class NotificationManager {
|
||||
sendNotification(mcMMOPlayer.getPlayer(), customEvent);
|
||||
}
|
||||
|
||||
public static void broadcastTitle(Server server, String title, String subtitle, int i1, int i2, int i3)
|
||||
{
|
||||
for(Player player : server.getOnlinePlayers())
|
||||
{
|
||||
public static void broadcastTitle(Server server, String title, String subtitle, int i1, int i2, int i3) {
|
||||
for(Player player : server.getOnlinePlayers()) {
|
||||
player.sendTitle(title, subtitle, i1, i2, i3);
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType)
|
||||
{
|
||||
public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType) {
|
||||
if (!mcMMOPlayer.useChatNotifications())
|
||||
return;
|
||||
|
||||
@@ -208,10 +198,8 @@ public class NotificationManager {
|
||||
if (!mcMMO.p.getGeneralConfig().adminNotifications())
|
||||
return;
|
||||
|
||||
for(Player player : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if (player.isOp() || Permissions.adminChat(player))
|
||||
{
|
||||
for(Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (player.isOp() || Permissions.adminChat(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Others", msg));
|
||||
}
|
||||
}
|
||||
@@ -241,15 +229,13 @@ public class NotificationManager {
|
||||
*/
|
||||
String senderName = LocaleLoader.getString("Server.ConsoleName");
|
||||
|
||||
if (commandSender instanceof Player)
|
||||
{
|
||||
if (commandSender instanceof Player) {
|
||||
senderName = ((Player) commandSender).getDisplayName()
|
||||
+ ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId();
|
||||
}
|
||||
|
||||
//Send the notification
|
||||
switch(sensitiveCommandType)
|
||||
{
|
||||
switch(sensitiveCommandType) {
|
||||
case XPRATE_MODIFY:
|
||||
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others",
|
||||
addItemToFirstPositionOfArray(senderName, args)));
|
||||
|
@@ -30,8 +30,7 @@ public class PlayerLevelUtils {
|
||||
// }
|
||||
// }
|
||||
|
||||
public int getEarlyGameCutoff(PrimarySkillType primarySkillType)
|
||||
{
|
||||
public int getEarlyGameCutoff(PrimarySkillType primarySkillType) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -84,13 +84,11 @@ public final class UserManager {
|
||||
mcMMO.p.getLogger().info("Saving mcMMOPlayers... (" + trackedSyncData.size() + ")");
|
||||
|
||||
for (McMMOPlayer playerData : trackedSyncData) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Saving data for player: "+playerData.getPlayerName());
|
||||
playerData.getProfile().save(true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
catch (Exception e) {
|
||||
mcMMO.p.getLogger().warning("Could not save mcMMO player data for player: " + playerData.getPlayerName());
|
||||
}
|
||||
}
|
||||
|
@@ -155,8 +155,7 @@ public class ScoreboardManager {
|
||||
private static String formatAbility(ChatColor color, String abilityName) {
|
||||
if (mcMMO.p.getGeneralConfig().getShowAbilityNames()) {
|
||||
return getShortenedName(color + abilityName);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return color + LocaleLoader.getString("Scoreboard.Misc.Ability");
|
||||
}
|
||||
}
|
||||
@@ -553,8 +552,7 @@ public class ScoreboardManager {
|
||||
public static void changeScoreboard(ScoreboardWrapper wrapper, int displayTime) {
|
||||
if (displayTime == -1) {
|
||||
wrapper.showBoardWithNoRevert();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
wrapper.showBoardAndScheduleRevert(displayTime * Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
}
|
||||
|
@@ -112,8 +112,7 @@ public class ScoreboardWrapper {
|
||||
// Stop updating if it's no longer something displaying cooldowns
|
||||
if (isBoardShown() && (isSkillScoreboard() || isCooldownScoreboard())) {
|
||||
doSidebarUpdateSoon();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
stopCooldownUpdating();
|
||||
}
|
||||
}
|
||||
@@ -179,8 +178,7 @@ public class ScoreboardWrapper {
|
||||
if (mcMMO.p.getServer().getScoreboardManager() != null)
|
||||
this.oldBoard = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.oldBoard = previousBoard;
|
||||
}
|
||||
}
|
||||
@@ -231,8 +229,7 @@ public class ScoreboardWrapper {
|
||||
if (!tippedKeep) {
|
||||
tippedKeep = true;
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Tip.Keep"));
|
||||
}
|
||||
else if (!tippedClear) {
|
||||
} else if (!tippedClear) {
|
||||
tippedClear = true;
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Tip.Clear"));
|
||||
profile.increaseTipsShown();
|
||||
@@ -257,8 +254,7 @@ public class ScoreboardWrapper {
|
||||
//Modify the player based on the event
|
||||
event.getTargetPlayer().setScoreboard(event.getTargetBoard());
|
||||
oldBoard = null;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)");
|
||||
}
|
||||
}
|
||||
@@ -493,8 +489,7 @@ public class ScoreboardWrapper {
|
||||
|
||||
sidebarObjective.getScore(ScoreboardManager.LABEL_CURRENT_XP).setScore(currentXP);
|
||||
sidebarObjective.getScore(ScoreboardManager.LABEL_REMAINING_XP).setScore(mcMMOPlayer.getXpToLevel(targetSkill) - currentXP);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (PrimarySkillType parentSkill : mcMMO.p.getSkillTools().getChildSkillParents(targetSkill)) {
|
||||
sidebarObjective.getScore(ScoreboardManager.skillLabels.get(parentSkill)).setScore(mcMMOPlayer.getSkillLevel(parentSkill));
|
||||
}
|
||||
@@ -516,8 +511,7 @@ public class ScoreboardWrapper {
|
||||
cooldownBM.setScore(secondsBM);
|
||||
|
||||
stopUpdating = (secondsSB == 0 && secondsBM == 0);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
SuperAbilityType ability = mcMMO.p.getSkillTools().getSuperAbility(targetSkill);
|
||||
Score cooldown = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(ability));
|
||||
int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0);
|
||||
@@ -529,8 +523,7 @@ public class ScoreboardWrapper {
|
||||
|
||||
if (stopUpdating) {
|
||||
stopCooldownUpdating();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
startCooldownUpdating();
|
||||
}
|
||||
}
|
||||
@@ -551,8 +544,7 @@ public class ScoreboardWrapper {
|
||||
|
||||
if (anyCooldownsActive) {
|
||||
startCooldownUpdating();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
stopCooldownUpdating();
|
||||
}
|
||||
break;
|
||||
@@ -563,11 +555,9 @@ public class ScoreboardWrapper {
|
||||
|
||||
if (targetProfile != null) {
|
||||
newProfile = targetProfile; // offline
|
||||
}
|
||||
else if (targetPlayer == null) {
|
||||
} else if (targetPlayer == null) {
|
||||
newProfile = mcMMOPlayer.getProfile(); // self
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
newProfile = UserManager.getPlayer(targetPlayer).getProfile(); // online
|
||||
}
|
||||
|
||||
|
@@ -77,8 +77,7 @@ public final class CombatUtils {
|
||||
}
|
||||
|
||||
//Add Stab Damage
|
||||
if (swordsManager.canUseStab())
|
||||
{
|
||||
if (swordsManager.canUseStab()) {
|
||||
boostedDamage += (swordsManager.getStabDamage() * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
@@ -86,8 +85,7 @@ public final class CombatUtils {
|
||||
swordsManager.serratedStrikes(target, event.getDamage());
|
||||
}
|
||||
|
||||
if (canUseLimitBreak(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK))
|
||||
{
|
||||
if (canUseLimitBreak(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
|
||||
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
@@ -264,8 +262,7 @@ public final class CombatUtils {
|
||||
|
||||
if (axesManager.canImpact(target)) {
|
||||
axesManager.impactCheck(target);
|
||||
}
|
||||
else if (axesManager.canGreaterImpact(target)) {
|
||||
} else if (axesManager.canGreaterImpact(target)) {
|
||||
boostedDamage+=axesManager.greaterImpact(target);
|
||||
}
|
||||
|
||||
@@ -277,8 +274,7 @@ public final class CombatUtils {
|
||||
boostedDamage+=(axesManager.criticalHit(target, boostedDamage) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
if (canUseLimitBreak(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK))
|
||||
{
|
||||
if (canUseLimitBreak(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
|
||||
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
@@ -320,8 +316,7 @@ public final class CombatUtils {
|
||||
unarmedManager.disarmCheck((Player) target);
|
||||
}
|
||||
|
||||
if (canUseLimitBreak(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))
|
||||
{
|
||||
if (canUseLimitBreak(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
|
||||
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
@@ -394,8 +389,7 @@ public final class CombatUtils {
|
||||
archeryManager.retrieveArrows(target, arrow);
|
||||
}
|
||||
|
||||
if (canUseLimitBreak(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK))
|
||||
{
|
||||
if (canUseLimitBreak(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
|
||||
boostedDamage+=getLimitBreakDamage(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK);
|
||||
}
|
||||
|
||||
@@ -494,8 +488,7 @@ public final class CombatUtils {
|
||||
processSwordCombat(target, player, event);
|
||||
|
||||
}
|
||||
}
|
||||
else if (ItemUtils.isAxe(heldItem)) {
|
||||
} else if (ItemUtils.isAxe(heldItem)) {
|
||||
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.AXES, target)) {
|
||||
return;
|
||||
}
|
||||
@@ -503,8 +496,7 @@ public final class CombatUtils {
|
||||
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.AXES)) {
|
||||
processAxeCombat(target, player, event);
|
||||
}
|
||||
}
|
||||
else if (ItemUtils.isUnarmed(heldItem)) {
|
||||
} else if (ItemUtils.isUnarmed(heldItem)) {
|
||||
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.UNARMED, target)) {
|
||||
return;
|
||||
}
|
||||
@@ -512,8 +504,7 @@ public final class CombatUtils {
|
||||
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.UNARMED)) {
|
||||
processUnarmedCombat(target, player, event);
|
||||
}
|
||||
}
|
||||
else if (ItemUtils.isTrident(heldItem)) {
|
||||
} else if (ItemUtils.isTrident(heldItem)) {
|
||||
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TRIDENTS, target)) {
|
||||
return;
|
||||
}
|
||||
@@ -521,8 +512,7 @@ public final class CombatUtils {
|
||||
if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.TRIDENTS)) {
|
||||
processTridentCombatMelee(target, player, event);
|
||||
}
|
||||
}
|
||||
else if (ItemUtils.isMace(heldItem)) {
|
||||
} else if (ItemUtils.isMace(heldItem)) {
|
||||
if (!mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.MACES, target)) {
|
||||
return;
|
||||
}
|
||||
@@ -543,8 +533,7 @@ public final class CombatUtils {
|
||||
processTamingCombat(target, master, wolf, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (painSource instanceof Trident trident) {
|
||||
} else if (painSource instanceof Trident trident) {
|
||||
ProjectileSource projectileSource = trident.getShooter();
|
||||
|
||||
if (projectileSource instanceof Player player) {
|
||||
@@ -554,8 +543,7 @@ public final class CombatUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (painSource instanceof Arrow arrow) {
|
||||
} else if (painSource instanceof Arrow arrow) {
|
||||
ProjectileSource projectileSource = arrow.getShooter();
|
||||
boolean isCrossbow = arrow.isShotFromCrossbow();
|
||||
if (projectileSource instanceof Player player) {
|
||||
@@ -590,8 +578,7 @@ public final class CombatUtils {
|
||||
* This cleans up names from displaying in chat as hearts
|
||||
* @param entity target entity
|
||||
*/
|
||||
public static void fixNames(@NotNull LivingEntity entity)
|
||||
{
|
||||
public static void fixNames(@NotNull LivingEntity entity) {
|
||||
List<MetadataValue> metadataValue = entity.getMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY);
|
||||
|
||||
if (metadataValue.size() <= 0)
|
||||
@@ -887,37 +874,27 @@ public final class CombatUtils {
|
||||
&& SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
||||
baseXP = 20 * ExperienceConfig.getInstance().getPlayerVersusPlayerXP();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (mcMMO.getModManager().isCustomEntity(target)) {
|
||||
baseXP = mcMMO.getModManager().getEntity(target).getXpMultiplier();
|
||||
}
|
||||
else if (target instanceof Animals) {
|
||||
} else if (target instanceof Animals) {
|
||||
EntityType type = target.getType();
|
||||
baseXP = ExperienceConfig.getInstance().getAnimalsXP(type);
|
||||
}
|
||||
else if (target instanceof Monster)
|
||||
{
|
||||
} else if (target instanceof Monster) {
|
||||
EntityType type = target.getType();
|
||||
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
EntityType type = target.getType();
|
||||
|
||||
if (ExperienceConfig.getInstance().hasCombatXP(type)) {
|
||||
if (type == EntityType.IRON_GOLEM)
|
||||
{
|
||||
if (type == EntityType.IRON_GOLEM) {
|
||||
if (!((IronGolem) target).isPlayerCreated()) {
|
||||
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
baseXP = ExperienceConfig.getInstance().getCombatXP(type);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
baseXP = 1.0;
|
||||
mcMMO.getModManager().addCustomEntity(target);
|
||||
}
|
||||
@@ -1036,22 +1013,17 @@ public final class CombatUtils {
|
||||
|
||||
if (ItemUtils.isWoodTool(inHand)) {
|
||||
tier = 1;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(inHand)) {
|
||||
} else if (ItemUtils.isStoneTool(inHand)) {
|
||||
tier = 2;
|
||||
}
|
||||
else if (ItemUtils.isIronTool(inHand)) {
|
||||
} else if (ItemUtils.isIronTool(inHand)) {
|
||||
tier = 3;
|
||||
}
|
||||
else if (ItemUtils.isGoldTool(inHand)) {
|
||||
} else if (ItemUtils.isGoldTool(inHand)) {
|
||||
tier = 1;
|
||||
}
|
||||
else if (ItemUtils.isDiamondTool(inHand)) {
|
||||
} else if (ItemUtils.isDiamondTool(inHand)) {
|
||||
tier = 4;
|
||||
} else if (ItemUtils.isNetheriteTool(inHand)) {
|
||||
tier = 5;
|
||||
}
|
||||
else if (mcMMO.getModManager().isCustomTool(inHand)) {
|
||||
} else if (mcMMO.getModManager().isCustomTool(inHand)) {
|
||||
tier = mcMMO.getModManager().getTool(inHand).getTier();
|
||||
}
|
||||
|
||||
|
@@ -19,11 +19,9 @@ public final class PerksUtils {
|
||||
public static int handleCooldownPerks(Player player, int cooldown) {
|
||||
if (Permissions.halvedCooldowns(player)) {
|
||||
cooldown *= 0.5;
|
||||
}
|
||||
else if (Permissions.thirdedCooldowns(player)) {
|
||||
} else if (Permissions.thirdedCooldowns(player)) {
|
||||
cooldown *= (2.0 / 3.0);
|
||||
}
|
||||
else if (Permissions.quarteredCooldowns(player)) {
|
||||
} else if (Permissions.quarteredCooldowns(player)) {
|
||||
cooldown *= 0.75;
|
||||
}
|
||||
|
||||
@@ -37,11 +35,9 @@ public final class PerksUtils {
|
||||
|
||||
if (Permissions.twelveSecondActivationBoost(player)) {
|
||||
ticks += 12;
|
||||
}
|
||||
else if (Permissions.eightSecondActivationBoost(player)) {
|
||||
} else if (Permissions.eightSecondActivationBoost(player)) {
|
||||
ticks += 8;
|
||||
}
|
||||
else if (Permissions.fourSecondActivationBoost(player)) {
|
||||
} else if (Permissions.fourSecondActivationBoost(player)) {
|
||||
ticks += 4;
|
||||
}
|
||||
|
||||
@@ -59,26 +55,19 @@ public final class PerksUtils {
|
||||
}
|
||||
|
||||
modifier = ExperienceConfig.getInstance().getCustomXpPerkBoost();
|
||||
}
|
||||
else if (Permissions.quadrupleXp(player, skill)) {
|
||||
} else if (Permissions.quadrupleXp(player, skill)) {
|
||||
modifier = 4;
|
||||
}
|
||||
else if (Permissions.tripleXp(player, skill)) {
|
||||
} else if (Permissions.tripleXp(player, skill)) {
|
||||
modifier = 3;
|
||||
}
|
||||
else if (Permissions.doubleAndOneHalfXp(player, skill)) {
|
||||
} else if (Permissions.doubleAndOneHalfXp(player, skill)) {
|
||||
modifier = 2.5;
|
||||
}
|
||||
else if (Permissions.doubleXp(player, skill)) {
|
||||
} else if (Permissions.doubleXp(player, skill)) {
|
||||
modifier = 2;
|
||||
}
|
||||
else if (Permissions.oneAndOneHalfXp(player, skill)) {
|
||||
} else if (Permissions.oneAndOneHalfXp(player, skill)) {
|
||||
modifier = 1.5;
|
||||
}
|
||||
else if (Permissions.oneAndAQuarterXp(player, skill)) {
|
||||
} else if (Permissions.oneAndAQuarterXp(player, skill)) {
|
||||
modifier = 1.25;
|
||||
}
|
||||
else if (Permissions.oneAndOneTenthXp(player, skill)) {
|
||||
} else if (Permissions.oneAndOneTenthXp(player, skill)) {
|
||||
modifier = 1.1;
|
||||
}
|
||||
|
||||
|
@@ -27,10 +27,8 @@ public class RankUtils {
|
||||
* @param primarySkillType the skill to check
|
||||
* @param newLevel the new level of this skill
|
||||
*/
|
||||
public static void executeSkillUnlockNotifications(Plugin plugin, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, int newLevel)
|
||||
{
|
||||
for(SubSkillType subSkillType : mcMMO.p.getSkillTools().getSubSkills(primarySkillType))
|
||||
{
|
||||
public static void executeSkillUnlockNotifications(Plugin plugin, McMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, int newLevel) {
|
||||
for(SubSkillType subSkillType : mcMMO.p.getSkillTools().getSubSkills(primarySkillType)) {
|
||||
int playerRankInSkill = getRank(mcMMOPlayer.getPlayer(), subSkillType);
|
||||
|
||||
HashMap<Integer, Integer> innerMap = subSkillRanks.get(subSkillType.toString());
|
||||
@@ -44,8 +42,7 @@ public class RankUtils {
|
||||
continue;
|
||||
|
||||
//The players level is the exact level requirement for this skill
|
||||
if (newLevel == innerMap.get(playerRankInSkill))
|
||||
{
|
||||
if (newLevel == innerMap.get(playerRankInSkill)) {
|
||||
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
|
||||
|
||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(mcMMOPlayer.getPlayer(), skillUnlockNotificationTask, (count * 100L));
|
||||
@@ -58,17 +55,14 @@ public class RankUtils {
|
||||
/**
|
||||
* Reset the interval between skill unlock notifications
|
||||
*/
|
||||
public static void resetUnlockDelayTimer()
|
||||
{
|
||||
public static void resetUnlockDelayTimer() {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
/* NEW SYSTEM */
|
||||
private static void addRanks(AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
private static void addRanks(AbstractSubSkill abstractSubSkill) {
|
||||
//Fill out the rank array
|
||||
for(int i = 0; i < abstractSubSkill.getNumRanks(); i++)
|
||||
{
|
||||
for(int i = 0; i < abstractSubSkill.getNumRanks(); i++) {
|
||||
//This adds the highest ranks first
|
||||
addRank(abstractSubSkill, abstractSubSkill.getNumRanks()-i);
|
||||
|
||||
@@ -77,11 +71,9 @@ public class RankUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addRanks(SubSkillType subSkillType)
|
||||
{
|
||||
private static void addRanks(SubSkillType subSkillType) {
|
||||
//Fill out the rank array
|
||||
for(int i = 0; i < subSkillType.getNumRanks(); i++)
|
||||
{
|
||||
for(int i = 0; i < subSkillType.getNumRanks(); i++) {
|
||||
//This adds the highest ranks first
|
||||
addRank(subSkillType, subSkillType.getNumRanks()-i);
|
||||
|
||||
@@ -93,15 +85,12 @@ public class RankUtils {
|
||||
/**
|
||||
* Populates the ranks for every skill we know about
|
||||
*/
|
||||
public static void populateRanks()
|
||||
{
|
||||
for(SubSkillType subSkillType : SubSkillType.values())
|
||||
{
|
||||
public static void populateRanks() {
|
||||
for(SubSkillType subSkillType : SubSkillType.values()) {
|
||||
addRanks(subSkillType);
|
||||
}
|
||||
|
||||
for(AbstractSubSkill abstractSubSkill : InteractionManager.getSubSkillList())
|
||||
{
|
||||
for(AbstractSubSkill abstractSubSkill : InteractionManager.getSubSkillList()) {
|
||||
addRanks(abstractSubSkill);
|
||||
}
|
||||
}
|
||||
@@ -112,8 +101,7 @@ public class RankUtils {
|
||||
* @param subSkillType the target subskill
|
||||
* @return true if the player has at least one rank in the skill
|
||||
*/
|
||||
public static boolean hasUnlockedSubskill(Player player, SubSkillType subSkillType)
|
||||
{
|
||||
public static boolean hasUnlockedSubskill(Player player, SubSkillType subSkillType) {
|
||||
int curRank = getRank(player, subSkillType);
|
||||
|
||||
//-1 means the skill has no unlockable levels and is therefor unlocked
|
||||
@@ -126,8 +114,7 @@ public class RankUtils {
|
||||
* @param abstractSubSkill the target subskill
|
||||
* @return true if the player has at least one rank in the skill
|
||||
*/
|
||||
public static boolean hasUnlockedSubskill(Player player, AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
public static boolean hasUnlockedSubskill(Player player, AbstractSubSkill abstractSubSkill) {
|
||||
int curRank = getRank(player, abstractSubSkill);
|
||||
|
||||
//-1 means the skill has no unlockable levels and is therefor unlocked
|
||||
@@ -141,8 +128,7 @@ public class RankUtils {
|
||||
* @param subSkillType the target subskill
|
||||
* @return true if the player is at least that rank in this subskill
|
||||
*/
|
||||
public static boolean hasReachedRank(int rank, Player player, SubSkillType subSkillType)
|
||||
{
|
||||
public static boolean hasReachedRank(int rank, Player player, SubSkillType subSkillType) {
|
||||
return getRank(player, subSkillType) >= rank;
|
||||
}
|
||||
|
||||
@@ -153,8 +139,7 @@ public class RankUtils {
|
||||
* @param abstractSubSkill the target subskill
|
||||
* @return true if the player is at least that rank in this subskill
|
||||
*/
|
||||
public static boolean hasReachedRank(int rank, Player player, AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
public static boolean hasReachedRank(int rank, Player player, AbstractSubSkill abstractSubSkill) {
|
||||
return getRank(player, abstractSubSkill) >= rank;
|
||||
}
|
||||
|
||||
@@ -164,8 +149,7 @@ public class RankUtils {
|
||||
* @param subSkillType Target subskill
|
||||
* @return The rank the player currently has achieved in this skill. -1 for skills without ranks.
|
||||
*/
|
||||
public static int getRank(McMMOPlayer mmoPlayer, SubSkillType subSkillType)
|
||||
{
|
||||
public static int getRank(McMMOPlayer mmoPlayer, SubSkillType subSkillType) {
|
||||
return getRank(mmoPlayer.getPlayer(), subSkillType);
|
||||
}
|
||||
|
||||
@@ -175,8 +159,7 @@ public class RankUtils {
|
||||
* @param subSkillType Target subskill
|
||||
* @return The rank the player currently has achieved in this skill. -1 for skills without ranks.
|
||||
*/
|
||||
public static int getRank(Player player, SubSkillType subSkillType)
|
||||
{
|
||||
public static int getRank(Player player, SubSkillType subSkillType) {
|
||||
String skillName = subSkillType.toString();
|
||||
int numRanks = subSkillType.getNumRanks();
|
||||
|
||||
@@ -198,8 +181,7 @@ public class RankUtils {
|
||||
//Skill level of parent skill
|
||||
int currentSkillLevel = UserManager.getPlayer(player).getSkillLevel(subSkillType.getParentSkill());
|
||||
|
||||
for(int i = 0; i < numRanks; i++)
|
||||
{
|
||||
for(int i = 0; i < numRanks; i++) {
|
||||
//Compare against the highest to lowest rank in that order
|
||||
int rank = numRanks-i;
|
||||
int unlockLevel = getRankUnlockLevel(subSkillType, rank);
|
||||
@@ -222,8 +204,7 @@ public class RankUtils {
|
||||
* @param abstractSubSkill Target subskill
|
||||
* @return The rank the player currently has achieved in this skill. -1 for skills without ranks.
|
||||
*/
|
||||
public static int getRank(Player player, AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
public static int getRank(Player player, AbstractSubSkill abstractSubSkill) {
|
||||
String skillName = abstractSubSkill.getConfigKeyName();
|
||||
int numRanks = abstractSubSkill.getNumRanks();
|
||||
|
||||
@@ -245,8 +226,7 @@ public class RankUtils {
|
||||
//Skill level of parent skill
|
||||
int currentSkillLevel = UserManager.getPlayer(player).getSkillLevel(abstractSubSkill.getPrimarySkill());
|
||||
|
||||
for(int i = 0; i < numRanks; i++)
|
||||
{
|
||||
for(int i = 0; i < numRanks; i++) {
|
||||
//Compare against the highest to lowest rank in that order
|
||||
int rank = numRanks-i;
|
||||
int unlockLevel = getRankUnlockLevel(abstractSubSkill, rank);
|
||||
@@ -268,8 +248,7 @@ public class RankUtils {
|
||||
* @param abstractSubSkill The subskill to add ranks for
|
||||
* @param rank The rank to add
|
||||
*/
|
||||
private static void addRank(AbstractSubSkill abstractSubSkill, int rank)
|
||||
{
|
||||
private static void addRank(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
initMaps(abstractSubSkill.getConfigKeyName());
|
||||
|
||||
HashMap<Integer, Integer> rankMap = subSkillRanks.get(abstractSubSkill.getConfigKeyName());
|
||||
@@ -278,8 +257,7 @@ public class RankUtils {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static void addRank(SubSkillType subSkillType, int rank)
|
||||
{
|
||||
private static void addRank(SubSkillType subSkillType, int rank) {
|
||||
initMaps(subSkillType.toString());
|
||||
|
||||
HashMap<Integer, Integer> rankMap = subSkillRanks.get(subSkillType.toString());
|
||||
@@ -300,13 +278,11 @@ public class RankUtils {
|
||||
* @param rank The target rank
|
||||
* @return The level at which this rank unlocks
|
||||
*/
|
||||
public static int getRankUnlockLevel(SubSkillType subSkillType, int rank)
|
||||
{
|
||||
public static int getRankUnlockLevel(SubSkillType subSkillType, int rank) {
|
||||
return RankConfig.getInstance().getSubSkillUnlockLevel(subSkillType, rank);
|
||||
}
|
||||
|
||||
public static int getRankUnlockLevel(AbstractSubSkill abstractSubSkill, int rank)
|
||||
{
|
||||
public static int getRankUnlockLevel(AbstractSubSkill abstractSubSkill, int rank) {
|
||||
return RankConfig.getInstance().getSubSkillUnlockLevel(abstractSubSkill, rank);
|
||||
}
|
||||
|
||||
@@ -315,8 +291,7 @@ public class RankUtils {
|
||||
* @param subSkillType target subskill
|
||||
* @return The unlock requirements for rank 1 in this skill
|
||||
*/
|
||||
public static int getUnlockLevel(SubSkillType subSkillType)
|
||||
{
|
||||
public static int getUnlockLevel(SubSkillType subSkillType) {
|
||||
return RankConfig.getInstance().getSubSkillUnlockLevel(subSkillType, 1);
|
||||
}
|
||||
|
||||
@@ -325,8 +300,7 @@ public class RankUtils {
|
||||
* @param abstractSubSkill target subskill
|
||||
* @return The unlock requirements for rank 1 in this skill
|
||||
*/
|
||||
public static int getUnlockLevel(AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
public static int getUnlockLevel(AbstractSubSkill abstractSubSkill) {
|
||||
return RankConfig.getInstance().getSubSkillUnlockLevel(abstractSubSkill, 1);
|
||||
}
|
||||
|
||||
@@ -335,13 +309,11 @@ public class RankUtils {
|
||||
* @param subSkillType target subskill
|
||||
* @return the last rank of a subskill
|
||||
*/
|
||||
public static int getHighestRank(SubSkillType subSkillType)
|
||||
{
|
||||
public static int getHighestRank(SubSkillType subSkillType) {
|
||||
return subSkillType.getNumRanks();
|
||||
}
|
||||
|
||||
public static String getHighestRankStr(SubSkillType subSkillType)
|
||||
{
|
||||
public static String getHighestRankStr(SubSkillType subSkillType) {
|
||||
return String.valueOf(subSkillType.getNumRanks());
|
||||
}
|
||||
|
||||
@@ -350,13 +322,11 @@ public class RankUtils {
|
||||
* @param abstractSubSkill target subskill
|
||||
* @return the last rank of a subskill
|
||||
*/
|
||||
public static int getHighestRank(AbstractSubSkill abstractSubSkill)
|
||||
{
|
||||
public static int getHighestRank(AbstractSubSkill abstractSubSkill) {
|
||||
return abstractSubSkill.getNumRanks();
|
||||
}
|
||||
|
||||
public static int getSuperAbilityUnlockRequirement(SuperAbilityType superAbilityType)
|
||||
{
|
||||
public static int getSuperAbilityUnlockRequirement(SuperAbilityType superAbilityType) {
|
||||
return getRankUnlockLevel(superAbilityType.getSubSkillTypeDefinition(), 1);
|
||||
}
|
||||
|
||||
|
@@ -61,8 +61,7 @@ public final class SkillUtils {
|
||||
|
||||
int length;
|
||||
|
||||
if (abilityLengthCap > 0)
|
||||
{
|
||||
if (abilityLengthCap > 0) {
|
||||
length = (int) Math.min(abilityLengthCap, 2 + (skillValue / abilityLengthVar));
|
||||
} else {
|
||||
length = 2 + (int) (skillValue / abilityLengthVar);
|
||||
@@ -181,8 +180,7 @@ public final class SkillUtils {
|
||||
|
||||
int ticks;
|
||||
|
||||
if (abilityLengthCap > 0)
|
||||
{
|
||||
if (abilityLengthCap > 0) {
|
||||
ticks = PerksUtils.handleActivationPerks(player, Math.min(abilityLengthCap, 2 + (mcMMOPlayer.getSkillLevel(skill) / abilityLengthVar)),
|
||||
mcMMO.p.getSkillTools().getSuperAbilityMaxLength(mcMMO.p.getSkillTools().getSuperAbility(skill))) * Misc.TICK_CONVERSION_FACTOR;
|
||||
} else {
|
||||
@@ -284,26 +282,19 @@ public final class SkillUtils {
|
||||
public static Material getRepairAndSalvageItem(@NotNull ItemStack inHand) {
|
||||
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
|
||||
return Material.DIAMOND;
|
||||
}
|
||||
else if (ItemUtils.isGoldTool(inHand) || ItemUtils.isGoldArmor(inHand)) {
|
||||
} else if (ItemUtils.isGoldTool(inHand) || ItemUtils.isGoldArmor(inHand)) {
|
||||
return Material.GOLD_INGOT;
|
||||
}
|
||||
else if (ItemUtils.isIronTool(inHand) || ItemUtils.isIronArmor(inHand)) {
|
||||
} else if (ItemUtils.isIronTool(inHand) || ItemUtils.isIronArmor(inHand)) {
|
||||
return Material.IRON_INGOT;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(inHand)) {
|
||||
} else if (ItemUtils.isStoneTool(inHand)) {
|
||||
return Material.COBBLESTONE;
|
||||
}
|
||||
else if (ItemUtils.isWoodTool(inHand)) {
|
||||
} else if (ItemUtils.isWoodTool(inHand)) {
|
||||
return Material.OAK_WOOD;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(inHand)) {
|
||||
} else if (ItemUtils.isLeatherArmor(inHand)) {
|
||||
return Material.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(inHand)) {
|
||||
} else if (ItemUtils.isStringTool(inHand)) {
|
||||
return Material.STRING;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -13,28 +13,24 @@ public class SoundManager {
|
||||
* Sends a sound to the player
|
||||
* @param soundType the type of sound
|
||||
*/
|
||||
public static void sendSound(Player player, Location location, SoundType soundType)
|
||||
{
|
||||
public static void sendSound(Player player, Location location, SoundType soundType) {
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), SoundCategory.MASTER, getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory)
|
||||
{
|
||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory) {
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory, float pitchModifier)
|
||||
{
|
||||
public static void sendCategorizedSound(Player player, Location location, SoundType soundType, SoundCategory soundCategory, float pitchModifier) {
|
||||
float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier));
|
||||
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch);
|
||||
}
|
||||
|
||||
public static void worldSendSound(World world, Location location, SoundType soundType)
|
||||
{
|
||||
public static void worldSendSound(World world, Location location, SoundType soundType) {
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
@@ -49,13 +45,11 @@ public class SoundManager {
|
||||
* @param soundType target soundtype
|
||||
* @return the volume for this soundtype
|
||||
*/
|
||||
private static float getVolume(SoundType soundType)
|
||||
{
|
||||
private static float getVolume(SoundType soundType) {
|
||||
return SoundConfig.getInstance().getVolume(soundType) * SoundConfig.getInstance().getMasterVolume();
|
||||
}
|
||||
|
||||
private static float getPitch(SoundType soundType)
|
||||
{
|
||||
private static float getPitch(SoundType soundType) {
|
||||
if (soundType == SoundType.FIZZ)
|
||||
return getFizzPitch();
|
||||
else if (soundType == SoundType.POP)
|
||||
@@ -64,8 +58,7 @@ public class SoundManager {
|
||||
return SoundConfig.getInstance().getPitch(soundType);
|
||||
}
|
||||
|
||||
private static Sound getSound(SoundType soundType)
|
||||
{
|
||||
private static Sound getSound(SoundType soundType) {
|
||||
return switch (soundType) {
|
||||
case ANVIL -> Sound.BLOCK_ANVIL_PLACE;
|
||||
case ITEM_BREAK -> Sound.ENTITY_ITEM_BREAK;
|
||||
|
@@ -18,8 +18,7 @@ public enum SoundType {
|
||||
ITEM_CONSUMED,
|
||||
TIRED;
|
||||
|
||||
public boolean usesCustomPitch()
|
||||
{
|
||||
public boolean usesCustomPitch() {
|
||||
switch(this){
|
||||
case POP:
|
||||
case FIZZ:
|
||||
|
Reference in New Issue
Block a user