From c689268e9c734496583563950a8d1474ba0557fa Mon Sep 17 00:00:00 2001 From: Blackvein Date: Thu, 16 Jan 2014 20:20:13 -0800 Subject: [PATCH] Added data support for Custom Reward Names --- .../java/me/blackvein/quests/CustomObjective.java | 6 +----- src/main/java/me/blackvein/quests/Quest.java | 15 ++++++--------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main/java/me/blackvein/quests/CustomObjective.java b/src/main/java/me/blackvein/quests/CustomObjective.java index 1155549e3..ebf9443ac 100644 --- a/src/main/java/me/blackvein/quests/CustomObjective.java +++ b/src/main/java/me/blackvein/quests/CustomObjective.java @@ -2,10 +2,6 @@ package me.blackvein.quests; import java.util.HashMap; import java.util.Map; -import org.bukkit.DyeColor; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.Listener; @@ -20,7 +16,7 @@ public abstract class CustomObjective implements Listener { private boolean enableCount = true; private boolean showCount = true; private int count = 1; - + public String getName() { return name; } diff --git a/src/main/java/me/blackvein/quests/Quest.java b/src/main/java/me/blackvein/quests/Quest.java index 346824709..6f9a3361e 100644 --- a/src/main/java/me/blackvein/quests/Quest.java +++ b/src/main/java/me/blackvein/quests/Quest.java @@ -56,15 +56,6 @@ public class Quest { String heroesSecondaryClassReq = null; Map> customRequirements = new HashMap>(); Map> customRewards = new HashMap>(); - /** - * Somehow I need to make customObjectives in the Stage class have the same - * sort of thing here ^ where it stores the custom data for the custom objective - * set by the questmaker. - * - * - * - * - */ public String failRequirements = null; // @@ -500,6 +491,12 @@ public class Quest { } if(found != null){ + Map datamap = customRewards.get(found.getName()); + String message = found.getRewardName(); + + for(String key : datamap.keySet()){ + message = message.replaceAll("%" + ((String) key) + "%", ((String) datamap.get(key))); + } player.sendMessage("- " + ChatColor.GOLD + found.getRewardName()); found.giveReward(player, customRewards.get(s)); }else{