mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Add some exploit prevention to fishing
This commit is contained in:
parent
d19cf1e260
commit
27854720f0
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.212</version>
|
<version>2.1.213-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>
|
||||||
|
@ -428,7 +428,9 @@ public class PlayerListener implements Listener {
|
|||||||
ItemStack inHand = player.getInventory().getItemInMainHand();
|
ItemStack inHand = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
//Grab lure level
|
//Grab lure level
|
||||||
if(inHand != null && inHand.getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) {
|
if(inHand != null
|
||||||
|
&& inHand.getItemMeta() != null
|
||||||
|
&& inHand.getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) {
|
||||||
if(inHand.getItemMeta().hasEnchants()) {
|
if(inHand.getItemMeta().hasEnchants()) {
|
||||||
for(Enchantment enchantment : inHand.getItemMeta().getEnchants().keySet()) {
|
for(Enchantment enchantment : inHand.getItemMeta().getEnchants().keySet()) {
|
||||||
if(enchantment.toString().toLowerCase().contains("lure")) {
|
if(enchantment.toString().toLowerCase().contains("lure")) {
|
||||||
@ -436,11 +438,15 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Prevent any potential odd behavior by only processing if no offhand fishing rod is present
|
||||||
|
if(!player.getInventory().getItemInOffHand().getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) {
|
||||||
|
// In case of offhand fishing rod, don't process anything
|
||||||
fishingManager.masterAngler(event.getHook(), lureLevel);
|
fishingManager.masterAngler(event.getHook(), lureLevel);
|
||||||
fishingManager.setFishingTarget();
|
fishingManager.setFishingTarget();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case CAUGHT_FISH:
|
case CAUGHT_FISH:
|
||||||
if(caught instanceof Item) {
|
if(caught instanceof Item) {
|
||||||
|
Loading…
Reference in New Issue
Block a user