[Noob Dev in Java] Requested Plugin not working

Discussion in 'Plugin Development' started by superbramie8, Jul 28, 2014.

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

    superbramie8

    No bugs in the code whatsoever, this is my first plugin I've ever made with more than 1 command.
    Just, seems to not work in-game.

    CODE (I know it looks stupid, a good friend requested these plugins)
    ---------------------------------------------------------------------------------
    http://dev.bukkit.org/paste/10401/
    ---------------------------------------------------------------------------------

    PLUGIN.YML
    ---------------------------------------------------------------------------------

    name: TrollPlugin
    main: org.bukkit.trollerplugin.Trollerclass
    version: 1.0
    author: Superbramie8


    commands:
    trollplus:
    description: Trolls you.
    usage:
    /trollplus help - Show all trollplus commands.
    /trollplus igniter - Ignite targeted player.
    /trollplus potion - Give negative effects to targeted player.
    /trollplus chattroll - Flood chat with weird messages.
    /trollplus dimension - Teleport targeted player to nether.
    /trollplus end - Teleport targeted player to the End.
    /trollplus bats - Spawn bats around targeted player.
    /trollplus tnt - Spawn TNT inside targeted player.
    /trollplus squids - Spawn Squids around targeted player.
    /trollplus hacked - Send messages acting like server has been hacked.

    permission: trollplus.execute
    permission-message:Sucks to be you, not enough permissions.
    ---------------------------------------------------------------------------------


    Also, please explain like im five.

    Any help is welcome.
     
  2. Offline

    manguvana

    superbramie8
    I see you only have one command, so why two onCommands?
    You can just use
    Code:
    if(cmd.equalsIgnoreCase("yourcmd"){
    if(args[0].equalsIgnoreCase("yoursubcommand"){
    } else if(args[0].equalsIgnoreCase("yourothersubcommand"){
    }
    }
    
    And so on.
    But your problem might be the plugin.yml spacing. Run it trough a online parser, to find errors.
    Also, there my only be one usage, like this:
    commands:
    trollplus:
    usage: <command> (subcommand)
     
  3. Offline

    superbramie8

    manguvana Do you have any links to a proper parser? Ive tried to find one before.
     
  4. Offline

    manguvana

  5. Offline

    superbramie8

    manguvana I have no idea what this means. sorry

    Code:
    ERROR:
     
    while scanning for the next token
    found character '\t' that cannot start any token
      in "<unicode string>", line 19, column 1:
            public void onEnable()
        ^
     
  6. Offline

    ZodiacTheories

  7. Offline

    manguvana

    @superbramie8​
    I ment to parse the .yml, not the class. The error is coming from the tabs, but in java it's fine.​
     
  8. Offline

    superbramie8

    manguvana Shit sorry, Im really new to this.

    Code:
    ERROR:
     
    while scanning for the next token
    found character '\t' that cannot start any token
      in "<unicode string>", line 9, column 1:
            trollplus:
        ^
    Still dont understand tho D:
     
  9. Offline

    manguvana

    superbramie8
    Instead of tabs, use 2 spaces. If you use Notepad++, you can use replace.
     
  10. Offline

    superbramie8

  11. Offline

    manguvana

    Any stacktrace? If not, then im gonna analyze your code more deep.
     
  12. Offline

    Necrodoom

    superbramie8 broken plugin.yml (tabs, incorrect spacing on last line).
    Attempting to check command arguments in cmd.getName (check args instead).
    Sleeping on main thread. Never do so, you are freezing the server, use a runnable.
     
  13. Offline

    hankered

    Necrodoom
    I think that's what he is trying to do..
     
  14. Offline

    Necrodoom

    hankered yes, and I listed more errors he has to fix.
     
  15. Offline

    jimbo8

    Sorry, but i started to cry a little when i read through the code.
     
  16. Offline

    teej107

    [​IMG]
    Pause a different thread other than the main one.

    And you don't need to announce that the plugin has been enabled. Bukkit already does that for you, and you are announcing it backwards anyway. However you are making a Troll plugin so I don't know what your intentions are.
     
  17. Offline

    AoH_Ruthless

    1. Wrong world import
    2. Unneeded announcing of enable/disable (Bukkit does this for you)
    3. Command name cannot have white space; in /trollplus igniter, igniter is args[0].
    4. When you set fire ticks, 2000 ticks is not 2 seconds ... it's 100 seconds.
    5. When you log "player has been ignited".. you log the target instead of the target's name.
    6. You have a second onCommand with a reiteration of #3
    7. Again, when you add a potion effect for 50000 ticks, thats about 2500 seconds or 40+ minutes
    8. As others mentioned, don't put the thread to sleep.
    9. Bukkit.broadcastMessage("A" + "\n" + "B") will print out A and B on two separate lines. Saves a lot of space
    And those are just the Bukkit issues ...
     
Thread Status:
Not open for further replies.

Share This Page