DaddySB [Scoreboard API]

Status
This thread has been locked.

Sniper

Software Developer
Supreme
Feedback score
65
Posts
1,312
Reactions
695
Resources
0
Just wondering if people want me to release this.

API:
How to use:

DaddySB.setTitle(text)Right after this, you need to refresh it using DaddySB.refreshBoard()

DaddySB.addLine(id, text)
Recommend setting the id's as numbers, or else it can mix up sometimes

DaddySB.setLine(id, text)
Recommend setting the id's as numbers, or else it can mix up sometimes

DaddySB.addCountdownLine(id, text, seconds, player)
In the "text" area you put $t for the countdown

DaddySB.removeLine(id)

DaddySB.hasLine(id) returns boolean


Code:
package com.shaut.test;

import java.util.ArrayList;

import org.bukkit.Bukkit;
import org.bukkit.Statistic;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;

import com.shaut.daddysb.DaddySB;

public class Main extends JavaPlugin implements Listener {

    public ArrayList<Player> cooldown = new ArrayList<Player>();

    public void onEnable() {
        DaddySB.setTitle("&eTesting");
        DaddySB.refreshBoard();
        Bukkit.getPluginManager().registerEvents(this, this);
        new BukkitRunnable() {
            @Override
            public void run() {
                for(Player player : Bukkit.getOnlinePlayers()) {
                    DaddySB.setLine("0", "&8&m------------");
                    DaddySB.setLine("1", player.getStatistic(Statistic.JUMP) + " jumps");
                    DaddySB.setLine("999", "&8&m------------");
                }
            }
        }.runTaskTimer(this, 10, 10);
    }

    @EventHandler
    public void onThrow(BlockBreakEvent e) {
        if(cooldown.contains(e.getPlayer())) {
            e.setCancelled(true);
        } else {
            DaddySB.addCountdownLine("2", "Block break: $t", 10, e.getPlayer());
            cooldown.add(e.getPlayer());
            new BukkitRunnable() {
         
                @Override
                public void run() {
                    cooldown.remove(e.getPlayer());
                }
            }.runTaskLater(this, 200);
        }
    }


}

7acdd2c3203b6c680e58e9b8770c6887.gif

Everything supports colour codes.
 

Attachments

  • 7acdd2c3203b6c680e58e9b8770c6887.gif
    7acdd2c3203b6c680e58e9b8770c6887.gif
    2.7 MB · Views: 61
  • 7acdd2c3203b6c680e58e9b8770c6887.gif
    7acdd2c3203b6c680e58e9b8770c6887.gif
    2.7 MB · Views: 196
Last edited:
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Oahu - Aidan

Developer
Supreme
Feedback score
13
Posts
144
Reactions
65
Resources
0
Looks cool to me, would definitely try it out if you released.

One question, does it support lines more than 16 characters?
 

Sniper

Software Developer
Supreme
Feedback score
65
Posts
1,312
Reactions
695
Resources
0
Looks cool to me, would definitely try it out if you released.

One question, does it support lines more than 16 characters?
The title can, the lines can only be 16 I think[DOUBLEPOST=1503296149][/DOUBLEPOST]Adding:

Per player lines
Fixing priorities in lines
 

Oahu - Aidan

Developer
Supreme
Feedback score
13
Posts
144
Reactions
65
Resources
0
The title can, the lines can only be 16 I think[DOUBLEPOST=1503296149][/DOUBLEPOST]Adding:

Per player lines
Fixing priorities in lines
You should add compatibility for more than 16 characters on a line, you can do it with Team suffixes and prefixes.
 

Eric

Software Engineer
Supreme
Feedback score
14
Posts
1,760
Reactions
1,648
Resources
1
Could be a lot easier to use (from that example class, it doesn't look very advanced and the API doesn't look very fun to code with)
 

Dori

Full Stack Developer
Supreme
Feedback score
28
Posts
459
Reactions
198
Resources
0
I would like you to post this API.
I think it will help a lot of new developers and people who need to save time in big projects.
Thank you for offering this <3
 

Sniper

Software Developer
Supreme
Feedback score
65
Posts
1,312
Reactions
695
Resources
0
Could be a lot easier to use (from that example class, it doesn't look very advanced and the API doesn't look very fun to code with)
I don't understand why it needs to be complex, if it gets the job done then it's fine I guess[DOUBLEPOST=1503326855][/DOUBLEPOST]Also, explain what a "fun" scoreboard would look like[DOUBLEPOST=1503326914][/DOUBLEPOST]Layton Eric
 
Last edited:

Eric

Software Engineer
Supreme
Feedback score
14
Posts
1,760
Reactions
1,648
Resources
1
I don't understand why it needs to be complex, if it gets the job done then it's fine I guess[DOUBLEPOST=1503326855][/DOUBLEPOST]Also, explain what a "fun" scoreboard would look like[DOUBLEPOST=1503326914][/DOUBLEPOST]Layton Eric
Not saying it needs to be advanced, it just doesn't look very nice to use.

I suggest building it into a ScoreboardHandler where the task and scoreboard lines are being held. Just make it cleaner.
 

Sniper

Software Developer
Supreme
Feedback score
65
Posts
1,312
Reactions
695
Resources
0
Not saying it needs to be advanced, it just doesn't look very nice to use.

I suggest building it into a ScoreboardHandler where the task and scoreboard lines are being held. Just make it cleaner.
Give me an example, want to make this look good.
 

Eric

Software Engineer
Supreme
Feedback score
14
Posts
1,760
Reactions
1,648
Resources
1
You can't remove lines all of a sudden etc. They're all static it appears.
No?

If you've ever seen anything like iHCF scoreboard you can just build a method to return a list of strings (maybe hashset) and apply that to a user every iteration.
 

Sniper

Software Developer
Supreme
Feedback score
65
Posts
1,312
Reactions
695
Resources
0
No?

If you've ever seen anything like iHCF scoreboard you can just build a method to return a list of strings (maybe hashset) and apply that to a user every iteration.
Oh okay, I'll maybe add that. Otherwise, It will be a simple scoreboard API that doesn't require much knowledge to get working.
 

Uxon

Building Oraxen, HackedServer and more!
Ultimate
Feedback score
12
Posts
2
Reactions
27
Resources
2
Oh okay, I'll maybe add that. Otherwise, It will be a simple scoreboard API that doesn't require much knowledge to get working.
And it will remain a useful gesture for the community! :p :D
 
Status
This thread has been locked.
Top