Solved How to change catch in fishing?

Discussion in 'Plugin Development' started by Quaro, Apr 14, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Quaro

    How to change catch in fishing?
     
  2. PlayerFishEvent ?
     
  3. Offline

    Quaro

    Yes but how to change the catch?
     
  4. If you mean the item you get, I'm not sure, this needs testing, which means printing values in console to be sure it triggers what you expect !

    First check if state is caught fish then get the caught entity and check if that's instanceof Item (the entity) and from then you can cast, but just see if you get till there.

    If that's not it then I don't think it's easily possible with the API... you could alternatively do a scheduled task and remove a fish from player's inventory (if he caught one in the first place) then add your whatever item.

    EDIT: Or yeah, duh', cancel the event when they catch something =)
     
  5. Offline

    Rocoty

    Since there is no method do change the catch, you could do a workaround:

    Cancel the event, give the player the item you want caught.
     
  6. Offline

    Quaro

    Im not so good in english, so i need examples please.

    So i have to do something like this?
    PlayerFishEvent:
    if(event.getCaught()!=null) {
    event.getCaught().remove();
    player.getInventory.addItem(...);
    }

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  7. Offline

    Rocoty

    If you will, yes.
     
  8. Offline

    stuntguy3000

    Well,

    MCMMO Changes what items are fished..
     
  9. Micius
    getEntity() can also be the entity you thrown the hook at... like an animal or a player... if you remove a player entity the game might go nuts, so try to follow what I told you.
     
  10. Offline

    Rocoty

    Or, instead of removing the entity, cancel the event.
     
Thread Status:
Not open for further replies.

Share This Page