Filled Full Inventory Chat Message

Discussion in 'Archived: Plugin Requests' started by HazePvPHD, Sep 16, 2014.

  1. Offline


    Suggested name: Full-Inventory Message

    What I want: So the title pretty much tells you what I am looking for. I have a custom auto-inventory but my developer retired and I need someone to develop a small, light weight message plugin where once they can no long fit any items in their inventories it will tell them In chat for every block they break.

    Ideas for commands: /fim reload /fim cooldown {x} (Global Cooldown between messages to reduce spam)

    Ideas for permissions: fim.reload fim.cooldown fim.message

    When I'd like it by: The end of the week would be nice :)
  2. Offline


    Just to be sure: When inventory is full and you break a block it will give you a message 'Your inventory is full! Could not pick up *name of item broken*'
  3. Offline


    Yes that is right, but maybe not say what block it is to reduce the lag. Also if possible make the message editable
  4. Offline


    Saying what block was broken will not cause any lag.
    I was just thinking, what if you went mining and are destroying your way back up and you keep getting spammed by this message because of all the useless cobblestone?
  5. Offline


    Here is something I put together @HazePvPHD:)

    It is just a simple plugin, should be pretty efficient.

    Maybe I can add an option to toggle the message off if a player has access to inventoryfull.alert to take care of
    you getting spammed? Konkz

    Here is the source:
    1. package me.clip.inventoryfull;
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.command.Command;
    6. import org.bukkit.command.CommandSender;
    7. import org.bukkit.configuration.file.FileConfiguration;
    8. import org.bukkit.entity.Player;
    9. import org.bukkit.event.EventHandler;
    10. import org.bukkit.event.EventPriority;
    11. import org.bukkit.event.Listener;
    12. import org.bukkit.event.block.BlockBreakEvent;
    13. import org.bukkit.inventory.ItemStack;
    14. import org.bukkit.inventory.PlayerInventory;
    15. import;
    17. public class InventoryFull extends JavaPlugin implements Listener {
    19. static String full;
    21. @Override
    22. public void onEnable() {
    23. loadConfig();
    24. saveConfig();
    25. loadMessage();
    26. Bukkit.getServer().getPluginManager().registerEvents(this, this);
    27. }
    29. private void loadConfig() {
    30. FileConfiguration c = getConfig();
    31. c.options().header("InventoryFull version "
    32. + getDescription().getVersion()
    33. + "\nCreated by: extended_clip"
    34. + "\nValid placeholders:"
    35. + "\n%block% - display the dropped item type"
    36. + "\n%player% - display the players name");
    37. c.addDefault("full_message", "&cYou don't have room in your inventory to collect that &f%block%&c!");
    38. c.options().copyDefaults(true);
    39. }
    41. private void loadMessage() {
    42. full = getConfig().getString("full_message");
    43. }
    45. @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    46. public void onBlockBreak(BlockBreakEvent e) {
    48. Player p = e.getPlayer();
    50. if (!p.hasPermission("inventoryfull.alert")) {
    51. return;
    52. }
    54. PlayerInventory i = p.getInventory();
    56. ItemStack wontFit = null;
    58. for (ItemStack drop : e.getBlock().getDrops()) {
    60. for (ItemStack is : i.getContents()) {
    61. if (is == null) {
    62. return;
    63. }
    64. if (is.getType().equals(drop.getType())
    65. && is.getAmount() + drop.getAmount() <= 64) {
    66. return;
    67. }
    68. }
    69. wontFit = drop;
    70. }
    72. sms(p, full.replace("%player%", p.getName())
    73. .replace("%block%", wontFit.getType().toString().toLowerCase().replace("_", " ")));
    75. }
    77. public void sms(CommandSender s, String msg) {
    78. s.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
    79. }
    81. @Override
    82. public boolean onCommand(CommandSender s, Command command, String label,
    83. String[] args) {
    85. if (s instanceof Player) {
    86. Player p = (Player) s;
    87. if (!p.hasPermission("inventoryfull.admin")) {
    88. sms(s, "&cYou don't have permission to do that!");
    89. return true;
    90. }
    91. }
    93. if (args.length == 0) {
    94. sms(s, "&cInventoryFull &fversion " + getDescription().getVersion());
    95. sms(s, "&7Created by: &cextended_clip");
    96. sms(s, "&7/invfull reload &f- &cReload config file");
    97. }
    98. else if (args.length > 0 && args[0].equalsIgnoreCase("reload")) {
    99. reloadConfig();
    100. saveConfig();
    101. loadMessage();
    102. sms(s, "&cInventoryFull &7configuration successfully reloaded!");
    103. }
    104. else {
    105. sms(s, "&cIncorrect usage! Use &7/inventoryfull");
    106. }
    108. return true;
    109. }
    110. }

    Here are the permissions/commands from the plugin.yml:
    name: InventoryFull
    author: extended_clip
    main: me.clip.inventoryfull.InventoryFull
    version: 1.0
    description: Be alerted when your inventory is full!
            description: Ability to use /inventoryfull and /inventoryfull reload
            default: op
            description: be alerted when your inventory is full and you mine a block that won't fit!
            default: true
        description: Admin command for InventoryFull
        aliases: [invfull, infull]

    Here is the plugin download:
    HazePvPHD and PapiDimmi like this.
  6. Offline


    Nice. Will try it out!
  7. Offline


    Cool! Let me know how it works for you.
  8. Offline


    Thanks man, just a quick question, could you add an auto-inventory which support worldguard and plotme. With this also a auto-smelt which supports up to fortune 50. Say they have fortune 20 they get 1-20 ironingots. If you can do this kit would be epic!! And just one more request, upon mining any ore it will autocraft it into its blocks, this will stop a lot of clustering. Thanks so much for the auto-inv but if you can do this too it would be epic!!
  9. Offline


    I would most likely not want to include those features in InventoryFull.
    All are very simple and I am capable of making but I know there are working plugins available that do exactly what you want.

    Search google a bit or even this forum, you will find what you are looking for.
  10. Offline


    I have searched google for hours on end, I have found some plugins but they have things wrong with them, for example: Auto-Smelt not compatiable with Fortune, Auto-Inventory needs to be enabled (I want it automatically on with no way to disable it) and I have not been able to find one for the auto-crafting of the ores as they are mined. If you be able to make all this into one that would be amazing!!

    Suggested Name: PrisonBlocks
  11. Offline


    I will make a plugin that has the auto smelt feature, and the blocks to inventory tomorrow. It will be a separate plugin aside from the InventoryFull plugin.
  12. Offline


    Ok Thanks a bunch!!! Also would you like be a developer on my server, and also will this include the auto-craft, once they have 9 coal, 9 diamonds, 9 emeralds, 9 gold ingots, 9 ironingots, 9 redstone, 9 lapislazuli it will take that and give them the block. Also one last thing, with your EZRanksLite, how do I stop the scoreboard from flashing and is there a way to enable it for everyone who joins, so its ALWAYS on. PS. with the plugin you will make please make no permissions or commands, just as long as it is ALWAYS on. So Auto-Smelt (Compatiable with Fortune 1-50), Auto-Craft, Auto-Inv all in one with no permissions, that would be great THANKS!
  13. Offline


    Your plugin is very helpful.. However if you can can you please use the HoloAPI and ProtocolLib to make the messages come where the block was broken in this form &4&LINVENTORY FULL and have an XP noise everytime? I know this might be copying some servers but I want this because my friends & I are doing a mining contest...

Share This Page