Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
7473c6d
Create README.md
PeachesMLG Dec 22, 2020
a8a0d0e
Merge remote-tracking branch 'github/master'
PeachesMLG Dec 22, 2020
62023dd
Fixed issues with comparing colours
PeachesMLG Dec 22, 2020
6155a40
Update README.md
PeachesMLG Dec 22, 2020
9203353
Update README.md
PeachesMLG Dec 22, 2020
fb60289
Update README.md
PeachesMLG Dec 22, 2020
3949902
Made more methods private
PeachesMLG Dec 23, 2020
ca4a68d
Merge remote-tracking branch 'github/master'
PeachesMLG Dec 23, 2020
0c1da22
Optimised Regex
PeachesMLG Dec 23, 2020
a843d7c
1.0.1
PeachesMLG Dec 23, 2020
98b180c
Update README.md
PeachesMLG Dec 23, 2020
bfcb5b6
1.0.2
PeachesMLG Dec 26, 2020
2924a2b
Merge remote-tracking branch 'github/master'
PeachesMLG Dec 26, 2020
05624c3
Code cleanup
PeachesMLG Dec 26, 2020
9d9afc7
Changed ImmutableMap to Map
PeachesMLG Dec 26, 2020
f318caa
Mode Code Cleanup
PeachesMLG Dec 26, 2020
15fa04c
Update README.md
PeachesMLG Mar 1, 2021
cf9cad0
Added ability to translate multiple Strings
PeachesMLG Mar 1, 2021
6581487
Added Rainbow Pattern
PeachesMLG Mar 1, 2021
e47845f
Update README.md
PeachesMLG Mar 1, 2021
a45bbae
Update README.md
PeachesMLG Mar 1, 2021
537b9fb
1.0.3
PeachesMLG Mar 1, 2021
438feff
Merge remote-tracking branch 'origin/master'
PeachesMLG Mar 1, 2021
d48a4dd
Make code consistent
daspositioned Mar 2, 2021
0955044
Add & Improve documentation
daspositioned Mar 2, 2021
baa0dc1
Fix documentation formatting
daspositioned Mar 2, 2021
eedcd84
Use Gradle as build tool
daspositioned Mar 2, 2021
e83c8b8
Update documentation versions
daspositioned Mar 2, 2021
ba7da18
Unfix everything I just did
daspositioned Mar 2, 2021
f66a85a
Merge pull request #4 from dlsf/feature/documentation
PeachesMLG Mar 2, 2021
ad9dd9a
Merge pull request #5 from dlsf/feature/gradle
PeachesMLG Mar 5, 2021
48a5cde
Fixed Java docs
PeachesMLG Mar 7, 2021
eeae3ac
Fixed Java docs
PeachesMLG Mar 7, 2021
891ca33
Maven FTW
PeachesMLG Mar 7, 2021
36d1ab1
Maven FTW
PeachesMLG Mar 7, 2021
82819f1
Added support for Bold Underline ect
PeachesMLG Mar 7, 2021
d996ac0
Add color stripping method
daspositioned Jul 16, 2021
9bba6c1
Fix solid pattern replacement
daspositioned Jul 16, 2021
4bc1cb6
Remove unnecessary brackets
daspositioned Jul 16, 2021
5b752f5
Remove unnecessary capturing group
daspositioned Jul 16, 2021
1c65e99
Merge pull request #9 from Iridium-Development/feature/color-stripping
PeachesMLG Jul 16, 2021
9dbdc55
Add alternative solid pattern
daspositioned Jul 29, 2021
a019a0d
Merge pull request #10 from Iridium-Development/feature/alternative-s…
PeachesMLG Aug 2, 2021
518b2b9
Version Increment
PeachesMLG Aug 3, 2021
6b8db8e
Update README.md
PeachesMLG Oct 1, 2021
66746dd
Fix color stripping method
daspositioned Oct 4, 2021
cdbcabb
Fix <#HEX> stripping
daspositioned Oct 4, 2021
2859474
Remove IridiumColorAPI.iml
daspositioned Oct 4, 2021
732f636
Merge pull request #12 from Iridium-Development/fix/color-stripping
PeachesMLG Oct 26, 2021
a9b584f
Switch to Gradle & Add unit tests
daspositioned Oct 26, 2021
7b442ee
Fix color stripping test
daspositioned Oct 26, 2021
fa0e61f
Fix missing test cases
daspositioned Oct 26, 2021
a5f0103
Clean up build.gradle.kts
daspositioned Oct 26, 2021
d90dfa1
Small cleanup
daspositioned Oct 26, 2021
288c280
Changed Tests
PeachesMLG Oct 26, 2021
4b958d9
Merge pull request #13 from Iridium-Development/feature/gradle-and-tests
PeachesMLG Oct 26, 2021
aa70a8b
Version Increment
PeachesMLG Oct 26, 2021
0fb5ca6
Improve the indentation
daspositioned Nov 10, 2021
48a775a
Merge pull request #15 from Iridium-Development/improvement/indentation
PeachesMLG Nov 18, 2021
f9b4c74
Create gradle.yml
PeachesMLG Nov 18, 2021
f6042ee
The repository link is now correct
LIMPIX31 Nov 21, 2021
4756aeb
Merge pull request #16 from LIMPIX31/patch-1
PeachesMLG Nov 25, 2021
80f316c
Fix a problem where the API did not recognize already converted color…
Dec 14, 2021
54bd62d
Merge pull request #18 from boiscljo/master
PeachesMLG Dec 15, 2021
37f470c
Allow modifier to be applied to only parts of the text
Dec 15, 2021
9f994a6
Merge branch 'Iridium-Development:master' into master
Dec 15, 2021
7f6e3b9
Fix autoformatting and add testing
Dec 15, 2021
b2e7a45
Merge branch 'master' of github.com:boiscljo/IridiumColorAPI
Dec 15, 2021
5fa1e55
Gradient and rainbow test case
Dec 15, 2021
db20b5b
Remove the reassigning the parameters
Dec 15, 2021
1468c50
Remove the reassigning the parameters
Dec 15, 2021
e9b1c3f
Merge pull request #19 from boiscljo/master
PeachesMLG Dec 15, 2021
5a336cb
Weaken ::process(List<String>) to ::process(Collection<String>)
zofiaclient Jun 19, 2022
1520cf7
Merge pull request #24 from ImajinDevon/patch-1
PeachesMLG Jun 19, 2022
76a45ac
Create LICENCE
PeachesMLG Jan 14, 2023
bcf3d23
Merge pull request #27 from Iridium-Development/add-license-1
PeachesMLG Jan 14, 2023
f073a2d
Version Increment
PeachesMLG Sep 22, 2023
2c96813
Version Increment
PeachesMLG Sep 22, 2023
a35e121
Version Increment
PeachesMLG Sep 22, 2023
fa46dba
Updated it to use apache commons lang3
RedW0lfStoneYT Jan 1, 2024
a630889
Add bungeecord support, Improve IridiumColorAPI#apply
iiAhmedYT Jan 2, 2024
5d3b7a3
put back the old check for the tests to run
iiAhmedYT Jan 9, 2024
69b453f
fix a potential bug one day?
iiAhmedYT Jan 9, 2024
a8a07f5
Fix compiling issues for me
iiAhmedYT Jan 9, 2024
e0e7271
Version Increment: Merge pull request #30 from iiAhmedYT/master
PeachesMLG Jan 9, 2024
ad27bde
Version Increment
PeachesMLG Jan 9, 2024
8814046
fix: single char error
meteorOSS Feb 2, 2024
b5591b9
Merge pull request #31 from meteorOSS/master
PeachesMLG Feb 11, 2024
7efb663
Merge pull request #29 from RedW0lfStoneYT/master
PeachesMLG Feb 24, 2024
b405cd2
Version Increment
PeachesMLG Feb 24, 2024
46de237
strip the color formatting: §r
sj-hub9796 Jan 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Java CI with Gradle
on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.commits[0].message, '[ci-skip]')"
steps:
- uses: actions/[email protected]
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Test with Gradle
run: ./gradlew test
- name: Build with Gradle
run: ./gradlew build
- name: Upload artifacts
uses: "actions/[email protected]"
with:
name: "IridiumColorAPI"
path: "build/libs/IridiumColorAPI-*.jar"
upload:
needs: build
runs-on: ubuntu-latest
if: "contains(github.event.commits[0].message, 'Version Increment')"
steps:
- uses: actions/checkout@v2
- uses: thecodemonkey/action-get-gradle-version@master
id: version
with:
file: "build.gradle.kts"
- uses: actions/[email protected]
with:
name: "IridiumColorAPI"
path: "./"
- name: Publish to Nexus
uses: sonatype-nexus-community/nexus-repo-github-action@master
with:
serverUrl: "https://nexus.iridiumdevelopment.net/"
username: "${{ secrets.NEXUS_USERNAME }}"
password: "${{ secrets.NEXUS_PASSWORD }}"
format: "maven2"
repository: "maven-releases"
coordinates: "groupId=com.iridium artifactId=IridiumColorAPI version=${{steps.version.outputs.version}} generate-pom=on"
assets: "extension=jar"
filename: "IridiumColorAPI-*.jar"
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Project exclude paths
/target/
/.idea/
.gradle/
.idea/
build/
target/
2 changes: 0 additions & 2 deletions IridiumColorAPI.iml

This file was deleted.

674 changes: 674 additions & 0 deletions LICENCE

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# IridiumColorAPI

```xml
<repository>
<id>iridiumdevelopment</id>
<url>https://nexus.iridiumdevelopment.net/repository/maven-releases/</url>
</repository>
```
```xml
<dependency>
<groupId>com.iridium</groupId>
<artifactId>IridiumColorAPI</artifactId>
<version>LATEST</version>
</dependency>
```
# Usage
To add a gradient simply use the <GRADIENT> tags
```java
IridiumColorAPI.process("<GRADIENT:2C08BA>Cool string with a gradient</GRADIENT:028A97>");
```
![Gradient Text](https://i.imgur.com/M1l5OM9.png)

The number after the rainbow represents the saturation
```java
IridiumColorAPI.process("<RAINBOW1>THIS IS A REALLY COOL Rainbow</RAINBOW>");
```

![Rainbow](https://i.imgur.com/5GhSFo1.png)

```java
IridiumColorAPI.process("<RAINBOW100>THIS IS A REALLY COOL Rainbow</RAINBOW>");
```
![Rainbow](https://i.imgur.com/Rieftuz.png)
```java
IridiumColorAPI.process("<SOLID:FF0080>Cool RGB SUPPORT");
```
![RGB Text](https://i.imgur.com/IudqIpb.png)

If your server version is pre 1.16 it will map the color to the nearest supported value(This also works with gradient)
In the example above, it will map to &5 as this is the closest

![Legacy RGB](https://i.imgur.com/8RMmCAX.png)
43 changes: 43 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
java
`maven-publish`
}

group = "com.iridium"
version = "1.0.9"
description = "IridiumColorAPI"
java.sourceCompatibility = JavaVersion.VERSION_1_8

repositories {
maven("https://repo.rosewooddev.io/repository/public/")
mavenCentral()
}

dependencies {
implementation("org.spigotmc:spigot:1.17.1")
implementation("org.apache.commons:commons-lang3:3.13.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
testImplementation("org.mockito:mockito-inline:4.0.0")
testImplementation("org.mockito:mockito-junit-jupiter:4.0.0")
}

publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
}
}

tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}

tasks {
build {
dependsOn(test)
}

test {
useJUnitPlatform()
setForkEvery(1)
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
234 changes: 234 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################

# Attempt to set APP_HOME

# Resolve links: $0 may be a link
app_path=$0

# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

warn () {
echo "$*"
} >&2

die () {
echo
echo "$*"
echo
exit 1
} >&2

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi

# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.

# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )

JAVACMD=$( cygpath --unix "$JAVACMD" )

# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#

eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
Loading