Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 13:00:06 +01:00
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
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -309,7 +310,7 @@ public class EntityFishingHook extends Entity {
|
||||
|
||||
if (this.hooked != null) {
|
||||
// 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);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
@ -332,7 +333,7 @@ public class EntityFishingHook extends Entity {
|
||||
} else if (this.au > 0) {
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
|
||||
// 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);
|
||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
@ -361,7 +362,7 @@ public class EntityFishingHook extends Entity {
|
||||
|
||||
if (this.h) {
|
||||
// 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);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
@ -376,7 +377,7 @@ public class EntityFishingHook extends Entity {
|
||||
|
||||
// CraftBukkit start
|
||||
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);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -1,6 +1,9 @@
|
||||
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 {
|
||||
|
||||
@ -19,7 +22,8 @@ public class ItemFishingRod extends Item {
|
||||
entityhuman.bK();
|
||||
} else {
|
||||
// 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);
|
||||
|
||||
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));
|
||||
if (!world.isStatic) {
|
||||
world.addEntity(new EntityFishingHook(world, entityhuman));
|
||||
world.addEntity(hook); // CraftBukkit - moved creation up
|
||||
}
|
||||
|
||||
entityhuman.bK();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren