Well... I have a code someone made me I have NO idea how to turn it into a plugin

Discussion in 'Plugin Development' started by x__Toshiro__X, May 19, 2013.

?

What am I?

  1. Noob

    27.8%
  2. Not a coder

    66.7%
  3. Nothing wrong with you

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

    x__Toshiro__X

    Code:
    @EventHandler(ignoreCancelled = true)
            public void onBreak(BlockBreakEvent event) {
            if(!event.getPlayer().isOp()) event.setCancelled(true);
            }
            @EventHandler(ignoreCancelled = true)
            public void onPlace(BlockPlaceEvent event) {
            if(!event.getPlayer().isOp()) event.setCancelled(true);
            }
     
  2. Offline

    CubieX

    If you have no clue about JAVA and the Bukkit API, I would suggest you use the "Request" forum to let someone implement this into a plugin.

    The other possibly way would be to learn it yourself.
    But I doubt this is what you want?
     
    TheGreenGamerHD likes this.
  3. Offline

    Tirelessly

    Not really related, but it's not JAVA, it's Java. It isn't an acronym.
     
  4. Offline

    x__Toshiro__X

    What do you mean "But I doubt this is what you want"?

    Made my day. :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  5. Offline

    CubieX

    Tirelessly
    And I'm sure you can clarify that?

    I often wirte it in upper case. Simply to highlight it. And I never heard of another usage for "JAVA",
    than to describe the programming language.
    Even oracle does this sometimes in their advertisements. Look here.

    That means, I do not believe that you are willing to learn JAVA, just to get that small plugin up and running.
    Am I right?

    Tirelessly Yes, I did it again. :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  6. Offline

    Tirelessly

    Yes, that's because the entire sentence is in all caps. Java is on that page in 7 other places, and all of them are "Java" and not "JAVA"

    EDIT: Make that 12 places
     
  7. Offline

    CubieX

    I explained why I use upper case and as long as there is no other definition associated with it,
    I will continue to do so whenever I feel like doing so.
    By the way, this is nothing to be discussed here, as it is completely meaningless... :rolleyes:
     
  8. Offline

    x__Toshiro__X

    Yes your right.
     
  9. Offline

    alf980103

    Well, with that code you can´t do much, because you need some more code, what do you want to do exactly?
     
  10. Offline

    x__Toshiro__X

    Well a plugin that lets only ops break blocks...
     
  11. Offline

    Skyshayde

    One sec, I'll make it

    Edit:

    Boom.
    https://dl.dropboxusercontent.com/u/35895921/OnlyOpsCanBreakOrPlace.jar
    Obligatory disclaimer, the BukkitDev team has not verified this and cannot be held liable for anything malicious in it. That said, I don't have anything malicious in it.

    It hasn't been tested, but it /should/ work

    And for anyone who cares, the source is below

    Show Spoiler

    Code:java
    1.  
    2. package com.gmail.skyshayde;
    3.  
    4. import org.bukkit.event.EventHandler;
    5. import org.bukkit.event.Listener;
    6. import org.bukkit.event.block.BlockBreakEvent;
    7. import org.bukkit.event.block.BlockPlaceEvent;
    8. import org.bukkit.plugin.java.JavaPlugin;
    9.  
    10. public class OnlyOpsCanBreak extends JavaPlugin implements Listener {
    11.  
    12. public void onEnable() {
    13. getServer().getPluginManager().registerEvents(this, this);
    14. }
    15.  
    16. @EventHandler(ignoreCancelled = true)
    17. public void onBreak(BlockBreakEvent event) {
    18. if (event.getPlayer().isOp() == false)
    19. event.setCancelled(true);
    20. }
    21.  
    22. @EventHandler(ignoreCancelled = true)
    23. public void onPlace(BlockPlaceEvent event) {
    24. if (event.getPlayer().isOp() == false)
    25. event.setCancelled(true);
    26. }
    27. }
    28.  

     
  12. Offline

    x__Toshiro__X

    It works.. OMG thanks.
     
  13. Offline

    Tirelessly

    Just because you try to justify it, doesn't make it correct..
     
  14. yeah you can thank me lata for the code :L
     
    Skyshayde likes this.
  15. Offline

    GodzOfMadness

    Tirelessly Who the hell cares if you say Java upper cased or not. I'm guessing you...
     
  16. Offline

    Tirelessly

    Thanks for being useless!
     
Thread Status:
Not open for further replies.

Share This Page