mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-19 07:38:33 +01:00
Refactoring for getter/setter methods, part 4
This commit is contained in:
parent
32b6cab5e6
commit
2c899bb5ae
@ -35,7 +35,6 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
import me.blackvein.quests.timers.EventTimer;
|
import me.blackvein.quests.timers.EventTimer;
|
||||||
import me.blackvein.quests.util.ItemUtil;
|
import me.blackvein.quests.util.ItemUtil;
|
||||||
import me.blackvein.quests.util.Lang;
|
import me.blackvein.quests.util.Lang;
|
||||||
import me.blackvein.quests.util.QuestMob;
|
|
||||||
|
|
||||||
public class Event {
|
public class Event {
|
||||||
|
|
||||||
@ -563,8 +562,8 @@ public class Event {
|
|||||||
inventory[4] = ItemUtil.readItemStack(section.getString(s + ".helmet"));
|
inventory[4] = ItemUtil.readItemStack(section.getString(s + ".helmet"));
|
||||||
dropChances[4] = (float) section.getDouble(s + ".helmet-drop-chance");
|
dropChances[4] = (float) section.getDouble(s + ".helmet-drop-chance");
|
||||||
QuestMob questMob = new QuestMob(type, spawnLocation, mobAmount);
|
QuestMob questMob = new QuestMob(type, spawnLocation, mobAmount);
|
||||||
questMob.inventory = inventory;
|
questMob.setInventory(inventory);
|
||||||
questMob.dropChances = dropChances;
|
questMob.setDropChances(dropChances);
|
||||||
questMob.setName(mobName);
|
questMob.setName(mobName);
|
||||||
event.mobSpawns.add(questMob);
|
event.mobSpawns.add(questMob);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,6 @@ import me.blackvein.quests.util.CK;
|
|||||||
import me.blackvein.quests.util.ItemUtil;
|
import me.blackvein.quests.util.ItemUtil;
|
||||||
import me.blackvein.quests.util.Lang;
|
import me.blackvein.quests.util.Lang;
|
||||||
import me.blackvein.quests.util.MiscUtil;
|
import me.blackvein.quests.util.MiscUtil;
|
||||||
import me.blackvein.quests.util.QuestMob;
|
|
||||||
|
|
||||||
public class EventFactory implements ConversationAbandonedListener {
|
public class EventFactory implements ConversationAbandonedListener {
|
||||||
|
|
||||||
@ -827,16 +826,16 @@ public class EventFactory implements ConversationAbandonedListener {
|
|||||||
ss.set("spawn-location", Quests.getLocationInfo(questMob.getSpawnLocation()));
|
ss.set("spawn-location", Quests.getLocationInfo(questMob.getSpawnLocation()));
|
||||||
ss.set("mob-type", questMob.getType().name());
|
ss.set("mob-type", questMob.getType().name());
|
||||||
ss.set("spawn-amounts", questMob.getSpawnAmounts());
|
ss.set("spawn-amounts", questMob.getSpawnAmounts());
|
||||||
ss.set("held-item", ItemUtil.serializeItemStack(questMob.inventory[0]));
|
ss.set("held-item", ItemUtil.serializeItemStack(questMob.getInventory()[0]));
|
||||||
ss.set("held-item-drop-chance", questMob.dropChances[0]);
|
ss.set("held-item-drop-chance", questMob.getDropChances()[0]);
|
||||||
ss.set("boots", ItemUtil.serializeItemStack(questMob.inventory[1]));
|
ss.set("boots", ItemUtil.serializeItemStack(questMob.getInventory()[1]));
|
||||||
ss.set("boots-drop-chance", questMob.dropChances[1]);
|
ss.set("boots-drop-chance", questMob.getDropChances()[1]);
|
||||||
ss.set("leggings", ItemUtil.serializeItemStack(questMob.inventory[2]));
|
ss.set("leggings", ItemUtil.serializeItemStack(questMob.getInventory()[2]));
|
||||||
ss.set("leggings-drop-chance", questMob.dropChances[2]);
|
ss.set("leggings-drop-chance", questMob.getDropChances()[2]);
|
||||||
ss.set("chest-plate", ItemUtil.serializeItemStack(questMob.inventory[3]));
|
ss.set("chest-plate", ItemUtil.serializeItemStack(questMob.getInventory()[3]));
|
||||||
ss.set("chest-plate-drop-chance", questMob.dropChances[3]);
|
ss.set("chest-plate-drop-chance", questMob.getDropChances()[3]);
|
||||||
ss.set("helmet", ItemUtil.serializeItemStack(questMob.inventory[4]));
|
ss.set("helmet", ItemUtil.serializeItemStack(questMob.getInventory()[4]));
|
||||||
ss.set("helmet-drop-chance", questMob.dropChances[4]);
|
ss.set("helmet-drop-chance", questMob.getDropChances()[4]);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1540,7 +1539,7 @@ public class EventFactory implements ConversationAbandonedListener {
|
|||||||
// Check/add newly made item
|
// Check/add newly made item
|
||||||
if (context.getSessionData("newItem") != null) {
|
if (context.getSessionData("newItem") != null) {
|
||||||
if (itemIndex >= 0) {
|
if (itemIndex >= 0) {
|
||||||
questMob.inventory[itemIndex] = ((ItemStack) context.getSessionData("tempStack"));
|
questMob.getInventory()[itemIndex] = ((ItemStack) context.getSessionData("tempStack"));
|
||||||
itemIndex = -1;
|
itemIndex = -1;
|
||||||
}
|
}
|
||||||
context.setSessionData("newItem", null);
|
context.setSessionData("newItem", null);
|
||||||
@ -1550,16 +1549,16 @@ public class EventFactory implements ConversationAbandonedListener {
|
|||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobType") + ChatColor.GRAY + " (" + ((questMob.getType() == null) ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getType().name()) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobType") + ChatColor.GRAY + " (" + ((questMob.getType() == null) ? Lang.get("noneSet") : ChatColor.AQUA + questMob.getType().name()) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddSpawnLocation") + ChatColor.GRAY + " (" + ((questMob.getSpawnLocation() == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + Quests.getLocationInfo(questMob.getSpawnLocation())) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "3" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorAddSpawnLocation") + ChatColor.GRAY + " (" + ((questMob.getSpawnLocation() == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + Quests.getLocationInfo(questMob.getSpawnLocation())) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobSpawnAmount") + ChatColor.GRAY + " (" + ((questMob.getSpawnAmounts() == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getSpawnAmounts()) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "4" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobSpawnAmount") + ChatColor.GRAY + " (" + ((questMob.getSpawnAmounts() == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getSpawnAmounts()) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobItemInHand") + ChatColor.GRAY + " (" + ((questMob.inventory[0] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.inventory[0])) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "5" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobItemInHand") + ChatColor.GRAY + " (" + ((questMob.getInventory()[0] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.getInventory()[0])) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobItemInHandDrop") + ChatColor.GRAY + " (" + ((questMob.dropChances[0] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.dropChances[0]) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "6" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobItemInHandDrop") + ChatColor.GRAY + " (" + ((questMob.getDropChances()[0] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getDropChances()[0]) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobBoots") + ChatColor.GRAY + " (" + ((questMob.inventory[1] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.inventory[1])) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "7" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobBoots") + ChatColor.GRAY + " (" + ((questMob.getInventory()[1] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.getInventory()[1])) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobBootsDrop") + ChatColor.GRAY + " (" + ((questMob.dropChances[1] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.dropChances[1]) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "8" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobBootsDrop") + ChatColor.GRAY + " (" + ((questMob.getDropChances()[1] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getDropChances()[1]) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobLeggings") + ChatColor.GRAY + " (" + ((questMob.inventory[2] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.inventory[2])) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "9" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobLeggings") + ChatColor.GRAY + " (" + ((questMob.getInventory()[2] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.getInventory()[2])) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobLeggingsDrop") + ChatColor.GRAY + " (" + ((questMob.dropChances[2] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.dropChances[2]) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "10" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobLeggingsDrop") + ChatColor.GRAY + " (" + ((questMob.getDropChances()[2] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getDropChances()[2]) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobChestPlate") + ChatColor.GRAY + " (" + ((questMob.inventory[3] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.inventory[3])) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "11" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobChestPlate") + ChatColor.GRAY + " (" + ((questMob.getInventory()[3] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.getInventory()[3])) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobChestPlateDrop") + ChatColor.GRAY + " (" + ((questMob.dropChances[3] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.dropChances[3]) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "12" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobChestPlateDrop") + ChatColor.GRAY + " (" + ((questMob.getDropChances()[3] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getDropChances()[3]) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobHelmet") + ChatColor.GRAY + " (" + ((questMob.inventory[4] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.inventory[4])) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "13" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobHelmet") + ChatColor.GRAY + " (" + ((questMob.getInventory()[4] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + ItemUtil.getDisplayString(questMob.getInventory()[4])) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobHelmetDrop") + ChatColor.GRAY + " (" + ((questMob.dropChances[4] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.dropChances[4]) + ChatColor.GRAY + ")\n";
|
text += ChatColor.BLUE + "" + ChatColor.BOLD + "14" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("eventEditorSetMobHelmetDrop") + ChatColor.GRAY + " (" + ((questMob.getDropChances()[4] == null) ? ChatColor.GRAY + Lang.get("noneSet") : ChatColor.AQUA + "" + questMob.getDropChances()[4]) + ChatColor.GRAY + ")\n";
|
||||||
text += ChatColor.GREEN + "" + ChatColor.BOLD + "15" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done") + "\n";
|
text += ChatColor.GREEN + "" + ChatColor.BOLD + "15" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("done") + "\n";
|
||||||
text += ChatColor.RED + "" + ChatColor.BOLD + "16" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("cancel");
|
text += ChatColor.RED + "" + ChatColor.BOLD + "16" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("cancel");
|
||||||
return text;
|
return text;
|
||||||
@ -1819,7 +1818,9 @@ public class EventFactory implements ConversationAbandonedListener {
|
|||||||
.replace("<least>", "0.0").replace("<greatest>", "1.0"));
|
.replace("<least>", "0.0").replace("<greatest>", "1.0"));
|
||||||
return new MobDropPrompt(invIndex, mobIndex, questMob);
|
return new MobDropPrompt(invIndex, mobIndex, questMob);
|
||||||
}
|
}
|
||||||
questMob.dropChances[invIndex] = chance;
|
Float[] temp = questMob.getDropChances();
|
||||||
|
temp[invIndex] = chance;
|
||||||
|
questMob.setDropChances(temp);
|
||||||
return new QuestMobPrompt(mobIndex, questMob);
|
return new QuestMobPrompt(mobIndex, questMob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1402,8 +1402,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
if (pln.getCooldown() != -1) {
|
if (pln.getCooldown() != -1) {
|
||||||
cc.setSessionData(CK.PLN_COOLDOWN, pln.getCooldown());
|
cc.setSessionData(CK.PLN_COOLDOWN, pln.getCooldown());
|
||||||
}
|
}
|
||||||
//
|
// Stages (Objectives)
|
||||||
// Stages
|
|
||||||
int index = 1;
|
int index = 1;
|
||||||
for (Stage stage : q.getStages()) {
|
for (Stage stage : q.getStages()) {
|
||||||
final String pref = "stage" + index;
|
final String pref = "stage" + index;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*******************************************************************************************************/
|
*******************************************************************************************************/
|
||||||
|
|
||||||
package me.blackvein.quests.util;
|
package me.blackvein.quests;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -20,7 +20,7 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.inventory.EntityEquipment;
|
import org.bukkit.inventory.EntityEquipment;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import me.blackvein.quests.Quests;
|
import me.blackvein.quests.util.ItemUtil;
|
||||||
|
|
||||||
public class QuestMob {
|
public class QuestMob {
|
||||||
|
|
||||||
@ -28,8 +28,11 @@ public class QuestMob {
|
|||||||
private EntityType entityType = null;
|
private EntityType entityType = null;
|
||||||
private Location spawnLocation = null;
|
private Location spawnLocation = null;
|
||||||
private Integer spawnAmounts = null;
|
private Integer spawnAmounts = null;
|
||||||
public ItemStack[] inventory = new ItemStack[5];
|
private ItemStack[] inventory = new ItemStack[5];
|
||||||
public Float[] dropChances = new Float[5];
|
private Float[] dropChances = new Float[5];
|
||||||
|
|
||||||
|
public QuestMob(){
|
||||||
|
}
|
||||||
|
|
||||||
public QuestMob(EntityType entityType, Location spawnLocation, int spawnAmounts) {
|
public QuestMob(EntityType entityType, Location spawnLocation, int spawnAmounts) {
|
||||||
this.entityType = entityType;
|
this.entityType = entityType;
|
||||||
@ -37,39 +40,52 @@ public class QuestMob {
|
|||||||
this.spawnAmounts = spawnAmounts;
|
this.spawnAmounts = spawnAmounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuestMob() {
|
public String getName() {
|
||||||
}
|
return name;
|
||||||
|
|
||||||
public void setSpawnLocation(Location spawnLocation) {
|
|
||||||
this.spawnLocation = spawnLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getSpawnLocation() {
|
|
||||||
return spawnLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(EntityType entityType) {
|
|
||||||
this.entityType = entityType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityType getType() {
|
|
||||||
return entityType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpawnAmounts(int spawnAmounts) {
|
|
||||||
this.spawnAmounts = spawnAmounts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSpawnAmounts() {
|
|
||||||
return spawnAmounts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public EntityType getType() {
|
||||||
return name;
|
return entityType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(EntityType entityType) {
|
||||||
|
this.entityType = entityType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getSpawnLocation() {
|
||||||
|
return spawnLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpawnLocation(Location spawnLocation) {
|
||||||
|
this.spawnLocation = spawnLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSpawnAmounts() {
|
||||||
|
return spawnAmounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpawnAmounts(int spawnAmounts) {
|
||||||
|
this.spawnAmounts = spawnAmounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack[] getInventory() {
|
||||||
|
return inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInventory(ItemStack[] inventory) {
|
||||||
|
this.inventory = inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Float[] getDropChances() {
|
||||||
|
return dropChances;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDropChances(Float[] dropChances) {
|
||||||
|
this.dropChances = dropChances;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHelmet(ItemStack helmet, float dropChance) {
|
public void setHelmet(ItemStack helmet, float dropChance) {
|
@ -1349,7 +1349,7 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sayPass(Quest quest, AsyncPlayerChatEvent evt) {
|
public void sayPassword(Quest quest, AsyncPlayerChatEvent evt) {
|
||||||
boolean done;
|
boolean done;
|
||||||
for (LinkedList<String> passes : getCurrentStage(quest).passwordPhrases) {
|
for (LinkedList<String> passes : getCurrentStage(quest).passwordPhrases) {
|
||||||
done = false;
|
done = false;
|
||||||
|
@ -306,7 +306,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
loadEvents();
|
loadEvents();
|
||||||
getLogger().log(Level.INFO, "" + quests.size() + " Quest(s) loaded.");
|
getLogger().log(Level.INFO, "" + quests.size() + " Quest(s) loaded.");
|
||||||
getLogger().log(Level.INFO, "" + events.size() + " Event(s) loaded.");
|
getLogger().log(Level.INFO, "" + events.size() + " Event(s) loaded.");
|
||||||
getLogger().log(Level.INFO, "" + Lang.getPhrases() + " Phrase(s) loaded.");
|
getLogger().log(Level.INFO, "" + Lang.size() + " Phrase(s) loaded.");
|
||||||
questers.putAll(getOnlineQuesters());
|
questers.putAll(getOnlineQuesters());
|
||||||
}
|
}
|
||||||
}, 5L);
|
}, 5L);
|
||||||
@ -537,9 +537,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
killDelay = config.getInt("kill-delay", 600);
|
killDelay = config.getInt("kill-delay", 600);
|
||||||
if (config.getString("language").equalsIgnoreCase("en")) {
|
if (config.getString("language").equalsIgnoreCase("en")) {
|
||||||
//Legacy
|
//Legacy
|
||||||
lang.iso = "en-US";
|
lang.setISO("en-US");
|
||||||
} else {
|
} else {
|
||||||
lang.iso = config.getString("language", "en-US");
|
lang.setISO(config.getString("language", "en-US"));
|
||||||
}
|
}
|
||||||
maxQuests = config.getInt("max-quests", maxQuests);
|
maxQuests = config.getInt("max-quests", maxQuests);
|
||||||
npcEffects = config.getBoolean("npc-effects.enabled", true);
|
npcEffects = config.getBoolean("npc-effects.enabled", true);
|
||||||
@ -2154,7 +2154,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
// Reload config from disc in-case a setting was changed
|
// Reload config from disc in-case a setting was changed
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
loadConfig();
|
loadConfig();
|
||||||
Lang.clearPhrases();
|
Lang.clear();
|
||||||
try {
|
try {
|
||||||
lang.loadLang();
|
lang.loadLang();
|
||||||
} catch (InvalidConfigurationException e) {
|
} catch (InvalidConfigurationException e) {
|
||||||
|
@ -335,7 +335,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (quester.containsObjective(quest, "password")) {
|
if (quester.containsObjective(quest, "password")) {
|
||||||
quester.sayPass(quest, evt);
|
quester.sayPassword(quest, evt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,9 @@ import org.bukkit.conversations.StringPrompt;
|
|||||||
|
|
||||||
public class DateTimePrompt extends FixedSetPrompt {
|
public class DateTimePrompt extends FixedSetPrompt {
|
||||||
|
|
||||||
Quests quests;
|
private Quests quests;
|
||||||
final Prompt oldPrompt;
|
private final Prompt oldPrompt;
|
||||||
String source = "";
|
private String source = "";
|
||||||
|
|
||||||
public DateTimePrompt(Quests plugin, Prompt old, String origin) {
|
public DateTimePrompt(Quests plugin, Prompt old, String origin) {
|
||||||
super("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
|
super("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
|
||||||
@ -65,7 +65,7 @@ public class DateTimePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
TimeZone tz = TimeZone.getTimeZone((String) cc.getSessionData("tempZone"));
|
TimeZone tz = TimeZone.getTimeZone((String) cc.getSessionData("tempZone"));
|
||||||
cal.setTimeZone(tz);
|
cal.setTimeZone(tz);
|
||||||
String[] iso = quests.lang.iso.split("-");
|
String[] iso = quests.lang.getISO().split("-");
|
||||||
Locale loc = new Locale(iso[0], iso[1]);
|
Locale loc = new Locale(iso[0], iso[1]);
|
||||||
Double hour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
Double hour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
||||||
String[] sep = String.valueOf(hour).replace("-", "").split("\\.");
|
String[] sep = String.valueOf(hour).replace("-", "").split("\\.");
|
||||||
|
@ -48,7 +48,7 @@ public class ItemStackPrompt extends FixedSetPrompt {
|
|||||||
// Stores display name in "tempDisplay"
|
// Stores display name in "tempDisplay"
|
||||||
// Stores lore in "tempLore"
|
// Stores lore in "tempLore"
|
||||||
// Stores metadata in "tempMeta"
|
// Stores metadata in "tempMeta"
|
||||||
final Prompt oldPrompt;
|
private final Prompt oldPrompt;
|
||||||
|
|
||||||
public ItemStackPrompt(Prompt old) {
|
public ItemStackPrompt(Prompt old) {
|
||||||
super("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
|
super("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
|
||||||
|
@ -31,8 +31,8 @@ import org.bukkit.conversations.StringPrompt;
|
|||||||
|
|
||||||
public class PlannerPrompt extends FixedSetPrompt {
|
public class PlannerPrompt extends FixedSetPrompt {
|
||||||
|
|
||||||
final Quests quests;
|
private final Quests quests;
|
||||||
final QuestFactory factory;
|
private final QuestFactory factory;
|
||||||
|
|
||||||
public PlannerPrompt(Quests plugin, QuestFactory qf) {
|
public PlannerPrompt(Quests plugin, QuestFactory qf) {
|
||||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
||||||
@ -178,7 +178,7 @@ public class PlannerPrompt extends FixedSetPrompt {
|
|||||||
|
|
||||||
TimeZone tz = TimeZone.getTimeZone(date[6]);
|
TimeZone tz = TimeZone.getTimeZone(date[6]);
|
||||||
cal.setTimeZone(tz);
|
cal.setTimeZone(tz);
|
||||||
String[] iso = quests.lang.iso.split("-");
|
String[] iso = quests.lang.getISO().split("-");
|
||||||
Locale loc = new Locale(iso[0], iso[1]);
|
Locale loc = new Locale(iso[0], iso[1]);
|
||||||
Double zhour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
Double zhour = (double) (cal.getTimeZone().getRawOffset() / 60 / 60 / 1000);
|
||||||
String[] sep = String.valueOf(zhour).replace("-", "").split("\\.");
|
String[] sep = String.valueOf(zhour).replace("-", "").split("\\.");
|
||||||
|
@ -30,9 +30,9 @@ import me.blackvein.quests.util.Lang;
|
|||||||
|
|
||||||
public class QuestAcceptPrompt extends StringPrompt {
|
public class QuestAcceptPrompt extends StringPrompt {
|
||||||
|
|
||||||
final Quests plugin;
|
private final Quests plugin;
|
||||||
Quester quester;
|
private Quester quester;
|
||||||
LinkedList<Quest> quests;
|
private LinkedList<Quest> quests;
|
||||||
|
|
||||||
public QuestAcceptPrompt(Quests plugin) {
|
public QuestAcceptPrompt(Quests plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
@ -40,8 +40,8 @@ import me.blackvein.quests.util.MiscUtil;
|
|||||||
|
|
||||||
public class RequirementsPrompt extends FixedSetPrompt {
|
public class RequirementsPrompt extends FixedSetPrompt {
|
||||||
|
|
||||||
Quests quests;
|
private Quests quests;
|
||||||
final QuestFactory factory;
|
private final QuestFactory factory;
|
||||||
|
|
||||||
public RequirementsPrompt(Quests plugin, QuestFactory qf) {
|
public RequirementsPrompt(Quests plugin, QuestFactory qf) {
|
||||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
||||||
|
@ -40,8 +40,8 @@ import me.blackvein.quests.util.Lang;
|
|||||||
|
|
||||||
public class RewardsPrompt extends FixedSetPrompt {
|
public class RewardsPrompt extends FixedSetPrompt {
|
||||||
|
|
||||||
final Quests quests;
|
private final Quests quests;
|
||||||
final QuestFactory factory;
|
private final QuestFactory factory;
|
||||||
|
|
||||||
public RewardsPrompt(Quests plugin, QuestFactory qf) {
|
public RewardsPrompt(Quests plugin, QuestFactory qf) {
|
||||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
||||||
|
@ -154,5 +154,5 @@ public class CK {
|
|||||||
public static final String E_TIMER = "evtTimer";
|
public static final String E_TIMER = "evtTimer";
|
||||||
public static final String E_CANCEL_TIMER = "evtCancelTimer";
|
public static final String E_CANCEL_TIMER = "evtCancelTimer";
|
||||||
// Party
|
// Party
|
||||||
public static final String P_INVITER = "inviter";
|
//public static final String P_INVITER = "inviter";
|
||||||
}
|
}
|
@ -36,7 +36,7 @@ import me.blackvein.quests.Quester;
|
|||||||
public class ItemUtil {
|
public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two stacks by name, amount, durability, display name, lore, enchantments and stored enchants
|
* Compare two stacks by name, amount, durability, display name, lore, enchantments, stored enchants and item flags
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param one first ItemStack to compare against second
|
* @param one first ItemStack to compare against second
|
||||||
|
@ -16,6 +16,7 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -32,9 +33,9 @@ import me.clip.placeholderapi.PlaceholderAPI;
|
|||||||
|
|
||||||
public class Lang {
|
public class Lang {
|
||||||
|
|
||||||
public String iso = "en-US";
|
private String iso = "en-US";
|
||||||
private static final LangToken tokens = new LangToken();
|
private static final LangToken tokens = new LangToken();
|
||||||
public static final LinkedHashMap<String, String> langMap = new LinkedHashMap<String, String>();
|
private static final LinkedHashMap<String, String> langMap = new LinkedHashMap<String, String>();
|
||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
|
|
||||||
public Lang(Quests plugin) {
|
public Lang(Quests plugin) {
|
||||||
@ -42,6 +43,18 @@ public class Lang {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getISO() {
|
||||||
|
return iso;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setISO(String iso) {
|
||||||
|
this.iso = iso;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<String> values() {
|
||||||
|
return langMap.values();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get lang string AND pass Player for use with PlaceholderAPI, if installed
|
* Get lang string AND pass Player for use with PlaceholderAPI, if installed
|
||||||
*
|
*
|
||||||
@ -91,11 +104,11 @@ public class Lang {
|
|||||||
return "NULL";
|
return "NULL";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearPhrases() {
|
public static void clear() {
|
||||||
langMap.clear();
|
langMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getPhrases() {
|
public static int size() {
|
||||||
return langMap.size();
|
return langMap.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user