From fa95a6fa3380553b43e7163ed0473ad730d9e00f Mon Sep 17 00:00:00 2001 From: lucian929 <60053521+lucian929@users.noreply.github.com> Date: Fri, 7 Jan 2022 21:36:46 -0500 Subject: [PATCH 01/13] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index a47ad126..b3925de3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ ## Table of Contents - [Description](#description) - [Installation](#installation) -- [Contact Information](#contact-information) ### Description From 1ee6fc5f497758e6eb600785d9105146ffcda3f8 Mon Sep 17 00:00:00 2001 From: lucian929 <60053521+lucian929@users.noreply.github.com> Date: Sat, 8 Jan 2022 12:13:00 -0500 Subject: [PATCH 02/13] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b3925de3..11d9350d 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ ## Table of Contents - [Description](#description) - [Installation](#installation) +- [Download](#download) ### Description @@ -17,4 +18,6 @@ HMCCosmetics is a free, open source cosmetics plugin which allows you to easily - Server running PaperMC (or a fork of PaperMC) - ProtocolLib +### Download +Download on the [Releases Page](https://github.com/HibiscusMC/HMCCosmetics/releases) From c7238bb375f6c1db6bbf3fb76b6e8ee2804e1148 Mon Sep 17 00:00:00 2001 From: lucian929 <60053521+lucian929@users.noreply.github.com> Date: Tue, 11 Jan 2022 01:09:22 -0500 Subject: [PATCH 03/13] Added demo video --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 11d9350d..73371164 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,7 @@ HMCCosmetics is a free, open source cosmetics plugin which allows you to easily ### Download Download on the [Releases Page](https://github.com/HibiscusMC/HMCCosmetics/releases) + +Demo: +https://user-images.githubusercontent.com/60053521/148890239-3c85255c-a532-48fd-afb5-79bae650337f.mp4 + From 44da234779e3446011c1456ca688f65e84ee7d70 Mon Sep 17 00:00:00 2001 From: lucian929 <60053521+lucian929@users.noreply.github.com> Date: Tue, 11 Jan 2022 01:10:25 -0500 Subject: [PATCH 04/13] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 73371164..7fa4a681 100644 --- a/README.md +++ b/README.md @@ -23,5 +23,7 @@ HMCCosmetics is a free, open source cosmetics plugin which allows you to easily Download on the [Releases Page](https://github.com/HibiscusMC/HMCCosmetics/releases) Demo: -https://user-images.githubusercontent.com/60053521/148890239-3c85255c-a532-48fd-afb5-79bae650337f.mp4 +![demo](https://user-images.githubusercontent.com/60053521/148890239-3c85255c-a532-48fd-afb5-79bae650337f.mp4) + + From 0faf05fd61fbc63b6756b65781d47c08f58d8f5d Mon Sep 17 00:00:00 2001 From: lucian929 <60053521+lucian929@users.noreply.github.com> Date: Tue, 11 Jan 2022 01:10:37 -0500 Subject: [PATCH 05/13] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 7fa4a681..01997262 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,5 @@ HMCCosmetics is a free, open source cosmetics plugin which allows you to easily Download on the [Releases Page](https://github.com/HibiscusMC/HMCCosmetics/releases) -Demo: -![demo](https://user-images.githubusercontent.com/60053521/148890239-3c85255c-a532-48fd-afb5-79bae650337f.mp4) - From e2406c697c2cc04d15bcbc7e8e85cecb1db9fe7f Mon Sep 17 00:00:00 2001 From: lucian929 Date: Tue, 11 Jan 2022 22:57:03 -0500 Subject: [PATCH 06/13] Updated default configuration files --- .idea/misc.xml | 5 + .idea/modules/HMCCosmetics.main.iml | 1 + .idea/modules/HMCCosmetics.test.iml | 3 - .idea/runConfigurations.xml | 10 - build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 269 ++++++++++++++--------- src/main/resources/menus/dye-menu.yml | 4 +- src/main/resources/menus/main.yml | 110 +++------ src/main/resources/messages.yml | 6 +- src/main/resources/plugin.yml | 2 +- 11 files changed, 203 insertions(+), 211 deletions(-) delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 6680db93..cc57d5fd 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,10 @@ + + + + + diff --git a/.idea/modules/HMCCosmetics.main.iml b/.idea/modules/HMCCosmetics.main.iml index 85578b10..97829813 100644 --- a/.idea/modules/HMCCosmetics.main.iml +++ b/.idea/modules/HMCCosmetics.main.iml @@ -4,6 +4,7 @@ + PAPER MCP ADVENTURE diff --git a/.idea/modules/HMCCosmetics.test.iml b/.idea/modules/HMCCosmetics.test.iml index a1e06243..c4622759 100644 --- a/.idea/modules/HMCCosmetics.test.iml +++ b/.idea/modules/HMCCosmetics.test.iml @@ -9,7 +9,4 @@ - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea5..00000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle index a8eef230..2cd05fe4 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group 'io.github.fisher2911' -version '1.0.0' +version '1.0.1' repositories { mavenCentral() diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 69a97150..2e6e5897 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 744e882e..c53aefaa 100644 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# 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. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# 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 -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +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 -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +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" +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 - ;; +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 @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 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" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + 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 @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +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 -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# 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. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# 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" "$@" diff --git a/src/main/resources/menus/dye-menu.yml b/src/main/resources/menus/dye-menu.yml index a3dcf49c..df407f07 100644 --- a/src/main/resources/menus/dye-menu.yml +++ b/src/main/resources/menus/dye-menu.yml @@ -3,14 +3,14 @@ rows: 3 items: 10: material: BLUE_STAINED_GLASS - name: Set to blue + name: "Set to blue" set-color: red: 55 green: 49 blue: 181 11: material: RED_STAINED_GLASS - name: Set to red + name: "Set to red" set-color: red: 190 green: 20 diff --git a/src/main/resources/menus/main.yml b/src/main/resources/menus/main.yml index a9c7ba35..c8f8baa5 100644 --- a/src/main/resources/menus/main.yml +++ b/src/main/resources/menus/main.yml @@ -1,87 +1,37 @@ -title: "Main" -rows: 3 +title: "<#3066BE>Cosmetics Menu" # GUI Title +rows: 3 # Rows in the GUI items: - 10: - material: NETHERITE_CHESTPLATE - name: "Backpack" - lore: + 10: # GUI Slot number + material: LEATHER_HORSE_ARMOR + name: "Colorful Hat" + lore: # Lore displayed when the player owns the item - "" - - "Enabled: %enabled%" - - "Allowed: %allowed%" - locked-lore: - - "Not allowed" - amount: 1 - type: BACKPACK - permission: "" - id: netherite_backpack - 11: - material: NETHERITE_HELMET - name: "Hat" - lore: - - "" - - "Enabled: %enabled%" - - "Allowed: %allowed%" - locked-lore: - - "Not allowed" + - "Enabled: <#6D9DC5>%enabled%" + - "Allowed: <#6D9DC5>%allowed%" + locked-lore: # Lore displayed when the player does not have the correct permission. + - "You do not own this item!" amount: 1 + model-data: 1 # CustomModelData Number type: HAT - permission: "" - id: netherite_hat - 12: - material: DIAMOND_CHESTPLATE - name: "Backpack" - lore: - - "" - - "Enabled: %enabled%" - - "Allowed: %allowed%" - locked-lore: - - "Not allowed" - amount: 1 - type: BACKPACK - permission: "" - id: diamond_backpack - 13: - material: DIAMOND_HELMET - name: "Hat " - lore: - - "" - - "Enabled: %enabled%" - - "Allowed: %allowed%" - locked-lore: - - "Not allowed" - amount: 1 - type: HAT - permission: "" - id: diamond_hat - 14: - material: LEATHER_CHESTPLATE - name: "Backpack" - lore: - - "" - - "Enabled: %enabled%" - - "Allowed: %allowed%" - locked-lore: - - "Not allowed" - amount: 1 - type: BACKPACK - permission: "" - id: leather_backpack - dyeable: true - 15: - material: LEATHER_HELMET - name: "Hat " - lore: - - "" - - "Enabled: %enabled%" - - "Allowed: %allowed%" - locked-lore: - - "Not allowed" - amount: 1 - type: HAT - color: + dyeable: true # Enables dyeable item feature + color: # Sets default color for item. Uses RGB format. red: 5 - blue: 100 green: 230 + blue: 100 + open-menu: dye-menu # Automatically open the dye menu when applying this cosmetic + permission: "cosmetics.colorful_hat" # Can be anything you want. + id: colorful_hat # Internal identifier. Can be anything you want. + 11: + material: PAPER + name: "Backpack" + lore: + - "" + - "Enabled: <#6D9DC5>%enabled%" + - "Allowed: <#6D9DC5>%allowed%" + locked-lore: + - "You do not own this item!" + amount: 1 + model-data: 1 + type: BACKPACK permission: "" - id: leather_hat - dyeable: true + id: backpack diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 20e15636..90756945 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -1,8 +1,8 @@ no-permission: "No Permission!" set-hat: "Set Hat!" -removed-hat: "Removed Hat" +removed-hat: "Removed hat." set-backpack: "Set Backpack!" -removed-backpack: "Removed Backpack" +removed-backpack: "Removed backpack." must-be-player: "You must be a player to do this!" -reloaded: "Config files reloaded" +reloaded: "Config files reloaded!" invalid-type: "Invalid cosmetic type, please use hat or backpack" \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 15b9308c..a37794c5 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: HMCCosmetics main: io.github.fisher2911.hmccosmetics.HMCCosmetics -version: 1.0.0 +version: 1.0.1 api-version: 1.17 softdepend: - Multiverse From f507dea3c56512c40a646482043608871e4183c9 Mon Sep 17 00:00:00 2001 From: lucian929 Date: Tue, 11 Jan 2022 22:58:25 -0500 Subject: [PATCH 07/13] Bumped version number --- build.gradle | 2 +- src/main/resources/plugin.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 2cd05fe4..557c573a 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group 'io.github.fisher2911' -version '1.0.1' +version '1.0.2' repositories { mavenCentral() diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a37794c5..11906999 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: HMCCosmetics main: io.github.fisher2911.hmccosmetics.HMCCosmetics -version: 1.0.1 +version: 1.0.2 api-version: 1.17 softdepend: - Multiverse From dbdc6a5c9062170c7e3c918bb830d2e9e33753f8 Mon Sep 17 00:00:00 2001 From: lucian929 Date: Wed, 12 Jan 2022 20:44:24 -0500 Subject: [PATCH 08/13] Added help command --- .../command/CosmeticsCommand.java | 15 +++ .../hmccosmetics/message/Messages.java | 12 +++ .../hmccosmetics/message/Permission.java | 1 + src/main/resources/menus/dye-menu.yml | 96 +++++++++++++++++-- src/main/resources/menus/main.yml | 30 ++++-- src/main/resources/messages.yml | 13 ++- src/main/resources/plugin.yml | 2 +- 7 files changed, 151 insertions(+), 18 deletions(-) diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java b/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java index e94a7800..1d3e5f32 100644 --- a/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java +++ b/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java @@ -4,6 +4,7 @@ import io.github.fisher2911.hmccosmetics.HMCCosmetics; import io.github.fisher2911.hmccosmetics.gui.ArmorItem; import io.github.fisher2911.hmccosmetics.gui.CosmeticsMenu; import io.github.fisher2911.hmccosmetics.gui.DyeSelectorGui; +import io.github.fisher2911.hmccosmetics.message.Message; import io.github.fisher2911.hmccosmetics.message.MessageHandler; import io.github.fisher2911.hmccosmetics.message.Messages; import io.github.fisher2911.hmccosmetics.user.User; @@ -86,4 +87,18 @@ public class CosmeticsCommand extends CommandBase { } } + @SubCommand("help") // WORK IN PROGRESS (WIP) + @Permission(io.github.fisher2911.hmccosmetics.message.Permission.HELP_COMMAND) + public void helpCommand(final CommandSender sender) { + Bukkit.getScheduler().runTaskAsynchronously( + this.plugin, + () -> { + this.messageHandler.sendMessage( + sender, + Messages.HELP_COMMAND + ); + } + ); + } + } diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java b/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java index b2e0f083..fe0f0aeb 100644 --- a/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java +++ b/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java @@ -18,4 +18,16 @@ public class Messages { new Message("reloaded", "Config reloaded"); public static final Message INVALID_TYPE = new Message("invalid-type", "Invalid type"); + public static final Message HELP_COMMAND = + new Message("help-command", "<#6D9DC5> HMCCosmetics - Help<#6D9DC5> \n" + + "\n" + + "\n" + + "<#5AE4B5>• <#40B7D6>/cosmetics - <#6D9DC5>Opens cosmetics GUI.\n" + + "\n" + + "<#5AE4B5>• <#40B7D6>/cosmetics dye - <#6D9DC5>Opens dye menu for specified cosmetic.\n" + + "\n" + + "<#5AE4B5>• <#40B7D6>/cosmetics help - <#6D9DC5>Opens this menu.\n" + + "\n" + + "\n" + + " "); } diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/Permission.java b/src/main/java/io/github/fisher2911/hmccosmetics/message/Permission.java index 43ef710c..a033443b 100644 --- a/src/main/java/io/github/fisher2911/hmccosmetics/message/Permission.java +++ b/src/main/java/io/github/fisher2911/hmccosmetics/message/Permission.java @@ -5,5 +5,6 @@ public class Permission { public static final String DEFAULT_COMMAND = "hmccosmetics.cmd.default"; public static final String DYE_COMMAND = "hmccosmetics.cmd.dye"; public static final String RELOAD_COMMAND = "hmccosmetics.cmd.reload"; + public static final String HELP_COMMAND = "hmccosmetics.cmd.help"; } diff --git a/src/main/resources/menus/dye-menu.yml b/src/main/resources/menus/dye-menu.yml index df407f07..eab80cbe 100644 --- a/src/main/resources/menus/dye-menu.yml +++ b/src/main/resources/menus/dye-menu.yml @@ -1,17 +1,93 @@ -title: Set Color -rows: 3 +title: "" +rows: 4 items: 10: - material: BLUE_STAINED_GLASS - name: "Set to blue" + material: LEATHER_HORSE_ARMOR + model-data: 1 + color: + red: 255 + green: 255 + blue: 255 + name: "Set to <#FFFFFF>white" + set-color: + red: 255 + green: 255 + blue: 255 + 11: + material: LEATHER_HORSE_ARMOR + model-data: 1 + color: + red: 190 + green: 20 + blue: 20 + name: "Set to <#BE1414>red" + set-color: + red: 190 + green: 20 + blue: 20 + 12: + material: LEATHER_HORSE_ARMOR + model-data: 1 + color: + red: 234 + green: 92 + blue: 43 + name: "Set to <#EA5C2B>orange" + set-color: + red: 234 + green: 92 + blue: 43 + 13: + material: LEATHER_HORSE_ARMOR + model-data: 1 + color: + red: 255 + green: 201 + blue: 0 + name: "Set to <#FFC900>yellow" + set-color: + red: 255 + green: 201 + blue: 0 + 14: + material: LEATHER_HORSE_ARMOR + model-data: 1 + color: + red: 163 + green: 218 + blue: 141 + name: "Set to <#A3DA8D>green" + set-color: + red: 163 + green: 218 + blue: 141 + 15: + material: LEATHER_HORSE_ARMOR + model-data: 1 + color: + red: 55 + green: 49 + blue: 181 + name: "Set to <#3731B5>blue" set-color: red: 55 green: 49 blue: 181 - 11: - material: RED_STAINED_GLASS - name: "Set to red" + 16: + material: LEATHER_HORSE_ARMOR + model-data: 1 + color: + red: 137 + green: 70 + blue: 166 + name: "Set to <#8946A6>purple" set-color: - red: 190 - green: 20 - blue: 20 \ No newline at end of file + red: 137 + green: 70 + blue: 166 + 31: + material: PAPER + name: "<#F7DCFA>Previous Page" + amount: 1 + model-data: 1 + open-menu: main \ No newline at end of file diff --git a/src/main/resources/menus/main.yml b/src/main/resources/menus/main.yml index c8f8baa5..5a3f1896 100644 --- a/src/main/resources/menus/main.yml +++ b/src/main/resources/menus/main.yml @@ -1,7 +1,7 @@ -title: "<#3066BE>Cosmetics Menu" # GUI Title -rows: 3 # Rows in the GUI +title: "" # GUI Title +rows: 5 # Rows in the GUI items: - 10: # GUI Slot number + 1: # GUI Slot number material: LEATHER_HORSE_ARMOR name: "Colorful Hat" lore: # Lore displayed when the player owns the item @@ -11,7 +11,7 @@ items: locked-lore: # Lore displayed when the player does not have the correct permission. - "You do not own this item!" amount: 1 - model-data: 1 # CustomModelData Number + model-data: 2 # CustomModelData Number type: HAT dyeable: true # Enables dyeable item feature color: # Sets default color for item. Uses RGB format. @@ -21,7 +21,7 @@ items: open-menu: dye-menu # Automatically open the dye menu when applying this cosmetic permission: "cosmetics.colorful_hat" # Can be anything you want. id: colorful_hat # Internal identifier. Can be anything you want. - 11: + 2: material: PAPER name: "Backpack" lore: @@ -31,7 +31,25 @@ items: locked-lore: - "You do not own this item!" amount: 1 - model-data: 1 + model-data: 4 type: BACKPACK permission: "" id: backpack + 37: + material: PAPER + name: "<#40B7D6>Previous Page" + amount: 1 + model-data: 1 + open-menu: menu-2 + 40: + material: PAPER + name: "Customization Menu" + amount: 1 + model-data: 3 + open-menu: dye-menu + 43: + material: PAPER + name: "<#40B7D6>Next Page" + amount: 1 + model-data: 2 + open-menu: menu-2 diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 90756945..7cc6f3b1 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -5,4 +5,15 @@ set-backpack: "Set Backpack!" removed-backpack: "Removed backpack." must-be-player: "You must be a player to do this!" reloaded: "Config files reloaded!" -invalid-type: "Invalid cosmetic type, please use hat or backpack" \ No newline at end of file +invalid-type: "Invalid cosmetic type, please use hat or backpack" +help-command: "<#6D9DC5> HMCCosmetics - Help<#6D9DC5> + + +<#5AE4B5>• <#40B7D6>/cosmetics - <#6D9DC5>Opens cosmetics GUI. + +<#5AE4B5>• <#40B7D6>/cosmetics dye - <#6D9DC5>Opens dye menu for specified cosmetic. + +<#5AE4B5>• <#40B7D6>/cosmetics help - <#6D9DC5>Opens this menu. + + + " \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 11906999..5b475fec 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: HMCCosmetics main: io.github.fisher2911.hmccosmetics.HMCCosmetics -version: 1.0.2 +version: 1.0.3 api-version: 1.17 softdepend: - Multiverse From c97c3650eace8c0174d39a84f351e110b9341c35 Mon Sep 17 00:00:00 2001 From: lucian929 Date: Wed, 12 Jan 2022 20:44:55 -0500 Subject: [PATCH 09/13] Added help command --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 557c573a..e4a23b5e 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group 'io.github.fisher2911' -version '1.0.2' +version '1.0.3' repositories { mavenCentral() From 6843373298828aeffe71cf084a50dc2bc47040c8 Mon Sep 17 00:00:00 2001 From: lucian929 <60053521+lucian929@users.noreply.github.com> Date: Thu, 13 Jan 2022 13:35:55 -0500 Subject: [PATCH 10/13] Update messages.yml --- src/main/resources/messages.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 7cc6f3b1..f307d257 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -1,12 +1,12 @@ -no-permission: "No Permission!" -set-hat: "Set Hat!" -removed-hat: "Removed hat." -set-backpack: "Set Backpack!" -removed-backpack: "Removed backpack." -must-be-player: "You must be a player to do this!" -reloaded: "Config files reloaded!" -invalid-type: "Invalid cosmetic type, please use hat or backpack" -help-command: "<#6D9DC5> HMCCosmetics - Help<#6D9DC5> +no-permission: "No Permission!" +set-hat: "Applied hat!" +removed-hat: "Removed hat!" +set-backpack: "Applied backpack!" +removed-backpack: "Removed backpack!" +must-be-player: "You must be a player to do this!" +reloaded: "Config files reloaded!" +invalid-type: "Invalid cosmetic type, please use hat or backpack!" +help-command: "<#6D9DC5> HMCCosmetics - Help  <#6D9DC5> <#5AE4B5>• <#40B7D6>/cosmetics - <#6D9DC5>Opens cosmetics GUI. @@ -16,4 +16,4 @@ help-command: "<#6D9DC5> <#5AE4B5>• <#40B7D6>/cosmetics help - <#6D9DC5>Opens this menu. - " \ No newline at end of file + " From a8ba08197567498fd5aeb0197687ff80625ecfc9 Mon Sep 17 00:00:00 2001 From: Skyslycer Date: Thu, 13 Jan 2022 22:08:10 +0100 Subject: [PATCH 11/13] add different message for no permission for cosmetics and make the chat thing reload too --- .../fisher2911/hmccosmetics/command/CosmeticsCommand.java | 2 ++ .../io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java | 2 +- .../fisher2911/hmccosmetics/message/MessageHandler.java | 4 +--- .../io/github/fisher2911/hmccosmetics/message/Messages.java | 2 ++ src/main/resources/messages.yml | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java b/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java index 1d3e5f32..8bdd0fe3 100644 --- a/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java +++ b/src/main/java/io/github/fisher2911/hmccosmetics/command/CosmeticsCommand.java @@ -21,6 +21,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import java.util.Map; +import java.util.Objects; import java.util.Optional; @Command("cosmetics") @@ -51,6 +52,7 @@ public class CosmeticsCommand extends CommandBase { this.plugin, () -> { this.cosmeticsMenu.reload(); + this.plugin.getMessageHandler().load(); this.messageHandler.sendMessage( sender, Messages.RELOADED diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java b/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java index 325380f5..ef6e2ce7 100644 --- a/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java +++ b/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticGui.java @@ -96,7 +96,7 @@ public class CosmeticGui { if (!hasPermission) { this.messageHandler.sendMessage( player, - Messages.NO_PERMISSION + Messages.NO_COSMETIC_PERMISSION ); return; } diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/MessageHandler.java b/src/main/java/io/github/fisher2911/hmccosmetics/message/MessageHandler.java index b635fe46..7ae9447d 100644 --- a/src/main/java/io/github/fisher2911/hmccosmetics/message/MessageHandler.java +++ b/src/main/java/io/github/fisher2911/hmccosmetics/message/MessageHandler.java @@ -140,7 +140,6 @@ public class MessageHandler { } for (final String key : config.getKeys(false)) { - final String message = Utils.replaceIfNull(config.getString(key), "", value -> { if (value == null) { this.logger.warning(String.format(ErrorMessages.ITEM_NOT_FOUND, "message", fileName)); @@ -148,8 +147,7 @@ public class MessageHandler { }).replace(Placeholder.PREFIX, prefix); final Message.Type messageType = Utils.stringToEnum( - Utils.replaceIfNull(config.getString("type"), "") - , Message.Type.class, Message.Type.MESSAGE + Utils.replaceIfNull(config.getString("type"), ""), Message.Type.class, Message.Type.MESSAGE ); this.messageMap.put(key, new Message(key, message, messageType)); diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java b/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java index fe0f0aeb..b023bee2 100644 --- a/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java +++ b/src/main/java/io/github/fisher2911/hmccosmetics/message/Messages.java @@ -4,6 +4,8 @@ public class Messages { public static final Message NO_PERMISSION = new Message("no-permission", "You do not have permission for this!"); + public static final Message NO_COSMETIC_PERMISSION = + new Message("no-cosmetic-permission", "You do not have permission for this cosmetic!"); public static final Message SET_HAT = new Message("set-hat", "Set hat"); public static final Message REMOVED_HAT = diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index 7cc6f3b1..a97babcc 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -1,4 +1,5 @@ no-permission: "No Permission!" +no-cosmetic-permission: "You do not have permission for this cosmetic!" set-hat: "Set Hat!" removed-hat: "Removed hat." set-backpack: "Set Backpack!" From e9694e77d750e29f06b2e602931cb672a6dc4280 Mon Sep 17 00:00:00 2001 From: Skyslycer Date: Thu, 13 Jan 2022 22:11:05 +0100 Subject: [PATCH 12/13] update messages.yml --- src/main/resources/messages.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index a97babcc..0aaa55ef 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -1,13 +1,14 @@ -no-permission: "No Permission!" -no-cosmetic-permission: "You do not have permission for this cosmetic!" -set-hat: "Set Hat!" -removed-hat: "Removed hat." -set-backpack: "Set Backpack!" -removed-backpack: "Removed backpack." -must-be-player: "You must be a player to do this!" -reloaded: "Config files reloaded!" -invalid-type: "Invalid cosmetic type, please use hat or backpack" -help-command: "<#6D9DC5> HMCCosmetics - Help<#6D9DC5> +no-permission: "No Permission!" +no-cosmetic-permission: "You do not have permission for this cosmetic!" +set-hat: "Applied hat!" +removed-hat: "Removed hat!" +set-backpack: "Applied backpack!" +removed-backpack: "Removed backpack!" +must-be-player: "You must be a player to do this!" +reloaded: "Config files reloaded!" +invalid-type: "Invalid cosmetic type, please use hat or backpack!" +help-command: "<#6D9DC5> HMCCosmetics - Help  <#6D9DC5> + <#5AE4B5>• <#40B7D6>/cosmetics - <#6D9DC5>Opens cosmetics GUI. @@ -17,4 +18,4 @@ help-command: "<#6D9DC5> <#5AE4B5>• <#40B7D6>/cosmetics help - <#6D9DC5>Opens this menu. - " \ No newline at end of file + " \ No newline at end of file From 3cef8dc0e348c2cee72c333abc421fea1ad7e15a Mon Sep 17 00:00:00 2001 From: lucian929 Date: Thu, 13 Jan 2022 16:40:33 -0500 Subject: [PATCH 13/13] Switched "Loaded GUI:" logger level to INFO --- .../io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java b/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java index 37020c0f..7b5ffeef 100644 --- a/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java +++ b/src/main/java/io/github/fisher2911/hmccosmetics/gui/CosmeticsMenu.java @@ -121,12 +121,11 @@ public class CosmeticsMenu { if (id.equals(DYE_MENU)) { this.guiMap.put(id, DyeGuiSerializer.INSTANCE.deserialize(DyeSelectorGui.class, source)); - this.plugin.getLogger().severe("Loaded dye gui: " + id); + this.plugin.getLogger().info("Loaded dye gui: " + id); continue; } - this.guiMap.put(id, source.get(CosmeticGui.class)); - this.plugin.getLogger().severe("Loaded gui: " + id); + this.plugin.getLogger().info("Loaded gui: " + id); } catch (final ConfigurateException exception) { exception.printStackTrace(); }