Plugin Help How to make an NPC soup refill station?

Discussion in 'Plugin Help/Development/Requests' started by PineappleJuice, Oct 15, 2016.

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

    PineappleJuice

    So I currently have a soup server, that I am working on, and was wondering if it is possible to have an NPC do the same as a normal essentials sign that refills your inventory with soup.

    Note that when I am talking about an NPC I don't mean a villager, it can be any type of mob in minecraft.

    This plugin/(s) should be able to make an NPC have the same ability as an essential sign that when you click it, shows an inventory full of soups which you can take...

    Any help would be appreciated!
     
  2. Offline

    oceantheskatr

    Would it be fine if the mob must have a certain name? I could make a plugin where if the mob has a certain name and you right click it, it will open an inventory with soups. What kind of soup? Request for how you want the name/lore to look? Inventory name/style? What game version?

    If you want me to make this, I can have it done by tomorrow. If you reply soon, I can probably have it done tonight :)
     
  3. Offline

    PineappleJuice

    I don't care if the mob had to have a certain name to be used, the soups can be regular soups, doesnt need a lore or fancy name, all the mob needs to do is make an inventory full of soups for players to take out, and it must never go empty

    If you can make such a plugin for me, I would appreciate that a lot, thanks in advance!

    EDIT: it must be 1.7-1.8 please
     
  4. Offline

    oceantheskatr

    Yes of course! I'll get on it very soon. It shouldn't take long. Check back here in a few hours. I'll update my post with more info as I do it. Since the plugin is so simple it should work on 1.7-1.11. I would like to name the inventory that opens, any ideas? It can stay empty if you'd like, of course.

    EDIT: Oh yeah also, the name of the soup mob would be something like "Soup Refill" so if you don't like that let me know.
     
  5. Offline

    PineappleJuice

    Maybe make the mobs name in colors? I'm not sure if you can do that, anyways, if you want, you can rename the soups to idk, CrackedMC (<-- thats my server) or idk, whatever you think is best
     
  6. Offline

    oceantheskatr

    I'll make the plugin and you can let me know if there's anything you want changed :)

    @PineappleJuice

    EDIT: Done! Any mob with the name "Soup Refill" will open the inventory if the player has the permission souprefill.use. The name can even look like "sOuP REfiLl" with colour and formatting, as long as it says "soup refill" with a space between the words. If you need anything at all changed let me know. I'm busy the rest of the night but I will of course change it tomorrow morning! :)

    I am a trusted contributor on this forum with nearly 3,000 posts, however if you require the source code before trying the plugin for yourself then just let me know.

    Finished plugin: https://www.dropbox.com/s/pytntwaq5lce0wf/SoupRefill-v1.0.0.jar?dl=1

    Screenshots:
    ss+(2016-10-15+at+07.41.22).jpg
    ss+(2016-10-15+at+07.45.15).jpg
     
    Last edited: Oct 15, 2016
  7. Offline

    PineappleJuice

  8. Offline

    oceantheskatr

    Let me know when you've tested it out and if everything worked okay. Also, if there's anything at all that you need changed then I'll try my best to do so.
     
  9. Offline

    I Al Istannen

    @oceantheskatr
    "if (!p.hasPermission("souprefill.use")) {"
    You can use your field, as you have already created it. Makes changing easier.

    Code:
    itemMeta.setDisplayName(new StringBuilder().append(ChatColor.GOLD).append(ChatColor.BOLD).append("CrackedMC").append(ChatColor.LIGHT_PURPLE).append(ChatColor.BOLD).append(" Soup").toString());
    
    You probably don't have the StringBuilder there, that is an optimization done at compile time.
    Maybe make that configurable? I don't really like hard coded strings, as you probably want to change them at some point. And one line to get it from the config could be nice ;)
     
  10. Offline

    PineappleJuice

    @oceantheskatr I have been using this plugin in my server and haven't had any problems with it so far, only problem might be what pops up in console... But I am not too concerned about that because it isn't interfering with the permissions or other plugins
     
  11. Offline

    oceantheskatr

    @PineappleJuice Glad you like it. I will make it more customizable today most likely. In the console if you're referring to the "SoupRefill created by Ocean" then that's something I put in all the plugins I release publicly. I make sure to only put it in the enable and disable of the plugin so that it only shows in the console.

    @I Al Istannen Right on, thanks for the contributions! I will change the permission check, and I will actually add a config for the strings so I will just use translateAlternateColorCodes :)

    EDIT: @PineappleJuice Here's the updated version that supports better customization: https://www.dropbox.com/s/00kpnf39eutwmes/SoupRefill-v1.0.1.jar?dl=1

    You can change the strings in the config. If you have any questions let me know.
     
    Last edited: Oct 16, 2016
    PineappleJuice and I Al Istannen like this.
  12. Offline

    PineappleJuice

  13. Offline

    oceantheskatr

    @PineappleJuice You are using Spigot 1.8.8? Can you do the following:

    Stop your server.
    Start your server.
    When it's fully started, stop it again.
    Go in to your server files.
    Go to the logs folder.
    Open the file called latest.log.
    Copy and paste the contents at http://pastebin.com/.
    Post it there and then link the URL here.

    Also, that is a problem that PerWorldPlugins seems to be causing for the plugin, I will try to find a way around it once I see your log :)

    I don't know a lot about PerWorldPlugins but try allowing my plugin to work in all worlds or something. That will be okay since only named mobs will use it.
     
    Last edited: Oct 16, 2016
  14. Offline

    PineappleJuice

  15. Online

    timtower Administrator Administrator Moderator

    Locked
    Offline mode is not supported by Bukkit
     
Thread Status:
Not open for further replies.

Share This Page