Per World Chat - Crash when adding new plugin

Discussion in 'Plugin Development' started by Plo124, Nov 8, 2013.

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

    Plo124

    Hi, I am Dev on a server, and I made a plugin which adds a per-world-chat.
    It all works fine when we have our current plugins, but when I add a new plugin, PermissionsEx says it failed to start, and TabAPI which is causing the problem is failing, and then the plugin doesn't let you chat, because I'm cancelling the Chat Event.

    This is the error, which is when I add another plugin to the server.
    Error (open)

    PHP:
    04.11 20:26:10 [ServerINFO at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    04.11 20:26:10 [ServerINFO at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:421)
    04.11 20:26:10 [ServerINFO at net.minecraft.server.v1_6_R3.MinecraftServer.s(MinecraftServer.java:488)
    04.11 20:26:10 [ServerINFO at net.minecraft.server.v1_6_R3.DedicatedServer.t(DedicatedServer.java:227)
    04.11 20:26:10 [ServerINFO at net.minecraft.server.v1_6_R3.MinecraftServer.t(MinecraftServer.java:524)
    04.11 20:26:10 [ServerINFO at org.bukkit.craftbukkit.v1_6_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:345)
    04.11 20:26:10 [ServerINFO at org.bukkit.craftbukkit.v1_6_R3.scheduler.CraftTask.run(CraftTask.java:53)
    04.11 20:26:10 [ServerINFO at com.plo.chatChannels.PloPlugin.ChatChannels$2.run(ChatChannels.java:108)
    04.11 20:26:10 [ServerINFO at com.plo.chatChannels.PloPlugin.ChatChannels.updateTabList(ChatChannels.java:690)
    04.11 20:26:10 [ServerINFO at ru.tehkode.permissions.bukkit.PermissionsEx.getUser(PermissionsEx.java:214)
    04.11 20:26:10 [ServerINFO at ru.tehkode.permissions.bukkit.PermissionsEx.getPermissionManager(PermissionsEx.java:203)
    04.11 20:26:10 [ServerINFO ru.tehkode.permissions.exceptions.PermissionsNotAvailablePermissions manager is not accessableIs the PermissionsEx plugin enabled?
    04.11 20:26:10 [ServerWARNING Task #24 for Chat v0.0.1 generated an exception
    04.11 20:26:05 [ServerINFO at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    04.11 20:26:05 [ServerINFO at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:421)
    04.11 20:26:05 [ServerINFO at net.minecraft.server.v1_6_R3.MinecraftServer.s(MinecraftServer.java:488)
    04.11 20:26:05 [ServerINFO at net.minecraft.server.v1_6_R3.DedicatedServer.t(DedicatedServer.java:227)
    04.11 20:26:05 [ServerINFO at net.minecraft.server.v1_6_R3.MinecraftServer.t(MinecraftServer.java:524)
    04.11 20:26:05 [ServerINFO at org.bukkit.craftbukkit.v1_6_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:345)
    04.11 20:26:05 [ServerINFO at org.bukkit.craftbukkit.v1_6_R3.scheduler.CraftTask.run(CraftTask.java:53)
    04.11 20:26:05 [ServerINFO at com.plo.chatChannels.PloPlugin.ChatChannels$2.run(ChatChannels.java:108)
    04.11 20:26:05 [ServerINFO at com.plo.chatChannels.PloPlugin.ChatChannels.updateTabList(ChatChannels.java:690)
    04.11 20:26:05 [ServerINFO at ru.tehkode.permissions.bukkit.PermissionsEx.getUser(PermissionsEx.java:214)
    04.11 20:26:05 [ServerINFO at ru.tehkode.permissions.bukkit.PermissionsEx.getPermissionManager(PermissionsEx.java:203)
    04.11 20:26:05 [ServerINFO ru.tehkode.permissions.exceptions.PermissionsNotAvailablePermissions manager is not accessableIs the PermissionsEx plugin enabled?


    As you can see, there are a few errors, which I will post the ones in my code:

    Line #108
    Code:java
    1. TabAPI.setPriority(Bukkit.getPluginManager().getPlugin("Chat"), p, 2);

    The whole Method
    Code:java
    1. Bukkit.getScheduler().runTaskTimer(this, new Runnable(){
    2. public void run(){
    3. for (Player p : Bukkit.getOnlinePlayers()){
    4. TabAPI.clearTab(p);
    5. TabAPI.setPriority(Bukkit.getPluginManager().getPlugin("Chat"), p, 2);
    6. if (minutes > 1){
    7. TabAPI.setTabString(Bukkit.getPluginManager().getPlugin("Chat"), p, 2, 2, "§6§l>>§7"+minutes+"mins");
    8. } else {
    9. TabAPI.setTabString(Bukkit.getPluginManager().getPlugin("Chat"), p, 2, 2, "§6§l>>§7"+seconds+"secs");
    10. }
    11. updateTabList(p, false);
    12. TabAPI.updatePlayer(p);
    13. }
    14. }
    15. },0L, 100L);


    Here is the other part, I don't know which one is line #690, because I modified the code, and added a web-chat system.
    Code:java
    1. public void updateTabList(Player pl, Boolean bl){
    2. PermissionUser pm = PermissionsEx.getUser(pl);
    3. if (pm.has("eminent.staff") && !staff.contains(pl.getName())){
    4. staff.add(pl.getName());
    5. }
    6. if (staff.contains(pl.getName()) && bl){
    7. staff.remove(pl.getName());
    8. }
    9. updateTab(pl);
    10. }
    11. public void updateTab(Player pl){
    12. World wl = pl.getWorld();
    13. int x =-1;
    14. int y = 7;
    15. TabAPI.setTabString(this, pl, 0, 1, "§9§lEminentCraft", 1);
    16. TabAPI.setTabString(this, pl, 1, 0, "§d§lStaff online", 1);
    17. int length = 0;
    18. for (String s : staff){
    19. if (length < 4 && Bukkit.getOfflinePlayer(s).isOnline() && pl.canSee(Bukkit.getPlayer(s)) ){
    20. TabAPI.setTabString(this, pl, length+2, 0, "§6§l>>§7"+s, 1);
    21. length++;
    22. }
    23. }
    24. TabAPI.setTabString(this, pl, 1, 1, "§d§lYour Server", 1);
    25. TabAPI.setTabString(this, pl, 0, 0, "", 1);
    26. TabAPI.setTabString(this, pl, 2, 1, "§6§l>>§7"+filterWorld(pl.getWorld().getName()), 1);
    27. TabAPI.setTabString(this, pl, 6, 0, "§d§lHub players", 1);
    28. TabAPI.setTabString(this, pl, 1, 2, "§d§lRestarting", 1);
    29. for (Player p : wl.getPlayers()){
    30. x++;
    31. if (x == 3){
    32. x=0;
    33. y++;
    34. }
    35. if (y < 21){
    36. TabAPI.setTabString(this, pl, y, x, p.getName(), 1);
    37. }
    38. }
    39. }


    So the problem for me is TabAPI and PermissionsEx, and adding another plugin.

    If you require further info, please ask below, and I would like an answer soon please [diamond]
     
  2. Offline

    Ytry

    Do you have vault installed?
     
  3. Offline

    Plo124

    Ytry
    Thanks for the quick reply
    I do have vault on the server, but its not included in by Build-Path, nor do I implement it in my plugin anywhere

    **** Edit ****
    I use the PermissionsEx API
     
  4. Offline

    sgavster

    this is what I would do for multiworld chat (I couldn't read the whole thread, sorry.)
    PHP:
        @EventHandler
        
    public void onChat(AsyncPlayerChatEvent e)
        {
            
    Player p e.getPlayer();
            
    String m e.getMessage();
            
    World w p.getWorld();
            
    e.setCancelled(true);
            for(
    Player o Bukkit.getOnlinePlayers())
            {
                if(
    o.getWorld().equals(w))
                {
                    
    o.sendMessage("Insert your wanted format here " m);
                }
            }
        }
     
    //UNTESTED!!!!!!!
     
  5. Offline

    Plo124

    sgavster
    Yes, that's what I do, and some extra chat features, like a staff-chat.
    The problem is the plugin doesn't initialise properly, and it manages the chat, so it cancels the chat, then it tries to get the Pex data for the player, but it can't do that, so it doesn't let you chat.
     
  6. Offline

    Plo124

  7. Offline

    Plo124

  8. Offline

    Plo124

  9. Offline

    Plo124

  10. Offline

    Plo124

  11. Offline

    sgavster

    Plo124 Something is wrong with PEX not being enabled. I think?
    and nice job on bumping, you didn't do it every 10 seconds!
    *highfive*
     
  12. Is peremissionsEx listed inside your depend or softdepend node inside plugin.yml, else the load order of your plugin and permissionsex may be random
     
  13. Offline

    Plo124

    ferrybig
    Good idea, I will check that out :3

    **** Edit ****
    Yes, I already did
     
  14. Offline

    Plo124

  15. Offline

    Plo124

  16. Offline

    Plo124

  17. Offline

    Plo124

  18. Offline

    iWareWolf

    Are you using the correct versions for the plugins needed? It could be outdated or too updated lol..
     
  19. Offline

    Plo124

    iWareWolf
    Yes, I am using the latest Bukkit API and CraftBukkit
     
  20. Offline

    Cirno

    Please actually look at the date he posted them, and reconsider editing the last part out. Just saying.

    Anyways, it might be due to a conflicting plugin. Check with the server owner to see if he's using other plugins; I know Multiverse toys with the chat format.
     
  21. Offline

    Plo124

    Cirno
    The problem is due to TabAPI, and I added this myself to the server, it wasn't already added from another plugin
     
  22. Inside plugin.yml, I mostly wrte depends wrong (was it depend or depends?) can you check if this mistake is also inside your plugin.yml

    [offtopic]Sorry for this late answer after tagging me, it was my b-day yesterday[/offtopic]
     
  23. Offline

    Plo124

    ferrybig
    I wrote it correctly, and Pex starts before my plugin
     
  24. Offline

    Goblom

    Plo124
    Code:
    [Server] INFO ru.tehkode.permissions.exceptions.PermissionsNotAvailable: Permissions manager is not accessable. Is the PermissionsEx plugin enabled?
    There is something wrong with your pex configuration, or something wrong with how your plugin interacts with PEX
     
  25. Offline

    Plo124

    Goblom Could it be a problem with spaces? Cuz that's what breaks YAML is the tab key vs spaces
     
  26. Offline

    Goblom

    Plo124 I Would check that just in case. But if it was a problem with YAML then Pex would be throwing errors up the wazu
     
  27. Offline

    Plo124

    Goblom Pex doesn't throw errors normally, only when I add a new plugin.
     
  28. Offline

    Plo124

Thread Status:
Not open for further replies.

Share This Page