if( -> if (

This commit is contained in:
nossr50
2024-05-12 14:13:34 -07:00
parent 435a6fde34
commit 291effdbc8
163 changed files with 1116 additions and 1116 deletions

View File

@@ -17,7 +17,7 @@ public class MobDodgeMetaCleanup extends CancellableRunnable {
@Override
public void run() {
if(!mob.isValid() || mob.getTarget() == null) {
if (!mob.isValid() || mob.getTarget() == null) {
mob.removeMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, pluginRef);
this.cancel();
} else if (!mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER)) {

View File

@@ -19,7 +19,7 @@ public class SaveTimerTask extends CancellableRunnable {
count++;
}
if(mcMMO.p.getPartyConfig().isPartyEnabled())
if (mcMMO.p.getPartyConfig().isPartyEnabled())
mcMMO.p.getPartyManager().saveParties();
}
}

View File

@@ -17,7 +17,7 @@ public class TravelingBlockMetaCleanup extends CancellableRunnable {
@Override
public void run() {
if(!entity.isValid()) {
if (!entity.isValid()) {
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef);
this.cancel();
} else if (!entity.hasMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK)) {

View File

@@ -45,14 +45,14 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
if (sender instanceof Player) {
((Player) sender).removeMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND, mcMMO.p);
}
if(sender instanceof Player)
if (sender instanceof Player)
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
}
private void displayChat() {
if (skill == null) {
if(sender instanceof Player) {
if (sender instanceof Player) {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
}
else {
@@ -60,7 +60,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
}
}
else {
if(sender instanceof Player) {
if (sender instanceof Player) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
}
else {
@@ -74,7 +74,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
// Format:
// 01. Playername - skill value
// 12. Playername - skill value
if(sender instanceof Player) {
if (sender instanceof Player) {
sender.sendMessage(String.format("%2d. %s%s - %s%s", place, ChatColor.GREEN, stat.name, ChatColor.WHITE, stat.statVal));
}
else {

View File

@@ -11,9 +11,9 @@ public class NotifySquelchReminderTask extends CancellableRunnable {
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
if(UserManager.getPlayer(player) != null)
if (UserManager.getPlayer(player) != null)
{
if(!UserManager.getPlayer(player).useChatNotifications())
if (!UserManager.getPlayer(player).useChatNotifications())
{
player.sendMessage(LocaleLoader.getString("Reminder.Squelched"));
}

View File

@@ -44,7 +44,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player);
if(!profile.isLoaded()) {
if (!profile.isLoaded()) {
LogUtils.debug(mcMMO.p.getLogger(), "Creating new data for player: "+player.getName());
//Profile isn't loaded so add as new user
profile = mcMMO.getDatabaseManager().newUser(player);

View File

@@ -62,7 +62,7 @@ public class AbilityDisableTask extends CancellableRunnable {
if (mcMMO.p.getAdvancedConfig().sendAbilityNotificationToOtherPlayers()) {
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
}
if(!mcMMO.isServerShutdownExecuted()) {
if (!mcMMO.isServerShutdownExecuted()) {
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityCooldownTask(mcMMOPlayer, ability), (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
}
}

View File

@@ -40,7 +40,7 @@ public class AwardCombatXpTask extends CancellableRunnable {
damage += health;
}
if(ExperienceConfig.getInstance().useCombatHPCeiling()) {
if (ExperienceConfig.getInstance().useCombatHPCeiling()) {
damage = Math.min(damage, ExperienceConfig.getInstance().getCombatHPCeiling());
}

View File

@@ -43,7 +43,7 @@
//// debugMessage+="RemainingTicks=["+containerEntry.getValue().bleedTicks+"], ";
//
// if (containerEntry.getValue().bleedTicks <= 0 || !target.isValid()) {
// if(target instanceof Player)
// if (target instanceof Player)
// {
// NotificationManager.sendPlayerInformation((Player) target, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Stopped");
// }
@@ -96,7 +96,7 @@
//
//// debugMessage+="FullArmor=["+String.valueOf(armorCount > 3)+"], ";
//
// if(armorCount > 3)
// if (armorCount > 3)
// {
// damage = damage * .75;
// }
@@ -104,13 +104,13 @@
//// debugMessage+="AfterRankAndArmorChecks["+damage+"], ";
//
// //Weapons below Diamond get damage cut in half
// if(toolTier < 4)
// if (toolTier < 4)
// damage = damage / 2;
//
//// debugMessage+="AfterDiamondCheck=["+String.valueOf(damage)+"], ";
//
// //Wood weapons get damage cut in half again
// if(toolTier < 2)
// if (toolTier < 2)
// damage = damage / 2;
//
//// debugMessage+="AfterWoodenCheck=["+String.valueOf(damage)+"], ";
@@ -129,7 +129,7 @@
//
//// debugMessage+="TargetHealthAfterDMG=["+String.valueOf(target.getHealth())+"], ";
//
// if(victimHealthAftermath <= 0 || victimHealth != victimHealthAftermath)
// if (victimHealthAftermath <= 0 || victimHealth != victimHealthAftermath)
// {
// //Play Bleed Sound
// SoundManager.worldSendSound(target.getWorld(), target.getLocation(), SoundType.BLEED);
@@ -187,7 +187,7 @@
// throw new IllegalStateException("Cannot add bleed task async!");
// }
//
// if(isIterating) {
// if (isIterating) {
// //Used to throw an error here, but in reality all we are really doing is preventing concurrency issues from other plugins being naughty and its not really needed
// //I'm not really a fan of silent errors, but I'm sick of seeing people using crazy enchantments come in and report this "bug"
// return;
@@ -195,7 +195,7 @@
//
//// if (isIterating) throw new IllegalStateException("Cannot add task while iterating timers!");
//
// if(toolTier < 4)
// if (toolTier < 4)
// ticks = Math.max(1, (ticks / 3));
//
// ticks+=1;

View File

@@ -35,7 +35,7 @@ public class DelayedCropReplant extends CancellableRunnable {
public DelayedCropReplant(BlockBreakEvent blockBreakEvent, BlockState cropState, int desiredCropAge, boolean wasImmaturePlant) {
BlockData cropData = cropState.getBlockData();
if(cropData instanceof Directional cropDir) {
if (cropData instanceof Directional cropDir) {
cropFace = cropDir.getFacing();
}
@@ -56,13 +56,13 @@ public class DelayedCropReplant extends CancellableRunnable {
//Remove the metadata marking the block as recently replanted
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new markPlantAsOld(blockBreakEvent.getBlock().getLocation()), 10);
if(blockBreakEvent.isCancelled()) {
if (blockBreakEvent.isCancelled()) {
wasImmaturePlant = true;
}
//Two kinds of air in Minecraft
if(currentState.getType().equals(cropMaterial) || currentState.getType().equals(Material.AIR) || currentState.getType().equals(Material.CAVE_AIR)) {
// if(currentState.getBlock().getRelative(BlockFace.DOWN))
if (currentState.getType().equals(cropMaterial) || currentState.getType().equals(Material.AIR) || currentState.getType().equals(Material.CAVE_AIR)) {
// if (currentState.getBlock().getRelative(BlockFace.DOWN))
//The space is not currently occupied by a block so we can fill it
cropBlock.setType(cropMaterial);
@@ -74,19 +74,19 @@ public class DelayedCropReplant extends CancellableRunnable {
int age = 0;
//Crop age should always be 0 if the plant was immature
if(!wasImmaturePlant) {
if (!wasImmaturePlant) {
age = desiredCropAge;
//Otherwise make the plant the desired age
}
if(newData instanceof Directional) {
if (newData instanceof Directional) {
//Cocoa Version
Directional directional = (Directional) newState.getBlockData();
directional.setFacing(cropFace);
newState.setBlockData(directional);
if(newData instanceof Cocoa) {
if (newData instanceof Cocoa) {
plantAnchorType = PlantAnchorType.COCOA;
}
}
@@ -119,7 +119,7 @@ public class DelayedCropReplant extends CancellableRunnable {
this.plantBlock = plantBlock;
this.plantAnchorType = plantAnchorType;
if(plantFace != null) {
if (plantFace != null) {
this.plantFace = plantFace;
}
}
@@ -140,8 +140,8 @@ public class DelayedCropReplant extends CancellableRunnable {
private void checkPlantIntegrity(@NotNull BlockFace blockFace) {
Block neighbor = plantBlock.getRelative(blockFace);
if(plantAnchorType == PlantAnchorType.COCOA) {
if(!neighbor.getType().toString().toLowerCase().contains("jungle")) {
if (plantAnchorType == PlantAnchorType.COCOA) {
if (!neighbor.getType().toString().toLowerCase().contains("jungle")) {
plantBlock.breakNaturally();
}
} else {
@@ -171,7 +171,7 @@ public class DelayedCropReplant extends CancellableRunnable {
@Override
public void run() {
Block cropBlock = cropLoc.getBlock();
if(cropBlock.getMetadata(MetadataConstants.METADATA_KEY_REPLANT).size() > 0)
if (cropBlock.getMetadata(MetadataConstants.METADATA_KEY_REPLANT).size() > 0)
cropBlock.setMetadata(MetadataConstants.METADATA_KEY_REPLANT, new RecentlyReplantedCropMeta(mcMMO.p, false));
}
}

View File

@@ -30,7 +30,7 @@ public class ExperienceBarHideTask extends CancellableRunnable {
*/
@Override
public void run() {
if(experienceBarManagerRef == null || mcMMOPlayer == null)
if (experienceBarManagerRef == null || mcMMOPlayer == null)
return;
experienceBarManagerRef.hideExperienceBar(primarySkillType);

View File

@@ -42,15 +42,15 @@ public class RuptureTask extends CancellableRunnable {
@Override
public void run() {
//Check validity
if(targetEntity.isValid()) {
if (targetEntity.isValid()) {
ruptureTick += 1; //Advance rupture tick by 1.
damageTickTracker += 1; //Increment damage tick tracker
//TODO: Clean this code up, applyRupture() is a confusing name for something that returns boolean
//Rupture hasn't ended yet
if(ruptureTick < expireTick) {
if (ruptureTick < expireTick) {
//Is it time to damage?
if(damageTickTracker >= DAMAGE_TICK_INTERVAL) {
if (damageTickTracker >= DAMAGE_TICK_INTERVAL) {
damageTickTracker = 0; //Reset timer
if (applyRupture()) return;
@@ -58,7 +58,7 @@ public class RuptureTask extends CancellableRunnable {
playAnimation();
}
} else {
if(!applyRupture()) {
if (!applyRupture()) {
playAnimation();
}
@@ -71,7 +71,7 @@ public class RuptureTask extends CancellableRunnable {
}
private void playAnimation() {
if(animationTick >= ANIMATION_TICK_INTERVAL) {
if (animationTick >= ANIMATION_TICK_INTERVAL) {
ParticleEffectUtils.playBleedEffect(targetEntity); //Animate
animationTick = 0;
} else {
@@ -114,7 +114,7 @@ public class RuptureTask extends CancellableRunnable {
//
// ParticleEffectUtils.playGreaterImpactEffect(targetEntity); //Animate
//
// if(ruptureSource.getPlayer() != null && ruptureSource.getPlayer().isValid()) {
// if (ruptureSource.getPlayer() != null && ruptureSource.getPlayer().isValid()) {
// targetEntity.damage(getExplosionDamage(), ruptureSource.getPlayer());
// } else {
// targetEntity.damage(getExplosionDamage(), null);
@@ -129,10 +129,10 @@ public class RuptureTask extends CancellableRunnable {
private double calculateAdjustedTickDamage() {
double tickDamage = pureTickDamage;
if(targetEntity.getHealth() <= tickDamage) {
if (targetEntity.getHealth() <= tickDamage) {
tickDamage = targetEntity.getHealth() - 0.01;
if(tickDamage <= 0) {
if (tickDamage <= 0) {
tickDamage = 0;
}
}