Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.infogroup.infoboard.scoreboard;
- import com.infogroup.infoboard.InfoBoardReborn;
- import com.infogroup.infoboard.utils.SortByPriority;
- import org.bukkit.Bukkit;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.List;
- public class Ladder {
- private InfoBoardReborn plugin;
- private ArrayList<InfoBoard> boards;
- private int position;
- private String name;
- private int shownTime;
- public Ladder(InfoBoardReborn plugin, String name, List<String> list) {
- this.plugin = plugin;
- this.name = name;
- boards = new ArrayList<>();
- for (String s : list) {
- Bukkit.getConsoleSender().sendMessage("boards: " + s);
- this.boards.add(
- this.plugin.getIBM()
- .getInfoBoard(s)); //ERROR NULL
- }
- this.position = 0;
- }
- /**
- * Get the next Board in line.
- *
- * @return InfoBoard
- */
- public InfoBoard getNext() {
- this.resetShownTime();
- if (boards.size() > position) {
- this.position++;
- return this.boards.get(position);
- } else {
- this.position = 0;
- return this.boards.get(position);
- }
- }
- /**
- * Get the current InfoBoard
- *
- * @return InfoBoard
- */
- public InfoBoard getCurrent() {
- return this.boards.get(position);
- }
- /**
- * Get the current position
- *
- * @return Integer
- */
- public Integer getPosition() {
- return this.position;
- }
- /**
- * Get the name of the ladder
- * @return String
- */
- public String getName(){
- return this.name;
- }
- /**
- * Sort the Boards list by their priorities
- */
- public void sortListByPriorities() {
- Collections.sort(this.boards, new SortByPriority());
- }
- /**
- * Get the time the current board has been shown
- *
- * @return Integer
- */
- public Integer getShownTime() {
- return this.shownTime;
- }
- /**
- * Add 1 to the shownTime counter
- */
- public void addShownTime() {
- this.shownTime++;
- }
- /**
- * Reset the shownTime counter
- */
- public void resetShownTime() {
- this.shownTime = 0;
- }
- /**
- * Get the amount of boards in the ladder
- *
- * @return Integer
- */
- public Integer size() {
- return this.boards.size();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement