mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-31 22:59:35 +01:00
Cleanup.
This commit is contained in:
parent
38d4d448a9
commit
8f8bfc62ca
@ -5,10 +5,12 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when mcMMO damages a block due to a special ability.
|
||||||
|
*/
|
||||||
public class FakeBlockDamageEvent extends BlockDamageEvent {
|
public class FakeBlockDamageEvent extends BlockDamageEvent {
|
||||||
|
|
||||||
public FakeBlockDamageEvent(Player player, Block block,
|
public FakeBlockDamageEvent(Player player, Block block, ItemStack itemInHand, boolean instaBreak) {
|
||||||
ItemStack itemInHand, boolean instaBreak) {
|
|
||||||
super(player, block, itemInHand, instaBreak);
|
super(player, block, itemInHand, instaBreak);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,6 +9,7 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
@ -111,15 +112,19 @@ public class Misc {
|
|||||||
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
|
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(armswing);
|
mcMMO.p.getServer().getPluginManager().callEvent(armswing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PluginManager pluginManger = mcMMO.p.getServer().getPluginManager();
|
||||||
|
|
||||||
FakeBlockDamageEvent damageEvent = new FakeBlockDamageEvent(player, block, player.getItemInHand(), true);
|
FakeBlockDamageEvent damageEvent = new FakeBlockDamageEvent(player, block, player.getItemInHand(), true);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
|
pluginManger.callEvent(damageEvent);
|
||||||
|
|
||||||
FakeBlockBreakEvent breakEvent = new FakeBlockBreakEvent(block, player);
|
FakeBlockBreakEvent breakEvent = new FakeBlockBreakEvent(block, player);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(breakEvent);
|
pluginManger.callEvent(breakEvent);
|
||||||
|
|
||||||
if (!damageEvent.isCancelled() || !breakEvent.isCancelled()) {
|
if (!damageEvent.isCancelled() || !breakEvent.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user