"Ghost" players help

Discussion in 'Plugin Development' started by rfsantos1996, Jul 23, 2014.

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

    rfsantos1996

    I tried.. I tried for a long time, I tried several times...

    BUT I CAN'T GET THIS THING WORKING...

    Well, here we go. I'm creating a custom plugin for my personal server (4 de funz mostly, but I like to make good things and not shitty plugins, even [or should I say, specially] for myself).

    I tried using getServer.getScoreboardManager.getMain and New scoreboards.. I tried setting all Team values, I tried setting just what I need (allow friendly fire = true and can see friendly invisible = true)

    My listener class:
    Code:java
    1. private final Team team;
    2.  
    3. public InvisibilityController() {
    4. team = pl.getServer().getScoreboardManager().getMainScoreboard().registerNewTeam("CustomServer"); // "invisibilityTeam" was already used lol
    5. // Tried using getMain and getNew, with variable allong with event.getPlayer().setScoreboard or without it
    6. team.setAllowFriendlyFire(true);
    7. team.setCanSeeFriendlyInvisibles(true);
    8. }
    9.  
    10. @EventHandler // Is this Listener registered? yeah yeah, all works normally
    11. public void onJoin(PlayerJoinEvent event) {
    12. Jogador jogador = CustomServer.getJogador(event.getPlayer());
    13. //event.getPlayer().setScoreboard(scoreboard); // tried using a scoreboard variable, but I belive this isn't needed at all, but I did with this uncommented either
    14. team.addPlayer(event.getPlayer());
    15. if(jogador.getTimeUntilRespawn() < 0)
    16. jogador.setPotionVisible();
    17. }


    Jogador's methods used on this:
    Code:java
    1. public void setPotionInvisible() {
    2. player.addPotionEffect(PotionEffectType.INVISIBILITY.createEffect(Integer.MAX_VALUE, 15)); // tried using a non-absurd value like TimeUnit.MINUTES.toSeconds(3) * 20 (since it is in ticks, and obviously casted as an int), and using the amplifier value as 0 too
    3. }
    4.  
    5. public void setPotionVisible() { // See OBS1 on thread
    6. if(player.hasPotionEffect(PotionEffectType.INVISIBILITY))
    7. player.removePotionEffect(PotionEffectType.INVISIBILITY);
    8. }


    OBS1: I know jogador.setPotionVISIBLE is called on join, but I call invisible on my custom death event, not on join anyway, I don't mind he rejoined the server as a non-ghost, but I use setPotionInvisible on the death...

    So, I AM SURE THAT:
    * Player is on the team
    * Team is registered and canSeeFriendlyInvisibles = true
    * Player is actually invisible (I can see the potion effect on inventory open)
    * I love cookies ;3

    Thank you for at least reading the thread
     
  2. Offline

    xTigerRebornx

    rfsantos1996 Do you ever set the scoreboard for the Player?
     
  3. Offline

    rfsantos1996

    yeah, I tried setting the scoreboard for the player, and tried without it either (I would really like to see invisible players without needing to set the scoreboard, do you know if this is possible?)

    @EDIT: I'll sleep now, see you and other repliers (if any) in ~7-8 hours
     
  4. Offline

    xTigerRebornx

    rfsantos1996 Packets to fake the scoreboards (look at GhostFactory or other libs), intercept potion packets for invisibility and don't send them to team members.
    You need to make sure the scoreboard is set for the ones you want to be able to see the transparent players.
     
  5. Offline

    rfsantos1996

    Well, using packets will be a little tricky, but I think i'll give up on this feature... I used the same code on the past version (a month ago and it worked fine...) Thanks for your help (;
     
Thread Status:
Not open for further replies.

Share This Page