Initial commit

This commit is contained in:
Paul Reilly 2020-07-11 14:28:42 -05:00
commit 3b6479cfc6
12 changed files with 284 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

View File

@ -0,0 +1,9 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="JAVA">
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

13
.idea/compiler.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="Uncraftables" />
</profile>
</annotationProcessing>
</component>
</project>

14
.idea/misc.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

62
.idea/workspace.xml Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="b7e3dfbd-dfc6-4dd5-b2c6-f110c120ecb3" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CodeStyleSettingsInfer">
<option name="done" value="true" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="MavenImportPreferences">
<option name="importingSettings">
<MavenImportingSettings>
<option name="importAutomatically" value="true" />
</MavenImportingSettings>
</option>
</component>
<component name="ProjectCodeStyleSettingsMigration">
<option name="version" value="1" />
</component>
<component name="ProjectId" id="1eYG3MGleQPorECCh37o5s5BQgS" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="b7e3dfbd-dfc6-4dd5-b2c6-f110c120ecb3" name="Default Changelist" comment="" />
<created>1594490912181</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1594490912181</updated>
</task>
<servers />
</component>
<component name="WindowStateProjectService">
<state x="446" y="70" key="#com.intellij.ide.util.MemberChooser" timestamp="1594491647536">
<screen x="0" y="0" width="1280" height="720" />
</state>
<state x="446" y="70" key="#com.intellij.ide.util.MemberChooser/0.0.1280.720@0.0.1280.720" timestamp="1594491647536" />
<state x="303" y="41" width="672" height="678" key="search.everywhere.popup" timestamp="1594493483113">
<screen x="0" y="0" width="1280" height="720" />
</state>
<state x="303" y="41" width="672" height="678" key="search.everywhere.popup/0.0.1280.720@0.0.1280.720" timestamp="1594493483113" />
</component>
</project>

2
Uncraftables.iml Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />

32
pom.xml Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dev.coomware</groupId>
<artifactId>Uncraftables</artifactId>
<version>1.0.0</version>
<repositories>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,83 @@
package dev.coomware;
import org.bukkit.Material;
import org.bukkit.inventory.ShapedRecipe;
public class Craftable {
private Uncraftables plugin;
private CraftingUtils util = Uncraftables.plugin.util;
public Craftable(Uncraftables instance) {
plugin = instance;
}
public void craftables() {
saddle();
leatherHorseArmor();
ironHorseArmor();
goldHorseArmor();
diamondHorseArmor();
nametag();
}
private void saddle() {
ShapedRecipe saddle = util.shaped(Material.SADDLE, "saddle_recipe");
saddle.shape("wlw","sls","wlw");
saddle.setIngredient('w', Material.STICK);
saddle.setIngredient('s', Material.STRING);
saddle.setIngredient('l', Material.LEATHER);
plugin.server.addRecipe(saddle);
}
private void leatherHorseArmor() {
ShapedRecipe armor = util.shaped(Material.LEATHER_HORSE_ARMOR, "leather_horse_armor_recipe");
armor.shape("aal","l*l","lsi");
armor.setIngredient('a', Material.AIR);
armor.setIngredient('s', Material.STRING);
armor.setIngredient('l', Material.LEATHER);
armor.setIngredient('*', Material.SADDLE);
armor.setIngredient('i', Material.IRON_INGOT);
plugin.server.addRecipe(armor);
}
private void ironHorseArmor() {
ShapedRecipe armor = util.shaped(Material.IRON_HORSE_ARMOR, "iron_horse_armor_recipe");
armor.shape("aai","i*i","isi");
armor.setIngredient('a', Material.AIR);
armor.setIngredient('s', Material.STRING);
armor.setIngredient('*', Material.SADDLE);
armor.setIngredient('i', Material.IRON_INGOT);
plugin.server.addRecipe(armor);
}
private void goldHorseArmor() {
ShapedRecipe armor = util.shaped(Material.GOLDEN_HORSE_ARMOR, "golden_horse_armor_recipe");
armor.shape("aag","g*g","gsi");
armor.setIngredient('a', Material.AIR);
armor.setIngredient('s', Material.STRING);
armor.setIngredient('g', Material.GOLD_INGOT);
armor.setIngredient('*', Material.SADDLE);
armor.setIngredient('i', Material.IRON_INGOT);
plugin.server.addRecipe(armor);
}
private void diamondHorseArmor() {
ShapedRecipe armor = util.shaped(Material.DIAMOND_HORSE_ARMOR, "diamond_horse_armor_recipe");
armor.shape("aad","d*d","dsi");
armor.setIngredient('a', Material.AIR);
armor.setIngredient('s', Material.STRING);
armor.setIngredient('d', Material.DIAMOND);
armor.setIngredient('*', Material.SADDLE);
armor.setIngredient('i', Material.IRON_INGOT);
plugin.server.addRecipe(armor);
}
private void nametag() {
ShapedRecipe nametag = util.shaped(Material.NAME_TAG, "nametag_recipe");
nametag.shape("aas","apa","paa");
nametag.setIngredient('a', Material.AIR);
nametag.setIngredient('s', Material.STRING);
nametag.setIngredient('p', Material.PAPER);
plugin.server.addRecipe(nametag);
}
}

View File

@ -0,0 +1,29 @@
package dev.coomware;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe;
public class CraftingUtils {
private Uncraftables plugin;
public CraftingUtils(Uncraftables instance) {
plugin = instance;
}
private NamespacedKey newKey(String string) {
return new NamespacedKey(plugin, string);
}
public ShapedRecipe shaped(Material result, String key) {
ItemStack is = new ItemStack(result);
return new ShapedRecipe(newKey(key), is);
}
public ShapelessRecipe shapeless(Material result, String key) {
ItemStack is = new ItemStack(result);
return new ShapelessRecipe(newKey(key), is);
}
}

View File

@ -0,0 +1,27 @@
package dev.coomware;
import org.bukkit.Server;
import org.bukkit.plugin.java.JavaPlugin;
public class Uncraftables extends JavaPlugin {
public static Uncraftables plugin;
public Server server;
public CraftingUtils util;
@Override
public void onLoad() {
plugin = this;
server = getServer();
util = new CraftingUtils(this);
}
@Override
public void onEnable() {
new Craftable(this).craftables();
}
@Override
public void onDisable() {
}
}

View File

@ -0,0 +1,6 @@
name: Uncraftables
main: dev.coomware.Uncraftables
version: 1.0.0
author: CoomWare
description: Adds in crafting recipes for all uncraftable items.
api-version: 1.16