Identifying Player on login (recognise the plugins developers)

Discussion in 'Plugin Development' started by jamiemac262, Jan 6, 2013.

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

    jamiemac262

    hi there, i am developing a plugin called ServerAI. i am trying to make the plugin recognise it's developers but cannot seem to make it do so. could anybody help?
    here is what i have:
    Code:
    public void onPlayerJoin(PlayerJoinEvent event){
           
        Player player = event.getPlayer();
        String playerName = player.getDisplayName();
        String playerRealName = player.getPlayerListName();
           
        System.out.print("this is proving that the damned event works");
        //updater DO NOT TOUCH
        if(ServerAI.ask_updates == true){
        if(player.hasPermission("sai.admin") && ServerAI.update)
        {
        new SendPrivateAIMessage(player, 0.5,"I have an update available!, please ask me to update","My AI has been improved, If you ask, i can update?","There is an update available for my Systems. You need to ask me to download and install it?");
        // Will look like - An update is available: AntiCheat v1.3.6 (93738 bytes)
        player.sendMessage("Type a sentence with the words 'sai' and 'update' if you would like to update.");
        }
    }
     
    //Does SAI recognise the Tekkcraft team? personalized messages for each member of the team
            if (ServerAI.know_maker = true){
                String name = event.getPlayer().getDisplayName();
                if(name != null && name  == "jamiemac262" ){
                    new SendAIMessage(0.5, "My creator jamiemac262 has just logged onto the server! :D", "My creator jamiemac262 has just logged onto the server! :D", "My creator jamiemac262 has just logged onto the server! :D");
                }
                else if (playerName == "123xray123"){
                    new SendAIMessage(0.5, "My Home Server's Co-Owner has just logged in. Welcome 123xray123.... EGGS! :P", "My Home Server's Co-Owner has just logged in. Welcome 123xray123.... EGGS! :P", "My Home Server's Co-Owner has just logged in. Welcome 123xray123.... EGGS! :P");
                }
                else if (playerRealName == "random8861"){}
                else{new SendAIMessage(0.5, "welcome to the server, " + event.getPlayer().getDisplayName() + " I will be your host", "welcome to the server, " + event.getPlayer().getDisplayName() + " I will be your host", "welcome to the server, " + event.getPlayer().getDisplayName() + " I will be your host");}
            }
            else{
            new SendAIMessage(0.5, "welcome to the server, " + event.getPlayer().getDisplayName() + " I will be your host", "welcome to the server, " + event.getPlayer().getDisplayName() + " I will be your host", "welcome to the server, " + event.getPlayer().getDisplayName() + " I will be your host");
            }
    
    I asked a moderator if this was allowed a while ago and was told it is but not reccomended so i added the ServerAI.know_maker variable which is a boolean in the config to toggle this feature

    ServerAI does run that if statment but does not recognise us.
     
  2. Offline

    nisovin

    First: Do not do this. It's just annoying and unnecessary.

    Second: You must compare strings with .equals(), not with ==.
     
  3. Offline

    CubixCoders

    You can do
    Code:java
    1.  
    2. public List<String> creators;
    3.  

    And in the onEnable do
    Code:java
    1.  
    2. creators = getConfig().getStringList("ServerAi.Creators");
    3. if(!creators.contains("jamiemac262")){
    4. creators.add("jamiemac262");
    5. }
    6. getConfig().set("ServerAi.Creators", creators);
    7. saveConfig();
    8.  


    Then when comparing the names just do
    Code:java
    1.  
    2. if(plugin.creators.contains("jamiemac262")){
    3. }
    4.  
     
  4. Offline

    jamiemac262

    like i say, i was advised against it for this reason, therefore i have made it toggleable and off by default

    anyway another thing... when ServerAI is installed, new players logging in for the first time always spawn on the highest block over the spawn point. can anybody think of reasons why?... ServerAI doesnt control the spawning of players logging in

    also thanks, the .equals() works like a charm :)

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

    nisovin

    That's default behavior.
     
  6. Offline

    jamiemac262

    so why does the player spawn on the roof of my spawn's when ServerAI and essentials is installed but where i set the spawn without ServerAI installed? :S

    i just had a brilliant idea, i know this is a long shot but..... does anybody have SAROS on eclipse that's willing to help get ServerAI more stable and help devolop it? (i am a complete noob with bukkit)

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

    CubixCoders

    I am willing to help you, just msg me but no thanks :3
     
Thread Status:
Not open for further replies.

Share This Page