mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
2.1.220
This commit is contained in:
parent
133a60c4bf
commit
db01b61371
@ -1,7 +1,12 @@
|
||||
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
|
||||
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
|
||||
Fixed Fishing exploit protection being triggered inappropriately by other plugins (Thanks smudgge)
|
||||
Fixed wiki url being incorrect in commands
|
||||
|
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.1.220-SNAPSHOT</version>
|
||||
<version>2.1.220</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<scm>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -558,7 +558,7 @@ public class BlockListener implements Listener {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
|
||||
|
||||
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);
|
||||
|
||||
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())) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
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);
|
||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||
}
|
||||
|
@ -866,7 +866,7 @@ public class PlayerListener implements Listener {
|
||||
// Bukkit.getPluginManager().callEvent(fakeSwing);
|
||||
player.getInventory().getItemInMainHand().setAmount(heldItem.getAmount() - 1);
|
||||
player.updateInventory();
|
||||
if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
||||
if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player)) {
|
||||
blockState.update(true);
|
||||
}
|
||||
}
|
||||
@ -877,7 +877,7 @@ public class PlayerListener implements Listener {
|
||||
// Bukkit.getPluginManager().callEvent(fakeSwing);
|
||||
event.setCancelled(true);
|
||||
if (herbalismManager.processShroomThumb(blockState)
|
||||
&& EventUtils.simulateBlockBreak(block, player, false)) {
|
||||
&& EventUtils.simulateBlockBreak(block, player)) {
|
||||
blockState.update(true);
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ public class FishingManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
return EventUtils.simulateBlockBreak(block, player, false);
|
||||
return EventUtils.simulateBlockBreak(block, player);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -690,7 +690,7 @@ public class HerbalismManager extends SkillManager {
|
||||
for (HylianTreasure treasure : treasures) {
|
||||
if (skillLevel >= treasure.getDropLevel()
|
||||
&& RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(treasure.getDropChance(), getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK))) {
|
||||
if (!EventUtils.simulateBlockBreak(blockState.getBlock(), player, false)) {
|
||||
if (!EventUtils.simulateBlockBreak(blockState.getBlock(), player)) {
|
||||
return false;
|
||||
}
|
||||
blockState.setType(Material.AIR);
|
||||
|
@ -111,7 +111,7 @@ public class MiningManager extends SkillManager {
|
||||
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
|
||||
if (!blastMiningCooldownOver() || targetBlock.getType() != Material.TNT || !EventUtils.simulateBlockBreak(targetBlock, player, true)) {
|
||||
if (!blastMiningCooldownOver() || targetBlock.getType() != Material.TNT || !EventUtils.simulateBlockBreak(targetBlock, player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.gmail.nossr50.skills.woodcutting;
|
||||
|
||||
import com.gmail.nossr50.api.FakeBlockBreakEventType;
|
||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
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.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
@ -277,7 +279,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
int beforeXP = xp;
|
||||
Block block = blockState.getBlock();
|
||||
|
||||
if (!EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
if (!EventUtils.simulateBlockBreak(block, player, FakeBlockBreakEventType.TREE_FELLER)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -321,7 +323,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
processedLogCount = updateProcessedLogCount(xp, processedLogCount, beforeXP);
|
||||
}
|
||||
|
||||
applyXpGain(xp, XPGainReason.PVE);
|
||||
applyXpGain(xp, XPGainReason.PVE, XPGainSource.SELF);
|
||||
}
|
||||
|
||||
private int updateProcessedLogCount(int xp, int processedLogCount, int beforeXP) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
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.XPGainSource;
|
||||
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.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -305,26 +308,50 @@ public final class EventUtils {
|
||||
/**
|
||||
* Simulate a block break event.
|
||||
*
|
||||
* @param block The block to break
|
||||
* @param player The player breaking the block
|
||||
* @param shouldArmSwing true if an armswing event should be fired, false otherwise
|
||||
* @param block The block to break
|
||||
* @param player The player breaking the block
|
||||
* @param shouldArmSwing ignored (here for API compatibility)
|
||||
* @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) {
|
||||
PluginManager pluginManager = mcMMO.p.getServer().getPluginManager();
|
||||
return simulateBlockBreak(block, player);
|
||||
}
|
||||
|
||||
// Support for NoCheat
|
||||
//if (shouldArmSwing) {
|
||||
// callFakeArmSwingEvent(player);
|
||||
//}
|
||||
/**
|
||||
* Simulate a block break event.
|
||||
*
|
||||
* @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);
|
||||
pluginManager.callEvent(damageEvent);
|
||||
|
||||
FakeBlockBreakEvent breakEvent = new FakeBlockBreakEvent(block, player);
|
||||
pluginManager.callEvent(breakEvent);
|
||||
BlockBreakEvent fakeBlockBreakEvent = null;
|
||||
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user