mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Herbalism XP exploit fix
This commit is contained in:
parent
0ae83420e6
commit
72958bb0f3
@ -1,3 +1,6 @@
|
|||||||
|
Version 2.1.185
|
||||||
|
Fixed an exploit for Herbalism
|
||||||
|
|
||||||
Version 2.1.184
|
Version 2.1.184
|
||||||
Removed April Fools event
|
Removed April Fools event
|
||||||
Fixed a bug where the default treasures.yml file had incorrect keys (see notes)
|
Fixed a bug where the default treasures.yml file had incorrect keys (see notes)
|
||||||
|
2
pom.xml
2
pom.xml
@ -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.184</version>
|
<version>2.1.185-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>
|
||||||
|
@ -848,9 +848,11 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if(!event.getPlayer().isSneaking()) {
|
||||||
herbalismManager.processBerryBushHarvesting(blockState);
|
herbalismManager.processBerryBushHarvesting(blockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIGHT_CLICK_AIR:
|
case RIGHT_CLICK_AIR:
|
||||||
|
@ -29,6 +29,7 @@ import com.gmail.nossr50.util.skills.SkillUtils;
|
|||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
import com.gmail.nossr50.util.text.StringUtils;
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -40,6 +41,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -111,21 +113,40 @@ public class HerbalismManager extends SkillManager {
|
|||||||
mmoPlayer.getPlayer().sendMessage("Bush XP: " + xpReward);
|
mmoPlayer.getPlayer().sendMessage("Bush XP: " + xpReward);
|
||||||
}
|
}
|
||||||
|
|
||||||
// //Check for double drops
|
CheckBushAge checkBushAge = new CheckBushAge(blockState.getBlock(), mmoPlayer, xpReward);
|
||||||
// if(checkDoubleDrop(blockState)) {
|
checkBushAge.runTaskLater(mcMMO.p, 1);
|
||||||
//
|
}
|
||||||
// if(mmoPlayer.isDebugMode()) {
|
}
|
||||||
// mmoPlayer.getPlayer().sendMessage("Double Drops succeeded for Berry Bush");
|
}
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //Add metadata to mark this block for double or triple drops
|
|
||||||
// markForBonusDrops(blockState);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
private class CheckBushAge extends BukkitRunnable {
|
||||||
|
|
||||||
|
@NotNull Block block;
|
||||||
|
@NotNull McMMOPlayer mmoPlayer;
|
||||||
|
int xpReward;
|
||||||
|
|
||||||
|
public CheckBushAge(@NotNull Block block, @NotNull McMMOPlayer mmoPlayer, int xpReward) {
|
||||||
|
this.block = block;
|
||||||
|
this.mmoPlayer = mmoPlayer;
|
||||||
|
this.xpReward = xpReward;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
BlockState blockState = block.getState();
|
||||||
|
|
||||||
|
if(blockState.getType().toString().equalsIgnoreCase("sweet_berry_bush")) {
|
||||||
|
if(blockState.getBlockData() instanceof Ageable) {
|
||||||
|
Ageable ageable = (Ageable) blockState.getBlockData();
|
||||||
|
|
||||||
|
if(ageable.getAge() <= 1) {
|
||||||
applyXpGain(xpReward, XPGainReason.PVE, XPGainSource.SELF);
|
applyXpGain(xpReward, XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean canUseHylianLuck() {
|
public boolean canUseHylianLuck() {
|
||||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK))
|
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_HYLIAN_LUCK))
|
||||||
|
Loading…
Reference in New Issue
Block a user