mirror of
https://github.com/PikaMug/Quests.git
synced 2024-09-09 14:08:02 +02: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());
|
||||||
|
Inventory inv = player.getInventory();
|
||||||
if (quester.hasJournal) {
|
if (quester.hasJournal) {
|
||||||
Inventory inv = player.getInventory();
|
|
||||||
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,15 +606,13 @@ 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;
|
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalNoRoom"));
|
||||||
quester.updateJournal();
|
|
||||||
} else
|
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalNoRoom"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user