[INACTIVE][SEC] BlockBlocks V12.6_01 - 'I don't want TNT and lava!' etc. [Permissions] [1000]

Discussion in 'Inactive/Unsupported Plugins' started by Liam Allan, Jun 29, 2011.

?

What blocks should I block?

  1. Portal(91)

    72 vote(s)
    78.3%
  2. Sponge

    20 vote(s)
    21.7%
  1. Offline

    Liam Allan

    [​IMG]

    BlockBlock
    Version 12.6_01
    Supports Permissions!
    Made by Liam Allan!
    700+ Downloads from 07/08/2011!
    Have a look at the brother plugin! BlockLog
    I don't know if it works for PermissionsBukkit
    This plugin is getting handed over to NeoSilky!

    Features!
    This plugin will stop certain blocks being placed.
    Anything todo with redstone will not let you
    place that item next to TNT
    here's the blocks that will not let be placed.

    Tnt, Lava, Bedrock, Fire, Mob Spawner and Natural Portal.

    When you place a block in that list, It will kick you
    and give you a message "You have been kicked for . . ."
    There are more details on the Wiki. Link is above.
    -------------------------------------------------------------------------
     
    Teh Kitteh and Torrent like this.
  2. Offline

    Torrent

    Very nice for your first plugin :)
    Just one thing: you need to add a download from an external site such as mediafire, dropbox etc. (Non registered users cant download attached files from the thread :p)
     
  3. Offline

    Liam Allan

    Ok, Glad you liked it!
     
  4. Offline

    SPACEDUDE360000

    Maybe a configuration file? Permissions for bypassing?
     
  5. Offline

    C0R7

    Can you set it up so the Owner or Admin of the server can change what is blocked.
     
  6. Offline

    captainawesome7

    You mean like WorldGuard or SimpleAntiGrief? Without configuration this plugin isn't all that useful..
     
    cholo71796 and dave47561879 like this.
  7. Offline

    C0R7

    I like the idea. It just needs a config file so you can block stuff and in game commands with it. like /b 46
     
  8. Offline

    Liam Allan

    Ok, Guys! I get the idea that you want a config file with setting's in them.
    Since I'm new to bukkit plugins (not java) I'm not sure how it works . . .
    If anyone wants to help out. Let me know.

    Guys, Re-check the post, Sourcecode is now avalible!

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

    C0R7

    ok cool. but i dont no java :( so i cant help you there. i wish i could learn.
     
  10. Offline

    Liam Allan

    I can give you a phew tips
     
  11. Offline

    C0R7

    Ok. that would be cool
     
  12. Offline

    Liam Allan

    Add me on skype "liamallan12345"
     
  13. Offline

    C0R7

    I will as soon as im done my call. and i cant talk with my bad internet. thats my problem right now.
     
  14. Offline

    Liam Allan

    Ok, I'm not fussed. . . .
     
  15. Offline

    Gonfa

    Awesome plugin. I will use it

    EDIT: I read just a little bit = awesome plugin. Read the rest = Super Epic Awesome Plugin

    and can u please add permissions?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  16. Just use a java.utils.Properties.
     
  17. Offline

    Liam Allan

    Can you explain how to use this?
     
  18. This is a slightly simplified version of what I use for my plugin.
    Code:
    public class MyPlugin extends JavaPlugin
    {
        private Properties properties;
        File storageLocation = new File("plugins" + File.separator + "MyPlugin");
        File propertiesLocation = new File(storageLocation, "Properties.ini");
    
        @Override
        public void onEnable()
        {
            properties = new Properties();
    
            if (!storageLocation.exists()) { storageLocation.mkdirs(); }
    
            try {
                if (!propertiesLocation.exists()) { propertiesLocation.createNewFile(); }
            }
            catch (IOException ex) { Logger.getLogger("Minecraft").log(Level.SEVERE, "Unable to create new properties file.", ex); }
    
            try {
                FileReader reader = new FileReader(propertiesLocation);
                properties.load(reader);
                reader.close();
            }
            catch (IOException ex) { Logger.getLogger("Minecraft").log(Level.SEVERE, "Unable to load persistent storage.", ex); }
        }
    
        @Override
        public void onDisable()
        {
            if (!storageLocation.exists()) { storageLocation.mkdirs(); }
    
            try {
                FileWriter writer = new FileWriter(propertiesLocation);
                properties.store(writer, "MyPlugin properties.");
                writer.close();
            }
            catch (IOException ex) { Logger.getLogger("Minecraft").log(Level.SEVERE, "Unable to store persistent storage.", ex); }
        }
    }
    Then, to access a property, use:-
    Code:
    properties.get("[KEY]");
    And to set:-
    Code:
    properties.setProperty("[KEY]", "[VALUE]");
     
  19. Offline

    Liam Allan

    So then my BlockListener would be something like this?

    if (block.getTypeId() == Material.properties.get("[KEY]")) {
    player.chat(player.getName() + " kicked for placing " + Material.properties.get("[KEY]") + ChatColor.GOLD + " [BlockLogger]" );
    player.kickPlayer("You have been kick for placing a blocked block.");
    block.setTypeId(0);
    System.out.println( player.getName() + " has been kicked for trying to place " + Material.properties.get("[KEY]")); }

    Is this right?
     
  20. Offline

    Pencil

    this:

    Code:
                            block.setTypeId(0);
    is actually a bad idea, mainly because you set *for example* tnt block to air. Now that would leave ugly marks in water/lava wouldnt it? :p waaay easier to do is just to cancel the event

    Event.setCancelled(true);
     
  21. Offline

    Liam Allan

    Thanks kind
    Thanks kind sir!
     
  22. Offline

    Pencil

    Np :)
     
  23. Offline

    Liam Allan

    Sorry. I'm a noob. What do I replace/add to my BlockListener ?
     
  24. Offline

    Pencil

    you remove the part that sets the block to air

    and insert the setcancelled thing like this:

    Code:
    if (block.getType() == Material.FIRE) {
                            player.chat(" kicked for placing fire." + ChatColor.GOLD + "[BlockLogger]" );
                            player.kickPlayer("You have been kicked for trying to make fire.");
                            event.setCancelled(true);
                            System.out.println(player.getName() + " has been kicked for trying to make fire");}
    Something like this, what it does is IF the player places the block, it cancels the event so it is as IF it never happened. Before the block was placed and then removed, with this it was never placed in the first place.
     
  25. Offline

    Liam Allan

    Oh. I was right. It was just that you posted "Event.setCancelled(true);" not "event.setCancelled(true);"
    Thanks!
     
  26. Offline

    Pencil

    Well that just not a fixed thing, if you for example put instead of

    public void onBlockPlace(BlockPlaceEvent event) {

    something like

    public void onBlockPlace(BlockPlaceEvent Event) {

    Event.setCancelled(true); would have worked XD I just didn't look at that part before, I was thinking u knew how to use it xD
     
  27. Offline

    Liam Allan

    Its fine anyway :D And your in the post for helpers :D So thanks very much!
     
  28. Offline

    Pencil

    np xD glad it worked ^^
     
  29. Offline

    nubpro

    Could you clean the thread?
    It's very messy and untidy.
     
  30. Offline

    Liam Allan

    Ok, Ill try :D
     

Share This Page