[INACTIVE][MECH/FIX] AntiExpedient v1.0 - stop players from placing blocks ontop of chests [1000]

Discussion in 'Inactive/Unsupported Plugins' started by codename_B, Aug 12, 2011.

  1. Offline

    codename_B

    AntiExpedient
    stop players from placing blocks ontop of chests

    Download v1.0

    What does it do?
    Exactly what is says on the tin - stops players from placing blocks ontop of chests!

    Who does it affect?
    Everyone! With this plugin enabled, noone can place blocks ontop of chests!

    Configuration options?
    None.

    Permissions?
    None.

    MySQL?
    No.

    Why did you make this plugin?
    @Rellac requested it.

    Where can I download it?
    Here.

    Source?
    Code:
    package de.bananaco.reliac;
    
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.event.Event;
    import org.bukkit.event.Event.Priority;
    import org.bukkit.event.block.BlockListener;
    import org.bukkit.event.block.BlockPlaceEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class AntiExpedient extends JavaPlugin {
    
    	@Override
    	public void onDisable() {
    		// Tells us we're go no more!
    		log("disabled");
    	}
    
    	@Override
    	public void onEnable() {
    		// Register the event.
    		getServer().getPluginManager().registerEvent(Event.Type.BLOCK_PLACE,
    				new EBlock(this), Priority.High, this);
    		// Tells us we're go!
    		log("enabled");
    	}
    
    	/**
    	 * Adds a little tag to every message
    	 *
    	 * @param message
    	 */
    	public void log(Object message) {
    		System.out.println("[AntiExpedient] " + String.valueOf(message));
    	}
    }
    
    class EBlock extends BlockListener {
    	AntiExpedient e;
    
    	EBlock(AntiExpedient e) {
    		// Pass the instance of the main class.
    		this.e = e;
    	}
    
    	public void onBlockPlace(BlockPlaceEvent event) {
    		// If the event is cancelled we shouldn't do anything.
    		if (event.isCancelled())
    			return;
    		// Otherwise let's see if they're trying to place a block ontop of a
    		// chest!
    		if (event.getBlock().getRelative(0, -1, 0).getType() == Material.CHEST) {
    			event.setCancelled(true);
    			// Haha! Denied!
    			event.getPlayer().sendMessage(ChatColor.RED + "Nope.");
    			// And log them for good measure.
    			e.log(event.getPlayer().getName()
    					+ " tried to place a block ontop of a chest");
    		}
    	}
    }
    
    
    Changelog:
    - 1.0 12/08/2011 - released plugin, job done.
     
    Rellac likes this.
  2. Offline

    skeletonofchaos

    Can we place chests beneath blocks?
     
  3. Offline

    codename_B

    You wouldn't be able to put any items in the chest in that case would you?

    This is only meant to fix the exploit of users placing blocks ontop of chests in protected areas so people can't steal their items on non-griefing but still theiving servers.
     
  4. Offline

    skeletonofchaos

  5. Offline

    Rellac

    Thanks alot, bud. [diamond]
     
  6. Offline

    Plague

    the source is a great use-case for a spoiler tag ;)
     
  7. Offline

    SwearWord

    wtf I just made this yesterday. I hate you.
     
  8. Offline

    codename_B

    Where? I don't see it in submissions.
     
  9. Offline

    Jaystice

    Don't hate, appreciate that you both came up with a great idea. :)
     
  10. Offline

    w000rm

    I'm probably being an idiot, but i don't get the purpose of this.
    So, i have a protected zone, and people can put blocks onto chests? No they can't :\ At least for me.
     
  11. Good plugin, but please allow Signs and Torches, these two didn't block the chests and i need it to mark what's in the quests.
     
  12. Offline

    Rellac

    Was just about to say the same thing.
     
  13. Offline

    NemisisX31

    yes, i concur. Maybe add one perm node as well. An exemption for ops.
     
  14. Offline

    Panzerx

    Can you make a permission node so when admin put a block above the chest others cant remove it
     
  15. Offline

    Asphodan

  16. Offline

    Alo

    Thanks! This is just what I needed! ;)
     
  17. Offline

    md_5

    @codename_B
    As you know this is now inactive due to not being maintained if it is on Bukkitdev or you wish to revive it tag me.
     

Share This Page