mirror of
https://github.com/PikaMug/Quests.git
synced 2024-10-05 02:17:51 +02:00
Add method to set item loaded from hand in editor
This commit is contained in:
parent
af65380362
commit
0ff0f043ee
@ -187,15 +187,19 @@ public class ItemStackPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "deprecation" })
|
|
||||||
@Override
|
@Override
|
||||||
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input) {
|
||||||
|
return acceptValidatedInput(context, input, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "unchecked", "deprecation" })
|
||||||
|
protected Prompt acceptValidatedInput(final ConversationContext context, final Number input, final ItemStack item) {
|
||||||
switch (input.intValue()) {
|
switch (input.intValue()) {
|
||||||
case 0:
|
case 0:
|
||||||
context.setSessionData("tempMeta", null);
|
context.setSessionData("tempMeta", null);
|
||||||
|
|
||||||
final Player player = (Player) context.getForWhom();
|
final Player player = (Player) context.getForWhom();
|
||||||
final ItemStack is = player.getItemInHand();
|
final ItemStack is = item == null ? player.getItemInHand() : item;
|
||||||
if (is == null || is.getType().equals(Material.AIR)) {
|
if (is == null || is.getType().equals(Material.AIR)) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("itemCreateNoItem"));
|
player.sendMessage(ChatColor.RED + Lang.get("itemCreateNoItem"));
|
||||||
return new ItemStackPrompt(context, oldPrompt);
|
return new ItemStackPrompt(context, oldPrompt);
|
||||||
|
Loading…
Reference in New Issue
Block a user