Solved OfflinePlayer Help

Discussion in 'Plugin Development' started by BaconStripzMan, Mar 3, 2015.

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

    BaconStripzMan

    So I'm working on a server hub plugin for the server I'm dev on. It works fine but when you do /ban player reason or /unban player you have to use capitals correctly otherwise
    Code:java
    1.  
    2. if(!rs.next()) {
    3. sender.sendMessage(error + "ยง7This player does not exist!");
    4. }

    This will run because obviously if I put /ban baconstripsman reason it's gonna be able to find BaconStripsMan but not baconstripsman

    So is there a way I can make it not worry about this while still working?

    BTW This is what I'm executing with MySQL
    Code:java
    1.  
    2. ps = c.prepareStatement("SELECT * FROM `minedom` WHERE uuid='" + p.getUniqueId().toString() + "';");
    3. //and this is how I grab the player
    4. OfflinePlayer p = Bukkit.getOfflinePlayer(args[0]);
    5.  
     
    Last edited by a moderator: Mar 4, 2015
  2. Offline

    xTrollxDudex

    You will need to iterate through the online players and check the individual names of each with equalsIgnoreCase(), because I don't know of any Bukkit method that does ignore case.
     
  3. Offline

    BaconStripzMan

    It works fine with capitalization when they're online but when they're offline
    If there is no way its fine
     
  4. Offline

    DannyDog

    @BaconStripzMan
    So typing the player's name with the proper capitalization works?
    I don't see why equalsIgnoreCase() wouldn't work.
     
  5. loop all offline players xD
     
  6. Offline

    BaconStripzMan

    I use UUID..

    and how would that work exactly? I use UUIDs
     
    Last edited by a moderator: Mar 4, 2015
  7. Online

    timtower Administrator Administrator Moderator

    @BaconStripzMan Please use the edit button instead of double posting.
    And this:
    Code:
    for(uuid someuuid:list){
    Offlineplayer p = server.getofflineplayer(someuuid);
    //do stuff
    }
     
  8. Offline

    BaconStripzMan

    Don't worry about it, the server owner said it's ok, he doesn't care
     
  9. Offline

    teej107

  10. Offline

    BaconStripzMan

Thread Status:
Not open for further replies.

Share This Page