mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
Tree Feller non-wood drop rate reduced by 90%
This commit is contained in:
parent
dda5b45bb1
commit
377bf1be4d
@ -10,6 +10,7 @@ Version 2.2.000
|
||||
TODO: Add unit test to determine crossbow or bow skill
|
||||
TODO: Add unit test for trident xp processing
|
||||
TODO: Add missing entries to changelog
|
||||
Tree Feller now drops 90% less non-wood blocks (leaves/etc) on average
|
||||
Replaced 'Experience_Formula.Modifier' in experience.yml with 'Experience_Formula.Skill_Multiplier' which is easier to understand and less prone to divide by zero bugs
|
||||
Treasure drop rate from Shake, Fishing, Hylian, and Excavation now benefit from the Luck perk
|
||||
Added 'Send_To_Console' settings to chat.yml to toggle sending party or admin chat messages to console
|
||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.2.000-BETA-02-SNAPSHOT</version>
|
||||
<version>2.2.000-BETA-04-SNAPSHOT</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<scm>
|
||||
|
@ -34,6 +34,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
//TODO: Seems to not be using the item drop event for bonus drops, may want to change that.. or may not be able to be changed?
|
||||
public class WoodcuttingManager extends SkillManager {
|
||||
@ -323,10 +324,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
processBonusDropCheck(blockState);
|
||||
} else if (BlockUtils.isNonWoodPartOfTree(blockState)) {
|
||||
//Drop displaced non-woodcutting XP blocks
|
||||
|
||||
if(RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
||||
Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);
|
||||
|
||||
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
||||
if(mcMMO.p.getAdvancedConfig().isKnockOnWoodXPOrbEnabled()) {
|
||||
//TODO: Test the results of this RNG, should be 10%
|
||||
@ -336,8 +334,10 @@ public class WoodcuttingManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// 90% of the time do not drop leaf blocks
|
||||
if (ThreadLocalRandom.current().nextInt(100) > 90) {
|
||||
Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK, 1);
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import java.util.UUID;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public abstract class MMOTestEnvironment {
|
||||
protected MockedStatic<mcMMO> mockedMcMMO;
|
||||
@ -62,23 +63,24 @@ public abstract class MMOTestEnvironment {
|
||||
protected String playerName = "testPlayer";
|
||||
|
||||
protected ChunkManager chunkManager;
|
||||
protected MaterialMapStore materialMapStore;
|
||||
|
||||
protected void mockBaseEnvironment(Logger logger) throws InvalidSkillException {
|
||||
mockedMcMMO = Mockito.mockStatic(mcMMO.class);
|
||||
mcMMO.p = Mockito.mock(mcMMO.class);
|
||||
Mockito.when(mcMMO.p.getLogger()).thenReturn(logger);
|
||||
when(mcMMO.p.getLogger()).thenReturn(logger);
|
||||
|
||||
// place store
|
||||
chunkManager = Mockito.mock(ChunkManager.class);
|
||||
Mockito.when(mcMMO.getPlaceStore()).thenReturn(chunkManager);
|
||||
when(mcMMO.getPlaceStore()).thenReturn(chunkManager);
|
||||
|
||||
// shut off mod manager for woodcutting
|
||||
Mockito.when(mcMMO.getModManager()).thenReturn(Mockito.mock(ModManager.class));
|
||||
Mockito.when(mcMMO.getModManager().isCustomLog(any())).thenReturn(false);
|
||||
when(mcMMO.getModManager()).thenReturn(Mockito.mock(ModManager.class));
|
||||
when(mcMMO.getModManager().isCustomLog(any())).thenReturn(false);
|
||||
|
||||
// chat config
|
||||
mockedChatConfig = Mockito.mockStatic(ChatConfig.class);
|
||||
Mockito.when(ChatConfig.getInstance()).thenReturn(Mockito.mock(ChatConfig.class));
|
||||
when(ChatConfig.getInstance()).thenReturn(Mockito.mock(ChatConfig.class));
|
||||
|
||||
// general config
|
||||
mockGeneralConfig();
|
||||
@ -94,10 +96,10 @@ public abstract class MMOTestEnvironment {
|
||||
|
||||
// wire skill tools
|
||||
this.skillTools = new SkillTools(mcMMO.p);
|
||||
Mockito.when(mcMMO.p.getSkillTools()).thenReturn(skillTools);
|
||||
when(mcMMO.p.getSkillTools()).thenReturn(skillTools);
|
||||
|
||||
this.transientEntityTracker = new TransientEntityTracker();
|
||||
Mockito.when(mcMMO.getTransientEntityTracker()).thenReturn(transientEntityTracker);
|
||||
when(mcMMO.getTransientEntityTracker()).thenReturn(transientEntityTracker);
|
||||
|
||||
mockPermissions();
|
||||
|
||||
@ -105,26 +107,26 @@ public abstract class MMOTestEnvironment {
|
||||
|
||||
// wire server
|
||||
this.server = Mockito.mock(Server.class);
|
||||
Mockito.when(mcMMO.p.getServer()).thenReturn(server);
|
||||
when(mcMMO.p.getServer()).thenReturn(server);
|
||||
|
||||
// wire plugin manager
|
||||
this.pluginManager = Mockito.mock(PluginManager.class);
|
||||
Mockito.when(server.getPluginManager()).thenReturn(pluginManager);
|
||||
when(server.getPluginManager()).thenReturn(pluginManager);
|
||||
|
||||
// wire world
|
||||
this.world = Mockito.mock(World.class);
|
||||
|
||||
// wire Misc
|
||||
this.mockedMisc = Mockito.mockStatic(Misc.class);
|
||||
Mockito.when(Misc.getBlockCenter(any())).thenReturn(new Location(world, 0, 0, 0));
|
||||
when(Misc.getBlockCenter(any())).thenReturn(new Location(world, 0, 0, 0));
|
||||
|
||||
// setup player and player related mocks after everything else
|
||||
this.player = Mockito.mock(Player.class);
|
||||
Mockito.when(player.getUniqueId()).thenReturn(playerUUID);
|
||||
when(player.getUniqueId()).thenReturn(playerUUID);
|
||||
|
||||
// wire inventory
|
||||
this.playerInventory = Mockito.mock(PlayerInventory.class);
|
||||
Mockito.when(player.getInventory()).thenReturn(playerInventory);
|
||||
when(player.getInventory()).thenReturn(playerInventory);
|
||||
|
||||
// PlayerProfile and McMMOPlayer are partially mocked
|
||||
playerProfile = new PlayerProfile("testPlayer", player.getUniqueId(), 0);
|
||||
@ -132,16 +134,19 @@ public abstract class MMOTestEnvironment {
|
||||
|
||||
// wire user manager
|
||||
this.mockedUserManager = Mockito.mockStatic(UserManager.class);
|
||||
Mockito.when(UserManager.getPlayer(player)).thenReturn(mmoPlayer);
|
||||
when(UserManager.getPlayer(player)).thenReturn(mmoPlayer);
|
||||
|
||||
this.materialMapStore = new MaterialMapStore();
|
||||
when(mcMMO.getMaterialMapStore()).thenReturn(materialMapStore);
|
||||
}
|
||||
|
||||
private void mockPermissions() {
|
||||
mockedPermissions = Mockito.mockStatic(Permissions.class);
|
||||
Mockito.when(Permissions.isSubSkillEnabled(any(Player.class), any(SubSkillType.class))).thenReturn(true);
|
||||
Mockito.when(Permissions.canUseSubSkill(any(Player.class), any(SubSkillType.class))).thenReturn(true);
|
||||
Mockito.when(Permissions.isSubSkillEnabled(any(Player.class), any(SubSkillType.class))).thenReturn(true);
|
||||
Mockito.when(Permissions.canUseSubSkill(any(Player.class), any(SubSkillType.class))).thenReturn(true);
|
||||
Mockito.when(Permissions.lucky(player, PrimarySkillType.WOODCUTTING)).thenReturn(false); // player is not lucky
|
||||
when(Permissions.isSubSkillEnabled(any(Player.class), any(SubSkillType.class))).thenReturn(true);
|
||||
when(Permissions.canUseSubSkill(any(Player.class), any(SubSkillType.class))).thenReturn(true);
|
||||
when(Permissions.isSubSkillEnabled(any(Player.class), any(SubSkillType.class))).thenReturn(true);
|
||||
when(Permissions.canUseSubSkill(any(Player.class), any(SubSkillType.class))).thenReturn(true);
|
||||
when(Permissions.lucky(player, PrimarySkillType.WOODCUTTING)).thenReturn(false); // player is not lucky
|
||||
}
|
||||
|
||||
private void mockRankConfig() {
|
||||
@ -150,24 +155,24 @@ public abstract class MMOTestEnvironment {
|
||||
|
||||
private void mockAdvancedConfig() {
|
||||
this.advancedConfig = Mockito.mock(AdvancedConfig.class);
|
||||
Mockito.when(mcMMO.p.getAdvancedConfig()).thenReturn(advancedConfig);
|
||||
when(mcMMO.p.getAdvancedConfig()).thenReturn(advancedConfig);
|
||||
}
|
||||
|
||||
private void mockGeneralConfig() {
|
||||
generalConfig = Mockito.mock(GeneralConfig.class);
|
||||
Mockito.when(generalConfig.getTreeFellerThreshold()).thenReturn(100);
|
||||
Mockito.when(generalConfig.getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, Material.OAK_LOG)).thenReturn(true);
|
||||
Mockito.when(generalConfig.getLocale()).thenReturn("en_US");
|
||||
Mockito.when(mcMMO.p.getGeneralConfig()).thenReturn(generalConfig);
|
||||
when(generalConfig.getTreeFellerThreshold()).thenReturn(100);
|
||||
when(generalConfig.getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, Material.OAK_LOG)).thenReturn(true);
|
||||
when(generalConfig.getLocale()).thenReturn("en_US");
|
||||
when(mcMMO.p.getGeneralConfig()).thenReturn(generalConfig);
|
||||
}
|
||||
|
||||
private void mockExperienceConfig() {
|
||||
experienceConfig = Mockito.mockStatic(ExperienceConfig.class);
|
||||
|
||||
Mockito.when(ExperienceConfig.getInstance()).thenReturn(Mockito.mock(ExperienceConfig.class));
|
||||
when(ExperienceConfig.getInstance()).thenReturn(Mockito.mock(ExperienceConfig.class));
|
||||
|
||||
// Combat
|
||||
Mockito.when(ExperienceConfig.getInstance().getCombatXP("Cow")).thenReturn(1D);
|
||||
when(ExperienceConfig.getInstance().getCombatXP("Cow")).thenReturn(1D);
|
||||
}
|
||||
|
||||
protected void cleanupBaseEnvironment() {
|
||||
|
Loading…
Reference in New Issue
Block a user