A "Sell when full" chest plugin

Discussion in 'Plugin Requests' started by Lily_K97, May 13, 2024.

  1. Offline

    Lily_K97

    Hiya! I'm looking for a 1.20.4 plugin (or a way around making it possible) that can check when placed chests that contain a specific item (like a sell shard or some kinda unique item) are full.

    When full, it automatically sells all the contents of the chest except the unique item, via Essentials' Worth.yml, and reduces some kinda "usage" count by 1 on the unique item.

    I'm incredibly new to plugins but I think this kind of selling mechanic would help a lot of idle-style servers? It would let players work on other things while the unique item sells "full chests" whenever the last slot is taken up. Any help would be incredible!

    I read a few similar posts regarding sell-chests and that it would be best to store player-placed chests and run checks on only those chests that happen to also be in loaded chunks for the sake of efficiency?
     
  2. Offline

    raffel080108

    Your wording confuses me a bit... are you asking for someone to make this for you or are you asking for help with developing this yourself?
    If it's the former I can look into making this for you, if it's the later then a starting point is to learn basic java and then you can look around for YouTube guides or online documentations, forum posts etc. to help with learning how to do certain things. If you want to post about asking with help related to specific things in developement then this is the wrong forum for that. Not sure what the Bukkit forum for that is but when I need help with specific development questions that I can't find any information on anywhere online, I always go to the Spigot Plugin Dev Forum
     
  3. Offline

    timtower Administrator Administrator Moderator

    Section for development is "plugin development"
     
  4. Offline

    Lily_K97

    It's a request to make the plugin if possible. I was just suggesting that if it isn't possible or too difficult of a task then I will go ahead and try it myself, albeit poorly. One of the requirements for posting on this forum is not to request something difficult to make. I don't personally know how difficult it is.

    TL;DR: Yes it is a request for someone to make it for me, my apologies for the confusing wording :)
     
  5. Offline

    CraftCreeper6

    @Lily_K97
    Try this. It's been quite a long time since I made a plugin, might be a few bugs- let me know if you run into any.

    Usage:
    /scgive [player name] [item uses]
    Permission: sellchests.give

    Set item uses to -1 for unlimited uses.

    Place the item into any chest, once full, it'll sell all of the eligible items.

    Depends on Essentials for worth.yml and Vault for economy.
     
    Last edited: May 15, 2024
  6. Offline

    Lily_K97

    This works flawlessly!

    Is there possibly a way to change the item (like the name, item type etc) and also if not too greedy to ask, a way to multiplier versions? Like a 2x and 4x version? Either way this is exactly what I was looking for :D
     
  7. Offline

    CraftCreeper6

    @Lily_K97
    Nice! I'll see what I can do later on.

    Edit, done.

    Config Example:
    Code:
    item:
      material: book
      name: '&9Sell Chest Talisman'
      lore:
      - '&c{uses} uses remaining'
      - '&cMultiplier: {multiplier}'
    Keep the {uses} and {multiplier}, build your string around them. Multiplier can only be within the lore, I might be able to add it to the item name upon request.

    Fixed some bugs:
    - Price wasn't accurate, only gave money for the price of 1 item even if it was a full stack
    - A free sell chest talisman is no longer given when joining the server (leftover debug)
    - The player that receives the money for the items is no longer linked to the chest, but each individual talisman itself

    FYI: Any talismans that existed before the update will not have the multiplier in their description until they are used, they will have a multiplier of 1. The display name and material will never be updated, you'll have to re-spawn them in to get the updated items.

    New download (probably the same link)
     
    Last edited: May 16, 2024
  8. Offline

    Lily_K97

    You're a god-send! Thank you so much, I genuinely really appreciate it! <3
     
  9. Offline

    CraftCreeper6

    @Lily_K97
    No problem! Let me know if you run into any issues.
     
  10. Offline

    Lily_K97

    I cant seem to set the material to anything other than "book", if i try "honeycomb" or "heart_of_the_sea" it returns null everytime x_x Sorry for pestering you about this...

    Edit: This also appears in the after I put them our Vote Crates:

    [09:46:12 WARN]: [SellChests] Task #15596 for SellChests v0.0.1 generated an exception
    java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.hasItemMeta()" because "stack" is null
    at com.jordna.managers.SellChestItemManager.getItemStackIsSellChestItem(SellChestItemManager.java:150) ~[SellChests.jar:?]
    at com.jordna.listeners.ChestEvents$1.run(ChestEvents.java:65) ~[SellChests.jar:?]
    at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.4.jar:git-Paper-496]
    at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:482) ~[paper-1.20.4.jar:git-Paper-496]
    at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1646) ~[paper-1.20.4.jar:git-Paper-496]
    at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.20.4.jar:git-Paper-496]
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1525) ~[paper-1.20.4.jar:git-Paper-496]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1226) ~[paper-1.20.4.jar:git-Paper-496]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[paper-1.20.4.jar:git-Paper-496]
    at java.lang.Thread.run(Thread.java:1583) ~[?:?]
     
    Last edited: May 17, 2024
  11. Offline

    CraftCreeper6

    @Lily_K97
    Oops. I rushed it a bit, added api-version and working fine.

    Should have fixed that other bug you're seeing too.

    Also added a message format to the config, and a message that tells you how much your chest sold for whenever it sells.
    Format for that:
    Code:
    messages:
      format:
        info: '&b&l[INFO] &r&7{message}'
        debug: '&5&l[DEBUG] &r&7{message}'
        error: '&c&l[ERROR] &r&c{message}'
    Here. Let me know if it works okay.
     
    Last edited: May 17, 2024
  12. Offline

    Lily_K97

    You're an absolute gem! Thank you so much for replying so quick and fixing all the issues so fast <3
     

Share This Page