mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
Now you can craft items in the smithing table to get income
Closes #1002
This commit is contained in:
parent
2ff77210b8
commit
d70d2e7918
@ -310,9 +310,9 @@ public class JobsListener implements Listener {
|
||||
special = true;
|
||||
}
|
||||
|
||||
int Number = 0;
|
||||
int number = 0;
|
||||
try {
|
||||
Number = Integer.parseInt(numberString);
|
||||
number = Integer.parseInt(numberString);
|
||||
} catch (NumberFormatException e) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("general.error.notNumber"));
|
||||
return;
|
||||
@ -322,7 +322,7 @@ public class JobsListener implements Listener {
|
||||
|
||||
Location loc = sign.getLocation();
|
||||
signInfo.setLoc(loc);
|
||||
signInfo.setNumber(Number);
|
||||
signInfo.setNumber(number);
|
||||
if (job != null)
|
||||
signInfo.setJobName(job.getName());
|
||||
signInfo.setType(type);
|
||||
@ -356,7 +356,6 @@ public class JobsListener implements Listener {
|
||||
}
|
||||
|
||||
String command = CMIChatColor.stripColor(event.getLine(1)).toLowerCase();
|
||||
|
||||
for (String key : Jobs.getGCManager().keys) {
|
||||
if (command.equalsIgnoreCase(CMIChatColor.stripColor(Jobs.getLanguage().getMessage("signs.secondline." + key)))) {
|
||||
event.setLine(1, Convert(Jobs.getLanguage().getMessage("signs.secondline." + key)));
|
||||
@ -481,9 +480,7 @@ public class JobsListener implements Listener {
|
||||
|
||||
mein: for (JobProgression one : JPlayer.getJobProgression()) {
|
||||
for (JobLimitedItems oneItem : one.getJob().getLimitedItems().values()) {
|
||||
if (one.getLevel() >= oneItem.getLevel())
|
||||
continue;
|
||||
if (!isThisItem(oneItem, CMIMaterial.get(iih), name, lore, enchants))
|
||||
if (one.getLevel() >= oneItem.getLevel() || !isThisItem(oneItem, CMIMaterial.get(iih), name, lore, enchants))
|
||||
continue;
|
||||
meinOk = one.getJob().getName();
|
||||
break mein;
|
||||
@ -500,7 +497,7 @@ public class JobsListener implements Listener {
|
||||
if (oneItem.getType() != mat)
|
||||
return false;
|
||||
|
||||
if (oneItem.getName() != null && name != null && !CMIChatColor.translate(oneItem.getName()).equalsIgnoreCase(name)) {
|
||||
if (oneItem.getName() != null && !CMIChatColor.translate(oneItem.getName()).equalsIgnoreCase(name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -595,7 +592,6 @@ public class JobsListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
ItemStack newArmorPiece = event.getCursor();
|
||||
ItemStack oldArmorPiece = event.getCurrentItem();
|
||||
|
@ -83,6 +83,7 @@ import org.bukkit.inventory.EnchantingInventory;
|
||||
import org.bukkit.inventory.GrindstoneInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.SmithingInventory;
|
||||
import org.bukkit.inventory.StonecutterInventory;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
@ -803,14 +804,16 @@ public class JobsPaymentListener implements Listener {
|
||||
Inventory inv = event.getInventory();
|
||||
// must be anvil inventory
|
||||
if (!(inv instanceof AnvilInventory) && (Version.isCurrentEqualOrHigher(Version.v1_14_R1)
|
||||
&& !(inv instanceof GrindstoneInventory) && !(inv instanceof StonecutterInventory)))
|
||||
&& !(inv instanceof GrindstoneInventory) && !(inv instanceof StonecutterInventory)
|
||||
&& !(inv instanceof SmithingInventory)))
|
||||
return;
|
||||
|
||||
int slot = event.getSlot();
|
||||
if (event.getSlotType() != SlotType.RESULT || (slot != 2 && slot != 1))
|
||||
return;
|
||||
|
||||
if ((Version.isCurrentEqualOrHigher(Version.v1_14_R1) && !(inv instanceof StonecutterInventory)) && slot == 1)
|
||||
if ((Version.isCurrentEqualOrHigher(Version.v1_14_R1)
|
||||
&& !(inv instanceof StonecutterInventory) && !(inv instanceof SmithingInventory)) && slot == 1)
|
||||
return;
|
||||
|
||||
if (!(event.getWhoClicked() instanceof Player))
|
||||
@ -880,7 +883,8 @@ public class JobsPaymentListener implements Listener {
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1) && inv instanceof StonecutterInventory) {
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1) && (inv instanceof StonecutterInventory
|
||||
|| inv instanceof SmithingInventory)) {
|
||||
if (event.getAction() != InventoryAction.DROP_ONE_SLOT) {
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user