mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
if( -> if (
This commit is contained in:
@ -68,7 +68,7 @@ public final class BlockUtils {
|
||||
mcMMO.getPlaceStore().setTrue(block);
|
||||
|
||||
// Failsafe against lingering metadata
|
||||
if(block.hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
|
||||
if (block.hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
|
||||
block.removeMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, mcMMO.p);
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ public final class BlockUtils {
|
||||
* @param block target block
|
||||
*/
|
||||
public static void cleanupBlockMetadata(Block block) {
|
||||
if(block.hasMetadata(MetadataConstants.METADATA_KEY_REPLANT)) {
|
||||
if (block.hasMetadata(MetadataConstants.METADATA_KEY_REPLANT)) {
|
||||
block.removeMetadata(MetadataConstants.METADATA_KEY_REPLANT, mcMMO.p);
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ public final class BlockUtils {
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean affectedBySuperBreaker(BlockState blockState) {
|
||||
if(mcMMO.getMaterialMapStore().isIntendedToolPickaxe(blockState.getType()))
|
||||
if (mcMMO.getMaterialMapStore().isIntendedToolPickaxe(blockState.getType()))
|
||||
return true;
|
||||
|
||||
if (ExperienceConfig.getInstance().doesBlockGiveSkillXP(PrimarySkillType.MINING, blockState.getBlockData()))
|
||||
|
@ -54,7 +54,7 @@ public final class ChimaeraWing {
|
||||
mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Not loaded
|
||||
if(mcMMOPlayer == null)
|
||||
if (mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
if (mcMMOPlayer.getTeleportCommenceLocation() != null) {
|
||||
|
@ -38,7 +38,7 @@ public class ContainerMetadataUtils {
|
||||
}
|
||||
|
||||
public static void printOwnershipGainDebug(@NotNull BlockState blockState, @Nullable McMMOPlayer mmoPlayer) {
|
||||
if(mmoPlayer != null && mmoPlayer.isDebugMode()) {
|
||||
if (mmoPlayer != null && mmoPlayer.isDebugMode()) {
|
||||
mmoPlayer.getPlayer().sendMessage("Container ownership " +
|
||||
ChatColor.GREEN +"gained " + ChatColor.RESET +
|
||||
"at location: " + blockState.getLocation().toString());
|
||||
@ -48,11 +48,11 @@ public class ContainerMetadataUtils {
|
||||
public static void printOwnershipLossDebug(BlockState blockState) {
|
||||
OfflinePlayer containerOwner = getContainerOwner(blockState);
|
||||
|
||||
if(containerOwner != null && containerOwner.isOnline()) {
|
||||
if (containerOwner != null && containerOwner.isOnline()) {
|
||||
final McMMOPlayer mmoContainerOwner = UserManager.getPlayer(containerOwner.getPlayer());
|
||||
|
||||
if(mmoContainerOwner != null) {
|
||||
if(mmoContainerOwner.isDebugMode()) {
|
||||
if (mmoContainerOwner != null) {
|
||||
if (mmoContainerOwner.isDebugMode()) {
|
||||
mmoContainerOwner.getPlayer().sendMessage("Container ownership " +
|
||||
ChatColor.RED + "lost " + ChatColor.RESET +
|
||||
"at location: " + blockState.getLocation().toString());
|
||||
@ -65,7 +65,7 @@ public class ContainerMetadataUtils {
|
||||
if (container instanceof PersistentDataHolder persistentDataHolder) {
|
||||
final UUID uuid = getOwner(persistentDataHolder);
|
||||
|
||||
if(uuid != null) {
|
||||
if (uuid != null) {
|
||||
return Bukkit.getOfflinePlayer(uuid);
|
||||
}
|
||||
}
|
||||
@ -79,11 +79,11 @@ public class ContainerMetadataUtils {
|
||||
}
|
||||
|
||||
public static void processContainerOwnership(BlockState blockState, Player player) {
|
||||
if(!mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.SMELTING))
|
||||
if (!mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.SMELTING))
|
||||
return;
|
||||
|
||||
if(getContainerOwner(blockState) != null) {
|
||||
if(getContainerOwner(blockState).getUniqueId().equals(player.getUniqueId()))
|
||||
if (getContainerOwner(blockState) != null) {
|
||||
if (getContainerOwner(blockState).getUniqueId().equals(player.getUniqueId()))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class EnchantmentMapper {
|
||||
}
|
||||
|
||||
private Enchantment initInfinity() {
|
||||
// if(Registry.ENCHANTMENT.match("infinity") != null) {
|
||||
// if (Registry.ENCHANTMENT.match("infinity") != null) {
|
||||
// return Registry.ENCHANTMENT.match("infinity");
|
||||
// }
|
||||
|
||||
|
@ -123,7 +123,7 @@ public final class EventUtils {
|
||||
Entity entity = entityDamageEvent.getEntity();
|
||||
|
||||
//Check to make sure the entity is not an NPC
|
||||
if(Misc.isNPCEntityExcludingVillagers(entity))
|
||||
if (Misc.isNPCEntityExcludingVillagers(entity))
|
||||
return false;
|
||||
|
||||
if (!entity.isValid() || !(entity instanceof LivingEntity livingEntity)) {
|
||||
@ -143,7 +143,7 @@ public final class EventUtils {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
if (mcMMOPlayer == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -350,7 +350,7 @@ public final class EventUtils {
|
||||
public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
if (mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(teleportingPlayer, targetPlayer, mcMMOPlayer.getParty().getName());
|
||||
@ -398,7 +398,7 @@ public final class EventUtils {
|
||||
|
||||
public static boolean handleXpGainEvent(Player player, PrimarySkillType skill, float xpGained, XPGainReason xpGainReason) {
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
if(mmoPlayer == null)
|
||||
if (mmoPlayer == null)
|
||||
return true;
|
||||
|
||||
McMMOPlayerXpGainEvent event = new McMMOPlayerXpGainEvent(player, skill, xpGained, xpGainReason);
|
||||
@ -415,7 +415,7 @@ public final class EventUtils {
|
||||
}
|
||||
|
||||
public static boolean handleStatsLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) {
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if (UserManager.getPlayer(player) == null)
|
||||
return true;
|
||||
|
||||
McMMOPlayerStatLossEvent event = new McMMOPlayerStatLossEvent(player, levelChanged, experienceChanged);
|
||||
@ -432,7 +432,7 @@ public final class EventUtils {
|
||||
String skillName = primarySkillType.toString();
|
||||
int playerSkillLevel = playerProfile.getSkillLevel(primarySkillType);
|
||||
int threshold = mcMMO.p.getGeneralConfig().getHardcoreDeathStatPenaltyLevelThreshold();
|
||||
if(playerSkillLevel > threshold) {
|
||||
if (playerSkillLevel > threshold) {
|
||||
playerProfile.modifySkill(primarySkillType, Math.max(threshold, playerSkillLevel - levelChanged.get(skillName)));
|
||||
playerProfile.removeXp(primarySkillType, experienceChanged.get(skillName));
|
||||
|
||||
@ -468,11 +468,11 @@ public final class EventUtils {
|
||||
McMMOPlayer killerPlayer = UserManager.getPlayer(killer);
|
||||
|
||||
//Not loaded
|
||||
if(killerPlayer == null)
|
||||
if (killerPlayer == null)
|
||||
return true;
|
||||
|
||||
//Not loaded
|
||||
if(UserManager.getPlayer(victim) == null)
|
||||
if (UserManager.getPlayer(victim) == null)
|
||||
return true;
|
||||
|
||||
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
|
||||
|
@ -11,7 +11,7 @@ public class FixSpellingNetheriteUtil {
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Checking " + fileName + " config material names...");
|
||||
|
||||
File configFile = new File(pluginRef.getDataFolder(), fileName);
|
||||
if(configFile.exists()) {
|
||||
if (configFile.exists()) {
|
||||
BufferedReader bufferedReader = null;
|
||||
FileWriter fileWriter = null;
|
||||
try {
|
||||
@ -35,14 +35,14 @@ public class FixSpellingNetheriteUtil {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(bufferedReader != null) {
|
||||
if (bufferedReader != null) {
|
||||
try {
|
||||
bufferedReader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(fileWriter != null) {
|
||||
if (fileWriter != null) {
|
||||
try {
|
||||
fileWriter.close();
|
||||
} catch (IOException e) {
|
||||
|
@ -18,15 +18,15 @@ public final class HardcoreManager {
|
||||
|
||||
public static void invokeStatPenalty(Player player) {
|
||||
|
||||
if(WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if(!WorldGuardManager.getInstance().hasHardcoreFlag(player))
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasHardcoreFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
double statLossPercentage = mcMMO.p.getGeneralConfig().getHardcoreDeathStatPenaltyPercentage();
|
||||
int levelThreshold = mcMMO.p.getGeneralConfig().getHardcoreDeathStatPenaltyLevelThreshold();
|
||||
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if (UserManager.getPlayer(player) == null)
|
||||
return;
|
||||
|
||||
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
|
||||
@ -69,15 +69,15 @@ public final class HardcoreManager {
|
||||
|
||||
public static void invokeVampirism(Player killer, Player victim) {
|
||||
|
||||
if(WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if(!WorldGuardManager.getInstance().hasHardcoreFlag(killer) || !WorldGuardManager.getInstance().hasHardcoreFlag(victim))
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasHardcoreFlag(killer) || !WorldGuardManager.getInstance().hasHardcoreFlag(victim))
|
||||
return;
|
||||
}
|
||||
|
||||
double vampirismStatLeechPercentage = mcMMO.p.getGeneralConfig().getHardcoreVampirismStatLeechPercentage();
|
||||
int levelThreshold = mcMMO.p.getGeneralConfig().getHardcoreVampirismLevelThreshold();
|
||||
|
||||
if(UserManager.getPlayer(killer) == null || UserManager.getPlayer(victim) == null)
|
||||
if (UserManager.getPlayer(killer) == null || UserManager.getPlayer(victim) == null)
|
||||
return;
|
||||
|
||||
PlayerProfile killerProfile = UserManager.getPlayer(killer).getProfile();
|
||||
|
@ -313,7 +313,7 @@
|
||||
// }
|
||||
//
|
||||
// public boolean isAprilFirst() {
|
||||
// if(!Config.getInstance().isAprilFoolsAllowed())
|
||||
// if (!Config.getInstance().isAprilFoolsAllowed())
|
||||
// return false;
|
||||
//
|
||||
// GregorianCalendar aprilFirst = new GregorianCalendar(currentYear, Calendar.APRIL, 1);
|
||||
@ -323,7 +323,7 @@
|
||||
// }
|
||||
//
|
||||
// public boolean nearingAprilFirst() {
|
||||
// if(!Config.getInstance().isAprilFoolsAllowed())
|
||||
// if (!Config.getInstance().isAprilFoolsAllowed())
|
||||
// return false;
|
||||
//
|
||||
// GregorianCalendar start = new GregorianCalendar(Calendar.getInstance().get(Calendar.YEAR), Calendar.MARCH, 28);
|
||||
@ -366,7 +366,7 @@
|
||||
// }
|
||||
//
|
||||
// public void levelUpApril(Player player, FakeSkillType fakeSkillType) {
|
||||
// if(!Config.getInstance().isAprilFoolsAllowed())
|
||||
// if (!Config.getInstance().isAprilFoolsAllowed())
|
||||
// return;
|
||||
//
|
||||
// final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
@ -379,7 +379,7 @@
|
||||
// }
|
||||
//
|
||||
// public void registerAprilCommand() {
|
||||
// if(!Config.getInstance().isAprilFoolsAllowed())
|
||||
// if (!Config.getInstance().isAprilFoolsAllowed())
|
||||
// return;
|
||||
//
|
||||
// PluginCommand command = mcMMO.p.getCommand("crafting");
|
||||
|
@ -70,7 +70,7 @@ public final class ItemMetadataUtils {
|
||||
int originalSpeed = getSuperAbilityToolOriginalDigSpeed(itemStack);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if(itemMeta != null) {
|
||||
if (itemMeta != null) {
|
||||
//TODO: can be optimized
|
||||
if (itemMeta.hasEnchant(mcMMO.p.getEnchantmentMapper().getEfficiency())) {
|
||||
itemMeta.removeEnchant(mcMMO.p.getEnchantmentMapper().getEfficiency());
|
||||
|
@ -183,7 +183,7 @@ public final class ItemUtils {
|
||||
public static boolean doesPlayerHaveEnchantmentOnArmor(@NotNull Player player, @NotNull String enchantmentByName) {
|
||||
Enchantment enchantment = getEnchantment(enchantmentByName);
|
||||
|
||||
if(enchantment == null)
|
||||
if (enchantment == null)
|
||||
return false;
|
||||
|
||||
return doesPlayerHaveEnchantmentOnArmor(player, enchantment);
|
||||
@ -191,8 +191,8 @@ public final class ItemUtils {
|
||||
|
||||
public static boolean doesPlayerHaveEnchantmentOnArmor(@NotNull Player player, @NotNull Enchantment enchantment) {
|
||||
for(ItemStack itemStack : player.getInventory().getArmorContents()) {
|
||||
if(itemStack != null) {
|
||||
if(hasEnchantment(itemStack, enchantment))
|
||||
if (itemStack != null) {
|
||||
if (hasEnchantment(itemStack, enchantment))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -203,17 +203,17 @@ public final class ItemUtils {
|
||||
public static boolean doesPlayerHaveEnchantmentOnArmorOrHands(@NotNull Player player, @NotNull String enchantmentName) {
|
||||
Enchantment enchantment = getEnchantment(enchantmentName);
|
||||
|
||||
if(enchantment == null)
|
||||
if (enchantment == null)
|
||||
return false;
|
||||
|
||||
return doesPlayerHaveEnchantmentOnArmorOrHands(player, enchantment);
|
||||
}
|
||||
|
||||
public static boolean doesPlayerHaveEnchantmentOnArmorOrHands(@NotNull Player player, @NotNull Enchantment enchantment) {
|
||||
if(doesPlayerHaveEnchantmentOnArmor(player, enchantment))
|
||||
if (doesPlayerHaveEnchantmentOnArmor(player, enchantment))
|
||||
return true;
|
||||
|
||||
if(doesPlayerHaveEnchantmentInHands(player, enchantment))
|
||||
if (doesPlayerHaveEnchantmentInHands(player, enchantment))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -222,7 +222,7 @@ public final class ItemUtils {
|
||||
public static boolean doesPlayerHaveEnchantmentInHands(@NotNull Player player, @NotNull NamespacedKey enchantmentNameKey) {
|
||||
Enchantment enchantment = Enchantment.getByKey(enchantmentNameKey);
|
||||
|
||||
if(enchantment == null)
|
||||
if (enchantment == null)
|
||||
return false;
|
||||
|
||||
return doesPlayerHaveEnchantmentInHands(player, enchantment);
|
||||
@ -231,7 +231,7 @@ public final class ItemUtils {
|
||||
public static boolean doesPlayerHaveEnchantmentInHands(@NotNull Player player, @NotNull String enchantmentName) {
|
||||
Enchantment enchantment = getEnchantment(enchantmentName);
|
||||
|
||||
if(enchantment == null)
|
||||
if (enchantment == null)
|
||||
return false;
|
||||
|
||||
return doesPlayerHaveEnchantmentInHands(player, enchantment);
|
||||
@ -243,7 +243,7 @@ public final class ItemUtils {
|
||||
}
|
||||
|
||||
public static boolean hasEnchantment(@NotNull ItemStack itemStack, @NotNull Enchantment enchantment) {
|
||||
if(itemStack.getItemMeta() != null) {
|
||||
if (itemStack.getItemMeta() != null) {
|
||||
return itemStack.getItemMeta().hasEnchant(enchantment);
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ public final class ItemUtils {
|
||||
|
||||
public static @Nullable Enchantment getEnchantment(@NotNull String enchantmentName) {
|
||||
for(Enchantment enchantment : Enchantment.values()) {
|
||||
if(enchantment.getKey().getKey().equalsIgnoreCase(enchantmentName)) {
|
||||
if (enchantment.getKey().getKey().equalsIgnoreCase(enchantmentName)) {
|
||||
return enchantment;
|
||||
}
|
||||
}
|
||||
@ -695,7 +695,7 @@ public final class ItemUtils {
|
||||
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
|
||||
if(itemMeta == null)
|
||||
if (itemMeta == null)
|
||||
return false;
|
||||
|
||||
return itemMeta.getLore() != null
|
||||
@ -709,7 +709,7 @@ public final class ItemUtils {
|
||||
|
||||
ItemMeta itemMeta = item.getItemMeta();
|
||||
|
||||
if(itemMeta == null)
|
||||
if (itemMeta == null)
|
||||
return false;
|
||||
|
||||
return itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
|
||||
@ -719,7 +719,7 @@ public final class ItemUtils {
|
||||
// ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
// List<String> itemLore = new ArrayList<>();
|
||||
//
|
||||
// if(itemMeta == null)
|
||||
// if (itemMeta == null)
|
||||
// return;
|
||||
//
|
||||
// if (itemMeta.hasLore()) {
|
||||
@ -735,13 +735,13 @@ public final class ItemUtils {
|
||||
public static void removeAbilityLore(@NotNull ItemStack itemStack) {
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if(itemMeta == null)
|
||||
if (itemMeta == null)
|
||||
return;
|
||||
|
||||
if (itemMeta.hasLore()) {
|
||||
List<String> itemLore = itemMeta.getLore();
|
||||
|
||||
if(itemLore == null)
|
||||
if (itemLore == null)
|
||||
return;
|
||||
|
||||
if (itemLore.remove("mcMMO Ability Tool")) {
|
||||
@ -754,7 +754,7 @@ public final class ItemUtils {
|
||||
public static void addDigSpeedToItem(@NotNull ItemStack itemStack, int existingEnchantLevel) {
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if(itemMeta == null)
|
||||
if (itemMeta == null)
|
||||
return;
|
||||
|
||||
itemMeta.addEnchant(mcMMO.p.getEnchantmentMapper().getEfficiency(),
|
||||
@ -771,7 +771,7 @@ public final class ItemUtils {
|
||||
EnchantmentWrapper enchantmentWrapper = getRandomEnchantment(fishingTreasureBook.getLegalEnchantments());
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if(itemMeta == null) {
|
||||
if (itemMeta == null) {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ public final class Misc {
|
||||
Location spawnLocation = fromLocation.clone();
|
||||
Location targetLocation = toLocation.clone();
|
||||
|
||||
if(spawnLocation.getWorld() == null)
|
||||
if (spawnLocation.getWorld() == null)
|
||||
return null;
|
||||
|
||||
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
|
||||
@ -318,7 +318,7 @@ public final class Misc {
|
||||
// }
|
||||
|
||||
public static void spawnExperienceOrb(@NotNull Location location, int experienceValue) {
|
||||
if(location.getWorld() == null)
|
||||
if (location.getWorld() == null)
|
||||
return;
|
||||
|
||||
ExperienceOrb experienceOrb = (ExperienceOrb) location.getWorld().spawnEntity(location, EntityType.EXPERIENCE_ORB);
|
||||
@ -336,7 +336,7 @@ public final class Misc {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(location == null || location.getWorld() == null)
|
||||
if (location == null || location.getWorld() == null)
|
||||
return;
|
||||
|
||||
ExperienceOrb experienceOrb = (ExperienceOrb) location.getWorld().spawnEntity(location, EntityType.EXPERIENCE_ORB);
|
||||
@ -352,7 +352,7 @@ public final class Misc {
|
||||
//
|
||||
// double win = 0, loss = 0;
|
||||
// for(int x = 0; x < iterations; x++) {
|
||||
// if(RandomChanceUtil.checkRandomChanceExecutionSuccess(normalPlayer.getPlayer(), SubSkillType.MINING_MOTHER_LODE, true)) {
|
||||
// if (RandomChanceUtil.checkRandomChanceExecutionSuccess(normalPlayer.getPlayer(), SubSkillType.MINING_MOTHER_LODE, true)) {
|
||||
// win++;
|
||||
// } else {
|
||||
// loss++;
|
||||
|
@ -54,7 +54,7 @@ public final class MobHealthbarUtils {
|
||||
/*
|
||||
* Store the name in metadata
|
||||
*/
|
||||
if(target.getMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY).size() <= 0)
|
||||
if (target.getMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY).size() <= 0)
|
||||
target.setMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY, new OldName(originalName, plugin));
|
||||
|
||||
if (oldName == null) {
|
||||
|
@ -147,7 +147,7 @@ public class TransientEntityTracker {
|
||||
private synchronized @Nullable HashSet<TrackedTamingEntity> getTrackedEntities(@NotNull UUID playerUUID, @NotNull CallOfTheWildType callOfTheWildType) {
|
||||
HashMap<CallOfTheWildType, HashSet<TrackedTamingEntity>> playerEntityMap = getPlayerTrackedEntityMap(playerUUID);
|
||||
|
||||
if(playerEntityMap == null)
|
||||
if (playerEntityMap == null)
|
||||
return null;
|
||||
|
||||
return playerEntityMap.get(callOfTheWildType);
|
||||
@ -196,12 +196,12 @@ public class TransientEntityTracker {
|
||||
|
||||
HashSet<TrackedTamingEntity> trackedEntities = getTrackedEntities(uuid, callOfTheWildType);
|
||||
|
||||
if(trackedEntities == null)
|
||||
if (trackedEntities == null)
|
||||
continue;
|
||||
|
||||
Iterator<TrackedTamingEntity> iterator = trackedEntities.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
if(iterator.next().getLivingEntity().equals(livingEntity)) {
|
||||
if (iterator.next().getLivingEntity().equals(livingEntity)) {
|
||||
iterator.remove();
|
||||
return;
|
||||
}
|
||||
@ -220,7 +220,7 @@ public class TransientEntityTracker {
|
||||
ArrayList<LivingEntity> matchingEntities = new ArrayList<>();
|
||||
|
||||
for(LivingEntity livingEntity : getChunkLookupCache()) {
|
||||
if(livingEntity.getLocation().getChunk().equals(chunk)) {
|
||||
if (livingEntity.getLocation().getChunk().equals(chunk)) {
|
||||
matchingEntities.add(livingEntity);
|
||||
}
|
||||
}
|
||||
@ -238,7 +238,7 @@ public class TransientEntityTracker {
|
||||
public synchronized int getAmountCurrentlySummoned(@NotNull UUID playerUUID, @NotNull CallOfTheWildType callOfTheWildType) {
|
||||
HashSet<TrackedTamingEntity> trackedEntities = getTrackedEntities(playerUUID, callOfTheWildType);
|
||||
|
||||
if(trackedEntities == null)
|
||||
if (trackedEntities == null)
|
||||
return 0;
|
||||
|
||||
return trackedEntities.size();
|
||||
@ -253,7 +253,7 @@ public class TransientEntityTracker {
|
||||
*/
|
||||
public synchronized void removeSummon(@NotNull LivingEntity livingEntity, @Nullable Player player, boolean timeExpired) {
|
||||
//Kill the summon & remove it
|
||||
if(livingEntity.isValid()) {
|
||||
if (livingEntity.isValid()) {
|
||||
livingEntity.setHealth(0); //Should trigger entity death events
|
||||
livingEntity.remove();
|
||||
|
||||
@ -265,8 +265,8 @@ public class TransientEntityTracker {
|
||||
}
|
||||
|
||||
//Inform player of summon death
|
||||
if(player != null && player.isOnline()) {
|
||||
if(timeExpired) {
|
||||
if (player != null && player.isOnline()) {
|
||||
if (timeExpired) {
|
||||
NotificationManager.sendPlayerInformationChatOnly(player, "Taming.Summon.COTW.TimeExpired", StringUtils.getPrettyEntityTypeString(livingEntity.getType()));
|
||||
} else {
|
||||
NotificationManager.sendPlayerInformationChatOnly(player, "Taming.Summon.COTW.Removed", StringUtils.getPrettyEntityTypeString(livingEntity.getType()));
|
||||
@ -302,7 +302,7 @@ public class TransientEntityTracker {
|
||||
for(CallOfTheWildType callOfTheWildType : CallOfTheWildType.values()) {
|
||||
HashSet<TrackedTamingEntity> trackedEntities = getTrackedEntities(playerUUID, callOfTheWildType);
|
||||
|
||||
if(trackedEntities == null) {
|
||||
if (trackedEntities == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class TransientMetadataTools {
|
||||
}
|
||||
|
||||
//Gets assigned to endermen, potentially doesn't get cleared before this point
|
||||
if(entity.hasMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK)) {
|
||||
if (entity.hasMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK)) {
|
||||
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef);
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ public class TransientMetadataTools {
|
||||
|
||||
//TODO: This loop has some redundancy, this whole method needs to be rewritten
|
||||
for(String key : MetadataConstants.MOB_METADATA_KEYS) {
|
||||
if(entity.hasMetadata(key)) {
|
||||
if (entity.hasMetadata(key)) {
|
||||
entity.removeMetadata(key, pluginRef);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public final class CommandUtils {
|
||||
}
|
||||
|
||||
public static boolean tooFar(CommandSender sender, Player target, boolean hasPermission) {
|
||||
if(!target.isOnline() && !hasPermission) {
|
||||
if (!target.isOnline() && !hasPermission) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
} else if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), mcMMO.p.getGeneralConfig().getInspectDistance()) && !hasPermission) {
|
||||
@ -217,7 +217,7 @@ public final class CommandUtils {
|
||||
}
|
||||
|
||||
private static void printGroupedSkillData(Player inspectTarget, CommandSender display, String header, List<PrimarySkillType> skillGroup) {
|
||||
if(UserManager.getPlayer(inspectTarget) == null)
|
||||
if (UserManager.getPlayer(inspectTarget) == null)
|
||||
return;
|
||||
|
||||
PlayerProfile profile = UserManager.getPlayer(inspectTarget).getProfile();
|
||||
|
@ -66,7 +66,7 @@ public class CompatibilityManager {
|
||||
}
|
||||
|
||||
private void initMasterAnglerLayer() {
|
||||
if(minecraftGameVersion.isAtLeast(1, 16, 3)) {
|
||||
if (minecraftGameVersion.isAtLeast(1, 16, 3)) {
|
||||
masterAnglerCompatibility = new MasterAnglerCompatibilityLayer();
|
||||
} else {
|
||||
masterAnglerCompatibility = null;
|
||||
@ -74,7 +74,7 @@ public class CompatibilityManager {
|
||||
}
|
||||
|
||||
private void initBungeeSerializerLayer() {
|
||||
if(minecraftGameVersion.isAtLeast(1, 16, 0)) {
|
||||
if (minecraftGameVersion.isAtLeast(1, 16, 0)) {
|
||||
bungeeSerializerCompatibilityLayer = new BungeeModernSerializerCompatibilityLayer();
|
||||
} else {
|
||||
bungeeSerializerCompatibilityLayer = new BungeeLegacySerializerCompatibilityLayer();
|
||||
@ -85,13 +85,13 @@ public class CompatibilityManager {
|
||||
|
||||
//TODO: move to text manager
|
||||
public void reportCompatibilityStatus(@NotNull CommandSender commandSender) {
|
||||
if(isFullyCompatibleServerSoftware) {
|
||||
if (isFullyCompatibleServerSoftware) {
|
||||
commandSender.sendMessage(LocaleLoader.getString("mcMMO.Template.Prefix",
|
||||
"mcMMO is fully compatible with the currently running server software."));
|
||||
} else {
|
||||
//TODO: Better messages for each incompatible layer
|
||||
for(CompatibilityType compatibilityType : CompatibilityType.values()) {
|
||||
if(!supportedLayers.get(compatibilityType)) {
|
||||
if (!supportedLayers.get(compatibilityType)) {
|
||||
commandSender.sendMessage(LocaleLoader.getString("mcMMO.Template.Prefix",
|
||||
LocaleLoader.getString("Compatibility.Layer.Unsupported", StringUtils.getCapitalized(compatibilityType.toString()))));
|
||||
}
|
||||
@ -115,7 +115,7 @@ public class CompatibilityManager {
|
||||
|
||||
private @NotNull NMSVersion determineNMSVersion() {
|
||||
//This bit here helps prevent mcMMO breaking if it isn't updated but the game continues to update
|
||||
if(minecraftGameVersion.isAtLeast(1, 17, 0)) {
|
||||
if (minecraftGameVersion.isAtLeast(1, 17, 0)) {
|
||||
return NMSVersion.NMS_1_17;
|
||||
}
|
||||
|
||||
@ -133,13 +133,13 @@ public class CompatibilityManager {
|
||||
case 16:
|
||||
if (minecraftGameVersion.getPatchVersion().asInt() == 1) {
|
||||
return NMSVersion.NMS_1_16_1;
|
||||
} else if(minecraftGameVersion.getPatchVersion().asInt() == 2) {
|
||||
} else if (minecraftGameVersion.getPatchVersion().asInt() == 2) {
|
||||
return NMSVersion.NMS_1_16_2;
|
||||
} else if(minecraftGameVersion.getPatchVersion().asInt() == 3) {
|
||||
} else if (minecraftGameVersion.getPatchVersion().asInt() == 3) {
|
||||
return NMSVersion.NMS_1_16_3;
|
||||
} else if(minecraftGameVersion.getPatchVersion().asInt() == 4) {
|
||||
} else if (minecraftGameVersion.getPatchVersion().asInt() == 4) {
|
||||
return NMSVersion.NMS_1_16_4;
|
||||
} else if(minecraftGameVersion.getPatchVersion().asInt() >= 5) {
|
||||
} else if (minecraftGameVersion.getPatchVersion().asInt() >= 5) {
|
||||
return NMSVersion.NMS_1_16_5;
|
||||
}
|
||||
case 17:
|
||||
|
@ -37,15 +37,15 @@
|
||||
// public PlayerAttackCooldownToolLayer(@NotNull NMSVersion nmsVersion) {
|
||||
// super(nmsVersion);
|
||||
// mcMMO.p.getLogger().info("Loading Compatibility Layer... (Player Attack Cooldown Exploit Prevention)");
|
||||
// if(!isCompatibleWithMinecraftVersion(nmsVersion)) {
|
||||
// if (!isCompatibleWithMinecraftVersion(nmsVersion)) {
|
||||
// mcMMO.p.getLogger().severe("this version of mcMMO does not support NMS for this version of Minecraft, try updating mcMMO or updating Minecraft. Not all versions of Minecraft will have NMS support built into mcMMO.");
|
||||
// cbNMSVersionPath = "";
|
||||
// } else {
|
||||
// if(NMSConstants.getCraftBukkitVersionPath(nmsVersion) != null) {
|
||||
// if (NMSConstants.getCraftBukkitVersionPath(nmsVersion) != null) {
|
||||
// cbNMSVersionPath = NMSConstants.getCraftBukkitVersionPath(nmsVersion);
|
||||
// noErrorsOnInitialize = initializeLayer();
|
||||
//
|
||||
// if(noErrorsOnInitialize) {
|
||||
// if (noErrorsOnInitialize) {
|
||||
// mcMMO.p.getLogger().info("Successfully Loaded Compatibility Layer! (Player Attack Cooldown Exploit Prevention)");
|
||||
// }
|
||||
// } else {
|
||||
|
@ -46,13 +46,13 @@ public class ExperienceBarManager {
|
||||
|
||||
public void updateExperienceBar(PrimarySkillType primarySkillType, Plugin plugin)
|
||||
{
|
||||
if(disabledBars.contains(primarySkillType)
|
||||
if (disabledBars.contains(primarySkillType)
|
||||
|| !ExperienceConfig.getInstance().isExperienceBarsEnabled()
|
||||
|| !ExperienceConfig.getInstance().isExperienceBarEnabled(primarySkillType))
|
||||
return;
|
||||
|
||||
//Init Bar
|
||||
if(experienceBars.get(primarySkillType) == null)
|
||||
if (experienceBars.get(primarySkillType) == null)
|
||||
experienceBars.put(primarySkillType, new ExperienceBarWrapper(primarySkillType, mcMMOPlayer));
|
||||
|
||||
//Get Bar
|
||||
@ -65,7 +65,7 @@ public class ExperienceBarManager {
|
||||
experienceBarWrapper.showExperienceBar();
|
||||
|
||||
//Setup Hide Bar Task
|
||||
if(experienceBarHideTaskHashMap.get(primarySkillType) != null)
|
||||
if (experienceBarHideTaskHashMap.get(primarySkillType) != null)
|
||||
{
|
||||
experienceBarHideTaskHashMap.get(primarySkillType).cancel();
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class ExperienceBarManager {
|
||||
}
|
||||
|
||||
private void scheduleHideTask(PrimarySkillType primarySkillType, Plugin plugin) {
|
||||
if(alwaysVisible.contains(primarySkillType))
|
||||
if (alwaysVisible.contains(primarySkillType))
|
||||
return;
|
||||
|
||||
ExperienceBarHideTask experienceBarHideTask = new ExperienceBarHideTask(this, mcMMOPlayer, primarySkillType);
|
||||
@ -84,7 +84,7 @@ public class ExperienceBarManager {
|
||||
|
||||
public void hideExperienceBar(PrimarySkillType primarySkillType)
|
||||
{
|
||||
if(experienceBars.containsKey(primarySkillType))
|
||||
if (experienceBars.containsKey(primarySkillType))
|
||||
experienceBars.get(primarySkillType).hideExperienceBar();
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ public class ExperienceBarManager {
|
||||
alwaysVisible.add(skillType);
|
||||
|
||||
//Remove lingering tasks
|
||||
if(experienceBarHideTaskHashMap.containsKey(skillType)) {
|
||||
if (experienceBarHideTaskHashMap.containsKey(skillType)) {
|
||||
experienceBarHideTaskHashMap.get(skillType).cancel();
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ public class ExperienceBarManager {
|
||||
disabledBars.add(skillType);
|
||||
|
||||
//Remove lingering tasks
|
||||
if(experienceBarHideTaskHashMap.containsKey(skillType)) {
|
||||
if (experienceBarHideTaskHashMap.containsKey(skillType)) {
|
||||
experienceBarHideTaskHashMap.get(skillType).cancel();
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ public class ExperienceBarManager {
|
||||
|
||||
private void informPlayer(@NotNull ExperienceBarManager.@NotNull XPBarSettingTarget settingTarget, @Nullable PrimarySkillType primarySkillType) {
|
||||
//Inform player of setting change
|
||||
if(settingTarget != XPBarSettingTarget.RESET) {
|
||||
if (settingTarget != XPBarSettingTarget.RESET) {
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.XPBar.SettingChanged", mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType), settingTarget.toString());
|
||||
} else {
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.XPBar.Reset");
|
||||
|
@ -57,9 +57,9 @@ public class ExperienceBarWrapper {
|
||||
private String getTitleTemplate() {
|
||||
//If they are using extra details
|
||||
|
||||
if(ExperienceConfig.getInstance().isEarlyGameBoostEnabled() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
|
||||
if (ExperienceConfig.getInstance().isEarlyGameBoostEnabled() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
|
||||
return LocaleLoader.getString("XPBar.Template.EarlyGameBoost");
|
||||
} else if(ExperienceConfig.getInstance().getAddExtraDetails())
|
||||
} else if (ExperienceConfig.getInstance().getAddExtraDetails())
|
||||
return LocaleLoader.getString("XPBar.Complex.Template", LocaleLoader.getString("XPBar."+niceSkillName, getLevel()), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
|
||||
|
||||
return LocaleLoader.getString("XPBar."+niceSkillName, getLevel(), getCurrentXP(), getMaxXP(), getPowerLevel(), getPercentageOfLevel());
|
||||
@ -99,23 +99,23 @@ public class ExperienceBarWrapper {
|
||||
|
||||
public void setProgress(double v) {
|
||||
//Clamp Values
|
||||
if(v < 0)
|
||||
if (v < 0)
|
||||
bossBar.setProgress(0.0D);
|
||||
|
||||
else if(v > 1)
|
||||
else if (v > 1)
|
||||
bossBar.setProgress(1.0D);
|
||||
else
|
||||
bossBar.setProgress(v);
|
||||
|
||||
//Check player level
|
||||
if(ExperienceConfig.getInstance().isEarlyGameBoostEnabled() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
|
||||
if (ExperienceConfig.getInstance().isEarlyGameBoostEnabled() && PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType)) {
|
||||
setColor(BarColor.YELLOW);
|
||||
} else {
|
||||
setColor(ExperienceConfig.getInstance().getExperienceBarColor(primarySkillType));
|
||||
}
|
||||
|
||||
//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();
|
||||
|
@ -135,7 +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 {
|
||||
@ -151,7 +151,7 @@ public class FormulaManager {
|
||||
private int processStandardXPToNextLevel(int level, FormulaType formulaType) {
|
||||
Map<Integer, Integer> experienceMapRef = formulaType == FormulaType.LINEAR ? experienceNeededStandardLinear : experienceNeededStandardExponential;
|
||||
|
||||
if(!experienceMapRef.containsKey(level)) {
|
||||
if (!experienceMapRef.containsKey(level)) {
|
||||
int experienceSum = 0;
|
||||
int retroIndex = (level * 10) + 1;
|
||||
|
||||
|
@ -73,7 +73,7 @@ public abstract class MajorMinorPatchVersion implements Versioned {
|
||||
|
||||
@Override
|
||||
public String getVersionStr() {
|
||||
if(isPatch()) {
|
||||
if (isPatch()) {
|
||||
return majorVersion.getVersionString() + "."
|
||||
+ minorVersion + "."
|
||||
+ patchVersion;
|
||||
|
@ -38,21 +38,21 @@ public class MinecraftGameVersion extends MajorMinorPatchVersion {
|
||||
public boolean isAtLeast(int majorVerNumber, int minorVerNumber, int patchVerNumber) {
|
||||
//First check if the major version is higher, if it is we have no need to check minor version or patch version
|
||||
|
||||
if(getMajorVersion().asInt() > majorVerNumber) {
|
||||
if (getMajorVersion().asInt() > majorVerNumber) {
|
||||
return true; //Major version is one higher and hierarchically more important than the other versions
|
||||
}
|
||||
|
||||
if(getMajorVersion().asInt() < majorVerNumber) {
|
||||
if (getMajorVersion().asInt() < majorVerNumber) {
|
||||
return false; //Major version is below, so return false
|
||||
}
|
||||
|
||||
//Major version meets the requirement, check minor version
|
||||
|
||||
if(getMinorVersion().asInt() > minorVerNumber) {
|
||||
if (getMinorVersion().asInt() > minorVerNumber) {
|
||||
return true; //Minor version is one higher and hierarchically more important than patch version, so exit here
|
||||
}
|
||||
|
||||
if(getMinorVersion().asInt() < minorVerNumber) {
|
||||
if (getMinorVersion().asInt() < minorVerNumber) {
|
||||
return false; //Minor version is at least one version behind, return false
|
||||
}
|
||||
|
||||
|
@ -72,9 +72,9 @@ public class PlatformManager {
|
||||
|
||||
//TODO: Rewrite this properly once we actually support a not-bukkit platform
|
||||
private @NotNull ServerSoftwareType determinePlatformType() {
|
||||
if(Bukkit.getVersion().toLowerCase(Locale.ENGLISH).contains("paper"))
|
||||
if (Bukkit.getVersion().toLowerCase(Locale.ENGLISH).contains("paper"))
|
||||
return ServerSoftwareType.PAPER;
|
||||
else if(Bukkit.getVersion().toLowerCase(Locale.ENGLISH).contains("spigot"))
|
||||
else if (Bukkit.getVersion().toLowerCase(Locale.ENGLISH).contains("spigot"))
|
||||
return ServerSoftwareType.SPIGOT;
|
||||
else
|
||||
return ServerSoftwareType.CRAFT_BUKKIT;
|
||||
|
@ -45,7 +45,7 @@ public class NotificationManager {
|
||||
*/
|
||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key)
|
||||
{
|
||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
|
||||
McMMOMessageType destination
|
||||
@ -61,7 +61,7 @@ public class NotificationManager {
|
||||
|
||||
public static boolean doesPlayerUseNotifications(Player player)
|
||||
{
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if (UserManager.getPlayer(player) == null)
|
||||
return false;
|
||||
else
|
||||
return UserManager.getPlayer(player).useChatNotifications();
|
||||
@ -84,7 +84,7 @@ public class NotificationManager {
|
||||
|
||||
public static void sendPlayerInformationChatOnly(Player player, String key, String... values)
|
||||
{
|
||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
|
||||
String preColoredString = LocaleLoader.getString(key, (Object[]) values);
|
||||
@ -93,7 +93,7 @@ public class NotificationManager {
|
||||
|
||||
public static void sendPlayerInformationChatOnlyPrefixed(Player player, String key, String... values)
|
||||
{
|
||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
|
||||
String preColoredString = LocaleLoader.getString(key, (Object[]) values);
|
||||
@ -104,7 +104,7 @@ public class NotificationManager {
|
||||
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key,
|
||||
String... values)
|
||||
{
|
||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
if (UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
|
||||
McMMOMessageType destination = mcMMO.p.getAdvancedConfig().doesNotificationUseActionBar(notificationType) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
||||
@ -123,11 +123,11 @@ public class NotificationManager {
|
||||
|
||||
|
||||
Component notificationTextComponent = customEvent.getNotificationTextComponent();
|
||||
if(customEvent.getChatMessageType() == McMMOMessageType.ACTION_BAR) {
|
||||
if (customEvent.getChatMessageType() == McMMOMessageType.ACTION_BAR) {
|
||||
audience.sendActionBar(notificationTextComponent);
|
||||
|
||||
// If the message is being sent to the action bar we need to check if a copy is also sent to the chat system
|
||||
if(customEvent.isMessageAlsoBeingSentToChat()) {
|
||||
if (customEvent.isMessageAlsoBeingSentToChat()) {
|
||||
//Send copy to chat system
|
||||
audience.sendMessage(notificationTextComponent);
|
||||
}
|
||||
@ -158,7 +158,7 @@ public class NotificationManager {
|
||||
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName,
|
||||
int levelsGained, int newLevel)
|
||||
{
|
||||
if(!mcMMOPlayer.useChatNotifications())
|
||||
if (!mcMMOPlayer.useChatNotifications())
|
||||
return;
|
||||
|
||||
McMMOMessageType destination
|
||||
@ -186,7 +186,7 @@ public class NotificationManager {
|
||||
|
||||
public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType)
|
||||
{
|
||||
if(!mcMMOPlayer.useChatNotifications())
|
||||
if (!mcMMOPlayer.useChatNotifications())
|
||||
return;
|
||||
|
||||
//CHAT MESSAGE
|
||||
@ -205,12 +205,12 @@ public class NotificationManager {
|
||||
*/
|
||||
private static void sendAdminNotification(String msg) {
|
||||
//If its not enabled exit
|
||||
if(!mcMMO.p.getGeneralConfig().adminNotifications())
|
||||
if (!mcMMO.p.getGeneralConfig().adminNotifications())
|
||||
return;
|
||||
|
||||
for(Player player : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(player.isOp() || Permissions.adminChat(player))
|
||||
if (player.isOp() || Permissions.adminChat(player))
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Others", msg));
|
||||
}
|
||||
@ -241,7 +241,7 @@ 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();
|
||||
@ -284,20 +284,20 @@ public class NotificationManager {
|
||||
}
|
||||
|
||||
public static void processLevelUpBroadcasting(@NotNull McMMOPlayer mmoPlayer, @NotNull PrimarySkillType primarySkillType, int level) {
|
||||
if(level <= 0)
|
||||
if (level <= 0)
|
||||
return;
|
||||
|
||||
//Check if broadcasting is enabled
|
||||
if(mcMMO.p.getGeneralConfig().shouldLevelUpBroadcasts()) {
|
||||
if (mcMMO.p.getGeneralConfig().shouldLevelUpBroadcasts()) {
|
||||
//Permission check
|
||||
if(!Permissions.levelUpBroadcast(mmoPlayer.getPlayer())) {
|
||||
if (!Permissions.levelUpBroadcast(mmoPlayer.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
|
||||
int levelInterval = mcMMO.p.getGeneralConfig().getLevelUpBroadcastInterval();
|
||||
int remainder = level % levelInterval;
|
||||
|
||||
if(remainder == 0) {
|
||||
if (remainder == 0) {
|
||||
//Grab appropriate audience
|
||||
Audience audience = mcMMO.getAudiences().filter(getLevelUpBroadcastPredicate(mmoPlayer.getPlayer()));
|
||||
//TODO: Make prettier
|
||||
@ -328,20 +328,20 @@ public class NotificationManager {
|
||||
//TODO: Remove the code duplication, am lazy atm
|
||||
//TODO: Fix broadcasts being skipped for situations where a player skips over the milestone like with the addlevels command
|
||||
public static void processPowerLevelUpBroadcasting(@NotNull McMMOPlayer mmoPlayer, int powerLevel) {
|
||||
if(powerLevel <= 0)
|
||||
if (powerLevel <= 0)
|
||||
return;
|
||||
|
||||
//Check if broadcasting is enabled
|
||||
if(mcMMO.p.getGeneralConfig().shouldPowerLevelUpBroadcasts()) {
|
||||
if (mcMMO.p.getGeneralConfig().shouldPowerLevelUpBroadcasts()) {
|
||||
//Permission check
|
||||
if(!Permissions.levelUpBroadcast(mmoPlayer.getPlayer())) {
|
||||
if (!Permissions.levelUpBroadcast(mmoPlayer.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
|
||||
int levelInterval = mcMMO.p.getGeneralConfig().getPowerLevelUpBroadcastInterval();
|
||||
int remainder = powerLevel % levelInterval;
|
||||
|
||||
if(remainder == 0) {
|
||||
if (remainder == 0) {
|
||||
//Grab appropriate audience
|
||||
Audience audience = mcMMO.getAudiences().filter(getPowerLevelUpBroadcastPredicate(mmoPlayer.getPlayer()));
|
||||
//TODO: Make prettier
|
||||
|
@ -19,7 +19,7 @@ public class PlayerLevelUtils {
|
||||
// int levelCap = Config.getInstance().getLevelCap(primarySkillType);
|
||||
// int cap;
|
||||
//
|
||||
// if(levelCap == Integer.MAX_VALUE || levelCap <= 0)
|
||||
// if (levelCap == Integer.MAX_VALUE || levelCap <= 0)
|
||||
// {
|
||||
// cap = Config.getInstance().getIsRetroMode() ? 50 : 5;
|
||||
// } else {
|
||||
|
@ -30,14 +30,14 @@ public final class UserManager {
|
||||
public static void track(@NotNull McMMOPlayer mcMMOPlayer) {
|
||||
mcMMOPlayer.getPlayer().setMetadata(MetadataConstants.METADATA_KEY_PLAYER_DATA, new FixedMetadataValue(mcMMO.p, mcMMOPlayer));
|
||||
|
||||
if(playerDataSet == null)
|
||||
if (playerDataSet == null)
|
||||
playerDataSet = new HashSet<>();
|
||||
|
||||
playerDataSet.add(mcMMOPlayer); //for sync saves on shutdown
|
||||
}
|
||||
|
||||
public static void cleanupPlayer(McMMOPlayer mcMMOPlayer) {
|
||||
if(playerDataSet != null)
|
||||
if (playerDataSet != null)
|
||||
playerDataSet.remove(mcMMOPlayer);
|
||||
}
|
||||
|
||||
@ -49,13 +49,13 @@ public final class UserManager {
|
||||
public static void remove(@NotNull Player player) {
|
||||
McMMOPlayer mcMMOPlayer = getPlayer(player);
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
if (mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
mcMMOPlayer.cleanup();
|
||||
player.removeMetadata(MetadataConstants.METADATA_KEY_PLAYER_DATA, mcMMO.p);
|
||||
|
||||
if(playerDataSet != null) {
|
||||
if (playerDataSet != null) {
|
||||
playerDataSet.remove(mcMMOPlayer); //Clear sync save tracking
|
||||
}
|
||||
}
|
||||
@ -68,7 +68,7 @@ public final class UserManager {
|
||||
remove(player);
|
||||
}
|
||||
|
||||
if(playerDataSet != null)
|
||||
if (playerDataSet != null)
|
||||
playerDataSet.clear(); //Clear sync save tracking
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ public final class UserManager {
|
||||
* Save all users ON THIS THREAD.
|
||||
*/
|
||||
public static void saveAll() {
|
||||
if(playerDataSet == null)
|
||||
if (playerDataSet == null)
|
||||
return;
|
||||
|
||||
ImmutableList<McMMOPlayer> trackedSyncData = ImmutableList.copyOf(playerDataSet);
|
||||
@ -139,14 +139,14 @@ public final class UserManager {
|
||||
*/
|
||||
public static @Nullable McMMOPlayer getPlayer(@Nullable Player player) {
|
||||
//Avoid Array Index out of bounds
|
||||
if(player != null && player.hasMetadata(MetadataConstants.METADATA_KEY_PLAYER_DATA))
|
||||
if (player != null && player.hasMetadata(MetadataConstants.METADATA_KEY_PLAYER_DATA))
|
||||
return (McMMOPlayer) player.getMetadata(MetadataConstants.METADATA_KEY_PLAYER_DATA).get(0).value();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
private static @Nullable McMMOPlayer retrieveMcMMOPlayer(@Nullable String playerName, boolean offlineValid) {
|
||||
if(playerName == null)
|
||||
if (playerName == null)
|
||||
return null;
|
||||
|
||||
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
||||
|
@ -46,7 +46,7 @@ public class ProbabilityUtil {
|
||||
double percentageValue = probability.getValue(); //Doesn't need to be scaled
|
||||
|
||||
//Apply lucky modifier
|
||||
if(isLucky) {
|
||||
if (isLucky) {
|
||||
percentageValue *= LUCKY_MODIFIER;
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ public class ProbabilityUtil {
|
||||
double percentageValue = probability.getValue();
|
||||
|
||||
//Apply lucky modifier
|
||||
if(isLucky) {
|
||||
if (isLucky) {
|
||||
percentageValue *= LUCKY_MODIFIER;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public class ProbabilityUtil {
|
||||
static SkillProbabilityType getProbabilityType(@NotNull SubSkillType subSkillType) {
|
||||
SkillProbabilityType skillProbabilityType = SkillProbabilityType.DYNAMIC_CONFIGURABLE;
|
||||
|
||||
if(subSkillType == SubSkillType.TAMING_FAST_FOOD_SERVICE
|
||||
if (subSkillType == SubSkillType.TAMING_FAST_FOOD_SERVICE
|
||||
|| subSkillType == SubSkillType.AXES_ARMOR_IMPACT
|
||||
|| subSkillType == SubSkillType.AXES_GREATER_IMPACT)
|
||||
skillProbabilityType = SkillProbabilityType.STATIC_CONFIGURABLE;
|
||||
@ -181,7 +181,7 @@ public class ProbabilityUtil {
|
||||
//Luck
|
||||
boolean isLucky = mmoPlayer != null && Permissions.lucky(mmoPlayer.getPlayer(), subSkillType.getParentSkill());
|
||||
|
||||
if(isLucky) {
|
||||
if (isLucky) {
|
||||
return probability.evaluate(LUCKY_MODIFIER);
|
||||
} else {
|
||||
return probability.evaluate();
|
||||
@ -224,7 +224,7 @@ public class ProbabilityUtil {
|
||||
if (mmoPlayer != null) {
|
||||
SubSkillEvent subSkillEvent = EventUtils.callSubSkillEvent(mmoPlayer, subSkillType);
|
||||
|
||||
if(subSkillEvent.isCancelled()) {
|
||||
if (subSkillEvent.isCancelled()) {
|
||||
return Probability.ALWAYS_FAILS;
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ public class ProbabilityUtil {
|
||||
double resultModifier = subSkillEvent.getResultModifier();
|
||||
|
||||
// Mutate probability
|
||||
if(resultModifier != 1.0D)
|
||||
if (resultModifier != 1.0D)
|
||||
probability = Probability.ofPercent(probability.getValue() * resultModifier);
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ public class ProbabilityUtil {
|
||||
@Nullable McMMOPlayer mmoPlayer, @NotNull Probability probability) {
|
||||
boolean isLucky = mmoPlayer != null && Permissions.lucky(mmoPlayer.getPlayer(), primarySkillType);
|
||||
|
||||
if(isLucky) {
|
||||
if (isLucky) {
|
||||
return probability.evaluate(LUCKY_MODIFIER);
|
||||
} else {
|
||||
return probability.evaluate();
|
||||
|
@ -185,18 +185,18 @@ public class ScoreboardManager {
|
||||
|
||||
// Called by PlayerQuitEvent listener and OnPlayerTeleport under certain circumstances
|
||||
public static void teardownPlayer(Player player) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
//Hacky world blacklist fix
|
||||
if(player.isOnline() && player.isValid()) {
|
||||
if(Bukkit.getServer().getScoreboardManager() != null)
|
||||
if (player.isOnline() && player.isValid()) {
|
||||
if (Bukkit.getServer().getScoreboardManager() != null)
|
||||
player.setScoreboard(Bukkit.getServer().getScoreboardManager().getMainScoreboard());
|
||||
}
|
||||
|
||||
if(getWrapper(player) != null) {
|
||||
if (getWrapper(player) != null) {
|
||||
ScoreboardWrapper wrapper = PLAYER_SCOREBOARDS.remove(player.getName());
|
||||
if(wrapper.revertTask != null) {
|
||||
if (wrapper.revertTask != null) {
|
||||
wrapper.revertTask.cancel();
|
||||
}
|
||||
}
|
||||
@ -225,12 +225,12 @@ public class ScoreboardManager {
|
||||
// Selfboards
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
if ((wrapper.isSkillScoreboard() && wrapper.targetSkill == skill) || (wrapper.isStatsScoreboard()) && wrapper.isBoardShown()) {
|
||||
wrapper.doSidebarUpdateSoon();
|
||||
}
|
||||
@ -270,12 +270,12 @@ public class ScoreboardManager {
|
||||
// Selfboards
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
if ((wrapper.isCooldownScoreboard() || wrapper.isSkillScoreboard() && wrapper.targetSkill == skill) && wrapper.isBoardShown()) {
|
||||
wrapper.doSidebarUpdateSoon();
|
||||
}
|
||||
@ -290,12 +290,12 @@ public class ScoreboardManager {
|
||||
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSkill(skill);
|
||||
|
||||
@ -309,12 +309,12 @@ public class ScoreboardManager {
|
||||
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSkill(primarySkillType);
|
||||
|
||||
@ -328,7 +328,7 @@ public class ScoreboardManager {
|
||||
// Do NOT run if already shown
|
||||
if (wrapper != null && wrapper.isBoardShown()) {
|
||||
|
||||
if(wrapper.isBoardShown())
|
||||
if (wrapper.isBoardShown())
|
||||
return;
|
||||
|
||||
wrapper.setOldScoreboard();
|
||||
@ -340,7 +340,7 @@ public class ScoreboardManager {
|
||||
public static void enablePlayerStatsScoreboard(Player player) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null)
|
||||
if (wrapper == null)
|
||||
return;
|
||||
|
||||
|
||||
@ -353,12 +353,12 @@ public class ScoreboardManager {
|
||||
public static void enablePlayerInspectScoreboard(@NotNull Player player, @NotNull PlayerProfile targetProfile) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeInspectStats(targetProfile);
|
||||
|
||||
@ -369,12 +369,12 @@ public class ScoreboardManager {
|
||||
public static void enablePlayerInspectScoreboard(@NotNull Player player, @NotNull McMMOPlayer targetMcMMOPlayer) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeInspectStats(targetMcMMOPlayer);
|
||||
|
||||
@ -385,12 +385,12 @@ public class ScoreboardManager {
|
||||
public static void enablePlayerCooldownScoreboard(Player player) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeCooldowns();
|
||||
|
||||
@ -401,12 +401,12 @@ public class ScoreboardManager {
|
||||
public static void showPlayerRankScoreboard(Player player, Map<PrimarySkillType, Integer> rank) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSelfRank();
|
||||
wrapper.acceptRankData(rank);
|
||||
@ -418,12 +418,12 @@ public class ScoreboardManager {
|
||||
public static void showPlayerRankScoreboardOthers(Player player, String targetName, Map<PrimarySkillType, Integer> rank) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeInspectRank(targetName);
|
||||
wrapper.acceptRankData(rank);
|
||||
@ -436,12 +436,12 @@ public class ScoreboardManager {
|
||||
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeTop(skill, pageNumber);
|
||||
wrapper.acceptLeaderboardData(stats);
|
||||
@ -453,12 +453,12 @@ public class ScoreboardManager {
|
||||
public static void showTopPowerScoreboard(Player player, int pageNumber, List<PlayerStat> stats) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
if (wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
if (wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeTopPower(pageNumber);
|
||||
wrapper.acceptLeaderboardData(stats);
|
||||
@ -468,7 +468,7 @@ public class ScoreboardManager {
|
||||
}
|
||||
|
||||
public static @Nullable ScoreboardWrapper getWrapper(Player player) {
|
||||
if(PLAYER_SCOREBOARDS.get(player.getName()) == null) {
|
||||
if (PLAYER_SCOREBOARDS.get(player.getName()) == null) {
|
||||
makeNewScoreboard(player);
|
||||
}
|
||||
|
||||
@ -518,7 +518,7 @@ public class ScoreboardManager {
|
||||
*/
|
||||
public static @Nullable Objective getPowerLevelObjective() {
|
||||
if (!mcMMO.p.getGeneralConfig().getPowerLevelTagsEnabled()) {
|
||||
if(getScoreboardManager() == null)
|
||||
if (getScoreboardManager() == null)
|
||||
return null;
|
||||
|
||||
Objective objective = getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
|
||||
@ -532,7 +532,7 @@ public class ScoreboardManager {
|
||||
}
|
||||
|
||||
|
||||
if(getScoreboardManager() == null)
|
||||
if (getScoreboardManager() == null)
|
||||
return null;
|
||||
|
||||
Objective powerObjective = getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);
|
||||
@ -580,7 +580,7 @@ public class ScoreboardManager {
|
||||
}
|
||||
|
||||
public static @Nullable ScoreboardWrapper makeNewScoreboard(Player player) {
|
||||
if(getScoreboardManager() == null)
|
||||
if (getScoreboardManager() == null)
|
||||
return null;
|
||||
|
||||
//Call our custom event
|
||||
|
@ -62,7 +62,7 @@ public class ScoreboardWrapper {
|
||||
|
||||
private void initBoard() {
|
||||
sidebarType = SidebarType.NONE;
|
||||
if(registered) {
|
||||
if (registered) {
|
||||
//Make sure our references are pointed at the right things
|
||||
sidebarObjective = scoreboard.getObjective(ScoreboardManager.SIDEBAR_OBJECTIVE);
|
||||
powerObjective = scoreboard.getObjective(ScoreboardManager.POWER_OBJECTIVE);
|
||||
@ -175,7 +175,7 @@ public class ScoreboardWrapper {
|
||||
if (previousBoard == scoreboard) { // Already displaying it
|
||||
if (this.oldBoard == null) {
|
||||
// (Shouldn't happen) Use failsafe value - we're already displaying our board, but we don't have the one we should revert to
|
||||
if(mcMMO.p.getServer().getScoreboardManager() != null)
|
||||
if (mcMMO.p.getServer().getScoreboardManager() != null)
|
||||
this.oldBoard = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard();
|
||||
}
|
||||
}
|
||||
@ -218,7 +218,7 @@ public class ScoreboardWrapper {
|
||||
// TODO is there any way to do the time that looks acceptable?
|
||||
// player.sendMessage(LocaleLoader.getString("Commands.Scoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase(Locale.ENGLISH)), ticks / 20F));
|
||||
|
||||
if(UserManager.getPlayer(playerName) == null)
|
||||
if (UserManager.getPlayer(playerName) == null)
|
||||
return;
|
||||
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
@ -411,7 +411,7 @@ public class ScoreboardWrapper {
|
||||
protected void loadObjective(String displayName) {
|
||||
//Unregister objective
|
||||
McMMOScoreboardObjectiveEvent unregisterEvent = callObjectiveEvent(ScoreboardObjectiveEventReason.UNREGISTER_THIS_OBJECTIVE);
|
||||
if(!unregisterEvent.isCancelled()) {
|
||||
if (!unregisterEvent.isCancelled()) {
|
||||
try {
|
||||
sidebarObjective.unregister();
|
||||
} catch (IllegalStateException e) {
|
||||
@ -419,7 +419,7 @@ public class ScoreboardWrapper {
|
||||
|
||||
LogUtils.debug(mcMMO.p.getLogger(), "Recovering scoreboard for player: " + player.getName());
|
||||
|
||||
if(mmoPlayer.isDebugMode())
|
||||
if (mmoPlayer.isDebugMode())
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(player, "Scoreboard.Recovery");
|
||||
|
||||
initBoard(); //Start over
|
||||
@ -429,7 +429,7 @@ public class ScoreboardWrapper {
|
||||
|
||||
//Register objective
|
||||
McMMOScoreboardObjectiveEvent registerEvent = callObjectiveEvent(ScoreboardObjectiveEventReason.REGISTER_NEW_OBJECTIVE);
|
||||
if(!registerEvent.isCancelled())
|
||||
if (!registerEvent.isCancelled())
|
||||
sidebarObjective = registerEvent.getTargetBoard().registerNewObjective(ScoreboardManager.SIDEBAR_OBJECTIVE, "dummy", SIDE_OBJECTIVE);
|
||||
|
||||
if (displayName.length() > 32) {
|
||||
@ -453,7 +453,7 @@ public class ScoreboardWrapper {
|
||||
* Load new values into the sidebar.
|
||||
*/
|
||||
private void updateSidebar() {
|
||||
if(updateTask != null) {
|
||||
if (updateTask != null) {
|
||||
try {
|
||||
updateTask.cancel();
|
||||
} catch (Exception e) {
|
||||
@ -477,7 +477,7 @@ public class ScoreboardWrapper {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
if (mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
switch (sidebarType) {
|
||||
|
@ -61,7 +61,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -72,12 +72,12 @@ public final class CombatUtils {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.SWORDS);
|
||||
}
|
||||
|
||||
if(target.getHealth() - event.getFinalDamage() > 0) {
|
||||
if (target.getHealth() - event.getFinalDamage() > 0) {
|
||||
swordsManager.processRupture(target);
|
||||
}
|
||||
|
||||
//Add Stab Damage
|
||||
if(swordsManager.canUseStab())
|
||||
if (swordsManager.canUseStab())
|
||||
{
|
||||
boostedDamage += (swordsManager.getStabDamage() * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
@ -86,7 +86,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());
|
||||
}
|
||||
@ -98,11 +98,11 @@ public final class CombatUtils {
|
||||
}
|
||||
|
||||
private static void printFinalDamageDebug(@NotNull Player player, @NotNull EntityDamageByEntityEvent event, @NotNull McMMOPlayer mcMMOPlayer, @Nullable String @Nullable ... extraInfoLines) {
|
||||
if(mcMMOPlayer.isDebugMode()) {
|
||||
if (mcMMOPlayer.isDebugMode()) {
|
||||
player.sendMessage("Final Damage value after mcMMO modifiers: "+ event.getFinalDamage());
|
||||
if(extraInfoLines != null) {
|
||||
if (extraInfoLines != null) {
|
||||
for(String str : extraInfoLines) {
|
||||
if(str != null)
|
||||
if (str != null)
|
||||
player.sendMessage(str);
|
||||
}
|
||||
}
|
||||
@ -119,7 +119,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ public final class CombatUtils {
|
||||
boostedDamage += (tridentsManager.impaleDamageBonus() * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||
if (canUseLimitBreak(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ public final class CombatUtils {
|
||||
boostedDamage += (tridentsManager.impaleDamageBonus() * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||
if (canUseLimitBreak(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.TRIDENTS_TRIDENTS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
delayArrowMetaCleanup(arrow);
|
||||
return;
|
||||
}
|
||||
@ -192,7 +192,7 @@ public final class CombatUtils {
|
||||
boostedDamage = mcMMOPlayer.getCrossbowsManager().poweredShot(initialDamage);
|
||||
}
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
|
||||
if (canUseLimitBreak(player, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
|
||||
boostedDamage+=getLimitBreakDamage(player, target, SubSkillType.CROSSBOWS_CROSSBOWS_LIMIT_BREAK);
|
||||
}
|
||||
|
||||
@ -222,13 +222,13 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// MacesManager macesManager = mcMMOPlayer.getMacesManager();
|
||||
|
||||
if(canUseLimitBreak(player, target, SubSkillType.MACES_MACES_LIMIT_BREAK)) {
|
||||
if (canUseLimitBreak(player, target, SubSkillType.MACES_MACES_LIMIT_BREAK)) {
|
||||
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.MACES_MACES_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -277,7 +277,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());
|
||||
}
|
||||
@ -298,7 +298,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -320,7 +320,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());
|
||||
}
|
||||
@ -335,11 +335,11 @@ public final class CombatUtils {
|
||||
double initialDamage = event.getDamage();
|
||||
double boostedDamage = initialDamage;
|
||||
|
||||
if(master != null && master.isOnline() && master.isValid()) {
|
||||
if (master != null && master.isOnline() && master.isValid()) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(master);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -372,7 +372,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Make sure the profiles been loaded
|
||||
if(mcMMOPlayer == null) {
|
||||
if (mcMMOPlayer == null) {
|
||||
delayArrowMetaCleanup(arrow);
|
||||
return;
|
||||
}
|
||||
@ -394,7 +394,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);
|
||||
}
|
||||
@ -402,7 +402,7 @@ public final class CombatUtils {
|
||||
double distanceMultiplier = ArcheryManager.distanceXpBonusMultiplier(target, arrow);
|
||||
double forceMultiplier = 1.0; //Hacky Fix - some plugins spawn arrows and assign them to players after the ProjectileLaunchEvent fires
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE))
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE))
|
||||
forceMultiplier = arrow.getMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE).get(0).asDouble();
|
||||
|
||||
event.setDamage(boostedDamage);
|
||||
@ -431,7 +431,7 @@ public final class CombatUtils {
|
||||
}
|
||||
|
||||
if (target instanceof Player player) {
|
||||
if(ExperienceConfig.getInstance().isNPCInteractionPrevented()) {
|
||||
if (ExperienceConfig.getInstance().isNPCInteractionPrevented()) {
|
||||
if (Misc.isNPCEntityExcludingVillagers(target)) {
|
||||
return;
|
||||
}
|
||||
@ -549,7 +549,7 @@ public final class CombatUtils {
|
||||
|
||||
if (projectileSource instanceof Player player) {
|
||||
if (!Misc.isNPCEntityExcludingVillagers(player)) {
|
||||
if(mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TRIDENTS, target)) {
|
||||
if (mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TRIDENTS, target)) {
|
||||
processTridentCombatRanged(trident, target, player, event);
|
||||
}
|
||||
}
|
||||
@ -561,9 +561,9 @@ public final class CombatUtils {
|
||||
if (projectileSource instanceof Player player) {
|
||||
|
||||
if (!Misc.isNPCEntityExcludingVillagers(player)) {
|
||||
if(!isCrossbow && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.ARCHERY, target)) {
|
||||
if (!isCrossbow && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.ARCHERY, target)) {
|
||||
processArcheryCombat(target, player, event, arrow);
|
||||
} else if(isCrossbow && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.CROSSBOWS, target)) {
|
||||
} else if (isCrossbow && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.CROSSBOWS, target)) {
|
||||
processCrossbowsCombat(target, player, event, arrow);
|
||||
}
|
||||
} else {
|
||||
@ -576,7 +576,7 @@ public final class CombatUtils {
|
||||
&& mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.TAMING)) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
if (mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
||||
@ -594,7 +594,7 @@ public final class CombatUtils {
|
||||
{
|
||||
List<MetadataValue> metadataValue = entity.getMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY);
|
||||
|
||||
if(metadataValue.size() <= 0)
|
||||
if (metadataValue.size() <= 0)
|
||||
return;
|
||||
|
||||
OldName oldName = (OldName) metadataValue.get(0);
|
||||
@ -612,7 +612,7 @@ public final class CombatUtils {
|
||||
* @return the RAW damage bonus from Limit Break which is applied before reductions
|
||||
*/
|
||||
public static int getLimitBreakDamage(@NotNull Player attacker, @NotNull LivingEntity defender, @NotNull SubSkillType subSkillType) {
|
||||
if(defender instanceof Player playerDefender) {
|
||||
if (defender instanceof Player playerDefender) {
|
||||
return getLimitBreakDamageAgainstQuality(attacker, subSkillType, getArmorQualityLevel(playerDefender));
|
||||
} else {
|
||||
return getLimitBreakDamageAgainstQuality(attacker, subSkillType, 1000);
|
||||
@ -630,11 +630,11 @@ public final class CombatUtils {
|
||||
public static int getLimitBreakDamageAgainstQuality(@NotNull Player attacker, @NotNull SubSkillType subSkillType, int armorQualityLevel) {
|
||||
int rawDamageBoost = RankUtils.getRank(attacker, subSkillType);
|
||||
|
||||
if(armorQualityLevel <= 4) {
|
||||
if (armorQualityLevel <= 4) {
|
||||
rawDamageBoost *= .25; //75% Nerf
|
||||
} else if(armorQualityLevel <= 8) {
|
||||
} else if (armorQualityLevel <= 8) {
|
||||
rawDamageBoost *= .50; //50% Nerf
|
||||
} else if(armorQualityLevel <= 12) {
|
||||
} else if (armorQualityLevel <= 12) {
|
||||
rawDamageBoost *= .75; //25% Nerf
|
||||
}
|
||||
|
||||
@ -650,7 +650,7 @@ public final class CombatUtils {
|
||||
int armorQualityLevel = 0;
|
||||
|
||||
for(ItemStack itemStack : defender.getInventory().getArmorContents()) {
|
||||
if(itemStack != null) {
|
||||
if (itemStack != null) {
|
||||
armorQualityLevel += getArmorQuality(itemStack);
|
||||
}
|
||||
}
|
||||
@ -673,7 +673,7 @@ public final class CombatUtils {
|
||||
* @return true if the player has access to the limit break
|
||||
*/
|
||||
public static boolean canUseLimitBreak(@NotNull Player player, LivingEntity target, @NotNull SubSkillType subSkillType) {
|
||||
if(target instanceof Player || mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
|
||||
if (target instanceof Player || mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
|
||||
return RankUtils.hasUnlockedSubskill(player, subSkillType)
|
||||
&& Permissions.isSubSkillEnabled(player, subSkillType);
|
||||
} else {
|
||||
@ -826,7 +826,7 @@ public final class CombatUtils {
|
||||
|
||||
McMMOPlayer mmoAttacker = UserManager.getPlayer(attacker);
|
||||
|
||||
if(mmoAttacker != null) {
|
||||
if (mmoAttacker != null) {
|
||||
mmoAttacker.getSwordsManager().processRupture(livingEntity);
|
||||
}
|
||||
|
||||
@ -923,17 +923,17 @@ public final class CombatUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if(hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, target)) {
|
||||
if (hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, target)) {
|
||||
baseXP = 0;
|
||||
} else if(hasMobFlag(MobMetaFlagType.MOB_SPAWNER_MOB, target) || target.hasMetadata("ES")) {
|
||||
} else if (hasMobFlag(MobMetaFlagType.MOB_SPAWNER_MOB, target) || target.hasMetadata("ES")) {
|
||||
baseXP *= ExperienceConfig.getInstance().getSpawnedMobXpMultiplier();
|
||||
} else if(hasMobFlag(MobMetaFlagType.NETHER_PORTAL_MOB, target)) {
|
||||
} else if (hasMobFlag(MobMetaFlagType.NETHER_PORTAL_MOB, target)) {
|
||||
baseXP *= ExperienceConfig.getInstance().getNetherPortalXpMultiplier();
|
||||
} else if(hasMobFlag(MobMetaFlagType.EGG_MOB, target)) {
|
||||
} else if (hasMobFlag(MobMetaFlagType.EGG_MOB, target)) {
|
||||
baseXP *= ExperienceConfig.getInstance().getEggXpMultiplier();
|
||||
} else if (hasMobFlag(MobMetaFlagType.PLAYER_BRED_MOB, target)) {
|
||||
baseXP *= ExperienceConfig.getInstance().getBredMobXpMultiplier();
|
||||
} else if(hasMobFlag(MobMetaFlagType.PLAYER_TAMED_MOB, target)) {
|
||||
} else if (hasMobFlag(MobMetaFlagType.PLAYER_TAMED_MOB, target)) {
|
||||
baseXP *= ExperienceConfig.getInstance().getTamedMobXpMultiplier();
|
||||
}
|
||||
|
||||
@ -958,14 +958,14 @@ public final class CombatUtils {
|
||||
private static boolean shouldBeAffected(@NotNull Player player, @NotNull Entity entity) {
|
||||
if (entity instanceof Player defender) {
|
||||
//TODO: NPC Interaction?
|
||||
if(UserManager.getPlayer(defender) == null)
|
||||
if (UserManager.getPlayer(defender) == null)
|
||||
return true;
|
||||
|
||||
if (!defender.getWorld().getPVP() || defender == player || UserManager.getPlayer(defender).getGodMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
||||
if (mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
||||
if ((mcMMO.p.getPartyManager().inSameParty(player, defender) || mcMMO.p.getPartyManager().areAllies(player, defender)) && !(Permissions.friendlyFire(player) && Permissions.friendlyFire(defender))) {
|
||||
return false;
|
||||
}
|
||||
@ -1077,7 +1077,7 @@ public final class CombatUtils {
|
||||
public static void modifyMoveSpeed(@NotNull LivingEntity livingEntity, double multiplier) {
|
||||
AttributeInstance attributeInstance = livingEntity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
|
||||
|
||||
if(attributeInstance != null) {
|
||||
if (attributeInstance != null) {
|
||||
double normalSpeed = attributeInstance.getBaseValue();
|
||||
attributeInstance.setBaseValue(normalSpeed * multiplier);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public final class ParticleEffectUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
if(location.getWorld() == null)
|
||||
if (location.getWorld() == null)
|
||||
return;
|
||||
|
||||
location.getWorld().playEffect(location, Effect.MOBSPAWNER_FLAMES, 1);
|
||||
@ -91,7 +91,7 @@ public final class ParticleEffectUtils {
|
||||
public static void playSmokeEffect(Location location) {
|
||||
World world = location.getWorld();
|
||||
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
// Have to do it this way, because not all block directions are valid for smoke
|
||||
|
@ -54,7 +54,7 @@ public final class PerksUtils {
|
||||
double modifier = 1.0F;
|
||||
|
||||
if (Permissions.customXpBoost(player, skill)) {
|
||||
if(UserManager.getPlayer(player) != null && UserManager.getPlayer(player).isDebugMode()) {
|
||||
if (UserManager.getPlayer(player) != null && UserManager.getPlayer(player).isDebugMode()) {
|
||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.DARK_GRAY + "XP Perk Multiplier IS CUSTOM! ");
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ public final class PerksUtils {
|
||||
|
||||
float modifiedXP = (float) (xp * modifier);
|
||||
|
||||
if(UserManager.getPlayer(player) != null && UserManager.getPlayer(player).isDebugMode()) {
|
||||
if (UserManager.getPlayer(player) != null && UserManager.getPlayer(player).isDebugMode()) {
|
||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP Perk Multiplier - " + ChatColor.GOLD + modifier);
|
||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "Original XP before perk boosts " + ChatColor.RED + (double) xp);
|
||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP AFTER PERKS " + ChatColor.DARK_RED + modifiedXP);
|
||||
|
@ -29,54 +29,54 @@ public class ProjectileUtils {
|
||||
*/
|
||||
// TODO: Add test
|
||||
public static void cleanupProjectileMetadata(@NotNull Arrow arrow) {
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_INF_ARROW)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_INF_ARROW)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_INF_ARROW, mcMMO.p);
|
||||
}
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE, mcMMO.p);
|
||||
}
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE, mcMMO.p);
|
||||
}
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW, mcMMO.p);
|
||||
}
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW, mcMMO.p);
|
||||
}
|
||||
|
||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOUNCE_COUNT)) {
|
||||
if (arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOUNCE_COUNT)) {
|
||||
arrow.removeMetadata(MetadataConstants.METADATA_KEY_BOUNCE_COUNT, mcMMO.p);
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyArrowMetadata(@NotNull Plugin pluginRef, @NotNull Arrow arrowToCopy, @NotNull Arrow newArrow) {
|
||||
if(arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_INF_ARROW)) {
|
||||
if (arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_INF_ARROW)) {
|
||||
newArrow.setMetadata(MetadataConstants.METADATA_KEY_INF_ARROW,
|
||||
arrowToCopy.getMetadata(MetadataConstants.METADATA_KEY_INF_ARROW).get(0));
|
||||
}
|
||||
|
||||
if(arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE)) {
|
||||
if (arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE)) {
|
||||
newArrow.setMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE,
|
||||
new FixedMetadataValue(pluginRef,
|
||||
arrowToCopy.getMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE).get(0).asDouble()));
|
||||
}
|
||||
|
||||
if(arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE)) {
|
||||
if (arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE)) {
|
||||
newArrow.setMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE,
|
||||
arrowToCopy.getMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE).get(0));
|
||||
}
|
||||
|
||||
if(arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW)) {
|
||||
if (arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW)) {
|
||||
newArrow.setMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW,
|
||||
arrowToCopy.getMetadata(MetadataConstants.METADATA_KEY_SPAWNED_ARROW).get(0));
|
||||
}
|
||||
|
||||
if(arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW)) {
|
||||
if (arrowToCopy.hasMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW)) {
|
||||
newArrow.setMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW,
|
||||
arrowToCopy.getMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW).get(0));
|
||||
}
|
||||
|
@ -36,15 +36,15 @@ public class RankUtils {
|
||||
HashMap<Integer, Integer> innerMap = subSkillRanks.get(subSkillType.toString());
|
||||
|
||||
//If the skill doesn't have registered ranks gtfo
|
||||
if(innerMap == null || innerMap.get(playerRankInSkill) == null)
|
||||
if (innerMap == null || innerMap.get(playerRankInSkill) == null)
|
||||
continue;
|
||||
|
||||
//Don't send notifications if the player lacks the permission node
|
||||
if(!Permissions.isSubSkillEnabled(mcMMOPlayer.getPlayer(), subSkillType))
|
||||
if (!Permissions.isSubSkillEnabled(mcMMOPlayer.getPlayer(), subSkillType))
|
||||
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);
|
||||
|
||||
@ -180,19 +180,19 @@ public class RankUtils {
|
||||
String skillName = subSkillType.toString();
|
||||
int numRanks = subSkillType.getNumRanks();
|
||||
|
||||
if(subSkillRanks == null)
|
||||
if (subSkillRanks == null)
|
||||
subSkillRanks = new HashMap<>();
|
||||
|
||||
if(numRanks == 0)
|
||||
if (numRanks == 0)
|
||||
return -1; //-1 Means the skill doesn't have ranks
|
||||
|
||||
if(subSkillRanks.get(skillName) == null && numRanks > 0)
|
||||
if (subSkillRanks.get(skillName) == null && numRanks > 0)
|
||||
addRanks(subSkillType);
|
||||
|
||||
//Get our rank map
|
||||
HashMap<Integer, Integer> rankMap = subSkillRanks.get(skillName);
|
||||
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if (UserManager.getPlayer(player) == null)
|
||||
return 0;
|
||||
|
||||
//Skill level of parent skill
|
||||
@ -205,11 +205,11 @@ public class RankUtils {
|
||||
int unlockLevel = getRankUnlockLevel(subSkillType, rank);
|
||||
|
||||
//If we check all ranks and still cannot unlock the skill, we return rank 0
|
||||
if(rank == 0)
|
||||
if (rank == 0)
|
||||
return 0;
|
||||
|
||||
//True if our skill level can unlock the current rank
|
||||
if(currentSkillLevel >= unlockLevel)
|
||||
if (currentSkillLevel >= unlockLevel)
|
||||
return rank;
|
||||
}
|
||||
|
||||
@ -227,19 +227,19 @@ public class RankUtils {
|
||||
String skillName = abstractSubSkill.getConfigKeyName();
|
||||
int numRanks = abstractSubSkill.getNumRanks();
|
||||
|
||||
if(subSkillRanks == null)
|
||||
if (subSkillRanks == null)
|
||||
subSkillRanks = new HashMap<>();
|
||||
|
||||
if(numRanks == 0)
|
||||
if (numRanks == 0)
|
||||
return -1; //-1 Means the skill doesn't have ranks
|
||||
|
||||
if(subSkillRanks.get(skillName) == null && numRanks > 0)
|
||||
if (subSkillRanks.get(skillName) == null && numRanks > 0)
|
||||
addRanks(abstractSubSkill);
|
||||
|
||||
//Get our rank map
|
||||
HashMap<Integer, Integer> rankMap = subSkillRanks.get(skillName);
|
||||
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
if (UserManager.getPlayer(player) == null)
|
||||
return 0;
|
||||
|
||||
//Skill level of parent skill
|
||||
@ -252,11 +252,11 @@ public class RankUtils {
|
||||
int unlockLevel = getRankUnlockLevel(abstractSubSkill, rank);
|
||||
|
||||
//If we check all ranks and still cannot unlock the skill, we return rank 0
|
||||
if(rank == 0)
|
||||
if (rank == 0)
|
||||
return 0;
|
||||
|
||||
//True if our skill level can unlock the current rank
|
||||
if(currentSkillLevel >= unlockLevel)
|
||||
if (currentSkillLevel >= unlockLevel)
|
||||
return rank;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class SkillTools {
|
||||
for(SubSkillType subSkillType : SubSkillType.values()) {
|
||||
String[] splitSubSkillName = subSkillType.toString().split("_");
|
||||
|
||||
if(primarySkillType1.toString().equalsIgnoreCase(splitSubSkillName[0])) {
|
||||
if (primarySkillType1.toString().equalsIgnoreCase(splitSubSkillName[0])) {
|
||||
//Parent Skill Found
|
||||
tempSubParentMap.put(subSkillType, primarySkillType1);
|
||||
}
|
||||
@ -127,7 +127,7 @@ public class SkillTools {
|
||||
PrimarySkillType parent = getSuperAbilityParent(superAbilityType);
|
||||
tempAbilityParentRelationshipMap.put(superAbilityType, parent);
|
||||
|
||||
if(superAbilityType != SuperAbilityType.BLAST_MINING) {
|
||||
if (superAbilityType != SuperAbilityType.BLAST_MINING) {
|
||||
//This map is used only for abilities that have a tool readying phase, so blast mining is ignored
|
||||
tempMainActivatedAbilityChildMap.put(parent, superAbilityType);
|
||||
}
|
||||
@ -296,7 +296,7 @@ public class SkillTools {
|
||||
}
|
||||
|
||||
public SuperAbilityType getSuperAbility(PrimarySkillType primarySkillType) {
|
||||
if(mainActivatedAbilityChildMap.get(primarySkillType) == null)
|
||||
if (mainActivatedAbilityChildMap.get(primarySkillType) == null)
|
||||
return null;
|
||||
|
||||
return mainActivatedAbilityChildMap.get(primarySkillType);
|
||||
|
@ -61,7 +61,7 @@ public final class SkillUtils {
|
||||
|
||||
int length;
|
||||
|
||||
if(abilityLengthCap > 0)
|
||||
if (abilityLengthCap > 0)
|
||||
{
|
||||
length = (int) Math.min(abilityLengthCap, 2 + (skillValue / abilityLengthVar));
|
||||
} else {
|
||||
@ -142,7 +142,7 @@ public final class SkillUtils {
|
||||
if (HiddenConfig.getInstance().useEnchantmentBuffs()) {
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
if(heldItem == null)
|
||||
if (heldItem == null)
|
||||
return;
|
||||
|
||||
if (!ItemUtils.canBeSuperAbilityDigBoosted(heldItem)) {
|
||||
@ -171,7 +171,7 @@ public final class SkillUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Not Loaded
|
||||
if(mcMMOPlayer == null)
|
||||
if (mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
PrimarySkillType skill = mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER) ? PrimarySkillType.MINING : PrimarySkillType.EXCAVATION;
|
||||
@ -181,7 +181,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;
|
||||
@ -202,18 +202,18 @@ public final class SkillUtils {
|
||||
}
|
||||
|
||||
public static void removeAbilityBuff(@Nullable ItemStack itemStack) {
|
||||
if(itemStack == null)
|
||||
if (itemStack == null)
|
||||
return;
|
||||
|
||||
if(!ItemUtils.canBeSuperAbilityDigBoosted(itemStack))
|
||||
if (!ItemUtils.canBeSuperAbilityDigBoosted(itemStack))
|
||||
return;
|
||||
|
||||
|
||||
//1.13.2+ will have persistent metadata for this itemStack
|
||||
if(isLegacyAbilityTool(itemStack)) {
|
||||
if (isLegacyAbilityTool(itemStack)) {
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if(itemMeta != null) {
|
||||
if (itemMeta != null) {
|
||||
// This is safe to call without prior checks.
|
||||
itemMeta.removeEnchant(mcMMO.p.getEnchantmentMapper().getEfficiency());
|
||||
|
||||
@ -222,7 +222,7 @@ public final class SkillUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if(isSuperAbilityBoosted(itemStack)) {
|
||||
if (isSuperAbilityBoosted(itemStack)) {
|
||||
removeBonusDigSpeedOnSuperAbilityTool(itemStack);
|
||||
}
|
||||
}
|
||||
@ -239,7 +239,7 @@ public final class SkillUtils {
|
||||
* @param maxDamageModifier the amount to adjust the max damage by
|
||||
*/
|
||||
public static void handleDurabilityChange(ItemStack itemStack, double durabilityModifier, double maxDamageModifier) {
|
||||
if(itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) {
|
||||
if (itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ public final class SkillUtils {
|
||||
* @param maxDamageModifier the amount to adjust the max damage by
|
||||
*/
|
||||
public static void handleArmorDurabilityChange(ItemStack itemStack, double durabilityModifier, double maxDamageModifier) {
|
||||
if(itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) {
|
||||
if (itemStack.hasItemMeta() && itemStack.getItemMeta().isUnbreakable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ public final class SkillUtils {
|
||||
public static int getRepairAndSalvageQuantities(Material itemMaterial, Material recipeMaterial) {
|
||||
int quantity = 0;
|
||||
|
||||
if(mcMMO.getMaterialMapStore().isNetheriteTool(itemMaterial) || mcMMO.getMaterialMapStore().isNetheriteArmor(itemMaterial)) {
|
||||
if (mcMMO.getMaterialMapStore().isNetheriteTool(itemMaterial) || mcMMO.getMaterialMapStore().isNetheriteArmor(itemMaterial)) {
|
||||
//One netherite bar requires 4 netherite scraps
|
||||
return 4;
|
||||
}
|
||||
@ -323,10 +323,10 @@ public final class SkillUtils {
|
||||
for(Iterator<? extends Recipe> recipeIterator = Bukkit.getServer().recipeIterator(); recipeIterator.hasNext();) {
|
||||
Recipe bukkitRecipe = recipeIterator.next();
|
||||
|
||||
if(bukkitRecipe.getResult().getType() != itemMaterial)
|
||||
if (bukkitRecipe.getResult().getType() != itemMaterial)
|
||||
continue;
|
||||
|
||||
if(bukkitRecipe instanceof ShapelessRecipe) {
|
||||
if (bukkitRecipe instanceof ShapelessRecipe) {
|
||||
for (ItemStack ingredient : ((ShapelessRecipe) bukkitRecipe).getIngredientList()) {
|
||||
if (ingredient != null
|
||||
&& (recipeMaterial == null || ingredient.getType() == recipeMaterial)
|
||||
@ -334,7 +334,7 @@ public final class SkillUtils {
|
||||
quantity += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
} else if(bukkitRecipe instanceof ShapedRecipe) {
|
||||
} else if (bukkitRecipe instanceof ShapedRecipe) {
|
||||
for (ItemStack ingredient : ((ShapedRecipe) bukkitRecipe).getIngredientMap().values()) {
|
||||
if (ingredient != null
|
||||
&& (recipeMaterial == null || ingredient.getType() == recipeMaterial)
|
||||
|
@ -15,13 +15,13 @@ public class SoundManager {
|
||||
*/
|
||||
public static void sendSound(Player player, Location location, SoundType soundType)
|
||||
{
|
||||
if(SoundConfig.getInstance().getIsEnabled(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)
|
||||
{
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
@ -29,18 +29,18 @@ public class SoundManager {
|
||||
{
|
||||
float totalPitch = Math.min(2.0F, (getPitch(soundType) + pitchModifier));
|
||||
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
player.playSound(location, getSound(soundType), soundCategory, getVolume(soundType), totalPitch);
|
||||
}
|
||||
|
||||
public static void worldSendSound(World world, Location location, SoundType soundType)
|
||||
{
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
world.playSound(location, getSound(soundType), getVolume(soundType), getPitch(soundType));
|
||||
}
|
||||
|
||||
public static void worldSendSoundMaxPitch(World world, Location location, SoundType soundType) {
|
||||
if(SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
if (SoundConfig.getInstance().getIsEnabled(soundType))
|
||||
world.playSound(location, getSound(soundType), getVolume(soundType), 2.0F);
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class SoundManager {
|
||||
|
||||
private static float getPitch(SoundType soundType)
|
||||
{
|
||||
if(soundType == SoundType.FIZZ)
|
||||
if (soundType == SoundType.FIZZ)
|
||||
return getFizzPitch();
|
||||
else if (soundType == SoundType.POP)
|
||||
return getPopPitch();
|
||||
|
@ -71,7 +71,7 @@ public class StringUtils {
|
||||
StringBuilder trimMessage = new StringBuilder();
|
||||
|
||||
for (int i = index; i < args.length; i++) {
|
||||
if(i + 1 >= args.length)
|
||||
if (i + 1 >= args.length)
|
||||
trimMessage.append(args[i]);
|
||||
else
|
||||
trimMessage.append(args[i]).append(" ");
|
||||
|
@ -31,15 +31,15 @@ public class TextUtils {
|
||||
TextComponent.Builder componentBuilder = Component.text();
|
||||
|
||||
for(Component component : componentsArray) {
|
||||
if(component == null) //Individual elements can be null
|
||||
if (component == null) //Individual elements can be null
|
||||
continue;
|
||||
|
||||
if(prefixComponent != null)
|
||||
if (prefixComponent != null)
|
||||
componentBuilder.append(prefixComponent);
|
||||
|
||||
componentBuilder.append(component);
|
||||
|
||||
if(suffixComponent != null)
|
||||
if (suffixComponent != null)
|
||||
componentBuilder.append(suffixComponent);
|
||||
|
||||
}
|
||||
@ -68,14 +68,14 @@ public class TextUtils {
|
||||
int indexOfPotentialMember = i + (groupsFinished * 3); //Groups don't always fill all members neatly
|
||||
|
||||
//Some groups won't have entirely non-null elements
|
||||
if(indexOfPotentialMember > components.size()-1) {
|
||||
if (indexOfPotentialMember > components.size()-1) {
|
||||
break;
|
||||
}
|
||||
|
||||
Component potentialMember = components.get(indexOfPotentialMember);
|
||||
|
||||
//Make sure the potential member exists because of rounding
|
||||
if(potentialMember != null) {
|
||||
if (potentialMember != null) {
|
||||
splitGroups[groupsFinished][i] = potentialMember;
|
||||
}
|
||||
}
|
||||
@ -113,7 +113,7 @@ public class TextUtils {
|
||||
}
|
||||
|
||||
public static @NotNull TextComponent colorizeText(@NotNull String rawtext) {
|
||||
if(customLegacySerializer == null) {
|
||||
if (customLegacySerializer == null) {
|
||||
customLegacySerializer = getSerializer();
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ public class TextUtils {
|
||||
}
|
||||
|
||||
public static @NotNull String sanitizeForSerializer(@NotNull String string) {
|
||||
if(customLegacySerializer == null) {
|
||||
if (customLegacySerializer == null) {
|
||||
customLegacySerializer = getSerializer();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user