[Util] Set a Player's Boss Bar [NMS]

Discussion in 'Resources' started by bigteddy98, Mar 16, 2014.

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

    bigteddy98

    This resource is no longer available.
     
    Skyost and SpiritGamerr like this.
  2. Offline

    Ultimate_n00b

    Just a force of habit, but you should release one without reflection as well.
     
  3. Why may I ask? I mean, isn't it better WITH reflection because then you wouldn't need to update the plugin every new bukkit version? o.o

    Anyway, nice work. I'd still prefer to just rely on BarAPI, but if they do discontinue we could always use this.
     
    TigerHix and SpiritGamerr like this.
  4. Offline

    osnapitzcookies

    Hey,

    I've ALWAYS wanted to make a plugin like this but I don't know how...
    With the pastebin thing you gave us, where do I put it?
    Thanks :)

    COOKIES!!! Mmm... xD :p
     
  5. Offline

    Garris0n

    Reflection is a lot slower, for one. Using NMS would make this far more efficient. In addition, the package names were added for a reason. It forces developers to update their generally hacky NMS code to ensure it doesn't break anything. Using reflection bypasses it and makes the plugin unsafe all over again. What if somebody using your plugin updates and the reflection that normally, say, refreshed chunks for players now corrupts them instead. The client didn't know to update the plugin to a new version and because it's using reflection the package names didn't stop it from doing damage.
     
    Ultimate_n00b likes this.
  6. Well that sucks for developers :/ Although, it's all about the clients.
     
  7. Offline

    Garris0n

    Ensuring your potentially dangerous code works each update before letting people use it makes perfect sense to me. And, as I said, reflection is slow.
     
  8. Offline

    Ultimate_n00b

    KingFaris11 likes this.
  9. Offline

    Garris0n

    gasp
     
    Msrules123, glen3b and KingFaris11 like this.
  10. Alternatives? I love Bukkit but I don't like being limited that much. =P
    I understand that but what IF a plugin DOES work in the new update as it uses bare minimum NMS code, developers would have to go through the hassle of updating it every time. Also, by reflection being slow I'm sure you're talking milliseconds, not very big in-game...
     
  11. Offline

    Ultimate_n00b

    KingFaris11 Alternative? It's called making an API just for what you need. As well, milliseconds are huge when you're running a larger server. 1 or 2, meh. 50 or 60? Starts to be noticable.
     
  12. I don't want to go off-topic, but are you sure? I've ran servers with over 150 players, and it's not very noticeable, probably does when it gets to 200 such as MeepCraft (500) or just the fact that the milliseconds was only a few and not 500+... Also, meh I can't be bothered. Just going to stick to staying away from NMS and Reflection.
     
  13. Is it possible to make the bar half full with this class?
     
  14. Offline

    ToastHelmi

    is this supportet by the current beta build?
     
  15. Offline

    bigteddy98

    Yes it is
     
  16. Offline

    ToastHelmi

    bigteddy98
    well it works now but my server-console is full with this

    Code:java
    1. [19:24:11] [Server thread/WARN]: java.lang.reflect.InvocationTargetException
    2. [19:24:11] [Server thread/WARN]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    3. [19:24:11] [Server thread/WARN]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    4. [19:24:11] [Server thread/WARN]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    5. [19:24:11] [Server thread/WARN]: at java.lang.reflect.Method.invoke(Unknown Source)
    6. [19:24:11] [Server thread/WARN]: at me.ToastHelmi.GrandTheftMinecart.NMS.BossBarFactory.changeWatcher(BossBarFactory.java:126)
    7. [19:24:11] [Server thread/WARN]: at me.ToastHelmi.GrandTheftMinecart.NMS.BossBarFactory.setBossBar(BossBarFactory.java:107)
    8. [19:24:11] [Server thread/WARN]: at me.ToastHelmi.GrandTheftMinecart.NMS.BossBarFactory$1.run(BossBarFactory.java:75)
    9. [19:24:11] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftTask.run(CraftTask.java:53)
    10. [19:24:11] [Server thread/WARN]: at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:345)
    11. [19:24:11] [Server thread/WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:587)
    12. [19:24:11] [Server thread/WARN]: at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:250)
    13. [19:24:11] [Server thread/WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:545)
    14. [19:24:11] [Server thread/WARN]: at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:457)
    15. [19:24:11] [Server thread/WARN]: at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617)
    16. [19:24:11] [Server thread/WARN]: Caused by: java.lang.NullPointerException
    17. [19:24:11] [Server thread/WARN]: at net.minecraft.server.v1_7_R1.DataWatcher.a(SourceFile:56)
    18. [19:24:11] [Server thread/WARN]: ... 14 more
     
  17. Offline

    bigteddy98

    I think you have players in your factory which aren't online, try removing them when they quit (or on reload).

    Hope it works,
    BigTeddy98, Sander.
     
  18. Offline

    ToastHelmi

    bigteddy98
    now where you say it :D

    i simply copyed your code and doesent have a deep look at it :D

    the problem is that in the task you use all online Player but not all online players have the bar set i think i just add a check if the map contains the name as key perhaps you want to update your code too ;D
     
  19. Offline

    bigteddy98

    Ofcourse, thanks for reporting. I will take a more clear look at it in a moment.
     
  20. Offline

    ToastHelmi

    bigteddy98
    This is my code for removeing the BossBar
    Code:java
    1. public void removeBossBar(Player p){
    2. playerText.remove(p.getName());
    3. ((EntityEnderDragon)playerDragons.remove(p.getName())).die();
    4. }


    but fore some reson the last text displayed stays
     
  21. Offline

    bigteddy98

    You will have to send the PacketPlayOutEntityDestroy packet with the id of the enderdragon, which is not supported yet by this class.
     
    ToastHelmi likes this.
  22. Offline

    ToastHelmi

    which was not supportet in this class :p
     
    bigteddy98 likes this.
  23. Offline

    Skyost

    bigteddy98
    Hi !
    I have suggestion : Add the life amount :)
    That's all ^^
     
Thread Status:
Not open for further replies.

Share This Page