diff --git a/build/resources/main/config.yml b/build/resources/main/config.yml new file mode 100644 index 0000000..83bb814 --- /dev/null +++ b/build/resources/main/config.yml @@ -0,0 +1,17 @@ +barrier: true +bedrock: true +bell: true +crying_obsidian: true +dragon_egg: true +eggs: true +elytra: true +end_frame: true +horse_armor: true +music_discs: true +name_tag: true +nether_star: true +nether_wart: true +saddle: true +spawner: true +totem: true +trident: true \ No newline at end of file diff --git a/build/resources/main/plugin.yml b/build/resources/main/plugin.yml new file mode 100644 index 0000000..7719d6a --- /dev/null +++ b/build/resources/main/plugin.yml @@ -0,0 +1,16 @@ +name: Uncraftables +main: io.github.paldiu.Uncraftables +version: 1.2.0 +author: Paldiu +description: Adds in crafting recipes for uncraftable items. +api-version: 1.19 + +commands: + reload: + description: Reloads the plugin. + permission: uncraftables.reload + +permissions: + uncraftables.reload: + description: Allows the user to reload the plugin. + default: op \ No newline at end of file diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin new file mode 100644 index 0000000..1302472 Binary files /dev/null and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/build/tmp/jar/MANIFEST.MF b/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..59499bc --- /dev/null +++ b/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/gradlew b/gradlew index a69d9cb..744e882 100644 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/bin/sh +#!/usr/bin/env sh # -# Copyright © 2015-2021 the original authors. +# Copyright 2015 the original author or authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,101 +17,67 @@ # ############################################################################## -# -# 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/. -# +## +## Gradle start up script for UN*X +## ############################################################################## # 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 +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 done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} +APP_BASE_NAME=`basename "$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 @@ -121,9 +87,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 @@ -132,7 +98,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 @@ -140,101 +106,80 @@ 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 +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 -# 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 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" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=$( cygpath --unix "$JAVACMD" ) + 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 + # 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" ;; + esac 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. +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# 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' ' ' - )" '"$@"' +# 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" exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index f127cfd..107acd3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%"=="" @echo off +@if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. +if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,15 +75,13 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd +if "%ERRORLEVEL%"=="0" goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/main/java/io/github/paldiu/CraftingListener.java b/src/main/java/io/github/paldiu/CraftingListener.java deleted file mode 100644 index 5e4efcf..0000000 --- a/src/main/java/io/github/paldiu/CraftingListener.java +++ /dev/null @@ -1,61 +0,0 @@ -package io.github.paldiu; - -import org.bukkit.Material; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.CraftItemEvent; -import org.bukkit.event.inventory.PrepareItemCraftEvent; -import org.bukkit.inventory.CraftingInventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.Recipe; -import org.bukkit.plugin.Plugin; - -public class CraftingListener implements Listener { - public CraftingListener(Plugin instance) { - instance.getServer().getPluginManager().registerEvents(this, instance); - } - - @EventHandler - public void preCraftEvent(PrepareItemCraftEvent e) { - final Recipe recipe = e.getRecipe(); - if (recipe == null) { return; } - - final ItemStack result = recipe.getResult(); - final CraftingInventory inv = e.getInventory(); - - if (e.isRepair()) { return; } - - if (result.getType().equals(Material.NETHER_WART)) { - result.setAmount(9); - inv.setResult(result); - } - if (result.getType().equals(Material.CRYING_OBSIDIAN)) { - result.setAmount(2); - inv.setResult(result); - } - if (result.getType().equals(Material.BEDROCK)) { - result.setAmount(4); - inv.setResult(result); - } - } - - @EventHandler - public void craftEvent(CraftItemEvent e) { - final ItemStack result = e.getRecipe().getResult(); - final CraftingInventory inv = e.getInventory(); - - if (result.getType().equals(Material.NETHER_WART)) { - result.setAmount(9); - inv.setResult(result); - } - if (result.getType().equals(Material.CRYING_OBSIDIAN)) { - result.setAmount(2); - inv.setResult(result); - } - if (result.getType().equals(Material.BEDROCK)) { - result.setAmount(4); - inv.setResult(result); - } - } - -} diff --git a/src/main/java/io/github/paldiu/CraftingUtils.java b/src/main/java/io/github/paldiu/CraftingUtils.java index 04c7593..a8b4c58 100644 --- a/src/main/java/io/github/paldiu/CraftingUtils.java +++ b/src/main/java/io/github/paldiu/CraftingUtils.java @@ -1,13 +1,17 @@ package io.github.paldiu; +import io.github.paldiu.config.ItemMetaSupplier; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapelessRecipe; +import org.bukkit.inventory.meta.ItemMeta; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; +import java.util.function.Supplier; + public class CraftingUtils { private final Uncraftables plugin; @@ -26,8 +30,34 @@ public class CraftingUtils { return new ShapedRecipe(newKey(key), is); } + public final @NotNull ShapedRecipe shaped(Material result, int amount, String key) { + ItemStack is = new ItemStack(result); + is.setAmount(amount); + return new ShapedRecipe(newKey(key), is); + } + + public final @NotNull ShapedRecipe shaped(Material result, int amount, String key, ItemMetaSupplier customData) { + ItemStack is = new ItemStack(result); + is.setAmount(amount); + is.setItemMeta(customData.getFrom(is)); + return new ShapedRecipe(newKey(key), is); + } + public final @NotNull ShapelessRecipe shapeless(Material result, String key) { ItemStack is = new ItemStack(result); return new ShapelessRecipe(newKey(key), is); } + + public final @NotNull ShapelessRecipe shapeless(Material result, int amount, String key) { + ItemStack is = new ItemStack(result); + is.setAmount(amount); + return new ShapelessRecipe(newKey(key), is); + } + + public final @NotNull ShapelessRecipe shapeless(Material result, int amount, String key, ItemMetaSupplier customData) { + ItemStack is = new ItemStack(result); + is.setAmount(amount); + is.setItemMeta(customData.getFrom(is)); + return new ShapelessRecipe(newKey(key), is); + } } diff --git a/src/main/java/io/github/paldiu/Uncraftables.java b/src/main/java/io/github/paldiu/Uncraftables.java index 3fb4c64..4fdf53c 100644 --- a/src/main/java/io/github/paldiu/Uncraftables.java +++ b/src/main/java/io/github/paldiu/Uncraftables.java @@ -26,7 +26,6 @@ public class Uncraftables extends JavaPlugin { Bukkit.getLogger().info("[Uncraftables] Successfully enabled bStats metrics!"); register(); - new CraftingListener(this); Bukkit.getLogger().info("[Uncraftables] successfully loaded all recipes."); new ReloadCMD(this); @@ -51,6 +50,7 @@ public class Uncraftables extends JavaPlugin { new NameTagRecipe(this); new NetherStarRecipe(this); new NetherWartRecipe(this); + new PhantomMembraneRecipe(this); new SaddleRecipe(this); new SpawnerRecipe(this); new TotemRecipe(this); diff --git a/src/main/java/io/github/paldiu/config/ConfigValues.java b/src/main/java/io/github/paldiu/config/ConfigValues.java index 6dc28e7..de20fd7 100644 --- a/src/main/java/io/github/paldiu/config/ConfigValues.java +++ b/src/main/java/io/github/paldiu/config/ConfigValues.java @@ -76,4 +76,16 @@ public class ConfigValues { public boolean tridentEnabled() { return plugin.getYamlWrapper().getBoolean("trident"); } + + public boolean membraneEnabled() { + return plugin.getYamlWrapper().getBoolean("membrane"); + } + + public boolean cobWebEnabled() { + return plugin.getYamlWrapper().getBoolean("cobweb"); + } + + public boolean witherSkullEnabled() { + return plugin.getYamlWrapper().getBoolean("wither_skull"); + } } diff --git a/src/main/java/io/github/paldiu/config/ItemMetaSupplier.java b/src/main/java/io/github/paldiu/config/ItemMetaSupplier.java new file mode 100644 index 0000000..7b0112f --- /dev/null +++ b/src/main/java/io/github/paldiu/config/ItemMetaSupplier.java @@ -0,0 +1,9 @@ +package io.github.paldiu.config; + +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +@FunctionalInterface +public interface ItemMetaSupplier { + ItemMeta getFrom(ItemStack itemStack); +} diff --git a/src/main/java/io/github/paldiu/recipes/BedrockRecipe.java b/src/main/java/io/github/paldiu/recipes/BedrockRecipe.java index 5bba229..84784cd 100644 --- a/src/main/java/io/github/paldiu/recipes/BedrockRecipe.java +++ b/src/main/java/io/github/paldiu/recipes/BedrockRecipe.java @@ -2,6 +2,7 @@ package io.github.paldiu.recipes; import io.github.paldiu.Uncraftables; import org.bukkit.Material; +import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapelessRecipe; public class BedrockRecipe extends Craftable { @@ -10,15 +11,11 @@ public class BedrockRecipe extends Craftable { if (!getConfigValues().bedrockEnabled()) return; - ShapelessRecipe recipe = getUtil().shapeless(Material.BEDROCK, "bedrock_recipe"); - recipe.addIngredient(2, Material.OBSIDIAN); - recipe.addIngredient(2, Material.STONE); - recipe.addIngredient(1, Material.DIAMOND); - recipe.addIngredient(1, Material.IRON_INGOT); - recipe.addIngredient(1, Material.COAL); - recipe.addIngredient(1, Material.WATER_BUCKET); - recipe.addIngredient(1, Material.LAVA_BUCKET); - recipe.getResult().setAmount(4); + ShapedRecipe recipe = getUtil().shaped(Material.BEDROCK, 4, "bedrock_recipe"); + recipe.shape("dod", "ono", "dod"); + recipe.setIngredient('d', Material.DIAMOND_BLOCK); + recipe.setIngredient('o', Material.OBSIDIAN); + recipe.setIngredient('n', Material.NETHERITE_BLOCK); getPlugin().getServer().addRecipe(recipe); } } diff --git a/src/main/java/io/github/paldiu/recipes/CobWebRecipe.java b/src/main/java/io/github/paldiu/recipes/CobWebRecipe.java new file mode 100644 index 0000000..d658437 --- /dev/null +++ b/src/main/java/io/github/paldiu/recipes/CobWebRecipe.java @@ -0,0 +1,17 @@ +package io.github.paldiu.recipes; + +import io.github.paldiu.Uncraftables; +import org.bukkit.Material; +import org.bukkit.inventory.ShapelessRecipe; + +public class CobWebRecipe extends Craftable { + public CobWebRecipe(Uncraftables plugin) { + super(plugin); + + if (!getConfigValues().cobWebEnabled()) return; + + ShapelessRecipe cobweb = getUtil().shapeless(Material.COBWEB, 2, "cobweb_recipe"); + cobweb.addIngredient(9, Material.STRING); + getPlugin().getServer().addRecipe(cobweb); + } +} diff --git a/src/main/java/io/github/paldiu/recipes/CryingObsidianRecipe.java b/src/main/java/io/github/paldiu/recipes/CryingObsidianRecipe.java index 46451bd..721ccd4 100644 --- a/src/main/java/io/github/paldiu/recipes/CryingObsidianRecipe.java +++ b/src/main/java/io/github/paldiu/recipes/CryingObsidianRecipe.java @@ -2,6 +2,7 @@ package io.github.paldiu.recipes; import io.github.paldiu.Uncraftables; import org.bukkit.Material; +import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapelessRecipe; public class CryingObsidianRecipe extends Craftable { @@ -10,10 +11,11 @@ public class CryingObsidianRecipe extends Craftable { if (!getConfigValues().cryingObsidianEnabled()) return; - ShapelessRecipe recipe = getUtil().shapeless(Material.CRYING_OBSIDIAN, "crying_obsidian_recipe"); - recipe.addIngredient(1, Material.OBSIDIAN); - recipe.addIngredient(4, Material.GHAST_TEAR); - recipe.getResult().setAmount(2); + ShapedRecipe recipe = getUtil().shaped(Material.CRYING_OBSIDIAN, 2, "crying_obsidian_recipe"); + recipe.shape("aga", "gog", "aga"); + recipe.setIngredient('a', Material.AIR); + recipe.setIngredient('o', Material.OBSIDIAN); + recipe.setIngredient('g', Material.GHAST_TEAR); getPlugin().getServer().addRecipe(recipe); } } diff --git a/src/main/java/io/github/paldiu/recipes/DragonEggRecipe.java b/src/main/java/io/github/paldiu/recipes/DragonEggRecipe.java index 55976bb..97823d5 100644 --- a/src/main/java/io/github/paldiu/recipes/DragonEggRecipe.java +++ b/src/main/java/io/github/paldiu/recipes/DragonEggRecipe.java @@ -13,7 +13,7 @@ public class DragonEggRecipe extends Craftable { ShapedRecipe recipe = getUtil().shaped(Material.DRAGON_EGG, "dragon_egg_recipe"); recipe.shape("obo", "beb", "obo"); - recipe.setIngredient('o', Material.OBSIDIAN); + recipe.setIngredient('o', Material.CRYING_OBSIDIAN); recipe.setIngredient('b', Material.DRAGON_BREATH); recipe.setIngredient('e', Material.DRAGON_HEAD); getPlugin().getServer().addRecipe(recipe); diff --git a/src/main/java/io/github/paldiu/recipes/EggRecipes.java b/src/main/java/io/github/paldiu/recipes/EggRecipes.java index e4cd8dc..d6b0ee9 100644 --- a/src/main/java/io/github/paldiu/recipes/EggRecipes.java +++ b/src/main/java/io/github/paldiu/recipes/EggRecipes.java @@ -2,8 +2,12 @@ package io.github.paldiu.recipes; import io.github.paldiu.Uncraftables; import org.bukkit.Material; +import org.bukkit.inventory.ItemFlag; +import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.ShapelessRecipe; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SpawnEggMeta; public class EggRecipes extends Craftable { public EggRecipes(Uncraftables plugin) { @@ -31,6 +35,7 @@ public class EggRecipes extends Craftable { pandaEgg(); phantomEgg(); piglinEgg(); + piglinBruteEgg(); pillagerEgg(); polarBearEgg(); ravagerEgg(); @@ -79,7 +84,7 @@ public class EggRecipes extends Craftable { private void beeEgg() { ShapedRecipe beeEgg = getUtil().shaped(Material.BEE_SPAWN_EGG, "bee_egg_recipe"); - beeEgg.shape("aha","heh","aha"); + beeEgg.shape("aha", "heh", "aha"); beeEgg.setIngredient('a', Material.AIR); beeEgg.setIngredient('h', Material.HONEYCOMB); beeEgg.setIngredient('e', Material.EGG); @@ -88,7 +93,7 @@ public class EggRecipes extends Craftable { private void blazeEgg() { ShapedRecipe blazeEgg = getUtil().shaped(Material.BLAZE_SPAWN_EGG, "blaze_egg_recipe"); - blazeEgg.shape("sbs","beb","sbs"); + blazeEgg.shape("sbs", "beb", "sbs"); blazeEgg.setIngredient('s', Material.SOUL_SOIL); blazeEgg.setIngredient('b', Material.BLAZE_ROD); blazeEgg.setIngredient('e', Material.EGG); @@ -97,7 +102,7 @@ public class EggRecipes extends Craftable { private void caveSpiderEgg() { ShapedRecipe caveSpiderEgg = getUtil().shaped(Material.CAVE_SPIDER_SPAWN_EGG, "cave_spider_egg_recipe"); - caveSpiderEgg.shape("afa","ses","afa"); + caveSpiderEgg.shape("afa", "ses", "afa"); caveSpiderEgg.setIngredient('a', Material.AIR); caveSpiderEgg.setIngredient('f', Material.FERMENTED_SPIDER_EYE); caveSpiderEgg.setIngredient('s', Material.SPIDER_EYE); @@ -107,7 +112,7 @@ public class EggRecipes extends Craftable { private void creeperEgg() { ShapedRecipe creeperEgg = getUtil().shaped(Material.CREEPER_SPAWN_EGG, "creeper_egg_recipe"); - creeperEgg.shape("aga","geg","aga"); + creeperEgg.shape("aga", "geg", "aga"); creeperEgg.setIngredient('a', Material.AIR); creeperEgg.setIngredient('g', Material.GUNPOWDER); creeperEgg.setIngredient('e', Material.EGG); @@ -116,37 +121,43 @@ public class EggRecipes extends Craftable { private void dolphinEgg() { ShapedRecipe dolphin = getUtil().shaped(Material.DOLPHIN_SPAWN_EGG, "dolphin_egg_recipe"); - dolphin.shape("aca","wew","aca"); + dolphin.shape("aca", "wew", "aca"); dolphin.setIngredient('a', Material.AIR); dolphin.setIngredient('w', Material.WATER_BUCKET); - dolphin.setIngredient('c', Material.COD); + dolphin.setIngredient('c', Material.TROPICAL_FISH); dolphin.setIngredient('e', Material.EGG); getPlugin().getServer().addRecipe(dolphin); } private void drownedEgg() { ShapedRecipe drowned = getUtil().shaped(Material.DROWNED_SPAWN_EGG, "drowned_egg_recipe"); - drowned.shape("awa","fef","awa"); + drowned.shape("awa", "fef", "awa"); drowned.setIngredient('a', Material.AIR); drowned.setIngredient('w', Material.WATER_BUCKET); - drowned.setIngredient('f', Material.FISHING_ROD); + drowned.setIngredient('f', Material.KELP); drowned.setIngredient('e', Material.ZOMBIE_SPAWN_EGG); getPlugin().getServer().addRecipe(drowned); } private void elderGuardEgg() { ShapedRecipe eldGuard = getUtil().shaped(Material.ELDER_GUARDIAN_SPAWN_EGG, "elder_guardian_egg_recipe"); - eldGuard.shape("apa","ses","apa"); - eldGuard.setIngredient('a', Material.AIR); + eldGuard.shape( + "sbs", + "pep", + "sps"); + eldGuard.setIngredient('s', Material.PRISMARINE_CRYSTALS); eldGuard.setIngredient('p', Material.PRISMARINE_SHARD); eldGuard.setIngredient('e', Material.GUARDIAN_SPAWN_EGG); - eldGuard.setIngredient('s', Material.SPONGE); + eldGuard.setIngredient('b', Material.BEACON); getPlugin().getServer().addRecipe(eldGuard); } private void endermanEgg() { ShapedRecipe enderman = getUtil().shaped(Material.ENDERMAN_SPAWN_EGG, "enderman_egg_recipe"); - enderman.shape("apa","pep","apa"); + enderman.shape( + "apa", + "pep", + "apa"); enderman.setIngredient('a', Material.AIR); enderman.setIngredient('p', Material.ENDER_PEARL); enderman.setIngredient('e', Material.EGG); @@ -155,7 +166,7 @@ public class EggRecipes extends Craftable { private void endermiteEgg() { ShapedRecipe endermite = getUtil().shaped(Material.ENDERMITE_SPAWN_EGG, "endermite_egg_recipe"); - endermite.shape("apa","cec","apa"); + endermite.shape("apa", "cec", "apa"); endermite.setIngredient('a', Material.AIR); endermite.setIngredient('p', Material.ENDER_PEARL); endermite.setIngredient('c', Material.CHORUS_FRUIT); @@ -165,7 +176,7 @@ public class EggRecipes extends Craftable { private void evokerEgg() { ShapedRecipe evoker = getUtil().shaped(Material.EVOKER_SPAWN_EGG, "evoker_egg_recipe"); - evoker.shape("ata","eve","ata"); + evoker.shape("ata", "eve", "ata"); evoker.setIngredient('a', Material.AIR); evoker.setIngredient('t', Material.TOTEM_OF_UNDYING); evoker.setIngredient('e', Material.EMERALD); @@ -175,7 +186,7 @@ public class EggRecipes extends Craftable { private void foxEgg() { ShapedRecipe fox = getUtil().shaped(Material.FOX_SPAWN_EGG, "fox_egg_recipe"); - fox.shape("asa","ses","asa"); + fox.shape("asa", "ses", "asa"); fox.setIngredient('a', Material.AIR); fox.setIngredient('s', Material.SWEET_BERRIES); fox.setIngredient('e', Material.EGG); @@ -184,7 +195,7 @@ public class EggRecipes extends Craftable { private void ghastEgg() { ShapedRecipe ghast = getUtil().shaped(Material.GHAST_SPAWN_EGG, "ghast_egg_recipe"); - ghast.shape("sts","geg","sts"); + ghast.shape("sts", "geg", "sts"); ghast.setIngredient('s', Material.SOUL_SOIL); ghast.setIngredient('t', Material.GHAST_TEAR); ghast.setIngredient('g', Material.GUNPOWDER); @@ -194,7 +205,7 @@ public class EggRecipes extends Craftable { private void guardianEgg() { ShapedRecipe guardian = getUtil().shaped(Material.GUARDIAN_SPAWN_EGG, "guardian_egg_recipe"); - guardian.shape("apa","pep","apa"); + guardian.shape("apa", "pep", "apa"); guardian.setIngredient('a', Material.AIR); guardian.setIngredient('p', Material.PRISMARINE_SHARD); guardian.setIngredient('e', Material.EGG); @@ -203,7 +214,7 @@ public class EggRecipes extends Craftable { private void hoglinEgg() { ShapedRecipe hoglin = getUtil().shaped(Material.HOGLIN_SPAWN_EGG, "hoglin_egg_recipe"); - hoglin.shape("sls","pep","sls"); + hoglin.shape("sls", "pep", "sls"); hoglin.setIngredient('s', Material.SOUL_SOIL); hoglin.setIngredient('p', Material.PORKCHOP); hoglin.setIngredient('l', Material.LEATHER); @@ -213,19 +224,19 @@ public class EggRecipes extends Craftable { private void huskEgg() { ShapedRecipe husk = getUtil().shaped(Material.HUSK_SPAWN_EGG, "husk_egg_recipe"); - husk.shape("asa","rer","asa"); + husk.shape("asa", "ses", "asa"); husk.setIngredient('a', Material.AIR); husk.setIngredient('s', Material.SAND); husk.setIngredient('e', Material.ZOMBIE_SPAWN_EGG); - husk.setIngredient('r', Material.ROTTEN_FLESH); getPlugin().getServer().addRecipe(husk); } private void llamaEgg() { ShapedRecipe llama = getUtil().shaped(Material.LLAMA_SPAWN_EGG, "llama_egg_recipe"); - llama.shape("aca","lel","aca"); + llama.shape("aca", "lel", "ana"); llama.setIngredient('a', Material.AIR); llama.setIngredient('c', Material.WHITE_CARPET); + llama.setIngredient('n', Material.IRON_NUGGET); llama.setIngredient('e', Material.EGG); llama.setIngredient('l', Material.LEATHER); getPlugin().getServer().addRecipe(llama); @@ -233,16 +244,16 @@ public class EggRecipes extends Craftable { private void magmaCubeEgg() { ShapedRecipe magma_cube = getUtil().shaped(Material.MAGMA_CUBE_SPAWN_EGG, "magma_cube_egg_recipe"); - magma_cube.shape("scs","cec","scs"); + magma_cube.shape("scs", "cec", "scs"); magma_cube.setIngredient('s', Material.SOUL_SOIL); magma_cube.setIngredient('c', Material.MAGMA_CREAM); - magma_cube.setIngredient('e', Material.EGG); + magma_cube.setIngredient('e', Material.SLIME_SPAWN_EGG); getPlugin().getServer().addRecipe(magma_cube); } private void pandaEgg() { ShapedRecipe panda = getUtil().shaped(Material.PANDA_SPAWN_EGG, "panda_egg_recipe"); - panda.shape("aba","beb","aba"); + panda.shape("aba", "beb", "aba"); panda.setIngredient('a', Material.AIR); panda.setIngredient('b', Material.BAMBOO); panda.setIngredient('e', Material.EGG); @@ -251,7 +262,7 @@ public class EggRecipes extends Craftable { private void phantomEgg() { ShapedRecipe phantom = getUtil().shaped(Material.PHANTOM_SPAWN_EGG, "phantom_egg_recipe"); - phantom.shape("ama","mem","ama"); + phantom.shape("ama", "mem", "ama"); phantom.setIngredient('a', Material.AIR); phantom.setIngredient('m', Material.PHANTOM_MEMBRANE); phantom.setIngredient('e', Material.EGG); @@ -260,7 +271,7 @@ public class EggRecipes extends Craftable { private void piglinEgg() { ShapedRecipe piglin = getUtil().shaped(Material.PIGLIN_SPAWN_EGG, "piglin_egg_recipe"); - piglin.shape("sgs","nen","sgs"); + piglin.shape("sgs", "nen", "sgs"); piglin.setIngredient('s', Material.SOUL_SOIL); piglin.setIngredient('n', Material.GOLD_NUGGET); piglin.setIngredient('g', Material.GOLD_INGOT); @@ -268,19 +279,30 @@ public class EggRecipes extends Craftable { getPlugin().getServer().addRecipe(piglin); } + private void piglinBruteEgg() { + ShapedRecipe piglin_brute = getUtil().shaped(Material.PIGLIN_BRUTE_SPAWN_EGG, "piglin_brute_egg_recipe"); + piglin_brute.shape("sgs", "ael", "sgs"); + piglin_brute.setIngredient('s', Material.SOUL_SOIL); + piglin_brute.setIngredient('a', Material.GOLDEN_AXE); + piglin_brute.setIngredient('l', Material.LEATHER); + piglin_brute.setIngredient('g', Material.GOLD_INGOT); + piglin_brute.setIngredient('e', Material.PIGLIN_SPAWN_EGG); + } + private void pillagerEgg() { ShapedRecipe pillager = getUtil().shaped(Material.PILLAGER_SPAWN_EGG, "pillager_egg_recipe"); - pillager.shape("aca","*e*","aca"); + pillager.shape("aca", "wew", "ada"); pillager.setIngredient('a', Material.AIR); pillager.setIngredient('c', Material.CROSSBOW); - pillager.setIngredient('*', Material.ARROW); + pillager.setIngredient('d', Material.EMERALD); + pillager.setIngredient('w', Material.ARROW); pillager.setIngredient('e', Material.VILLAGER_SPAWN_EGG); getPlugin().getServer().addRecipe(pillager); } private void polarBearEgg() { ShapedRecipe polar_bear = getUtil().shaped(Material.POLAR_BEAR_SPAWN_EGG, "polar_bear_egg_recipe"); - polar_bear.shape("aca","ses","aca"); + polar_bear.shape("aca", "ses", "aca"); polar_bear.setIngredient('a', Material.AIR); polar_bear.setIngredient('c', Material.COD); polar_bear.setIngredient('e', Material.EGG); @@ -290,26 +312,27 @@ public class EggRecipes extends Craftable { private void ravagerEgg() { ShapedRecipe ravager = getUtil().shaped(Material.RAVAGER_SPAWN_EGG, "ravager_egg_recipe"); - ravager.shape("asa","ses","asa"); + ravager.shape("asa", "ded", "ada"); ravager.setIngredient('a', Material.AIR); ravager.setIngredient('s', Material.SADDLE); + ravager.setIngredient('d', Material.EMERALD); ravager.setIngredient('e', Material.HOGLIN_SPAWN_EGG); getPlugin().getServer().addRecipe(ravager); } private void shulkerEgg() { ShapedRecipe shulker = getUtil().shaped(Material.SHULKER_SPAWN_EGG, "shulker_egg_recipe"); - shulker.shape("scs","beb","scs"); + shulker.shape("scs", "beb", "scs"); shulker.setIngredient('s', Material.END_STONE); - shulker.setIngredient('c', Material.CHORUS_FRUIT); - shulker.setIngredient('b', Material.SHULKER_SHELL); + shulker.setIngredient('b', Material.CHORUS_FRUIT); + shulker.setIngredient('c', Material.SHULKER_SHELL); shulker.setIngredient('e', Material.EGG); getPlugin().getServer().addRecipe(shulker); } private void silverfishEgg() { ShapedRecipe silverfish = getUtil().shaped(Material.SILVERFISH_SPAWN_EGG, "silverfish_egg_recipe"); - silverfish.shape("asa","cec","asa"); + silverfish.shape("asa", "cec", "asa"); silverfish.setIngredient('a', Material.AIR); silverfish.setIngredient('s', Material.STONE_BRICKS); silverfish.setIngredient('c', Material.CHISELED_STONE_BRICKS); @@ -319,16 +342,18 @@ public class EggRecipes extends Craftable { private void skeletonEgg() { ShapedRecipe skeleton = getUtil().shaped(Material.SKELETON_SPAWN_EGG, "skeleton_egg_recipe"); - skeleton.shape("aba","beb","aba"); + skeleton.shape("asa", "bex", "aba"); skeleton.setIngredient('a', Material.AIR); skeleton.setIngredient('b', Material.BONE); + skeleton.setIngredient('x', Material.BOW); + skeleton.setIngredient('s', Material.SKELETON_SKULL); skeleton.setIngredient('e', Material.EGG); getPlugin().getServer().addRecipe(skeleton); } private void slimeEgg() { ShapedRecipe slime = getUtil().shaped(Material.SLIME_SPAWN_EGG, "slime_egg_recipe"); - slime.shape("asa","ses","asa"); + slime.shape("asa", "ses", "asa"); slime.setIngredient('a', Material.AIR); slime.setIngredient('s', Material.SLIME_BALL); slime.setIngredient('e', Material.EGG); @@ -337,7 +362,7 @@ public class EggRecipes extends Craftable { private void spiderEgg() { ShapedRecipe spider = getUtil().shaped(Material.SPIDER_SPAWN_EGG, "spider_egg_recipe"); - spider.shape("aia","ses","aia"); + spider.shape("aia", "ses", "aia"); spider.setIngredient('a', Material.AIR); spider.setIngredient('i', Material.SPIDER_EYE); spider.setIngredient('s', Material.STRING); @@ -347,17 +372,17 @@ public class EggRecipes extends Craftable { private void strayEgg() { ShapedRecipe stray = getUtil().shaped(Material.STRAY_SPAWN_EGG, "stray_egg_recipe"); - stray.shape("asa","iei","asa"); + stray.shape("asa", "iei", "asa"); stray.setIngredient('a', Material.AIR); - stray.setIngredient('s', Material.SNOWBALL); + stray.setIngredient('s', Material.BLUE_ICE); stray.setIngredient('e', Material.SKELETON_SPAWN_EGG); - stray.setIngredient('i', Material.ICE); + stray.setIngredient('i', Material.PACKED_ICE); getPlugin().getServer().addRecipe(stray); } private void striderEgg() { ShapedRecipe strider = getUtil().shaped(Material.STRIDER_SPAWN_EGG, "strider_egg_recipe"); - strider.shape("sls","lel","sls"); + strider.shape("sls", "lel", "sls"); strider.setIngredient('s', Material.SOUL_SOIL); strider.setIngredient('l', Material.LAVA_BUCKET); strider.setIngredient('e', Material.EGG); @@ -366,7 +391,7 @@ public class EggRecipes extends Craftable { private void vexEgg() { ShapedRecipe vex = getUtil().shaped(Material.VEX_SPAWN_EGG, "vex_egg_recipe"); - vex.shape("afa","fef","afa"); + vex.shape("afa", "fef", "afa"); vex.setIngredient('a', Material.AIR); vex.setIngredient('f', Material.FEATHER); vex.setIngredient('e', Material.EVOKER_SPAWN_EGG); @@ -375,7 +400,7 @@ public class EggRecipes extends Craftable { private void vindicatorEgg() { ShapedRecipe vindicator = getUtil().shaped(Material.VINDICATOR_SPAWN_EGG, "vindicator_egg_recipe"); - vindicator.shape("axa","*e*","axa"); + vindicator.shape("a*a", "*ex", "a*a"); vindicator.setIngredient('a', Material.AIR); vindicator.setIngredient('x', Material.IRON_AXE); vindicator.setIngredient('e', Material.PILLAGER_SPAWN_EGG); @@ -385,17 +410,17 @@ public class EggRecipes extends Craftable { private void witchEgg() { ShapedRecipe witch = getUtil().shaped(Material.WITCH_SPAWN_EGG, "witch_egg_recipe"); - witch.shape("apa","ses","apa"); + witch.shape("asa", "pep", "asa"); witch.setIngredient('a', Material.AIR); witch.setIngredient('p', Material.SPLASH_POTION); - witch.setIngredient('s', Material.STICK); + witch.setIngredient('s', Material.VINE); witch.setIngredient('e', Material.EGG); getPlugin().getServer().addRecipe(witch); } private void witherSkeletonEgg() { ShapedRecipe wither_skeleton = getUtil().shaped(Material.WITHER_SKELETON_SPAWN_EGG, "wither_skeleton_egg_recipe"); - wither_skeleton.shape("scs","cec","scs"); + wither_skeleton.shape("scs", "cec", "scs"); wither_skeleton.setIngredient('s', Material.SOUL_SOIL); wither_skeleton.setIngredient('c', Material.COAL); wither_skeleton.setIngredient('e', Material.SKELETON_SPAWN_EGG); @@ -404,7 +429,7 @@ public class EggRecipes extends Craftable { private void wolfEgg() { ShapedRecipe wolf = getUtil().shaped(Material.WOLF_SPAWN_EGG, "wolf_egg_recipe"); - wolf.shape("aba","nen","aba"); + wolf.shape("aba", "nen", "aba"); wolf.setIngredient('a', Material.AIR); wolf.setIngredient('b', Material.BONE); wolf.setIngredient('n', Material.NAME_TAG); @@ -414,7 +439,7 @@ public class EggRecipes extends Craftable { private void zoglinEgg() { ShapedRecipe zoglin = getUtil().shaped(Material.ZOGLIN_SPAWN_EGG, "zoglin_egg_recipe"); - zoglin.shape("srs","rer","srs"); + zoglin.shape("srs", "rer", "srs"); zoglin.setIngredient('s', Material.SOUL_SOIL); zoglin.setIngredient('r', Material.ROTTEN_FLESH); zoglin.setIngredient('e', Material.HOGLIN_SPAWN_EGG); @@ -423,7 +448,7 @@ public class EggRecipes extends Craftable { private void zombieEgg() { ShapedRecipe zombie = getUtil().shaped(Material.ZOMBIE_SPAWN_EGG, "zombie_egg_recipe"); - zombie.shape("ara","rer","ara"); + zombie.shape("ara", "rer", "ara"); zombie.setIngredient('a', Material.AIR); zombie.setIngredient('r', Material.ROTTEN_FLESH); zombie.setIngredient('e', Material.EGG); @@ -432,7 +457,7 @@ public class EggRecipes extends Craftable { private void zombieVillagerEgg() { ShapedRecipe zombie_villager = getUtil().shaped(Material.ZOMBIE_VILLAGER_SPAWN_EGG, "z_villager_egg_recipe"); - zombie_villager.shape("ara","rer","ara"); + zombie_villager.shape("ara", "rer", "ara"); zombie_villager.setIngredient('a', Material.AIR); zombie_villager.setIngredient('r', Material.ROTTEN_FLESH); zombie_villager.setIngredient('e', Material.VILLAGER_SPAWN_EGG); @@ -441,7 +466,7 @@ public class EggRecipes extends Craftable { private void zPiglinEgg() { ShapedRecipe zombie_piglin = getUtil().shaped(Material.ZOMBIFIED_PIGLIN_SPAWN_EGG, "z_piglin_egg_recipe"); - zombie_piglin.shape("srs","rer","srs"); + zombie_piglin.shape("srs", "rer", "srs"); zombie_piglin.setIngredient('s', Material.SOUL_SOIL); zombie_piglin.setIngredient('r', Material.ROTTEN_FLESH); zombie_piglin.setIngredient('e', Material.PIGLIN_SPAWN_EGG); @@ -452,7 +477,7 @@ public class EggRecipes extends Craftable { private void batEgg() { ShapedRecipe bat = getUtil().shaped(Material.BAT_SPAWN_EGG, "bat_egg_recipe"); - bat.shape("aba","fef","aba"); + bat.shape("aba", "fef", "aba"); bat.setIngredient('a', Material.AIR); bat.setIngredient('b', Material.APPLE); bat.setIngredient('e', Material.CHICKEN_SPAWN_EGG); @@ -462,7 +487,7 @@ public class EggRecipes extends Craftable { private void catEgg() { ShapedRecipe cat = getUtil().shaped(Material.CAT_SPAWN_EGG, "cat_egg_recipe"); - cat.shape("aca","ses","aca"); + cat.shape("aca", "ses", "aca"); cat.setIngredient('a', Material.AIR); cat.setIngredient('c', Material.COD); cat.setIngredient('s', Material.SALMON); @@ -472,7 +497,7 @@ public class EggRecipes extends Craftable { private void chickenEgg() { ShapedRecipe chimken = getUtil().shaped(Material.CHICKEN_SPAWN_EGG, "chicken_egg_recipe"); - chimken.shape("afa","fef","afa"); + chimken.shape("afa", "fef", "afa"); chimken.setIngredient('a', Material.AIR); chimken.setIngredient('f', Material.FEATHER); chimken.setIngredient('e', Material.EGG); @@ -481,7 +506,7 @@ public class EggRecipes extends Craftable { private void codEgg() { ShapedRecipe cod = getUtil().shaped(Material.COD_SPAWN_EGG, "cod_egg_recipe"); - cod.shape("aca","cec","aca"); + cod.shape("aca", "cec", "aca"); cod.setIngredient('a', Material.AIR); cod.setIngredient('c', Material.COD); cod.setIngredient('e', Material.EGG); @@ -490,7 +515,7 @@ public class EggRecipes extends Craftable { private void cowEgg() { ShapedRecipe coo = getUtil().shaped(Material.COW_SPAWN_EGG, "cow_egg_recipe"); - coo.shape("ala","lel","ala"); + coo.shape("ala", "lel", "ala"); coo.setIngredient('a', Material.AIR); coo.setIngredient('l', Material.LEATHER); coo.setIngredient('e', Material.EGG); @@ -505,7 +530,7 @@ public class EggRecipes extends Craftable { private void horseEgg() { ShapedRecipe hoarse = getUtil().shaped(Material.HORSE_SPAWN_EGG, "horse_egg_recipe"); - hoarse.shape("asa","lel","ala"); + hoarse.shape("asa", "lel", "ala"); hoarse.setIngredient('a', Material.AIR); hoarse.setIngredient('s', Material.SADDLE); hoarse.setIngredient('e', Material.EGG); @@ -515,7 +540,7 @@ public class EggRecipes extends Craftable { private void mooshroomEgg() { ShapedRecipe coo_pat = getUtil().shaped(Material.MOOSHROOM_SPAWN_EGG, "mooshroom_egg_recipe"); - coo_pat.shape("ara","rer","ara"); + coo_pat.shape("ara", "rer", "ara"); coo_pat.setIngredient('a', Material.AIR); coo_pat.setIngredient('r', Material.RED_MUSHROOM); coo_pat.setIngredient('e', Material.COW_SPAWN_EGG); @@ -531,7 +556,7 @@ public class EggRecipes extends Craftable { private void ocelotEgg() { ShapedRecipe ocky_way = getUtil().shaped(Material.OCELOT_SPAWN_EGG, "ocelot_egg_recipe"); - ocky_way.shape("aca","ses","aca"); + ocky_way.shape("aca", "ses", "aca"); ocky_way.setIngredient('a', Material.AIR); ocky_way.setIngredient('c', Material.COCOA_BEANS); ocky_way.setIngredient('s', Material.SALMON); @@ -541,7 +566,7 @@ public class EggRecipes extends Craftable { private void parrotEgg() { ShapedRecipe garrote = getUtil().shaped(Material.PARROT_SPAWN_EGG, "parrot_egg_recipe"); - garrote.shape("asa","fef","asa"); + garrote.shape("asa", "fef", "asa"); garrote.setIngredient('a', Material.AIR); garrote.setIngredient('s', Material.WHEAT_SEEDS); garrote.setIngredient('f', Material.FEATHER); @@ -551,7 +576,7 @@ public class EggRecipes extends Craftable { private void pigEgg() { ShapedRecipe pidge = getUtil().shaped(Material.PIG_SPAWN_EGG, "pig_egg_recipe"); - pidge.shape("aca","cec","aca"); + pidge.shape("aca", "cec", "aca"); pidge.setIngredient('a', Material.AIR); pidge.setIngredient('c', Material.PORKCHOP); pidge.setIngredient('e', Material.EGG); @@ -560,7 +585,7 @@ public class EggRecipes extends Craftable { private void pufferfishEgg() { ShapedRecipe paisson = getUtil().shaped(Material.PUFFERFISH_SPAWN_EGG, "pufferfish_egg_recipe"); - paisson.shape("apa","pep","apa"); + paisson.shape("apa", "pep", "apa"); paisson.setIngredient('a', Material.AIR); paisson.setIngredient('p', Material.PUFFERFISH); paisson.setIngredient('e', Material.EGG); @@ -569,7 +594,7 @@ public class EggRecipes extends Craftable { private void rabbitEgg() { ShapedRecipe rebillet = getUtil().shaped(Material.RABBIT_SPAWN_EGG, "rabbit_egg_recipe"); - rebillet.shape("aha","heh","afa"); + rebillet.shape("aha", "heh", "afa"); rebillet.setIngredient('a', Material.AIR); rebillet.setIngredient('h', Material.RABBIT_HIDE); rebillet.setIngredient('e', Material.EGG); @@ -579,7 +604,7 @@ public class EggRecipes extends Craftable { private void salmonEgg() { ShapedRecipe slammin_salmon = getUtil().shaped(Material.SALMON_SPAWN_EGG, "salmon_egg_recipe"); - slammin_salmon.shape("asa","ses","asa"); + slammin_salmon.shape("asa", "ses", "asa"); slammin_salmon.setIngredient('a', Material.AIR); slammin_salmon.setIngredient('s', Material.SALMON); slammin_salmon.setIngredient('e', Material.EGG); @@ -588,7 +613,7 @@ public class EggRecipes extends Craftable { private void sheepEgg() { ShapedRecipe haggis = getUtil().shaped(Material.SHEEP_SPAWN_EGG, "sheep_egg_recipe"); - haggis.shape("awa","mem","awa"); + haggis.shape("awa", "mem", "awa"); haggis.setIngredient('a', Material.AIR); haggis.setIngredient('w', Material.WHITE_WOOL); haggis.setIngredient('m', Material.MUTTON); @@ -605,7 +630,7 @@ public class EggRecipes extends Craftable { private void squidEgg() { ShapedRecipe squidge = getUtil().shaped(Material.SQUID_SPAWN_EGG, "squid_egg_recipe"); - squidge.shape("aia","iei","aia"); + squidge.shape("aia", "iei", "aia"); squidge.setIngredient('a', Material.AIR); squidge.setIngredient('i', Material.INK_SAC); squidge.setIngredient('e', Material.EGG); @@ -631,7 +656,7 @@ public class EggRecipes extends Craftable { private void turtleEgg() { ShapedRecipe tortuga = getUtil().shaped(Material.TURTLE_SPAWN_EGG, "turtle_egg_recipe"); - tortuga.shape("asa","ses","asa"); + tortuga.shape("asa", "ses", "asa"); tortuga.setIngredient('a', Material.AIR); tortuga.setIngredient('s', Material.SCUTE); tortuga.setIngredient('e', Material.EGG); @@ -640,7 +665,7 @@ public class EggRecipes extends Craftable { private void villagerEgg() { ShapedRecipe moron = getUtil().shaped(Material.VILLAGER_SPAWN_EGG, "villager_egg_recipe"); - moron.shape("aea","p*p","aea"); + moron.shape("aea", "p*p", "aea"); moron.setIngredient('a', Material.AIR); moron.setIngredient('e', Material.EGG); moron.setIngredient('p', Material.POPPY); @@ -650,7 +675,7 @@ public class EggRecipes extends Craftable { private void traderEgg() { ShapedRecipe dinkhead = getUtil().shaped(Material.WANDERING_TRADER_SPAWN_EGG, "trader_egg_recipe"); - dinkhead.shape("aea","e*e","aea"); + dinkhead.shape("aea", "e*e", "aea"); dinkhead.setIngredient('a', Material.AIR); dinkhead.setIngredient('e', Material.EMERALD); dinkhead.setIngredient('*', Material.VILLAGER_SPAWN_EGG); diff --git a/src/main/java/io/github/paldiu/recipes/NetherStarRecipe.java b/src/main/java/io/github/paldiu/recipes/NetherStarRecipe.java index 762879d..5fc6ae9 100644 --- a/src/main/java/io/github/paldiu/recipes/NetherStarRecipe.java +++ b/src/main/java/io/github/paldiu/recipes/NetherStarRecipe.java @@ -10,13 +10,13 @@ public class NetherStarRecipe extends Craftable { if (!getConfigValues().netherStarEnabled()) return; - ShapedRecipe recipe = getUtil().shaped(Material.NETHER_STAR, "nether_star_recipe"); - recipe.shape("nwn","sss","bqb"); - recipe.setIngredient('n', Material.NETHER_WART); - recipe.setIngredient('w', Material.WITHER_SKELETON_SKULL); - recipe.setIngredient('s', Material.SOUL_SAND); - recipe.setIngredient('b', Material.BLAZE_ROD); - recipe.setIngredient('q', Material.QUARTZ); - getPlugin().getServer().addRecipe(recipe); + ShapedRecipe nether_star = getUtil().shaped(Material.NETHER_STAR, "nether_star_recipe"); + nether_star.shape("nwn","sss","bqb"); + nether_star.setIngredient('n', Material.NETHER_WART); + nether_star.setIngredient('w', Material.WITHER_SKELETON_SKULL); + nether_star.setIngredient('s', Material.SOUL_SAND); + nether_star.setIngredient('b', Material.BLAZE_ROD); + nether_star.setIngredient('q', Material.QUARTZ); + getPlugin().getServer().addRecipe(nether_star); } } diff --git a/src/main/java/io/github/paldiu/recipes/NetherWartRecipe.java b/src/main/java/io/github/paldiu/recipes/NetherWartRecipe.java index 6496283..3bda6d9 100644 --- a/src/main/java/io/github/paldiu/recipes/NetherWartRecipe.java +++ b/src/main/java/io/github/paldiu/recipes/NetherWartRecipe.java @@ -10,9 +10,8 @@ public class NetherWartRecipe extends Craftable { if (!getConfigValues().netherWartEnabled()) return; - ShapelessRecipe recipe = getUtil().shapeless(Material.NETHER_WART, "netherwart_recipe"); - recipe.addIngredient(1, Material.NETHER_WART_BLOCK); - recipe.getResult().setAmount(9); - getPlugin().getServer().addRecipe(recipe); + ShapelessRecipe netherwart = getUtil().shapeless(Material.NETHER_WART, 9, "netherwart_recipe"); + netherwart.addIngredient(1, Material.NETHER_WART_BLOCK); + getPlugin().getServer().addRecipe(netherwart); } } diff --git a/src/main/java/io/github/paldiu/recipes/PhantomMembraneRecipe.java b/src/main/java/io/github/paldiu/recipes/PhantomMembraneRecipe.java new file mode 100644 index 0000000..9f0d457 --- /dev/null +++ b/src/main/java/io/github/paldiu/recipes/PhantomMembraneRecipe.java @@ -0,0 +1,20 @@ +package io.github.paldiu.recipes; + +import io.github.paldiu.Uncraftables; +import org.bukkit.Material; +import org.bukkit.inventory.ShapedRecipe; + +public class PhantomMembraneRecipe extends Craftable{ + public PhantomMembraneRecipe(Uncraftables plugin) { + super(plugin); + + if (!getConfigValues().membraneEnabled()) return; + + ShapedRecipe membrane = getUtil().shaped(Material.PHANTOM_MEMBRANE, "membrane_recipe"); + membrane.shape("sfs", "frf", "sfs"); + membrane.setIngredient('s', Material.SLIME_BALL); + membrane.setIngredient('f', Material.FEATHER); + membrane.setIngredient('r', Material.FIREWORK_STAR); + getPlugin().getServer().addRecipe(membrane); + } +} diff --git a/src/main/java/io/github/paldiu/recipes/WitherSkullRecipe.java b/src/main/java/io/github/paldiu/recipes/WitherSkullRecipe.java new file mode 100644 index 0000000..e560542 --- /dev/null +++ b/src/main/java/io/github/paldiu/recipes/WitherSkullRecipe.java @@ -0,0 +1,21 @@ +package io.github.paldiu.recipes; + +import io.github.paldiu.Uncraftables; +import org.bukkit.Material; +import org.bukkit.inventory.ShapedRecipe; + +public class WitherSkullRecipe extends Craftable { + + public WitherSkullRecipe(Uncraftables plugin) { + super(plugin); + + if (!getConfigValues().witherSkullEnabled()) return; + + ShapedRecipe recipe = getUtil().shaped(Material.WITHER_SKELETON_SKULL, "wither_skull_recipe"); + recipe.shape("scs", "coc", "scs"); + recipe.setIngredient('s', Material.SOUL_SOIL); + recipe.setIngredient('c', Material.COAL); + recipe.setIngredient('o', Material.SKELETON_SKULL); + getPlugin().getServer().addRecipe(recipe); + } +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 83bb814..7836a3d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,12 +1,14 @@ barrier: true bedrock: true bell: true +cobweb: true crying_obsidian: true dragon_egg: true eggs: true elytra: true end_frame: true horse_armor: true +membrane: true music_discs: true name_tag: true nether_star: true @@ -14,4 +16,5 @@ nether_wart: true saddle: true spawner: true totem: true -trident: true \ No newline at end of file +trident: true +wither_skull: true \ No newline at end of file