It worked before

Discussion in 'Plugin Development' started by Saturisk, Feb 26, 2011.

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

    Saturisk

    I feel ever so stupid for not being able to figure this out, but i get the normal 'you screwed up stupid' when i try to run this plugin, and it's wierd because it's very basic.
    Code:
    //The Package
    package com.bukkit.shawn.Basic;
    import org.bukkit.event.Event;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.plugin.PluginManager;
    /**
    * Basic for Bukkit
    *
    * @author Saturisk
    */
    //Starts the class
    public class Basic extends JavaPlugin{
        //Links the BasicPlayerListener
        private final BasicPlayerListener playerListener = new BasicPlayerListener();
        @Override
        //When the plugin is disabled this method is called.
        public void onDisable() {
        }
        @Override
        //When the plugin is enabled this method is called.
        public void onEnable() {
            //Create the pluginmanage pm.
            PluginManager pm = getServer().getPluginManager();
            //Create PlayerCommand listener
            pm.registerEvent(Event.Type.PLAYER_COMMAND, this.playerListener, Event.Priority.Normal, this);
            pm.registerEvent(Event.Type.PLAYER_JOIN, this.playerListener, Event.Priority.Normal, this);
          //Get the infomation from the yml file.
            PluginDescriptionFile pdfFile = this.getDescription();
            //Print that the plugin has been enabled!
            System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
        }
    }
    Code:
    //The Package
    package com.bukkit.shawn.Basic;
    //All the imports
    import org.bukkit.entity.Player;
    import org.bukkit.event.player.PlayerChatEvent;
    import org.bukkit.event.player.PlayerListener;
    import org.bukkit.event.player.PlayerLoginEvent;
    import org.bukkit.ChatColor;
    //Starts the class BasicPlayer listener
    public class BasicPlayerListener extends PlayerListener{
    
          //This method is called whenever a player uses a command.
              public void onPlayerJoin(PlayerLoginEvent event) {
    
                  Player player = event.getPlayer();
    
                  player.sendMessage(ChatColor.GREEN + "Welcome to the server " + player.getName() + ", please type '/rules' for the guidelines on this server");
     
              }
    
            public void onPlayerCommand(PlayerChatEvent event) {
              //Make the message a string.
                String[] split = event.getMessage().split(" ");
                //Get the player that talked.
                Player player = event.getPlayer();
                //If the first part of the string is /basic or /b then do this.
                if (split[0].equalsIgnoreCase("/rules")) {
                    player.sendMessage(ChatColor.GREEN + "[1] Don't destroy what isn't yours without permission");
                    player.sendMessage(ChatColor.GREEN + "[2] Don't nag other players to help you or give you stuff");
                    player.sendMessage(ChatColor.GREEN + "[3] Have fun");
                    player.sendMessage(ChatColor.GREEN + "[4] No Griefing");
                    player.sendMessage(ChatColor.GREEN + "[5] To see a list of commands type '/commands'");
     
                }
    
                if (split[0].equalsIgnoreCase("/commands")) {
    
                    player.sendMessage(ChatColor.GREEN + "Coming soon once i set up everything.");
    
                }
    
          }
    }
    this is my basic
    and this is my playerListener
    It gives me the severe warnings, and it's not my YML file, did i set up something wrong?
     
  2. Offline

    Edward Hand

    Last edited by a moderator: May 10, 2016
  3. Offline

    Saturisk

    Edward XD You are now my favorite person

    Really quick how do i say: if(player is an op) i say it like (player.isOp) but it doesn't work.

    Sorry for triple post, but all my plugins have that and it works fine :\

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

    Edward Hand

    Code:
    if(player.isOp())
     
  5. Offline

    Plague

    Edward, that picture, OMG!
     
  6. Offline

    Saturisk

    alright fixed it. Thanks Edward, once again! [​IMG]

    Wow it worked, thanks (not that i was doubting you or anything) But on a side note, when i run my SetSpawn thing, it works but the cmd console says unknown command. What is this?

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

    Edward Hand

    Yeah. It does that. I just ignore it...
     
  8. Offline

    Saturisk

    Alrighty, and good news i got all the plugins that i wanted to build working [​IMG]
     
Thread Status:
Not open for further replies.

Share This Page