Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
Fire events for fireball item usage. Fixes BUKKIT-1566
Dieser Commit ist enthalten in:
Ursprung
bbc3d31be7
Commit
ef7e14f9ef
@ -1,5 +1,10 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
public class ItemFireball extends Item {
|
public class ItemFireball extends Item {
|
||||||
|
|
||||||
public ItemFireball(int i) {
|
public ItemFireball(int i) {
|
||||||
@ -40,6 +45,21 @@ public class ItemFireball extends Item {
|
|||||||
int i1 = world.getTypeId(i, j, k);
|
int i1 = world.getTypeId(i, j, k);
|
||||||
|
|
||||||
if (i1 == 0) {
|
if (i1 == 0) {
|
||||||
|
// CraftBukkit start
|
||||||
|
org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k);
|
||||||
|
Player thePlayer = (Player) entityhuman.getBukkitEntity();
|
||||||
|
|
||||||
|
BlockIgniteEvent eventIgnite = new BlockIgniteEvent(blockClicked, BlockIgniteEvent.IgniteCause.FIREBALL, thePlayer);
|
||||||
|
world.getServer().getPluginManager().callEvent(eventIgnite);
|
||||||
|
|
||||||
|
if (eventIgnite.isCancelled()) {
|
||||||
|
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||||
|
--itemstack.count;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, c.nextFloat() * 0.4F + 0.8F);
|
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, c.nextFloat() * 0.4F + 0.8F);
|
||||||
world.setTypeId(i, j, k, Block.FIRE.id);
|
world.setTypeId(i, j, k, Block.FIRE.id);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren