[LIB] GhostFactory - Make players look like ghosts

Discussion in 'Resources' started by lenis0012, May 24, 2013.

Thread Status:
Not open for further replies.
  1. Am I the only one that can't get this working in 1.7? Players are fully invisible, not half opaque
    EDIT: Just me being stupid, I did ghostManager.addPlayer but forgot about ghostManager.setGhost
  2. Offline

    Codex Arcanum

    Techy4198 Conarnar
    Not sure how much either of you care, since this was off topic and is several months old, but I want to comment for the record that Conarnar is correct - boolean statements using && don't evaluate the right side if the left is false. If you want both sides to execute, you can use a bitwise and statement (just one ampersand). I just went and tested to make sure I wasn't making a mistake. Code below. Apologies for the off topic post.
    Show Spoiler

    public class mainclass {
        public static void main(final String[] args){
           if(a() & b()){
       publicstaticboolean a(){
          System.out.println("A has been called!");
       publicstaticboolean b(){
          System.out.println("B has been called!");
    octoshrimpy likes this.
  3. Offline


    I added Comphenix his code on the top for now.
    I will take a look at all reported issues this weekend
  4. Offline


    Am I the only one having issues with getting this to work with 1.7? Players are only fully invisible, and yes, I am using "ghostManager.setGhost(Player player, boolean b)".
  5. Offline


    Nope, I'm having problems too, Idk why.
  6. Offline


    hmm i dont know sir.
    Works fine on my side.

    Ill update the post soon
  7. Offline


    Hello Comphenix,

    I use your version of GhostFactory. It works perfectly fine, but when I create a scoreboard for every single player on the server, then you are no longer a ghost. I guess there is no solution for this, right?
  8. Offline


    Why do you need to create a scoreboard for each player? To display custom information?

    If so, I refer you to this post I made earlier in this thread. It's usually not possible to combine GhostTracker with other uses of the scoreboard.
  9. Offline


    Ok thanks. Yes I need it to display custom information.
  10. Offline


    Ah, ok. No, sorry, you can't do that and use GhostTracker at the same time.
  11. Offline


    I think it is possible if you would use packets for GhostFactory. NametagEdit does use packets and the effect is that you can use a scoreboard and nametagedit. Could you create a version of GhostFactory that uses packets?

  12. Offline


    You should be.
    I dont think teams depend on existing scoreboard.
    But it can be that the scoreboard instance was changed for the player
  13. Offline


    Sorry, I am not knowledgeable with all of this coding stuff but is there a way to combine GhostFactory/GhostPlayer to MassiveVampires? http://dev.bukkit.org/bukkit-plugins/vampire/

    I want players that are vampires to have access to ghost player but not for players that are not vampires.
  14. Offline


    Would require either a change in GhostPlayer or in Vampires.
    I would contact the GhostPlayer developer tho

    I may remake it with packets so that it does not have confilcts with other scoreboard systems

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 1, 2016
  15. Offline


  16. Offline


    This is not working for me, there is no method called "create()", and also this.ghostFactory = new GhostFactory(this, true), isn't working either; when I add a boolean, it will be underlined red.
  17. Offline


    I have got the same problem is there a fix?
  18. Offline


    macboinc TheGamblingMan

    Just do:
    this.ghostFactory = new GhostFactory(this);
    There is no constructor with the boolean argument in the newest version of GhostFactory. Nows, ghosts in their invisible state can only be seen by other ghosts in the factory list.
    Skyost likes this.
  19. Offline


  20. Offline


    Please don't comment if you have nothing nice to say! :)
  21. Offline


    I have already made that but i wanted to know if it's right :)
  22. Offline


    Hi!, does anyone could tell me please if possible make a ghost less transparent?
  23. Offline


    Could it bee possible that that doesn't work because i only see myself so transperent but others are fully invisible
  24. Offline


    Not that I'm aware of.

    If others are fully transparent, then you are either not in the same scoreboard team, or some shenanigans happened with set.CanSeeFriendlyInvisibles(true).

    I found this library rather confusing, and some of the methods weren't updated (see comment above by macboinc. That got me too), so I used it as a base to make something a bit simpler for the nubs like me. Here you go. Untested as of now, I'll be editing it a bit when I have time to throw it in a plugin. Tested and edited.

    2. //stick this in your main
    3. private Team ghostTeam;
    5. //stick this in onEnable();
    6. makeTeam();
    8. //stick this at the bottom of your code
    10. public void makeTeam(){
    12. Scoreboard board = Bukkit.getServer().getScoreboardManager().getMainScoreboard();
    13. ghostTeam = board.getTeam("ghosts");
    14. if(ghostTeam == null){
    16. ghostTeam = board.registerNewTeam("ghosts");
    17. }
    18. ghostTeam.setCanSeeFriendlyInvisibles(true);
    19. }
    21. public void makeGhost(Player player){
    23. if(!ghostTeam.hasPlayer(player)){
    24. ghostTeam.addPlayer(player);
    25. }
    26. player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 15));
    27. //player.sendMessage("now a ghost");
    28. }
    30. public void makeSolid(Player player){
    32. if(!ghostTeam.hasPlayer(player)){
    33. ghostTeam.addPlayer(player);
    34. }
    35. player.removePotionEffect(PotionEffectType.INVISIBILITY);
    36. //player.sendMessage("now solid");
    37. }
    39. public boolean checkGhost(Player player){
    41. if(player == null || !(ghostTeam.hasPlayer(player))){
    42. return false;
    43. }else{
    44. return true;
    45. }
    46. }
    48. public void addTeam(Player player){
    50. ghostTeam.addPlayer(player);
    52. //player.sendMessage("you were added to the ghost team");
    53. }
    55. public void removeTeam(Player player){
    57. ghostTeam.removePlayer(player);
    59. //player.sendMessage("you were removed from the ghost team");
    60. }


    There are 3 states of being, in this code: Not in the team, in the team & transparent, in the team & solid. Because those not in the team cannot see the transparent ones in the team, I will only use the first state (not in team) as a scapegoat for things like being in another world.

    makeTeam(); - Starts scoreboard up, and creates a team named "ghosts" if the team didn't exist already. Since onEnable is the first thing to run (usually), making sure this gets done first is a really good idea.

    makeGhost(Player player); - Has an IF statement that checks if the player you're making a ghost is in the team already. If he isn't it adds the player in to the team, since you cannot be a ghost without being in the team. Then, it adds infinite (Integer.MAX_VALUE) invisibility to said player. From my experience, all those nested PotionEffectTypes are needed.

    makeSolid(Player player); - Ignoring that first state we mentioned earlier, being a solid person that can still see ghosts is going to to require the same IF statement said above, and then at the end, we remove the potion effect.

    checkGhost(Player player); - Does exactly what is says. IF player doesn't exist (== null) OR is not in the team, return false. Otherwise, return true.
    (Use like: if(checkGhost(ThisIsMyUsername)==true){do something})

    addTeam(); and removeTeam(); - Not practical, since ghostTeam.addplayer(); is just as easy, but I use it along with sending a message repetitively in a plugin, so I added them in.

    Hope I helped a bit. :D


    Fixed the java after some testing. Works for what I want it to do, so I stopped testing. Never actually called checkGhost(); Am I doing something wrong here? (there's always something :p )
    TheGamblingMan likes this.
  25. Offline


    thanks i will test it if i notice something i will tell you :D
    octoshrimpy likes this.
  26. Offline


    I don't know why but i can't see the other ghosts

    Every time when somen should get a ghost i wrote makeghost but everyone sees himself transparent and no one else
  27. Offline


    TheGamblingMan Let's start off from the beginning, shall we?

    Do have makeTeam(); in your onEnable?

    are you in the team? Can't see transparent people unless you're in the team.

    What do you mean by that? that everyone else in the team (ghost&solid) see them but anyone else doesn't?
    Or that they see each themselves as invisible, but each ghost does not see anyone else who is ghost?

    Any errors being spit out?
  28. Offline


    Yes i have the makeTeam(); in my onEnable

    I should be in the Team because i see myself transperent

    And they see each themselves as invisible, but each ghost does not see anyone else who is ghost

    And no errors
  29. Offline


    TheGamblingMan Which version of minecraft/bukkit/CB are you using? (both as reference and server) You see yourself as translucent, so you're in the team, others seeing themselves as invisible, would mean (and I'm assuming here) that they are not in the team. I'm using it in a plugin of mine, and it seems to work fine. Send your code this way, let's get this figured out. :)
  30. Offline


    i mean everyone sees themselves as transperent and use the newest version of bukkit
Thread Status:
Not open for further replies.

Share This Page