Fixed up some issues

fixes
This commit is contained in:
Paul Reilly 2020-07-11 14:27:45 -05:00
parent 062c5c9cad
commit eff95b1b7b
7 changed files with 39 additions and 20 deletions

View File

@ -2,12 +2,12 @@
<project version="4">
<component name="ChangeListManager">
<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" />
<change beforePath="$PROJECT_DIR$/src/main/java/dev/coomware/CheaperChains.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/dev/coomware/CheaperChains.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/Chainmail.jar" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/dev/coomware/CheaperChains.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/dev/coomware/CheaperChains.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/maven-archiver/pom.properties" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-archiver/pom.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -61,26 +61,30 @@
<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="1594484859921">
<state width="1236" height="176" key="GridCell.Tab.0.bottom" timestamp="1594490934355">
<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="1594484859921" />
<state width="1236" height="176" key="GridCell.Tab.0.center" timestamp="1594484859921">
<state width="1236" height="176" key="GridCell.Tab.0.bottom/0.0.1280.720@0.0.1280.720" timestamp="1594490934355" />
<state width="1236" height="176" key="GridCell.Tab.0.center" timestamp="1594490934355">
<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="1594484859921" />
<state width="1236" height="176" key="GridCell.Tab.0.left" timestamp="1594484859920">
<state width="1236" height="176" key="GridCell.Tab.0.center/0.0.1280.720@0.0.1280.720" timestamp="1594490934355" />
<state width="1236" height="176" key="GridCell.Tab.0.left" timestamp="1594490934354">
<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="1594484859920" />
<state width="1236" height="176" key="GridCell.Tab.0.right" timestamp="1594484859921">
<state width="1236" height="176" key="GridCell.Tab.0.left/0.0.1280.720@0.0.1280.720" timestamp="1594490934354" />
<state width="1236" height="176" key="GridCell.Tab.0.right" timestamp="1594490934355">
<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="1594484859921" />
<state x="337" y="185" key="com.intellij.ide.util.TipDialog" timestamp="1594482989645">
<state width="1236" height="176" key="GridCell.Tab.0.right/0.0.1280.720@0.0.1280.720" timestamp="1594490934355" />
<state x="337" y="185" key="com.intellij.ide.util.TipDialog" timestamp="1594486161225">
<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="1594482989645" />
<state x="337" y="185" key="com.intellij.ide.util.TipDialog/0.0.1280.720@0.0.1280.720" timestamp="1594486161225" />
<state x="91" y="63" key="new project wizard" timestamp="1594490907072">
<screen x="0" y="0" width="1280" height="720" />
</state>
<state x="91" y="63" key="new project wizard/0.0.1280.720@0.0.1280.720" timestamp="1594490907072" />
<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>

View File

@ -4,7 +4,9 @@ import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.jetbrains.annotations.NotNull;
@ -16,18 +18,30 @@ public class CheaperChains implements Listener {
//This event priority should make the condition guaranteed
@EventHandler(priority = EventPriority.HIGHEST)
public void chainCraftEvent(@NotNull PrepareItemCraftEvent e) {
public void prepareCraftEvent(@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; }
final ItemStack result = recipe.getResult();
//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);
if (result.getType() == Material.CHAIN) {
result.setAmount(3);
e.getInventory().setResult(result);
}
}
//This whole method does the same as above, just an extra fail-safe.
@EventHandler(priority = EventPriority.HIGHEST)
public void chainCraftEvent(@NotNull CraftItemEvent e) {
Recipe recipe = e.getRecipe();
ItemStack result = recipe.getResult();
if (result.getType() == Material.CHAIN) {
result.setAmount(3);
e.getInventory().setResult(result);
}
}
}

BIN
target/Chainmail-1.1.0.jar Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
#Generated by Maven
#Fri Jul 10 20:54:50 CDT 2020
#Sat Jul 11 11:59:33 CDT 2020
version=1.0-SNAPSHOT
groupId=dev.coomware
artifactId=Chainmail

View File

@ -1 +1,2 @@
C:\Users\Nilbog\Documents\NetBeansProjects\Chainmail\src\main\java\dev\coomware\Chainmail.java
C:\Users\Nilbog\Documents\NetBeansProjects\Chainmail\src\main\java\dev\coomware\CheaperChains.java