geforkt von Mirrors/Paper
Add Fish (Hook) entity to PlayerFishEvent. Adds BUKKIT-1025
Dieser Commit ist enthalten in:
Ursprung
ddec7117ee
Commit
83e0e0770a
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Fish;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -309,7 +310,7 @@ public class EntityFishingHook extends Entity {
|
|||||||
|
|
||||||
if (this.hooked != null) {
|
if (this.hooked != null) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), this.hooked.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
|
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), this.hooked.getBukkitEntity(), (Fish) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
|
||||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||||
|
|
||||||
if (playerFishEvent.isCancelled()) {
|
if (playerFishEvent.isCancelled()) {
|
||||||
@ -332,7 +333,7 @@ public class EntityFishingHook extends Entity {
|
|||||||
} else if (this.au > 0) {
|
} else if (this.au > 0) {
|
||||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
|
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
|
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), (Fish) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
|
||||||
playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
|
playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
|
||||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||||
|
|
||||||
@ -361,7 +362,7 @@ public class EntityFishingHook extends Entity {
|
|||||||
|
|
||||||
if (this.h) {
|
if (this.h) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.IN_GROUND);
|
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND);
|
||||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||||
|
|
||||||
if (playerFishEvent.isCancelled()) {
|
if (playerFishEvent.isCancelled()) {
|
||||||
@ -376,7 +377,7 @@ public class EntityFishingHook extends Entity {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (b0 == 0) {
|
if (b0 == 0) {
|
||||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.FAILED_ATTEMPT);
|
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT);
|
||||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
import org.bukkit.event.player.PlayerFishEvent; // CraftBukkit
|
// CraftBukkit start
|
||||||
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
|
import org.bukkit.entity.Fish;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
public class ItemFishingRod extends Item {
|
public class ItemFishingRod extends Item {
|
||||||
|
|
||||||
@ -19,7 +22,8 @@ public class ItemFishingRod extends Item {
|
|||||||
entityhuman.bK();
|
entityhuman.bK();
|
||||||
} else {
|
} else {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, PlayerFishEvent.State.FISHING);
|
EntityFishingHook hook = new EntityFishingHook(world, entityhuman);
|
||||||
|
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (Fish) hook.getBukkitEntity(), PlayerFishEvent.State.FISHING);
|
||||||
world.getServer().getPluginManager().callEvent(playerFishEvent);
|
world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||||
|
|
||||||
if (playerFishEvent.isCancelled()) {
|
if (playerFishEvent.isCancelled()) {
|
||||||
@ -29,7 +33,7 @@ public class ItemFishingRod extends Item {
|
|||||||
|
|
||||||
world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (e.nextFloat() * 0.4F + 0.8F));
|
world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (e.nextFloat() * 0.4F + 0.8F));
|
||||||
if (!world.isStatic) {
|
if (!world.isStatic) {
|
||||||
world.addEntity(new EntityFishingHook(world, entityhuman));
|
world.addEntity(hook); // CraftBukkit - moved creation up
|
||||||
}
|
}
|
||||||
|
|
||||||
entityhuman.bK();
|
entityhuman.bK();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren