mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-23 16:01:21 +01:00
Include ability to set display of Custom Requirements, fixes #1340
This commit is contained in:
parent
d16e668dad
commit
f177b652ac
@ -28,10 +28,10 @@ public abstract class CustomObjective implements Listener {
|
||||
private Quests plugin = Quests.getPlugin(Quests.class);
|
||||
private String name = null;
|
||||
private String author = null;
|
||||
private String display = "Progress: %count%";
|
||||
private LinkedList<Entry<String, Object>> data = new LinkedList<Entry<String, Object>>();
|
||||
private Map<String, String> descriptions = new HashMap<String, String>();
|
||||
private String countPrompt = "Enter number";
|
||||
private String display = "Progress: %count%";
|
||||
private boolean showCount = true;
|
||||
private int count = 1;
|
||||
|
||||
@ -50,6 +50,14 @@ public abstract class CustomObjective implements Listener {
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(String display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public LinkedList<Entry<String, Object>> getData() {
|
||||
return data;
|
||||
@ -105,14 +113,6 @@ public abstract class CustomObjective implements Listener {
|
||||
public void setShowCount(boolean showCount) {
|
||||
this.showCount = showCount;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(String display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public Map<String, Object> getDataForPlayer(Player player, CustomObjective customObj, Quest quest) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
|
@ -21,6 +21,7 @@ public abstract class CustomRequirement {
|
||||
|
||||
private String name = null;
|
||||
private String author = null;
|
||||
private String display = null;
|
||||
private Map<String, Object> data = new HashMap<String, Object>();
|
||||
private Map<String, String> descriptions = new HashMap<String, String>();
|
||||
|
||||
@ -41,6 +42,14 @@ public abstract class CustomRequirement {
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(String display) {
|
||||
display = name;
|
||||
}
|
||||
|
||||
public Map<String, Object> getData() {
|
||||
return data;
|
||||
|
@ -21,7 +21,7 @@ public abstract class CustomReward {
|
||||
|
||||
private String name = null;
|
||||
private String author = null;
|
||||
private String rewardName = null;
|
||||
private String display = null;
|
||||
private Map<String, Object> data = new HashMap<String, Object>();
|
||||
private Map<String, String> descriptions = new HashMap<String, String>();
|
||||
|
||||
@ -43,6 +43,28 @@ public abstract class CustomReward {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(String display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getDisplay()}
|
||||
*/
|
||||
public String getRewardName() {
|
||||
return display;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setDisplay(String)}
|
||||
*/
|
||||
public void setRewardName(String name) {
|
||||
display = name;
|
||||
}
|
||||
|
||||
public Map<String, Object> getData() {
|
||||
return data;
|
||||
}
|
||||
@ -64,12 +86,4 @@ public abstract class CustomReward {
|
||||
public Map<String, String> getDescriptions() {
|
||||
return descriptions;
|
||||
}
|
||||
|
||||
public String getRewardName() {
|
||||
return rewardName;
|
||||
}
|
||||
|
||||
public void setRewardName(String name) {
|
||||
rewardName = name;
|
||||
}
|
||||
}
|
||||
|
@ -734,8 +734,8 @@ public class Quest {
|
||||
if (rews.getMcmmoSkills().isEmpty() == false) {
|
||||
for (String s : rews.getMcmmoSkills()) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN
|
||||
+ rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)) + " " + ChatColor.DARK_PURPLE
|
||||
+ s + " " + Lang.get(p, "experience"));
|
||||
+ rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)) + " "
|
||||
+ ChatColor.DARK_PURPLE + s + " " + Lang.get(p, "experience"));
|
||||
}
|
||||
}
|
||||
if (rews.getHeroesClasses().isEmpty() == false) {
|
||||
@ -760,14 +760,15 @@ public class Quest {
|
||||
}
|
||||
if (found != null) {
|
||||
Map<String, Object> datamap = rews.getCustomRewards().get(found.getName());
|
||||
String message = found.getRewardName();
|
||||
String message = found.getDisplay();
|
||||
if (message != null) {
|
||||
for (String key : datamap.keySet()) {
|
||||
message = message.replace("%" + key + "%", datamap.get(key).toString());
|
||||
}
|
||||
p.sendMessage("- " + ChatColor.GOLD + message);
|
||||
} else {
|
||||
plugin.getLogger().warning("Failed to notify player: Custom Reward does not have an assigned name");
|
||||
plugin.getLogger().warning("Failed to notify player: "
|
||||
+ "Custom Reward does not have an assigned name");
|
||||
}
|
||||
found.giveReward(p, rews.getCustomRewards().get(s));
|
||||
} else {
|
||||
|
@ -774,9 +774,11 @@ public class Quester {
|
||||
if (cr.getName().equalsIgnoreCase(m.getKey())) {
|
||||
if (cr != null) {
|
||||
if (cr.testRequirement(getPlayer(), m.getValue())) {
|
||||
finishedRequirements.add(ChatColor.GREEN + "" + m.getKey());
|
||||
finishedRequirements.add(ChatColor.GREEN + ""
|
||||
+ (cr.getDisplay() != null ? cr.getDisplay() : m.getKey()));
|
||||
} else {
|
||||
unfinishedRequirements.add(ChatColor.GRAY + "" + m.getKey());
|
||||
unfinishedRequirements.add(ChatColor.GRAY + ""
|
||||
+ (cr.getDisplay() != null ? cr.getDisplay() : m.getKey()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user