[MECH] Hungry v0.3.1 - Yet another hunger plugin [1060]

Discussion in 'Inactive/Unsupported Plugins' started by tr4656, Jun 14, 2011.

  1. Offline

    tr4656

    [​IMG]

    Hungry
    Authors: jonathanyc and tr4656
    Version: v0.3.1

    Hungry adds immersion to Minecraft! There is a reason to actually eat food in order to survive making it more realistic - so gather your food and actually eat so you won’t go hungry.

    Highlights:
    • There is actually a need to eat food (like real life)
    • Custom Language support
    Resources:
    Download Plugin
    Contribute at Bitbucket!
    Github Mirror

    Instructions, Permissions and FAQ:
    Our wiki is hosted at Bitbucket, and is available here.
    Quick Links
    To-do list and Known Bugs:
    See our Bitbucket issues page.

    Changelog:
    v0.3.1
    • Fixed eating events not registering when right-clicking on air.
    Credits:
    • Thanks to Fullwall, for his Gastronomic plugin (off which many parts of this plugin were based!)
    • Thanks to chernobyl360, for maintaining Gastronomic after Fullwall stopped (until he got hacked)
     
  2. Offline

    Monkey78

    It's been mentioned a few times, do people not read the thread before posting?

    Make sure you're looking at a block that's close to you (within touching distance) when eating the food. It's glitchy when you eat while looking at stuff that's far away.
    Best bet is to just look at the floor when eating something.
     
  3. Offline

    Filin

    After the transfer of source code:
    an internal error occurred while attempting to perform this command
    Help me please!
     
  4. Offline

    jonathanyc

    That error in itself is useless - there are an infinite number of problems that could have occurred to throw that error. We're going to need the logs to do anything helpful.

    OK, I've done some testing... and it appears that somehow every call to "event.isCancelled()" is somehow returning true. Could a Bukkit developer shed some light on this, as I was testing with absolutely no plugins other than Hungry?​

    OK. Just pushed version 0.3.1 (actually pushed a while ago, but I couldn't access Bukkit so the post was delayed until now).

    Version 0.3.1 should fix the bug with right-clicking on air. It's available at the same location.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 16, 2016
  5. Offline

    Joggal

    @jonathanyc
    i have problems with the config in the hungry file,
    when i make changes it won't save that.
    maybe you can help me?
     
  6. Offline

    Angelus1992

    @tr4656
    I've got to tell (I don't know if it's a bug or not, and I'm just saying) that when you right-click a cake, your hunger level goes down, but if your health is full, the cake doesn't dissapear or gets eaten, but the hunger level goes down (It was hard to tell you this because I'm not english and it was a little confusing).
    Besides that, it's an awesome plugin. Players love it :)
     
  7. Offline

    jonathanyc

    Oh, I think I know why that would be happening. I'll send in a fix - thanks! :)

    As has been stated before, after you edit the file, type /hungryreload instead of /reload to load the configuration.

    EDIT: @Angelus1992 Hungry should now be updated to have fixed that. Thanks for the tip!
     
  8. Offline

    ashtheking

    Could you make a thirst, aswell? It would be nice to have to drink both water and eat food. Like, you can rightclick a pool of water, and you start to drink, and it either removes or reduces the level of the water.
     
  9. Offline

    Tealk

    Hi, i have suggestion on how to make the appearence of the hunger better. It is strange to have hunger shown in percentage. It would be much nicer to have some kind of a Hungerbar.
    It could be done like this "|||||....."
    where one | represents 10% hunger an one . represents 10% you have left untill you get damage
     
  10. Offline

    Celtic Minstrel

    I'd rather that be shown with two different colours of |
     
  11. Offline

    jonathanyc

    @Tealk @Celtic Minstrel

    That's definitely possible, we'll look into it.

    That could probably be created as an Effect. It's one of the Bitbucket issues already, I think. :) Thanks!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 16, 2016
  12. Offline

    Kalexer

    I like this plugin, but everytime I adjust the config in the configuration file it resets to default on serverreload, what to do?
     
  13. Offline

    jonathanyc

    Please read a few posts up. :p (#294 is probably what you're looking for)
     
  14. Offline

    Ranzear

    /sethunger appears to be case-sensitive. Just a little glitch really.
     
  15. Offline

    F0RCE

  16. Offline

    jonathanyc

    Good catch. :) Will send in a fix. Thanks!
     
  17. Offline

    T4L_Goose

    I'm getting this when I shut my server down

    2011-08-15 16:31:52 [SEVERE] Error occurred while disabling Hungry v0.3.1 (Is it up to date?): tried to access class com.google.gson.JsonSerializationContextDefault from class com.google.gson.Gson
    java.lang.IllegalAccessError: tried to access class com.google.gson.JsonSerializationContextDefault from class com.google.gson.Gson
    at com.google.gson.Gson.toJsonTree(Gson.java:217)
    at com.google.gson.Gson.toJson(Gson.java:260)
    at com.google.gson.Gson.toJson(Gson.java:240)
    at us.icebrg.hungry.configuration.ConfigurationService.save(ConfigurationService.java:44)
    at us.icebrg.hungry.configuration.ConfigurationService.save(ConfigurationService.java:40)
    at us.icebrg.hungry.configuration.ConfigurationService.save(ConfigurationService.java:35)
    at us.icebrg.hungry.Hungry.saveConfiguration(Hungry.java:372)
    at us.icebrg.hungry.Hungry.onDisable(Hungry.java:186)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:128)
    at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:899)
    at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:288)
    at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:281)
    at org.bukkit.craftbukkit.CraftServer.disablePlugins(CraftServer.java:157)
    at net.minecraft.server.MinecraftServer.stop(MinecraftServer.java:312)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:391)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
     
  18. Offline

    Ranzear

    Seems a sloppy solution to this plugin defaulting its config every time I use the /reload command for other plugins and updates. I suppose I'll just read-only the config to solve the issue more precisely.
     
  19. Offline

    jonathanyc

    Wait, what? Unless I don't understand what you're saying, this solution is not sloppy at all. When you run the /reload command, Bukkit calls onDisable() first, and then onEnable(). When the server starts, Bukkit calls onEnable(). When the server shutdowns, Bukkit calls onDisable().

    To Hungry, /reload-ing the server is the same as shutting it down, and then starting it back up.

    So unless you don't believe player data and configuration should be saved when the server shuts down, the way Hungry works is completely logical - it saves your configuration and player data on onDisable(), i.e., on shutdown or on /reload.

    To allow you to add new configuration in-place, without restarting the server (and thus calling onEnable() without calling onDisable()), we kindly added the /hungryreload command, which might more aptly be called /hungryload as it loads the configuration and player data from the disk without saving it.

    Strange, I got this error too, once, on my server. I'm not sure why it's happening, but I'm looking into it. Thanks!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 16, 2016
  20. Offline

    kahlilnc

    Hm would this be compatible with heroes damage system?
     
  21. Offline

    Ranzear

    I was inferring the solution above to "My Hungry config is getting reset to defaults all the time" was "Don't use /reload all", which is exactly what reset my configuration but is a legitimate method if you make changes to more than one plugin at a time.

    I just don't follow how the config defaulting itself isn't a problem just because it doesn't do so if you never have to reload other plugins. Not a huge problem in the end (not the first plugin I've had to read-only the config of to fix this exact issue), just strangely overlooked.

    Isn't that the point of the config file? To save settings through shutdowns and restarts?
     
  22. Offline

    Monkey78

    Sorry, I have to agree with @Ranzear.

    As far as I'm aware, most people make changes to plugin settings by adding the changes to the configs, then /reload all plugins to implement the changes.
    Using the system of saving the current settings when a /reload is called for just overwrites all the changes made to the configs.
    Unless you've been doing a heavy amount of configuration via in-game commands (not likely with the only one currently being /hungrytoggle) then I don't see why you would want to save the configs since it was loaded last time?

    I admit that this is the only plugin I've used so far that seems to want to save it's settings every time the /reload is started, therefore overwriting the one you're trying to load. So it does feel quite counter-intuitive to how other plugins work.
     
  23. Offline

    Celtic Minstrel

    I'm sorry, but for this to work, Bukkit needs to allow the plugin to distinguish between actual shutdown and just a reload. Currently, it's not possible for the plugin to know whether the server is being shut down or just reloaded.

    I'll point out though that if it's not possible to change config options in-game, and you don't store additional non-config data in the config file as SimpleSignEdit does, there's not really much point in saving the config on shutdown.

    A compromise is possible, though. In General I added an auto-save option to the config as well as a command to save the config immediately; all options are mutable in-game, and it only saves on shutdown if auto-save is currently true.
     
  24. Offline

    Ranzear

    Why would or should a plugin ever revert to default settings, ever?
    It's not a matter of the plugin differentiating between a shutdown or a restart! It shouldn't be defaulting the settings or overwriting the config.yml ever, except when it can't find a config.yml and needs to generate one.

    I don't understand why your goal is to reset the settings of the plugin on shutdown but not on restart, even if you could differentiate between them.
     
  25. Offline

    Celtic Minstrel

    A shutdown and a restart are the same thing. Also, the plugin doesn't revert to default settings when you reload; it reverts to whatever settings it has stored in memory. If the settings in memory have changed, it's logical to assume that, when you shut down the server, you would want them to be saved. As far as the plugin knows, reloading the server is the same as restarting it; thus, they have chosen to make it save the settings. It may not be ideal, but there aren't many good solutions as the API currently is.
     
  26. Offline

    jonathanyc

    Celtic Minstrel is completely right - though I suppose that as the only command that edits configuration (as was stated previously) is /hungrytoggle, it wouldn't hurt that much to not save configuration. I suppose I'll make this a configuration option.

    I don't know what the Heroes damage system does, but this plugin basically damages through Player::setHealth and Player::damage. You can choose between them with a configuration option whose name escapes me at the moment. The difference between them is that the latter will "artificially" damage the player, skipping armor and the like, while the former will damage armor. As long as Heroes doesn't interfere with either, it should work - but the best way, as always, is to TIAS.
     
  27. Offline

    Schlumpf

    I got a question, @ my Server I have no Bugs all work now :)
    But for what is the effects folder?
     
  28. Offline

    Spycoclown

    the right question is? how can i change the effects?

    i have some extra food and i would like to insert them into the effects..
     
  29. Offline

    Ranzear

    Does starvation throw a damage type that HeroicDeath can intercept? Just keep getting 'unknown' deaths.
     
  30. Offline

    Celtic Minstrel

    I'd guess that if it fires a damage event it'll be DamageCause.CUSTOM.
     
  31. Offline

    dep2011

    multi world support? :D
     

Share This Page