mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-24 11:38:42 +01:00
Code cleanup
This commit is contained in:
parent
3370e50417
commit
d13683445d
@ -356,17 +356,6 @@ public class Quester {
|
||||
LinkedList<String> unfinishedObjectives = new LinkedList<String>();
|
||||
LinkedList<String> finishedObjectives = new LinkedList<String>();
|
||||
LinkedList<String> objectives = new LinkedList<String>();
|
||||
for (ItemStack e : getCurrentStage(quest).blocksToDamage) {
|
||||
for (ItemStack e2 : getQuestData(quest).blocksDamaged) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
if (e2.getAmount() < e.getAmount()) {
|
||||
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("damage") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
|
||||
} else {
|
||||
finishedObjectives.add(ChatColor.GRAY + Lang.get("damage") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ItemStack e : getCurrentStage(quest).blocksToBreak) {
|
||||
for (ItemStack e2 : getQuestData(quest).blocksBroken) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
@ -378,6 +367,17 @@ public class Quester {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ItemStack e : getCurrentStage(quest).blocksToDamage) {
|
||||
for (ItemStack e2 : getQuestData(quest).blocksDamaged) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
if (e2.getAmount() < e.getAmount()) {
|
||||
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("damage") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
|
||||
} else {
|
||||
finishedObjectives.add(ChatColor.GRAY + Lang.get("damage") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ItemStack e : getCurrentStage(quest).blocksToPlace) {
|
||||
for (ItemStack e2 : getQuestData(quest).blocksPlaced) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
@ -693,7 +693,6 @@ public class Quester {
|
||||
if (broken.getAmount() < toBreak.getAmount()) {
|
||||
ItemStack newBroken = broken;
|
||||
newBroken.setAmount(broken.getAmount() + 1);
|
||||
// TODO is this correct?
|
||||
getQuestData(quest).blocksBroken.set(getQuestData(quest).blocksBroken.indexOf(broken), newBroken);
|
||||
if (broken.getAmount() == toBreak.getAmount()) {
|
||||
finishObjective(quest, "breakBlock", m, null, null, null, null, null, null, null, null, null);
|
||||
@ -719,7 +718,6 @@ public class Quester {
|
||||
if (damaged.getAmount() < toDamage.getAmount()) {
|
||||
ItemStack newDamaged = damaged;
|
||||
newDamaged.setAmount(damaged.getAmount() + 1);
|
||||
// TODO is this correct?
|
||||
getQuestData(quest).blocksDamaged.set(getQuestData(quest).blocksDamaged.indexOf(damaged), newDamaged);
|
||||
if (damaged.getAmount() == toDamage.getAmount()) {
|
||||
finishObjective(quest, "damageBlock", m, null, null, null, null, null, null, null, null, null);
|
||||
@ -745,7 +743,6 @@ public class Quester {
|
||||
if (placed.getAmount() < toPlace.getAmount()) {
|
||||
ItemStack newplaced = placed;
|
||||
newplaced.setAmount(placed.getAmount() + 1);
|
||||
// TODO is this correct?
|
||||
getQuestData(quest).blocksPlaced.set(getQuestData(quest).blocksPlaced.indexOf(placed), newplaced);
|
||||
if (placed.getAmount() == toPlace.getAmount()) {
|
||||
finishObjective(quest, "placeBlock", m, null, null, null, null, null, null, null, null, null);
|
||||
@ -771,7 +768,6 @@ public class Quester {
|
||||
if (used.getAmount() < toUse.getAmount()) {
|
||||
ItemStack newUsed = used;
|
||||
newUsed.setAmount(used.getAmount() + 1);
|
||||
// TODO is this correct?
|
||||
getQuestData(quest).blocksUsed.set(getQuestData(quest).blocksUsed.indexOf(used), newUsed);
|
||||
if (used.getAmount() == toUse.getAmount()) {
|
||||
finishObjective(quest, "useBlock", m, null, null, null, null, null, null, null, null, null);
|
||||
@ -797,7 +793,6 @@ public class Quester {
|
||||
if (cut.getAmount() < toCut.getAmount()) {
|
||||
ItemStack newCut = cut;
|
||||
newCut.setAmount(cut.getAmount() + 1);
|
||||
// TODO is this correct?
|
||||
getQuestData(quest).blocksCut.set(getQuestData(quest).blocksCut.indexOf(cut), newCut);
|
||||
if (cut.getAmount() == toCut.getAmount()) {
|
||||
finishObjective(quest, "cutBlock", m, null, null, null, null, null, null, null, null, null);
|
||||
@ -930,9 +925,9 @@ public class Quester {
|
||||
}
|
||||
}
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
System.out.println("An error has occurred with Quests. Please report on Github. Include the info below");
|
||||
System.out.println("index = " + getQuestData(quest).locationsReached.indexOf(location));
|
||||
System.out.println("locationsReached = " + getQuestData(quest).locationsReached.toString());
|
||||
plugin.getLogger().severe("An error has occurred with Quests. Please report on Github. Include the info below");
|
||||
plugin.getLogger().severe("index = " + getQuestData(quest).locationsReached.indexOf(location));
|
||||
plugin.getLogger().severe("locationsReached = " + getQuestData(quest).locationsReached.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -1448,13 +1443,6 @@ public class Quester {
|
||||
data.citizenNumKilled.add(0);
|
||||
}
|
||||
}
|
||||
if (quest.getStage(stage).blocksToCut.isEmpty() == false) {
|
||||
for (ItemStack is : quest.getStage(stage).blocksToCut) {
|
||||
// TODO should be .set() ?
|
||||
is.setAmount(0);
|
||||
data.blocksCut.add(is);
|
||||
}
|
||||
}
|
||||
if (quest.getStage(stage).locationsToReach.isEmpty() == false) {
|
||||
for (Location l : quest.getStage(stage).locationsToReach) {
|
||||
data.locationsReached.add(l);
|
||||
|
@ -1115,7 +1115,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
cs.sendMessage(ChatColor.RED + Lang.get("questCmdNoPerms"));
|
||||
}
|
||||
} catch (NullPointerException npe) {
|
||||
System.out.println("Please report this full error in Github ticket #130");
|
||||
npe.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -1131,7 +1130,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
quester.hardClear();
|
||||
quester.saveData();
|
||||
quester.updateJournal();
|
||||
final File dataFolder = new File(this.getDataFolder(), "data/");
|
||||
final File dataFolder = new File(this.getDataFolder(), "data" + File.separator);
|
||||
final File found = new File(dataFolder, quester.id + ".yml");
|
||||
found.delete();
|
||||
addToBlacklist(quester.id);
|
||||
@ -1164,7 +1163,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
quester.hardClear();
|
||||
quester.saveData();
|
||||
quester.updateJournal();
|
||||
final File dataFolder = new File(this.getDataFolder(), "data/");
|
||||
final File dataFolder = new File(this.getDataFolder(), "data" + File.separator);
|
||||
final File found = new File(dataFolder, id + ".yml");
|
||||
found.delete();
|
||||
String msg = Lang.get("questReset");
|
||||
|
Loading…
Reference in New Issue
Block a user