Creating a Welcome plugin

Discussion in 'Plugin Development' started by Willo7838, Oct 1, 2015.

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

    Willo7838

    Hello! I am currently trying to make a Welcome Plugin using Java Eclipse. I used an example from https://bukkit.org/threads/making-a-player-say-something-on-command.157210/ which was

    player.chat("What You want them to say!");

    I keep getting the errors
    Multiple markers at this line
    - Syntax error, insert ")" to complete MethodDeclaration
    - Syntax error, insert "SimpleName" to complete QualifiedName
    - Syntax error, insert "Identifier (" to complete
    MethodHeaderName
    - Syntax error, insert ")" to complete MethodDeclaration
    - Syntax error, insert "Identifier (" to complete
    MethodHeaderName
    and hovering over the ')' at the end says
    Syntax error, insert ")" to complete MethodDeclaration

    Here is the full code:
    Code:
    package me.Will7838.PotatoWelcome;
    
    public class PotatoWelcome {
       
        player.chat("What You want them to say!");
    
    }
    
    I want people to (using a single command) be able to welcome people to a server. Please respond
    And also, I am NOOB at Java so I am really stumped here.
     
  2. Offline

    tkuiyeager1

    @Willo7838 so you want to send the player a message when he joins the server?
     
  3. I recommend getting a better understanding of java before you start to make plugins

    player.chat caan't just be called in the middle of a class, without being in a method. From what I can see, you're trying to make them chat on join. Use the join event.
     
  4. Offline

    teej107

    You think he'd be able to understand that without a knowledge of Java?

    @Willo7838
    [​IMG]
     
  5. Hey here is an little code for you:
    http://hastebin.com/aqafiloguf.avrasm
    If you want to send the player a message if he joins... also i changed JoinMessage because the yellow "NAME joined the game" doesnt look good.

    I hope i helped you :3

    (Also you haveto register the Event in your main and say in your event class, that it is an Listener)
     
  6. Offline

    Reynergodoy

    First: PotatoWelcome is not your main class, so you should register PotatoWelcome at the main class, as I found Teej has a topic for it ( how to set your main class )

    Second: You have to say to the plugin who is this player, to make this you have to do an @EventHandler and a
    public void *ARANDOMNAME* (PlayerJoinEvent e) {
    }

    Third: You have to add some "things' in the PotatoWelcome class, so here's a link to a tutorial explaining you how to set a join message


    Java is not that simple that you think it is, to code a code like that
    plugin.makeItself.iWant("A plugin that makes my server the best server in the world");
    or more like this
    player.chat("What I want the player to chat");

    To you to do a command that makes the player say what you say in the command will be pretty hard to you, so start with lite things.
     
  7. Offline

    BaconStripzMan

    DON'T LINK BLOODY BCBROZ
     
  8. Offline

    Jayyy

    Code:
    package packagenamehere;
    
    imports
    
    public class yourclass extends JavaPlugin {
    
    @EventHandler
    public static void Welcome(PlayerJoinEvent e){
    
    Player p = e.getPlayer();
    
    if(!p.hasPlayedBefore() {
    Bukkit.broadcastMessage(ChatColor.GREEN + "Welcome " + p.getName());
    }
    }
    
    **Not sure if there is errors because I did this right here**
    Here this should work fine :D
     
  9. Offline

    boomboompower

    @Jayyy hes trying to make the player chat, not broadcast a message. (although that can work, you can user something like:
    Code:
    Player p = event.getPlayer();
    p.chat("Hello!");
     
  10. Offline

    Scimiguy

    Wow everyone is just pouring code onto this thread despite the OP obviously having trouble understanding basic Java.
    HE WILL NOT LEARN FROM YOU CODING FOR HIM
     
  11. Offline

    boomboompower

  12. Offline

    Scimiguy

  13. Offline

    Protophite

    glad I wasn't the only one thinking that.
     
Thread Status:
Not open for further replies.

Share This Page