mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-01 21:24:43 +02:00
Update code style
This commit is contained in:
@ -15,8 +15,7 @@ public class Herbalism {
|
||||
/**
|
||||
* Convert blocks affected by the Green Thumb & Green Terra abilities.
|
||||
*
|
||||
* @param blockState
|
||||
* The {@link BlockState} to check ability activation for
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
protected static boolean convertGreenTerraBlocks(BlockState blockState) {
|
||||
@ -29,16 +28,16 @@ public class Herbalism {
|
||||
blockState.setType(Material.MOSSY_STONE_BRICKS);
|
||||
return true;
|
||||
|
||||
case DIRT :
|
||||
case GRASS_PATH :
|
||||
case DIRT:
|
||||
case GRASS_PATH:
|
||||
blockState.setType(Material.GRASS_BLOCK);
|
||||
return true;
|
||||
|
||||
case COBBLESTONE :
|
||||
case COBBLESTONE:
|
||||
blockState.setType(Material.MOSSY_COBBLESTONE);
|
||||
return true;
|
||||
|
||||
default :
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -62,15 +61,14 @@ public class Herbalism {
|
||||
|
||||
if (mcMMO.getPlaceStore().isTrue(target))
|
||||
mcMMO.getPlaceStore().setFalse(target);
|
||||
else
|
||||
{
|
||||
else {
|
||||
dropAmount++;
|
||||
|
||||
if(herbalismManager.checkDoubleDrop(target.getState()))
|
||||
if (herbalismManager.checkDoubleDrop(target.getState()))
|
||||
BlockUtils.markDropsAsBonus(target.getState(), triple);
|
||||
}
|
||||
|
||||
for (BlockFace blockFace : new BlockFace[] { BlockFace.UP, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST ,BlockFace.WEST})
|
||||
for (BlockFace blockFace : new BlockFace[]{BlockFace.UP, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST})
|
||||
dropAmount += calculateChorusPlantDropsRecursive(target.getRelative(blockFace, 1), traversed, triple, herbalismManager);
|
||||
|
||||
return dropAmount;
|
||||
@ -80,8 +78,7 @@ public class Herbalism {
|
||||
* Calculate the drop amounts for multi block plants based on the blocks
|
||||
* relative to them.
|
||||
*
|
||||
* @param blockState
|
||||
* The {@link BlockState} of the bottom block of the plant
|
||||
* @param blockState The {@link BlockState} of the bottom block of the plant
|
||||
* @return the number of bonus drops to award from the blocks in this plant
|
||||
*/
|
||||
protected static int countAndMarkDoubleDropsMultiBlockPlant(BlockState blockState, boolean triple, HerbalismManager herbalismManager) {
|
||||
@ -109,7 +106,7 @@ public class Herbalism {
|
||||
} else {
|
||||
dropAmount++;
|
||||
|
||||
if(herbalismManager.checkDoubleDrop(relativeBlock.getState()))
|
||||
if (herbalismManager.checkDoubleDrop(relativeBlock.getState()))
|
||||
BlockUtils.markDropsAsBonus(relativeBlock.getState(), triple);
|
||||
}
|
||||
}
|
||||
@ -122,8 +119,7 @@ public class Herbalism {
|
||||
* Calculate the drop amounts for kelp plants based on the blocks
|
||||
* relative to them.
|
||||
*
|
||||
* @param blockState
|
||||
* The {@link BlockState} of the bottom block of the plant
|
||||
* @param blockState The {@link BlockState} of the bottom block of the plant
|
||||
* @return the number of bonus drops to award from the blocks in this plant
|
||||
*/
|
||||
protected static int countAndMarkDoubleDropsKelp(BlockState blockState, boolean triple, HerbalismManager herbalismManager) {
|
||||
@ -136,12 +132,12 @@ public class Herbalism {
|
||||
for (int y = 1; y < kelpMaxHeight; y++) {
|
||||
Block relativeUpBlock = block.getRelative(BlockFace.UP, y);
|
||||
|
||||
if(!isKelp(relativeUpBlock))
|
||||
if (!isKelp(relativeUpBlock))
|
||||
break;
|
||||
|
||||
amount += 1;
|
||||
|
||||
if(herbalismManager.checkDoubleDrop(relativeUpBlock.getState()))
|
||||
if (herbalismManager.checkDoubleDrop(relativeUpBlock.getState()))
|
||||
BlockUtils.markDropsAsBonus(relativeUpBlock.getState(), triple);
|
||||
|
||||
}
|
||||
@ -169,19 +165,18 @@ public class Herbalism {
|
||||
/**
|
||||
* Convert blocks affected by the Green Thumb & Green Terra abilities.
|
||||
*
|
||||
* @param blockState
|
||||
* The {@link BlockState} to check ability activation for
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
protected static boolean convertShroomThumb(BlockState blockState) {
|
||||
switch (blockState.getType()) {
|
||||
case DIRT :
|
||||
case DIRT:
|
||||
case GRASS_BLOCK:
|
||||
case GRASS_PATH :
|
||||
case GRASS_PATH:
|
||||
blockState.setType(Material.MYCELIUM);
|
||||
return true;
|
||||
|
||||
default :
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -189,8 +184,7 @@ public class Herbalism {
|
||||
/**
|
||||
* Check if the block has a recently grown crop from Green Thumb
|
||||
*
|
||||
* @param blockState
|
||||
* The {@link BlockState} to check green thumb regrown for
|
||||
* @param blockState The {@link BlockState} to check green thumb regrown for
|
||||
* @return true if the block is recently regrown, false otherwise
|
||||
*/
|
||||
public static boolean isRecentlyRegrown(BlockState blockState) {
|
||||
|
@ -42,7 +42,7 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canGreenThumbBlock(BlockState blockState) {
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_GREEN_THUMB))
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_GREEN_THUMB))
|
||||
return false;
|
||||
|
||||
Player player = getPlayer();
|
||||
@ -52,7 +52,7 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseShroomThumb(BlockState blockState) {
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_SHROOM_THUMB))
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_SHROOM_THUMB))
|
||||
return false;
|
||||
|
||||
Player player = getPlayer();
|
||||
@ -63,7 +63,7 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseHylianLuck() {
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK))
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK))
|
||||
return false;
|
||||
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
@ -148,26 +148,26 @@ public class HerbalismManager extends SkillManager {
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
xp = ExperienceConfig.getInstance().getXp(skill, blockState.getType());
|
||||
xp = ExperienceConfig.getInstance().getXp(skill, blockState.getType());
|
||||
|
||||
if (!oneBlockPlant) {
|
||||
//Kelp is actually two blocks mixed together
|
||||
if(material == Material.KELP_PLANT || material == Material.KELP) {
|
||||
amount = Herbalism.countAndMarkDoubleDropsKelp(blockState, greenTerra,this);
|
||||
} else {
|
||||
amount = Herbalism.countAndMarkDoubleDropsMultiBlockPlant(blockState, greenTerra, this);
|
||||
}
|
||||
|
||||
xp *= amount;
|
||||
if (!oneBlockPlant) {
|
||||
//Kelp is actually two blocks mixed together
|
||||
if (material == Material.KELP_PLANT || material == Material.KELP) {
|
||||
amount = Herbalism.countAndMarkDoubleDropsKelp(blockState, greenTerra, this);
|
||||
} else {
|
||||
/* MARK SINGLE BLOCK CROP FOR DOUBLE DROP */
|
||||
if(checkDoubleDrop(blockState))
|
||||
BlockUtils.markDropsAsBonus(blockState, greenTerra);
|
||||
amount = Herbalism.countAndMarkDoubleDropsMultiBlockPlant(blockState, greenTerra, this);
|
||||
}
|
||||
|
||||
if (Permissions.greenThumbPlant(player, material)) {
|
||||
processGreenThumbPlants(blockState, greenTerra);
|
||||
}
|
||||
xp *= amount;
|
||||
} else {
|
||||
/* MARK SINGLE BLOCK CROP FOR DOUBLE DROP */
|
||||
if (checkDoubleDrop(blockState))
|
||||
BlockUtils.markDropsAsBonus(blockState, greenTerra);
|
||||
}
|
||||
|
||||
if (Permissions.greenThumbPlant(player, material)) {
|
||||
processGreenThumbPlants(blockState, greenTerra);
|
||||
}
|
||||
//} mod config close
|
||||
|
||||
applyXpGain(xp, XPGainReason.PVE);
|
||||
@ -181,11 +181,11 @@ public class HerbalismManager extends SkillManager {
|
||||
|
||||
/**
|
||||
* Check for success on herbalism double drops
|
||||
*
|
||||
* @param blockState target block state
|
||||
* @return true if double drop succeeds
|
||||
*/
|
||||
public boolean checkDoubleDrop(BlockState blockState)
|
||||
{
|
||||
public boolean checkDoubleDrop(BlockState blockState) {
|
||||
return BlockUtils.checkDoubleDrops(getPlayer(), blockState, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ public class HerbalismManager extends SkillManager {
|
||||
public boolean processShroomThumb(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
PlayerInventory playerInventory = player.getInventory();
|
||||
|
||||
|
||||
if (!playerInventory.contains(Material.BROWN_MUSHROOM, 1)) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Skills.NeedMore", StringUtils.getPrettyItemString(Material.BROWN_MUSHROOM));
|
||||
return false;
|
||||
@ -328,8 +328,7 @@ public class HerbalismManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!ItemUtils.isHoe(getPlayer().getInventory().getItemInMainHand()))
|
||||
{
|
||||
if (!ItemUtils.isHoe(getPlayer().getInventory().getItemInMainHand())) {
|
||||
if (!playerInventory.containsAtLeast(seedStack, 1)) {
|
||||
return;
|
||||
}
|
||||
@ -355,8 +354,7 @@ public class HerbalismManager extends SkillManager {
|
||||
|
||||
if (greenTerra) {
|
||||
crops.setAge(3);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
crops.setAge(greenThumbStage);
|
||||
}
|
||||
break;
|
||||
@ -366,21 +364,18 @@ public class HerbalismManager extends SkillManager {
|
||||
|
||||
if (greenTerra || greenThumbStage > 2) {
|
||||
crops.setAge(2);
|
||||
}
|
||||
else if (greenThumbStage == 2) {
|
||||
} else if (greenThumbStage == 2) {
|
||||
crops.setAge(1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
crops.setAge(0);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case COCOA:
|
||||
|
||||
if (greenTerra || getGreenThumbStage() > 1) {
|
||||
crops.setAge(1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
crops.setAge(0);
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user