📈Progress Bars

Create progress bars!

Overview

The ProgressBar class provides a utility for generating progress bars based on current and maximum values.

Methods

getProgressBar

public static String getProgressBar(int current, int max, int totalBars, char symbol, ChatColor completedColor, ChatColor notCompletedColor)

Generates a progress bar string based on the current and maximum values.

Parameters

  • current: The current value.

  • max: The maximum value.

  • totalBars: The total number of bars in the progress bar.

  • symbol: The symbol used to represent progress.

  • completedColor: The ChatColor for the completed part of the progress bar.

  • notCompletedColor: The ChatColor for the incomplete part of the progress bar.

Returns

  • Returns a string representing the progress bar.

Example Usage

int current = 50;
int max = 100;
int totalBars = 10;
char symbol = '|';
ChatColor completedColor = ChatColor.GREEN;
ChatColor notCompletedColor = ChatColor.RED;

String progressBar = ProgressBar.getProgressBar(current, max, totalBars, symbol, completedColor, notCompletedColor);
System.out.println(progressBar);

In this example, we use the getProgressBar method to generate a progress bar string based on the current and maximum values, with a total of 10 bars, using the '|' symbol, and green for completed and red for incomplete parts of the progress bar.

Last updated