Plugin that makes it so player's cannot break items?

Discussion in 'Bukkit Discussion' started by jmwart1, Jun 15, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    jmwart1

    I need a world guard type plugin that will make it so all players except admins and owner CAN'T break blocks. I've seen it on many SG servers (which is what I'm making). A lightweight plugin that prevents and world modification is what I need. I downloaded world guard but I myself couldn't even break blocks. What plugin do I need?

    I need it to cover every inch of the world. This is purely an SG world and I do not want players editing ANY inch of it.
     
  2. Offline

    Brian_Entei

    Worldguard is your best bet for region protection, you just have to figure it's permissions out. Try searching the internet for worldguards' permissions and commands. However, for the block breaking, I could write you a plugin and send you the link in a pm, if that's an okay thing to do. The plugin would have the permission "pluginName.worldName.allowbreak", and for each world you have, you'd subsitute the world's name for the worldName in that permission. Then you'd give that permission to all of your admins and yourself, that way only people you choose could place/break blocks. The code is actually simple, if you know how to code in java. An example:

    Code:java
    1. package com.gmail.br45entei.BlockProtector;
    2.  
    3. import java.util.logging.Logger;
    4.  
    5. import org.bukkit.Bukkit;
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.event.EventHandler;
    9. import org.bukkit.event.EventPriority;
    10. import org.bukkit.event.Listener;
    11. import org.bukkit.event.block.BlockBreakEvent;
    12. import org.bukkit.plugin.PluginDescriptionFile;
    13. import org.bukkit.plugin.java.JavaPlugin;
    14.  
    15. public class BlockProtection extends JavaPlugin implements Listener {
    16. private static BlockProtection plugin;
    17. private static final Logger logger = Logger.getLogger("Minecraft");
    18.  
    19. public void LoginListener(BlockProtection JavaPlugin) {
    20. getServer().getPluginManager().registerEvents(this, plugin);
    21. }
    22. @Override
    23. public void onDisable() {PluginDescriptionFile pdffile = this.getDescription();
    24. logger.info(pdffile.getPrefix() + " version " + pdffile.getVersion() + " is now disabled.");
    25. }
    26. @Override
    27. public void onEnable() {PluginDescriptionFile pdffile = this.getDescription();
    28. Bukkit.getServer().getPluginManager().registerEvents(this, this);
    29. logger.info(pdffile.getPrefix() + " version " + pdffile.getVersion() + " is now enabled!");
    30. }
    31.  
    32. @EventHandler(priority=EventPriority.LOWEST)
    33. public void onPlayerBreakBlock(BlockBreakEvent evt) {
    34. Player breaker = evt.getPlayer();
    35. if(breaker.hasPermission("blockprotect." + breaker.getWorld().getName() + ".allowbreak") == false) {
    36. evt.setCancelled(true);
    37. breaker.sendMessage(ChatColor.DARK_RED + "You are not allowed to break blocks in this world!");
    38. Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.YELLOW + breaker.getName() + " was not allowed to break a block in the world \"" + breaker.getWorld().getName() + "\"!");
    39. }
    40. }
    41. }


    I won't guarantee the above posted code is error-free, as I typed it on the spot, but I will see about working on a plugin for you.
     
  3. Offline

    AwesomeMarioFan

    Install WorldGuard and run this command:
    /region __global__ build deny

    Note: There are 2 _'s on each side.
     
  4. Offline

    rsod

    Essentials Anti-Build or PEX Modifyworld
     
  5. Offline

    Brian_Entei


    You could also do that, too.
     
Thread Status:
Not open for further replies.

Share This Page