mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
Merge master
This commit is contained in:
commit
75ace0cfa0
@ -57,9 +57,14 @@ Version 2.2.000
|
|||||||
This power level command gives you a view of all your current masteries, it also provides a summary of your power level.
|
This power level command gives you a view of all your current masteries, it also provides a summary of your power level.
|
||||||
|
|
||||||
Version 2.1.220
|
Version 2.1.220
|
||||||
|
(API) Added TreeFellerBlockBreakEvent class which extends FakeBlockBreakEvent (see notes), this is sent out during Tree Feller processing to allow other plugins to differentiate between Tree Feller and other fake block break events
|
||||||
Config files update automatically again
|
Config files update automatically again
|
||||||
Default configs are now copied to plugins/mcMMO/defaults for easy reference, these configs will always match the default values of the config in the JAR
|
Default configs are now copied to plugins/mcMMO/defaults for easy reference
|
||||||
|
Fixed child skills counting towards power level in /inspect (Thanks Wariorrrr)
|
||||||
|
|
||||||
|
NOTES: For a while configs were not updating automatically as a rewrite of how config files were loaded was partially done, this is now complete and configs will update automatically again.
|
||||||
|
Fake block break events have been sent out historically by mcMMO to check other plugins for a players permission to break or place a block, Tree Feller will now specify via inheritance its own event type for this so mcMMO plugins can handle Tree Feller fake block break events differently if they so choose.
|
||||||
|
You can now view the default configs more easily as they are now copied to plugins/mcMMO/defaults, these configs will be overwritten on start up to match the default values of the config in the JAR
|
||||||
Version 2.1.219
|
Version 2.1.219
|
||||||
Fixed Fishing exploit protection being triggered inappropriately by other plugins (Thanks smudgge)
|
Fixed Fishing exploit protection being triggered inappropriately by other plugins (Thanks smudgge)
|
||||||
Fixed wiki url being incorrect in commands
|
Fixed wiki url being incorrect in commands
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
package com.gmail.nossr50.api;
|
||||||
|
|
||||||
|
public enum FakeBlockBreakEventType {
|
||||||
|
FAKE,
|
||||||
|
TREE_FELLER
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.gmail.nossr50.api;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||||
|
import com.gmail.nossr50.events.fake.FakeEvent;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class TreeFellerBlockBreakEvent extends FakeBlockBreakEvent {
|
||||||
|
public TreeFellerBlockBreakEvent(@NotNull Block theBlock, @NotNull Player player) {
|
||||||
|
super(theBlock, player);
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ import com.gmail.nossr50.util.Permissions;
|
|||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillTools;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -47,27 +48,26 @@ public class InspectCommand implements TabExecutor {
|
|||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
|
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
|
||||||
|
|
||||||
// Sum power level
|
|
||||||
int powerLevel = 0;
|
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||||
for (PrimarySkillType skill : mcMMO.p.getSkillTools().GATHERING_SKILLS) {
|
for (PrimarySkillType skill : mcMMO.p.getSkillTools().GATHERING_SKILLS) {
|
||||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||||
powerLevel += profile.getSkillLevel(skill);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||||
for (PrimarySkillType skill : mcMMO.p.getSkillTools().COMBAT_SKILLS) {
|
for (PrimarySkillType skill : mcMMO.p.getSkillTools().COMBAT_SKILLS) {
|
||||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||||
powerLevel += profile.getSkillLevel(skill);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||||
for (PrimarySkillType skill : mcMMO.p.getSkillTools().MISC_SKILLS) {
|
for (PrimarySkillType skill : mcMMO.p.getSkillTools().MISC_SKILLS) {
|
||||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||||
powerLevel += profile.getSkillLevel(skill);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sum power level
|
||||||
|
int powerLevel = 0;
|
||||||
|
for (PrimarySkillType skill : SkillTools.NON_CHILD_SKILLS)
|
||||||
|
powerLevel += profile.getSkillLevel(skill);
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", powerLevel));
|
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", powerLevel));
|
||||||
} else {
|
} else {
|
||||||
Player target = mcMMOPlayer.getPlayer();
|
Player target = mcMMOPlayer.getPlayer();
|
||||||
|
@ -558,7 +558,7 @@ public class BlockListener implements Listener {
|
|||||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
|
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
|
||||||
|
|
||||||
if(mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK)) {
|
if(mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK)) {
|
||||||
if (SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(blockState.getBlock(), player, true)) {
|
if (SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(blockState.getBlock(), player)) {
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
|
|
||||||
if(blockState.getType().getKey().getKey().contains("glass")) {
|
if(blockState.getType().getKey().getKey().contains("glass")) {
|
||||||
@ -633,11 +633,11 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && (heldItem.getType() == Material.AIR || mcMMO.p.getGeneralConfig().getUnarmedItemsAsUnarmed())) {
|
else if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && (heldItem.getType() == Material.AIR || mcMMO.p.getGeneralConfig().getUnarmedItemsAsUnarmed())) {
|
||||||
if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState)) {
|
if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState)) {
|
||||||
if (EventUtils.simulateBlockBreak(block, player, true) && mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
if (EventUtils.simulateBlockBreak(block, player) && mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
||||||
blockState.update();
|
blockState.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!event.getInstaBreak() && SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
|
else if (!event.getInstaBreak() && SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(block, player)) {
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
|
|
||||||
if(blockState.getType().getKey().getKey().contains("glass")) {
|
if(blockState.getType().getKey().getKey().contains("glass")) {
|
||||||
@ -647,7 +647,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isNonWoodPartOfTree(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
|
else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isNonWoodPartOfTree(blockState) && EventUtils.simulateBlockBreak(block, player)) {
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||||
}
|
}
|
||||||
|
@ -866,7 +866,7 @@ public class PlayerListener implements Listener {
|
|||||||
// 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)) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -877,7 +877,7 @@ public class PlayerListener implements Listener {
|
|||||||
// 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)) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ public class FishingManager extends SkillManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EventUtils.simulateBlockBreak(block, player, false);
|
return EventUtils.simulateBlockBreak(block, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -688,7 +688,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
for (HylianTreasure treasure : treasures) {
|
for (HylianTreasure treasure : treasures) {
|
||||||
if (skillLevel >= treasure.getDropLevel()
|
if (skillLevel >= treasure.getDropLevel()
|
||||||
&& ProbabilityUtil.isStaticSkillRNGSuccessful(PrimarySkillType.HERBALISM, player, treasure.getDropChance())) {
|
&& ProbabilityUtil.isStaticSkillRNGSuccessful(PrimarySkillType.HERBALISM, player, treasure.getDropChance())) {
|
||||||
if (!EventUtils.simulateBlockBreak(blockState.getBlock(), player, false)) {
|
if (!EventUtils.simulateBlockBreak(blockState.getBlock(), player)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
blockState.setType(Material.AIR);
|
blockState.setType(Material.AIR);
|
||||||
|
@ -139,7 +139,7 @@ public class MiningManager extends SkillManager {
|
|||||||
Block targetBlock = player.getTargetBlock(BlockUtils.getTransparentBlocks(), BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE);
|
Block targetBlock = player.getTargetBlock(BlockUtils.getTransparentBlocks(), BlastMining.MAXIMUM_REMOTE_DETONATION_DISTANCE);
|
||||||
|
|
||||||
//Blast mining cooldown check needs to be first so the player can be messaged
|
//Blast mining cooldown check needs to be first so the player can be messaged
|
||||||
if (!blastMiningCooldownOver() || targetBlock.getType() != Material.TNT || !EventUtils.simulateBlockBreak(targetBlock, player, true)) {
|
if (!blastMiningCooldownOver() || targetBlock.getType() != Material.TNT || !EventUtils.simulateBlockBreak(targetBlock, player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.gmail.nossr50.skills.woodcutting;
|
package com.gmail.nossr50.skills.woodcutting;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.api.FakeBlockBreakEventType;
|
||||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
|
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
@ -302,7 +304,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
int beforeXP = xp;
|
int beforeXP = xp;
|
||||||
Block block = blockState.getBlock();
|
Block block = blockState.getBlock();
|
||||||
|
|
||||||
if (!EventUtils.simulateBlockBreak(block, player, true)) {
|
if (!EventUtils.simulateBlockBreak(block, player, FakeBlockBreakEventType.TREE_FELLER)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +349,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
processedLogCount = updateProcessedLogCount(xp, processedLogCount, beforeXP);
|
processedLogCount = updateProcessedLogCount(xp, processedLogCount, beforeXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyXpGain(xp, XPGainReason.PVE);
|
applyXpGain(xp, XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int updateProcessedLogCount(int xp, int processedLogCount, int beforeXP) {
|
private int updateProcessedLogCount(int xp, int processedLogCount, int beforeXP) {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.api.FakeBlockBreakEventType;
|
||||||
|
import com.gmail.nossr50.api.TreeFellerBlockBreakEvent;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
@ -43,6 +45,7 @@ import org.bukkit.entity.FishHook;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
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.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -306,24 +309,48 @@ public final class EventUtils {
|
|||||||
*
|
*
|
||||||
* @param block The block to break
|
* @param block The block to break
|
||||||
* @param player The player breaking the block
|
* @param player The player breaking the block
|
||||||
* @param shouldArmSwing true if an armswing event should be fired, false otherwise
|
* @param shouldArmSwing ignored (here for API compatibility)
|
||||||
* @return true if the event wasn't cancelled, false otherwise
|
* @return true if the event wasn't cancelled, false otherwise
|
||||||
|
* {@code @Deprecated} use {@link #simulateBlockBreak(Block, Player, FakeBlockBreakEventType)} instead
|
||||||
*/
|
*/
|
||||||
public static boolean simulateBlockBreak(Block block, Player player, boolean shouldArmSwing) {
|
public static boolean simulateBlockBreak(Block block, Player player, boolean shouldArmSwing) {
|
||||||
PluginManager pluginManager = mcMMO.p.getServer().getPluginManager();
|
return simulateBlockBreak(block, player);
|
||||||
|
}
|
||||||
|
|
||||||
// Support for NoCheat
|
/**
|
||||||
//if (shouldArmSwing) {
|
* Simulate a block break event.
|
||||||
// callFakeArmSwingEvent(player);
|
*
|
||||||
//}
|
* @param block The block to break
|
||||||
|
* @param player The player breaking the block
|
||||||
|
* @return true if the event wasn't cancelled, false otherwise
|
||||||
|
* {@code @Deprecated} use {@link #simulateBlockBreak(Block, Player, FakeBlockBreakEventType)} instead
|
||||||
|
*/
|
||||||
|
public static boolean simulateBlockBreak(Block block, Player player) {
|
||||||
|
return simulateBlockBreak(block, player, FakeBlockBreakEventType.FAKE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simulate a block break event.
|
||||||
|
*
|
||||||
|
* @param block The block to break
|
||||||
|
* @param player The player breaking the block
|
||||||
|
* @param eventType The type of event to signal to other plugins
|
||||||
|
* @return true if the event wasn't cancelled, false otherwise
|
||||||
|
*/
|
||||||
|
public static boolean simulateBlockBreak(Block block, Player player, FakeBlockBreakEventType eventType) {
|
||||||
|
PluginManager pluginManager = mcMMO.p.getServer().getPluginManager();
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
FakeBlockBreakEvent breakEvent = new FakeBlockBreakEvent(block, player);
|
BlockBreakEvent fakeBlockBreakEvent = null;
|
||||||
pluginManager.callEvent(breakEvent);
|
|
||||||
|
|
||||||
return !damageEvent.isCancelled() && !breakEvent.isCancelled();
|
switch (eventType) {
|
||||||
|
case FAKE -> fakeBlockBreakEvent = new FakeBlockBreakEvent(block, player);
|
||||||
|
case TREE_FELLER -> fakeBlockBreakEvent = new TreeFellerBlockBreakEvent(block, player);
|
||||||
|
}
|
||||||
|
pluginManager.callEvent(fakeBlockBreakEvent);
|
||||||
|
return !damageEvent.isCancelled() && !fakeBlockBreakEvent.isCancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) {
|
public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user