BreakProhibitor

Discussion in 'Archived: Plugin Requests' started by qkumber1, Feb 22, 2012.

  1. Offline

    qkumber1

    All I need is a simple plugin that disallows breaking any blocks on the map at all. If this is already made, please direct me to it.
     
  2. Offline

    javoris767

    Would you like it to disallow block place too?
     
  3. Offline

    Numenorean95

    If that is really all you want i imagine it is almost too simple to already be out there... I can make you one in five minutes if this is what you want without any other features.
     
  4. Offline

    Zarius

    PermissionsEx (with the ModifyWorld module) will let you set it so no-one can break any blocks unless you add a permission for them to do so.
     
  5. Offline

    javoris767

    If you need block place disallowed on it tell me and I'll add it.
    Download
    Permission: bp.break ( to allow )
     
  6. Offline

    qkumber1

    Thanks a million.

    >TheListener.class
    Exactly what is that? The name makes me suspicious of your plugin.

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

    K_Cin

    You are using the old type of listener. Take a look at this page.

    Example BreakProhibitor class:
    PHP:
    package me.kcin.BreakProhibitor;
     
    import java.util.logging.Logger;
     
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.BlockBreakEvent;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class 
    BreakProhibitor extends JavaPlugin implements Listener {
     
        public final 
    Logger logger Logger.getLogger("Minecraft");
     
        public 
    void onDisable() {
            
    PluginDescriptionFile pdfFile this.getDescription();
            
    this.logger.info("[" pdfFile.getName() + "] Plugin v" pdfFile.getVersion() + " by " pdfFile.getAuthors() + " disabled.");
        }
     
        public 
    void onEnable() {
            
    getServer().getPluginManager().registerEvents(thisthis);
            
    PluginDescriptionFile pdfFile this.getDescription();
            
    this.logger.info("[" pdfFile.getName() + "] Plugin v" pdfFile.getVersion() + " by " pdfFile.getAuthors() + " enabled.");
        }
     
        @
    EventHandler
        
    public void onBlockBreak(BlockBreakEvent event) {
            if(!
    event.getPlayer().hasPermission("breakprohibitor.ignore")) {
                
    event.setCancelled(true);
            }
        }
     
    }
    You can download BreakProhibitor.jar if you want to take a closer look.
     
  8. Offline

    Score_Under

    He's using the new listener type, just with more than one class.

    qkumber1, all 4 plugins mentioned in this thread are completely safe.
     
  9. Offline

    javoris767

    I'll show the code >.>. You don't trust me :(.

    Code:
    package me.javoris767.BreakProhibitor;
     
    import java.util.logging.Logger;
     
    import org.bukkit.Bukkit;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin {
        Logger log = Logger.getLogger("Minecraft");
        private final TheListener blistener = new TheListener(this);
       
        public void onDisable() {
        }
        public void onEnable() {
            Bukkit.getServer().getPluginManager().registerEvents(blistener, this);
        }
    }
    Code:
    package me.javoris767.BreakProhibitor;
     
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.EventPriority;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.BlockBreakEvent;
     
    public class TheListener implements Listener {
        public Main plugin;
        public TheListener(Main instance) {
            plugin = instance;
        }
        @EventHandler(priority = EventPriority.HIGHEST)
        public void onBlockBreak(BlockBreakEvent event) {
            Player player = event.getPlayer();
            if (event.isCancelled()) return;
            if (!event.getPlayer().hasPermission("bp.break")) {
                event.getPlayer();
                event.setCancelled(true);
            player.sendMessage(ChatColor.RED + "You are not allowed to break blocks!");
            }
        }
    }
     
  10. Offline

    XLighterShadowX

    cant you jsut set build to false in the permissions file...? and im sure theres something in the server.properties for it too (but that might be vanilla)
     
  11. Offline

    javoris767

    I ensure I'm not using the old Event System :p.
     

Share This Page