Merge branch 'master' of github.com:mcMMO-Dev/mcMMO

This commit is contained in:
nossr50 2022-07-17 14:03:10 -07:00
commit 6d7982c0cf
14 changed files with 136 additions and 39 deletions

View File

@ -1,3 +1,16 @@
Version 2.1.215
Version 2.1.214
Temporarily removed FakePlayerAnimationEvent (see notes)
Players can now see their own level up broadcasts
NOTES:
Spigot updated PlayerAnimationEvent with an API break between versions 1.18 and 1.19, as a temporary fix for mcMMO to be able to support both of these
Minecraft versions I have temporarily removed FakePlayerAnimationEvent. I am working on a fix to dynamically use the correct API depending on the version of MC
as many people will likely be stuck on 1.18 for a while.
FakePlayerAnimationEvent existed to circumvent false positives on anti-cheat plugins such as NoCheat, however
I am unsure if it is still needed and removing it may have no ill effects.. however I cannot be certain.
Anti-cheat plugin authors should be informed to update if you run into false positives with mcMMO after this update so they can make the appropriate changes.
Version 2.1.213 Version 2.1.213
Updated various mechanics to recognize and understand the new blocks Updated various mechanics to recognize and understand the new blocks
Added 'Packed_Mud' to mining xp Added 'Packed_Mud' to mining xp

10
pom.xml
View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId> <groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId> <artifactId>mcMMO</artifactId>
<version>2.1.213</version> <version>2.1.215-SNAPSHOT</version>
<name>mcMMO</name> <name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url> <url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm> <scm>
@ -226,8 +226,8 @@
<url>https://repo.codemc.org/repository/maven-public</url> <url>https://repo.codemc.org/repository/maven-public</url>
</repository> </repository>
<repository> <repository>
<id>sk89q-repo</id> <id>enginehub-repo</id>
<url>https://maven.sk89q.com/repo/</url> <url>https://maven.enginehub.org/repo/</url>
</repository> </repository>
<repository> <!-- for development builds --> <repository> <!-- for development builds -->
<id>sonatype-oss</id> <id>sonatype-oss</id>
@ -279,12 +279,12 @@
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId> <artifactId>adventure-platform-bukkit</artifactId>
<version>4.0.1</version> <version>4.1.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-platform-api</artifactId> <artifactId>adventure-platform-api</artifactId>
<version>4.0.1</version> <version>4.1.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven.scm</groupId> <groupId>org.apache.maven.scm</groupId>

View File

@ -74,7 +74,7 @@ public class LevelUpBroadcastPredicate<T extends CommandSender> implements Predi
} }
//Visibility checks //Visibility checks
if(!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer())) { if(!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
return false; //Player who leveled should be invisible to this player so don't send the message return false; //Player who leveled should be invisible to this player so don't send the message
} }

View File

@ -74,7 +74,7 @@ public class PowerLevelUpBroadcastPredicate<T extends CommandSender> implements
} }
//Visibility checks //Visibility checks
if(!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer())) { if(!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
return false; //Player who leveled should be invisible to this player so don't send the message return false; //Player who leveled should be invisible to this player so don't send the message
} }

View File

@ -1,13 +1,14 @@
package com.gmail.nossr50.events.fake; //package com.gmail.nossr50.events.fake;
//
import org.bukkit.entity.Player; //import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerAnimationEvent; //import org.bukkit.event.player.PlayerAnimationEvent;
//import org.bukkit.event.player.PlayerAnimationType;
/** //
* Called when handling extra drops to avoid issues with NoCheat. ///**
*/ // * Called when handling extra drops to avoid issues with NoCheat.
public class FakePlayerAnimationEvent extends PlayerAnimationEvent implements FakeEvent { // */
public FakePlayerAnimationEvent(Player player) { //public class FakePlayerAnimationEvent extends PlayerAnimationEvent implements FakeEvent {
super(player); // public FakePlayerAnimationEvent(Player player, PlayerAnimationType playerAnimationType) {
} // super(player, playerAnimationType);
} // }
//}

View File

@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.taming.CallOfTheWildType; import com.gmail.nossr50.datatypes.skills.subskills.taming.CallOfTheWildType;
import com.gmail.nossr50.events.McMMOReplaceVanillaTreasureEvent; import com.gmail.nossr50.events.McMMOReplaceVanillaTreasureEvent;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.ShareHandler; import com.gmail.nossr50.party.ShareHandler;
@ -841,7 +840,7 @@ public class PlayerListener implements Listener {
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager(); HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer()); //PlayerAnimationEvent compat // FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer(), PlayerAnimationType.ARM_SWING); //PlayerAnimationEvent compat
if(!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) { if(!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) {
//TODO: Is this code to set false from bone meal even needed? I'll have to double check later. //TODO: Is this code to set false from bone meal even needed? I'll have to double check later.
if (heldItem.getType() == Material.BONE_MEAL) { if (heldItem.getType() == Material.BONE_MEAL) {
@ -860,7 +859,7 @@ public class PlayerListener implements Listener {
if (herbalismManager.canGreenThumbBlock(blockState)) { if (herbalismManager.canGreenThumbBlock(blockState)) {
//call event for Green Thumb Block //call event for Green Thumb Block
if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, block).isCancelled()) { if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, block).isCancelled()) {
Bukkit.getPluginManager().callEvent(fakeSwing); // Bukkit.getPluginManager().callEvent(fakeSwing);
player.getInventory().getItemInMainHand().setAmount(heldItem.getAmount() - 1); player.getInventory().getItemInMainHand().setAmount(heldItem.getAmount() - 1);
player.updateInventory(); player.updateInventory();
if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) { if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
@ -871,7 +870,7 @@ public class PlayerListener implements Listener {
/* SHROOM THUMB CHECK */ /* SHROOM THUMB CHECK */
else if (herbalismManager.canUseShroomThumb(blockState)) { else if (herbalismManager.canUseShroomThumb(blockState)) {
if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_SHROOM_THUMB, block).isCancelled()) { if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_SHROOM_THUMB, block).isCancelled()) {
Bukkit.getPluginManager().callEvent(fakeSwing); // Bukkit.getPluginManager().callEvent(fakeSwing);
event.setCancelled(true); event.setCancelled(true);
if (herbalismManager.processShroomThumb(blockState) if (herbalismManager.processShroomThumb(blockState)
&& EventUtils.simulateBlockBreak(block, player, false)) { && EventUtils.simulateBlockBreak(block, player, false)) {

View File

@ -281,6 +281,7 @@ public class WoodcuttingManager extends SkillManager {
Player player = getPlayer(); Player player = getPlayer();
int xp = 0; int xp = 0;
int processedLogCount = 0; int processedLogCount = 0;
ItemStack itemStack = player.getInventory().getItemInMainHand();
for (BlockState blockState : treeFellerBlocks) { for (BlockState blockState : treeFellerBlocks) {
int beforeXP = xp; int beforeXP = xp;
@ -299,7 +300,7 @@ public class WoodcuttingManager extends SkillManager {
xp += processTreeFellerXPGains(blockState, processedLogCount); xp += processTreeFellerXPGains(blockState, processedLogCount);
//Drop displaced block //Drop displaced block
Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK); Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);
//Bonus Drops / Harvest lumber checks //Bonus Drops / Harvest lumber checks
processHarvestLumber(blockState); processHarvestLumber(blockState);
@ -307,7 +308,7 @@ public class WoodcuttingManager extends SkillManager {
//Drop displaced non-woodcutting XP blocks //Drop displaced non-woodcutting XP blocks
if(RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) { if(RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK); 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(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
if(mcMMO.p.getAdvancedConfig().isKnockOnWoodXPOrbEnabled()) { if(mcMMO.p.getAdvancedConfig().isKnockOnWoodXPOrbEnabled()) {
@ -319,7 +320,7 @@ public class WoodcuttingManager extends SkillManager {
} }
} else { } else {
Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK, 1); Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK, 1);
} }
} }

View File

@ -44,6 +44,8 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerAnimationType;
import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@ -224,12 +226,12 @@ public final class EventUtils {
return event; return event;
} }
public static FakePlayerAnimationEvent callFakeArmSwingEvent(Player player) { // public static Event callFakeArmSwingEvent(@NotNull Player player) {
FakePlayerAnimationEvent event = new FakePlayerAnimationEvent(player); // PlayerAnimationEvent event = new FakePlayerAnimationEvent(player, PlayerAnimationType.ARM_SWING);
mcMMO.p.getServer().getPluginManager().callEvent(event); // mcMMO.p.getServer().getPluginManager().callEvent(event);
//
return event; // return event;
} // }
public static boolean tryLevelChangeEvent(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason) { public static boolean tryLevelChangeEvent(Player player, PrimarySkillType skill, int levelsChanged, float xpRemoved, boolean isLevelUp, XPGainReason xpGainReason) {
McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason); McMMOPlayerLevelChangeEvent event = isLevelUp ? new McMMOPlayerLevelUpEvent(player, skill, levelsChanged, xpGainReason) : new McMMOPlayerLevelDownEvent(player, skill, levelsChanged, xpGainReason);
@ -314,9 +316,9 @@ public final class EventUtils {
PluginManager pluginManager = mcMMO.p.getServer().getPluginManager(); PluginManager pluginManager = mcMMO.p.getServer().getPluginManager();
// Support for NoCheat // Support for NoCheat
if (shouldArmSwing) { //if (shouldArmSwing) {
callFakeArmSwingEvent(player); // callFakeArmSwingEvent(player);
} //}
FakeBlockDamageEvent damageEvent = new FakeBlockDamageEvent(player, block, player.getInventory().getItemInMainHand(), true); FakeBlockDamageEvent damageEvent = new FakeBlockDamageEvent(player, block, player.getInventory().getItemInMainHand(), true);
pluginManager.callEvent(damageEvent); pluginManager.callEvent(damageEvent);

View File

@ -134,6 +134,11 @@ public final class Permissions {
|| permissible.hasPermission("mcmmo.perks.xp.50percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); || permissible.hasPermission("mcmmo.perks.xp.50percentboost." + skill.toString().toLowerCase(Locale.ENGLISH));
} }
public static boolean oneAndAQuarterXp(Permissible permissible, PrimarySkillType skill) {
return permissible.hasPermission("mcmmo.perks.xp.25percentboost.all")
|| permissible.hasPermission("mcmmo.perks.xp.25percentboost." + skill.toString().toLowerCase(Locale.ENGLISH));
}
public static boolean oneAndOneTenthXp(Permissible permissible, PrimarySkillType skill) { public static boolean oneAndOneTenthXp(Permissible permissible, PrimarySkillType skill) {
return permissible.hasPermission("mcmmo.perks.xp.10percentboost.all") return permissible.hasPermission("mcmmo.perks.xp.10percentboost.all")
|| permissible.hasPermission("mcmmo.perks.xp.10percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); || permissible.hasPermission("mcmmo.perks.xp.10percentboost." + skill.toString().toLowerCase(Locale.ENGLISH));

View File

@ -626,7 +626,7 @@ public class ScoreboardWrapper {
} }
} }
public void acceptLeaderboardData(List<PlayerStat> leaderboardData) { public void acceptLeaderboardData(@NotNull List<PlayerStat> leaderboardData) {
for (PlayerStat stat : leaderboardData) { for (PlayerStat stat : leaderboardData) {
String name = stat.name; String name = stat.name;

View File

@ -681,7 +681,7 @@ public final class CombatUtils {
continue; continue;
} }
EventUtils.callFakeArmSwingEvent(attacker); //EventUtils.callFakeArmSwingEvent(attacker);
switch (type) { switch (type) {
case SWORDS: case SWORDS:

View File

@ -74,6 +74,9 @@ public final class PerksUtils {
else if (Permissions.oneAndOneHalfXp(player, skill)) { else if (Permissions.oneAndOneHalfXp(player, skill)) {
modifier = 1.5; modifier = 1.5;
} }
else if (Permissions.oneAndAQuarterXp(player, skill)) {
modifier = 1.25;
}
else if (Permissions.oneAndOneTenthXp(player, skill)) { else if (Permissions.oneAndOneTenthXp(player, skill)) {
modifier = 1.1; modifier = 1.1;
} }

View File

@ -304,6 +304,7 @@ Experience_Values:
Acacia_Wood: 70 Acacia_Wood: 70
Dark_Oak_Wood: 70 Dark_Oak_Wood: 70
Mangrove_Wood: 80 Mangrove_Wood: 80
Mangrove_Log: 95
Mangrove_Roots: 10 Mangrove_Roots: 10
Red_Mushroom_Block: 70 Red_Mushroom_Block: 70
Brown_Mushroom_Block: 70 Brown_Mushroom_Block: 70
@ -496,6 +497,7 @@ Experience_Values:
Purpur_Stairs: 250 Purpur_Stairs: 250
Packed_Mud: 30 Packed_Mud: 30
Mud_Bricks: 40 Mud_Bricks: 40
Dripstone_Block: 35
Repair: Repair:
Base: 1000.0 Base: 1000.0
Wood: 0.6 Wood: 0.6

View File

@ -1495,6 +1495,7 @@ permissions:
children: children:
mcmmo.perks.xp.150percentboost.all: true mcmmo.perks.xp.150percentboost.all: true
mcmmo.perks.xp.50percentboost.all: true mcmmo.perks.xp.50percentboost.all: true
mcmmo.perks.xp.25percentboost.all: true
mcmmo.perks.xp.10percentboost.all: true mcmmo.perks.xp.10percentboost.all: true
mcmmo.perks.xp.customboost.all: true mcmmo.perks.xp.customboost.all: true
mcmmo.perks.xp.double.all: true mcmmo.perks.xp.double.all: true
@ -1640,6 +1641,76 @@ permissions:
mcmmo.perks.xp.50percentboost.woodcutting: mcmmo.perks.xp.50percentboost.woodcutting:
default: false default: false
description: Multiplies incoming Woodcutting XP by 1.5 description: Multiplies incoming Woodcutting XP by 1.5
mcmmo.perks.xp.25percentboost.*:
default: false
description: Multiplies incoming XP by 1.25
children:
mcmmo.perks.xp.25percentboost.all: true
mcmmo.perks.xp.25percentboost:
default: false
description: Multiplies incoming XP by 1.25
children:
mcmmo.perks.xp.25percentboost.all: true
mcmmo.perks.xp.25percentboost.all:
default: false
description: Multiplies incoming XP by 1.25
children:
mcmmo.perks.xp.25percentboost.acrobatics: true
mcmmo.perks.xp.25percentboost.alchemy: true
mcmmo.perks.xp.25percentboost.archery: true
mcmmo.perks.xp.25percentboost.axes: true
mcmmo.perks.xp.25percentboost.excavation: true
mcmmo.perks.xp.25percentboost.fishing: true
mcmmo.perks.xp.25percentboost.herbalism: true
mcmmo.perks.xp.25percentboost.mining: true
mcmmo.perks.xp.25percentboost.repair: true
mcmmo.perks.xp.25percentboost.smelting: true
mcmmo.perks.xp.25percentboost.swords: true
mcmmo.perks.xp.25percentboost.taming: true
mcmmo.perks.xp.25percentboost.unarmed: true
mcmmo.perks.xp.25percentboost.woodcutting: true
mcmmo.perks.xp.25percentboost.acrobatics:
default: false
description: Multiplies incoming Acrobatics XP by 1.25
mcmmo.perks.xp.25percentboost.alchemy:
default: false
description: Multiplies incoming Acrobatics XP by 1.25
mcmmo.perks.xp.25percentboost.archery:
default: false
description: Multiplies incoming Archery XP by 1.25
mcmmo.perks.xp.25percentboost.axes:
default: false
description: Multiplies incoming Axes XP by 1.25
mcmmo.perks.xp.25percentboost.excavation:
default: false
description: Multiplies incoming Excavation XP by 1.25
mcmmo.perks.xp.25percentboost.fishing:
default: false
description: Multiplies incoming Fishing XP by 1.25
mcmmo.perks.xp.25percentboost.herbalism:
default: false
description: Multiplies incoming Herbalism XP by 1.25
mcmmo.perks.xp.25percentboost.mining:
default: false
description: Multiplies incoming Mining XP by 1.25
mcmmo.perks.xp.25percentboost.repair:
default: false
description: Multiplies incoming Repair XP by 1.25
mcmmo.perks.xp.25percentboost.smelting:
default: false
description: Multiplies incoming Smelting XP by 1.25
mcmmo.perks.xp.25percentboost.swords:
default: false
description: Multiplies incoming Swords XP by 1.25
mcmmo.perks.xp.25percentboost.taming:
default: false
description: Multiplies incoming Taming XP by 1.25
mcmmo.perks.xp.25percentboost.unarmed:
default: false
description: Multiplies incoming Unarmed XP by 1.5
mcmmo.perks.xp.25percentboost.woodcutting:
default: false
description: Multiplies incoming Woodcutting XP by 1.25
mcmmo.perks.xp.10percentboost.*: mcmmo.perks.xp.10percentboost.*:
default: false default: false
description: Multiplies incoming XP by 1.1 description: Multiplies incoming XP by 1.1