mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Move break event to the initial check.
This commit is contained in:
parent
f5c58f3679
commit
09e77c8c94
@ -222,13 +222,6 @@ public class PlayerListener implements Listener {
|
|||||||
Block block = player.getTargetBlock(null, 100);
|
Block block = player.getTargetBlock(null, 100);
|
||||||
|
|
||||||
if (fishingManager.canIceFish(block)) {
|
if (fishingManager.canIceFish(block)) {
|
||||||
FakeBlockBreakEvent blockBreakEvent = new FakeBlockBreakEvent(block, player);
|
|
||||||
plugin.getServer().getPluginManager().callEvent(blockBreakEvent);
|
|
||||||
|
|
||||||
if (blockBreakEvent.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
fishingManager.iceFishing(event.getHook(), block);
|
fishingManager.iceFishing(event.getHook(), block);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||||
|
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakePlayerFishEvent;
|
import com.gmail.nossr50.events.fake.FakePlayerFishEvent;
|
||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerMagicHunterEvent;
|
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerMagicHunterEvent;
|
||||||
@ -188,7 +189,16 @@ public class FishingManager extends SkillManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Permissions.iceFishing(getPlayer());
|
Player player = getPlayer();
|
||||||
|
|
||||||
|
if (!Permissions.iceFishing(player)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
FakeBlockBreakEvent blockBreakEvent = new FakeBlockBreakEvent(block, player);
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(blockBreakEvent);
|
||||||
|
|
||||||
|
return !blockBreakEvent.isCancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user