Fixed bug which allowed players to bypass fishing's exploit prevention

Fixes #1319
This commit is contained in:
TfT_02 2013-08-17 10:11:46 +02:00
parent 36f1a2d78a
commit 560c3860b4
3 changed files with 15 additions and 1 deletions

View File

@ -14,6 +14,7 @@ Version 1.4.07-dev
+ Added a 5 second cooldown after teleporting before Acrobatics XP can be earned. + Config option to disable + Added a 5 second cooldown after teleporting before Acrobatics XP can be earned. + Config option to disable
+ Added new API methods to ExperienceAPI to get a players rank on the leaderboards + Added new API methods to ExperienceAPI to get a players rank on the leaderboards
+ Added new McMMOPlayerDeathPenaltyEvent, fired when a player dies and would lose levels + Added new McMMOPlayerDeathPenaltyEvent, fired when a player dies and would lose levels
= Fixed bug which allowed players to bypass fishing's exploit prevention
= Fixed bug with Skull Splitter not finding the locale string = Fixed bug with Skull Splitter not finding the locale string
= Fixed issue where locale strings could cause the scoreboard header to be longer than 16 characters. = Fixed issue where locale strings could cause the scoreboard header to be longer than 16 characters.
= Fixed a bug with Beast Lore when the entity had no owner but was tamed. = Fixed a bug with Beast Lore when the entity had no owner but was tamed.

View File

@ -47,6 +47,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.skills.KrakenAttackTask; import com.gmail.nossr50.runnables.skills.KrakenAttackTask;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.fishing.Fishing.Tier; import com.gmail.nossr50.skills.fishing.Fishing.Tier;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -151,7 +152,7 @@ public class FishingManager extends SkillManager {
return false; return false;
} }
Block targetBlock = getPlayer().getTargetBlock(null, 100); Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
if (!targetBlock.isLiquid()) { if (!targetBlock.isLiquid()) {
return false; return false;

View File

@ -1,5 +1,8 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import java.util.Arrays;
import java.util.HashSet;
import org.bukkit.CropState; import org.bukkit.CropState;
import org.bukkit.NetherWartsState; import org.bukkit.NetherWartsState;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@ -313,4 +316,13 @@ public final class BlockUtils {
return blockId == Repair.repairAnvilId || blockId == Repair.salvageAnvilId; return blockId == Repair.repairAnvilId || blockId == Repair.salvageAnvilId;
} }
/**
* Get a HashSet containing every transparent block
*
* @return HashSet with the IDs of every transparent block
*/
public static HashSet<Byte> getTransparentBlocks() {
return new HashSet<Byte>(Arrays.asList((byte) 0, (byte) 6, (byte) 18, (byte) 20, (byte) 27, (byte) 28, (byte) 31, (byte) 32, (byte) 32, (byte) 34, (byte) 37, (byte) 38, (byte) 39, (byte) 40, (byte) 50, (byte) 51, (byte) 52, (byte) 53, (byte) 55, (byte) 59, (byte) 63, (byte) 64, (byte) 65, (byte) 66, (byte) 67, (byte) 68, (byte) 69, (byte) 70, (byte) 71, (byte) 72, (byte) 75, (byte) 76, (byte) 77, (byte) 78, (byte) 79, (byte) 81, (byte) 83, (byte) 85, (byte) 92, (byte) 93, (byte) 94, (byte) 96, (byte) 101, (byte) 102, (byte) 104, (byte) 105, (byte) 106, (byte) 107, (byte) 108, (byte) 109, (byte) 111, (byte) 113, (byte) 114, (byte) 115, (byte) 119, (byte) 126, (byte) 128, (byte) 131, (byte) 132, (byte) 134, (byte) 135, (byte) 136, (byte) 139, (byte) 141, (byte) 142, (byte) 143, (byte) 145, (byte) 147, (byte) 148, (byte) 149, (byte) 150, (byte) 151, (byte) 156, (byte) 157, (byte) 171));
}
} }