AutoFarm Blocker (Super easy)

Discussion in 'Archived: Plugin Requests' started by joshwenke, Nov 24, 2012.

  1. Offline

    joshwenke

    Plugin category: Mechanics (MECH)

    Suggested name: AutoFarmBlocker, StopAutoFarms, NoAutoFarm

    What I want: This would be a super-simple plugin, all it would do is prevent the use of automatic farms for my server. This includes wheat farms where water rushes over wheat, the cactus glitch where cacti try to grow, are stopped by a block above them, and when sugar cane/melon/pumpkin is pushed by a piston.

    Basically, the plugin would cancel the block-break event and turn around and ruin the auto farm. For example, if the player tried creating a wheat farm, the water would run over the wheat but instead of the wheat breaking and dropping wheat, it would break and drop nothing.

    If a cactus tries growing up and can't, the whole cactus will break.

    And if a piston tries pushing a sugar cane or melon or pumpkin in an attempt to auto-harvest them, the piston would get destroyed.

    If you can (optionally) stop other auto farms that I am not aware of (if you have time of course), that would rock too. I'm fine with leaving cobble generators alone cause I need that functionality for my skyblock world.

    (I know there's already a plugin NoFarm for the prevention of mob farming by mob grinders, this plugin is different in the sense that it only handles crops and not entities.)

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: No permissions needed for this plugin.

    When I'd like it by: January 1, 2013 is the absolute latest, but anytime earlier would be awesome!
     
    JazzaG likes this.
  2. Offline

    Codex Arcanum

    Just out of curiosity, why do want to stop automated farming so badly? I'm not going to go on an idealistic rant here, but it seems like the amount of time it takes to make an automated farm more than justifies the rewards.
     
  3. Offline

    joshwenke

    The players are creating huge farms that get them thousands of dollars in our economy every minute. It wouldn't be a problem, but with our economy fueling the server, and the idea that farmers are supposed to make money from joining a /job, the auto farms ruin the economy. Not to mention people trading 5 stacks of bread for a few diamonds. On a huge scale, with the server of 50-60 people online and 10 people making autofarms, this is a pretty big problem
     
  4. Offline

    Codex Arcanum

    Ah that makes much more sense. Have you considered dropping the sell price of farmable materials in whatever economy system you use?
     
  5. Offline

    joshwenke

    I've tried about everything, yet it doesn't help. The sell price for sugar cane is already as low as I can reasonably make it, and people are still making tons of money off these farms. They sit AFK for hours just automatically collecting their cactus and melons.. No matter how much I try to stop the farms by making new rules, it just doesn't work.
     
  6. Offline

    1mpre55

    Easy, just kick users if they are afk for some time. This will save some server resources too.
     
  7. Offline

    Latzafs

    If you have essentials you can get it to automatically kick you. Since this is so easy, I'll try to make it as my first plugin, :D
     
  8. Offline

    joshwenke

    Yeah, I've done my best with that, but it's not so much the idiling issue as it is the farms in their great numbers.

    I'd make the plugin myself but I'm still a beginner-ish at Java, so it would be nice if someone can let me know if this plugin would be a possibility!
     
  9. Offline

    1mpre55

    I don't understand how cactus thing works and how you plan to prevent it. As far as I know, if cactus can't grow, the BlockGrowEvent never gets fired.
    Other than that, it seems possible, but I doubt that a lot of other servers would want it.

    Wheat:
    Code:
    @EventHandler (ignoreCancelled = true)
        public void onWaterBreakingWheat(BlockFromToEvent event) {
            if (event.getBlock().getType().equals(Material.WATER) && event.getToBlock().getType().equals(Material.WHEAT)) {
                event.getToBlock().setType(Material.AIR);
            }
        }
    Piston:
    Code:
    @EventHandler (ignoreCancelled = true)
        public void onPistonFarming(BlockPistonExtendEvent event) {
            for (Block block : event.getBlocks().toArray(new Block[0])) {
                Material type = block.getType();
                if (type.equals(Material.SUGAR_CANE_BLOCK) || type.equals(Material.PUMPKIN) || type.equals(Material.MELON_BLOCK)) {
                    event.setCancelled(true);
                    event.getBlock().setType(Material.AIR);
                    return;
                }
            }
        }
     
  10. Offline

    Borlea

    I could stop pistons from breaking certain blocks (i think haven't tried yet) but i'm not sure about cactus/wheat. I'm thinking of a way of water going overtop of the wheat if the water comes from top or it just thinks the wheat is like a stone block but I'm not even 10% sure how I would do that. If I get some random time and I wanna try and do some of your plugin and just post it here I will. But other then that prob a smarter coder that will see this post

    Edit: The guy above me looks like he figured out the corrects events.. Since I don't know alot of the bukkit events yet.
     
  11. Offline

    Latzafs

    I could see a way out of this. If it's a sticky piston with something attached to it, this wouldn't work. Also, would be slightly different for cacti I think. not only that, but what if theirs a sticky piston underneath the dirt block which holds the growing object and just works like that? Unlikely, but it still will go by.
     
  12. Offline

    1mpre55

    Actually, it still works. Because event.getBlocks() returns a List<Block> with all affected blocks in it. Then with the for loop it goes through all of them. This will even detect a very complicated system with 2 pistons on both sides, where first piston pushes multiple blocks (up to the max number of blocks that a piston can push) with sugarcane at the end and then 2nd piston will push all blocks back.
    I don't understand how the cacti glitch works. Maybe you can explain it to me?
    Then the farm will have to be re-planted manually. It'll stop being an auto-farm and become a regular farm with auto-harvesting instead. But if you want it, you can prevent that too, but you'll have to check for the block above every block in the event.getBlocks() list. I don't think that it's worth the cpu usage.
     
  13. Offline

    joshwenke

    Looks good, I'll test it out. Thanks!
     
  14. Offline

    tremor

    There is a lot of reasons to block various autofarming:
    1. Economy balancing for servers who have markets or trading.
    2. Over abundance of free or cheap food, makes reckless PvP or exploring too easy.. some servers want a more hardened survival experience.
    3. Lag. Some of the sheer numbers of entities on the ground from some farms bring servers to their knees. Consider my egg farm - with 1000 chickens crammed into a 4x4 water hole dropping over 100 eggs per second. I can have 5 chests full of eggs in only minutes of afk in that auto farm. If i hang out there for an hour the server will crash.
    4. Broken default mechanics of farming. Harvesting your wheat should give you a chance for seeds from 0-2. One 9x9 wheat farm can currently return twice the seeds needed for replanting.
    I'd like to see a comprehensive farm plugin passed!
     
  15. Offline

    joshwenke

    Yes, exactly what I was thinking! At least someone understands :)

    I privately developed this plugin since no one else was willing to take on that task... if you need a copy PM me.
     
  16. Offline

    AndyMcB1

    Melon auto farms.. Where the dirt block they're on pushes it off..
     
  17. Offline

    1mpre55

    3. Minecraft automatically despawns items after 5 minutes. And usually dropped items cause more lag on the client side than on the server. And if it's a big problem, try using NoLagg.
    4. Actually, it's 0-3 seeds, and auto-farm doesn't change that.
    I agree with your other points, but I'd like to point out that it takes a lot of resources to make the auto-farm. Disabling auto-farms might be a good idea on some servers, but on most servers (yes, even economy) auto-farms are not a problem.
     
  18. Offline

    tremor

    For #3 ya.. lag probably isn't the biggest factor here. I'm averse to the NoLagg plugin personally, It's caused me more problems that it's solved regarding lag. Client side lag is actually my servers biggest problem, my TPS never drops below 20.

    For the auto-farms thing, I wouldn't want to disable those.. they are great! I just think alot of the mechanics of the food and animals could use an overhaul. I use a plugin called ExtraHardMode which does some fun things to fix farming and make the server more difficult.. It disables netherwart from growing, (it drops from pigzombies in netherfort only). It disabled crafting melon seeds from melon slice on crafting table.. makes it work more like wheat - break a stalk and get a return chance.

    @op - You could easily block a portion of autofarming with WorldGuard. 1 - I think there are some grow restrictions you can setup.. also, you could block pistons. Like i said, ExtraHardMode has some nice farm fixes.. however when I configured a few of those, myplayers RAGED. One fix they put it was water source block fix... dumping water from a bucket just made the water wash away.. instead you would be forced to irrigate from a natural water supply.
     
  19. Offline

    iPadHD

    Sure, but they can make a afk pool, and the cactus (crop) would fall into the afk pool with them.
     
  20. Offline

    bennie3211

    U can disable piston push for some blocks with essentials, then u can add sugarcane, melon, pumpkin ect. for it :)
     
  21. Offline

    iPadHD

    Didn't think of that, wonderful idea. Although, wheat! XD Essentials needs a plugin to do this D:
     
  22. Offline

    tremor

    better than disabling piston push.. create a "chance" than instead of pushing the block.. it will destroy the block.. so like an auto melon farm - maybe only half the melons push and break into slices, and the other half just vanish.
     
  23. Offline

    bennie3211

    I use this methode for 3 months, because they used it to destroy melon, pumpkin and sugar canes, now they have to harvest it with there hands :p
     
  24. Offline

    Chaositic

  25. Offline

    AndyMcB1

    Still, as I said before, Melons can be pushed by dirt, by a piston..
     
  26. Offline

    tremor

    Not if the plugin is done correctly - basically they give the melon the property of obsidian, and it cannot be pushed.. even by a piston with other blocks between it like dirt.
     
  27. Offline

    bennie3211

    yes, this is the effect when u config it right ;)
     
  28. Offline

    Tirelessly

    What minecraft do you play where a chicken drops an egg in less than 10 seconds?
     
  29. Offline

    1mpre55

    But that requires hooking into NMS code.
     
  30. Offline

    tremor

    Per - http://www.minecraftwiki.net/wiki/Chicken_egg - "An Egg is a food item laid by Chickens every 5–10 minutes (it takes 40 minutes for 9 chickens to lay 50 eggs, so 7.2 minutes/egg)."

    Now for simple math. Double chickens to 18, 50 eggs in 20 minutes. Double chickens to 36, 50 eggs in 10 minutes. 72 chickens, 50 eggs in 5 minutes. That's 10 eggs per minute or 1 egg every 6 seconds. I can login to any standard survival server and have this farm up and running at this capacity in under 20 minutes.. I will even make a video if I have to. It's busted farm mechanics and a very "eggsploitable" food source.

    Then consider that some teams/clans/factions/guilds of players build these farms by the dozens, with 100's of chickens in each. Apparently.. .you're the one playing the wrong Minecraft.
     
    afistofirony and joshwenke like this.

Share This Page