mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Fixed most block based experience gain
This commit is contained in:
parent
bd3d437a91
commit
32db56abe5
@ -195,6 +195,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
/* Materials */
|
/* Materials */
|
||||||
public int getXp(SkillType skill, BlockData data)
|
public int getXp(SkillType skill, BlockData data)
|
||||||
{
|
{
|
||||||
|
System.out.print(">>YUP>"+skill.toString());
|
||||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||||
if (config.contains(explicitString))
|
if (config.contains(explicitString))
|
||||||
@ -210,7 +211,6 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
|||||||
|
|
||||||
public boolean isSkillBlock(SkillType skill, BlockData data)
|
public boolean isSkillBlock(SkillType skill, BlockData data)
|
||||||
{
|
{
|
||||||
System.out.print(">>\n\n"+config.toString()+"\n\n<<");
|
|
||||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||||
if (config.contains(explicitString))
|
if (config.contains(explicitString))
|
||||||
|
@ -191,12 +191,10 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
/* HERBALISM */
|
/* HERBALISM */
|
||||||
if (BlockUtils.affectedByGreenTerra(blockState)) {
|
if (BlockUtils.affectedByGreenTerra(blockState)) {
|
||||||
System.out.println(">>This Shit");
|
|
||||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||||
|
|
||||||
/* Green Terra */
|
/* Green Terra */
|
||||||
if (herbalismManager.canActivateAbility()) {
|
if (herbalismManager.canActivateAbility()) {
|
||||||
System.out.println(">>Sucks big ol");
|
|
||||||
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM);
|
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +203,7 @@ public class BlockListener implements Listener {
|
|||||||
* Instead, we check it inside the drops handler.
|
* Instead, we check it inside the drops handler.
|
||||||
*/
|
*/
|
||||||
if (SkillType.HERBALISM.getPermissions(player)) {
|
if (SkillType.HERBALISM.getPermissions(player)) {
|
||||||
System.out.println(">>Pee pee");
|
System.out.print(">>getPermissions");
|
||||||
herbalismManager.herbalismBlockCheck(blockState);
|
herbalismManager.herbalismBlockCheck(blockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +217,6 @@ public class BlockListener implements Listener {
|
|||||||
/* WOOD CUTTING */
|
/* WOOD CUTTING */
|
||||||
else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && SkillType.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && SkillType.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||||
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
||||||
|
|
||||||
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
||||||
woodcuttingManager.processTreeFeller(blockState);
|
woodcuttingManager.processTreeFeller(blockState);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ public class Excavation {
|
|||||||
* @return the list of treasures that could be found
|
* @return the list of treasures that could be found
|
||||||
*/
|
*/
|
||||||
protected static List<ExcavationTreasure> getTreasures(BlockState blockState) {
|
protected static List<ExcavationTreasure> getTreasures(BlockState blockState) {
|
||||||
System.out.print(">>4");
|
|
||||||
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
|
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
|
||||||
if (TreasureConfig.getInstance().excavationMap.containsKey(friendly))
|
if (TreasureConfig.getInstance().excavationMap.containsKey(friendly))
|
||||||
return TreasureConfig.getInstance().excavationMap.get(friendly);
|
return TreasureConfig.getInstance().excavationMap.get(friendly);
|
||||||
@ -28,7 +27,6 @@ public class Excavation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static int getBlockXP(BlockState blockState) {
|
protected static int getBlockXP(BlockState blockState) {
|
||||||
System.out.print(">>5");
|
|
||||||
int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getBlockData());
|
int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getBlockData());
|
||||||
|
|
||||||
if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {
|
if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {
|
||||||
|
@ -112,18 +112,22 @@ public class HerbalismManager extends SkillManager {
|
|||||||
* @param blockState The {@link BlockState} to check ability activation for
|
* @param blockState The {@link BlockState} to check ability activation for
|
||||||
*/
|
*/
|
||||||
public void herbalismBlockCheck(BlockState blockState) {
|
public void herbalismBlockCheck(BlockState blockState) {
|
||||||
|
System.out.print(">>1");
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
Material material = blockState.getType();
|
Material material = blockState.getType();
|
||||||
boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.CHORUS_PLANT || material == Material.SUGAR_CANE);
|
boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.CHORUS_PLANT || material == Material.SUGAR_CANE);
|
||||||
|
|
||||||
// Prevents placing and immediately breaking blocks for exp
|
// Prevents placing and immediately breaking blocks for exp
|
||||||
if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) {
|
if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||||
|
System.out.print(">>1.5");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
System.out.print(">>2");
|
||||||
|
|
||||||
if (!canBlockCheck()) {
|
if (!canBlockCheck()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
System.out.print(">>3");
|
||||||
|
|
||||||
Collection<ItemStack> drops = null;
|
Collection<ItemStack> drops = null;
|
||||||
int amount = 1;
|
int amount = 1;
|
||||||
@ -131,6 +135,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
boolean greenTerra = mcMMOPlayer.getAbilityMode(skill.getAbility());
|
boolean greenTerra = mcMMOPlayer.getAbilityMode(skill.getAbility());
|
||||||
|
|
||||||
if (mcMMO.getModManager().isCustomHerbalismBlock(blockState)) {
|
if (mcMMO.getModManager().isCustomHerbalismBlock(blockState)) {
|
||||||
|
System.out.print(">>4");
|
||||||
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState);
|
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState);
|
||||||
xp = customBlock.getXpGain();
|
xp = customBlock.getXpGain();
|
||||||
|
|
||||||
@ -139,6 +144,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
System.out.print(">>5");
|
||||||
if(material == Material.CHORUS_FLOWER && blockState.getRawData() != 5) {
|
if(material == Material.CHORUS_FLOWER && blockState.getRawData() != 5) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -146,21 +152,26 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) {
|
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) {
|
||||||
drops = blockState.getBlock().getDrops();
|
drops = blockState.getBlock().getDrops();
|
||||||
|
System.out.print(">>6");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!oneBlockPlant) {
|
if (!oneBlockPlant) {
|
||||||
|
System.out.print(">>7");
|
||||||
amount = Herbalism.calculateMultiBlockPlantDrops(blockState);
|
amount = Herbalism.calculateMultiBlockPlantDrops(blockState);
|
||||||
xp *= amount;
|
xp *= amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Permissions.greenThumbPlant(player, material)) {
|
if (Permissions.greenThumbPlant(player, material)) {
|
||||||
|
System.out.print(">>8");
|
||||||
processGreenThumbPlants(blockState, greenTerra);
|
processGreenThumbPlants(blockState, greenTerra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.print(">>9");
|
||||||
|
|
||||||
applyXpGain(xp, XPGainReason.PVE);
|
applyXpGain(xp, XPGainReason.PVE);
|
||||||
|
|
||||||
if (drops == null) {
|
if (drops == null) {
|
||||||
|
System.out.print(">>10");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,8 +331,8 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
|
|
||||||
case POTATO:
|
case POTATOES:
|
||||||
case CARROT:
|
case CARROTS:
|
||||||
case BEETROOTS:
|
case BEETROOTS:
|
||||||
case WHEAT:
|
case WHEAT:
|
||||||
Crops crops = (Crops) blockState.getBlockData();
|
Crops crops = (Crops) blockState.getBlockData();
|
||||||
|
@ -45,6 +45,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
* @param blockState Block being broken
|
* @param blockState Block being broken
|
||||||
*/
|
*/
|
||||||
public void woodcuttingBlockCheck(BlockState blockState) {
|
public void woodcuttingBlockCheck(BlockState blockState) {
|
||||||
|
System.out.print(">>HEYO");
|
||||||
int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
|
int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
|
||||||
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
|
@ -170,9 +170,7 @@ public final class BlockUtils {
|
|||||||
* @return true if the block should affected by Green Terra, false otherwise
|
* @return true if the block should affected by Green Terra, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean affectedByGreenTerra(BlockState blockState) {
|
public static boolean affectedByGreenTerra(BlockState blockState) {
|
||||||
System.out.print(">>Fuckin hell dude");
|
|
||||||
if (ExperienceConfig.getInstance().isSkillBlock(SkillType.HERBALISM, blockState.getBlockData())) {
|
if (ExperienceConfig.getInstance().isSkillBlock(SkillType.HERBALISM, blockState.getBlockData())) {
|
||||||
System.out.print(">>Does it work?");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.skills.AbilityType;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.TreeSpecies;
|
import org.bukkit.TreeSpecies;
|
||||||
|
import org.bukkit.block.data.Ageable;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
@ -42,6 +43,20 @@ public class StringUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getFriendlyConfigBlockDataString(BlockData data) {
|
public static String getFriendlyConfigBlockDataString(BlockData data) {
|
||||||
|
Ageable isCrop = (Ageable) data;
|
||||||
|
switch(data.getMaterial()){
|
||||||
|
case COCOA:
|
||||||
|
case WHEAT:
|
||||||
|
case BEETROOTS:
|
||||||
|
case CARROTS:
|
||||||
|
case POTATOES:
|
||||||
|
case NETHER_WART_BLOCK: {
|
||||||
|
if (isCrop.getAge() == isCrop.getMaximumAge()) {
|
||||||
|
return getPrettyItemString(data.getMaterial()).replace(" ", "_") + "_Ripe";
|
||||||
|
}
|
||||||
|
return getPrettyItemString(data.getMaterial()).replace(" ", "_") + "_Ungrown";
|
||||||
|
}
|
||||||
|
}
|
||||||
return getPrettyItemString(data.getMaterial()).replace(" ", "_");
|
return getPrettyItemString(data.getMaterial()).replace(" ", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,48 +140,54 @@ Experience:
|
|||||||
Snow_Block: 40
|
Snow_Block: 40
|
||||||
Soul_Sand: 40
|
Soul_Sand: 40
|
||||||
Woodcutting:
|
Woodcutting:
|
||||||
Acacia: 90
|
Oak_Log: 70
|
||||||
Birch: 90
|
Spruce_Log: 80
|
||||||
Dark_Oak: 90
|
Birch_Log: 90
|
||||||
Generic: 70
|
Jungle_Log: 100
|
||||||
Jungle: 100
|
Acacia_Log: 90
|
||||||
Redwood: 80
|
Dark_Oak_Log: 90
|
||||||
|
Stripped_Oak_Log: 70
|
||||||
|
Stripped_Spruce_Log: 80
|
||||||
|
Stripped_Birch_Log: 90
|
||||||
|
Stripped_Jungle_Log: 100
|
||||||
|
Stripped_Acacia_Log: 90
|
||||||
|
Stripped_Dark_Oak_Log: 90
|
||||||
Huge_Mushroom_1: 70
|
Huge_Mushroom_1: 70
|
||||||
Huge_Mushroom_2: 70
|
Huge_Mushroom_2: 70
|
||||||
Herbalism:
|
Herbalism:
|
||||||
Allium: 300
|
Allium: 300
|
||||||
Azure_Bluet: 150
|
Azure_Bluet: 150
|
||||||
Beetroot_Block_Ripe: 50
|
Beetroots_Ripe: 50
|
||||||
Blue_Orchid: 150
|
Blue_Orchid: 150
|
||||||
Brown_Mushroom: 150
|
Brown_Mushroom: 150
|
||||||
Cactus: 30
|
Cactus: 30
|
||||||
Carrot_Ripe: 50
|
Carrots_Ripe: 50
|
||||||
Chorus_Flower: 25
|
Chorus_Flower: 25
|
||||||
Chorus_Plant: 1
|
Chorus_Plant: 1
|
||||||
Cocoa_Ripe: 30
|
Cocoa_Ripe: 30
|
||||||
Crops_Ripe: 50
|
Wheat_Ripe: 50
|
||||||
Dead_Bush: 30
|
Dead_Bush: 30
|
||||||
Lilac: 50
|
Lilac: 50
|
||||||
Melon_Block: 20
|
Melon_Block: 20
|
||||||
Nether_Warts_Ripe: 50
|
Nether_Wart_Ripe: 50
|
||||||
Orange_Tulip: 150
|
Orange_Tulip: 150
|
||||||
Oxeye_Daisy: 150
|
Oxeye_Daisy: 150
|
||||||
Peony: 50
|
Peony: 50
|
||||||
Pink_Tulip: 150
|
Pink_Tulip: 150
|
||||||
Poppy: 100
|
Poppy: 100
|
||||||
Potato_Ripe: 50
|
Potatoes_Ripe: 50
|
||||||
Pumpkin: 20
|
Pumpkin: 20
|
||||||
Red_Mushroom: 150
|
Red_Mushroom: 150
|
||||||
Red_Tulip: 150
|
Red_Tulip: 150
|
||||||
Rose_Bush: 50
|
Rose_Bush: 50
|
||||||
Small_Fern: 10
|
Fern: 10
|
||||||
Small_Grass: 10
|
Grass: 10
|
||||||
Sugar_Cane_Block: 30
|
Sugar_Cane_Block: 30
|
||||||
Sunflower: 50
|
Sunflower: 50
|
||||||
Tall_Grass: 50
|
Tall_Grass: 50
|
||||||
Tall_Fern: 50
|
Large_Fern: 50
|
||||||
Vine: 10
|
Vine: 10
|
||||||
Water_Lily: 100
|
Lily_Pad: 100
|
||||||
White_Tulip: 150
|
White_Tulip: 150
|
||||||
Dandelion: 100
|
Dandelion: 100
|
||||||
Mining:
|
Mining:
|
||||||
|
Loading…
Reference in New Issue
Block a user