Solved [FACTION][HELP]How to check if a player is a faction leader?

Discussion in 'Plugin Development' started by lolgrapig112, Dec 24, 2012.

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

    lolgrapig112

    Dear,

    I would like to check if a player in a faction is a faction leader. thats all ;)
    I already attached the faction libary.

    Greetz,
    lolgrapig112

    p.s. merry cristmas
     
  2. Offline

    fireblast709

  3. Offline

    mythcaptor

    fireblast's suggestion returns Factions's FPlayer which probably isn't what you want. I'm also developing for factions, and while a little messy, this code works fine to check if a player is a leader.
    Code:java
    1. import com.massivecraft.factions.P;

    Code:java
    1.  
    2. public static Boolean isFactionLeader(Player p){
    3. StringBuilder faction = new StringBuilder();
    4. faction.append(P.p.getPlayerFactionTag(p));
    5. if(faction.charAt(0) == ('*') && faction.charAt(1) == ('*')){
    6. return true;
    7. }
    8. return false;
    9. }
    10.  
     
  4. Offline

    lolgrapig112

    Hey both I used fireblasts link and that worked fine it is also compact. But thanks :)

    Code:
    if (me.getRole() == Rel.LEADER){
    Thats is what is used.

    Greetz and merry cristmas,
    lolgrapig112
     
  5. Offline

    fireblast709

    Well FPlayer is the link between Factions and Player ;3
     
  6. Offline

    lolgrapig112

  7. Offline

    mythcaptor

    Ah, thanks, you've inadvertently helped me as well, I only looked at Faction's main class, so I'm only using methods from there, and my code is messy. Your method is indeed more efficient :3
     
Thread Status:
Not open for further replies.

Share This Page