[REQUEST] StraightToInv Plugin

Discussion in 'Archived: Plugin Requests' started by Hyperven0m, Jul 29, 2014.

  1. Offline

    Hyperven0m

    What it does:
    StraightToInv is a unique plugin for prison servers. It is a plugin which makes drops from mines go straight to the player's inventory! How cool is that? The purpose of this plugin is so that player's don't steal other players blocks! It also works great for Factions, or something similar. For example: Player holds axe, breaks wood with axe, wood doesn't drop, instead it

    goes straight to the players inventory!

    Why we need this:
    The community really needs this because players are sick of other players stealing their stuff that they earned by for example: killing a player with op armor, finding diamonds, etc. so please find a solution to this!

    Permissions:
    sti.use


    Config:
    disabled-worlds:
    - Disabledworld1
    - Disabledworld2

    Worldguard, Factions, and PlotMe:
    Please make sure that players won't be able to override Worldguard, Factions, and PlotMe. What I mean is don't let them be able to break Worldguard, Factions, or PlotMe regions like similar plugins to this one do.

    *UPDATE: The plugin will be uploaded to the public on this page on the 11th-14th!
     
  2. Offline

    EnderTroll68

    I can do this, pretty simple. I will post when I finish it in here.

    It's done, check the [x] in my signature

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  3. Offline

    Hyperven0m

    Thanks man! I will try it when I get home
     
  4. Offline

    Deleted user

    EnderTroll68
    But you don't cancel the event. Won't the blocks get dropped to the ground and the inventory?
     
  5. Offline

    EnderTroll68

    Whoops. You are right. My bad. Fixing it now.

    Edit: You could have just asked for the source rather than decompiling it.

    Well I uploaded a new version, this one will work but it is not affected by fortune. To get that part working I will need a bit longer since I am busy and do not have time to code it at the moment

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  6. Offline

    Hyperven0m

    Ok, I did try the first version and it didn't work, I will try the 2nd one now :) .
     
  7. Offline

    timtower Administrator Administrator Moderator

    EnderTroll68 Please don't compile with java 8. Most servers don't have that.
     
  8. Offline

    Hyperven0m

    Hi, looks like I came across a problem I got an error because you compiled the plugin with Java 8, and I am running Java 7. If you could change it to Java 7 that would be great! Here's the log: http://pastebin.com/NABdmHET

    Ok, so I've installed Java 8 and it's working fine now. The blocks aren't dropping which is what I expected.. BUT I am not getting anything in my inventory

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

    EnderTroll68

    timtower
    I don't have java 7 though

    Like I said, I don't have time to make sure this works, it was supposed to only take me like 10 minutes. If someone else wants to pick it up, here is the source:
    Code:java
    1. public class Main extends JavaPlugin implements Listener {
    2. public void onEnable() {
    3. saveDefaultConfig();
    4. Bukkit.getPluginManager().registerEvents(this, this);
    5. }
    6.  
    7. @EventHandler(priority = EventPriority.HIGHEST)
    8. public void onBlockBreak(BlockBreakEvent e) {
    9. if (!e.getPlayer().hasPermission("sti.use")) {
    10. return;
    11. }
    12. if (e.getPlayer().getGameMode() != GameMode.SURVIVAL)
    13. return;
    14. if (e.isCancelled()) {
    15. return;
    16. }
    17. for (String string : getConfig().getStringList("disabled-worlds")) {
    18. if (e.getPlayer().getLocation().getWorld().getName().equalsIgnoreCase(string)) {
    19. return;
    20. }
    21. }
    22. if (e.getPlayer().getItemInHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) > 0) {
    23. for (ItemStack is : e.getBlock().getDrops(e.getPlayer().getItemInHand())) {
    24. e.getPlayer().getInventory().addItem(is);
    25. }
    26. } else {
    27.  
    28. }
    29. e.getBlock().setType(Material.AIR);
    30. e.setCancelled(true);
    31. }
    32. }


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  10. Offline

    Hyperven0m

    *QUICK UPDATE* The plugin is finished! However I would like a feature that allows fortune to be used. Whoever can implement this please let me know <removed>

    [edit by JaguarJo: removed personal info. Please keep all discussion on the forums. Thanks.]
     
  11. Offline

    Jaaakee224

Share This Page