mirror of
https://github.com/SimplexDevelopment/Chainmail.git
synced 2024-11-01 00:37:11 +00:00
Fixed shaped crafting, added cheaper chains
Made chains give 3 instead of 1 when crafted, making chainmail a bit cheaper to craft. This is due to chainmail having the same protection rating as Gold, but having the same durability as Iron. Before, it was pointless to craft chainmail as it was weaker than iron yet cost a little bit more than iron armor due to the use of iron nuggets along with one iron ingot. Also, fixed crafting for the helmet and boots.
This commit is contained in:
parent
c6a770a1fa
commit
062c5c9cad
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -1,7 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="a10c035f-3136-4a06-841f-0569882b4bf7" name="Default Changelist" comment="" />
|
||||
<list default="true" id="a10c035f-3136-4a06-841f-0569882b4bf7" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/dev/coomware/CheaperChains.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/dev/coomware/Chainmail.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/dev/coomware/Chainmail.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/plugin.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/plugin.yml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
@ -17,6 +24,9 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectCodeStyleSettingsMigration">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
@ -28,6 +38,7 @@
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||
<property name="project.structure.last.edited" value="Modules" />
|
||||
<property name="project.structure.proportion" value="0.0" />
|
||||
<property name="project.structure.side.proportion" value="0.0" />
|
||||
@ -50,29 +61,29 @@
|
||||
<screen x="0" y="0" width="1280" height="720" />
|
||||
</state>
|
||||
<state x="233" y="19" key="#Project_Structure/0.0.1280.720@0.0.1280.720" timestamp="1594431018212" />
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.bottom" timestamp="1594433176611">
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.bottom" timestamp="1594484859921">
|
||||
<screen x="0" y="0" width="1280" height="720" />
|
||||
</state>
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.bottom/0.0.1280.720@0.0.1280.720" timestamp="1594433176611" />
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.center" timestamp="1594433176611">
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.bottom/0.0.1280.720@0.0.1280.720" timestamp="1594484859921" />
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.center" timestamp="1594484859921">
|
||||
<screen x="0" y="0" width="1280" height="720" />
|
||||
</state>
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.center/0.0.1280.720@0.0.1280.720" timestamp="1594433176611" />
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.left" timestamp="1594433176610">
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.center/0.0.1280.720@0.0.1280.720" timestamp="1594484859921" />
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.left" timestamp="1594484859920">
|
||||
<screen x="0" y="0" width="1280" height="720" />
|
||||
</state>
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.left/0.0.1280.720@0.0.1280.720" timestamp="1594433176610" />
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.right" timestamp="1594433176611">
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.left/0.0.1280.720@0.0.1280.720" timestamp="1594484859920" />
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.right" timestamp="1594484859921">
|
||||
<screen x="0" y="0" width="1280" height="720" />
|
||||
</state>
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.right/0.0.1280.720@0.0.1280.720" timestamp="1594433176611" />
|
||||
<state x="337" y="185" key="com.intellij.ide.util.TipDialog" timestamp="1594433149112">
|
||||
<state width="1236" height="176" key="GridCell.Tab.0.right/0.0.1280.720@0.0.1280.720" timestamp="1594484859921" />
|
||||
<state x="337" y="185" key="com.intellij.ide.util.TipDialog" timestamp="1594482989645">
|
||||
<screen x="0" y="0" width="1280" height="720" />
|
||||
</state>
|
||||
<state x="337" y="185" key="com.intellij.ide.util.TipDialog/0.0.1280.720@0.0.1280.720" timestamp="1594433149112" />
|
||||
<state x="303" y="41" width="672" height="678" key="search.everywhere.popup" timestamp="1594432413312">
|
||||
<state x="337" y="185" key="com.intellij.ide.util.TipDialog/0.0.1280.720@0.0.1280.720" timestamp="1594482989645" />
|
||||
<state x="303" y="41" width="672" height="678" key="search.everywhere.popup" timestamp="1594484613684">
|
||||
<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="1594432413312" />
|
||||
<state x="303" y="41" width="672" height="678" key="search.everywhere.popup/0.0.1280.720@0.0.1280.720" timestamp="1594484613684" />
|
||||
</component>
|
||||
</project>
|
6
pom.xml
6
pom.xml
@ -22,6 +22,12 @@
|
||||
<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>
|
||||
|
||||
|
||||
|
@ -3,13 +3,24 @@ package dev.coomware;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Chainmail extends JavaPlugin {
|
||||
public static Chainmail plugin;
|
||||
public Server server;
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
plugin = this;
|
||||
server = getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
new CheaperChains(this);
|
||||
newRecipes();
|
||||
Bukkit.getLogger().info("Successfully added new recipes for chainmail armor.");
|
||||
Bukkit.getLogger().info("This plugin was made by CoomWare.");
|
||||
@ -23,9 +34,11 @@ public class Chainmail extends JavaPlugin {
|
||||
private void newRecipes() {
|
||||
//New namespaced keys for identification for each new recipe.
|
||||
NamespacedKey key1 = new NamespacedKey(this, "chain_helmet_recipe");
|
||||
NamespacedKey key1a = new NamespacedKey(this, "chain_helmet_alternate");
|
||||
NamespacedKey key2 = new NamespacedKey(this, "chaim_chest_recipe");
|
||||
NamespacedKey key3 = new NamespacedKey(this, "chain_pants_recipe");
|
||||
NamespacedKey key4 = new NamespacedKey(this, "chain_boots_recipe");
|
||||
NamespacedKey key4a = new NamespacedKey(this, "chain_boots_alternate");
|
||||
|
||||
//Define the final item to create
|
||||
ItemStack helmet = new ItemStack(Material.CHAINMAIL_HELMET);
|
||||
@ -35,19 +48,25 @@ public class Chainmail extends JavaPlugin {
|
||||
|
||||
//Initialize new recipe instances
|
||||
ShapedRecipe chelm = new ShapedRecipe(key1, helmet);
|
||||
ShapedRecipe chelmA = new ShapedRecipe(key1a, helmet);
|
||||
ShapedRecipe cchest = new ShapedRecipe(key2, chest);
|
||||
ShapedRecipe cpants = new ShapedRecipe(key3, pants);
|
||||
ShapedRecipe cboots = new ShapedRecipe(key4, boots);
|
||||
ShapedRecipe cbootsA = new ShapedRecipe(key4a, boots);
|
||||
|
||||
//Define the shape of the recipes
|
||||
chelm.shape("ccc","cac","aaa");
|
||||
chelmA.shape("aaa","ccc","cac");
|
||||
cchest.shape("cac","ccc","ccc");
|
||||
cpants.shape("ccc","cac","cac");
|
||||
cboots.shape("aaa","cac","cac");
|
||||
cbootsA.shape("cac","cac","aaa");
|
||||
|
||||
//Helmet
|
||||
chelm.setIngredient('c', Material.CHAIN);
|
||||
chelm.setIngredient('a', Material.AIR);
|
||||
chelmA.setIngredient('c', Material.CHAIN);
|
||||
chelmA.setIngredient('a', Material.AIR);
|
||||
//Chestplate
|
||||
cchest.setIngredient('c', Material.CHAIN);
|
||||
cchest.setIngredient('a', Material.AIR);
|
||||
@ -57,11 +76,15 @@ public class Chainmail extends JavaPlugin {
|
||||
//Boots
|
||||
cboots.setIngredient('c', Material.CHAIN);
|
||||
cboots.setIngredient('a', Material.AIR);
|
||||
cbootsA.setIngredient('c', Material.CHAIN);
|
||||
cbootsA.setIngredient('a', Material.AIR);
|
||||
|
||||
//Add all the new recipes to the server :)
|
||||
getServer().addRecipe(chelm);
|
||||
getServer().addRecipe(cchest);
|
||||
getServer().addRecipe(cpants);
|
||||
getServer().addRecipe(cboots);
|
||||
server.addRecipe(chelm);
|
||||
server.addRecipe(chelmA);
|
||||
server.addRecipe(cchest);
|
||||
server.addRecipe(cpants);
|
||||
server.addRecipe(cboots);
|
||||
server.addRecipe(cbootsA);
|
||||
}
|
||||
}
|
||||
|
33
src/main/java/dev/coomware/CheaperChains.java
Normal file
33
src/main/java/dev/coomware/CheaperChains.java
Normal file
@ -0,0 +1,33 @@
|
||||
package dev.coomware;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.PrepareItemCraftEvent;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CheaperChains implements Listener {
|
||||
//Initializer
|
||||
public CheaperChains(@NotNull Chainmail plugin) {
|
||||
plugin.server.getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
//This event priority should make the condition guaranteed
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void chainCraftEvent(@NotNull PrepareItemCraftEvent e) {
|
||||
//Check to make sure the return value isn't just a repaired item
|
||||
if (e.isRepair()) { return; }
|
||||
|
||||
final Recipe recipe = e.getRecipe();
|
||||
|
||||
//Check to make sure the recipe actually exists
|
||||
if (recipe == null) { return; }
|
||||
|
||||
//If the result of the recipe is chains, set the amount to give to 3
|
||||
if (recipe.getResult().getType() == Material.CHAIN) {
|
||||
recipe.getResult().setAmount(3);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
name: Chainmail
|
||||
main: dev.coomware.Chainmail
|
||||
version: 1.0.0-FINAL
|
||||
version: 1.1.0
|
||||
description: Plugin which adds a recipe for chainmail armor using chains.
|
||||
author: CoomWare
|
||||
api-version: 1.16
|
Binary file not shown.
Binary file not shown.
BIN
target/classes/dev/coomware/CheaperChains.class
Normal file
BIN
target/classes/dev/coomware/CheaperChains.class
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: Chainmail
|
||||
main: dev.coomware.Chainmail
|
||||
version: 1.0.0-FINAL
|
||||
version: 1.1.0
|
||||
description: Plugin which adds a recipe for chainmail armor using chains.
|
||||
author: CoomWare
|
||||
api-version: 1.16
|
@ -1 +1,2 @@
|
||||
dev\coomware\Chainmail.class
|
||||
dev\coomware\CheaperChains.class
|
||||
|
Loading…
Reference in New Issue
Block a user