mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 18:45:27 +01:00
Starting rewards item data
Unstable
This commit is contained in:
parent
91e1fd840d
commit
0474f20933
@ -1,4 +1,4 @@
|
|||||||
#Fri, 12 Apr 2013 13:03:10 -0700
|
#Mon, 22 Apr 2013 13:58:51 -0700
|
||||||
|
|
||||||
|
|
||||||
/Users/136-aclarke/Desktop/Quests=
|
/Users/136-aclarke/Desktop/Quests=
|
||||||
|
@ -16,8 +16,11 @@
|
|||||||
# debug-mode: true/false
|
# debug-mode: true/false
|
||||||
# Should debugging information be printed out to console?
|
# Should debugging information be printed out to console?
|
||||||
#
|
#
|
||||||
# kill-time: number
|
# kill-delay: number
|
||||||
# How long (in seconds) should a player have to wait before they can kill the same player for a Quest?
|
# How long (in seconds) should a player have to wait before they can kill the same player for a Quest?
|
||||||
|
#
|
||||||
|
# prompt-timeout: number
|
||||||
|
# How long (in seconds) should a player be prompted for a Quest before it auto-cancels? (0 = Infinite)
|
||||||
allow-command-questing: true
|
allow-command-questing: true
|
||||||
allow-command-quests-with-npcs: false
|
allow-command-quests-with-npcs: false
|
||||||
show-requirements: true
|
show-requirements: true
|
||||||
@ -25,6 +28,7 @@ allow-quitting: true
|
|||||||
debug-mode: false
|
debug-mode: false
|
||||||
kill-delay: 600
|
kill-delay: 600
|
||||||
snoop: true
|
snoop: true
|
||||||
|
prompt-timeout: 20
|
||||||
quester-blacklist:
|
quester-blacklist:
|
||||||
- "SomeGuy12345"
|
- "SomeGuy12345"
|
||||||
- "somePrefix*"
|
- "somePrefix*"
|
||||||
|
BIN
build/classes/me/blackvein/quests/ItemUtil.class
Normal file
BIN
build/classes/me/blackvein/quests/ItemUtil.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
dist/.DS_Store
vendored
Executable file
BIN
dist/.DS_Store
vendored
Executable file
Binary file not shown.
BIN
dist/lib/ProtocolLib-2.4.1.jar
vendored
Normal file
BIN
dist/lib/ProtocolLib-2.4.1.jar
vendored
Normal file
Binary file not shown.
BIN
lib/.DS_Store
vendored
Normal file
BIN
lib/.DS_Store
vendored
Normal file
Binary file not shown.
@ -16,8 +16,11 @@
|
|||||||
# debug-mode: true/false
|
# debug-mode: true/false
|
||||||
# Should debugging information be printed out to console?
|
# Should debugging information be printed out to console?
|
||||||
#
|
#
|
||||||
# kill-time: number
|
# kill-delay: number
|
||||||
# How long (in seconds) should a player have to wait before they can kill the same player for a Quest?
|
# How long (in seconds) should a player have to wait before they can kill the same player for a Quest?
|
||||||
|
#
|
||||||
|
# prompt-timeout: number
|
||||||
|
# How long (in seconds) should a player be prompted for a Quest before it auto-cancels? (0 = Infinite)
|
||||||
allow-command-questing: true
|
allow-command-questing: true
|
||||||
allow-command-quests-with-npcs: false
|
allow-command-quests-with-npcs: false
|
||||||
show-requirements: true
|
show-requirements: true
|
||||||
@ -25,8 +28,12 @@ allow-quitting: true
|
|||||||
debug-mode: false
|
debug-mode: false
|
||||||
kill-delay: 600
|
kill-delay: 600
|
||||||
snoop: true
|
snoop: true
|
||||||
|
<<<<<<< HEAD
|
||||||
show-npc-effects: true
|
show-npc-effects: true
|
||||||
npc-effect: "note"
|
npc-effect: "note"
|
||||||
|
=======
|
||||||
|
prompt-timeout: 20
|
||||||
|
>>>>>>> Starting rewards item data
|
||||||
quester-blacklist:
|
quester-blacklist:
|
||||||
- "SomeGuy12345"
|
- "SomeGuy12345"
|
||||||
- "somePrefix*"
|
- "somePrefix*"
|
||||||
|
45
src/me/blackvein/quests/ItemUtil.java
Normal file
45
src/me/blackvein/quests/ItemUtil.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package me.blackvein.quests;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class ItemUtil {
|
||||||
|
|
||||||
|
public static Quests plugin = null;
|
||||||
|
|
||||||
|
//Format - id-id:amount-amount:data-data:enchantment-enchantment level:name-name:lore-lore:
|
||||||
|
public static ItemStack parseItem(String s){
|
||||||
|
|
||||||
|
String[] args = s.split(":");
|
||||||
|
ItemStack stack = null;
|
||||||
|
LinkedList<String> lore = new LinkedList<String>();
|
||||||
|
|
||||||
|
for(String arg : args){
|
||||||
|
|
||||||
|
if(arg.startsWith("id-"))
|
||||||
|
stack = new ItemStack(Integer.parseInt(arg.substring(3)));
|
||||||
|
else if(arg.startsWith("amount-"))
|
||||||
|
stack.setAmount(Integer.parseInt(arg.substring(7)));
|
||||||
|
else if(arg.startsWith("data-"))
|
||||||
|
stack.setDurability(Short.parseShort(arg.substring(5)));
|
||||||
|
else if(arg.startsWith("enchantment-")){
|
||||||
|
String[] ench = arg.substring(12).split(" ");
|
||||||
|
Enchantment e = Quests.getEnchantment(ench[0]);
|
||||||
|
stack.addEnchantment(e, Integer.parseInt(ench[1]));
|
||||||
|
}else if(arg.startsWith("name-"))
|
||||||
|
stack.getItemMeta().setDisplayName(arg.substring(5));
|
||||||
|
else if(arg.startsWith("lore-"))
|
||||||
|
lore.add(arg.substring(5));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lore.isEmpty() == false)
|
||||||
|
stack.getItemMeta().setLore(lore);
|
||||||
|
|
||||||
|
return stack;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -47,7 +47,6 @@ public class Quest {
|
|||||||
List<String> commands = new LinkedList<String>();
|
List<String> commands = new LinkedList<String>();
|
||||||
List<String> permissions = new LinkedList<String>();
|
List<String> permissions = new LinkedList<String>();
|
||||||
LinkedList<ItemStack> itemRewards = new LinkedList<ItemStack>();
|
LinkedList<ItemStack> itemRewards = new LinkedList<ItemStack>();
|
||||||
LinkedList<Integer> itemRewardAmounts = new LinkedList<Integer>();
|
|
||||||
|
|
||||||
//mcMMO
|
//mcMMO
|
||||||
List<String> mcmmoSkills = new LinkedList<String>();
|
List<String> mcmmoSkills = new LinkedList<String>();
|
||||||
@ -253,7 +252,7 @@ public class Quest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(ItemStack i : itemRewards){
|
for(ItemStack i : itemRewards){
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + itemRewardAmounts.get(itemRewards.indexOf(i)));
|
player.sendMessage("- " + ChatColor.DARK_GREEN + i.getItemMeta().getDisplayName() + ChatColor.GRAY + " x " + i.getAmount());
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +41,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
public static Permission permission = null;
|
public static Permission permission = null;
|
||||||
public static mcMMO mcmmo = null;
|
public static mcMMO mcmmo = null;
|
||||||
public static boolean snoop = true;
|
public static boolean snoop = true;
|
||||||
|
<<<<<<< HEAD
|
||||||
public static boolean npcEffects = true;
|
public static boolean npcEffects = true;
|
||||||
public static String effect = "note";
|
public static String effect = "note";
|
||||||
|
=======
|
||||||
|
public static int timeout = 20;
|
||||||
|
>>>>>>> Starting rewards item data
|
||||||
List<String> questerBlacklist = new LinkedList<String>();
|
List<String> questerBlacklist = new LinkedList<String>();
|
||||||
ConversationFactory conversationFactory;
|
ConversationFactory conversationFactory;
|
||||||
QuestFactory questFactory;
|
QuestFactory questFactory;
|
||||||
@ -79,7 +83,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
.withModality(false)
|
.withModality(false)
|
||||||
.withPrefix(new QuestsPrefix())
|
.withPrefix(new QuestsPrefix())
|
||||||
.withFirstPrompt(new QuestPrompt())
|
.withFirstPrompt(new QuestPrompt())
|
||||||
.withTimeout(20)
|
.withTimeout(timeout)
|
||||||
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!")
|
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!")
|
||||||
.addConversationAbandonedListener(this);
|
.addConversationAbandonedListener(this);
|
||||||
|
|
||||||
@ -175,6 +179,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
}
|
}
|
||||||
}, 5L);
|
}, 5L);
|
||||||
|
|
||||||
|
ItemUtil.plugin = Quests.this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -253,10 +259,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
showQuestReqs = config.getBoolean("show-requirements");
|
showQuestReqs = config.getBoolean("show-requirements");
|
||||||
allowQuitting = config.getBoolean("allow-quitting");
|
allowQuitting = config.getBoolean("allow-quitting");
|
||||||
snoop = config.getBoolean("snoop", true);
|
snoop = config.getBoolean("snoop", true);
|
||||||
|
<<<<<<< HEAD
|
||||||
npcEffects = config.getBoolean("show-npc-effects", true);
|
npcEffects = config.getBoolean("show-npc-effects", true);
|
||||||
effect = config.getString("npc-effect", "note");
|
effect = config.getString("npc-effect", "note");
|
||||||
debug = config.getBoolean("debug-mode");
|
debug = config.getBoolean("debug-mode");
|
||||||
killDelay = config.getInt("kill-delay");
|
killDelay = config.getInt("kill-delay");
|
||||||
|
=======
|
||||||
|
debug = config.getBoolean("debug-mode", false);
|
||||||
|
killDelay = config.getInt("kill-delay", 600);
|
||||||
|
timeout = config.getInt("prompt-timeout", 20);
|
||||||
|
>>>>>>> Starting rewards item data
|
||||||
for (String s : config.getStringList("quester-blacklist"))
|
for (String s : config.getStringList("quester-blacklist"))
|
||||||
questerBlacklist.add(s);
|
questerBlacklist.add(s);
|
||||||
|
|
||||||
@ -2719,27 +2731,23 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Load rewards
|
//Load rewards
|
||||||
if (config.contains("quests." + s + ".rewards.item-ids")) {
|
if (config.contains("quests." + s + ".rewards.items")) {
|
||||||
|
|
||||||
if (Quests.checkList(config.getList("quests." + s + ".rewards.item-ids"), Integer.class)) {
|
if (Quests.checkList(config.getList("quests." + s + ".rewards.items"), String.class)) {
|
||||||
|
|
||||||
if (config.contains("quests." + s + ".rewards.item-amounts")) {
|
|
||||||
|
|
||||||
if (Quests.checkList(config.getList("quests." + s + ".rewards.item-amounts"), Integer.class)) {
|
|
||||||
|
|
||||||
boolean failed = false;
|
boolean failed = false;
|
||||||
for (int i : config.getIntegerList("quests." + s + ".rewards.item-ids")) {
|
for (String item : config.getStringList("quests." + s + ".rewards.items")) {
|
||||||
|
|
||||||
Material m = Material.getMaterial(i);
|
try{
|
||||||
if (m == null) {
|
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + i + ChatColor.GOLD + " in " + ChatColor.GREEN + "item-amounts: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
ItemStack stack = ItemUtil.parseItem(item);
|
||||||
|
quest.itemRewards.add(stack);
|
||||||
|
|
||||||
|
}catch(Exception e){
|
||||||
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + item + ChatColor.GOLD + " in " + ChatColor.GREEN + "items: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not formatted properly!");
|
||||||
failed = true;
|
failed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int amnt = config.getIntegerList("quests." + s + ".rewards.item-amounts").get(config.getIntegerList("quests." + s + ".rewards.item-ids").indexOf(i));
|
|
||||||
ItemStack stack = new ItemStack(m, amnt);
|
|
||||||
quest.itemRewards.add(stack);
|
|
||||||
quest.itemRewardAmounts.add(amnt);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2747,16 +2755,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "item-amounts: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.AQUA + "Rewards " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "item-amounts:");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "item-ids: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of item ids!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "item-ids: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of item ids!");
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user