Filled FishingTrap

Discussion in 'Plugin Requests' started by adi0115, Jul 11, 2019.

  1. Offline

    adi0115

    Plugin category: Mechanics

    Minecraft version: 1.8

    Suggested name: FishingTrap

    What I want: I'm looking for a plugin where players can place trapped chest with a specific name near water and the chest will catch fish into the chest. The trap needs bait inside to catch fish, everytime a fish is caught, one bait is removed. Here's some requirements:

    - The fishing trap chest needs a specific name to be a "fishing trap" which can be set inside of config with color codes support. If the trapped chest doesn't match the name, it will act just like any other trapped chest

    - In the config you can add which fish you want to be 'caught', you can set the name and the lore of the fish as well.

    - Every x amount of minutes, a fish will be randomly picked from the list and added to the chest. The time can be set inside of the config

    - If the chest matches the name in the config, it has to be placed withing 1 block of water, if someone is trying to place the trap and it's not withing 1 block of water, the trap will not be placed and instead, the player will recieve a message about the trap not being close enough to water.

    - Fishing traps need bait to catch fish, the bait item list are in the config, for every fish caught, one bait item will be removed. If there's no bait inside of the fishing trap that matches the bait in the config, no fish will be caught until the correct bait is added.

    - The GUI for the fish trap should be just 9 slots inventory with all slots blocked off by black stained glass except the middle 3 slot where fish get caught and where bait can be added.

    Example of config (please don't actually use this config, this is just an example of the config to show what I would like to be in it)
    Code:
    chest name: '&cFishing Trap'
    fishing cooldown: 5 # the amount of time between fish getting caught in minutes
    placed not near water:'&cThe trap is not close enough to water!'
    fish list:
        - 'RAW_FISH:name:'&bRaw Fish'lore:'&fRaw Fish Caught by a fishing trap'
        - 'PUFFERFISH:name:'&bRaw PufferFish'lore:'&fRaw PufferFish Caught by a fishing trap'
    bait:
        - 'APPLE'
        - 'PUMPKIN__SEED'
        - 'SUGARCANE'

    Ideas for commands: /ft reload - reloads config

    Ideas for permissions: No permissions, only OPs can use the reload command.

    When I'd like it by: This week
     
  2. Offline

    adi0115

  3. Offline

    KarimAKL

    @adi0115 I really like the idea. :)
    I slowly began trying to create it yesterday evening/night and today, but unfortunately i couldn't get it done before my vacation. If someone else hasn't done it before i'm back home, i'll try working on it again.
     
  4. Offline

    adi0115

    @KarimAKL No problem, thanks for attempting it :)
     
    KarimAKL likes this.
  5. Offline

    wand555

    Hey
    I started creating this today out of fun.
    The way it is set up now, you have to write the exact Material names of the items you want as bait and as reward. Also you might see "Allow Wrong Item" in the config, which, if set to false, doesn't allow any other items besides the set items in the config, to be placed in the FishingTrap.
    Though the plugin still has some bugs in its entirity:
    • Cooldown cannot have decimals after the dot (e.g. 3.5)
    • ft reload doesn't affect the cooldown, because I use runnables to schedule the cooldown, so either there will be multiple cooldowns or the cooldown starts fresh (which happens during a normal reload anyway)
    • Once in the GUI, you cannot use shift click or numberkey click
    • Upon destroying, after making a double chest out of a FishingTrap (Trapped Chest) and a regular (non FishingTrap) Trapped Chest, the content is lost
    Besides that, I implemented some other, rather unnoticable features:
    • When two FishingTraps are placed next to each other, they form a double chest, but behave like two individual FishingTraps
    • When breaking a FishingTrap, the content is dropped at its location
    • When the FishingTrap is full and you catch an item, the item will be dropped at the FishingTrap's location

    For the colour support you can either use the old code or the Bukkit ChatColor
    Example:
    "Chest Name: §cFishingTrap" is the same as "Chest Name: ChatColor.RED + "FishingTrap" "
    Download
     
  6. Offline

    adi0115

    @wand555 Thank you :), I will test it out as soon as I can
     
  7. Offline

    adi0115

    @wand555 For some reason I can't place it, it always says I'm not close enough when placed directly next to water. Maybe changing the distance from 1 block near water to 2 blocks would make it more player-friendly since then it can be placed in more places?
     
  8. Offline

    wand555

    It's definitely not the range that's causing the problem. Try changing the name of the chest to something without colour. If the renaming through colour codes doesn't work, I could make a command where, when holding a trapped chest in the main hand, the player gets the preferred colour chest (/fishingtrap green). Also I'm on vacation for the next 16 days so I cannot work on it.
     
  9. Offline

    KarimAKL

    It seems both of the people working on this are on vacation now, huh? :p Have a good vacation. :)
     
  10. Offline

    adi0115

    @wand555 Re-naming the chest to non-color name gave me the same issue. Hopefully you can work on it when you're back.
     
  11. Offline

    KarimAKL

    @adi0115 I've just come back from vacation. Does this work?
     
  12. Offline

    adi0115

    @KarimAKL I will test it asap

    EDIT: @KarimAKL I tried it out but for some reason it acts a normal trapped chest, I kept everything default and used the default name from the config and nothing happens even if I place it away from water to see if I get the error message, my chest
     
    Last edited: Jul 29, 2019
  13. Offline

    adi0115

    @KarimAKL I also tried it with a regular chest just incase it was a regular chest instead and still nothing.
     
  14. Offline

    KarimAKL

    @adi0115 I didn't see your edit, i'll look into it tomorrow, i'm kinda tired right now.
     
  15. Offline

    adi0115

  16. Offline

    KarimAKL

    @adi0115 I think i've come across the problem, it seems like it didn't occur to me when i was making it. :p
    The problem (what i think is the problem) is that the item has a special NBT tag, meaning the name of the item doesn't matter, it's just in the trap.yml file because you can then customize the item.
    I'll have to add a command that can give you the item, what do you want the command (and permission) to be? Maybe '/ft give [player]' will do, or maybe you only want OPs to be able to use the command?
    I've just noticed that i forgot to check if the player is OP before allowing them to use the reload command, i'll add that as well.
    Note: Because i'm using NBT tags, i have to use NMS, and because i'm using NMS, you shouldn't expect this plugin to work on other versions, just let me know if you want to change version at some point.
     
  17. Offline

    adi0115

    @KarimAKL Yeah, /ft give [player] should work fine, maybe only OPs and console can execute that command? Thanks
     
  18. Offline

    KarimAKL

    @adi0115 I think that should do it, let me know how it goes. You can download it here.
    Commands:
    Code:
    /fishingtrap - Alias: /ft
    /ft help [page]
    /ft reload
    /ft give trap [amount] [player]
    /ft give bait <name> [amount] [player]
    /ft give fish <name> [amount] [player]
    All commands require the player to be opped. (The console counts as opped as well)
    The bait and fish 'name' is not the item name; it's the key name in the configuration.
     
  19. Offline

    wand555

    Hey @adi0115 , looks like I didn't pay attention to your version details. I believe its not working because I'm working with containers, which are not a thing in 1.8. Also as Karim already provided you with a (probably superb) plugin, I'm not going to work on this any further.
     
  20. Offline

    adi0115

    @wand555 Np, thanks for attempting it tho.


    @KarimAKL Sorry for late response, I way away for few days and just got back. I tried out the new version and now I can place it but for some reason I can't put bait inside that is in the bait yml file? I'm not sure if I'm doing something wrong or not.
     
  21. Offline

    KarimAKL

    @adi0115 You can only place valid bait inside the trap, did you get the bait by using the '/ft give bait <bait_name> [amount] [player]' command?
     
  22. Offline

    adi0115

    @KarimAKL Oh, I didn't know they used NBT tags aswell. It works now, thanks for filling this request out, plugins works just the way I wanted, no bugs so far ;)
     
    KarimAKL likes this.

Share This Page