Remove overkill hashCode, fixes #460. Bump version number

This commit is contained in:
BuildTools 2018-12-10 20:58:31 -05:00
parent 1f6a410723
commit bf7a0849b1
10 changed files with 17 additions and 554 deletions

View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId>
<version>3.4.9</version>
<version>3.5.0</version>
<name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging>

View File

@ -86,105 +86,6 @@ public class Event {
this.plugin = plugin;
}
public int hashCode() {
assert false : "hashCode not designed";
return 42; // any arbitrary constant will do
}
@Override
public boolean equals(Object o) {
if (o instanceof Event) {
Event other = (Event) o;
if (other.name.equals(name) == false) {
return false;
}
if (other.message != null && message != null) {
if (other.message.equals(message) == false) {
return false;
}
} else if (other.message != null && message == null) {
return false;
} else if (other.message == null && message != null) {
return false;
}
if (other.clearInv != clearInv) {
return false;
}
if (other.failQuest != failQuest) {
return false;
}
if (other.explosions.equals(explosions) == false) {
return false;
}
if (other.effects.entrySet().equals(effects.entrySet()) == false) {
return false;
}
if (other.items.equals(items) == false) {
return false;
}
if (other.stormWorld != null && stormWorld != null) {
if (other.stormWorld.equals(stormWorld) == false) {
return false;
}
} else if (other.stormWorld != null && stormWorld == null) {
return false;
} else if (other.stormWorld == null && stormWorld != null) {
return false;
}
if (other.stormDuration != stormDuration) {
return false;
}
if (other.thunderWorld != null && thunderWorld != null) {
if (other.thunderWorld.equals(thunderWorld) == false) {
return false;
}
} else if (other.thunderWorld != null && thunderWorld == null) {
return false;
} else if (other.thunderWorld == null && thunderWorld != null) {
return false;
}
if (other.thunderDuration != thunderDuration) {
return false;
}
for (QuestMob qm : mobSpawns) {
if (qm.equals(other.mobSpawns.get(mobSpawns.indexOf(qm))) == false) {
return false;
}
}
if (other.lightningStrikes.equals(lightningStrikes) == false) {
return false;
}
if (other.commands.equals(commands) == false) {
return false;
}
if (other.potionEffects.equals(potionEffects) == false) {
return false;
}
if (other.hunger != hunger) {
return false;
}
if (other.saturation != saturation) {
return false;
}
if (other.health != health) {
return false;
}
if (other.teleport != null && teleport != null) {
if (other.teleport.equals(teleport) == false) {
return false;
}
} else if (other.teleport != null && teleport == null) {
return false;
} else if (other.teleport == null && teleport != null) {
return false;
}
if (!other.book.equals(book)) {
return false;
}
}
return true;
}
public String getName() {
return name;
}

View File

@ -47,6 +47,7 @@ public class NpcListener implements Listener {
plugin = newPlugin;
}
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOWEST)
public void onNPCRightClick(NPCRightClickEvent evt) {
if (plugin.questFactory.selectingNPCs.contains(evt.getClicker())) {

View File

@ -71,7 +71,7 @@ public class Quest {
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;
//Planner
// Planner
public String startPlanner = null;
public String endPlanner = null;
public long repeatPlanner = -1;
@ -560,206 +560,6 @@ public class Quest {
q.updateJournal();
}
@Override
public boolean equals(Object o) {
if (o instanceof Quest) {
Quest other = (Quest) o;
if (other.blockStart != null && blockStart != null) {
if (other.blockStart.equals(blockStart) == false) {
return false;
}
} else if (other.blockStart != null && blockStart == null) {
return false;
} else if (other.blockStart == null && blockStart != null) {
return false;
}
if (commands.size() == other.commands.size()) {
for (int i = 0; i < commands.size(); i++) {
if (commands.get(i).equals(other.commands.get(i)) == false) {
return false;
}
}
} else {
return false;
}
if (other.description.equals(description) == false) {
return false;
}
if (other.initialEvent != null && initialEvent != null) {
if (other.initialEvent.equals(initialEvent) == false) {
return false;
}
} else if (other.initialEvent != null && initialEvent == null) {
return false;
} else if (other.initialEvent == null && initialEvent != null) {
return false;
}
if (other.exp != exp) {
return false;
}
if (other.failRequirements != null && failRequirements != null) {
if (other.failRequirements.equals(failRequirements) == false) {
return false;
}
} else if (other.failRequirements != null && failRequirements == null) {
return false;
} else if (other.failRequirements == null && failRequirements != null) {
return false;
}
if (other.finished.equals(finished) == false) {
return false;
}
if (other.items.equals(items) == false) {
return false;
}
if (other.itemRewards.equals(itemRewards) == false) {
return false;
}
if (other.mcmmoAmounts.equals(mcmmoAmounts) == false) {
return false;
}
if (other.mcmmoSkills.equals(mcmmoSkills) == false) {
return false;
}
if (other.heroesClasses.equals(heroesClasses) == false) {
return false;
}
if (other.heroesAmounts.equals(heroesAmounts) == false) {
return false;
}
if (other.phatLootRewards.equals(phatLootRewards) == false) {
return false;
}
if (other.moneyReq != moneyReq) {
return false;
}
if (other.moneyReward != moneyReward) {
return false;
}
if (other.name.equals(name) == false) {
return false;
}
if (other.neededQuests.equals(neededQuests) == false) {
return false;
}
if (other.blockQuests.equals(blockQuests) == false) {
return false;
}
if (other.npcStart != null && npcStart != null) {
if (other.npcStart.equals(npcStart) == false) {
return false;
}
} else if (other.npcStart != null && npcStart == null) {
return false;
} else if (other.npcStart == null && npcStart != null) {
return false;
}
if (other.permissionReqs.equals(permissionReqs) == false) {
return false;
}
if (other.heroesPrimaryClassReq != null && heroesPrimaryClassReq != null) {
if (other.heroesPrimaryClassReq.equals(heroesPrimaryClassReq) == false) {
return false;
}
} else if (other.heroesPrimaryClassReq != null && heroesPrimaryClassReq == null) {
return false;
} else if (other.heroesPrimaryClassReq == null && heroesPrimaryClassReq != null) {
return false;
}
if (other.heroesSecondaryClassReq != null && heroesSecondaryClassReq != null) {
if (other.heroesSecondaryClassReq.equals(heroesSecondaryClassReq) == false) {
return false;
}
} else if (other.heroesSecondaryClassReq != null && heroesSecondaryClassReq == null) {
return false;
} else if (other.heroesSecondaryClassReq == null && heroesSecondaryClassReq != null) {
return false;
}
if (other.customRequirements.equals(customRequirements) == false) {
return false;
}
if (other.customRewards.equals(customRewards) == false) {
return false;
}
if (other.permissions.equals(permissions) == false) {
return false;
}
if (other.mcMMOSkillReqs.equals(mcMMOSkillReqs) == false) {
return false;
}
if (other.mcMMOAmountReqs.equals(mcMMOAmountReqs) == false) {
return false;
}
if (other.questPoints != questPoints) {
return false;
}
if (other.questPointsReq != questPointsReq) {
return false;
}
if (other.orderedStages.equals(orderedStages) == false) {
return false;
}
if (!other.startPlanner.equals(startPlanner)) {
return false;
}
if (!other.endPlanner.equals(endPlanner)) {
return false;
}
if (other.repeatPlanner != repeatPlanner) {
return false;
}
if (other.cooldownPlanner != cooldownPlanner) {
return false;
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 53 * hash + (this.description != null ? this.description.hashCode() : 0);
hash = 53 * hash + (this.finished != null ? this.finished.hashCode() : 0);
hash = 53 * hash + (this.startPlanner != null ? this.startPlanner.hashCode() : 0);
hash = 53 * hash + (this.endPlanner != null ? this.endPlanner.hashCode() : 0);
hash = 53 * hash + (int) (this.repeatPlanner ^ (this.repeatPlanner >>> 32));
hash = 53 * hash + (int) (this.cooldownPlanner ^ (this.cooldownPlanner >>> 32));
hash = 53 * hash + (this.region != null ? this.region.hashCode() : 0);
hash = 53 * hash + (this.guiDisplay != null ? this.guiDisplay.hashCode() : 0);
hash = 53 * hash + (this.orderedStages != null ? this.orderedStages.hashCode() : 0);
hash = 53 * hash + (this.npcStart != null ? this.npcStart.hashCode() : 0);
hash = 53 * hash + (this.blockStart != null ? this.blockStart.hashCode() : 0);
hash = 53 * hash + (this.initialEvent != null ? this.initialEvent.hashCode() : 0);
hash = 53 * hash + this.moneyReq;
hash = 53 * hash + this.questPointsReq;
hash = 53 * hash + (this.items != null ? this.items.hashCode() : 0);
hash = 53 * hash + (this.neededQuests != null ? this.neededQuests.hashCode() : 0);
hash = 53 * hash + (this.blockQuests != null ? this.blockQuests.hashCode() : 0);
hash = 53 * hash + (this.permissionReqs != null ? this.permissionReqs.hashCode() : 0);
hash = 53 * hash + (this.mcMMOSkillReqs != null ? this.mcMMOSkillReqs.hashCode() : 0);
hash = 53 * hash + (this.mcMMOAmountReqs != null ? this.mcMMOAmountReqs.hashCode() : 0);
hash = 53 * hash + (this.heroesPrimaryClassReq != null ? this.heroesPrimaryClassReq.hashCode() : 0);
hash = 53 * hash + (this.heroesSecondaryClassReq != null ? this.heroesSecondaryClassReq.hashCode() : 0);
hash = 53 * hash + (this.customRequirements != null ? this.customRequirements.hashCode() : 0);
hash = 53 * hash + (this.customRewards != null ? this.customRewards.hashCode() : 0);
hash = 53 * hash + (this.failRequirements != null ? this.failRequirements.hashCode() : 0);
hash = 53 * hash + this.moneyReward;
hash = 53 * hash + this.questPoints;
hash = 53 * hash + this.exp;
hash = 53 * hash + (this.commands != null ? this.commands.hashCode() : 0);
hash = 53 * hash + (this.permissions != null ? this.permissions.hashCode() : 0);
hash = 53 * hash + (this.itemRewards != null ? this.itemRewards.hashCode() : 0);
hash = 53 * hash + (this.mcmmoSkills != null ? this.mcmmoSkills.hashCode() : 0);
hash = 53 * hash + (this.mcmmoAmounts != null ? this.mcmmoAmounts.hashCode() : 0);
hash = 53 * hash + (this.heroesClasses != null ? this.heroesClasses.hashCode() : 0);
hash = 53 * hash + (this.heroesAmounts != null ? this.heroesAmounts.hashCode() : 0);
hash = 53 * hash + (this.phatLootRewards != null ? this.phatLootRewards.hashCode() : 0);
return hash;
}
public boolean isInRegion(Player player) {
if (region == null) {
return true;

View File

@ -1293,6 +1293,7 @@ public class QuestFactory implements ConversationAbandonedListener {
}
}
@SuppressWarnings("deprecation")
public static void loadQuest(ConversationContext cc, Quest q) {
cc.setSessionData(CK.ED_QUEST_EDIT, q.name);
cc.setSessionData(CK.Q_NAME, q.name);

View File

@ -485,6 +485,7 @@ public class Quester {
return getObjectives(quest);
}
@SuppressWarnings("deprecation")
public LinkedList<String> getObjectives(Quest quest) {
if (getQuestData(quest) == null)
return new LinkedList<String>();
@ -826,6 +827,7 @@ public class Quester {
return false;
}
@SuppressWarnings("deprecation")
public void breakBlock(Quest quest, ItemStack m) {
ItemStack temp = m;
temp.setAmount(0);
@ -869,6 +871,7 @@ public class Quester {
}
}
@SuppressWarnings("deprecation")
public void damageBlock(Quest quest, ItemStack m) {
ItemStack temp = m;
temp.setAmount(0);
@ -912,6 +915,7 @@ public class Quester {
}
}
@SuppressWarnings("deprecation")
public void placeBlock(Quest quest, ItemStack m) {
ItemStack temp = m;
temp.setAmount(0);
@ -955,6 +959,7 @@ public class Quester {
}
}
@SuppressWarnings("deprecation")
public void useBlock(Quest quest, ItemStack m) {
ItemStack temp = m;
temp.setAmount(0);
@ -998,6 +1003,7 @@ public class Quester {
}
}
@SuppressWarnings("deprecation")
public void cutBlock(Quest quest, ItemStack m) {
ItemStack temp = m;
temp.setAmount(0);
@ -1076,14 +1082,12 @@ public class Quester {
return;
}
if (questData.mobsKilled.contains(e) == false) {
for (EntityType ee : questData.mobsKilled) {
}
return;
}
Stage currentStage = getCurrentStage(quest);
int indexOfMobKilled = questData.mobsKilled.indexOf(e);
Integer numberOfSpecificMobKilled = questData.mobNumKilled.get(indexOfMobKilled);
Integer numberOfSpecificMobNeedsToBeKilledInCurrentStage = currentStage.mobNumToKill.get(indexOfMobKilled);
int numberOfSpecificMobKilled = questData.mobNumKilled.get(indexOfMobKilled);
int numberOfSpecificMobNeedsToBeKilledInCurrentStage = currentStage.mobNumToKill.get(indexOfMobKilled);
if (questData.locationsToKillWithin.isEmpty() == false) {
Location locationToKillWithin = questData.locationsToKillWithin.get(indexOfMobKilled);
double radius = questData.radiiToKillWithin.get(indexOfMobKilled);
@ -1458,6 +1462,7 @@ public class Quester {
* @param quest Quest with at least one stage
* @param stage Where first stage is '0'
*/
@SuppressWarnings("deprecation")
public void addEmptiesFor(Quest quest, int stage) {
QuestData data = new QuestData(this);
data.setDoJournalUpdate(false);
@ -1700,6 +1705,7 @@ public class Quester {
return difference;
}
@SuppressWarnings("deprecation")
public FileConfiguration getBaseData() {
FileConfiguration data = new YamlConfiguration();
if (currentQuests.isEmpty() == false) {
@ -2001,6 +2007,7 @@ public class Quester {
return data;
}
@SuppressWarnings("deprecation")
public boolean loadData() {
FileConfiguration data = new YamlConfiguration();
try {

View File

@ -141,203 +141,4 @@ public class Stage {
if (playersToKill != null) { return true; }
return false;
}
public int hashCode() {
assert false : "hashCode not designed";
return 42; // any arbitrary constant will do
}
@Override
public boolean equals(Object o) {
if (o instanceof Stage) {
Stage other = (Stage) o;
if (other.blocksToBreak.equals(blocksToBreak) == false) {
return false;
}
if (other.blocksToDamage.equals(blocksToDamage) == false) {
return false;
}
if (other.blocksToPlace.equals(blocksToPlace) == false) {
return false;
}
if (other.blocksToUse.equals(blocksToUse) == false) {
return false;
}
if (other.blocksToCut.equals(blocksToCut) == false) {
return false;
}
if (other.fishToCatch != null && fishToCatch != null) {
if (other.fishToCatch.equals(fishToCatch) == false) {
return false;
}
} else if (other.fishToCatch != null && fishToCatch == null) {
return false;
} else if (other.fishToCatch == null && fishToCatch != null) {
return false;
}
if (other.playersToKill != null && playersToKill != null) {
if (other.playersToKill.equals(playersToKill) == false) {
return false;
}
} else if (other.playersToKill != null && playersToKill == null) {
return false;
} else if (other.playersToKill == null && playersToKill != null) {
return false;
}
if (other.itemsToEnchant.equals(itemsToEnchant) == false) {
return false;
}
if (other.mobsToKill.equals(mobsToKill) == false) {
return false;
}
if (other.mobNumToKill.equals(mobNumToKill) == false) {
return false;
}
if (other.locationsToKillWithin.equals(locationsToKillWithin) == false) {
return false;
}
if (other.radiiToKillWithin.equals(radiiToKillWithin) == false) {
return false;
}
if (other.areaNames.equals(areaNames) == false) {
return false;
}
if (other.itemsToDeliver.equals(itemsToDeliver) == false) {
return false;
}
if (other.itemDeliveryTargets.equals(itemDeliveryTargets) == false) {
return false;
}
if (other.deliverMessages.equals(deliverMessages) == false) {
return false;
}
if (other.citizensToInteract.equals(citizensToInteract) == false) {
return false;
}
if (other.citizensToKill.equals(citizensToKill) == false) {
return false;
}
if (other.citizenNumToKill.equals(citizenNumToKill) == false) {
return false;
}
if (other.locationsToReach.equals(locationsToReach) == false) {
return false;
}
if (other.radiiToReachWithin.equals(radiiToReachWithin) == false) {
return false;
}
if (other.worldsToReachWithin.equals(worldsToReachWithin) == false) {
return false;
}
if (other.locationNames.equals(locationNames) == false) {
return false;
}
if (other.mobsToTame.equals(mobsToTame) == false) {
return false;
}
if (other.sheepToShear.equals(sheepToShear) == false) {
return false;
}
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;
}
if (other.script != null && script != null) {
if (other.script.equals(script) == false) {
return false;
}
} else if (other.script != null && script == null) {
return false;
} else if (other.script == null && script != null) {
return false;
}
if (other.startEvent != null && startEvent != null) {
if (other.startEvent.equals(startEvent) == false) {
return false;
}
} else if (other.startEvent != null && startEvent == null) {
return false;
} else if (other.startEvent == null && startEvent != null) {
return false;
}
if (other.deathEvent != null && deathEvent != null) {
if (other.deathEvent.equals(deathEvent) == false) {
return false;
}
} else if (other.deathEvent != null && deathEvent == null) {
return false;
} else if (other.deathEvent == null && deathEvent != null) {
return false;
}
if (other.finishEvent != null && finishEvent != null) {
if (other.finishEvent.equals(finishEvent) == false) {
return false;
}
} else if (other.finishEvent != null && finishEvent == null) {
return false;
} else if (other.finishEvent == null && finishEvent != null) {
return false;
}
if (other.chatEvents.equals(chatEvents) == false) {
return false;
}
if (other.commandEvents.equals(commandEvents) == false) {
return false;
}
if (other.delay != delay) {
return false;
}
if (other.delayMessage != null && delayMessage != null) {
if (other.delayMessage.equals(delayMessage) == false) {
return false;
}
} else if (other.delayMessage != null && delayMessage == null) {
return false;
} else if (other.delayMessage == null && delayMessage != null) {
return false;
}
if (other.startMessage != null && startMessage != null) {
if (other.startMessage.equals(startMessage) == false) {
return false;
}
} else if (other.startMessage != null && startMessage == null) {
return false;
} else if (other.startMessage == null && startMessage != null) {
return false;
}
if (other.completeMessage != null && completeMessage != null) {
if (other.completeMessage.equals(completeMessage) == false) {
return false;
}
} else if (other.completeMessage != null && completeMessage == null) {
return false;
} else if (other.completeMessage == null && completeMessage != null) {
return false;
}
if (other.objectiveOverride != null && objectiveOverride != null) {
if (other.objectiveOverride.equals(objectiveOverride) == false) {
return false;
}
} else if (other.objectiveOverride != null && objectiveOverride == null) {
return false;
} else if (other.objectiveOverride == null && objectiveOverride != null) {
return false;
}
}
return true;
}
}

View File

@ -61,7 +61,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
this.questFactory = qf;
}
@SuppressWarnings({ "unchecked", "deprecation" })
@SuppressWarnings({ "unchecked" })
@Override
public String getPromptText(ConversationContext context) {
try {
@ -618,7 +618,6 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5");
}
@SuppressWarnings("deprecation")
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorBreakBlocks") + " -\n";
@ -836,7 +835,6 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5");
}
@SuppressWarnings("deprecation")
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorDamageBlocks") + " -\n";
@ -1054,7 +1052,6 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5");
}
@SuppressWarnings("deprecation")
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorPlaceBlocks") + " -\n";
@ -1272,7 +1269,6 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5");
}
@SuppressWarnings("deprecation")
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorUseBlocks") + " -\n";
@ -1490,7 +1486,6 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5");
}
@SuppressWarnings("deprecation")
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorCutBlocks") + " -\n";
@ -1768,7 +1763,6 @@ public class CreateStagePrompt extends FixedSetPrompt {
super("1", "2", "3", "4", "5");
}
@SuppressWarnings("deprecation")
@Override
public String getPromptText(ConversationContext context) {
String text = ChatColor.GOLD + "- " + Lang.get("stageEditorEnchantItems") + " -\n";

View File

@ -31,6 +31,7 @@ public class MiscUtil {
return s2 + s;
}
@SuppressWarnings("deprecation")
public static String getProperEnchantmentName(Enchantment enchantment) {
String name = enchantment.getName().toLowerCase();
return name;

View File

@ -245,47 +245,4 @@ public class QuestMob {
qm.dropChances = dropChances;
return qm;
}
public int hashCode() {
assert false : "hashCode not designed";
return 42; // any arbitrary constant will do
}
@Override
public boolean equals(Object o) {
if ((o instanceof QuestMob) == false) {
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 (!entityType.equals(other.entityType)) {
return false;
}
if (dropChances != other.dropChances) {
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 (!spawnAmounts.equals(other.spawnAmounts)) {
return false;
}
if (!spawnLocation.equals(other.spawnLocation)) {
return false;
}
return true;
}
}