mirror of
https://github.com/PikaMug/Quests.git
synced 2025-02-16 20:41:20 +01:00
Started Quest Journal
This commit is contained in:
parent
063b8fdd6d
commit
821af639aa
@ -1,10 +1,10 @@
|
||||
package com.evilmidget38;
|
||||
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
@ -12,23 +12,24 @@ import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
|
||||
public class UUIDFetcher implements Callable<Map<String, UUID>> {
|
||||
|
||||
private static final double PROFILES_PER_REQUEST = 100;
|
||||
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
|
||||
private final JSONParser jsonParser = new JSONParser();
|
||||
private final List<String> names;
|
||||
private final boolean rateLimiting;
|
||||
|
||||
|
||||
public UUIDFetcher(List<String> names, boolean rateLimiting) {
|
||||
this.names = ImmutableList.copyOf(names);
|
||||
this.rateLimiting = rateLimiting;
|
||||
}
|
||||
|
||||
|
||||
public UUIDFetcher(List<String> names) {
|
||||
this(names, true);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, UUID> call() throws Exception {
|
||||
Map<String, UUID> uuidMap = new HashMap<String, UUID>();
|
||||
int requests = (int) Math.ceil(names.size() / PROFILES_PER_REQUEST);
|
||||
@ -50,14 +51,14 @@ public class UUIDFetcher implements Callable<Map<String, UUID>> {
|
||||
}
|
||||
return uuidMap;
|
||||
}
|
||||
|
||||
|
||||
private static void writeBody(HttpURLConnection connection, String body) throws Exception {
|
||||
OutputStream stream = connection.getOutputStream();
|
||||
stream.write(body.getBytes());
|
||||
stream.flush();
|
||||
stream.close();
|
||||
}
|
||||
|
||||
|
||||
private static HttpURLConnection createConnection() throws Exception {
|
||||
URL url = new URL(PROFILE_URL);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
@ -68,18 +69,18 @@ public class UUIDFetcher implements Callable<Map<String, UUID>> {
|
||||
connection.setDoOutput(true);
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
||||
private static UUID getUUID(String id) {
|
||||
return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" +id.substring(20, 32));
|
||||
return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32));
|
||||
}
|
||||
|
||||
|
||||
public static byte[] toBytes(UUID uuid) {
|
||||
ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]);
|
||||
byteBuffer.putLong(uuid.getMostSignificantBits());
|
||||
byteBuffer.putLong(uuid.getLeastSignificantBits());
|
||||
return byteBuffer.array();
|
||||
}
|
||||
|
||||
|
||||
public static UUID fromBytes(byte[] array) {
|
||||
if (array.length != 16) {
|
||||
throw new IllegalArgumentException("Illegal byte array length: " + array.length);
|
||||
@ -89,8 +90,8 @@ public class UUIDFetcher implements Callable<Map<String, UUID>> {
|
||||
long leastSignificant = byteBuffer.getLong();
|
||||
return new UUID(mostSignificant, leastSignificant);
|
||||
}
|
||||
|
||||
|
||||
public static UUID getUUIDOf(String name) throws Exception {
|
||||
return new UUIDFetcher(Arrays.asList(name)).call().get(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,5 +27,4 @@ public interface ColorUtil {
|
||||
static final ChatColor DARKRED = ChatColor.DARK_RED;
|
||||
static final ChatColor YELLOW = ChatColor.YELLOW;
|
||||
|
||||
|
||||
}
|
||||
|
@ -6,17 +6,17 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public abstract class CustomObjective implements Listener {
|
||||
|
||||
|
||||
private String name = null;
|
||||
private String author = null;
|
||||
public final Map<String,Object> datamap = new HashMap<String, Object>();
|
||||
public final Map<String, Object> datamap = new HashMap<String, Object>();
|
||||
public final Map<String, String> descriptions = new HashMap<String, String>();
|
||||
private String countPrompt = "null";
|
||||
private String display = "null";
|
||||
private boolean enableCount = true;
|
||||
private boolean showCount = true;
|
||||
private int count = 1;
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@ -32,12 +32,12 @@ public abstract class CustomObjective implements Listener {
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
|
||||
public void addData(String name) {
|
||||
datamap.put(name, null);
|
||||
}
|
||||
|
||||
public void addDescription(String data, String description){
|
||||
|
||||
public void addDescription(String data, String description) {
|
||||
descriptions.put(data, description);
|
||||
}
|
||||
|
||||
@ -80,138 +80,148 @@ public abstract class CustomObjective implements Listener {
|
||||
public void setEnableCount(boolean enableCount) {
|
||||
this.enableCount = enableCount;
|
||||
}
|
||||
|
||||
public Map<String, Object> getDatamap(Player player, CustomObjective obj){
|
||||
|
||||
|
||||
public static Map<String, Object> getDatamap(Player player, CustomObjective obj, Quest quest) {
|
||||
|
||||
Quester quester = Quests.getInstance().getQuester(player.getUniqueId());
|
||||
if(quester != null){
|
||||
|
||||
if (quester != null) {
|
||||
|
||||
int index = -1;
|
||||
int tempIndex = 0;
|
||||
|
||||
for(me.blackvein.quests.CustomObjective co : quester.currentStage.customObjectives){
|
||||
|
||||
if(co.getName().equals(obj.getName())){
|
||||
|
||||
for (me.blackvein.quests.CustomObjective co : quester.getCurrentStage(quest).customObjectives) {
|
||||
|
||||
if (co.getName().equals(obj.getName())) {
|
||||
index = tempIndex;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
tempIndex++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(index > -1){
|
||||
|
||||
return quester.currentStage.customObjectiveData.get(index);
|
||||
|
||||
|
||||
if (index > -1) {
|
||||
|
||||
return quester.getCurrentStage(quest).customObjectiveData.get(index);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void incrementObjective(Player player, CustomObjective obj, int count){
|
||||
|
||||
|
||||
public static void incrementObjective(Player player, CustomObjective obj, int count, Quest quest) {
|
||||
|
||||
Quester quester = Quests.getInstance().getQuester(player.getUniqueId());
|
||||
if(quester != null){
|
||||
|
||||
if (quester != null) {
|
||||
|
||||
//Check if the player has Quest with objective
|
||||
|
||||
boolean hasQuest = false;
|
||||
|
||||
for(CustomObjective co : quester.currentStage.customObjectives){
|
||||
|
||||
if(co.getName().equals(obj.getName())){
|
||||
|
||||
for (CustomObjective co : quester.getCurrentStage(quest).customObjectives) {
|
||||
|
||||
if (co.getName().equals(obj.getName())) {
|
||||
hasQuest = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(hasQuest && quester.hasCustomObjective(obj.getName())){
|
||||
|
||||
if(quester.customObjectiveCounts.containsKey(obj.getName())){
|
||||
int old = quester.customObjectiveCounts.get(obj.getName());
|
||||
Quests.getInstance().getQuester(player.getUniqueId()).customObjectiveCounts.put(obj.getName(), old + count);
|
||||
}else{
|
||||
Quests.getInstance().getQuester(player.getUniqueId()).customObjectiveCounts.put(obj.getName(), count);
|
||||
|
||||
if (hasQuest && quester.hasCustomObjective(quest, obj.getName())) {
|
||||
|
||||
if (quester.getQuestData(quest).customObjectiveCounts.containsKey(obj.getName())) {
|
||||
int old = quester.getQuestData(quest).customObjectiveCounts.get(obj.getName());
|
||||
Quests.getInstance().getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts.put(obj.getName(), old + count);
|
||||
} else {
|
||||
Quests.getInstance().getQuester(player.getUniqueId()).getQuestData(quest).customObjectiveCounts.put(obj.getName(), count);
|
||||
}
|
||||
|
||||
int index = -1;
|
||||
for(int i = 0; i < quester.currentStage.customObjectives.size(); i++){
|
||||
if(quester.currentStage.customObjectives.get(i).getName().equals(obj.getName())){
|
||||
for (int i = 0; i < quester.getCurrentStage(quest).customObjectives.size(); i++) {
|
||||
if (quester.getCurrentStage(quest).customObjectives.get(i).getName().equals(obj.getName())) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(index > -1){
|
||||
if (index > -1) {
|
||||
|
||||
if(quester.customObjectiveCounts.get(obj.getName()) >= quester.currentStage.customObjectiveCounts.get(index)){
|
||||
quester.finishObjective("customObj", null, null, null, null, null, null, null, null, null, obj);
|
||||
if (quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()) >= quester.getCurrentStage(quest).customObjectiveCounts.get(index)) {
|
||||
quester.finishObjective(quest, "customObj", null, null, null, null, null, null, null, null, null, obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o){
|
||||
|
||||
if(o instanceof CustomObjective){
|
||||
|
||||
public boolean equals(Object o) {
|
||||
|
||||
if (o instanceof CustomObjective) {
|
||||
|
||||
CustomObjective other = (CustomObjective) o;
|
||||
|
||||
if(other.name.equals(name) == false)
|
||||
|
||||
if (other.name.equals(name) == false) {
|
||||
return false;
|
||||
|
||||
if(other.author.equals(name) == false)
|
||||
return false;
|
||||
|
||||
for(String s : other.datamap.keySet()){
|
||||
if(datamap.containsKey(s) == false)
|
||||
return false;
|
||||
}
|
||||
|
||||
for(Object val : other.datamap.values()){
|
||||
if(datamap.containsValue(val) == false)
|
||||
return false;
|
||||
|
||||
if (other.author.equals(name) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for(String s : other.descriptions.keySet()){
|
||||
if(descriptions.containsKey(s) == false)
|
||||
|
||||
for (String s : other.datamap.keySet()) {
|
||||
if (datamap.containsKey(s) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(String s : other.descriptions.values()){
|
||||
if(descriptions.containsValue(s) == false)
|
||||
|
||||
for (Object val : other.datamap.values()) {
|
||||
if (datamap.containsValue(val) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(other.countPrompt.equals(countPrompt) == false)
|
||||
|
||||
for (String s : other.descriptions.keySet()) {
|
||||
if (descriptions.containsKey(s) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (String s : other.descriptions.values()) {
|
||||
if (descriptions.containsValue(s) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (other.countPrompt.equals(countPrompt) == false) {
|
||||
return false;
|
||||
|
||||
if(other.display.equals(display) == false)
|
||||
}
|
||||
|
||||
if (other.display.equals(display) == false) {
|
||||
return false;
|
||||
|
||||
if(other.enableCount != enableCount)
|
||||
}
|
||||
|
||||
if (other.enableCount != enableCount) {
|
||||
return false;
|
||||
|
||||
if(other.showCount != showCount)
|
||||
}
|
||||
|
||||
if (other.showCount != showCount) {
|
||||
return false;
|
||||
|
||||
if(other.count != count)
|
||||
}
|
||||
|
||||
if (other.count != count) {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -5,12 +5,12 @@ import java.util.Map;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class CustomRequirement {
|
||||
|
||||
|
||||
private String name = null;
|
||||
private String author = null;
|
||||
public final Map<String,Object> datamap = new HashMap<String, Object>();
|
||||
public final Map<String, Object> datamap = new HashMap<String, Object>();
|
||||
public final Map<String, String> descriptions = new HashMap<String, String>();
|
||||
|
||||
|
||||
public abstract boolean testRequirement(Player p, Map<String, Object> m);
|
||||
|
||||
public String getName() {
|
||||
@ -28,13 +28,13 @@ public abstract class CustomRequirement {
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
|
||||
public void addData(String name) {
|
||||
datamap.put(name, null);
|
||||
}
|
||||
|
||||
public void addDescription(String data, String description){
|
||||
|
||||
public void addDescription(String data, String description) {
|
||||
descriptions.put(data, description);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -5,13 +5,13 @@ import java.util.Map;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class CustomReward {
|
||||
|
||||
|
||||
private String name = null;
|
||||
private String author = null;
|
||||
private String rewardName = null;
|
||||
public final Map<String,Object> datamap = new HashMap<String, Object>();
|
||||
public final Map<String, Object> datamap = new HashMap<String, Object>();
|
||||
public final Map<String, String> descriptions = new HashMap<String, String>();
|
||||
|
||||
|
||||
public abstract void giveReward(Player p, Map<String, Object> m);
|
||||
|
||||
public String getName() {
|
||||
@ -29,21 +29,21 @@ public abstract class CustomReward {
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
|
||||
public void addData(String name) {
|
||||
datamap.put(name, null);
|
||||
}
|
||||
|
||||
public void addDescription(String data, String description){
|
||||
|
||||
public void addDescription(String data, String description) {
|
||||
descriptions.put(data, description);
|
||||
}
|
||||
|
||||
public void setRewardName(String name){
|
||||
|
||||
public void setRewardName(String name) {
|
||||
rewardName = name;
|
||||
}
|
||||
|
||||
public String getRewardName(){
|
||||
|
||||
public String getRewardName() {
|
||||
return rewardName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -36,20 +36,24 @@ public class Event {
|
||||
int thunderDuration = 0;
|
||||
public LinkedList<QuestMob> mobSpawns = new LinkedList<QuestMob>() {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof LinkedList) {
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof LinkedList) {
|
||||
|
||||
LinkedList<QuestMob> other = (LinkedList<QuestMob>) o;
|
||||
LinkedList<QuestMob> other = (LinkedList<QuestMob>) o;
|
||||
|
||||
if (size() != other.size()) return false;
|
||||
if (size() != other.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < size(); i++) {
|
||||
if (get(i).equals(other.get(i)) == false) return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < size(); i++) {
|
||||
if (get(i).equals(other.get(i)) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
LinkedList<Location> lightningStrikes = new LinkedList<Location>();
|
||||
LinkedList<String> commands = new LinkedList<String>();
|
||||
@ -84,7 +88,7 @@ public class Event {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(other.failQuest != failQuest) {
|
||||
if (other.failQuest != failQuest) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -128,10 +132,11 @@ public class Event {
|
||||
return false;
|
||||
}
|
||||
|
||||
for(QuestMob qm : mobSpawns){
|
||||
for (QuestMob qm : mobSpawns) {
|
||||
|
||||
if(qm.equals(other.mobSpawns.get(mobSpawns.indexOf(qm))) == false)
|
||||
if (qm.equals(other.mobSpawns.get(mobSpawns.indexOf(qm))) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -180,12 +185,12 @@ public class Event {
|
||||
|
||||
}
|
||||
|
||||
public void fire(Quester quester) {
|
||||
public void fire(Quester quester, Quest quest) {
|
||||
|
||||
Player player = quester.getPlayer();
|
||||
|
||||
if (message != null) {
|
||||
player.sendMessage(Quests.parseString(message, quester.currentQuest));
|
||||
player.sendMessage(Quests.parseString(message, quest));
|
||||
}
|
||||
|
||||
if (clearInv == true) {
|
||||
@ -232,9 +237,9 @@ public class Event {
|
||||
|
||||
if (mobSpawns.isEmpty() == false) {
|
||||
|
||||
for (QuestMob questMob : mobSpawns) {
|
||||
questMob.spawn();
|
||||
}
|
||||
for (QuestMob questMob : mobSpawns) {
|
||||
questMob.spawn();
|
||||
}
|
||||
}
|
||||
|
||||
if (lightningStrikes.isEmpty() == false) {
|
||||
@ -289,9 +294,9 @@ public class Event {
|
||||
|
||||
}
|
||||
|
||||
if(failQuest == true) {
|
||||
if (failQuest == true) {
|
||||
|
||||
quester.currentQuest.failQuest(quester);
|
||||
quest.failQuest(quester);
|
||||
|
||||
}
|
||||
|
||||
@ -494,21 +499,20 @@ public class Event {
|
||||
}
|
||||
|
||||
if (data.contains(eventKey + "mob-spawns")) {
|
||||
ConfigurationSection section = data.getConfigurationSection(eventKey + "mob-spawns");
|
||||
ConfigurationSection section = data.getConfigurationSection(eventKey + "mob-spawns");
|
||||
|
||||
//is a mob, the keys are just a number or something.
|
||||
for (String s : section.getKeys(false)) {
|
||||
String mobName = section.getString(s + ".name");
|
||||
Location spawnLocation = Quests.getLocation(section.getString(s + ".spawn-location"));
|
||||
EntityType type = Quests.getMobType(section.getString(s + ".mob-type"));
|
||||
Integer mobAmount = section.getInt(s + ".spawn-amounts");
|
||||
//is a mob, the keys are just a number or something.
|
||||
for (String s : section.getKeys(false)) {
|
||||
String mobName = section.getString(s + ".name");
|
||||
Location spawnLocation = Quests.getLocation(section.getString(s + ".spawn-location"));
|
||||
EntityType type = Quests.getMobType(section.getString(s + ".mob-type"));
|
||||
Integer mobAmount = section.getInt(s + ".spawn-amounts");
|
||||
|
||||
|
||||
if (spawnLocation == null) {
|
||||
Quests.printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s + ChatColor.GOLD + " inside " + ChatColor.GREEN + " mob-spawn-locations: " + ChatColor.GOLD + "inside Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not in proper location format!");
|
||||
if (spawnLocation == null) {
|
||||
Quests.printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + s + ChatColor.GOLD + " inside " + ChatColor.GREEN + " mob-spawn-locations: " + ChatColor.GOLD + "inside Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not in proper location format!");
|
||||
Quests.printSevere(ChatColor.GOLD + "[Quests] Proper location format is: \"WorldName x y z\"");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == null) {
|
||||
Quests.printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + section.getString(s + ".mob-type") + ChatColor.GOLD + " inside " + ChatColor.GREEN + " mob-spawn-types: " + ChatColor.GOLD + "inside Event " + ChatColor.DARK_PURPLE + name + ChatColor.GOLD + " is not a valid mob name!");
|
||||
@ -539,7 +543,7 @@ public class Event {
|
||||
questMob.setName(mobName);
|
||||
|
||||
event.mobSpawns.add(questMob);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.contains(eventKey + "lightning-strikes")) {
|
||||
@ -568,9 +572,10 @@ public class Event {
|
||||
if (data.contains(eventKey + "commands")) {
|
||||
|
||||
if (Quests.checkList(data.getList(eventKey + "commands"), String.class)) {
|
||||
for(String s : data.getStringList(eventKey + "commands")){
|
||||
if(s.startsWith("/"))
|
||||
for (String s : data.getStringList(eventKey + "commands")) {
|
||||
if (s.startsWith("/")) {
|
||||
s = s.replaceFirst("/", "");
|
||||
}
|
||||
event.commands.add(s);
|
||||
}
|
||||
} else {
|
||||
@ -631,7 +636,6 @@ public class Event {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (data.contains(eventKey + "hunger")) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,12 +5,10 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
public class GUIListener implements Listener {
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent evt) {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,16 +4,16 @@ import org.bukkit.Material;
|
||||
|
||||
public class ItemData {
|
||||
|
||||
public static Material getMaterial(String name) {
|
||||
Material material = Material.matchMaterial(name);
|
||||
if (material == null) {
|
||||
name = name.toUpperCase().replace(" ", "_");
|
||||
for (Material mat : Material.values()) {
|
||||
if (mat.toString().contains(name)) {
|
||||
return mat;
|
||||
}
|
||||
}
|
||||
}
|
||||
return material;
|
||||
}
|
||||
public static Material getMaterial(String name) {
|
||||
Material material = Material.matchMaterial(name);
|
||||
if (material == null) {
|
||||
name = name.toUpperCase().replace(" ", "_");
|
||||
for (Material mat : Material.values()) {
|
||||
if (mat.toString().contains(name)) {
|
||||
return mat;
|
||||
}
|
||||
}
|
||||
}
|
||||
return material;
|
||||
}
|
||||
}
|
||||
|
@ -10,36 +10,37 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class NpcEffectThread implements Runnable{
|
||||
public class NpcEffectThread implements Runnable {
|
||||
|
||||
final Quests plugin;
|
||||
|
||||
public NpcEffectThread(Quests quests){
|
||||
public NpcEffectThread(Quests quests) {
|
||||
|
||||
plugin = quests;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(){
|
||||
public void run() {
|
||||
|
||||
for(Player player : plugin.getServer().getOnlinePlayers()){
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0);
|
||||
if(nearby.isEmpty() == false){
|
||||
if (nearby.isEmpty() == false) {
|
||||
|
||||
for(Entity e : nearby){
|
||||
if(plugin.citizens != null)
|
||||
if(plugin.citizens.getNPCRegistry().isNPC(e)){
|
||||
|
||||
NPC npc = plugin.citizens.getNPCRegistry().getNPC(e);
|
||||
if(plugin.hasQuest(npc, quester)) {
|
||||
showEffect(player, npc);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
for (Entity e : nearby) {
|
||||
if (plugin.citizens != null) {
|
||||
if (plugin.citizens.getNPCRegistry().isNPC(e)) {
|
||||
|
||||
NPC npc = plugin.citizens.getNPCRegistry().getNPC(e);
|
||||
if (plugin.hasQuest(npc, quester)) {
|
||||
showEffect(player, npc);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -50,339 +51,340 @@ public class NpcEffectThread implements Runnable{
|
||||
}
|
||||
|
||||
private static void showEffect(Player player, NPC npc) {
|
||||
|
||||
if(Bukkit.getVersion().contains("1.7.2"))
|
||||
|
||||
if (Bukkit.getVersion().contains("1.7.2")) {
|
||||
showEffect_R1(player, npc);
|
||||
else if(Bukkit.getVersion().contains("1.7.9"))
|
||||
} else if (Bukkit.getVersion().contains("1.7.9")) {
|
||||
showEffect_R3(player, npc);
|
||||
else if(Bukkit.getVersion().contains("1.7.10"))
|
||||
} else if (Bukkit.getVersion().contains("1.7.10")) {
|
||||
showEffect_R4(player, npc);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void showEffect_R4(Player player, NPC npc){
|
||||
|
||||
if(Quests.effect.equalsIgnoreCase("enchant")){
|
||||
private static void showEffect_R4(Player player, NPC npc) {
|
||||
|
||||
try{
|
||||
if (Quests.effect.equalsIgnoreCase("enchant")) {
|
||||
|
||||
try {
|
||||
Eff_1_7_R4.ENCHANTMENT_TABLE.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 10);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("crit")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("crit")) {
|
||||
|
||||
try{
|
||||
Eff_1_7_R4.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
|
||||
}catch(Exception e){
|
||||
try {
|
||||
Eff_1_7_R4.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float) 0.35, 3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("spell")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("spell")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R4.INSTANT_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("magiccrit")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("magiccrit")) {
|
||||
|
||||
try{
|
||||
Eff_1_7_R4.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
|
||||
}catch(Exception e){
|
||||
try {
|
||||
Eff_1_7_R4.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float) 0.35, 3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("mobspell")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("mobspell")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R4.MOB_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("note")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("note")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R4.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("portal")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("portal")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R4.PORTAL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 5);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("dust")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("dust")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R4.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("witch")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("witch")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R4.WITCH_MAGIC.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("snowball")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("snowball")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R4.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("splash")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("splash")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R4.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("smoke")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("smoke")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R4.TOWN_AURA.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 20);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void showEffect_R3(Player player, NPC npc){
|
||||
|
||||
if(Quests.effect.equalsIgnoreCase("enchant")){
|
||||
private static void showEffect_R3(Player player, NPC npc) {
|
||||
|
||||
try{
|
||||
if (Quests.effect.equalsIgnoreCase("enchant")) {
|
||||
|
||||
try {
|
||||
Eff_1_7_R3.ENCHANTMENT_TABLE.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 10);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("crit")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("crit")) {
|
||||
|
||||
try{
|
||||
Eff_1_7_R3.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
|
||||
}catch(Exception e){
|
||||
try {
|
||||
Eff_1_7_R3.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float) 0.35, 3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("spell")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("spell")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R3.INSTANT_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("magiccrit")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("magiccrit")) {
|
||||
|
||||
try{
|
||||
Eff_1_7_R3.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
|
||||
}catch(Exception e){
|
||||
try {
|
||||
Eff_1_7_R3.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float) 0.35, 3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("mobspell")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("mobspell")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R3.MOB_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("note")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("note")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R3.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("portal")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("portal")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R3.PORTAL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 5);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("dust")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("dust")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R3.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("witch")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("witch")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R3.WITCH_MAGIC.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("snowball")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("snowball")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R3.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("splash")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("splash")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R3.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("smoke")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("smoke")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R3.TOWN_AURA.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 20);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void showEffect_R1(Player player, NPC npc){
|
||||
|
||||
if(Quests.effect.equalsIgnoreCase("enchant")){
|
||||
private static void showEffect_R1(Player player, NPC npc) {
|
||||
|
||||
try{
|
||||
if (Quests.effect.equalsIgnoreCase("enchant")) {
|
||||
|
||||
try {
|
||||
Eff_1_7_R1.ENCHANTMENT_TABLE.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 10);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("crit")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("crit")) {
|
||||
|
||||
try{
|
||||
Eff_1_7_R1.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
|
||||
}catch(Exception e){
|
||||
try {
|
||||
Eff_1_7_R1.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float) 0.35, 3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("spell")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("spell")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R1.INSTANT_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("magiccrit")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("magiccrit")) {
|
||||
|
||||
try{
|
||||
Eff_1_7_R1.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
|
||||
}catch(Exception e){
|
||||
try {
|
||||
Eff_1_7_R1.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float) 0.35, 3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("mobspell")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("mobspell")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R1.MOB_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("note")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("note")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R1.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("portal")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("portal")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R1.PORTAL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 5);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("dust")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("dust")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R1.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("witch")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("witch")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R1.WITCH_MAGIC.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("snowball")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("snowball")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R1.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("splash")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("splash")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float) 0.5, old.getZ());
|
||||
Eff_1_7_R1.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("smoke")){
|
||||
} else if (Quests.effect.equalsIgnoreCase("smoke")) {
|
||||
|
||||
try{
|
||||
try {
|
||||
Eff_1_7_R1.TOWN_AURA.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 20);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class NpcListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onNPCRightClick(NPCRightClickEvent evt) {
|
||||
|
||||
if(plugin.questFactory.selectingNPCs.contains(evt.getClicker())){
|
||||
if (plugin.questFactory.selectingNPCs.contains(evt.getClicker())) {
|
||||
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + "ID " + evt.getNPC().getId());
|
||||
return;
|
||||
}
|
||||
@ -45,70 +45,92 @@ public class NpcListener implements Listener {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
boolean delivery = false;
|
||||
|
||||
if (quester.hasObjective("deliverItem") && player.getItemInHand() != null) {
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
ItemStack hand = player.getItemInHand();
|
||||
if (quester.hasObjective(quest, "deliverItem") && player.getItemInHand() != null) {
|
||||
|
||||
ItemStack found = null;
|
||||
ItemStack hand = player.getItemInHand();
|
||||
|
||||
for(ItemStack is : quester.currentStage.itemsToDeliver){
|
||||
ItemStack found = null;
|
||||
|
||||
if(ItemUtil.compareItems(is, hand, true) == 0){
|
||||
found = is;
|
||||
break;
|
||||
}
|
||||
for (ItemStack is : quester.getCurrentStage(quest).itemsToDeliver) {
|
||||
|
||||
}
|
||||
|
||||
if (found != null) {
|
||||
|
||||
NPC clicked = evt.getNPC();
|
||||
|
||||
for (Integer n : quester.currentStage.itemDeliveryTargets) {
|
||||
if (n == clicked.getId()) {
|
||||
quester.deliverItem(hand);
|
||||
delivery = true;
|
||||
if (ItemUtil.compareItems(is, hand, true) == 0) {
|
||||
found = is;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (found != null) {
|
||||
|
||||
NPC clicked = evt.getNPC();
|
||||
|
||||
for (Integer n : quester.getCurrentStage(quest).itemDeliveryTargets) {
|
||||
if (n == clicked.getId()) {
|
||||
quester.deliverItem(quest, hand);
|
||||
delivery = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (plugin.questNPCs.contains(evt.getNPC()) && delivery == false) {
|
||||
|
||||
if (plugin.checkQuester(player.getName()) == false) {
|
||||
if (quester.hasObjective("talkToNPC")) {
|
||||
|
||||
quester.interactWithNPC(evt.getNPC());
|
||||
boolean hasObjective = false;
|
||||
|
||||
} else {
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "talkToNPC")) {
|
||||
|
||||
quester.interactWithNPC(quest, evt.getNPC());
|
||||
if (quester.getQuestData(quest).citizensInteracted.containsKey(evt.getNPC().getId()) && quester.getQuestData(quest).citizensInteracted.get(evt.getNPC().getId()) == false) {
|
||||
hasObjective = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!hasObjective) {
|
||||
|
||||
LinkedList<Quest> npcQuests = new LinkedList<Quest>();
|
||||
|
||||
for (Quest q : plugin.getQuests()) {
|
||||
|
||||
if(quester.currentQuests.containsKey(q))
|
||||
continue;
|
||||
|
||||
if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) {
|
||||
if (Quests.ignoreLockedQuests) {
|
||||
if (q.testRequirements(quester) && (q.redoDelay <= 0)) {
|
||||
npcQuests.add(q);
|
||||
if (Quests.ignoreLockedQuests) {
|
||||
if (q.testRequirements(quester)) {
|
||||
npcQuests.add(q);
|
||||
}
|
||||
} else if (quester.completedQuests.contains(q.name) == false || q.redoDelay > -1) {
|
||||
} else if (quester.completedQuests.contains(q.name) == false || q.redoDelay > -1) {
|
||||
npcQuests.add(q);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (npcQuests.isEmpty() == false && npcQuests.size() > 1) {
|
||||
|
||||
if(plugin.questNPCGUIs.contains(evt.getNPC().getId())) {
|
||||
|
||||
if (plugin.questNPCGUIs.contains(evt.getNPC().getId())) {
|
||||
|
||||
quester.showGUIDisplay(npcQuests);
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Conversation c = plugin.NPCConversationFactory.buildConversation((Conversable) player);
|
||||
c.getContext().setSessionData("quests", npcQuests);
|
||||
c.getContext().setSessionData("npc", evt.getNPC().getName());
|
||||
@ -120,63 +142,58 @@ public class NpcListener implements Listener {
|
||||
|
||||
if (!quester.completedQuests.contains(q.name)) {
|
||||
|
||||
if (quester.currentQuest == null) {
|
||||
if (quester.currentQuests.size() < Quests.maxQuests || Quests.maxQuests < 1) {
|
||||
|
||||
quester.questToTake = q.name;
|
||||
|
||||
String s = extracted(quester);
|
||||
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||
|
||||
} else if (quester.currentQuest.equals(q) == false) {
|
||||
} else if (quester.currentQuests.containsKey(q) == false) {
|
||||
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
|
||||
}
|
||||
|
||||
} else if (quester.completedQuests.contains(q.name)) {
|
||||
} else if (quester.currentQuests.size() < Quests.maxQuests || Quests.maxQuests < 1) {
|
||||
|
||||
if (quester.currentQuest == null) {
|
||||
if (quester.getDifference(q) > 0) {
|
||||
String early = Lang.get("questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
} else if (q.redoDelay < 0) {
|
||||
String completed = Lang.get("questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
} else {
|
||||
quester.questToTake = q.name;
|
||||
String s = extracted(quester);
|
||||
|
||||
if (quester.getDifference(q) > 0) {
|
||||
String early = Lang.get("questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
} else if (q.redoDelay < 0) {
|
||||
String completed = Lang.get("questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
} else {
|
||||
quester.questToTake = q.name;
|
||||
String s = extracted(quester);
|
||||
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
} else if (quester.currentQuest.equals(q) == false) {
|
||||
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(maxQuests));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
|
||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||
}
|
||||
|
||||
} else if (quester.currentQuests.containsKey(q) == false) {
|
||||
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -187,9 +204,9 @@ public class NpcListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onNPCLeftClick(NPCLeftClickEvent evt){
|
||||
public void onNPCLeftClick(NPCLeftClickEvent evt) {
|
||||
|
||||
if(plugin.questFactory.selectingNPCs.contains(evt.getClicker())){
|
||||
if (plugin.questFactory.selectingNPCs.contains(evt.getClicker())) {
|
||||
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + Lang.get("id") + " " + evt.getNPC().getId());
|
||||
}
|
||||
|
||||
@ -222,8 +239,13 @@ public class NpcListener implements Listener {
|
||||
if (okay) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.hasObjective("killNPC")) {
|
||||
quester.killNPC(evt.getNPC());
|
||||
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "killNPC")) {
|
||||
quester.killNPC(quest, evt.getNPC());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -243,8 +265,12 @@ public class NpcListener implements Listener {
|
||||
|
||||
Player player = (Player) damager;
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.hasObjective("killNPC")) {
|
||||
quester.killNPC(evt.getNPC());
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "killNPC")) {
|
||||
quester.killNPC(quest, evt.getNPC());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -264,4 +290,4 @@ public class NpcListener implements Listener {
|
||||
ChatColor.GOLD,
|
||||
ChatColor.RESET, plugin.getQuest(quester.questToTake).description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,9 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityTameEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.player.PlayerFishEvent.State;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -40,7 +42,58 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
plugin = newPlugin;
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInventoryClickEvent(InventoryClickEvent evt) {
|
||||
|
||||
InventoryAction ac = evt.getAction();
|
||||
|
||||
if(evt.getCurrentItem() != null && ItemUtil.isJournal(evt.getCurrentItem())) {
|
||||
|
||||
if(ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY)
|
||||
|| ac.equals(InventoryAction.DROP_ALL_SLOT)
|
||||
|| ac.equals(InventoryAction.DROP_ONE_SLOT)) {
|
||||
|
||||
evt.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
} else if(evt.getCurrentItem() != null && ItemUtil.isJournal(evt.getCursor())) {
|
||||
|
||||
if(ac.equals(InventoryAction.MOVE_TO_OTHER_INVENTORY)
|
||||
|| ac.equals(InventoryAction.DROP_ALL_CURSOR)
|
||||
|| ac.equals(InventoryAction.DROP_ONE_CURSOR)) {
|
||||
|
||||
evt.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(evt.getCurrentItem() != null && ItemUtil.isJournal(evt.getCursor()) || evt.getCurrentItem() != null && ItemUtil.isJournal(evt.getCurrentItem())) {
|
||||
|
||||
int upper = evt.getView().getTopInventory().getSize();
|
||||
if(evt.getView().getTopInventory().getType().equals(InventoryType.CRAFTING))
|
||||
upper += 4;
|
||||
int lower = evt.getView().getBottomInventory().getSize();
|
||||
int relative = evt.getRawSlot() - upper;
|
||||
|
||||
if(relative < 0 || relative >= (lower)) {
|
||||
evt.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent evt) {
|
||||
|
||||
if(ItemUtil.isJournal(evt.getItemDrop().getItemStack()))
|
||||
evt.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent evt) {
|
||||
|
||||
@ -50,120 +103,130 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
final Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
final Player player = evt.getPlayer();
|
||||
boolean hasObjective = false;
|
||||
|
||||
if (quester.hasObjective("useBlock")) {
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
quester.useBlock(evt.getClickedBlock().getType());
|
||||
if (quester.hasObjective(quest, "useBlock")) {
|
||||
quester.useBlock(quest, evt.getClickedBlock().getType());
|
||||
hasObjective = true;
|
||||
}
|
||||
|
||||
} else if (plugin.questFactory.selectedBlockStarts.containsKey(evt.getPlayer())) {
|
||||
}
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedBlockStarts.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
if (!hasObjective) {
|
||||
|
||||
} else if (plugin.eventFactory.selectedExplosionLocations.containsKey(evt.getPlayer())) {
|
||||
if (plugin.questFactory.selectedBlockStarts.containsKey(evt.getPlayer())) {
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedExplosionLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedBlockStarts.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
} else if (plugin.eventFactory.selectedEffectLocations.containsKey(evt.getPlayer())) {
|
||||
} else if (plugin.eventFactory.selectedExplosionLocations.containsKey(evt.getPlayer())) {
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedEffectLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedExplosionLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
} else if (plugin.eventFactory.selectedMobLocations.containsKey(evt.getPlayer())) {
|
||||
} else if (plugin.eventFactory.selectedEffectLocations.containsKey(evt.getPlayer())) {
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedMobLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedEffectLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
} else if (plugin.eventFactory.selectedLightningLocations.containsKey(evt.getPlayer())) {
|
||||
} else if (plugin.eventFactory.selectedMobLocations.containsKey(evt.getPlayer())) {
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedLightningLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedMobLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
} else if (plugin.eventFactory.selectedTeleportLocations.containsKey(evt.getPlayer())) {
|
||||
} else if (plugin.eventFactory.selectedLightningLocations.containsKey(evt.getPlayer())) {
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedTeleportLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedLightningLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
} else if (plugin.questFactory.selectedKillLocations.containsKey(evt.getPlayer())) {
|
||||
} else if (plugin.eventFactory.selectedTeleportLocations.containsKey(evt.getPlayer())) {
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedKillLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.eventFactory.selectedTeleportLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
} else if (plugin.questFactory.selectedReachLocations.containsKey(evt.getPlayer())) {
|
||||
} else if (plugin.questFactory.selectedKillLocations.containsKey(evt.getPlayer())) {
|
||||
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedReachLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedKillLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
} else if (player.isConversing() == false) {
|
||||
} else if (plugin.questFactory.selectedReachLocations.containsKey(evt.getPlayer())) {
|
||||
|
||||
for (final Quest q : plugin.quests) {
|
||||
Block block = evt.getClickedBlock();
|
||||
Location loc = block.getLocation();
|
||||
plugin.questFactory.selectedReachLocations.put(evt.getPlayer(), block);
|
||||
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
|
||||
|
||||
if (q.blockStart != null) {
|
||||
} else if (player.isConversing() == false) {
|
||||
|
||||
if (q.blockStart.equals(evt.getClickedBlock().getLocation())) {
|
||||
for (final Quest q : plugin.quests) {
|
||||
|
||||
if (quester.currentQuest != null) {
|
||||
if (q.blockStart != null) {
|
||||
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
if (q.blockStart.equals(evt.getClickedBlock().getLocation())) {
|
||||
|
||||
} else {
|
||||
if (quester.currentQuests.size() >= Quests.maxQuests && Quests.maxQuests > 0) {
|
||||
|
||||
if (quester.completedQuests.contains(q.name)) {
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
|
||||
if (q.redoDelay > -1 && (quester.getDifference(q)) > 0) {
|
||||
} else {
|
||||
|
||||
String early = Lang.get("questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
return;
|
||||
if (quester.completedQuests.contains(q.name)) {
|
||||
|
||||
} else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
|
||||
if (q.redoDelay > -1 && (quester.getDifference(q)) > 0) {
|
||||
|
||||
String completed = Lang.get("questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
return;
|
||||
String early = Lang.get("questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
return;
|
||||
|
||||
} else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
|
||||
|
||||
String completed = Lang.get("questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
quester.questToTake = q.name;
|
||||
|
||||
String s
|
||||
= ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
||||
+ "\n"
|
||||
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
||||
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||
|
||||
}
|
||||
|
||||
quester.questToTake = q.name;
|
||||
|
||||
String s =
|
||||
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
||||
+ "\n"
|
||||
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
||||
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
@ -183,73 +246,73 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getWhoClicked().getUniqueId());
|
||||
Player player = (Player) evt.getWhoClicked();
|
||||
|
||||
|
||||
if (evt.getInventory().getTitle().equals("Quests")) {
|
||||
|
||||
|
||||
ItemStack clicked = evt.getCurrentItem();
|
||||
if(clicked != null) {
|
||||
if (clicked != null) {
|
||||
|
||||
for(Quest quest : plugin.quests) {
|
||||
for (Quest quest : plugin.quests) {
|
||||
|
||||
if(quest.guiDisplay != null) {
|
||||
if (quest.guiDisplay != null) {
|
||||
|
||||
if(ItemUtil.compareItems(clicked, quest.guiDisplay, false) == 0) {
|
||||
if (ItemUtil.compareItems(clicked, quest.guiDisplay, false) == 0) {
|
||||
|
||||
if (quester.currentQuest != null) {
|
||||
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
|
||||
player.sendMessage(YELLOW + msg);
|
||||
|
||||
} else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) {
|
||||
String completed = Lang.get("questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
} else {
|
||||
if (quester.currentQuests.size() >= Quests.maxQuests && Quests.maxQuests > 0) {
|
||||
|
||||
boolean takeable = true;
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
|
||||
player.sendMessage(YELLOW + msg);
|
||||
|
||||
if (quester.completedQuests.contains(quest.name)) {
|
||||
} else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) {
|
||||
String completed = Lang.get("questAlreadyCompleted");
|
||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + completed);
|
||||
} else {
|
||||
|
||||
if (quester.getDifference(quest) > 0) {
|
||||
String early = Lang.get("questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(quest)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
takeable = false;
|
||||
}
|
||||
boolean takeable = true;
|
||||
|
||||
if (quester.completedQuests.contains(quest.name)) {
|
||||
|
||||
if (quester.getDifference(quest) > 0) {
|
||||
String early = Lang.get("questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(quest)) + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + early);
|
||||
takeable = false;
|
||||
}
|
||||
|
||||
if (quest.region != null) {
|
||||
}
|
||||
|
||||
boolean inRegion = false;
|
||||
Player p = quester.getPlayer();
|
||||
RegionManager rm = Quests.worldGuard.getRegionManager(p.getWorld());
|
||||
Iterator<ProtectedRegion> it = rm.getApplicableRegions(p.getLocation()).iterator();
|
||||
while (it.hasNext()) {
|
||||
ProtectedRegion pr = it.next();
|
||||
if (pr.getId().equalsIgnoreCase(quest.region)) {
|
||||
inRegion = true;
|
||||
break;
|
||||
}
|
||||
if (quest.region != null) {
|
||||
|
||||
boolean inRegion = false;
|
||||
Player p = quester.getPlayer();
|
||||
RegionManager rm = Quests.worldGuard.getRegionManager(p.getWorld());
|
||||
Iterator<ProtectedRegion> it = rm.getApplicableRegions(p.getLocation()).iterator();
|
||||
while (it.hasNext()) {
|
||||
ProtectedRegion pr = it.next();
|
||||
if (pr.getId().equalsIgnoreCase(quest.region)) {
|
||||
inRegion = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (inRegion == false) {
|
||||
String invalidLoc = Lang.get("questInvalidLocation");
|
||||
invalidLoc = invalidLoc.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + invalidLoc);
|
||||
takeable = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (takeable == true) {
|
||||
|
||||
quester.takeQuest(quest, false);
|
||||
|
||||
if (inRegion == false) {
|
||||
String invalidLoc = Lang.get("questInvalidLocation");
|
||||
invalidLoc = invalidLoc.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + invalidLoc);
|
||||
takeable = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (takeable == true) {
|
||||
|
||||
quester.takeQuest(quest, false);
|
||||
|
||||
}
|
||||
|
||||
evt.getWhoClicked().closeInventory();
|
||||
|
||||
}
|
||||
@ -261,13 +324,13 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
}
|
||||
|
||||
evt.setCancelled(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerChat(AsyncPlayerChatEvent evt) {
|
||||
|
||||
@ -275,19 +338,23 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
|
||||
if (quester.currentStage != null) {
|
||||
if (quester.currentQuests.isEmpty() == false) {
|
||||
|
||||
if (quester.currentStage.chatEvents.isEmpty() == false) {
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
String chat = evt.getMessage();
|
||||
for (String s : quester.currentStage.chatEvents.keySet()) {
|
||||
if (quester.getCurrentStage(quest).chatEvents.isEmpty() == false) {
|
||||
|
||||
if (s.equalsIgnoreCase(chat)) {
|
||||
String chat = evt.getMessage();
|
||||
for (String s : quester.getCurrentStage(quest).chatEvents.keySet()) {
|
||||
|
||||
if (quester.eventFired.get(s) == null || quester.eventFired.get(s) == false) {
|
||||
if (s.equalsIgnoreCase(chat)) {
|
||||
|
||||
quester.currentStage.chatEvents.get(s).fire(quester);
|
||||
quester.eventFired.put(s, true);
|
||||
if (quester.getQuestData(quest).eventFired.get(s) == null || quester.getQuestData(quest).eventFired.get(s) == false) {
|
||||
|
||||
quester.getCurrentStage(quest).chatEvents.get(s).fire(quester, quest);
|
||||
quester.getQuestData(quest).eventFired.put(s, true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -295,12 +362,12 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (quester.hasObjective("password")) {
|
||||
|
||||
quester.sayPass(evt);
|
||||
|
||||
if (quester.hasObjective(quest, "password")) {
|
||||
|
||||
quester.sayPass(quest, evt);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -315,9 +382,14 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (quester.hasObjective("damageBlock")) {
|
||||
|
||||
quester.damageBlock(evt.getBlock().getType());
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "damageBlock")) {
|
||||
|
||||
quester.damageBlock(quest, evt.getBlock().getType());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -331,10 +403,15 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (quester.hasObjective("placeBlock")) {
|
||||
|
||||
if (evt.isCancelled() == false) {
|
||||
quester.placeBlock(evt.getBlock().getType());
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "placeBlock")) {
|
||||
|
||||
if (evt.isCancelled() == false) {
|
||||
quester.placeBlock(quest, evt.getBlock().getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -349,33 +426,38 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (quester.hasObjective("breakBlock")) {
|
||||
|
||||
if (evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH) == false && evt.isCancelled() == false) {
|
||||
quester.breakBlock(evt.getBlock().getType());
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "breakBlock")) {
|
||||
|
||||
if (evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH) == false && evt.isCancelled() == false) {
|
||||
quester.breakBlock(quest, evt.getBlock().getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (quester.hasObjective(quest, "placeBlock")) {
|
||||
|
||||
if (quester.hasObjective("placeBlock")) {
|
||||
if (quester.getQuestData(quest).blocksPlaced.containsKey(evt.getBlock().getType())) {
|
||||
|
||||
if (quester.blocksPlaced.containsKey(evt.getBlock().getType())) {
|
||||
if (quester.getQuestData(quest).blocksPlaced.get(evt.getBlock().getType()) > 0) {
|
||||
|
||||
if (quester.blocksPlaced.get(evt.getBlock().getType()) > 0) {
|
||||
if (evt.isCancelled() == false) {
|
||||
quester.getQuestData(quest).blocksPlaced.put(evt.getBlock().getType(), quester.getQuestData(quest).blocksPlaced.get(evt.getBlock().getType()) - 1);
|
||||
}
|
||||
|
||||
if (evt.isCancelled() == false) {
|
||||
quester.blocksPlaced.put(evt.getBlock().getType(), quester.blocksPlaced.get(evt.getBlock().getType()) - 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS) && quester.hasObjective(quest, "cutBlock")) {
|
||||
|
||||
if (evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS) && quester.hasObjective("cutBlock")) {
|
||||
quester.cutBlock(quest, evt.getBlock().getType());
|
||||
|
||||
quester.cutBlock(evt.getBlock().getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -389,10 +471,15 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (evt.getEntity().getType().equals(EntityType.SHEEP) && quester.hasObjective("shearSheep")) {
|
||||
|
||||
Sheep sheep = (Sheep) evt.getEntity();
|
||||
quester.shearSheep(sheep.getColor());
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (evt.getEntity().getType().equals(EntityType.SHEEP) && quester.hasObjective(quest, "shearSheep")) {
|
||||
|
||||
Sheep sheep = (Sheep) evt.getEntity();
|
||||
quester.shearSheep(quest, sheep.getColor());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -409,9 +496,14 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (plugin.checkQuester(p.getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(p.getUniqueId());
|
||||
if (quester.hasObjective("tameMob")) {
|
||||
|
||||
quester.tameMob(evt.getEntityType());
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "tameMob")) {
|
||||
|
||||
quester.tameMob(quest, evt.getEntityType());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -427,11 +519,16 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (plugin.checkQuester(evt.getEnchanter().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getEnchanter().getUniqueId());
|
||||
if (quester.hasObjective("enchantItem")) {
|
||||
|
||||
for (Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
quester.enchantItem(e, evt.getItem().getType());
|
||||
if (quester.hasObjective(quest, "enchantItem")) {
|
||||
|
||||
for (Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||
|
||||
quester.enchantItem(quest, e, evt.getItem().getType());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -441,76 +538,6 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* CRAFTING (Player)
|
||||
*
|
||||
* 0 - Crafted Slot 1 - Top-left Craft Slot 2 - Top-right Craft Slot 3 -
|
||||
* Bottom-left Craft Slot 4 - Bottom-right Craft Slot
|
||||
*
|
||||
* 5 - Head Slot 6 - Body Slot 7 - Leg Slot 8 - Boots Slot
|
||||
*
|
||||
* 9-35 - Top-left to Bottom-right inventory slots 36-44 - Left to Right
|
||||
* hotbar slots
|
||||
*
|
||||
* -999 - Drop Slot
|
||||
*
|
||||
*
|
||||
* BREWING
|
||||
*
|
||||
* 0 - Left Potion Slot 1 - Middle Potion Slot 2 - Right Potion Slot 3-
|
||||
* Ingredient Slot
|
||||
*
|
||||
* 4-30 - Top-left to Bottom-right inventory slots 31-39 - Left to Right
|
||||
* hotbar slots
|
||||
*
|
||||
* ENCHANTING
|
||||
*
|
||||
* 0 - Enchant Slot
|
||||
*
|
||||
* 1-27 - Top-left to Bottom-right inventory slots 28-36 - Left to Right
|
||||
* hotbar slots
|
||||
*
|
||||
* ENDER CHEST
|
||||
*
|
||||
* 0-26 - Top-left to Bottom-right chest slots
|
||||
*
|
||||
* 27-53 - Top-left to Bottom-right inventory slots 54-62 - Left to Right
|
||||
* hotbar slots
|
||||
*
|
||||
* DISPENSER
|
||||
*
|
||||
* 0-8 - Top-left to Bottom-right dispenser slots
|
||||
*
|
||||
* 9-35 - Top-left to Bottom-right inventory slots 36-44 - Left to Right
|
||||
* hotbar slots
|
||||
*
|
||||
* FURNACE
|
||||
*
|
||||
* 0 - Furnace Slot 1 - Fuel Slot 2 - Product Slot
|
||||
*
|
||||
* 3-29 - Top-left to Bottom-right inventory slots 30-38 - Left to Right
|
||||
* hotbar slots
|
||||
*
|
||||
* WORKBENCH
|
||||
*
|
||||
* 0 - Product Slot 1-9 - Top-left to Bottom-right crafting slots
|
||||
*
|
||||
* CHEST
|
||||
*
|
||||
* 0-26 - Top-left to Bottom-right chest slots
|
||||
*
|
||||
* 27-53 - Top-left to Bottom-right inventory slots 54-62 - Left to Right
|
||||
* hotbar slots
|
||||
*
|
||||
* CHEST (Double)
|
||||
*
|
||||
* 0-53 - Top-left to Bottom-right chest slots
|
||||
*
|
||||
* 54-80 - Top-left to Bottom-right inventory slots 81-89 - Left to Right
|
||||
* hotbar slots
|
||||
*
|
||||
*/
|
||||
@EventHandler
|
||||
public void onEntityDeath(EntityDeathEvent evt) {
|
||||
|
||||
@ -541,8 +568,12 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
|
||||
if (quester.hasObjective("killMob")) {
|
||||
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "killMob")) {
|
||||
quester.killMob(quest, evt.getEntity().getLocation(), evt.getEntity().getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -562,8 +593,13 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
Player player = (Player) damager;
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.hasObjective("killMob")) {
|
||||
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
||||
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "killMob")) {
|
||||
quester.killMob(quest, evt.getEntity().getLocation(), evt.getEntity().getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -608,8 +644,12 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
|
||||
if (quester.hasObjective("killPlayer")) {
|
||||
quester.killPlayer(evt.getEntity().getName());
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "killPlayer")) {
|
||||
quester.killPlayer(quest, evt.getEntity().getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -637,8 +677,13 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (okay) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.hasObjective("killPlayer")) {
|
||||
quester.killPlayer(evt.getEntity().getName());
|
||||
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "killPlayer")) {
|
||||
quester.killPlayer(quest, evt.getEntity().getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -654,13 +699,33 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (plugin.checkQuester(player.getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if(quester.currentStage != null){
|
||||
if(quester.currentStage.deathEvent != null){
|
||||
quester.currentStage.deathEvent.fire(quester);
|
||||
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.getCurrentStage(quest).deathEvent != null) {
|
||||
quester.getCurrentStage(quest).deathEvent.fire(quester, quest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ItemStack found = null;
|
||||
|
||||
for(ItemStack stack : evt.getDrops()) {
|
||||
|
||||
if(ItemUtil.isJournal(stack)) {
|
||||
found = stack;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(found != null) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
evt.getDrops().remove(found);
|
||||
quester.hasJournal = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -671,8 +736,13 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (plugin.checkQuester(player.getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.hasObjective("catchFish") && evt.getState().equals(State.CAUGHT_FISH)) {
|
||||
quester.catchFish();
|
||||
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.hasObjective(quest, "catchFish") && evt.getState().equals(State.CAUGHT_FISH)) {
|
||||
quester.catchFish(quest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -682,8 +752,6 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent evt) {
|
||||
|
||||
System.out.println("Joined: " + evt.getPlayer().getUniqueId());
|
||||
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = new Quester(plugin);
|
||||
@ -710,13 +778,15 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
}
|
||||
|
||||
quester.checkQuest();
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
quester.checkQuest(quest);
|
||||
}
|
||||
|
||||
if (quester.currentQuest != null) {
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.currentStage.delay > -1) {
|
||||
if (quester.getCurrentStage(quest).delay > -1) {
|
||||
|
||||
quester.startStageTimer();
|
||||
quester.startStageTimer(quest);
|
||||
|
||||
}
|
||||
|
||||
@ -732,24 +802,26 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (quester.currentQuest != null) {
|
||||
|
||||
if (quester.currentStage.delay > -1) {
|
||||
quester.stopStageTimer();
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
if (quester.getCurrentStage(quest).delay > -1) {
|
||||
quester.stopStageTimer(quest);
|
||||
}
|
||||
|
||||
if(quester.currentStage.disconnectEvent != null){
|
||||
quester.currentStage.disconnectEvent.fire(quester);
|
||||
if (quester.getCurrentStage(quest).disconnectEvent != null) {
|
||||
quester.getCurrentStage(quest).disconnectEvent.fire(quester, quest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(quester.hasData()){
|
||||
if (quester.hasData()) {
|
||||
quester.saveData();
|
||||
}
|
||||
|
||||
if(plugin.questFactory.selectingNPCs.contains(evt.getPlayer()))
|
||||
if (plugin.questFactory.selectingNPCs.contains(evt.getPlayer())) {
|
||||
plugin.questFactory.selectingNPCs.remove(evt.getPlayer());
|
||||
}
|
||||
plugin.questers.remove(quester.id);
|
||||
|
||||
}
|
||||
@ -772,9 +844,13 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
|
||||
if (quester.hasObjective("reachLocation")) {
|
||||
for (Quest quest : quester.currentQuests.keySet()) {
|
||||
|
||||
quester.reachLocation(evt.getTo());
|
||||
if (quester.hasObjective(quest, "reachLocation")) {
|
||||
|
||||
quester.reachLocation(quest, evt.getTo());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class Quest {
|
||||
Location blockStart;
|
||||
Quests plugin;
|
||||
Event initialEvent;
|
||||
|
||||
|
||||
//Requirements
|
||||
int moneyReq = 0;
|
||||
int questPointsReq = 0;
|
||||
@ -55,10 +55,10 @@ public class Quest {
|
||||
String heroesSecondaryClassReq = null;
|
||||
Map<String, Map<String, Object>> customRequirements = new HashMap<String, Map<String, Object>>();
|
||||
Map<String, Map<String, Object>> customRewards = new HashMap<String, Map<String, Object>>();
|
||||
|
||||
|
||||
public String failRequirements = null;
|
||||
//
|
||||
|
||||
|
||||
//Rewards
|
||||
int moneyReward = 0;
|
||||
int questPoints = 0;
|
||||
@ -74,15 +74,15 @@ public class Quest {
|
||||
List<Double> heroesAmounts = new LinkedList<Double>();
|
||||
List<String> phatLootRewards = new LinkedList<String>();
|
||||
//
|
||||
|
||||
|
||||
public Stage getStage(int index) {
|
||||
try {
|
||||
return orderedStages.get(index);
|
||||
}catch (IndexOutOfBoundsException e) {
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void nextStage(Quester q) {
|
||||
|
||||
String stageCompleteMessage = q.getCurrentStage(this).completeMessage;
|
||||
@ -99,7 +99,7 @@ public class Quest {
|
||||
plugin.trigger.parseQuestTaskTrigger(q.getCurrentStage(this).script, player);
|
||||
}
|
||||
if (q.getCurrentStage(this).finishEvent != null) {
|
||||
q.getCurrentStage(this).finishEvent.fire(q);
|
||||
q.getCurrentStage(this).finishEvent.fire(q, this);
|
||||
}
|
||||
|
||||
completeQuest(q);
|
||||
@ -126,10 +126,10 @@ public class Quest {
|
||||
|
||||
public void setStage(Quester quester, int stage) throws InvalidStageException {
|
||||
|
||||
quester.currentQuests.put(this, stage);
|
||||
|
||||
quester.currentQuests.put(this, stage);
|
||||
|
||||
if (orderedStages.size() - 1 < stage) {
|
||||
throw new InvalidStageException(this, stage);
|
||||
throw new InvalidStageException(this, stage);
|
||||
}
|
||||
|
||||
quester.resetObjectives(this);
|
||||
@ -139,16 +139,17 @@ public class Quest {
|
||||
}
|
||||
|
||||
/*if (quester.getCurrentStage(this).finishEvent != null) {
|
||||
quester.getCurrentStage(this).finishEvent.fire(quester);
|
||||
}*/
|
||||
|
||||
quester.getCurrentStage(this).finishEvent.fire(quester);
|
||||
}*/
|
||||
if (quester.getCurrentStage(this).startEvent != null) {
|
||||
quester.getCurrentStage(this).startEvent.fire(quester);
|
||||
quester.getCurrentStage(this).startEvent.fire(quester, this);
|
||||
}
|
||||
|
||||
quester.addEmpties(this);
|
||||
|
||||
quester.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questObjectivesTitle"));
|
||||
String msg = Lang.get("questObjectivesTitle");
|
||||
msg = msg.replaceAll("<quest>", name);
|
||||
quester.getPlayer().sendMessage(ChatColor.GOLD + msg);
|
||||
for (String s : quester.getObjectivesReal(this)) {
|
||||
|
||||
quester.getPlayer().sendMessage(s);
|
||||
@ -234,24 +235,25 @@ public class Quest {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (String s : customRequirements.keySet()){
|
||||
|
||||
|
||||
for (String s : customRequirements.keySet()) {
|
||||
|
||||
CustomRequirement found = null;
|
||||
for(CustomRequirement cr : plugin.customRequirements){
|
||||
if(cr.getName().equalsIgnoreCase(s)){
|
||||
for (CustomRequirement cr : plugin.customRequirements) {
|
||||
if (cr.getName().equalsIgnoreCase(s)) {
|
||||
found = cr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(found != null){
|
||||
if(found.testRequirement(player, customRequirements.get(s)) == false)
|
||||
|
||||
if (found != null) {
|
||||
if (found.testRequirement(player, customRequirements.get(s)) == false) {
|
||||
return false;
|
||||
}else{
|
||||
}
|
||||
} else {
|
||||
Quests.printWarning("[Quests] Quester \"" + player.getName() + "\" attempted to take Quest \"" + name + "\", but the Custom Requirement \"" + s + "\" could not be found. Does it still exist?");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (quester.questPoints < questPointsReq) {
|
||||
@ -263,7 +265,7 @@ public class Quest {
|
||||
}
|
||||
|
||||
for (String q : blockQuests) {
|
||||
if (quester.completedQuests.contains(q)) {
|
||||
if (quester.completedQuests.contains(q) || quester.currentQuests.containsKey(q)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -335,33 +337,36 @@ public class Quest {
|
||||
|
||||
LinkedList<String> phatLootMessages = new LinkedList<String>();
|
||||
|
||||
for(String s : phatLootRewards) {
|
||||
for (String s : phatLootRewards) {
|
||||
|
||||
LootBundle lb = PhatLootsAPI.getPhatLoot(s).rollForLoot();
|
||||
|
||||
if(lb.getExp() > 0){
|
||||
if (lb.getExp() > 0) {
|
||||
phatLootExp += lb.getExp();
|
||||
player.giveExp(lb.getExp());
|
||||
}
|
||||
|
||||
if(lb.getMoney() > 0){
|
||||
if (lb.getMoney() > 0) {
|
||||
phatLootMoney += lb.getMoney();
|
||||
Quests.economy.depositPlayer(player.getName(), lb.getMoney());
|
||||
}
|
||||
|
||||
if(lb.getItemList().isEmpty() == false){
|
||||
if (lb.getItemList().isEmpty() == false) {
|
||||
phatLootItems.addAll(lb.getItemList());
|
||||
for(ItemStack is : lb.getItemList())
|
||||
for (ItemStack is : lb.getItemList()) {
|
||||
Quests.addItem(player, is);
|
||||
}
|
||||
}
|
||||
|
||||
if(lb.getCommandList().isEmpty() == false){
|
||||
for(CommandLoot cl : lb.getCommandList())
|
||||
if (lb.getCommandList().isEmpty() == false) {
|
||||
for (CommandLoot cl : lb.getCommandList()) {
|
||||
cl.execute(player);
|
||||
}
|
||||
}
|
||||
|
||||
if(lb.getMessageList().isEmpty() == false)
|
||||
if (lb.getMessageList().isEmpty() == false) {
|
||||
phatLootMessages.addAll(lb.getMessageList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -384,26 +389,29 @@ public class Quest {
|
||||
for (ItemStack i : itemRewards) {
|
||||
|
||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||
|
||||
if(i.getEnchantments().isEmpty())
|
||||
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount());
|
||||
else
|
||||
} else {
|
||||
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
|
||||
|
||||
}
|
||||
|
||||
} else if (i.getDurability() != 0) {
|
||||
|
||||
if(i.getEnchantments().isEmpty())
|
||||
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
|
||||
else
|
||||
} else {
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(i.getEnchantments().isEmpty())
|
||||
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount());
|
||||
else
|
||||
} else {
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
none = null;
|
||||
@ -412,26 +420,29 @@ public class Quest {
|
||||
for (ItemStack i : phatLootItems) {
|
||||
|
||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||
|
||||
if(i.getEnchantments().isEmpty())
|
||||
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount());
|
||||
else
|
||||
} else {
|
||||
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
|
||||
|
||||
}
|
||||
|
||||
} else if (i.getDurability() != 0) {
|
||||
|
||||
if(i.getEnchantments().isEmpty())
|
||||
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
|
||||
else
|
||||
} else {
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(i.getEnchantments().isEmpty())
|
||||
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount());
|
||||
else
|
||||
} else {
|
||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
none = null;
|
||||
@ -466,38 +477,38 @@ public class Quest {
|
||||
none = null;
|
||||
}
|
||||
|
||||
if(phatLootMessages.isEmpty() == false) {
|
||||
for (String s : phatLootMessages){
|
||||
if (phatLootMessages.isEmpty() == false) {
|
||||
for (String s : phatLootMessages) {
|
||||
player.sendMessage("- " + s);
|
||||
}
|
||||
none = null;
|
||||
}
|
||||
|
||||
for (String s : customRewards.keySet()){
|
||||
|
||||
|
||||
for (String s : customRewards.keySet()) {
|
||||
|
||||
CustomReward found = null;
|
||||
for(CustomReward cr : plugin.customRewards){
|
||||
if(cr.getName().equalsIgnoreCase(s)){
|
||||
for (CustomReward cr : plugin.customRewards) {
|
||||
if (cr.getName().equalsIgnoreCase(s)) {
|
||||
found = cr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(found != null){
|
||||
|
||||
if (found != null) {
|
||||
Map<String, Object> datamap = customRewards.get(found.getName());
|
||||
String message = found.getRewardName();
|
||||
|
||||
for(String key : datamap.keySet()){
|
||||
|
||||
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{
|
||||
} else {
|
||||
Quests.printWarning("[Quests] Quester \"" + player.getName() + "\" completed the Quest \"" + name + "\", but the Custom Reward \"" + s + "\" could not be found. Does it still exist?");
|
||||
}
|
||||
|
||||
|
||||
none = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (none != null) {
|
||||
@ -623,7 +634,7 @@ public class Quest {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(other.phatLootRewards.equals(phatLootRewards) == false) {
|
||||
if (other.phatLootRewards.equals(phatLootRewards) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -680,12 +691,12 @@ public class Quest {
|
||||
} else if (other.heroesSecondaryClassReq == null && heroesSecondaryClassReq != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.customRequirements.equals(customRequirements) == false){
|
||||
|
||||
if (other.customRequirements.equals(customRequirements) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.customRewards.equals(customRewards) == false){
|
||||
|
||||
if (other.customRewards.equals(customRewards) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -723,18 +734,19 @@ public class Quest {
|
||||
|
||||
}
|
||||
|
||||
public boolean isInRegion(Player player){
|
||||
public boolean isInRegion(Player player) {
|
||||
|
||||
if(region == null){
|
||||
if (region == null) {
|
||||
return true;
|
||||
}else{
|
||||
} else {
|
||||
ApplicableRegionSet ars = Quests.worldGuard.getRegionManager(player.getWorld()).getApplicableRegions(player.getLocation());
|
||||
Iterator<ProtectedRegion> i = ars.iterator();
|
||||
while(i.hasNext()){
|
||||
while (i.hasNext()) {
|
||||
|
||||
ProtectedRegion pr = i.next();
|
||||
if(pr.getId().equalsIgnoreCase(region))
|
||||
if (pr.getId().equalsIgnoreCase(region)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class QuestData {
|
||||
|
||||
|
||||
public Map<Material, Integer> blocksDamaged = new EnumMap<Material, Integer>(Material.class);
|
||||
public Map<Material, Integer> blocksBroken = new EnumMap<Material, Integer>(Material.class);
|
||||
public Map<Material, Integer> blocksPlaced = new EnumMap<Material, Integer>(Material.class);
|
||||
@ -41,5 +41,6 @@ public class QuestData {
|
||||
public Map<String, Boolean> passwordsSaid = new HashMap<String, Boolean>();
|
||||
public Map<String, Integer> customObjectiveCounts = new HashMap<String, Integer>();
|
||||
public Map<String, Boolean> eventFired = new HashMap<String, Boolean>();
|
||||
|
||||
public boolean delayOver = true;
|
||||
|
||||
}
|
||||
|
@ -273,20 +273,20 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
}
|
||||
|
||||
if (quests.citizens != null) {
|
||||
|
||||
if(context.getSessionData(CK.Q_GUIDISPLAY) == null) {
|
||||
|
||||
if (context.getSessionData(CK.Q_GUIDISPLAY) == null) {
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
|
||||
ItemStack stack = (ItemStack) context.getSessionData(CK.Q_GUIDISPLAY);
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + ItemUtil.getDisplayString(stack) + RESET + YELLOW + ")\n";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
text += GRAY + "8 - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("questCitNotInstalled") + ")\n";
|
||||
}
|
||||
|
||||
|
||||
if (quests.citizens != null) {
|
||||
text += BLUE + "" + BOLD + "10" + RESET + DARKAQUA + " - " + Lang.get("questEditorReqs") + "\n";
|
||||
} else {
|
||||
@ -789,84 +789,83 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class GUIDisplayPrompt extends FixedSetPrompt {
|
||||
|
||||
public GUIDisplayPrompt(){
|
||||
|
||||
|
||||
public GUIDisplayPrompt() {
|
||||
|
||||
super("1", "2", "3");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
|
||||
if(context.getSessionData("tempStack") != null){
|
||||
|
||||
|
||||
if (context.getSessionData("tempStack") != null) {
|
||||
|
||||
ItemStack stack = (ItemStack) context.getSessionData("tempStack");
|
||||
boolean failed = false;
|
||||
|
||||
for(Quest quest : quests.quests) {
|
||||
|
||||
if(quest.guiDisplay != null) {
|
||||
|
||||
if(ItemUtil.compareItems(stack, quest.guiDisplay, false) != 0) {
|
||||
|
||||
|
||||
for (Quest quest : quests.quests) {
|
||||
|
||||
if (quest.guiDisplay != null) {
|
||||
|
||||
if (ItemUtil.compareItems(stack, quest.guiDisplay, false) != 0) {
|
||||
|
||||
String error = Lang.get("questGUIError");
|
||||
error = error.replaceAll("<quest>", PURPLE + quest.name + RED);
|
||||
context.getForWhom().sendRawMessage(RED + error);
|
||||
failed = true;
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!failed)
|
||||
|
||||
if (!failed) {
|
||||
context.setSessionData(CK.Q_GUIDISPLAY, context.getSessionData("tempStack"));
|
||||
|
||||
}
|
||||
|
||||
context.setSessionData("tempStack", null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
String text = GREEN + Lang.get("questGUITitle") + "\n";
|
||||
if(context.getSessionData(CK.Q_GUIDISPLAY) != null){
|
||||
if (context.getSessionData(CK.Q_GUIDISPLAY) != null) {
|
||||
ItemStack stack = (ItemStack) context.getSessionData(CK.Q_GUIDISPLAY);
|
||||
text += DARKGREEN + Lang.get("questCurrentItem") + " " + RESET + ItemUtil.getDisplayString(stack) + "\n\n";
|
||||
}else {
|
||||
} else {
|
||||
text += DARKGREEN + Lang.get("questCurrentItem") + " " + GRAY + "(" + Lang.get("none") + ")\n\n";
|
||||
}
|
||||
text += GREEN + "" + BOLD + "1 -" + RESET + DARKGREEN + " " + Lang.get("questSetItem") + "\n";
|
||||
text += GREEN + "" + BOLD + "2 -" + RESET + DARKGREEN + " " + Lang.get("questClearItem") + "\n";
|
||||
text += GREEN + "" + BOLD + "3 -" + RESET + GREEN + " " + Lang.get("done") + "\n";
|
||||
|
||||
|
||||
text += GREEN + "" + BOLD + "3 -" + RESET + GREEN + " " + Lang.get("done") + "\n";
|
||||
|
||||
return text;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
|
||||
if(input.equalsIgnoreCase("1")) {
|
||||
|
||||
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
|
||||
return new ItemStackPrompt(GUIDisplayPrompt.this);
|
||||
|
||||
}else if(input.equalsIgnoreCase("2")) {
|
||||
|
||||
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
|
||||
context.setSessionData(CK.Q_GUIDISPLAY, null);
|
||||
context.getForWhom().sendRawMessage(YELLOW + Lang.get("questGUICleared"));
|
||||
return new GUIDisplayPrompt();
|
||||
|
||||
}else {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
return new CreateMenuPrompt();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -962,7 +961,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
|
||||
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||
return new CreateMenuPrompt();
|
||||
}
|
||||
@ -1222,7 +1221,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
if (cc.getSessionData(CK.Q_GUIDISPLAY) != null) {
|
||||
guiDisplay = (ItemStack) cc.getSessionData(CK.Q_GUIDISPLAY);
|
||||
}
|
||||
|
||||
|
||||
if (cc.getSessionData(CK.REW_MONEY) != null) {
|
||||
moneyRew = (Integer) cc.getSessionData(CK.REW_MONEY);
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ public class QuestTaskTrigger {
|
||||
task_script.runTaskScript(dPlayer.mirrorBukkitPlayer(player), null, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,7 @@ public class Stage {
|
||||
LinkedList<String> areaNames = new LinkedList<String>();
|
||||
|
||||
LinkedList<ItemStack> itemsToDeliver = new LinkedList<ItemStack>();
|
||||
LinkedList<Integer> itemDeliveryTargets = new LinkedList<Integer>(){
|
||||
LinkedList<Integer> itemDeliveryTargets = new LinkedList<Integer>() {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
@ -56,7 +56,7 @@ public class Stage {
|
||||
};
|
||||
public LinkedList<String> deliverMessages = new LinkedList<String>();
|
||||
|
||||
public LinkedList<Integer> citizensToInteract = new LinkedList<Integer>(){
|
||||
public LinkedList<Integer> citizensToInteract = new LinkedList<Integer>() {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
@ -202,15 +202,15 @@ public class Stage {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.itemsToDeliver.equals(itemsToDeliver) == false){
|
||||
if (other.itemsToDeliver.equals(itemsToDeliver) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.itemDeliveryTargets.equals(itemDeliveryTargets) == false){
|
||||
if (other.itemDeliveryTargets.equals(itemDeliveryTargets) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.deliverMessages.equals(deliverMessages) == false){
|
||||
if (other.deliverMessages.equals(deliverMessages) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -253,23 +253,23 @@ public class Stage {
|
||||
if (other.itemsToCraft.equals(itemsToCraft) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (other.customObjectives.equals(customObjectives) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (other.customObjectiveDisplays.equals(customObjectiveDisplays) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (other.customObjectiveData.equals(customObjectiveData) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (other.passwordDisplays.equals(passwordDisplays) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (other.passwordPhrases.equals(passwordPhrases) == false) {
|
||||
return false;
|
||||
}
|
||||
@ -314,11 +314,13 @@ public class Stage {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(other.chatEvents.equals(chatEvents) == false)
|
||||
if (other.chatEvents.equals(chatEvents) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(other.delay != delay)
|
||||
if (other.delay != delay) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (other.delayMessage != null && delayMessage != null) {
|
||||
if (other.delayMessage.equals(delayMessage) == false) {
|
||||
@ -349,7 +351,7 @@ public class Stage {
|
||||
} else if (other.completeMessage == null && completeMessage != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (other.objectiveOverride != null && objectiveOverride != null) {
|
||||
if (other.objectiveOverride.equals(objectiveOverride) == false) {
|
||||
return false;
|
||||
@ -366,5 +368,4 @@ public class Stage {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,66 +4,73 @@ import me.blackvein.quests.util.Lang;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class StageTimer implements Runnable{
|
||||
public class StageTimer implements Runnable {
|
||||
|
||||
Quester quester;
|
||||
Quests plugin;
|
||||
Quest quest;
|
||||
|
||||
public StageTimer(Quests quests, Quester q){
|
||||
public StageTimer(Quests quests, Quester q, Quest qu) {
|
||||
|
||||
quester = q;
|
||||
quest = qu;
|
||||
plugin = quests;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(){
|
||||
public void run() {
|
||||
|
||||
if(quester.delayOver){
|
||||
if (quester.getQuestData(quest).delayOver) {
|
||||
|
||||
Player player = quester.getPlayer();
|
||||
|
||||
if(quester.currentQuest != null){
|
||||
if (quest.orderedStages.indexOf(quester.getCurrentStage(quest)) == (quest.orderedStages.size() - 1)) {
|
||||
|
||||
if(quester.currentQuest.orderedStages.indexOf(quester.currentStage) == (quester.currentQuest.orderedStages.size() - 1)){
|
||||
if (quester.getCurrentStage(quest).script != null) {
|
||||
plugin.trigger.parseQuestTaskTrigger(quester.getCurrentStage(quest).script, player);
|
||||
}
|
||||
if (quester.getCurrentStage(quest).finishEvent != null) {
|
||||
quester.getCurrentStage(quest).finishEvent.fire(quester, quest);
|
||||
}
|
||||
|
||||
if(quester.currentStage.script != null)
|
||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
||||
if(quester.currentStage.finishEvent != null)
|
||||
quester.currentStage.finishEvent.fire(quester);
|
||||
quest.completeQuest(quester);
|
||||
|
||||
quester.currentQuest.completeQuest(quester);
|
||||
} else {
|
||||
|
||||
}else {
|
||||
quester.resetObjectives(quest);
|
||||
|
||||
quester.resetObjectives();
|
||||
if(quester.currentStage.script != null)
|
||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
||||
if(quester.currentStage.finishEvent != null)
|
||||
quester.currentStage.finishEvent.fire(quester);
|
||||
quester.currentStage = quester.currentQuest.orderedStages.get(quester.currentStageIndex + 1);
|
||||
quester.currentStageIndex++;
|
||||
quester.addEmpties();
|
||||
quester.delayStartTime = 0;
|
||||
quester.delayTimeLeft = -1;
|
||||
if (quester.getCurrentStage(quest).script != null) {
|
||||
plugin.trigger.parseQuestTaskTrigger(quester.getCurrentStage(quest).script, player);
|
||||
}
|
||||
|
||||
player.sendMessage(ChatColor.GOLD + Lang.get("questObjectivesTitle"));
|
||||
for(String s : quester.getObjectivesReal()){
|
||||
if (quester.getCurrentStage(quest).finishEvent != null) {
|
||||
quester.getCurrentStage(quest).finishEvent.fire(quester, quest);
|
||||
}
|
||||
|
||||
player.sendMessage(s);
|
||||
quester.setCurrentStage(quest, quester.currentQuests.get(quest) + 1);
|
||||
quester.addEmpties(quest);
|
||||
quester.getQuestData(quest).delayStartTime = 0;
|
||||
quester.getQuestData(quest).delayTimeLeft = -1;
|
||||
|
||||
}
|
||||
String msg = Lang.get("questObjectivesTitle");
|
||||
msg = msg.replaceAll("<quest>", quest.name);
|
||||
player.sendMessage(ChatColor.GOLD + msg);
|
||||
player.sendMessage(ChatColor.GOLD + Lang.get("questObjectivesTitle"));
|
||||
for (String s : quester.getObjectivesReal(quest)) {
|
||||
|
||||
String stageStartMessage = quester.currentStage.startMessage;
|
||||
if (stageStartMessage != null) {
|
||||
quester.getPlayer().sendMessage(Quests.parseString(stageStartMessage, quester.currentQuest));
|
||||
}
|
||||
player.sendMessage(s);
|
||||
|
||||
}
|
||||
|
||||
String stageStartMessage = quester.getCurrentStage(quest).startMessage;
|
||||
if (stageStartMessage != null) {
|
||||
quester.getPlayer().sendMessage(Quests.parseString(stageStartMessage, quest));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
quester.delayOver = true;
|
||||
quester.getQuestData(quest).delayOver = true;
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,27 +3,27 @@ package me.blackvein.quests.exceptions;
|
||||
import me.blackvein.quests.Quest;
|
||||
|
||||
public class InvalidStageException extends Exception {
|
||||
|
||||
private final Quest quest;
|
||||
private final int stage;
|
||||
|
||||
public InvalidStageException(Quest quest, int stage) {
|
||||
this.quest = quest;
|
||||
this.stage = stage;
|
||||
}
|
||||
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
public int getStage() {
|
||||
return stage;
|
||||
}
|
||||
private final Quest quest;
|
||||
private final int stage;
|
||||
|
||||
private static final long serialVersionUID = 1778748295752972651L;
|
||||
public InvalidStageException(Quest quest, int stage) {
|
||||
this.quest = quest;
|
||||
this.stage = stage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printStackTrace() {
|
||||
super.printStackTrace();
|
||||
}
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
public int getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1778748295752972651L;
|
||||
|
||||
@Override
|
||||
public void printStackTrace() {
|
||||
super.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ currentQuest
|
||||
noCurrentQuest
|
||||
noActiveQuest
|
||||
|
||||
questObjectivesTitle
|
||||
|
||||
-REMOVED-
|
||||
|
||||
@ -18,4 +19,12 @@ questOneActive
|
||||
|
||||
-ADDED-
|
||||
|
||||
questMaxAllowed
|
||||
COMMAND_JOURNAL
|
||||
COMMAND_JOURNAL_HELP
|
||||
|
||||
questMaxAllowed
|
||||
journalTitle
|
||||
journalTaken
|
||||
journalPutAway
|
||||
journalAlreadyHave
|
||||
journalNoRoom
|
File diff suppressed because it is too large
Load Diff
@ -24,7 +24,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
//Stores itemstack in "tempStack" context data.
|
||||
//Stores id in "tempId"
|
||||
@ -33,9 +33,9 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
//Stores enchantments in "tempEnchantments"
|
||||
//Stores name in "tempName"
|
||||
//Stores lore in "tempLore"
|
||||
|
||||
final Prompt oldPrompt;
|
||||
public ItemStackPrompt(Prompt old){
|
||||
|
||||
public ItemStackPrompt(Prompt old) {
|
||||
|
||||
super("0", "1", "2", "3", "4", "5", "6", "7", "8");
|
||||
oldPrompt = old;
|
||||
@ -45,12 +45,14 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
@Override
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String menu = YELLOW + Lang.get("createItemTitle") + "\n";
|
||||
if(cc.getSessionData("tempId") != null){
|
||||
if (cc.getSessionData("tempId") != null) {
|
||||
String stackData = getItemData(cc);
|
||||
if(stackData != null)
|
||||
if (stackData != null) {
|
||||
menu += stackData;
|
||||
}else
|
||||
}
|
||||
} else {
|
||||
menu += "\n";
|
||||
}
|
||||
menu += GOLD + "" + BOLD + "0. " + RESET + "" + YELLOW + Lang.get("itemCreateLoadHand") + "\n";
|
||||
menu += YELLOW + "" + BOLD + "1. " + RESET + "" + GOLD + Lang.get("itemCreateSetID") + "\n";
|
||||
menu += YELLOW + "" + BOLD + "2. " + RESET + "" + GOLD + Lang.get("itemCreateSetAmount") + "\n";
|
||||
@ -66,16 +68,16 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext cc, String input) {
|
||||
|
||||
if(input.equalsIgnoreCase("0")){
|
||||
if (input.equalsIgnoreCase("0")) {
|
||||
|
||||
Player player = (Player) cc.getForWhom();
|
||||
ItemStack is = player.getItemInHand();
|
||||
if(is == null || is.getType().equals(Material.AIR)){
|
||||
if (is == null || is.getType().equals(Material.AIR)) {
|
||||
|
||||
player.sendMessage(RED + Lang.get("itemCreateNoItem"));
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
cc.setSessionData("tempData", null);
|
||||
cc.setSessionData("tempEnchantments", null);
|
||||
@ -84,22 +86,24 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
cc.setSessionData("tempId", is.getTypeId());
|
||||
cc.setSessionData("tempAmount", is.getAmount());
|
||||
if(is.getDurability() != 0)
|
||||
if (is.getDurability() != 0) {
|
||||
cc.setSessionData("tempData", is.getDurability());
|
||||
if(is.getEnchantments() != null && is.getEnchantments().isEmpty() == false)
|
||||
cc.setSessionData("tempEnchantments", new HashMap<Enchantment,Integer>(is.getEnchantments()));
|
||||
if(is.hasItemMeta()){
|
||||
}
|
||||
if (is.getEnchantments() != null && is.getEnchantments().isEmpty() == false) {
|
||||
cc.setSessionData("tempEnchantments", new HashMap<Enchantment, Integer>(is.getEnchantments()));
|
||||
}
|
||||
if (is.hasItemMeta()) {
|
||||
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
if(meta.hasDisplayName())
|
||||
if (meta.hasDisplayName()) {
|
||||
cc.setSessionData("tempName", ChatColor.stripColor(meta.getDisplayName()));
|
||||
if(meta.hasLore()){
|
||||
}
|
||||
if (meta.hasLore()) {
|
||||
LinkedList<String> lore = new LinkedList<String>();
|
||||
lore.addAll(meta.getLore());
|
||||
cc.setSessionData("tempLore", lore);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
player.sendMessage(GREEN + Lang.get("itemCreateLoaded"));
|
||||
@ -107,55 +111,55 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase("1")){
|
||||
} else if (input.equalsIgnoreCase("1")) {
|
||||
return new IDPrompt();
|
||||
}else if(input.equalsIgnoreCase("2")){
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
|
||||
if(cc.getSessionData("tempId") != null){
|
||||
if (cc.getSessionData("tempId") != null) {
|
||||
return new AmountPrompt();
|
||||
}else{
|
||||
} else {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoID"));
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase("3")){
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
|
||||
if(cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null){
|
||||
if (cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null) {
|
||||
return new DataPrompt();
|
||||
}else{
|
||||
} else {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount"));
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase("4")){
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
|
||||
if(cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null){
|
||||
if (cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null) {
|
||||
return new EnchantmentPrompt();
|
||||
}else{
|
||||
} else {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount"));
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase("5")){
|
||||
} else if (input.equalsIgnoreCase("5")) {
|
||||
|
||||
if(cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null){
|
||||
if (cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null) {
|
||||
return new NamePrompt();
|
||||
}else{
|
||||
} else {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount"));
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase("6")){
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
|
||||
if(cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null){
|
||||
if (cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null) {
|
||||
return new LorePrompt();
|
||||
}else{
|
||||
} else {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount"));
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase("7")) {
|
||||
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
|
||||
cc.setSessionData("tempStack", null);
|
||||
cc.setSessionData("tempId", null);
|
||||
cc.setSessionData("tempAmount", null);
|
||||
@ -164,9 +168,9 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
cc.setSessionData("tempName", null);
|
||||
cc.setSessionData("tempLore", null);
|
||||
|
||||
}else if(input.equalsIgnoreCase("8")){
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
|
||||
if(cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null){
|
||||
if (cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null) {
|
||||
|
||||
int id = (Integer) cc.getSessionData("tempId");
|
||||
int amount = (Integer) cc.getSessionData("tempAmount");
|
||||
@ -175,51 +179,57 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
String name = null;
|
||||
LinkedList<String> lore = null;
|
||||
|
||||
if(cc.getSessionData("tempData") != null)
|
||||
if (cc.getSessionData("tempData") != null) {
|
||||
data = (Short) cc.getSessionData("tempData");
|
||||
if(cc.getSessionData("tempEnchantments") != null)
|
||||
}
|
||||
if (cc.getSessionData("tempEnchantments") != null) {
|
||||
enchs = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
|
||||
if(cc.getSessionData("tempName") != null)
|
||||
}
|
||||
if (cc.getSessionData("tempName") != null) {
|
||||
name = (String) cc.getSessionData("tempName");
|
||||
if(cc.getSessionData("tempLore") != null)
|
||||
}
|
||||
if (cc.getSessionData("tempLore") != null) {
|
||||
lore = (LinkedList<String>) cc.getSessionData("tempLore");
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(id, amount);
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
|
||||
if(data != -1)
|
||||
stack.setDurability((short)data);
|
||||
if(enchs != null){
|
||||
for(Entry<Enchantment, Integer> e : enchs.entrySet())
|
||||
meta.addEnchant(e.getKey(), e.getValue(), true);
|
||||
if (data != -1) {
|
||||
stack.setDurability((short) data);
|
||||
}
|
||||
if(name != null)
|
||||
if (enchs != null) {
|
||||
for (Entry<Enchantment, Integer> e : enchs.entrySet()) {
|
||||
meta.addEnchant(e.getKey(), e.getValue(), true);
|
||||
}
|
||||
}
|
||||
if (name != null) {
|
||||
meta.setDisplayName(name);
|
||||
if(lore != null)
|
||||
}
|
||||
if (lore != null) {
|
||||
meta.setLore(lore);
|
||||
}
|
||||
|
||||
stack.setItemMeta(meta);
|
||||
|
||||
cc.setSessionData("tempStack", stack);
|
||||
cc.setSessionData("newItem", Boolean.TRUE);
|
||||
|
||||
|
||||
}else{
|
||||
} else {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount"));
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try{
|
||||
try {
|
||||
return oldPrompt;
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateCriticalError"));
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class IDPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
@ -229,47 +239,45 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
if(input.equalsIgnoreCase(Lang.get("cmdCancel")) == false){
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
|
||||
String dataString = null;
|
||||
if (input.contains(":")) {
|
||||
String[] splitInput = input.split(":");
|
||||
input = splitInput[0];
|
||||
if (splitInput.length > 1) {
|
||||
dataString = splitInput[1];
|
||||
}
|
||||
}
|
||||
String dataString = null;
|
||||
if (input.contains(":")) {
|
||||
String[] splitInput = input.split(":");
|
||||
input = splitInput[0];
|
||||
if (splitInput.length > 1) {
|
||||
dataString = splitInput[1];
|
||||
}
|
||||
}
|
||||
|
||||
Material mat = ItemData.getMaterial(input);
|
||||
if(mat == null){
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidID"));
|
||||
return new IDPrompt();
|
||||
} else {
|
||||
Material mat = ItemData.getMaterial(input);
|
||||
if (mat == null) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidID"));
|
||||
return new IDPrompt();
|
||||
} else {
|
||||
|
||||
cc.setSessionData("tempId", mat.getId());
|
||||
cc.setSessionData("tempAmount", 1);
|
||||
cc.setSessionData("tempId", mat.getId());
|
||||
cc.setSessionData("tempAmount", 1);
|
||||
|
||||
if (dataString != null) {
|
||||
try {
|
||||
short data = Short.parseShort(dataString);
|
||||
cc.setSessionData("tempData", data);
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidData"));
|
||||
return new IDPrompt();
|
||||
}
|
||||
}
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
if (dataString != null) {
|
||||
try {
|
||||
short data = Short.parseShort(dataString);
|
||||
cc.setSessionData("tempData", data);
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidData"));
|
||||
return new IDPrompt();
|
||||
}
|
||||
}
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private class AmountPrompt extends StringPrompt {
|
||||
@ -281,25 +289,25 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
if(input.equalsIgnoreCase(Lang.get("cmdCancel")) == false){
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
|
||||
try{
|
||||
try {
|
||||
|
||||
int amt = Integer.parseInt(input);
|
||||
if(amt < 1 || amt > 64){
|
||||
if (amt < 1 || amt > 64) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidAmount"));
|
||||
return new AmountPrompt();
|
||||
}else{
|
||||
} else {
|
||||
cc.setSessionData("tempAmount", Integer.parseInt(input));
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}catch(NumberFormatException e){
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new AmountPrompt();
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
|
||||
@ -317,25 +325,25 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
if(input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false){
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
|
||||
try{
|
||||
try {
|
||||
|
||||
int amt = Integer.parseInt(input);
|
||||
if(amt < 1){
|
||||
if (amt < 1) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidData"));
|
||||
return new DataPrompt();
|
||||
}else{
|
||||
} else {
|
||||
cc.setSessionData("tempData", Short.parseShort(input));
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}catch(NumberFormatException e){
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidInput"));
|
||||
return new DataPrompt();
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase(Lang.get("cmdClear"))){
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
|
||||
cc.setSessionData("tempData", null);
|
||||
|
||||
@ -360,7 +368,6 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
}
|
||||
text = text.substring(0, text.length() - 1);
|
||||
|
||||
|
||||
return text + "\n" + YELLOW + Lang.get("itemCreateEnterEnch");
|
||||
|
||||
}
|
||||
@ -368,23 +375,24 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
|
||||
if(input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false){
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
|
||||
Enchantment e = Quests.getEnchantment(input);
|
||||
if(e != null){
|
||||
if (e != null) {
|
||||
|
||||
cc.setSessionData("tempEnchant", e);
|
||||
return new LevelPrompt(Quester.prettyEnchantmentString(e));
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidEnch"));
|
||||
return new EnchantmentPrompt();
|
||||
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase(Lang.get("cmdClear")))
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
cc.setSessionData("tempEnchantments", null);
|
||||
}
|
||||
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
@ -393,7 +401,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
final String enchantment;
|
||||
|
||||
protected LevelPrompt(String ench){
|
||||
protected LevelPrompt(String ench) {
|
||||
enchantment = ench;
|
||||
}
|
||||
|
||||
@ -407,31 +415,31 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
|
||||
try{
|
||||
try {
|
||||
|
||||
int num = Integer.parseInt(input);
|
||||
if(num < 1){
|
||||
if (num < 1) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidLevel"));
|
||||
return new LevelPrompt(enchantment);
|
||||
}else{
|
||||
} else {
|
||||
|
||||
if(cc.getSessionData("tempEnchantments") != null){
|
||||
if (cc.getSessionData("tempEnchantments") != null) {
|
||||
|
||||
Map<Enchantment, Integer> enchs = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
|
||||
enchs.put((Enchantment)cc.getSessionData("tempEnchant"), num);
|
||||
enchs.put((Enchantment) cc.getSessionData("tempEnchant"), num);
|
||||
cc.setSessionData("tempEnchantments", enchs);
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
Map<Enchantment, Integer> enchs = new HashMap<Enchantment, Integer>();
|
||||
enchs.put((Enchantment)cc.getSessionData("tempEnchant"), num);
|
||||
enchs.put((Enchantment) cc.getSessionData("tempEnchant"), num);
|
||||
cc.setSessionData("tempEnchantments", enchs);
|
||||
|
||||
}
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}catch (NumberFormatException e){
|
||||
} catch (NumberFormatException e) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNotNumber"));
|
||||
e.printStackTrace();
|
||||
return new LevelPrompt(enchantment);
|
||||
@ -439,8 +447,6 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -454,13 +460,13 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
if(input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false){
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
|
||||
input = Quests.parseString(input);
|
||||
|
||||
input = Quests.parseString(input);
|
||||
|
||||
cc.setSessionData("tempName", input);
|
||||
|
||||
}else if(input.equalsIgnoreCase(Lang.get("cmdClear"))){
|
||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
|
||||
cc.setSessionData("tempName", null);
|
||||
|
||||
@ -481,15 +487,15 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
if(input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false){
|
||||
|
||||
input = Quests.parseString(input);
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
|
||||
input = Quests.parseString(input);
|
||||
|
||||
LinkedList<String> lore = new LinkedList<String>();
|
||||
lore.addAll(Arrays.asList(input.split(";")));
|
||||
cc.setSessionData("tempLore", lore);
|
||||
|
||||
}else if(input.equalsIgnoreCase("clear")){
|
||||
} else if (input.equalsIgnoreCase("clear")) {
|
||||
|
||||
cc.setSessionData("tempLore", null);
|
||||
|
||||
@ -501,45 +507,45 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
}
|
||||
|
||||
private String getItemData(ConversationContext cc) {
|
||||
|
||||
|
||||
|
||||
private String getItemData(ConversationContext cc){
|
||||
|
||||
if(cc.getSessionData("tempId") != null){
|
||||
if (cc.getSessionData("tempId") != null) {
|
||||
|
||||
String item;
|
||||
|
||||
if(cc.getSessionData("tempName") == null){
|
||||
if (cc.getSessionData("tempName") == null) {
|
||||
|
||||
Integer id = (Integer) cc.getSessionData("tempId");
|
||||
item = AQUA + Quester.prettyItemString(id);
|
||||
|
||||
if(cc.getSessionData("tempData") != null)
|
||||
if (cc.getSessionData("tempData") != null) {
|
||||
item += ":" + BLUE + (Short) cc.getSessionData("tempData");
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
|
||||
item = PINK + "" + ITALIC + (String) cc.getSessionData("tempName") + RESET + "" + GRAY + " (";
|
||||
Integer id = (Integer) cc.getSessionData("tempId");
|
||||
item += AQUA + Quester.prettyItemString(id);
|
||||
if(cc.getSessionData("tempData") != null)
|
||||
if (cc.getSessionData("tempData") != null) {
|
||||
item += ":" + BLUE + (Short) cc.getSessionData("tempData");
|
||||
}
|
||||
item += GRAY + ")";
|
||||
|
||||
}
|
||||
|
||||
if(cc.getSessionData("tempAmount") != null)
|
||||
if (cc.getSessionData("tempAmount") != null) {
|
||||
item += GRAY + " x " + DARKAQUA + (Integer) cc.getSessionData("tempAmount");
|
||||
else
|
||||
} else {
|
||||
item += GRAY + " x " + DARKAQUA + "1";
|
||||
}
|
||||
|
||||
item += "\n";
|
||||
|
||||
if(cc.getSessionData("tempEnchantments") != null){
|
||||
if (cc.getSessionData("tempEnchantments") != null) {
|
||||
|
||||
Map<Enchantment, Integer> enchantments = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
|
||||
for(Entry<Enchantment, Integer> e : enchantments.entrySet()){
|
||||
for (Entry<Enchantment, Integer> e : enchantments.entrySet()) {
|
||||
|
||||
item += GRAY + " - " + RED + Quester.prettyEnchantmentString(e.getKey()) + " " + Quests.getNumeral(e.getValue()) + "\n";
|
||||
|
||||
@ -547,27 +553,27 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
}
|
||||
|
||||
if(cc.getSessionData("tempLore") != null){
|
||||
if (cc.getSessionData("tempLore") != null) {
|
||||
|
||||
List<String> lore = (List<String>) cc.getSessionData("tempLore");
|
||||
|
||||
item += DARKGREEN + "(Lore)\n\"";
|
||||
for(String s : lore){
|
||||
for (String s : lore) {
|
||||
|
||||
if(lore.indexOf(s) != (lore.size() - 1))
|
||||
if (lore.indexOf(s) != (lore.size() - 1)) {
|
||||
item += DARKGREEN + "" + ITALIC + s + "\n";
|
||||
else
|
||||
} else {
|
||||
item += DARKGREEN + "" + ITALIC + s + "\"\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
item += "\n";
|
||||
return item;
|
||||
|
||||
}else{
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
|
||||
LinkedList<Quest> quests;
|
||||
|
||||
public QuestAcceptPrompt(Quests plugin) {
|
||||
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@ -71,34 +70,36 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
|
||||
Quest q = null;
|
||||
|
||||
for (Quest quest : quests) {
|
||||
|
||||
|
||||
if (quest.getName().equalsIgnoreCase(input)) {
|
||||
q = quest;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (q == null)
|
||||
for (Quest quest : quests) {
|
||||
|
||||
if (numInput == (quests.indexOf(quest) + 1)) {
|
||||
q = quest;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (q == null)
|
||||
for (Quest quest : quests) {
|
||||
|
||||
if (StringUtils.containsIgnoreCase(quest.getName(), input)) {
|
||||
q = quest;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (q == null) {
|
||||
for (Quest quest : quests) {
|
||||
|
||||
if (numInput == (quests.indexOf(quest) + 1)) {
|
||||
q = quest;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (q == null) {
|
||||
for (Quest quest : quests) {
|
||||
|
||||
if (StringUtils.containsIgnoreCase(quest.getName(), input)) {
|
||||
q = quest;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (q == null) {
|
||||
cc.getForWhom().sendRawMessage(RED + Lang.get("invalidSelection"));
|
||||
return new QuestAcceptPrompt(plugin);
|
||||
@ -108,25 +109,25 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
|
||||
|
||||
if (!quester.completedQuests.contains(q.name)) {
|
||||
|
||||
if (quester.currentQuest == null) {
|
||||
if (quester.currentQuests.size() < Quests.maxQuests || Quests.maxQuests < 1) {
|
||||
|
||||
if(q.testRequirements(quester)){
|
||||
if (q.testRequirements(quester)) {
|
||||
|
||||
quester.questToTake = q.name;
|
||||
|
||||
String s = extracted(quester);
|
||||
|
||||
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
|
||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||
|
||||
}else{
|
||||
} else {
|
||||
player.sendMessage(q.failRequirements);
|
||||
}
|
||||
|
||||
} else if (quester.currentQuest.equals(q) == false) {
|
||||
} else if (quester.currentQuests.containsKey(q) == false) {
|
||||
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
|
||||
@ -136,7 +137,7 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
|
||||
|
||||
} else if (quester.completedQuests.contains(q.name)) {
|
||||
|
||||
if (quester.currentQuest == null) {
|
||||
if (quester.currentQuests.size() < Quests.maxQuests || Quests.maxQuests < 1) {
|
||||
|
||||
if (quester.getDifference(q) > 0) {
|
||||
String early = Lang.get("questTooEarly");
|
||||
@ -152,13 +153,13 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
|
||||
String s = extracted(quester);
|
||||
|
||||
for (String msg : s.split("<br>")) {
|
||||
player.sendMessage(msg);
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||
}
|
||||
|
||||
} else if (quester.currentQuest.equals(q) == false) {
|
||||
} else if (quester.currentQuests.containsKey(q) == false) {
|
||||
|
||||
String msg = Lang.get("questMaxAllowed");
|
||||
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
|
||||
@ -172,7 +173,6 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
if (context.getSessionData(CK.REQ_MCMMO_SKILLS) == null) {
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("reqSetMcMMO") + " " + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("reqSetMcMMO") + "\n";
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("reqSetMcMMO") + "\n";
|
||||
List<String> skills = (List<String>) context.getSessionData(CK.REQ_MCMMO_SKILLS);
|
||||
List<Integer> amounts = (List<Integer>) context.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS);
|
||||
|
||||
@ -145,10 +145,10 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "9 - " + RESET + ITALIC + PURPLE + Lang.get("reqSetCustom") + "\n";
|
||||
LinkedList<String> customReqs = (LinkedList<String>) context.getSessionData(CK.REQ_CUSTOM);
|
||||
for(String s : customReqs){
|
||||
|
||||
for (String s : customReqs) {
|
||||
|
||||
text += RESET + "" + PURPLE + " - " + PINK + s + "\n";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -552,19 +552,20 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class CustomRequirementsPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = PINK + Lang.get("customRequirementsTitle") + "\n";
|
||||
if(quests.customRequirements.isEmpty()){
|
||||
if (quests.customRequirements.isEmpty()) {
|
||||
text += BOLD + "" + PURPLE + "(" + Lang.get("stageEditorNoModules") + ")";
|
||||
}else {
|
||||
for(CustomRequirement cr : quests.customRequirements)
|
||||
} else {
|
||||
for (CustomRequirement cr : quests.customRequirements) {
|
||||
text += PURPLE + " - " + cr.getName() + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return text + YELLOW + Lang.get("reqCustomPrompt");
|
||||
}
|
||||
|
||||
@ -574,37 +575,37 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
|
||||
CustomRequirement found = null;
|
||||
for(CustomRequirement cr : quests.customRequirements){
|
||||
if(cr.getName().equalsIgnoreCase(input)){
|
||||
for (CustomRequirement cr : quests.customRequirements) {
|
||||
if (cr.getName().equalsIgnoreCase(input)) {
|
||||
found = cr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(found == null){
|
||||
for(CustomRequirement cr : quests.customRequirements){
|
||||
if(cr.getName().toLowerCase().contains(input.toLowerCase())){
|
||||
|
||||
if (found == null) {
|
||||
for (CustomRequirement cr : quests.customRequirements) {
|
||||
if (cr.getName().toLowerCase().contains(input.toLowerCase())) {
|
||||
found = cr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(found != null){
|
||||
|
||||
if(context.getSessionData(CK.REQ_CUSTOM) != null){
|
||||
|
||||
if (found != null) {
|
||||
|
||||
if (context.getSessionData(CK.REQ_CUSTOM) != null) {
|
||||
LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.REQ_CUSTOM);
|
||||
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
|
||||
if(list.contains(found.getName()) == false){
|
||||
if (list.contains(found.getName()) == false) {
|
||||
list.add(found.getName());
|
||||
datamapList.add(found.datamap);
|
||||
context.setSessionData(CK.REQ_CUSTOM, list);
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA, datamapList);
|
||||
}else{
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(YELLOW + Lang.get("reqCustomAlreadyAdded"));
|
||||
return new CustomRequirementsPrompt();
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
LinkedList<Map<String, Object>> datamapList = new LinkedList<Map<String, Object>>();
|
||||
datamapList.add(found.datamap);
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
@ -612,17 +613,17 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
context.setSessionData(CK.REQ_CUSTOM, list);
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA, datamapList);
|
||||
}
|
||||
|
||||
|
||||
//Send user to the custom data prompt if there is any needed
|
||||
if(found.datamap.isEmpty() == false){
|
||||
|
||||
if (found.datamap.isEmpty() == false) {
|
||||
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA_DESCRIPTIONS, found.descriptions);
|
||||
return new RequirementCustomDataListPrompt();
|
||||
|
||||
|
||||
}
|
||||
//
|
||||
|
||||
}else{
|
||||
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(YELLOW + Lang.get("reqCustomNotFound"));
|
||||
return new CustomRequirementsPrompt();
|
||||
}
|
||||
@ -638,98 +639,103 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class RequirementCustomDataListPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
|
||||
|
||||
String text = BOLD + "" + AQUA + "- ";
|
||||
|
||||
|
||||
LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.REQ_CUSTOM);
|
||||
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
|
||||
|
||||
|
||||
String reqName = list.getLast();
|
||||
Map<String, Object> datamap = datamapList.getLast();
|
||||
|
||||
|
||||
text += reqName + " -\n";
|
||||
int index = 1;
|
||||
|
||||
|
||||
LinkedList<String> datamapKeys = new LinkedList<String>();
|
||||
for(String key : datamap.keySet())
|
||||
for (String key : datamap.keySet()) {
|
||||
datamapKeys.add(key);
|
||||
Collections.sort(datamapKeys);
|
||||
|
||||
for(String dataKey : datamapKeys){
|
||||
|
||||
text += BOLD + "" + DARKBLUE + index + " - " + RESET + BLUE + dataKey;
|
||||
if(datamap.get(dataKey) != null)
|
||||
text += GREEN + " (" + (String) datamap.get(dataKey) + ")\n";
|
||||
else
|
||||
text += RED + " (" + Lang.get("valRequired") + ")\n";
|
||||
|
||||
index++;
|
||||
|
||||
}
|
||||
|
||||
Collections.sort(datamapKeys);
|
||||
|
||||
for (String dataKey : datamapKeys) {
|
||||
|
||||
text += BOLD + "" + DARKBLUE + index + " - " + RESET + BLUE + dataKey;
|
||||
if (datamap.get(dataKey) != null) {
|
||||
text += GREEN + " (" + (String) datamap.get(dataKey) + ")\n";
|
||||
} else {
|
||||
text += RED + " (" + Lang.get("valRequired") + ")\n";
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
}
|
||||
|
||||
text += BOLD + "" + DARKBLUE + index + " - " + AQUA + Lang.get("finish");
|
||||
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
|
||||
|
||||
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
|
||||
Map<String, Object> datamap = datamapList.getLast();
|
||||
|
||||
|
||||
int numInput;
|
||||
|
||||
try{
|
||||
|
||||
try {
|
||||
numInput = Integer.parseInt(input);
|
||||
}catch(NumberFormatException nfe){
|
||||
} catch (NumberFormatException nfe) {
|
||||
return new RequirementCustomDataListPrompt();
|
||||
}
|
||||
|
||||
if(numInput < 1 || numInput > datamap.size() + 1)
|
||||
|
||||
if (numInput < 1 || numInput > datamap.size() + 1) {
|
||||
return new RequirementCustomDataListPrompt();
|
||||
|
||||
if(numInput < datamap.size() + 1){
|
||||
|
||||
}
|
||||
|
||||
if (numInput < datamap.size() + 1) {
|
||||
|
||||
LinkedList<String> datamapKeys = new LinkedList<String>();
|
||||
for(String key : datamap.keySet())
|
||||
for (String key : datamap.keySet()) {
|
||||
datamapKeys.add(key);
|
||||
}
|
||||
Collections.sort(datamapKeys);
|
||||
|
||||
String selectedKey = datamapKeys.get(numInput - 1);
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA_TEMP, selectedKey);
|
||||
return new RequirementCustomDataPrompt();
|
||||
|
||||
}else{
|
||||
|
||||
if(datamap.containsValue(null)){
|
||||
|
||||
} else {
|
||||
|
||||
if (datamap.containsValue(null)) {
|
||||
return new RequirementCustomDataListPrompt();
|
||||
}else{
|
||||
} else {
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA_DESCRIPTIONS, null);
|
||||
return new RequirementsPrompt(quests, factory);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class RequirementCustomDataPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = "";
|
||||
String temp = (String)context.getSessionData(CK.REQ_CUSTOM_DATA_TEMP);
|
||||
String temp = (String) context.getSessionData(CK.REQ_CUSTOM_DATA_TEMP);
|
||||
Map<String, String> descriptions = (Map<String, String>) context.getSessionData(CK.REQ_CUSTOM_DATA_DESCRIPTIONS);
|
||||
if(descriptions.get(temp) != null)
|
||||
if (descriptions.get(temp) != null) {
|
||||
text += GOLD + descriptions.get(temp) + "\n";
|
||||
|
||||
}
|
||||
|
||||
String lang = Lang.get("stageEditorCustomDataPrompt");
|
||||
lang = lang.replaceAll("<data>", temp);
|
||||
text += YELLOW + lang;
|
||||
@ -740,13 +746,13 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REQ_CUSTOM_DATA);
|
||||
Map<String, Object> datamap = datamapList.getLast();
|
||||
datamap.put((String)context.getSessionData(CK.REQ_CUSTOM_DATA_TEMP), input);
|
||||
datamap.put((String) context.getSessionData(CK.REQ_CUSTOM_DATA_TEMP), input);
|
||||
context.setSessionData(CK.REQ_CUSTOM_DATA_TEMP, null);
|
||||
return new RequirementCustomDataListPrompt();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class mcMMOPrompt extends FixedSetPrompt {
|
||||
|
||||
public mcMMOPrompt() {
|
||||
@ -802,16 +808,17 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
|
||||
|
||||
String skillList = DARKGREEN + Lang.get("skillListTitle") + "\n";
|
||||
SkillType[] skills = SkillType.values();
|
||||
for(int i = 0; i < skills.length; i++) {
|
||||
|
||||
if(i == (skills.length - 1))
|
||||
for (int i = 0; i < skills.length; i++) {
|
||||
|
||||
if (i == (skills.length - 1)) {
|
||||
skillList += GREEN + skills[i].getName() + "\n";
|
||||
else
|
||||
} else {
|
||||
skillList += GREEN + skills[i].getName() + "\n\n";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return skillList + YELLOW + Lang.get("reqMcMMOPrompt");
|
||||
@ -1064,7 +1071,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
return new HeroesPrompt();
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
String text = Lang.get("reqHeroesNotSecondary");
|
||||
text = text.replaceAll("<class>", PINK + hc.getName() + RED);
|
||||
cc.getForWhom().sendRawMessage(RED + text);
|
||||
|
@ -135,7 +135,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
} else {
|
||||
|
||||
text += GRAY + "8 - " + Lang.get("rewSetHeroes") + " (" + Lang.get("rewNoHeroes") + ")\n";
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (Quests.phatLoots != null) {
|
||||
@ -158,16 +158,16 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
text += GRAY + "9 - " + Lang.get("rewSetPhat") + " (" + Lang.get("rewNoPhat") + ")\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (context.getSessionData(CK.REW_CUSTOM) == null) {
|
||||
text += BLUE + "" + BOLD + "10 - " + RESET + ITALIC + PURPLE + Lang.get("rewSetCustom") + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "10 - " + RESET + ITALIC + PURPLE + Lang.get("rewSetCustom") + "\n";
|
||||
LinkedList<String> customRews = (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM);
|
||||
for(String s : customRews){
|
||||
|
||||
for (String s : customRews) {
|
||||
|
||||
text += RESET + "" + PURPLE + " - " + PINK + s + "\n";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,9 +210,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
} else {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
}
|
||||
}else if(input.equalsIgnoreCase("10")){
|
||||
} else if (input.equalsIgnoreCase("10")) {
|
||||
return new CustomRewardsPrompt();
|
||||
}else if (input.equalsIgnoreCase("11")) {
|
||||
} else if (input.equalsIgnoreCase("11")) {
|
||||
return factory.returnToMenu();
|
||||
}
|
||||
return null;
|
||||
@ -550,16 +550,17 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
|
||||
|
||||
String skillList = DARKGREEN + Lang.get("skillListTitle") + "\n";
|
||||
SkillType[] skills = SkillType.values();
|
||||
for(int i = 0; i < skills.length; i++) {
|
||||
|
||||
if(i == (skills.length - 1))
|
||||
for (int i = 0; i < skills.length; i++) {
|
||||
|
||||
if (i == (skills.length - 1)) {
|
||||
skillList += GREEN + skills[i].getName() + "\n";
|
||||
else
|
||||
} else {
|
||||
skillList += GREEN + skills[i].getName() + "\n\n";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return skillList + Lang.get("rewMcMMOPrompt") + "\n" + GOLD + Lang.get("rewMcMMOPromptHint");
|
||||
@ -619,9 +620,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
for (String s : args) {
|
||||
|
||||
try {
|
||||
|
||||
|
||||
amounts.add(Integer.parseInt(s));
|
||||
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
String text = Lang.get("reqNotANumber");
|
||||
text = text.replaceAll("<input>", PINK + s + RED);
|
||||
@ -906,19 +907,20 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class CustomRewardsPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = PINK + Lang.get("customRewardsTitle") + "\n";
|
||||
if(quests.customRewards.isEmpty()){
|
||||
if (quests.customRewards.isEmpty()) {
|
||||
text += BOLD + "" + PURPLE + "(" + Lang.get("stageEditorNoModules") + ")";
|
||||
}else {
|
||||
for(CustomReward cr : quests.customRewards)
|
||||
} else {
|
||||
for (CustomReward cr : quests.customRewards) {
|
||||
text += PURPLE + " - " + cr.getName() + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return text + YELLOW + Lang.get("rewCustomRewardPrompt");
|
||||
}
|
||||
|
||||
@ -928,37 +930,37 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||
|
||||
CustomReward found = null;
|
||||
for(CustomReward cr : quests.customRewards){
|
||||
if(cr.getName().equalsIgnoreCase(input)){
|
||||
for (CustomReward cr : quests.customRewards) {
|
||||
if (cr.getName().equalsIgnoreCase(input)) {
|
||||
found = cr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(found == null){
|
||||
for(CustomReward cr : quests.customRewards){
|
||||
if(cr.getName().toLowerCase().contains(input.toLowerCase())){
|
||||
|
||||
if (found == null) {
|
||||
for (CustomReward cr : quests.customRewards) {
|
||||
if (cr.getName().toLowerCase().contains(input.toLowerCase())) {
|
||||
found = cr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(found != null){
|
||||
|
||||
if(context.getSessionData(CK.REW_CUSTOM) != null){
|
||||
|
||||
if (found != null) {
|
||||
|
||||
if (context.getSessionData(CK.REW_CUSTOM) != null) {
|
||||
LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM);
|
||||
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
|
||||
if(list.contains(found.getName()) == false){
|
||||
if (list.contains(found.getName()) == false) {
|
||||
list.add(found.getName());
|
||||
datamapList.add(found.datamap);
|
||||
context.setSessionData(CK.REW_CUSTOM, list);
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA, datamapList);
|
||||
}else{
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(YELLOW + Lang.get("rewCustomAlreadyAdded"));
|
||||
return new CustomRewardsPrompt();
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
LinkedList<Map<String, Object>> datamapList = new LinkedList<Map<String, Object>>();
|
||||
datamapList.add(found.datamap);
|
||||
LinkedList<String> list = new LinkedList<String>();
|
||||
@ -966,17 +968,17 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
context.setSessionData(CK.REW_CUSTOM, list);
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA, datamapList);
|
||||
}
|
||||
|
||||
|
||||
//Send user to the custom data prompt if there is any needed
|
||||
if(found.datamap.isEmpty() == false){
|
||||
|
||||
if (found.datamap.isEmpty() == false) {
|
||||
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA_DESCRIPTIONS, found.descriptions);
|
||||
return new RewardCustomDataListPrompt();
|
||||
|
||||
|
||||
}
|
||||
//
|
||||
|
||||
}else{
|
||||
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(YELLOW + Lang.get("rewCustomNotFound"));
|
||||
return new CustomRewardsPrompt();
|
||||
}
|
||||
@ -992,98 +994,103 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class RewardCustomDataListPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
|
||||
|
||||
String text = BOLD + "" + AQUA + "- ";
|
||||
|
||||
|
||||
LinkedList<String> list = (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM);
|
||||
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
|
||||
|
||||
|
||||
String rewName = list.getLast();
|
||||
Map<String, Object> datamap = datamapList.getLast();
|
||||
|
||||
|
||||
text += rewName + " -\n";
|
||||
int index = 1;
|
||||
|
||||
|
||||
LinkedList<String> datamapKeys = new LinkedList<String>();
|
||||
for(String key : datamap.keySet())
|
||||
for (String key : datamap.keySet()) {
|
||||
datamapKeys.add(key);
|
||||
Collections.sort(datamapKeys);
|
||||
|
||||
for(String dataKey : datamapKeys){
|
||||
|
||||
text += BOLD + "" + DARKBLUE + index + " - " + RESET + BLUE + dataKey;
|
||||
if(datamap.get(dataKey) != null)
|
||||
text += GREEN + " (" + (String) datamap.get(dataKey) + ")\n";
|
||||
else
|
||||
text += RED + " (" + Lang.get("valRequired") + ")\n";
|
||||
|
||||
index++;
|
||||
|
||||
}
|
||||
|
||||
Collections.sort(datamapKeys);
|
||||
|
||||
for (String dataKey : datamapKeys) {
|
||||
|
||||
text += BOLD + "" + DARKBLUE + index + " - " + RESET + BLUE + dataKey;
|
||||
if (datamap.get(dataKey) != null) {
|
||||
text += GREEN + " (" + (String) datamap.get(dataKey) + ")\n";
|
||||
} else {
|
||||
text += RED + " (" + Lang.get("valRequired") + ")\n";
|
||||
}
|
||||
|
||||
index++;
|
||||
|
||||
}
|
||||
|
||||
text += BOLD + "" + DARKBLUE + index + " - " + AQUA + Lang.get("finish");
|
||||
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
|
||||
|
||||
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
|
||||
Map<String, Object> datamap = datamapList.getLast();
|
||||
|
||||
|
||||
int numInput;
|
||||
|
||||
try{
|
||||
|
||||
try {
|
||||
numInput = Integer.parseInt(input);
|
||||
}catch(NumberFormatException nfe){
|
||||
} catch (NumberFormatException nfe) {
|
||||
return new RewardCustomDataListPrompt();
|
||||
}
|
||||
|
||||
if(numInput < 1 || numInput > datamap.size() + 1)
|
||||
|
||||
if (numInput < 1 || numInput > datamap.size() + 1) {
|
||||
return new RewardCustomDataListPrompt();
|
||||
|
||||
if(numInput < datamap.size() + 1){
|
||||
|
||||
}
|
||||
|
||||
if (numInput < datamap.size() + 1) {
|
||||
|
||||
LinkedList<String> datamapKeys = new LinkedList<String>();
|
||||
for(String key : datamap.keySet())
|
||||
for (String key : datamap.keySet()) {
|
||||
datamapKeys.add(key);
|
||||
}
|
||||
Collections.sort(datamapKeys);
|
||||
|
||||
String selectedKey = datamapKeys.get(numInput - 1);
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA_TEMP, selectedKey);
|
||||
return new RewardCustomDataPrompt();
|
||||
|
||||
}else{
|
||||
|
||||
if(datamap.containsValue(null)){
|
||||
|
||||
} else {
|
||||
|
||||
if (datamap.containsValue(null)) {
|
||||
return new RewardCustomDataListPrompt();
|
||||
}else{
|
||||
} else {
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA_DESCRIPTIONS, null);
|
||||
return new RewardsPrompt(quests, factory);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class RewardCustomDataPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
String text = "";
|
||||
String temp = (String)context.getSessionData(CK.REW_CUSTOM_DATA_TEMP);
|
||||
String temp = (String) context.getSessionData(CK.REW_CUSTOM_DATA_TEMP);
|
||||
Map<String, String> descriptions = (Map<String, String>) context.getSessionData(CK.REW_CUSTOM_DATA_DESCRIPTIONS);
|
||||
if(descriptions.get(temp) != null)
|
||||
if (descriptions.get(temp) != null) {
|
||||
text += GOLD + descriptions.get(temp) + "\n";
|
||||
|
||||
}
|
||||
|
||||
String lang = Lang.get("stageEditorCustomDataPrompt");
|
||||
lang = lang.replaceAll("<data>", temp);
|
||||
text += YELLOW + lang;
|
||||
@ -1094,11 +1101,11 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
LinkedList<Map<String, Object>> datamapList = (LinkedList<Map<String, Object>>) context.getSessionData(CK.REW_CUSTOM_DATA);
|
||||
Map<String, Object> datamap = datamapList.getLast();
|
||||
datamap.put((String)context.getSessionData(CK.REW_CUSTOM_DATA_TEMP), input);
|
||||
datamap.put((String) context.getSessionData(CK.REW_CUSTOM_DATA_TEMP), input);
|
||||
context.setSessionData(CK.REW_CUSTOM_DATA_TEMP, null);
|
||||
return new RewardCustomDataListPrompt();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,11 +9,11 @@ import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
|
||||
public class StagesPrompt extends StringPrompt implements ColorUtil{
|
||||
public class StagesPrompt extends StringPrompt implements ColorUtil {
|
||||
|
||||
private final QuestFactory questFactory;
|
||||
|
||||
public StagesPrompt(QuestFactory qf){
|
||||
public StagesPrompt(QuestFactory qf) {
|
||||
|
||||
questFactory = qf;
|
||||
|
||||
@ -26,7 +26,7 @@ public class StagesPrompt extends StringPrompt implements ColorUtil{
|
||||
|
||||
int stages = getStages(cc);
|
||||
|
||||
for(int i = 1; i <= stages; i++){
|
||||
for (int i = 1; i <= stages; i++) {
|
||||
|
||||
text += BOLD + "" + GREEN + i + ". " + RESET + GOLD + Lang.get("stageEditorEditStage") + " " + i + "\n";
|
||||
|
||||
@ -45,39 +45,41 @@ public class StagesPrompt extends StringPrompt implements ColorUtil{
|
||||
|
||||
int i;
|
||||
|
||||
try{
|
||||
try {
|
||||
|
||||
i = Integer.parseInt(string);
|
||||
|
||||
}catch(NumberFormatException e){
|
||||
} catch (NumberFormatException e) {
|
||||
return new StagesPrompt(questFactory);
|
||||
}
|
||||
|
||||
int stages = getStages(cc);
|
||||
|
||||
if(i < 0)
|
||||
if (i < 0) {
|
||||
return new StagesPrompt(questFactory);
|
||||
else if(i < (stages + 1) && i > 0)
|
||||
} else if (i < (stages + 1) && i > 0) {
|
||||
return new CreateStagePrompt((i), questFactory, questFactory.quests.citizens);
|
||||
else if(i == (stages + 1))
|
||||
} else if (i == (stages + 1)) {
|
||||
return new CreateStagePrompt((stages + 1), questFactory, questFactory.quests.citizens);
|
||||
else if(i == (stages + 2))
|
||||
} else if (i == (stages + 2)) {
|
||||
return questFactory.returnToMenu();
|
||||
else
|
||||
} else {
|
||||
return new StagesPrompt(questFactory);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int getStages(ConversationContext cc){
|
||||
public static int getStages(ConversationContext cc) {
|
||||
|
||||
int num = 1;
|
||||
|
||||
while(true){
|
||||
while (true) {
|
||||
|
||||
if(cc.getSessionData("stage" + num) != null)
|
||||
if (cc.getSessionData("stage" + num) != null) {
|
||||
num++;
|
||||
else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -85,7 +87,7 @@ public class StagesPrompt extends StringPrompt implements ColorUtil{
|
||||
|
||||
}
|
||||
|
||||
public static void deleteStage(ConversationContext cc, int stageNum){
|
||||
public static void deleteStage(ConversationContext cc, int stageNum) {
|
||||
|
||||
int stages = getStages(cc);
|
||||
int current = stageNum;
|
||||
@ -93,17 +95,19 @@ public class StagesPrompt extends StringPrompt implements ColorUtil{
|
||||
String newPref;
|
||||
boolean last = false;
|
||||
|
||||
if(stageNum == stages)
|
||||
if (stageNum == stages) {
|
||||
last = true;
|
||||
}
|
||||
|
||||
while(true){
|
||||
while (true) {
|
||||
|
||||
if(!last){
|
||||
if (!last) {
|
||||
|
||||
current++;
|
||||
|
||||
if(current > stages)
|
||||
if (current > stages) {
|
||||
break;
|
||||
}
|
||||
|
||||
pref = "stage" + current;
|
||||
newPref = "stage" + (current - 1);
|
||||
@ -168,12 +172,12 @@ public class StagesPrompt extends StringPrompt implements ColorUtil{
|
||||
cc.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_COUNT, cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT));
|
||||
cc.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS));
|
||||
cc.setSessionData(newPref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, cc.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP));
|
||||
|
||||
|
||||
cc.setSessionData(newPref + CK.S_PASSWORD_DISPLAYS, cc.getSessionData(pref + CK.S_PASSWORD_DISPLAYS));
|
||||
cc.setSessionData(newPref + CK.S_PASSWORD_PHRASES, cc.getSessionData(pref + CK.S_PASSWORD_PHRASES));
|
||||
|
||||
|
||||
cc.setSessionData(newPref + CK.S_OVERRIDE_DISPLAY, cc.getSessionData(pref + CK.S_OVERRIDE_DISPLAY));
|
||||
|
||||
|
||||
cc.setSessionData(newPref + CK.S_DELAY, cc.getSessionData(pref + CK.S_DELAY));
|
||||
cc.setSessionData(newPref + CK.S_DELAY_MESSAGE, cc.getSessionData(pref + CK.S_DELAY_MESSAGE));
|
||||
|
||||
@ -184,7 +188,6 @@ public class StagesPrompt extends StringPrompt implements ColorUtil{
|
||||
|
||||
}
|
||||
|
||||
|
||||
cc.setSessionData(pref + CK.S_BREAK_IDS, null);
|
||||
cc.setSessionData(pref + CK.S_BREAK_AMOUNTS, null);
|
||||
|
||||
@ -245,12 +248,12 @@ public class StagesPrompt extends StringPrompt implements ColorUtil{
|
||||
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_COUNT, null);
|
||||
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS, null);
|
||||
cc.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, null);
|
||||
|
||||
|
||||
cc.setSessionData(pref + CK.S_PASSWORD_DISPLAYS, null);
|
||||
cc.setSessionData(pref + CK.S_PASSWORD_PHRASES, null);
|
||||
|
||||
cc.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, null);
|
||||
|
||||
|
||||
cc.setSessionData(pref + CK.S_DELAY, null);
|
||||
cc.setSessionData(pref + CK.S_DELAY_MESSAGE, null);
|
||||
|
||||
@ -259,17 +262,18 @@ public class StagesPrompt extends StringPrompt implements ColorUtil{
|
||||
cc.setSessionData(pref + CK.S_COMPLETE_MESSAGE, null);
|
||||
cc.setSessionData(pref + CK.S_START_MESSAGE, null);
|
||||
|
||||
if(last)
|
||||
if (last) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!last)
|
||||
if (!last) {
|
||||
cc.setSessionData("stage" + (current - 1), null);
|
||||
else
|
||||
} else {
|
||||
cc.setSessionData("stage" + (current), null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,137 +2,137 @@ package me.blackvein.quests.util;
|
||||
|
||||
public class CK {
|
||||
|
||||
public static final String ED_QUEST_EDIT = "edit";
|
||||
public static final String ED_QUEST_DELETE = "delQuest";
|
||||
public static final String ED_EVENT_DELETE = "delEvent";
|
||||
public static final String ED_QUEST_EDIT = "edit";
|
||||
public static final String ED_QUEST_DELETE = "delQuest";
|
||||
public static final String ED_EVENT_DELETE = "delEvent";
|
||||
|
||||
//Quests
|
||||
public static final String Q_NAME = "questName";
|
||||
public static final String Q_ASK_MESSAGE = "askMessage";
|
||||
public static final String Q_FINISH_MESSAGE = "finishMessage";
|
||||
public static final String Q_REDO_DELAY = "redoDelay";
|
||||
public static final String Q_START_NPC = "npcStart";
|
||||
public static final String Q_START_BLOCK= "blockStart";
|
||||
public static final String Q_FAIL_MESSAGE = "failMessage";
|
||||
public static final String Q_INITIAL_EVENT = "initialEvent";
|
||||
public static final String Q_REGION = "region";
|
||||
public static final String Q_GUIDISPLAY = "guiDisplay";
|
||||
//Quests
|
||||
public static final String Q_NAME = "questName";
|
||||
public static final String Q_ASK_MESSAGE = "askMessage";
|
||||
public static final String Q_FINISH_MESSAGE = "finishMessage";
|
||||
public static final String Q_REDO_DELAY = "redoDelay";
|
||||
public static final String Q_START_NPC = "npcStart";
|
||||
public static final String Q_START_BLOCK = "blockStart";
|
||||
public static final String Q_FAIL_MESSAGE = "failMessage";
|
||||
public static final String Q_INITIAL_EVENT = "initialEvent";
|
||||
public static final String Q_REGION = "region";
|
||||
public static final String Q_GUIDISPLAY = "guiDisplay";
|
||||
|
||||
//Requirements
|
||||
public static final String REQ_MONEY = "moneyReq";
|
||||
public static final String REQ_QUEST_POINTS = "questPointsReq";
|
||||
public static final String REQ_ITEMS = "itemReqs";
|
||||
public static final String REQ_ITEMS_REMOVE = "removeItemReqs";
|
||||
public static final String REQ_PERMISSION = "permissionReqs";
|
||||
public static final String REQ_MCMMO_SKILLS = "mcMMOSkillReqs";
|
||||
public static final String REQ_MCMMO_SKILL_AMOUNTS = "mcMMOSkillAmountReqs";
|
||||
public static final String REQ_HEROES_PRIMARY_CLASS = "heroesPrimaryClassReq";
|
||||
public static final String REQ_HEROES_SECONDARY_CLASS = "heroesSecondaryClassReq";
|
||||
public static final String REQ_QUEST = "questReqs";
|
||||
public static final String REQ_QUEST_BLOCK = "questBlocks";
|
||||
public static final String REQ_CUSTOM = "customReqs";
|
||||
public static final String REQ_CUSTOM_DATA = "customReqData";
|
||||
public static final String REQ_CUSTOM_DATA_DESCRIPTIONS = "customReqDataDesc";
|
||||
public static final String REQ_CUSTOM_DATA_TEMP = "customReqDataTemp";
|
||||
//Requirements
|
||||
public static final String REQ_MONEY = "moneyReq";
|
||||
public static final String REQ_QUEST_POINTS = "questPointsReq";
|
||||
public static final String REQ_ITEMS = "itemReqs";
|
||||
public static final String REQ_ITEMS_REMOVE = "removeItemReqs";
|
||||
public static final String REQ_PERMISSION = "permissionReqs";
|
||||
public static final String REQ_MCMMO_SKILLS = "mcMMOSkillReqs";
|
||||
public static final String REQ_MCMMO_SKILL_AMOUNTS = "mcMMOSkillAmountReqs";
|
||||
public static final String REQ_HEROES_PRIMARY_CLASS = "heroesPrimaryClassReq";
|
||||
public static final String REQ_HEROES_SECONDARY_CLASS = "heroesSecondaryClassReq";
|
||||
public static final String REQ_QUEST = "questReqs";
|
||||
public static final String REQ_QUEST_BLOCK = "questBlocks";
|
||||
public static final String REQ_CUSTOM = "customReqs";
|
||||
public static final String REQ_CUSTOM_DATA = "customReqData";
|
||||
public static final String REQ_CUSTOM_DATA_DESCRIPTIONS = "customReqDataDesc";
|
||||
public static final String REQ_CUSTOM_DATA_TEMP = "customReqDataTemp";
|
||||
|
||||
//Rewards
|
||||
public static final String REW_MONEY = "moneyRew";
|
||||
public static final String REW_QUEST_POINTS = "questPointsRew";
|
||||
public static final String REW_ITEMS = "itemRews";
|
||||
public static final String REW_EXP = "expRew";
|
||||
public static final String REW_COMMAND = "commandRews";
|
||||
public static final String REW_PERMISSION = "permissionRews";
|
||||
public static final String REW_MCMMO_SKILLS = "mcMMOSkillRews";
|
||||
public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts";
|
||||
public static final String REW_HEROES_CLASSES = "heroesClassRews";
|
||||
public static final String REW_HEROES_AMOUNTS = "heroesAmountRews";
|
||||
public static final String REW_PHAT_LOOTS = "phatLootRews";
|
||||
public static final String REW_CUSTOM = "customRews";
|
||||
public static final String REW_CUSTOM_DATA = "customRewData";
|
||||
public static final String REW_CUSTOM_DATA_DESCRIPTIONS = "customRewDataDesc";
|
||||
public static final String REW_CUSTOM_DATA_TEMP = "customRewDataTemp";
|
||||
//Stages
|
||||
public static final String S_BREAK_IDS = "breakIds";
|
||||
public static final String S_BREAK_AMOUNTS = "breakAmounts";
|
||||
public static final String S_DAMAGE_IDS = "damageIds";
|
||||
public static final String S_DAMAGE_AMOUNTS = "damageAmounts";
|
||||
public static final String S_PLACE_IDS = "placeIds";
|
||||
public static final String S_PLACE_AMOUNTS = "placeAmounts";
|
||||
public static final String S_USE_IDS = "useIds";
|
||||
public static final String S_USE_AMOUNTS = "useAmounts";
|
||||
public static final String S_CUT_IDS = "cutIds";
|
||||
public static final String S_CUT_AMOUNTS = "cutAmounts";
|
||||
public static final String S_FISH = "fish";
|
||||
public static final String S_PLAYER_KILL = "playerKill";
|
||||
public static final String S_ENCHANT_TYPES = "enchantTypes";
|
||||
public static final String S_ENCHANT_IDS = "enchantIds";
|
||||
public static final String S_ENCHANT_AMOUNTS = "enchantAmounts";
|
||||
public static final String S_DELIVERY_ITEMS = "deliveryItems";
|
||||
public static final String S_DELIVERY_NPCS = "deliveryNPCs";
|
||||
public static final String S_DELIVERY_MESSAGES = "deliveryMessages";
|
||||
public static final String S_NPCS_TO_TALK_TO = "npcIdsToTalkTo";
|
||||
public static final String S_NPCS_TO_KILL = "npcIdsToKill";
|
||||
public static final String S_NPCS_TO_KILL_AMOUNTS = "npcAmountsToKill";
|
||||
public static final String S_MOB_TYPES = "mobTypes";
|
||||
public static final String S_MOB_AMOUNTS = "mobAmounts";
|
||||
public static final String S_MOB_KILL_LOCATIONS = "killLocations";
|
||||
public static final String S_MOB_KILL_LOCATIONS_RADIUS = "killLocationRadii";
|
||||
public static final String S_MOB_KILL_LOCATIONS_NAMES = "killLocationNames";
|
||||
public static final String S_REACH_LOCATIONS = "reachLocations";
|
||||
public static final String S_REACH_LOCATIONS_RADIUS = "reachLocationRadii";
|
||||
public static final String S_REACH_LOCATIONS_NAMES = "reachLocationNames";
|
||||
public static final String S_TAME_TYPES = "tameTypes";
|
||||
public static final String S_TAME_AMOUNTS = "tameAmounts";
|
||||
public static final String S_SHEAR_COLORS = "shearColors";
|
||||
public static final String S_SHEAR_AMOUNTS = "shearAmounts";
|
||||
public static final String S_START_EVENT = "startEvent";
|
||||
public static final String S_FINISH_EVENT = "finishEvent";
|
||||
public static final String S_CHAT_EVENTS = "chatEvents";
|
||||
public static final String S_CHAT_EVENT_TRIGGERS = "chatEventTriggers";
|
||||
public static final String S_CHAT_TEMP_EVENT = "chatTempEvent";
|
||||
public static final String S_DEATH_EVENT = "deathEvent";
|
||||
public static final String S_DISCONNECT_EVENT = "disconnectEvent";
|
||||
public static final String S_DELAY = "delay";
|
||||
public static final String S_DELAY_MESSAGE = "delayMessage";
|
||||
public static final String S_DENIZEN = "denizen";
|
||||
public static final String S_COMPLETE_MESSAGE = "completeMessage";
|
||||
public static final String S_START_MESSAGE = "startMessage";
|
||||
public static final String S_OVERRIDE_DISPLAY = "overrideDisplay";
|
||||
public static final String S_PASSWORD_DISPLAYS = "passwordDisplays";
|
||||
public static final String S_PASSWORD_PHRASES = "passwordPhrases";
|
||||
public static final String S_CUSTOM_OBJECTIVES = "customObjectives";
|
||||
public static final String S_CUSTOM_OBJECTIVES_COUNT = "customObjectiveCounts";
|
||||
public static final String S_CUSTOM_OBJECTIVES_DATA = "customObjectiveData";
|
||||
public static final String S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS = "customObjectiveDataDescriptions";
|
||||
public static final String S_CUSTOM_OBJECTIVES_DATA_TEMP = "customObjectiveDataTemp";
|
||||
//Rewards
|
||||
public static final String REW_MONEY = "moneyRew";
|
||||
public static final String REW_QUEST_POINTS = "questPointsRew";
|
||||
public static final String REW_ITEMS = "itemRews";
|
||||
public static final String REW_EXP = "expRew";
|
||||
public static final String REW_COMMAND = "commandRews";
|
||||
public static final String REW_PERMISSION = "permissionRews";
|
||||
public static final String REW_MCMMO_SKILLS = "mcMMOSkillRews";
|
||||
public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts";
|
||||
public static final String REW_HEROES_CLASSES = "heroesClassRews";
|
||||
public static final String REW_HEROES_AMOUNTS = "heroesAmountRews";
|
||||
public static final String REW_PHAT_LOOTS = "phatLootRews";
|
||||
public static final String REW_CUSTOM = "customRews";
|
||||
public static final String REW_CUSTOM_DATA = "customRewData";
|
||||
public static final String REW_CUSTOM_DATA_DESCRIPTIONS = "customRewDataDesc";
|
||||
public static final String REW_CUSTOM_DATA_TEMP = "customRewDataTemp";
|
||||
//Stages
|
||||
public static final String S_BREAK_IDS = "breakIds";
|
||||
public static final String S_BREAK_AMOUNTS = "breakAmounts";
|
||||
public static final String S_DAMAGE_IDS = "damageIds";
|
||||
public static final String S_DAMAGE_AMOUNTS = "damageAmounts";
|
||||
public static final String S_PLACE_IDS = "placeIds";
|
||||
public static final String S_PLACE_AMOUNTS = "placeAmounts";
|
||||
public static final String S_USE_IDS = "useIds";
|
||||
public static final String S_USE_AMOUNTS = "useAmounts";
|
||||
public static final String S_CUT_IDS = "cutIds";
|
||||
public static final String S_CUT_AMOUNTS = "cutAmounts";
|
||||
public static final String S_FISH = "fish";
|
||||
public static final String S_PLAYER_KILL = "playerKill";
|
||||
public static final String S_ENCHANT_TYPES = "enchantTypes";
|
||||
public static final String S_ENCHANT_IDS = "enchantIds";
|
||||
public static final String S_ENCHANT_AMOUNTS = "enchantAmounts";
|
||||
public static final String S_DELIVERY_ITEMS = "deliveryItems";
|
||||
public static final String S_DELIVERY_NPCS = "deliveryNPCs";
|
||||
public static final String S_DELIVERY_MESSAGES = "deliveryMessages";
|
||||
public static final String S_NPCS_TO_TALK_TO = "npcIdsToTalkTo";
|
||||
public static final String S_NPCS_TO_KILL = "npcIdsToKill";
|
||||
public static final String S_NPCS_TO_KILL_AMOUNTS = "npcAmountsToKill";
|
||||
public static final String S_MOB_TYPES = "mobTypes";
|
||||
public static final String S_MOB_AMOUNTS = "mobAmounts";
|
||||
public static final String S_MOB_KILL_LOCATIONS = "killLocations";
|
||||
public static final String S_MOB_KILL_LOCATIONS_RADIUS = "killLocationRadii";
|
||||
public static final String S_MOB_KILL_LOCATIONS_NAMES = "killLocationNames";
|
||||
public static final String S_REACH_LOCATIONS = "reachLocations";
|
||||
public static final String S_REACH_LOCATIONS_RADIUS = "reachLocationRadii";
|
||||
public static final String S_REACH_LOCATIONS_NAMES = "reachLocationNames";
|
||||
public static final String S_TAME_TYPES = "tameTypes";
|
||||
public static final String S_TAME_AMOUNTS = "tameAmounts";
|
||||
public static final String S_SHEAR_COLORS = "shearColors";
|
||||
public static final String S_SHEAR_AMOUNTS = "shearAmounts";
|
||||
public static final String S_START_EVENT = "startEvent";
|
||||
public static final String S_FINISH_EVENT = "finishEvent";
|
||||
public static final String S_CHAT_EVENTS = "chatEvents";
|
||||
public static final String S_CHAT_EVENT_TRIGGERS = "chatEventTriggers";
|
||||
public static final String S_CHAT_TEMP_EVENT = "chatTempEvent";
|
||||
public static final String S_DEATH_EVENT = "deathEvent";
|
||||
public static final String S_DISCONNECT_EVENT = "disconnectEvent";
|
||||
public static final String S_DELAY = "delay";
|
||||
public static final String S_DELAY_MESSAGE = "delayMessage";
|
||||
public static final String S_DENIZEN = "denizen";
|
||||
public static final String S_COMPLETE_MESSAGE = "completeMessage";
|
||||
public static final String S_START_MESSAGE = "startMessage";
|
||||
public static final String S_OVERRIDE_DISPLAY = "overrideDisplay";
|
||||
public static final String S_PASSWORD_DISPLAYS = "passwordDisplays";
|
||||
public static final String S_PASSWORD_PHRASES = "passwordPhrases";
|
||||
public static final String S_CUSTOM_OBJECTIVES = "customObjectives";
|
||||
public static final String S_CUSTOM_OBJECTIVES_COUNT = "customObjectiveCounts";
|
||||
public static final String S_CUSTOM_OBJECTIVES_DATA = "customObjectiveData";
|
||||
public static final String S_CUSTOM_OBJECTIVES_DATA_DESCRIPTIONS = "customObjectiveDataDescriptions";
|
||||
public static final String S_CUSTOM_OBJECTIVES_DATA_TEMP = "customObjectiveDataTemp";
|
||||
|
||||
//Events
|
||||
public static final String E_OLD_EVENT = "oldEvent";
|
||||
public static final String E_NAME = "evtName";
|
||||
public static final String E_MESSAGE = "evtMessage";
|
||||
public static final String E_CLEAR_INVENTORY = "evtClearInv";
|
||||
public static final String E_FAIL_QUEST = "evtFailQuest";
|
||||
public static final String E_ITEMS = "evtItems";
|
||||
public static final String E_ITEMS_AMOUNTS = "evtItemAmounts";
|
||||
public static final String E_EXPLOSIONS = "evtExplosions";
|
||||
public static final String E_EFFECTS = "evtEffects";
|
||||
public static final String E_EFFECTS_LOCATIONS = "evtEffectLocations";
|
||||
public static final String E_WORLD_STORM = "evtStormWorld";
|
||||
public static final String E_WORLD_STORM_DURATION = "evtStormDuration";
|
||||
public static final String E_WORLD_THUNDER = "evtThunderWorld";
|
||||
public static final String E_WORLD_THUNDER_DURATION = "evtThunderDuration";
|
||||
public static final String E_MOB_TYPES = "evtMobTypes";
|
||||
public static final String E_LIGHTNING = "evtLightningStrikes";
|
||||
public static final String E_POTION_TYPES = "evtPotionTypes";
|
||||
public static final String E_POTION_DURATIONS = "evtPotionDurations";
|
||||
public static final String E_POTION_STRENGHT = "evtPotionMagnitudes";
|
||||
public static final String E_HUNGER = "evtHunger";
|
||||
public static final String E_SATURATION = "evtSaturation";
|
||||
public static final String E_HEALTH = "evtHealth";
|
||||
public static final String E_TELEPORT = "evtTeleportLocation";
|
||||
public static final String E_COMMANDS = "evtCommands";
|
||||
//Events
|
||||
public static final String E_OLD_EVENT = "oldEvent";
|
||||
public static final String E_NAME = "evtName";
|
||||
public static final String E_MESSAGE = "evtMessage";
|
||||
public static final String E_CLEAR_INVENTORY = "evtClearInv";
|
||||
public static final String E_FAIL_QUEST = "evtFailQuest";
|
||||
public static final String E_ITEMS = "evtItems";
|
||||
public static final String E_ITEMS_AMOUNTS = "evtItemAmounts";
|
||||
public static final String E_EXPLOSIONS = "evtExplosions";
|
||||
public static final String E_EFFECTS = "evtEffects";
|
||||
public static final String E_EFFECTS_LOCATIONS = "evtEffectLocations";
|
||||
public static final String E_WORLD_STORM = "evtStormWorld";
|
||||
public static final String E_WORLD_STORM_DURATION = "evtStormDuration";
|
||||
public static final String E_WORLD_THUNDER = "evtThunderWorld";
|
||||
public static final String E_WORLD_THUNDER_DURATION = "evtThunderDuration";
|
||||
public static final String E_MOB_TYPES = "evtMobTypes";
|
||||
public static final String E_LIGHTNING = "evtLightningStrikes";
|
||||
public static final String E_POTION_TYPES = "evtPotionTypes";
|
||||
public static final String E_POTION_DURATIONS = "evtPotionDurations";
|
||||
public static final String E_POTION_STRENGHT = "evtPotionMagnitudes";
|
||||
public static final String E_HUNGER = "evtHunger";
|
||||
public static final String E_SATURATION = "evtSaturation";
|
||||
public static final String E_HEALTH = "evtHealth";
|
||||
public static final String E_TELEPORT = "evtTeleportLocation";
|
||||
public static final String E_COMMANDS = "evtCommands";
|
||||
|
||||
//Party
|
||||
public static final String P_INVITER = "inviter";
|
||||
//Party
|
||||
public static final String P_INVITER = "inviter";
|
||||
|
||||
}
|
||||
|
@ -27,5 +27,4 @@ public interface ColorUtil {
|
||||
static final ChatColor DARKRED = ChatColor.DARK_RED;
|
||||
static final ChatColor YELLOW = ChatColor.YELLOW;
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class ItemUtil implements ColorUtil{
|
||||
public class ItemUtil implements ColorUtil {
|
||||
|
||||
/**
|
||||
* Will compare stacks by id, amount, data, name/lore and enchantments
|
||||
@ -17,91 +17,97 @@ public class ItemUtil implements ColorUtil{
|
||||
*
|
||||
* @param one ItemStack to compare
|
||||
* @param two ItemStack to compare to
|
||||
* @return 0 if stacks are equal, or the first inequality from the following values:<br>
|
||||
* @return 0 if stacks are equal, or the first inequality from the following
|
||||
* values:<br>
|
||||
* @return -1 -> stack ids are unequal<br>
|
||||
* @return -2 -> stack amounts are unequal<br>
|
||||
* @return -3 -> stack data is unequal<br>
|
||||
* @return -4 -> stack name/lore is unequal<br>
|
||||
* @return -5 -> stack enchantments are unequal<br>
|
||||
*/
|
||||
public static int compareItems(ItemStack one, ItemStack two, boolean ignoreAmount){
|
||||
public static int compareItems(ItemStack one, ItemStack two, boolean ignoreAmount) {
|
||||
|
||||
if(one == null && two != null || one != null && two == null)
|
||||
if (one == null && two != null || one != null && two == null) {
|
||||
return 0;
|
||||
|
||||
if(one == null && two == null)
|
||||
}
|
||||
|
||||
if (one == null && two == null) {
|
||||
return 0;
|
||||
|
||||
if(one.getTypeId() != two.getTypeId())
|
||||
}
|
||||
|
||||
if (one.getTypeId() != two.getTypeId()) {
|
||||
return -1;
|
||||
else if( (one.getAmount() != two.getAmount()) && ignoreAmount == false)
|
||||
} else if ((one.getAmount() != two.getAmount()) && ignoreAmount == false) {
|
||||
return -2;
|
||||
else if(one.getData().equals(two.getData()) == false)
|
||||
} else if (one.getData().equals(two.getData()) == false) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
if(one.hasItemMeta() || two.hasItemMeta()){
|
||||
if (one.hasItemMeta() || two.hasItemMeta()) {
|
||||
|
||||
if(one.hasItemMeta() && two.hasItemMeta() == false)
|
||||
if (one.hasItemMeta() && two.hasItemMeta() == false) {
|
||||
return -4;
|
||||
else if(one.hasItemMeta() == false && two.hasItemMeta())
|
||||
} else if (one.hasItemMeta() == false && two.hasItemMeta()) {
|
||||
return -4;
|
||||
else if(one.getItemMeta().hasDisplayName() && two.getItemMeta().hasDisplayName() == false)
|
||||
} else if (one.getItemMeta().hasDisplayName() && two.getItemMeta().hasDisplayName() == false) {
|
||||
return -4;
|
||||
else if(one.getItemMeta().hasDisplayName() == false && two.getItemMeta().hasDisplayName())
|
||||
} else if (one.getItemMeta().hasDisplayName() == false && two.getItemMeta().hasDisplayName()) {
|
||||
return -4;
|
||||
|
||||
else if(one.getItemMeta().hasLore() && two.getItemMeta().hasLore() == false)
|
||||
} else if (one.getItemMeta().hasLore() && two.getItemMeta().hasLore() == false) {
|
||||
return -4;
|
||||
else if(one.getItemMeta().hasLore() == false && two.getItemMeta().hasLore())
|
||||
} else if (one.getItemMeta().hasLore() == false && two.getItemMeta().hasLore()) {
|
||||
return -4;
|
||||
|
||||
else if(one.getItemMeta().hasDisplayName() && two.getItemMeta().hasDisplayName() && ChatColor.stripColor(one.getItemMeta().getDisplayName()).equals(ChatColor.stripColor(two.getItemMeta().getDisplayName())) == false)
|
||||
} else if (one.getItemMeta().hasDisplayName() && two.getItemMeta().hasDisplayName() && ChatColor.stripColor(one.getItemMeta().getDisplayName()).equals(ChatColor.stripColor(two.getItemMeta().getDisplayName())) == false) {
|
||||
return -4;
|
||||
|
||||
else if(one.getItemMeta().hasLore() && two.getItemMeta().hasLore() && one.getItemMeta().getLore().equals(two.getItemMeta().getLore()) == false)
|
||||
} else if (one.getItemMeta().hasLore() && two.getItemMeta().hasLore() && one.getItemMeta().getLore().equals(two.getItemMeta().getLore()) == false) {
|
||||
return -4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(one.getEnchantments().equals(two.getEnchantments()) == false)
|
||||
if (one.getEnchantments().equals(two.getEnchantments()) == false) {
|
||||
return -5;
|
||||
else
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Formats -> id-id:amount-amount:data-data:enchantment-enchantment level:name-name:lore-lore:
|
||||
//
|
||||
public static ItemStack readItemStack(String data){
|
||||
public static ItemStack readItemStack(String data) {
|
||||
|
||||
if (data == null) return null;
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
ItemStack stack = null;
|
||||
String[] args = data.split(":");
|
||||
ItemMeta meta = null;
|
||||
LinkedList<String> lore = new LinkedList<String>();
|
||||
for(String arg : args){
|
||||
for (String arg : args) {
|
||||
|
||||
if(arg.startsWith("id-")){
|
||||
if (arg.startsWith("id-")) {
|
||||
stack = new ItemStack(Integer.parseInt(arg.substring(3)));
|
||||
meta = stack.getItemMeta();
|
||||
}else if(arg.startsWith("amount-"))
|
||||
} else if (arg.startsWith("amount-")) {
|
||||
stack.setAmount(Integer.parseInt(arg.substring(7)));
|
||||
else if(arg.startsWith("data-"))
|
||||
} else if (arg.startsWith("data-")) {
|
||||
stack.setDurability(Short.parseShort(arg.substring(5)));
|
||||
else if(arg.startsWith("enchantment-")){
|
||||
} else if (arg.startsWith("enchantment-")) {
|
||||
String[] enchs = arg.substring(12).split(" ");
|
||||
Enchantment e = Quests.getEnchantment(enchs[0]);
|
||||
meta.addEnchant(e, Integer.parseInt(enchs[1]), true);
|
||||
}else if(arg.startsWith("name-"))
|
||||
} else if (arg.startsWith("name-")) {
|
||||
meta.setDisplayName(arg.substring(5));
|
||||
else if(arg.startsWith("lore-"))
|
||||
} else if (arg.startsWith("lore-")) {
|
||||
lore.add(arg.substring(5));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(lore.isEmpty() == false)
|
||||
if (lore.isEmpty() == false) {
|
||||
meta.setLore(lore);
|
||||
}
|
||||
|
||||
stack.setItemMeta(meta);
|
||||
|
||||
@ -109,54 +115,61 @@ public class ItemUtil implements ColorUtil{
|
||||
|
||||
}
|
||||
|
||||
public static String serialize(ItemStack is){
|
||||
public static String serialize(ItemStack is) {
|
||||
|
||||
String serial;
|
||||
|
||||
if (is == null) return null;
|
||||
|
||||
if (is == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
serial = "id-" + is.getTypeId();
|
||||
serial += ":amount-" + is.getAmount();
|
||||
if(is.getDurability() != 0)
|
||||
if (is.getDurability() != 0) {
|
||||
serial += ":data-" + is.getDurability();
|
||||
if(is.getEnchantments().isEmpty() == false){
|
||||
|
||||
for(Entry<Enchantment, Integer> e : is.getEnchantments().entrySet())
|
||||
serial += ":enchantment-" + Quester.enchantmentString(e.getKey()) + " " + e.getValue();
|
||||
|
||||
}
|
||||
if(is.hasItemMeta()){
|
||||
if (is.getEnchantments().isEmpty() == false) {
|
||||
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
if(meta.hasDisplayName())
|
||||
serial += ":name-" + meta.getDisplayName();
|
||||
if(meta.hasLore()){
|
||||
for(String s : meta.getLore())
|
||||
serial += ":lore-" + s;
|
||||
for (Entry<Enchantment, Integer> e : is.getEnchantments().entrySet()) {
|
||||
serial += ":enchantment-" + Quester.enchantmentString(e.getKey()) + " " + e.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
if (is.hasItemMeta()) {
|
||||
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
if (meta.hasDisplayName()) {
|
||||
serial += ":name-" + meta.getDisplayName();
|
||||
}
|
||||
if (meta.hasLore()) {
|
||||
for (String s : meta.getLore()) {
|
||||
serial += ":lore-" + s;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return serial;
|
||||
|
||||
}
|
||||
|
||||
public static String getDisplayString(ItemStack is){
|
||||
public static String getDisplayString(ItemStack is) {
|
||||
|
||||
String text;
|
||||
|
||||
if(is.hasItemMeta() && is.getItemMeta().hasDisplayName())
|
||||
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
|
||||
text = "" + DARKAQUA + ITALIC + is.getItemMeta().getDisplayName() + RESET + AQUA + " x " + is.getAmount();
|
||||
else{
|
||||
} else {
|
||||
text = AQUA + Quester.prettyItemString(is.getTypeId());
|
||||
if(is.getDurability() != 0)
|
||||
if (is.getDurability() != 0) {
|
||||
text += AQUA + ":" + is.getDurability();
|
||||
}
|
||||
|
||||
text += AQUA + " x " + is.getAmount();
|
||||
|
||||
if(is.getEnchantments().isEmpty() == false)
|
||||
if (is.getEnchantments().isEmpty() == false) {
|
||||
text += " " + PURPLE + Lang.get("enchantedItem");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -164,16 +177,17 @@ public class ItemUtil implements ColorUtil{
|
||||
|
||||
}
|
||||
|
||||
public static String getString(ItemStack is){
|
||||
public static String getString(ItemStack is) {
|
||||
|
||||
String text;
|
||||
|
||||
if(is.hasItemMeta() && is.getItemMeta().hasDisplayName())
|
||||
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
|
||||
text = "" + DARKAQUA + ITALIC + is.getItemMeta().getDisplayName() + RESET + AQUA + " x " + is.getAmount();
|
||||
else{
|
||||
} else {
|
||||
text = AQUA + Quester.prettyItemString(is.getTypeId());
|
||||
if(is.getDurability() != 0)
|
||||
if (is.getDurability() != 0) {
|
||||
text += AQUA + ":" + is.getDurability();
|
||||
}
|
||||
|
||||
text += AQUA + " x " + is.getAmount();
|
||||
|
||||
@ -183,18 +197,33 @@ public class ItemUtil implements ColorUtil{
|
||||
|
||||
}
|
||||
|
||||
public static String getName(ItemStack is){
|
||||
public static String getName(ItemStack is) {
|
||||
|
||||
String text;
|
||||
|
||||
if(is.hasItemMeta() && is.getItemMeta().hasDisplayName())
|
||||
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
|
||||
text = "" + DARKAQUA + ITALIC + is.getItemMeta().getDisplayName();
|
||||
else{
|
||||
} else {
|
||||
text = AQUA + Quester.prettyItemString(is.getTypeId());
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isJournal(ItemStack is) {
|
||||
|
||||
if(is == null)
|
||||
return false;
|
||||
|
||||
if(is.hasItemMeta() == false)
|
||||
return false;
|
||||
|
||||
if(is.getItemMeta().hasDisplayName() == false)
|
||||
return false;
|
||||
|
||||
return is.getItemMeta().getDisplayName().equals(PINK + Lang.get("journalTitle"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,116 +6,136 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MiscUtil {
|
||||
|
||||
public static String getCapitalized(String s){
|
||||
|
||||
if(s.isEmpty())
|
||||
|
||||
public static String getCapitalized(String s) {
|
||||
|
||||
if (s.isEmpty()) {
|
||||
return s;
|
||||
|
||||
}
|
||||
|
||||
s = s.toLowerCase();
|
||||
String s2 = s.substring(0, 1);
|
||||
s2 = s2.toUpperCase();
|
||||
|
||||
|
||||
s = s.substring(1, s.length());
|
||||
|
||||
|
||||
return s2 + s;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Time: 7d 24h 5m 10s 20ms
|
||||
public static long getTimeFromString(String string) {
|
||||
//if it returns -1 then the string is incorrect.
|
||||
long timeMilliSeconds = -1;
|
||||
//replace 2 or more spaces with one space.
|
||||
string = string.replaceAll("[ ]{2,}", " ");
|
||||
|
||||
|
||||
String[] dates = string.split(" ");
|
||||
|
||||
for (String date : dates) {
|
||||
String num = date.split("[a-zA-Z]+")[0];
|
||||
String type = date.split("[0-9]+")[1];
|
||||
|
||||
int t = 0;
|
||||
try {
|
||||
t = Math.abs(Integer.parseInt(num));
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
|
||||
if (type.equals("d")) {
|
||||
timeMilliSeconds += t * 86400000;
|
||||
} else if (type.equals("h")) {
|
||||
timeMilliSeconds += t * 3600000;
|
||||
} else if (type.equals("m")) {
|
||||
timeMilliSeconds += t * 60000;
|
||||
} else if (type.equals("s")) {
|
||||
timeMilliSeconds += t * 1000;
|
||||
} else if (type.equals("ms")) {
|
||||
timeMilliSeconds += t;
|
||||
}
|
||||
}
|
||||
|
||||
//To balance the -1 at the beginning.
|
||||
if (timeMilliSeconds > -1) timeMilliSeconds++;
|
||||
|
||||
return timeMilliSeconds;
|
||||
//if it returns -1 then the string is incorrect.
|
||||
long timeMilliSeconds = -1;
|
||||
//replace 2 or more spaces with one space.
|
||||
string = string.replaceAll("[ ]{2,}", " ");
|
||||
|
||||
String[] dates = string.split(" ");
|
||||
|
||||
for (String date : dates) {
|
||||
String num = date.split("[a-zA-Z]+")[0];
|
||||
String type = date.split("[0-9]+")[1];
|
||||
|
||||
int t = 0;
|
||||
try {
|
||||
t = Math.abs(Integer.parseInt(num));
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
|
||||
if (type.equals("d")) {
|
||||
timeMilliSeconds += t * 86400000;
|
||||
} else if (type.equals("h")) {
|
||||
timeMilliSeconds += t * 3600000;
|
||||
} else if (type.equals("m")) {
|
||||
timeMilliSeconds += t * 60000;
|
||||
} else if (type.equals("s")) {
|
||||
timeMilliSeconds += t * 1000;
|
||||
} else if (type.equals("ms")) {
|
||||
timeMilliSeconds += t;
|
||||
}
|
||||
}
|
||||
|
||||
//To balance the -1 at the beginning.
|
||||
if (timeMilliSeconds > -1) {
|
||||
timeMilliSeconds++;
|
||||
}
|
||||
|
||||
return timeMilliSeconds;
|
||||
}
|
||||
|
||||
|
||||
public static String getProperMobName(EntityType type) {
|
||||
|
||||
|
||||
String name = type.name().toLowerCase();
|
||||
|
||||
|
||||
name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
|
||||
while(fixUnderscore(name) != null)
|
||||
while (fixUnderscore(name) != null) {
|
||||
name = fixUnderscore(name);
|
||||
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public static EntityType getProperMobType(String properName) {
|
||||
|
||||
|
||||
properName = unfixUnderscores(properName);
|
||||
properName = properName.toUpperCase();
|
||||
for(EntityType et : EntityType.values()) {
|
||||
|
||||
if(et.isAlive() && et.name().equalsIgnoreCase(properName))
|
||||
for (EntityType et : EntityType.values()) {
|
||||
|
||||
if (et.isAlive() && et.name().equalsIgnoreCase(properName)) {
|
||||
return et;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static String fixUnderscore(String s) {
|
||||
|
||||
|
||||
int index = s.indexOf('_');
|
||||
if(index == -1)
|
||||
if (index == -1) {
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
s = s.substring(0, (index + 1)) + Character.toUpperCase(s.charAt(index + 1)) + s.substring(index + 2);
|
||||
s = s.replaceFirst("_", "");
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
private static String unfixUnderscores(String s) {
|
||||
|
||||
|
||||
int max = s.length();
|
||||
|
||||
for(int i = 1; i < max; i++) {
|
||||
|
||||
if(Character.isUpperCase(s.charAt(i))) {
|
||||
|
||||
|
||||
for (int i = 1; i < max; i++) {
|
||||
|
||||
if (Character.isUpperCase(s.charAt(i))) {
|
||||
|
||||
s = s.substring(0, i) + "_" + s.substring(i);
|
||||
i++;
|
||||
max++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
public static String concatArgArray(String[] args, int startingIndex, int endingIndex, char delimiter) {
|
||||
|
||||
String s = "";
|
||||
|
||||
for (int i = startingIndex; i <= endingIndex; i++) {
|
||||
|
||||
s += args[i] + delimiter;
|
||||
|
||||
}
|
||||
|
||||
s = s.substring(0, s.length());
|
||||
|
||||
return s.trim().equals("") ? null : s.trim();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,234 +15,254 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class QuestMob {
|
||||
|
||||
private String name = null;
|
||||
private EntityType entityType = null;
|
||||
private Location spawnLocation = null;
|
||||
private Integer spawnAmounts = null;
|
||||
public ItemStack[] inventory = new ItemStack[5];
|
||||
public Float[] dropChances = new Float[5];
|
||||
private String name = null;
|
||||
private EntityType entityType = null;
|
||||
private Location spawnLocation = null;
|
||||
private Integer spawnAmounts = null;
|
||||
public ItemStack[] inventory = new ItemStack[5];
|
||||
public Float[] dropChances = new Float[5];
|
||||
|
||||
public QuestMob (EntityType entityType, Location spawnLocation, int spawnAmounts) {
|
||||
this.entityType = entityType;
|
||||
this.spawnLocation = spawnLocation;
|
||||
this.spawnAmounts = spawnAmounts;
|
||||
}
|
||||
public QuestMob(EntityType entityType, Location spawnLocation, int spawnAmounts) {
|
||||
this.entityType = entityType;
|
||||
this.spawnLocation = spawnLocation;
|
||||
this.spawnAmounts = spawnAmounts;
|
||||
}
|
||||
|
||||
public QuestMob() {
|
||||
public QuestMob() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setSpawnLocation(Location spawnLocation) {
|
||||
this.spawnLocation = spawnLocation;
|
||||
}
|
||||
public void setSpawnLocation(Location spawnLocation) {
|
||||
this.spawnLocation = spawnLocation;
|
||||
}
|
||||
|
||||
public Location getSpawnLocation() {
|
||||
return spawnLocation;
|
||||
}
|
||||
public Location getSpawnLocation() {
|
||||
return spawnLocation;
|
||||
}
|
||||
|
||||
public void setType(EntityType entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
public void setType(EntityType entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return entityType;
|
||||
}
|
||||
public EntityType getType() {
|
||||
return entityType;
|
||||
}
|
||||
|
||||
public void setSpawnAmounts(int spawnAmounts) {
|
||||
this.spawnAmounts = spawnAmounts;
|
||||
}
|
||||
public void setSpawnAmounts(int spawnAmounts) {
|
||||
this.spawnAmounts = spawnAmounts;
|
||||
}
|
||||
|
||||
public Integer getSpawnAmounts() {
|
||||
return spawnAmounts;
|
||||
}
|
||||
public Integer getSpawnAmounts() {
|
||||
return spawnAmounts;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setHelmet(ItemStack helmet, float dropChance) {
|
||||
inventory[4] = helmet;
|
||||
dropChances[4] = dropChance;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setChest(ItemStack chest, float dropChance) {
|
||||
inventory[3] = chest;
|
||||
dropChances[3] = dropChance;
|
||||
}
|
||||
|
||||
public void setHelmet(ItemStack helmet, float dropChance) {
|
||||
inventory[4] = helmet;
|
||||
dropChances[4] = dropChance;
|
||||
}
|
||||
public void setLeggings(ItemStack leggings, float dropChance) {
|
||||
inventory[2] = leggings;
|
||||
dropChances[2] = dropChance;
|
||||
}
|
||||
|
||||
public void setChest(ItemStack chest, float dropChance) {
|
||||
inventory[3] = chest;
|
||||
dropChances[3] = dropChance;
|
||||
}
|
||||
public void setBoots(ItemStack boots, float dropChance) {
|
||||
inventory[1] = boots;
|
||||
dropChances[1] = dropChance;
|
||||
}
|
||||
|
||||
public void setLeggings(ItemStack leggings, float dropChance) {
|
||||
inventory[2] = leggings;
|
||||
dropChances[2] = dropChance;
|
||||
}
|
||||
public void setHeldItem(ItemStack heldItem, float dropChance) {
|
||||
inventory[0] = heldItem;
|
||||
dropChances[0] = dropChance;
|
||||
}
|
||||
|
||||
public void setBoots(ItemStack boots, float dropChance) {
|
||||
inventory[1] = boots;
|
||||
dropChances[1] = dropChance;
|
||||
}
|
||||
public void spawn() {
|
||||
|
||||
public void setHeldItem(ItemStack heldItem, float dropChance) {
|
||||
inventory[0] = heldItem;
|
||||
dropChances[0] = dropChance;
|
||||
}
|
||||
World world = spawnLocation.getWorld();
|
||||
|
||||
for (int i = 0; i < spawnAmounts; i++) {
|
||||
|
||||
public void spawn() {
|
||||
Entity entity = world.spawnEntity(spawnLocation, entityType);
|
||||
|
||||
World world = spawnLocation.getWorld();
|
||||
if (name != null) {
|
||||
((LivingEntity) entity).setCustomName(name);
|
||||
((LivingEntity) entity).setCustomNameVisible(true);
|
||||
}
|
||||
|
||||
for (int i = 0; i < spawnAmounts; i++) {
|
||||
for (int j = 0; j < 5; j++) {
|
||||
if (inventory[j] != null) {
|
||||
((CraftEntity) entity).getHandle().setEquipment(j, CraftItemStack.asNMSCopy(inventory[j]));
|
||||
}
|
||||
}
|
||||
|
||||
Entity entity = world.spawnEntity(spawnLocation, entityType);
|
||||
EntityEquipment eq = ((CraftLivingEntity) entity).getEquipment();
|
||||
|
||||
if (name != null) {
|
||||
((LivingEntity) entity).setCustomName(name);
|
||||
((LivingEntity) entity).setCustomNameVisible(true);
|
||||
}
|
||||
if (dropChances[0] != null) {
|
||||
eq.setItemInHandDropChance(dropChances[0]);
|
||||
}
|
||||
if (dropChances[1] != null) {
|
||||
eq.setBootsDropChance(dropChances[1]);
|
||||
}
|
||||
if (dropChances[2] != null) {
|
||||
eq.setLeggingsDropChance(dropChances[2]);
|
||||
}
|
||||
if (dropChances[3] != null) {
|
||||
eq.setChestplateDropChance(dropChances[3]);
|
||||
}
|
||||
if (dropChances[4] != null) {
|
||||
eq.setHelmetDropChance(dropChances[4]);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 5; j++) {
|
||||
if (inventory[j] != null)
|
||||
((CraftEntity) entity).getHandle().setEquipment(j, CraftItemStack.asNMSCopy(inventory[j]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EntityEquipment eq = ((CraftLivingEntity) entity).getEquipment();
|
||||
public String serialize() {
|
||||
String string = "";
|
||||
string += "type-" + entityType.getName();
|
||||
if (name != null) {
|
||||
string += "::name-" + name;
|
||||
}
|
||||
if (spawnLocation != null) {
|
||||
string += "::spawn-" + Quests.getLocationInfo(spawnLocation);
|
||||
}
|
||||
if (spawnAmounts != null) {
|
||||
string += "::amounts-" + spawnAmounts;
|
||||
}
|
||||
|
||||
if (dropChances[0] != null) eq.setItemInHandDropChance(dropChances[0]);
|
||||
if (dropChances[1] != null) eq.setBootsDropChance(dropChances[1]);
|
||||
if (dropChances[2] != null) eq.setLeggingsDropChance(dropChances[2]);
|
||||
if (dropChances[3] != null) eq.setChestplateDropChance(dropChances[3]);
|
||||
if (dropChances[4] != null) eq.setHelmetDropChance(dropChances[4]);
|
||||
if (inventory[0] != null) {
|
||||
string += "::hand-" + ItemUtil.serialize(inventory[0]);
|
||||
string += "::hand_drop-" + dropChances[0];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (inventory[1] != null) {
|
||||
string += "::boots-" + ItemUtil.serialize(inventory[1]);
|
||||
string += "::boots_drop-" + dropChances[1];
|
||||
}
|
||||
|
||||
public String serialize() {
|
||||
String string = "";
|
||||
string += "type-" + entityType.getName();
|
||||
if (name != null) string += "::name-" + name;
|
||||
if (spawnLocation != null) string += "::spawn-" + Quests.getLocationInfo(spawnLocation);
|
||||
if (spawnAmounts != null) string += "::amounts-" + spawnAmounts;
|
||||
if (inventory[2] != null) {
|
||||
string += "::leggings-" + ItemUtil.serialize(inventory[2]);
|
||||
string += "::leggings_drop-" + dropChances[2];
|
||||
}
|
||||
|
||||
if (inventory[0] != null) {
|
||||
string += "::hand-" + ItemUtil.serialize(inventory[0]);
|
||||
string += "::hand_drop-" + dropChances[0];
|
||||
}
|
||||
if (inventory[3] != null) {
|
||||
string += "::chest-" + ItemUtil.serialize(inventory[3]);
|
||||
string += "::chest_drop-" + dropChances[3];
|
||||
}
|
||||
|
||||
if (inventory[1] != null) {
|
||||
string += "::boots-" + ItemUtil.serialize(inventory[1]);
|
||||
string += "::boots_drop-" + dropChances[1];
|
||||
}
|
||||
if (inventory[4] != null) {
|
||||
string += "::helmet-" + ItemUtil.serialize(inventory[4]);
|
||||
string += "::helmet_drop-" + dropChances[4];
|
||||
}
|
||||
|
||||
if (inventory[2] != null) {
|
||||
string += "::leggings-" + ItemUtil.serialize(inventory[2]);
|
||||
string += "::leggings_drop-" + dropChances[2];
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
if (inventory[3] != null) {
|
||||
string += "::chest-" + ItemUtil.serialize(inventory[3]);
|
||||
string += "::chest_drop-" + dropChances[3];
|
||||
}
|
||||
public static QuestMob fromString(String str) {
|
||||
|
||||
if (inventory[4] != null) {
|
||||
string += "::helmet-" + ItemUtil.serialize(inventory[4]);
|
||||
string += "::helmet_drop-" + dropChances[4];
|
||||
}
|
||||
String name = null;
|
||||
EntityType entityType = null;
|
||||
Location loc = null;
|
||||
Integer amounts = null;
|
||||
ItemStack[] inventory = new ItemStack[5];
|
||||
Float[] dropChances = new Float[5];
|
||||
|
||||
return string;
|
||||
}
|
||||
String[] args = str.split("::");
|
||||
for (String string : args) {
|
||||
if (string.startsWith("type-")) {
|
||||
entityType = Quests.getMobType(string.substring(5));
|
||||
} else if (string.startsWith("name-")) {
|
||||
name = string.substring(5);
|
||||
} else if (string.startsWith("spawn-")) {
|
||||
loc = Quests.getLocation(string.substring(6));
|
||||
} else if (string.startsWith("amounts-")) {
|
||||
amounts = Integer.parseInt(string.substring(8));
|
||||
} else if (string.startsWith("hand-")) {
|
||||
inventory[0] = ItemUtil.readItemStack(string.substring(5));
|
||||
} else if (string.startsWith("hand_drop-")) {
|
||||
dropChances[0] = Float.parseFloat(string.substring(10));
|
||||
} else if (string.startsWith("boots-")) {
|
||||
inventory[1] = ItemUtil.readItemStack(string.substring(6));
|
||||
} else if (string.startsWith("boots_drop-")) {
|
||||
dropChances[1] = Float.parseFloat(string.substring(11));
|
||||
} else if (string.startsWith("leggings-")) {
|
||||
inventory[2] = ItemUtil.readItemStack(string.substring(9));
|
||||
} else if (string.startsWith("leggings_drop-")) {
|
||||
dropChances[2] = Float.parseFloat(string.substring(14));
|
||||
} else if (string.startsWith("chest-")) {
|
||||
inventory[3] = ItemUtil.readItemStack(string.substring(6));
|
||||
} else if (string.startsWith("chest_drop-")) {
|
||||
dropChances[3] = Float.parseFloat(string.substring(11));
|
||||
} else if (string.startsWith("helmet-")) {
|
||||
inventory[4] = ItemUtil.readItemStack(string.substring(7));
|
||||
} else if (string.startsWith("helmet_drop-")) {
|
||||
dropChances[4] = Float.parseFloat(string.substring(12));
|
||||
}
|
||||
|
||||
public static QuestMob fromString(String str) {
|
||||
}
|
||||
|
||||
String name = null;
|
||||
EntityType entityType = null;
|
||||
Location loc = null;
|
||||
Integer amounts = null;
|
||||
ItemStack[] inventory = new ItemStack[5];
|
||||
Float[] dropChances = new Float[5];
|
||||
QuestMob qm = new QuestMob(entityType, loc, amounts);
|
||||
qm.setName(name);
|
||||
qm.inventory = inventory;
|
||||
qm.dropChances = dropChances;
|
||||
return qm;
|
||||
}
|
||||
|
||||
String[] args = str.split("::");
|
||||
for (String string : args) {
|
||||
if (string.startsWith("type-")) {
|
||||
entityType = Quests.getMobType(string.substring(5));
|
||||
} else if (string.startsWith("name-")) {
|
||||
name = string.substring(5);
|
||||
} else if (string.startsWith("spawn-")) {
|
||||
loc = Quests.getLocation(string.substring(6));
|
||||
} else if (string.startsWith("amounts-")) {
|
||||
amounts = Integer.parseInt(string.substring(8));
|
||||
} else if (string.startsWith("hand-")) {
|
||||
inventory[0] = ItemUtil.readItemStack(string.substring(5));
|
||||
} else if (string.startsWith("hand_drop-")) {
|
||||
dropChances[0] = Float.parseFloat(string.substring(10));
|
||||
} else if (string.startsWith("boots-")) {
|
||||
inventory[1] = ItemUtil.readItemStack(string.substring(6));
|
||||
} else if (string.startsWith("boots_drop-")) {
|
||||
dropChances[1] = Float.parseFloat(string.substring(11));
|
||||
} else if (string.startsWith("leggings-")) {
|
||||
inventory[2] = ItemUtil.readItemStack(string.substring(9));
|
||||
} else if (string.startsWith("leggings_drop-")) {
|
||||
dropChances[2] = Float.parseFloat(string.substring(14));
|
||||
} else if (string.startsWith("chest-")) {
|
||||
inventory[3] = ItemUtil.readItemStack(string.substring(6));
|
||||
} else if (string.startsWith("chest_drop-")) {
|
||||
dropChances[3] = Float.parseFloat(string.substring(11));
|
||||
} else if (string.startsWith("helmet-")) {
|
||||
inventory[4] = ItemUtil.readItemStack(string.substring(7));
|
||||
} else if (string.startsWith("helmet_drop-")) {
|
||||
dropChances[4] = Float.parseFloat(string.substring(12));
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if ((o instanceof QuestMob) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
QuestMob other = (QuestMob) o;
|
||||
|
||||
QuestMob qm = new QuestMob(entityType, loc, amounts);
|
||||
qm.setName(name);
|
||||
qm.inventory = inventory;
|
||||
qm.dropChances = dropChances;
|
||||
return qm;
|
||||
}
|
||||
if (name != null && other.name != null) {
|
||||
if (name.equalsIgnoreCase(other.name) == false) {
|
||||
return false;
|
||||
}
|
||||
} else if (name == null && other.name == null) {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if ((o instanceof QuestMob) == false) {
|
||||
return false;
|
||||
}
|
||||
if (entityType != other.entityType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QuestMob other = (QuestMob) o;
|
||||
|
||||
if (name != null && other.name != null) {
|
||||
if (name.equalsIgnoreCase(other.name) == false)
|
||||
return false;
|
||||
} else if (name == null && other.name == null) {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (dropChances != other.dropChances) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entityType != other.entityType)
|
||||
return false;
|
||||
if (inventory.length == other.inventory.length) {
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
if (ItemUtil.compareItems(inventory[i], other.inventory[i], false) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dropChances != other.dropChances)
|
||||
return false;
|
||||
if (spawnAmounts != other.spawnAmounts) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (inventory.length == other.inventory.length) {
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
if (ItemUtil.compareItems(inventory[i], other.inventory[i], false) != 0)
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (spawnLocation != other.spawnLocation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spawnAmounts != other.spawnAmounts)
|
||||
return false;
|
||||
|
||||
if (spawnLocation != other.spawnLocation)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ permissions:
|
||||
quests.info:
|
||||
description: View plugin information
|
||||
default: true
|
||||
quests.journal:
|
||||
description: View Quest Journal
|
||||
default: true
|
||||
quests.admin:
|
||||
description: Base Questsadmin command
|
||||
default: op
|
||||
|
Loading…
Reference in New Issue
Block a user