Giter Club home page Giter Club logo

board's Introduction

board

A clean and functional scoreboard api for use with Bukkit/Spigot plugins. The objective of board is to allow for easy creation of scoreboard systems without the hassle of the included api's in Bukkit.

Usage

board can be easily added to your project with the use of Apache Maven.

Requirements of board

It is recommended that you use the jitpack

After you have all of the requirements installed & configured you can use the following series of commands to download and install board to your local maven repo (.m2)

git clone https://github.com/missionarydev/board.git
cd board
mvn clean install

board will now have been added to your local maven repo (.m2) and you can begin using it by adding the following into your Maven pom.xml

<dependency>
    <groupId>me.missionary</groupId>
    <artifactId>board</artifactId>
    <version>1.1.0-SNAPSHOT</version>
    <scope>compile</scope>
</dependency>

After you have added the dependency to your Maven pom.xml the last thing you need to do is register the BoardManager and instance of BoardProvider with your plugin!

public class ExampleUsage extends JavaPlugin {

    private BoardManager manager;

    @Override
    public void onEnable() {
        manager = new BoardManager(this, BoardSettings.builder().boardProvider(new ExampleProviderImplementation()).scoreDirection(ScoreDirection.UP).build());
    }

    @Override
    public void onDisable() {
        manager.onDisable();
    }
}

Functionality

board provides support for creating simple and elegant scoreboards.

Here is an example of how to create a scoreboard with board.

public class ExampleProviderImplementation implements BoardProvider {

        @Override
        public String getTitle(Player player) {
            return ChatColor.LIGHT_PURPLE + "Board";
        }

        @Override
        public List<String> getLines(Player player) {
            List<String> lines = new ArrayList<>();
            lines.add("&7&m-----------------");
            lines.add(ChatColor.LIGHT_PURPLE + "Name" + ChatColor.GRAY + ": " + ChatColor.YELLOW + player.getName());
            lines.add(ChatColor.LIGHT_PURPLE + "Health" + ChatColor.GRAY + ": " + ChatColor.YELLOW + String.format("%.1f\u2764", Math.ceil(player.getHealth()) / 2.0));
            lines.add(ChatColor.LIGHT_PURPLE + "Hunger" + ChatColor.GRAY + ": " + ChatColor.YELLOW + player.getFoodLevel() / 2);
            lines.add("&7&m-----------------");
            return lines;
        }
    }

The previous code will produce this result:

board's People

Contributors

missionarydev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

board's Issues

error

I implemented with maven but if i create a new plugin work if i implements it in a mine plugin give me this error

[13:25:10] [Server thread/ERROR]: Could not load 'plugins\VyperUtils.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: me/missionary/board/provider/BoardProvider at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[server.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[server.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [server.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [server.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [server.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [server.jar:git-Spigot-db6de12-18fbb24] at java.lang.Thread.run(Unknown Source) [?:1.8.0_251] Caused by: java.lang.NoClassDefFoundError: me/missionary/board/provider/BoardProvider at java.lang.Class.forName0(Native Method) ~[?:1.8.0_251] at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_251] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[server.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[server.jar:git-Spigot-db6de12-18fbb24] ... 6 more Caused by: java.lang.ClassNotFoundException: me.missionary.board.provider.BoardProvider at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_251] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[server.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[server.jar:git-Spigot-db6de12-18fbb24] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_251] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_251] at java.lang.Class.forName0(Native Method) ~[?:1.8.0_251] at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_251] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[server.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[server.jar:git-Spigot-db6de12-18fbb24] ... 6 more

Question about creating own objectives to the scoreboards.

Hi!
I have a question about creating own objectives. Is board somehow interfere with the objectives? I'm creating my own objective with criteria health and display type - below name. Unfortunately, when I'm joining to the server, the objective always shows 0, and I can't find a way to check what prevents showing the real value ๐Ÿ˜•

image

Hence I have a question about changing the objective value. I found that Board only replaces one, its own objective. But it don't interfere with another ones. Is it possible that board API affects to the other objective values? Below, I paste the code where I'm adding a new objective. I'm executing that method after the setup method from the Board API.

Cheers!

    public static void setScoreboardHealthObjective(Board board) {
        Scoreboard scoreboard = board.getScoreboard();
        if (scoreboard == null) {
            return;
        }

        if (scoreboard.getObjective("healthbar") == null) {
            Objective objective = scoreboard.registerNewObjective("healthbar", "health", ChatHelper.fixColor("&cโค"));
            objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
        }
    }

Error "Team name cannot be null!"

Hi. I'm using plugin board on my server. Rarely, it spams an error "Team name cannot be null!" ๐Ÿค”

Spigot version: "Paper version git-Paper-243 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)"

[15:28:10 WARN]: [MyPlugin] Task #2981 for MyPlugin v1.0 generated an exception
java.lang.IllegalArgumentException: Team name cannot be null
        at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[patched_1.14.4.jar:git-Paper-243]
        at org.bukkit.craftbukkit.v1_14_R1.scoreboard.CraftScoreboard.getTeam(CraftScoreboard.java:146) ~[patched_1.14.4.jar:git-Paper-243]
        at me.missionary.board.board.Board.update(Board.java:102) ~[?:?]
        at me.missionary.board.board.tasks.BoardUpdateTask.lambda$run$2(BoardUpdateTask.java:23) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:1.8.0_275]
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:1.8.0_275]
        at java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet.lambda$entryConsumer$0(Collections.java:1577) ~[?:1.8.0_275]
        at java.util.concurrent.ConcurrentHashMap$EntrySpliterator.forEachRemaining(ConcurrentHashMap.java:3606) ~[?:1.8.0_275]
        at java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntrySetSpliterator.forEachRemaining(Collections.java:1602) ~[?:1.8.0_275]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) ~[?:1.8.0_275]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[?:1.8.0_275]
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:1.8.0_275]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:1.8.0_275]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_275]
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485) ~[?:1.8.0_275]
        at me.missionary.board.board.tasks.BoardUpdateTask.run(BoardUpdateTask.java:23) ~[?:?]
        at org.bukkit.craftbukkit.v1_14_R1.scheduler.CraftTask.run(CraftTask.java:84) ~[patched_1.14.4.jar:git-Paper-243]
        at org.bukkit.craftbukkit.v1_14_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:452) ~[patched_1.14.4.jar:git-Paper-243]
        at net.minecraft.server.v1_14_R1.MinecraftServer.b(MinecraftServer.java:1171) ~[patched_1.14.4.jar:git-Paper-243]
        at net.minecraft.server.v1_14_R1.DedicatedServer.b(DedicatedServer.java:417) ~[patched_1.14.4.jar:git-Paper-243]
        at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:1098) ~[patched_1.14.4.jar:git-Paper-243]
        at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:925) ~[patched_1.14.4.jar:git-Paper-243]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_275]

Scores are visible at the end of each line

I use 1.13.2 and I get scores at the end of all lines, but in the example image there is no scores, this is a bug, or it is impossible to hide the scores in this version?
What I get:
image
What I expect:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.