mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-03 17:29:57 +01:00
Quests Journal can no longer be assigned to armor slots, fixes #828
This commit is contained in:
parent
b50e8ea61d
commit
33dc547cae
@ -575,14 +575,13 @@ public class CmdExecutor implements CommandExecutor {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private void questsJournal(final Player player) {
|
private void questsJournal(final Player player) {
|
||||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
if (quester.hasJournal) {
|
|
||||||
Inventory inv = player.getInventory();
|
Inventory inv = player.getInventory();
|
||||||
|
if (quester.hasJournal) {
|
||||||
ItemStack[] arr = inv.getContents();
|
ItemStack[] arr = inv.getContents();
|
||||||
for (int i = 0; i < arr.length; i++) {
|
for (int i = 0; i < arr.length; i++) {
|
||||||
if (arr[i] != null) {
|
if (arr[i] != null) {
|
||||||
if (ItemUtil.isJournal(arr[i])) {
|
if (ItemUtil.isJournal(arr[i])) {
|
||||||
inv.setItem(i, null);
|
inv.setItem(i, null);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -597,10 +596,8 @@ public class CmdExecutor implements CommandExecutor {
|
|||||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalTaken"));
|
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalTaken"));
|
||||||
quester.hasJournal = true;
|
quester.hasJournal = true;
|
||||||
quester.updateJournal();
|
quester.updateJournal();
|
||||||
} else {
|
} else if (inv.firstEmpty() != -1) {
|
||||||
Inventory inv = player.getInventory();
|
|
||||||
ItemStack[] arr = inv.getContents();
|
ItemStack[] arr = inv.getContents();
|
||||||
boolean given = false;
|
|
||||||
for (int i = 0; i < arr.length; i++) {
|
for (int i = 0; i < arr.length; i++) {
|
||||||
if (arr[i] == null) {
|
if (arr[i] == null) {
|
||||||
ItemStack stack = new ItemStack(Material.WRITTEN_BOOK, 1);
|
ItemStack stack = new ItemStack(Material.WRITTEN_BOOK, 1);
|
||||||
@ -609,14 +606,12 @@ public class CmdExecutor implements CommandExecutor {
|
|||||||
stack.setItemMeta(meta);
|
stack.setItemMeta(meta);
|
||||||
inv.setItem(i, stack);
|
inv.setItem(i, stack);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalTaken"));
|
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalTaken"));
|
||||||
given = true;
|
quester.hasJournal = true;
|
||||||
|
quester.updateJournal();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (given) {
|
} else {
|
||||||
quester.hasJournal = true;
|
|
||||||
quester.updateJournal();
|
|
||||||
} else
|
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalNoRoom"));
|
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalNoRoom"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user