[Util] Game Leaderboards *UPDATED (7/13/14)*

Discussion in 'Resources' started by Squid_Boss, Mar 18, 2014.

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

    Squid_Boss

    maved145
    The error is because there are only 2 players in the config, and it's calling for a third when it's not there. No worries. I am working on an updated version of this and that won't be an issue.
     
  2. Offline

    maved145

    Squid_Boss
    Have any ideas of when this will be out?
    And someone told me Collections.sort() would be a idea

    And also i will want to use this in a timer :/
    Im making a plugin to show the top 10 kills on a scoreboard which i will update every 5 minutes with a RepeatingTask.
     
  3. Offline

    Squid_Boss

    maved145
    Hopefully tomorrow if it's cooperative :p. And yeah in the newer version is more developer friendly, and Collections.sort is used.

    Also, in regards to the timer, hopefully the updated version won't cause any issues when in a task, but I will test it out beforehand and let everyone know.
     
  4. Offline

    maved145

  5. Offline

    Squid_Boss

    ==================== UPDATED (7/13/14) =====================
    • More developer friendly
    • One method to create / update a scoreboard
    • Added support for UUIDs in the configuration file

    maved145 Updated. :)
     
  6. Offline

    maved145

    Squid_Boss i love you(No homo) Thanks soooo much man!
     
  7. Offline

    Squid_Boss

  8. Offline

    maved145

    Squid_Boss haven’t tested it yet
    I will now.

    Squid_Boss
    Oh hmm, when i said scoreboards i literally meant scoreboards as in the side scoreboards :/

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

    Squid_Boss

    maved145 Oh, this isn't dealing with scoreboards, this deals with blocks / signs / heads.
     
  10. Offline

    maved145

    Squid_Boss Well i can deal with the scoreboard myself. Ok so how will i go about getting all of this then.
    I have saved the kills in the config like this. Playername: Kills
    So how do i get those kills and put them in order?
     
  11. Offline

    Squid_Boss

    maved145
    I suppose you can tweak my Leaderboards class around about to work for scoreboards and not for blocks / signs / heads. I think the class is fairly easy to follow, so if you just change out the blockstates and locations into scoreboard stuff it should work out.
     
  12. Offline

    BananaBitchs

    this is wont work

    Code:java
    1. Location f = new Location(Bukkit.getWorld("world"), 91, 81,95);
    2. Location s = new Location(Bukkit.getWorld("world"), 91, 80,94);
    3. Location t = new Location(Bukkit.getWorld("world"), 91, 80,96);
    4. for(OfflinePlayer p : Bukkit.getOfflinePlayers()){
    5. Player p1 = p.getPlayer();
    6. new Leaderboard(f, s, t, Material.DIAMOND_BLOCK, Material.IRON_BLOCK, Material.GOLD_BLOCK, BlockFace.WEST, CoinsAPI.getC(), "Coins."+p1.getName());
    7. }
     
  13. Offline

    matanrak

    Try this This worked for me:
    (I Changed my cords to your cords and changed the name of every location to your name to them my code is different)
    Code:
                   
                    Location f = new Location(Bukkit.getWorld("map1"), 91, 81,95);
                    Location s = new Location(Bukkit.getWorld("map1"), 91, 80,94);
                    Location t = new Location(Bukkit.getWorld("map1"), 91, 80,96);
                   
                    new Leaderboard(f , s, t, Material.DIAMOND_BLOCK,Material.IRON_BLOCK , Material.GOLD_BLOCK , BlockFace.WEST ,  getConfig() , "player" );
                   
                    
    WORKED SOO GOOD, your amazing! I will give you credits for your work in my plugin i promise!

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

    Squid_Boss

    BananaBitchs
    You're not supposed to use a player's name / UUID in the configurationStringFormat. Remove the for loop and make the "Coins." + p1.getName() into "Coins.player" Assuming your config is set up like this:
    Code:
    Coins:
        <Playername>: <coins>
     
  15. Offline

    BananaBitchs

    @Squid_Boss
    Code:java
    1. FileConfiguration Players;
    2. OfflinePlayer sd = Bukkit.getOfflinePlayer(topName);
    3. Location f1 = new Location(Bukkit.getWorld("world"), 91, 81,95);
    4. Location s1 = new Location(Bukkit.getWorld("world"), 91, 80,94);
    5. Location t1 = new Location(Bukkit.getWorld("world"), 91, 80,96);
    6. new Leaderboard(f1, s1, t1, Material.DIAMOND_BLOCK, Material.IRON_BLOCK, Material.GOLD_BLOCK, BlockFace.WEST, Players, "Coins."+sd);
     
  16. Offline

    Squid_Boss

    BananaBitchs
    I don't think you understood me. In the configurationStringFormat (The last parameter) it needs to contain the word 'player' as in 'p' 'l' 'a' 'y' 'e' 'r'.
    IF your configuration file is set up like this:
    Code:
    Coins:
        <PlayerName>: <coins>
    THEN the configurationStringFormat needs to be this:
    Code:
    "Coins.player"
    So the new constructor would look like this:
    Code:java
    1. new Leaderboard(f1, s1, t1, Material.DIAMOND_BLOCK, Material.IRON_BLOCK, Material.GOLD_BLOCK, BlockFace.WEST, Players, "Coins.player");

    Do NOT replace the 'player' in "Coins.player" with an actual player's name. Just simply type the word 'player' because the code checks for the WORD 'player' (NOT AN ACTUAL PLAYER NAME), and loops through all of the values it can find to create the leaderboard.

    So your new code would be this (add it in, don't change anything around):
    Code:java
    1. FileConfiguration Players;
    2. Location f1 = new Location(Bukkit.getWorld("world"), 91, 81,95);
    3. Location s1 = new Location(Bukkit.getWorld("world"), 91, 80,94);
    4. Location t1 = new Location(Bukkit.getWorld("world"), 91, 80,96);
    5. new Leaderboard(f1, s1, t1, Material.DIAMOND_BLOCK, Material.IRON_BLOCK, Material.GOLD_BLOCK, BlockFace.WEST, Players, "Coins.player");
     
  17. Offline

    BananaBitchs

    @Squid_Boss

    tnx man work
     
  18. Offline

    TVXtrem

    I don't know why but it isnt working for me. My Config is setup like this:
    Stats.<PlayerUUID>.Punkte: <Integer> and i tried to create a leaderboard like this:

    Code:
    new Leaderboard(l.add(0, 1, 0), l.add(1, 0, 0), l.subtract(0, 0, 1), Material.DIAMOND_BLOCK, Material.IRON_BLOCK, Material.GOLD_BLOCK, BlockFace.NORTH, GMain.getInstance().getConfig(), "Stats.player.integer");
    It would be very cool if someone helps me :) Thanks.

    By the way, here is a picture how the leaderboard looks in game:
    [​IMG]
     
  19. Offline

    Squid_Boss

    Haven't really gotten into MySQL so I'd say no.

    Oh., that's interesting. Let me do some more testing to be 100% sure that UUIDs will work. And it's very strange that there isn't a 2nd and 3rd place as well... *Off to test*.

    TVXtrem
    I tested, and UUIDs should now work. I can't update the pastebin at the moment (20 pastes per 24 hours), so as soon as I can update the pastebin for the class I will edit this post saying so. In the meantime, here is a link to an alternative (lesser known) pasting thing so you won't be empty handed.
    http://tny.cz/387e8577

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

    TVXtrem

    Oh, thanks. I'll try it later. :)

    I found out that i set the configpath wrong, instead of "integer" i had to put in "Punkte", now it shows the Playername and the Points, but it's still only the one Gold Block with the first place. By the way, i don't know why it's a Gold Block because that's actually for the 3rd place... :/

    //EDIT
    Now, there is an error in the log every time the plugin creates the leaderboard:
    Code:
    [16:28:46 WARN]: Couldn't look up profile properties for net.minecraft.util.com.
    mojang.authlib.GameProfile@1505a62[id=245a3be9-9825-38d6-befc-808dd39eeb1e,name=
    Spielgurke,properties={},legacy=false]
    net.minecraft.util.com.mojang.authlib.exceptions.AuthenticationException: The cl
    ient has sent too many requests within a certain amount of time
            at net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilAuthenticati
    onService.makeRequest(YggdrasilAuthenticationService.java:65) ~[craftbukkit.jar:
    git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilMinecraftSes
    sionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:135) [cr
    aftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.TileEntitySkull.d(TileEntitySkull.java:7
    4) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.TileEntitySkull.setGameProfile(TileEntit
    ySkull.java:62) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.craftbukkit.v1_7_R3.block.CraftSkull.update(CraftSkull.jav
    a:194) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.craftbukkit.v1_7_R3.block.CraftBlockState.update(CraftBloc
    kState.java:135) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.craftbukkit.v1_7_R3.block.CraftBlockState.update(CraftBloc
    kState.java:131) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at de.TVXtrem.GunGame.utils.Leaderboard.<init>(Leaderboard.java:206) [Gu
    nGameU.jar:?]
            at de.TVXtrem.GunGame.Arena.win(Arena.java:621) [GunGameU.jar:?]
            at de.TVXtrem.GunGame.Arena.giveKit(Arena.java:170) [GunGameU.jar:?]
            at de.TVXtrem.GunGame.GListeners.onDeath(GListeners.java:110) [GunGameU.
    jar:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0
    _51]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0
    _51]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .7.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callPlayerDeat
    hEvent(CraftEventFactory.java:370) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084j
    nks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.die(EntityPlayer.java:373)
    [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.EntityLiving.damageEntity(EntityLiving.j
    ava:732) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.EntityHuman.damageEntity(EntityHuman.jav
    a:746) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.damageEntity(EntityPlayer.j
    ava:452) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.EntityFishingHook.h(EntityFishingHook.ja
    va:189) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.World.entityJoinedWorld(World.java:1421)
    [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.World.playerJoinedWorld(World.java:1402)
    [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.World.tickEntities(World.java:1290) [cra
    ftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.WorldServer.tickEntities(WorldServer.jav
    a:481) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:6
    49) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:2
    60) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:5
    58) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :469) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    28) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
    [16:28:46 WARN]: Couldn't look up profile properties for net.minecraft.util.com.
    mojang.authlib.GameProfile@1505a62[id=245a3be9-9825-38d6-befc-808dd39eeb1e,name=
    Spielgurke,properties={},legacy=false]
    net.minecraft.util.com.mojang.authlib.exceptions.AuthenticationException: The cl
    ient has sent too many requests within a certain amount of time
            at net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilAuthenticati
    onService.makeRequest(YggdrasilAuthenticationService.java:65) ~[craftbukkit.jar:
    git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilMinecraftSes
    sionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:135) [cr
    aftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.TileEntitySkull.d(TileEntitySkull.java:7
    4) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.TileEntitySkull.setGameProfile(TileEntit
    ySkull.java:62) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.craftbukkit.v1_7_R3.block.CraftSkull.update(CraftSkull.jav
    a:194) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.craftbukkit.v1_7_R3.block.CraftBlockState.update(CraftBloc
    kState.java:135) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.craftbukkit.v1_7_R3.block.CraftBlockState.update(CraftBloc
    kState.java:131) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at de.TVXtrem.GunGame.utils.Leaderboard.<init>(Leaderboard.java:206) [Gu
    nGameU.jar:?]
            at de.TVXtrem.GunGame.Arena.win(Arena.java:621) [GunGameU.jar:?]
            at de.TVXtrem.GunGame.Arena.giveKit(Arena.java:170) [GunGameU.jar:?]
            at de.TVXtrem.GunGame.GListeners.onDeath(GListeners.java:110) [GunGameU.
    jar:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0
    _51]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0
    _51]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .7.0_51]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:292) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callPlayerDeat
    hEvent(CraftEventFactory.java:370) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084j
    nks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.die(EntityPlayer.java:373)
    [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.EntityLiving.damageEntity(EntityLiving.j
    ava:732) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.EntityHuman.damageEntity(EntityHuman.jav
    a:746) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.EntityPlayer.damageEntity(EntityPlayer.j
    ava:452) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.EntityFishingHook.h(EntityFishingHook.ja
    va:189) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.World.entityJoinedWorld(World.java:1421)
    [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.World.playerJoinedWorld(World.java:1402)
    [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.World.tickEntities(World.java:1290) [cra
    ftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.WorldServer.tickEntities(WorldServer.jav
    a:481) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:6
    49) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:2
    60) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:5
    58) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :469) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
            at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  21. Squid_Boss maybe if i take the TOP 3 out of the MySQL and then put them in a config that that will work.
     
Thread Status:
Not open for further replies.

Share This Page