mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-25 12:15:59 +01:00
Remove native GPS support. Add new Bukkit Event API. Bump version number
This commit is contained in:
parent
d42123a275
commit
7927806d41
2
dist/pom.xml
vendored
2
dist/pom.xml
vendored
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>3.6.9</version>
|
||||
<version>3.7.0</version>
|
||||
</parent>
|
||||
<artifactId>quests-dist</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>3.6.9</version>
|
||||
<version>3.7.0</version>
|
||||
</parent>
|
||||
<artifactId>quests-main</artifactId>
|
||||
|
||||
@ -112,11 +112,6 @@
|
||||
<artifactId>PhatLoots</artifactId>
|
||||
<version>-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.PikaMug</groupId>
|
||||
<artifactId>GPS</artifactId>
|
||||
<version>-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.DRE2N</groupId>
|
||||
<artifactId>DungeonsXL</artifactId>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -28,8 +28,6 @@ import com.alessiodp.parties.api.interfaces.PartiesAPI;
|
||||
import com.codisimus.plugins.phatloots.PhatLoots;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.herocraftonline.heroes.Heroes;
|
||||
import com.live.bemmamin.gps.Vars;
|
||||
import com.live.bemmamin.gps.api.GPSAPI;
|
||||
|
||||
import de.erethon.dungeonsxl.DungeonsXL;
|
||||
|
||||
@ -40,7 +38,6 @@ public class Dependencies {
|
||||
private static Permission permission = null;
|
||||
private static WorldGuardAPI worldGuardApi = null;
|
||||
private static mcMMO mcmmo = null;
|
||||
private static GPSAPI gpsapi = null;
|
||||
private static Heroes heroes = null;
|
||||
private static PhatLoots phatLoots = null;
|
||||
private static PlaceholderAPIPlugin placeholder = null;
|
||||
@ -70,10 +67,6 @@ public class Dependencies {
|
||||
return mcmmo;
|
||||
}
|
||||
|
||||
public GPSAPI getGpsApi() {
|
||||
return gpsapi;
|
||||
}
|
||||
|
||||
public Heroes getHeroes() {
|
||||
return heroes;
|
||||
}
|
||||
@ -138,10 +131,6 @@ public class Dependencies {
|
||||
if (isPluginAvailable("mcMMO")) {
|
||||
mcmmo = (mcMMO) plugin.getServer().getPluginManager().getPlugin("mcMMO");
|
||||
}
|
||||
if (isPluginAvailable("GPS") && plugin.getSettings().canUseGPS()) {
|
||||
gpsapi = new GPSAPI(plugin);
|
||||
Vars.getInstance().setMaxDistanceToEntry(9999.0);
|
||||
}
|
||||
if (isPluginAvailable("Heroes")) {
|
||||
heroes = (Heroes) plugin.getServer().getPluginManager().getPlugin("Heroes");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -39,6 +39,12 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
import de.erethon.dungeonsxl.player.DGroup;
|
||||
import me.blackvein.quests.actions.Action;
|
||||
import me.blackvein.quests.events.quester.QuesterPostChangeStageEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPostCompleteQuestEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPostFailQuestEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPreChangeStageEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPreCompleteQuestEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPreFailQuestEvent;
|
||||
import me.blackvein.quests.exceptions.InvalidStageException;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
@ -149,7 +155,7 @@ public class Quest {
|
||||
return initialAction;
|
||||
}
|
||||
|
||||
public void setInitialActino(Action initialAction) {
|
||||
public void setInitialAction(Action initialAction) {
|
||||
this.initialAction = initialAction;
|
||||
}
|
||||
|
||||
@ -237,6 +243,12 @@ public class Quest {
|
||||
throw new InvalidStageException(this, stage);
|
||||
}
|
||||
Stage currentStage = quester.getCurrentStage(this);
|
||||
Stage nextStage = quester.getCurrentStage(this);
|
||||
QuesterPreChangeStageEvent preEvent = new QuesterPreChangeStageEvent(quester, this, currentStage, nextStage);
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
quester.hardQuit(this);
|
||||
quester.hardStagePut(this, stage);
|
||||
quester.addEmptiesFor(this, stage);
|
||||
@ -246,12 +258,10 @@ public class Quest {
|
||||
/*
|
||||
* if (quester.getCurrentStage(this).finishEvent != null) { quester.getCurrentStage(this).finishEvent.fire(quester); }
|
||||
*/
|
||||
Stage nextStage = quester.getCurrentStage(this);
|
||||
if (nextStage.startEvent != null) {
|
||||
nextStage.startEvent.fire(quester, this);
|
||||
}
|
||||
updateCompass(quester, nextStage);
|
||||
updateGPS(quester);
|
||||
String msg = Lang.get(quester.getPlayer(), "questObjectivesTitle");
|
||||
msg = msg.replace("<quest>", name);
|
||||
quester.getPlayer().sendMessage(ChatColor.GOLD + msg);
|
||||
@ -261,62 +271,8 @@ public class Quest {
|
||||
quester.getPlayer().sendMessage(plugin.parseStringWithPossibleLineBreaks(stageStartMessage, this, quester.getPlayer()));
|
||||
}
|
||||
quester.updateJournal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add location-objective points for GPS and begin navigation.<p>
|
||||
*
|
||||
* Do not call this method multiple times.
|
||||
*
|
||||
* @param quester The quester to have their GPS updated
|
||||
* @return true if successful
|
||||
*/
|
||||
protected boolean updateGPS(Quester quester) {
|
||||
if (plugin.getDependencies().getGpsApi() == null) {
|
||||
return false;
|
||||
}
|
||||
Stage stage = quester.getCurrentStage(this);
|
||||
LinkedList<Location> targetLocations = new LinkedList<Location>();
|
||||
if (stage == null) {
|
||||
return false;
|
||||
}
|
||||
if (stage.citizensToInteract != null && stage.citizensToInteract.size() > 0) {
|
||||
for (Integer i : stage.citizensToInteract) {
|
||||
targetLocations.add(plugin.getNPCLocation(i));
|
||||
}
|
||||
} else if (stage.citizensToKill != null && stage.citizensToKill.size() > 0) {
|
||||
for (Integer i : stage.citizensToKill) {
|
||||
targetLocations.add(plugin.getNPCLocation(i));
|
||||
}
|
||||
} else if (stage.locationsToReach != null && stage.locationsToReach.size() > 0) {
|
||||
targetLocations.addAll(stage.locationsToReach);
|
||||
} else if (stage.itemDeliveryTargets != null && stage.itemDeliveryTargets.size() > 0) {
|
||||
for (Integer i : stage.itemDeliveryTargets) {
|
||||
NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getById(i);
|
||||
targetLocations.add(npc.getStoredLocation());
|
||||
}
|
||||
}
|
||||
if (targetLocations != null && !targetLocations.isEmpty()) {
|
||||
int index = 1;
|
||||
String pointName = "quests-" + quester.getPlayer().getUniqueId().toString() + "-" + stage.toString() + "-";
|
||||
for (Location l : targetLocations) {
|
||||
if (l.getWorld().getName().equals(quester.getPlayer().getWorld().getName())) {
|
||||
if (!plugin.getDependencies().getGpsApi().gpsIsActive(quester.getPlayer())) {
|
||||
plugin.getDependencies().getGpsApi().addPoint(pointName + index, l);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 1 ; i < targetLocations.size(); i++) {
|
||||
if (!plugin.getDependencies().getGpsApi().gpsIsActive(quester.getPlayer())) {
|
||||
plugin.getDependencies().getGpsApi().connect(pointName + i, pointName + (i + 1), true);
|
||||
}
|
||||
}
|
||||
if (!plugin.getDependencies().getGpsApi().gpsIsActive(quester.getPlayer())) {
|
||||
plugin.getDependencies().getGpsApi().startGPS(quester.getPlayer(), pointName + (index - 1));
|
||||
}
|
||||
}
|
||||
return targetLocations != null && !targetLocations.isEmpty();
|
||||
QuesterPostChangeStageEvent postEvent = new QuesterPostChangeStageEvent(quester, this, currentStage, nextStage);
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -457,6 +413,11 @@ public class Quest {
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void completeQuest(Quester q) {
|
||||
QuesterPreCompleteQuestEvent preEvent = new QuesterPreCompleteQuestEvent(q, this);
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
final Player player = plugin.getServer().getPlayer(q.getUUID());
|
||||
q.hardQuit(this);
|
||||
if (!q.completedQuests.contains(name)) {
|
||||
@ -596,7 +557,7 @@ public class Quest {
|
||||
if (!i.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)) {
|
||||
text += ChatColor.GRAY + " " + Lang.get(player, "with") + ChatColor.DARK_PURPLE;
|
||||
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
||||
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
|
||||
text += " " + ItemUtil.getPrettyEnchantmentName(e.getKey()) + ":" + e.getValue();
|
||||
}
|
||||
}
|
||||
} catch (Throwable tr) {
|
||||
@ -610,7 +571,7 @@ public class Quest {
|
||||
} else {
|
||||
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " " + Lang.get(player, "with");
|
||||
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
||||
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
|
||||
text += " " + ItemUtil.getPrettyEnchantmentName(e.getKey()) + ":" + e.getValue();
|
||||
}
|
||||
text += ChatColor.GRAY + " x " + i.getAmount();
|
||||
}
|
||||
@ -623,7 +584,7 @@ public class Quest {
|
||||
if (!i.getItemMeta().hasItemFlag(ItemFlag.HIDE_ENCHANTS)) {
|
||||
text += ChatColor.GRAY + " " + Lang.get(player, "with");
|
||||
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
|
||||
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
|
||||
text += " " + ItemUtil.getPrettyEnchantmentName(e.getKey()) + ":" + e.getValue();
|
||||
}
|
||||
}
|
||||
} catch (Throwable tr) {
|
||||
@ -718,12 +679,9 @@ public class Quest {
|
||||
q.saveData();
|
||||
player.updateInventory();
|
||||
q.updateJournal();
|
||||
if (plugin.getDependencies().getGpsApi() != null) {
|
||||
if (plugin.getDependencies().getGpsApi().gpsIsActive(player)) {
|
||||
plugin.getDependencies().getGpsApi().stopGPS(player);
|
||||
}
|
||||
}
|
||||
q.findCompassTarget();
|
||||
QuesterPostCompleteQuestEvent postEvent = new QuesterPostCompleteQuestEvent(q, this);
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -733,6 +691,11 @@ public class Quest {
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void failQuest(Quester q) {
|
||||
QuesterPreFailQuestEvent preEvent = new QuesterPreFailQuestEvent(q, this);
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (plugin.getServer().getPlayer(q.getUUID()) != null) {
|
||||
Player player = plugin.getServer().getPlayer(q.getUUID());
|
||||
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questObjectivesTitle").replace("<quest>", name));
|
||||
@ -745,6 +708,8 @@ public class Quest {
|
||||
q.saveData();
|
||||
}
|
||||
q.updateJournal();
|
||||
QuesterPostFailQuestEvent postEvent = new QuesterPostFailQuestEvent(q, this);
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -56,6 +56,7 @@ import me.blackvein.quests.prompts.StagesPrompt;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import me.blackvein.quests.util.MiscUtil;
|
||||
import me.blackvein.quests.util.WorldGuardAPI;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
|
||||
@ -1630,7 +1631,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
amounts.add(e.getValue());
|
||||
for (Entry<Enchantment, Material> e2 : e.getKey().entrySet()) {
|
||||
names.add(e2.getValue().name());
|
||||
enchants.add(Quester.prettyEnchantmentString(e2.getKey()));
|
||||
enchants.add(ItemUtil.getPrettyEnchantmentName(e2.getKey()));
|
||||
}
|
||||
}
|
||||
cc.setSessionData(pref + CK.S_ENCHANT_TYPES, enchants);
|
||||
@ -1674,7 +1675,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
if (stage.mobsToKill.isEmpty() == false) {
|
||||
LinkedList<String> mobs = new LinkedList<String>();
|
||||
for (EntityType et : stage.mobsToKill) {
|
||||
mobs.add(Quester.prettyMobString(et));
|
||||
mobs.add(MiscUtil.getPrettyMobName(et));
|
||||
}
|
||||
cc.setSessionData(pref + CK.S_MOB_TYPES, mobs);
|
||||
cc.setSessionData(pref + CK.S_MOB_AMOUNTS, stage.mobNumToKill);
|
||||
@ -1701,7 +1702,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
LinkedList<String> mobs = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
for (Entry<EntityType, Integer> e : stage.mobsToTame.entrySet()) {
|
||||
mobs.add(Quester.prettyMobString(e.getKey()));
|
||||
mobs.add(MiscUtil.getPrettyMobName(e.getKey()));
|
||||
amnts.add(e.getValue());
|
||||
}
|
||||
cc.setSessionData(pref + CK.S_TAME_TYPES, mobs);
|
||||
@ -1711,7 +1712,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
LinkedList<String> colors = new LinkedList<String>();
|
||||
LinkedList<Integer> amnts = new LinkedList<Integer>();
|
||||
for (Entry<DyeColor, Integer> e : stage.sheepToShear.entrySet()) {
|
||||
colors.add(Quester.prettyColorString(e.getKey()));
|
||||
colors.add(MiscUtil.getPrettyDyeColorName(e.getKey()));
|
||||
amnts.add(e.getValue());
|
||||
}
|
||||
cc.setSessionData(pref + CK.S_SHEAR_COLORS, colors);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -40,13 +40,14 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import me.blackvein.quests.events.quester.QuesterPostStartQuestEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPreStartQuestEvent;
|
||||
import me.blackvein.quests.timers.StageTimer;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
@ -387,6 +388,11 @@ public class Quester {
|
||||
public void takeQuest(Quest q, boolean override) {
|
||||
if (q == null) {
|
||||
return;
|
||||
}
|
||||
QuesterPreStartQuestEvent preEvent = new QuesterPreStartQuestEvent(this, q);
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
Player player = getPlayer();
|
||||
Planner pln = q.getPlanner();
|
||||
@ -513,11 +519,12 @@ public class Quester {
|
||||
stage.startEvent.fire(this, q);
|
||||
}
|
||||
q.updateCompass(this, stage);
|
||||
q.updateGPS(this);
|
||||
saveData();
|
||||
} else {
|
||||
player.sendMessage(q.getRequirements().getFailRequirements());
|
||||
}
|
||||
QuesterPostStartQuestEvent postEvent = new QuesterPostStartQuestEvent(this, q);
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -669,12 +676,12 @@ public class Quester {
|
||||
if (num1 < num2) {
|
||||
String obj = Lang.get(getPlayer(), "enchantItem");
|
||||
obj = obj.replace("<item>", ItemUtil.getName(new ItemStack(mat)) + ChatColor.GREEN);
|
||||
obj = obj.replace("<enchantment>", ChatColor.LIGHT_PURPLE + Quester.prettyEnchantmentString(enchantment) + ChatColor.GREEN);
|
||||
obj = obj.replace("<enchantment>", ChatColor.LIGHT_PURPLE + ItemUtil.getPrettyEnchantmentName(enchantment) + ChatColor.GREEN);
|
||||
unfinishedObjectives.add(ChatColor.GREEN + obj + ChatColor.GREEN + ": " + num1 + "/" + num2);
|
||||
} else {
|
||||
String obj = Lang.get(getPlayer(), "enchantItem");
|
||||
obj = obj.replace("<item>", ItemUtil.getName(new ItemStack(mat)) + ChatColor.GRAY);
|
||||
obj = obj.replace("<enchantment>", ChatColor.LIGHT_PURPLE + Quester.prettyEnchantmentString(enchantment) + ChatColor.GRAY);
|
||||
obj = obj.replace("<enchantment>", ChatColor.LIGHT_PURPLE + ItemUtil.getPrettyEnchantmentName(enchantment) + ChatColor.GRAY);
|
||||
finishedObjectives.add(ChatColor.GRAY + obj + ChatColor.GRAY + ": " + num1 + "/" + num2);
|
||||
}
|
||||
}
|
||||
@ -698,12 +705,12 @@ public class Quester {
|
||||
< getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(e))) {
|
||||
if (getCurrentStage(quest).locationsToKillWithin.isEmpty()) {
|
||||
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "kill") + " "
|
||||
+ ChatColor.AQUA + Quester.prettyMobString(e) + ChatColor.GREEN + ": "
|
||||
+ ChatColor.AQUA + MiscUtil.getPrettyMobName(e) + ChatColor.GREEN + ": "
|
||||
+ (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2)))
|
||||
+ "/" + (getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(e))));
|
||||
} else {
|
||||
String obj = Lang.get(getPlayer(), "killAtLocation");
|
||||
obj = obj.replace("<mob>", ChatColor.LIGHT_PURPLE + Quester.prettyMobString(e));
|
||||
obj = obj.replace("<mob>", ChatColor.LIGHT_PURPLE + MiscUtil.getPrettyMobName(e));
|
||||
obj = obj.replace("<location>", getCurrentStage(quest).killNames.get(getCurrentStage(quest).mobsToKill.indexOf(e)));
|
||||
unfinishedObjectives.add(ChatColor.GREEN + obj + ChatColor.GREEN + ": "
|
||||
+ (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2)))
|
||||
@ -712,12 +719,12 @@ public class Quester {
|
||||
} else {
|
||||
if (getCurrentStage(quest).locationsToKillWithin.isEmpty()) {
|
||||
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "kill") + " "
|
||||
+ ChatColor.AQUA + Quester.prettyMobString(e) + ChatColor.GRAY + ": "
|
||||
+ ChatColor.AQUA + MiscUtil.getPrettyMobName(e) + ChatColor.GRAY + ": "
|
||||
+ (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2)))
|
||||
+ "/" + (getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(e))));
|
||||
} else {
|
||||
String obj = Lang.get(getPlayer(), "killAtLocation");
|
||||
obj = obj.replace("<mob>", ChatColor.LIGHT_PURPLE + Quester.prettyMobString(e));
|
||||
obj = obj.replace("<mob>", ChatColor.LIGHT_PURPLE + MiscUtil.getPrettyMobName(e));
|
||||
obj = obj.replace("<location>", getCurrentStage(quest).killNames.get(getCurrentStage(quest).mobsToKill.indexOf(e)));
|
||||
finishedObjectives.add(ChatColor.GRAY + obj + ChatColor.GRAY + ": "
|
||||
+ (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2)))
|
||||
@ -796,10 +803,10 @@ public class Quester {
|
||||
for (Entry<EntityType, Integer> e2 : getQuestData(quest).mobsTamed.entrySet()) {
|
||||
if (e.getKey().equals(e2.getKey())) {
|
||||
if (e2.getValue() < e.getValue()) {
|
||||
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "tame") + " " + getCapitalized(e.getKey().name())
|
||||
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "tame") + " " + MiscUtil.getCapitalized(e.getKey().name())
|
||||
+ ChatColor.GREEN + ": " + e2.getValue() + "/" + e.getValue());
|
||||
} else {
|
||||
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "tame") + " " + getCapitalized(e.getKey().name())
|
||||
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "tame") + " " + MiscUtil.getCapitalized(e.getKey().name())
|
||||
+ ChatColor.GRAY + ": " + e2.getValue() + "/" + e.getValue());
|
||||
}
|
||||
}
|
||||
@ -1929,125 +1936,6 @@ public class Quester {
|
||||
hardDataPut(quest, data);
|
||||
}
|
||||
|
||||
public static String getCapitalized(String target) {
|
||||
String firstLetter = target.substring(0, 1);
|
||||
String remainder = target.substring(1);
|
||||
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
|
||||
return capitalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up item names. 'WOODEN_BUTTON' becomes 'Wooden Button'
|
||||
*
|
||||
* @param itemName any item name, ideally
|
||||
* @return cleaned-up string
|
||||
*/
|
||||
public static String prettyItemString(String itemName) {
|
||||
String baseString = Material.matchMaterial(itemName).toString();
|
||||
String[] substrings = baseString.split("_");
|
||||
String prettyString = "";
|
||||
int size = 1;
|
||||
for (String s : substrings) {
|
||||
prettyString = prettyString.concat(Quester.getCapitalized(s));
|
||||
if (size < substrings.length) {
|
||||
prettyString = prettyString.concat(" ");
|
||||
}
|
||||
size++;
|
||||
}
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets player-friendly name from type. 'ENDER_DRAGON' becomes 'Ender Dragon'
|
||||
*
|
||||
* @param type any mob type, ideally
|
||||
* @return cleaned-up string
|
||||
*/
|
||||
public static String prettyMobString(EntityType type) {
|
||||
String baseString = type.toString();
|
||||
String[] substrings = baseString.split("_");
|
||||
String prettyString = "";
|
||||
int size = 1;
|
||||
for (String s : substrings) {
|
||||
prettyString = prettyString.concat(Quester.getCapitalized(s));
|
||||
if (size < substrings.length) {
|
||||
prettyString = prettyString.concat(" ");
|
||||
}
|
||||
size++;
|
||||
}
|
||||
if (type.equals((EntityType.OCELOT))) {
|
||||
prettyString = "Ocelot";
|
||||
}
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
public static String prettyColorString(DyeColor color) {
|
||||
return Lang.get("COLOR_" + color.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets player-friendly name from enchantment. 'FIRE_ASPECT' becomes 'Fire Aspect'
|
||||
*
|
||||
* @param e Enchantment to get pretty localized name of
|
||||
* @return pretty localized name
|
||||
*/
|
||||
public static String prettyEnchantmentString(Enchantment e) {
|
||||
String prettyString = enchantmentString(e);
|
||||
prettyString = capitalsToSpaces(prettyString);
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name of enchantment exactly as it appears in lang file
|
||||
*
|
||||
* @param e Enchantment to get localized name of
|
||||
* @return localized name
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // since 1.13
|
||||
public static String enchantmentString(Enchantment e) {
|
||||
try {
|
||||
return (Lang.get("ENCHANTMENT_" + e.getName()));
|
||||
} catch (NullPointerException ne) {
|
||||
Bukkit.getLogger().warning(e.getName() + " was not found in Lang.yml, please ask the developer to "
|
||||
+ "update the file or simply add an entry for the enchantment");
|
||||
return e.getName().toLowerCase().replace("_", " ");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single space in front of all capital letters
|
||||
*
|
||||
* @param s string to process
|
||||
* @return processed string
|
||||
*/
|
||||
public static String capitalsToSpaces(String s) {
|
||||
int max = s.length();
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Capitalize character after space
|
||||
*
|
||||
* @param s string to process
|
||||
* @return processed string
|
||||
*/
|
||||
public static String spaceToCapital(String s) {
|
||||
int index = s.indexOf(' ');
|
||||
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;
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
FileConfiguration data = getBaseData();
|
||||
try {
|
||||
@ -2174,7 +2062,7 @@ public class Quester {
|
||||
Map<Enchantment, Material> enchMap = (Map<Enchantment, Material>) e.getKey();
|
||||
enchAmounts.add(questData.itemsEnchanted.get(enchMap));
|
||||
for (Entry<Enchantment, Material> e2 : enchMap.entrySet()) {
|
||||
enchantments.add(Quester.prettyEnchantmentString((Enchantment) e2.getKey()));
|
||||
enchantments.add(ItemUtil.getPrettyEnchantmentName((Enchantment) e2.getKey()));
|
||||
itemNames.add(((Material) e2.getValue()).name());
|
||||
}
|
||||
}
|
||||
@ -2194,7 +2082,7 @@ public class Quester {
|
||||
LinkedList<String> locations = new LinkedList<String>();
|
||||
LinkedList<Integer> radii = new LinkedList<Integer>();
|
||||
for (EntityType e : questData.mobsKilled) {
|
||||
mobNames.add(Quester.prettyMobString(e));
|
||||
mobNames.add(MiscUtil.getPrettyMobName(e));
|
||||
}
|
||||
for (int i : questData.mobNumKilled) {
|
||||
mobAmounts.add(i);
|
||||
@ -2268,7 +2156,7 @@ public class Quester {
|
||||
LinkedList<String> mobNames = new LinkedList<String>();
|
||||
LinkedList<Integer> mobAmounts = new LinkedList<Integer>();
|
||||
for (EntityType e : questData.mobsTamed.keySet()) {
|
||||
mobNames.add(Quester.prettyMobString(e));
|
||||
mobNames.add(MiscUtil.getPrettyMobName(e));
|
||||
mobAmounts.add(questData.mobsTamed.get(e));
|
||||
}
|
||||
questSec.set("mobs-to-tame", mobNames);
|
||||
@ -2278,7 +2166,7 @@ public class Quester {
|
||||
LinkedList<String> colors = new LinkedList<String>();
|
||||
LinkedList<Integer> shearAmounts = new LinkedList<Integer>();
|
||||
for (DyeColor d : questData.sheepSheared.keySet()) {
|
||||
colors.add(Quester.prettyColorString(d));
|
||||
colors.add(MiscUtil.getPrettyDyeColorName(d));
|
||||
shearAmounts.add(questData.sheepSheared.get(d));
|
||||
}
|
||||
questSec.set("sheep-to-shear", colors);
|
||||
@ -2583,7 +2471,7 @@ public class Quester {
|
||||
List<String> names = questSec.getStringList("enchantment-item-names");
|
||||
List<Integer> times = questSec.getIntegerList("times-enchanted");
|
||||
for (String s : enchantNames) {
|
||||
enchantments.add(Quests.getEnchantment(s));
|
||||
enchantments.add(ItemUtil.getEnchantmentFromProperName(s));
|
||||
materials.add(Material.matchMaterial(names.get(enchantNames.indexOf(s))));
|
||||
amounts.add(times.get(enchantNames.indexOf(s)));
|
||||
}
|
||||
@ -2696,7 +2584,7 @@ public class Quester {
|
||||
List<String> colors = questSec.getStringList("sheep-to-shear");
|
||||
List<Integer> amounts = questSec.getIntegerList("sheep-sheared");
|
||||
for (String color : colors) {
|
||||
getQuestData(quest).sheepSheared.put(Quests.getDyeColor(color), amounts.get(colors.indexOf(color)));
|
||||
getQuestData(quest).sheepSheared.put(MiscUtil.getDyeColor(color), amounts.get(colors.indexOf(color)));
|
||||
}
|
||||
}
|
||||
if (questSec.contains("passwords")) {
|
||||
@ -2743,132 +2631,6 @@ public class Quester {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static ConfigurationSection getLegacyQuestData(FileConfiguration questSec, String questName) {
|
||||
ConfigurationSection newData = questSec.createSection("questData");
|
||||
if (questSec.contains("blocks-broken-names")) {
|
||||
List<String> names = questSec.getStringList("blocks-broken-names");
|
||||
List<Integer> amounts = questSec.getIntegerList("blocks-broken-amounts");
|
||||
newData.set(questName + ".blocks-broken-names", names);
|
||||
newData.set(questName + ".blocks-broken-amounts", amounts);
|
||||
}
|
||||
if (questSec.contains("blocks-damaged-names")) {
|
||||
List<String> names = questSec.getStringList("blocks-damaged-names");
|
||||
List<Integer> amounts = questSec.getIntegerList("blocks-damaged-amounts");
|
||||
newData.set(questName + ".blocks-damaged-names", names);
|
||||
newData.set(questName + ".blocks-damaged-amounts", amounts);
|
||||
}
|
||||
if (questSec.contains("blocks-placed-names")) {
|
||||
List<String> names = questSec.getStringList("blocks-placed-names");
|
||||
List<Integer> amounts = questSec.getIntegerList("blocks-placed-amounts");
|
||||
newData.set(questName + ".blocks-placed-names", names);
|
||||
newData.set(questName + ".blocks-placed-amounts", amounts);
|
||||
}
|
||||
if (questSec.contains("blocks-used-names")) {
|
||||
List<String> names = questSec.getStringList("blocks-used-names");
|
||||
List<Integer> amounts = questSec.getIntegerList("blocks-used-amounts");
|
||||
newData.set(questName + ".blocks-used-names", names);
|
||||
newData.set(questName + ".blocks-used-amounts", amounts);
|
||||
}
|
||||
if (questSec.contains("blocks-cut-names")) {
|
||||
List<String> names = questSec.getStringList("blocks-cut-names");
|
||||
List<Integer> amounts = questSec.getIntegerList("blocks-cut-amounts");
|
||||
newData.set(questName + ".blocks-cut-names", names);
|
||||
newData.set(questName + ".blocks-cut-amounts", amounts);
|
||||
}
|
||||
if (questSec.contains("fish-caught")) {
|
||||
newData.set(questName + ".fish-caught", questSec.getInt("fish-caught"));
|
||||
}
|
||||
if (questSec.contains("players-killed")) {
|
||||
newData.set(questName + ".players-killed", questSec.getInt("players-killed"));
|
||||
}
|
||||
if (questSec.contains("enchantments")) {
|
||||
List<String> enchantNames = questSec.getStringList("enchantments");
|
||||
List<String> names = questSec.getStringList("enchantment-item-names");
|
||||
List<Integer> times = questSec.getIntegerList("times-enchanted");
|
||||
newData.set(questName + ".enchantments", enchantNames);
|
||||
newData.set(questName + ".enchantment-item-names", names);
|
||||
newData.set(questName + ".times-enchanted", times);
|
||||
}
|
||||
if (questSec.contains("mobs-killed")) {
|
||||
List<String> mobs = questSec.getStringList("mobs-killed");
|
||||
List<Integer> amounts = questSec.getIntegerList("mobs-killed-amounts");
|
||||
newData.set(questName + ".mobs-killed", mobs);
|
||||
newData.set(questName + ".mobs-killed-amounts", amounts);
|
||||
if (questSec.contains("mob-kill-locations")) {
|
||||
List<String> locations = questSec.getStringList("mob-kill-locations");
|
||||
List<Integer> radii = questSec.getIntegerList("mob-kill-location-radii");
|
||||
newData.set(questName + ".mob-kill-locations", locations);
|
||||
newData.set(questName + ".mob-kill-location-radii", radii);
|
||||
}
|
||||
}
|
||||
if (questSec.contains("item-delivery-amounts")) {
|
||||
List<Integer> deliveryAmounts = questSec.getIntegerList("item-delivery-amounts");
|
||||
newData.set(questName + ".item-delivery-amounts", deliveryAmounts);
|
||||
}
|
||||
if (questSec.contains("citizen-ids-to-talk-to")) {
|
||||
List<Integer> ids = questSec.getIntegerList("citizen-ids-to-talk-to");
|
||||
List<Boolean> has = questSec.getBooleanList("has-talked-to");
|
||||
newData.set(questName + ".citizen-ids-to-talk-to", ids);
|
||||
newData.set(questName + ".has-talked-to", has);
|
||||
}
|
||||
if (questSec.contains("citizen-ids-killed")) {
|
||||
List<Integer> ids = questSec.getIntegerList("citizen-ids-killed");
|
||||
List<Integer> num = questSec.getIntegerList("citizen-amounts-killed");
|
||||
newData.set(questName + ".citizen-ids-killed", ids);
|
||||
newData.set(questName + ".citizen-amounts-killed", num);
|
||||
}
|
||||
if (questSec.contains("locations-to-reach")) {
|
||||
List<String> locations = questSec.getStringList("locations-to-reach");
|
||||
List<Boolean> has = questSec.getBooleanList("has-reached-location");
|
||||
List<Integer> radii = questSec.getIntegerList("radii-to-reach-within");
|
||||
newData.set(questName + ".locations-to-reach", locations);
|
||||
newData.set(questName + ".has-reached-location", has);
|
||||
newData.set(questName + ".radii-to-reach-within", radii);
|
||||
}
|
||||
if (questSec.contains("potions-brewed-names")) {
|
||||
List<String> names = questSec.getStringList("potions-brewed-names");
|
||||
List<Integer> amounts = questSec.getIntegerList("potions-brewed-amounts");
|
||||
newData.set(questName + ".potions-brewed-names", names);
|
||||
newData.set(questName + ".potions-brewed-amounts", amounts);
|
||||
}
|
||||
if (questSec.contains("mobs-to-tame")) {
|
||||
List<String> mobs = questSec.getStringList("mobs-to-tame");
|
||||
List<Integer> amounts = questSec.getIntegerList("mob-tame-amounts");
|
||||
newData.set(questName + ".mobs-to-tame", mobs);
|
||||
newData.set(questName + ".mob-tame-amounts", amounts);
|
||||
}
|
||||
if (questSec.contains("sheep-to-shear")) {
|
||||
List<String> colors = questSec.getStringList("sheep-to-shear");
|
||||
List<Integer> amounts = questSec.getIntegerList("sheep-sheared");
|
||||
newData.set(questName + ".sheep-to-shear", colors);
|
||||
newData.set(questName + ".sheep-sheared", amounts);
|
||||
}
|
||||
if (questSec.contains("passwords")) {
|
||||
List<String> passwords = questSec.getStringList("passwords");
|
||||
List<Boolean> said = questSec.getBooleanList("passwords-said");
|
||||
newData.set(questName + ".passwords", passwords);
|
||||
newData.set(questName + ".passwords-said", said);
|
||||
}
|
||||
if (questSec.contains("custom-objectives")) {
|
||||
List<String> customObj = questSec.getStringList("custom-objectives");
|
||||
List<Integer> customObjCount = questSec.getIntegerList("custom-objective-counts");
|
||||
newData.set(questName + ".custom-objectives", customObj);
|
||||
newData.set(questName + ".custom-objective-counts", customObjCount);
|
||||
}
|
||||
if (questSec.contains("stage-delay")) {
|
||||
newData.set(questName + ".stage-delay", questSec.getLong("stage-delay"));
|
||||
}
|
||||
if (questSec.contains("chat-triggers")) {
|
||||
List<String> chatTriggers = questSec.getStringList("chat-triggers");
|
||||
newData.set(questName + ".chat-triggers", chatTriggers);
|
||||
}
|
||||
if (questSec.contains("command-triggers")) {
|
||||
List<String> commandTriggers = questSec.getStringList("command-triggers");
|
||||
newData.set(questName + ".command-triggers", commandTriggers);
|
||||
}
|
||||
return newData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate the stage timer
|
||||
* @param quest The quest of which the timer is for
|
||||
@ -2952,91 +2714,6 @@ public class Quester {
|
||||
}
|
||||
}
|
||||
|
||||
public static String checkPlacement(Inventory inv, int rawSlot) {
|
||||
if (rawSlot < 0) {
|
||||
return Lang.get("questNoDrop");
|
||||
}
|
||||
InventoryType type = inv.getType();
|
||||
if (type.equals(InventoryType.BREWING)) {
|
||||
if (rawSlot < 4) {
|
||||
return Lang.get("questNoBrew");
|
||||
}
|
||||
} else if (type.equals(InventoryType.CHEST)) {
|
||||
if (inv.getContents().length == 27) {
|
||||
if (rawSlot < 27) {
|
||||
return Lang.get("questNoStore");
|
||||
}
|
||||
} else {
|
||||
if (rawSlot < 54) {
|
||||
return Lang.get("questNoStore");
|
||||
}
|
||||
}
|
||||
} else if (type.equals(InventoryType.CRAFTING)) {
|
||||
if (rawSlot < 5) {
|
||||
return Lang.get("questNoCraft");
|
||||
} else if (rawSlot < 9) {
|
||||
return Lang.get("questNoEquip");
|
||||
}
|
||||
} else if (type.equals(InventoryType.DISPENSER)) {
|
||||
if (rawSlot < 9) {
|
||||
return Lang.get("questNoDispense");
|
||||
}
|
||||
} else if (type.equals(InventoryType.ENCHANTING)) {
|
||||
if (rawSlot == 0) {
|
||||
return Lang.get("questNoEnchant");
|
||||
}
|
||||
} else if (type.equals(InventoryType.ENDER_CHEST)) {
|
||||
if (rawSlot < 27) {
|
||||
return Lang.get("questNoStore");
|
||||
}
|
||||
} else if (type.equals(InventoryType.FURNACE)) {
|
||||
if (rawSlot < 3) {
|
||||
return Lang.get("questNoSmelt");
|
||||
}
|
||||
} else if (type.equals(InventoryType.WORKBENCH)) {
|
||||
if (rawSlot < 10) {
|
||||
return Lang.get("questNoCraft");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Integer> getChangedSlots(Inventory inInv, ItemStack inNew) {
|
||||
List<Integer> changed = new ArrayList<Integer>();
|
||||
if (inInv.contains(inNew.getType())) {
|
||||
int amount = inNew.getAmount();
|
||||
HashMap<Integer, ? extends ItemStack> items = inInv.all(inNew.getType());
|
||||
for (int i = 0; i < inInv.getSize(); i++) {
|
||||
if (!items.containsKey((Integer) i)) {
|
||||
continue;
|
||||
}
|
||||
ItemStack item = items.get((Integer) i);
|
||||
int slotamount = item.getMaxStackSize() - item.getAmount();
|
||||
if (slotamount > 1) {
|
||||
if (amount > slotamount) {
|
||||
int toAdd = slotamount - amount;
|
||||
amount = amount - toAdd;
|
||||
changed.add(i);
|
||||
} else {
|
||||
changed.add(i);
|
||||
amount = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (amount > 0) {
|
||||
if (inInv.firstEmpty() != -1) {
|
||||
changed.add(inInv.firstEmpty());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (inInv.firstEmpty() != -1) {
|
||||
changed.add(inInv.firstEmpty());
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
public void showGUIDisplay(NPC npc, LinkedList<Quest> quests) {
|
||||
Player player = getPlayer();
|
||||
int size = ((quests.size() / 9) + 1) * 9;
|
||||
@ -3084,11 +2761,6 @@ public class Quester {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plugin.getDependencies().getGpsApi() != null) {
|
||||
if (plugin.getDependencies().getGpsApi().gpsIsActive(this.getPlayer())) {
|
||||
plugin.getDependencies().getGpsApi().stopGPS(this.getPlayer());
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -3166,4 +2838,91 @@ public class Quester {
|
||||
}
|
||||
return playerAmount >= is.getAmount();
|
||||
}
|
||||
|
||||
// I'm not sure why these methods are here. They've been in the class for a long time but aren't used anywhere?
|
||||
|
||||
/*public static String checkPlacement(Inventory inv, int rawSlot) {
|
||||
if (rawSlot < 0) {
|
||||
return Lang.get("questNoDrop");
|
||||
}
|
||||
InventoryType type = inv.getType();
|
||||
if (type.equals(InventoryType.BREWING)) {
|
||||
if (rawSlot < 4) {
|
||||
return Lang.get("questNoBrew");
|
||||
}
|
||||
} else if (type.equals(InventoryType.CHEST)) {
|
||||
if (inv.getContents().length == 27) {
|
||||
if (rawSlot < 27) {
|
||||
return Lang.get("questNoStore");
|
||||
}
|
||||
} else {
|
||||
if (rawSlot < 54) {
|
||||
return Lang.get("questNoStore");
|
||||
}
|
||||
}
|
||||
} else if (type.equals(InventoryType.CRAFTING)) {
|
||||
if (rawSlot < 5) {
|
||||
return Lang.get("questNoCraft");
|
||||
} else if (rawSlot < 9) {
|
||||
return Lang.get("questNoEquip");
|
||||
}
|
||||
} else if (type.equals(InventoryType.DISPENSER)) {
|
||||
if (rawSlot < 9) {
|
||||
return Lang.get("questNoDispense");
|
||||
}
|
||||
} else if (type.equals(InventoryType.ENCHANTING)) {
|
||||
if (rawSlot == 0) {
|
||||
return Lang.get("questNoEnchant");
|
||||
}
|
||||
} else if (type.equals(InventoryType.ENDER_CHEST)) {
|
||||
if (rawSlot < 27) {
|
||||
return Lang.get("questNoStore");
|
||||
}
|
||||
} else if (type.equals(InventoryType.FURNACE)) {
|
||||
if (rawSlot < 3) {
|
||||
return Lang.get("questNoSmelt");
|
||||
}
|
||||
} else if (type.equals(InventoryType.WORKBENCH)) {
|
||||
if (rawSlot < 10) {
|
||||
return Lang.get("questNoCraft");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}*/
|
||||
|
||||
/*public static List<Integer> getChangedSlots(Inventory inInv, ItemStack inNew) {
|
||||
List<Integer> changed = new ArrayList<Integer>();
|
||||
if (inInv.contains(inNew.getType())) {
|
||||
int amount = inNew.getAmount();
|
||||
HashMap<Integer, ? extends ItemStack> items = inInv.all(inNew.getType());
|
||||
for (int i = 0; i < inInv.getSize(); i++) {
|
||||
if (!items.containsKey((Integer) i)) {
|
||||
continue;
|
||||
}
|
||||
ItemStack item = items.get((Integer) i);
|
||||
int slotamount = item.getMaxStackSize() - item.getAmount();
|
||||
if (slotamount > 1) {
|
||||
if (amount > slotamount) {
|
||||
int toAdd = slotamount - amount;
|
||||
amount = amount - toAdd;
|
||||
changed.add(i);
|
||||
} else {
|
||||
changed.add(i);
|
||||
amount = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (amount > 0) {
|
||||
if (inInv.firstEmpty() != -1) {
|
||||
changed.add(inInv.firstEmpty());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (inInv.firstEmpty() != -1) {
|
||||
changed.add(inInv.firstEmpty());
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}*/
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -216,11 +216,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
public void onDisable() {
|
||||
getLogger().info("Saving Quester data.");
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
if (depends.getGpsApi() != null) {
|
||||
if (depends.getGpsApi().gpsIsActive(p)) {
|
||||
depends.getGpsApi().stopGPS(p);
|
||||
}
|
||||
}
|
||||
Quester quester = getQuester(p.getUniqueId());
|
||||
quester.saveData();
|
||||
}
|
||||
@ -2107,7 +2102,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (config.contains("quests." + questKey + ".stages.ordered." + s2 + ".enchantments")) {
|
||||
if (Quests.checkList(config.getList("quests." + questKey + ".stages.ordered." + s2 + ".enchantments"), String.class)) {
|
||||
for (String enchant : config.getStringList("quests." + questKey + ".stages.ordered." + s2 + ".enchantments")) {
|
||||
Enchantment e = Quests.getEnchantment(enchant);
|
||||
Enchantment e = ItemUtil.getEnchantmentFromProperName(enchant);
|
||||
if (e != null) {
|
||||
enchantments.add(e);
|
||||
} else {
|
||||
@ -2674,10 +2669,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
|
||||
/**
|
||||
* Add possibilty to use fallbacks for customs maps
|
||||
* Add possibilty to use fallbacks for customs maps<p>
|
||||
*
|
||||
* Avoid null objects in datamap by initialize the entry value with empty string if no fallback present.
|
||||
*/
|
||||
static Map<String, Object> populateCustoms(ConfigurationSection sec2, Map<String, Object> datamap) {
|
||||
private static Map<String, Object> populateCustoms(ConfigurationSection sec2, Map<String, Object> datamap) {
|
||||
Map<String,Object> data = new HashMap<String,Object>();
|
||||
if (sec2 != null) {
|
||||
for (String key : datamap.keySet()) {
|
||||
@ -2688,10 +2684,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
|
||||
/**
|
||||
* Add possibilty to use fallbacks for customs entries
|
||||
* Add possibilty to use fallbacks for customs entries<p>
|
||||
*
|
||||
* Avoid null objects in datamap by initialize the entry value with empty string if no fallback present.
|
||||
*/
|
||||
static Entry<String, Object> populateCustoms(ConfigurationSection sec2, Entry<String, Object> datamap) {
|
||||
private static Entry<String, Object> populateCustoms(ConfigurationSection sec2, Entry<String, Object> datamap) {
|
||||
String key = null;;
|
||||
Object value = null;;
|
||||
if (sec2 != null) {
|
||||
@ -2721,9 +2718,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (legacyFile.exists()) {
|
||||
getLogger().log(Level.INFO, "Renaming legacy \"events.yml\" to \"actions.yml\"");
|
||||
try {
|
||||
legacyFile.renameTo(actionsFile);
|
||||
if (legacyFile.exists()) {
|
||||
getLogger().log(Level.INFO, "Deleting legacy \"events.yml\" ... done!");
|
||||
if (legacyFile.renameTo(actionsFile)) {
|
||||
getLogger().log(Level.INFO, "Success! Deleting legacy \"events.yml\" ... done!");
|
||||
legacyFile.delete();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -3239,130 +3235,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
return count - subtract;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // since 1.13
|
||||
public static Enchantment getEnchantment(String enchant) {
|
||||
String ench = Lang.getKey(enchant.replace(" ", ""));
|
||||
ench = ench.replace("ENCHANTMENT_", "");
|
||||
Enchantment e = Enchantment.getByName(ench);
|
||||
return e != null ? e : getEnchantmentLegacy(ench.replace(" ", ""));
|
||||
}
|
||||
|
||||
public static Enchantment getEnchantmentLegacy(String enchant) {
|
||||
if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_DAMAGE"))) {
|
||||
return Enchantment.ARROW_DAMAGE;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_FIRE"))) {
|
||||
return Enchantment.ARROW_FIRE;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_INFINITE"))) {
|
||||
return Enchantment.ARROW_INFINITE;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_KNOCKBACK"))) {
|
||||
return Enchantment.ARROW_KNOCKBACK;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DAMAGE_ALL"))) {
|
||||
return Enchantment.DAMAGE_ALL;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DAMAGE_ARTHROPODS"))) {
|
||||
return Enchantment.DAMAGE_ARTHROPODS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DAMAGE_UNDEAD"))) {
|
||||
return Enchantment.DAMAGE_UNDEAD;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DIG_SPEED"))) {
|
||||
return Enchantment.DIG_SPEED;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DURABILITY"))) {
|
||||
return Enchantment.DURABILITY;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_FIRE_ASPECT"))) {
|
||||
return Enchantment.FIRE_ASPECT;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_KNOCKBACK"))) {
|
||||
return Enchantment.KNOCKBACK;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LOOT_BONUS_BLOCKS"))) {
|
||||
return Enchantment.LOOT_BONUS_BLOCKS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LOOT_BONUS_MOBS"))) {
|
||||
return Enchantment.LOOT_BONUS_MOBS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LUCK"))) {
|
||||
return Enchantment.LOOT_BONUS_MOBS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LURE"))) {
|
||||
return Enchantment.LOOT_BONUS_MOBS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_OXYGEN"))) {
|
||||
return Enchantment.OXYGEN;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_ENVIRONMENTAL"))) {
|
||||
return Enchantment.PROTECTION_ENVIRONMENTAL;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_EXPLOSIONS"))) {
|
||||
return Enchantment.PROTECTION_EXPLOSIONS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_FALL"))) {
|
||||
return Enchantment.PROTECTION_FALL;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_FIRE"))) {
|
||||
return Enchantment.PROTECTION_FIRE;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_PROJECTILE"))) {
|
||||
return Enchantment.PROTECTION_PROJECTILE;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_SILK_TOUCH"))) {
|
||||
return Enchantment.SILK_TOUCH;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_THORNS"))) {
|
||||
return Enchantment.THORNS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_WATER_WORKER"))) {
|
||||
return Enchantment.WATER_WORKER;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Enchantment getEnchantmentPretty(String enchant) {
|
||||
while (Quester.spaceToCapital(enchant) != null) {
|
||||
enchant = Quester.spaceToCapital(enchant);
|
||||
}
|
||||
return getEnchantment(enchant);
|
||||
}
|
||||
|
||||
public static DyeColor getDyeColor(String s) {
|
||||
String col = Lang.getKey(MiscUtil.getCapitalized(s));
|
||||
col = col.replace("COLOR_", "");
|
||||
DyeColor color = null;
|
||||
try {
|
||||
color = DyeColor.valueOf(col);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Do nothing
|
||||
}
|
||||
return color != null ? color : getDyeColorLegacy(s);
|
||||
}
|
||||
|
||||
public static DyeColor getDyeColorLegacy(String s) {
|
||||
if (s.equalsIgnoreCase("Black") || s.equalsIgnoreCase(Lang.get("COLOR_BLACK"))) {
|
||||
return DyeColor.BLACK;
|
||||
} else if (s.equalsIgnoreCase("Blue") || s.equalsIgnoreCase(Lang.get("COLOR_BLUE"))) {
|
||||
return DyeColor.BLUE;
|
||||
} else if (s.equalsIgnoreCase("Brown") || s.equalsIgnoreCase(Lang.get("COLOR_BROWN"))) {
|
||||
return DyeColor.BROWN;
|
||||
} else if (s.equalsIgnoreCase("Cyan") || s.equalsIgnoreCase(Lang.get("COLOR_CYAN"))) {
|
||||
return DyeColor.CYAN;
|
||||
} else if (s.equalsIgnoreCase("Gray") || s.equalsIgnoreCase(Lang.get("COLOR_GRAY"))) {
|
||||
return DyeColor.GRAY;
|
||||
} else if (s.equalsIgnoreCase("Green") || s.equalsIgnoreCase(Lang.get("COLOR_GREEN"))) {
|
||||
return DyeColor.GREEN;
|
||||
} else if (s.equalsIgnoreCase("LightBlue") || s.equalsIgnoreCase(Lang.get("COLOR_LIGHT_BLUE"))) {
|
||||
return DyeColor.LIGHT_BLUE;
|
||||
} else if (s.equalsIgnoreCase("Lime") || s.equalsIgnoreCase(Lang.get("COLOR_LIME"))) {
|
||||
return DyeColor.LIME;
|
||||
} else if (s.equalsIgnoreCase("Magenta") || s.equalsIgnoreCase(Lang.get("COLOR_MAGENTA"))) {
|
||||
return DyeColor.MAGENTA;
|
||||
} else if (s.equalsIgnoreCase("Orange") || s.equalsIgnoreCase(Lang.get("COLOR_ORAGE"))) {
|
||||
return DyeColor.ORANGE;
|
||||
} else if (s.equalsIgnoreCase("Pink") || s.equalsIgnoreCase(Lang.get("COLOR_PINK"))) {
|
||||
return DyeColor.PINK;
|
||||
} else if (s.equalsIgnoreCase("Purple") || s.equalsIgnoreCase(Lang.get("COLOR_PURPLE"))) {
|
||||
return DyeColor.PURPLE;
|
||||
} else if (s.equalsIgnoreCase("Red") || s.equalsIgnoreCase(Lang.get("COLOR_RED"))) {
|
||||
return DyeColor.RED;
|
||||
// 1.13 changed DyeColor.SILVER -> DyeColor.LIGHT_GRAY
|
||||
} else if (s.equalsIgnoreCase("Silver") || s.equalsIgnoreCase("LightGray") || s.equalsIgnoreCase(Lang.get("COLOR_SILVER"))) {
|
||||
return DyeColor.getByColor(Color.SILVER);
|
||||
} else if (s.equalsIgnoreCase("White") || s.equalsIgnoreCase(Lang.get("COLOR_WHITE"))) {
|
||||
return DyeColor.WHITE;
|
||||
} else if (s.equalsIgnoreCase("Yellow") || s.equalsIgnoreCase(Lang.get("COLOR_YELLOW"))) {
|
||||
return DyeColor.YELLOW;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDyeString(DyeColor dc) {
|
||||
return Lang.get("COLOR_" + dc.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether an NPC has a quest that the player may accept
|
||||
* @param npc The giver NPC to check
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -160,7 +160,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
if (player.hasPermission("quests.editor.actions.create") || player.hasPermission("quests.editor.events.create")) {
|
||||
context.setSessionData(CK.E_OLD_EVENT, "");
|
||||
return new EventNamePrompt();
|
||||
return new ActionNamePrompt();
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get("noPermission"));
|
||||
return new MenuPrompt();
|
||||
@ -416,7 +416,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
deleteEvent(context);
|
||||
deleteAction(context);
|
||||
return new MenuPrompt();
|
||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||
return new MenuPrompt();
|
||||
@ -785,7 +785,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
saveEvent(context);
|
||||
saveAction(context);
|
||||
return new MenuPrompt();
|
||||
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||
return new CreateMenuPrompt();
|
||||
@ -858,7 +858,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
}
|
||||
//
|
||||
|
||||
private void deleteEvent(ConversationContext context) {
|
||||
private void deleteAction(ConversationContext context) {
|
||||
YamlConfiguration data = new YamlConfiguration();
|
||||
try {
|
||||
actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
@ -891,7 +891,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
clearData(context);
|
||||
}
|
||||
|
||||
private void saveEvent(ConversationContext context) {
|
||||
private void saveAction(ConversationContext context) {
|
||||
YamlConfiguration data = new YamlConfiguration();
|
||||
try {
|
||||
actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
@ -908,7 +908,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
if (((String) context.getSessionData(CK.E_OLD_EVENT)).isEmpty() == false) {
|
||||
data.set("events." + (String) context.getSessionData(CK.E_OLD_EVENT), null);
|
||||
LinkedList<Action> temp = plugin.getEvents();
|
||||
temp.remove(plugin.getEvent((String) context.getSessionData(CK.E_OLD_EVENT)));
|
||||
temp.remove(plugin.getAction((String) context.getSessionData(CK.E_OLD_EVENT)));
|
||||
plugin.setEvents(temp);
|
||||
}
|
||||
ConfigurationSection section = data.createSection("events." + (String) context.getSessionData(CK.E_NAME));
|
||||
@ -1049,7 +1049,7 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
clearData(context);
|
||||
}
|
||||
|
||||
private class EventNamePrompt extends StringPrompt {
|
||||
private class ActionNamePrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
@ -1064,16 +1064,16 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
for (Action e : plugin.getEvents()) {
|
||||
if (e.getName().equalsIgnoreCase(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorExists"));
|
||||
return new EventNamePrompt();
|
||||
return new ActionNamePrompt();
|
||||
}
|
||||
}
|
||||
if (names.contains(input)) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorSomeone"));
|
||||
return new EventNamePrompt();
|
||||
return new ActionNamePrompt();
|
||||
}
|
||||
if (StringUtils.isAlphanumeric(input) == false) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("eventEditorAlpha"));
|
||||
return new EventNamePrompt();
|
||||
return new ActionNamePrompt();
|
||||
}
|
||||
context.setSessionData(CK.E_NAME, input);
|
||||
names.add(input);
|
||||
|
@ -0,0 +1,12 @@
|
||||
package me.blackvein.quests.events;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
public abstract class QuestsEvent extends Event {
|
||||
public QuestsEvent() {
|
||||
}
|
||||
|
||||
public QuestsEvent(boolean async) {
|
||||
super(async);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quest;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.events.QuestsEvent;
|
||||
|
||||
/**
|
||||
* Represents a quest-related event
|
||||
*/
|
||||
public abstract class QuestEvent extends QuestsEvent {
|
||||
protected Quest quest;
|
||||
|
||||
public QuestEvent(final Quest quest) {
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
public QuestEvent(final Quest quest, boolean async) {
|
||||
super(async);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quest involved in this event
|
||||
*
|
||||
* @return Quest which is involved in this event
|
||||
*/
|
||||
public final Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quest;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
|
||||
/**
|
||||
* Called when a quest is quit by a quester
|
||||
*/
|
||||
public class QuestQuitEvent extends QuestEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Quester quester;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuestQuitEvent(Quest quest, Quester who) {
|
||||
super(quest);
|
||||
this.quester = who;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quester involved in this event
|
||||
*
|
||||
* @return Quester who is involved in this event
|
||||
*/
|
||||
public Quester getQuester() {
|
||||
return quester;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quest;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
|
||||
/**
|
||||
* Called when a quest is taken by a quester
|
||||
*/
|
||||
public class QuestTakeEvent extends QuestEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Quester quester;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuestTakeEvent(Quest quest, Quester who) {
|
||||
super(quest);
|
||||
this.quester = who;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quester involved in this event
|
||||
*
|
||||
* @return Quester who is involved in this event
|
||||
*/
|
||||
public Quester getQuester() {
|
||||
return quester;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quester;
|
||||
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.events.QuestsEvent;
|
||||
|
||||
/**
|
||||
* Represents a quester-related event
|
||||
*/
|
||||
public abstract class QuesterEvent extends QuestsEvent {
|
||||
protected Quester quester;
|
||||
|
||||
public QuesterEvent(final Quester quester) {
|
||||
this.quester = quester;
|
||||
}
|
||||
|
||||
public QuesterEvent(final Quester quester, boolean async) {
|
||||
super(async);
|
||||
this.quester = quester;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quester involved in this event
|
||||
*
|
||||
* @return Quester which is involved in this event
|
||||
*/
|
||||
public final Quester getQuester() {
|
||||
return quester;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quester;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Stage;
|
||||
|
||||
/**
|
||||
* Called after a quester changes stage
|
||||
*/
|
||||
public class QuesterPostChangeStageEvent extends QuesterEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Quest quest;
|
||||
private Stage current;
|
||||
private Stage next;
|
||||
|
||||
public QuesterPostChangeStageEvent(Quester quester, Quest quest, Stage current, Stage next) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
this.current = current;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quest involved in this event
|
||||
*
|
||||
* @return Quest who is involved in this event
|
||||
*/
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
public Stage getCurrentStage() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public Stage getNextStage() {
|
||||
return next;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quester;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
|
||||
/**
|
||||
* Called after a quester completes a quest
|
||||
*/
|
||||
public class QuesterPostCompleteQuestEvent extends QuesterEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Quest quest;
|
||||
|
||||
public QuesterPostCompleteQuestEvent(Quester quester, Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quest involved in this event
|
||||
*
|
||||
* @return Quest who is involved in this event
|
||||
*/
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quester;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
|
||||
/**
|
||||
* Called after a quester fails a quest
|
||||
*/
|
||||
public class QuesterPostFailQuestEvent extends QuesterEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Quest quest;
|
||||
|
||||
public QuesterPostFailQuestEvent(Quester quester, Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quest involved in this event
|
||||
*
|
||||
* @return Quest who is involved in this event
|
||||
*/
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quester;
|
||||
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
|
||||
/**
|
||||
* Called after a quester starts a quest
|
||||
*/
|
||||
public class QuesterPostStartQuestEvent extends QuesterEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Quest quest;
|
||||
|
||||
public QuesterPostStartQuestEvent(Quester quester, Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quest involved in this event
|
||||
*
|
||||
* @return Quest who is involved in this event
|
||||
*/
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quester;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Stage;
|
||||
|
||||
/**
|
||||
* Called before a quester changes stage
|
||||
*/
|
||||
public class QuesterPreChangeStageEvent extends QuesterEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Quest quest;
|
||||
private Stage current;
|
||||
private Stage next;
|
||||
private boolean cancel = false;;
|
||||
|
||||
public QuesterPreChangeStageEvent(Quester quester, Quest quest, Stage current, Stage next) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
this.current = current;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quest involved in this event
|
||||
*
|
||||
* @return Quest who is involved in this event
|
||||
*/
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
public Stage getCurrentStage() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public Stage getNextStage() {
|
||||
return next;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quester;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
|
||||
/**
|
||||
* Called before a quester completes a quest
|
||||
*/
|
||||
public class QuesterPreCompleteQuestEvent extends QuesterEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Quest quest;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuesterPreCompleteQuestEvent(Quester quester, Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quest involved in this event
|
||||
*
|
||||
* @return Quest who is involved in this event
|
||||
*/
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quester;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
|
||||
/**
|
||||
* Called before a quester fails a quest
|
||||
*/
|
||||
public class QuesterPreFailQuestEvent extends QuesterEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Quest quest;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuesterPreFailQuestEvent(Quester quester, Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quest involved in this event
|
||||
*
|
||||
* @return Quest who is involved in this event
|
||||
*/
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.events.quester;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
|
||||
/**
|
||||
* Called before a quester starts a quest
|
||||
*/
|
||||
public class QuesterPreStartQuestEvent extends QuesterEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Quest quest;
|
||||
private boolean cancel = false;
|
||||
|
||||
public QuesterPreStartQuestEvent(Quester quester, Quest quest) {
|
||||
super(quester);
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quest involved in this event
|
||||
*
|
||||
* @return Quest who is involved in this event
|
||||
*/
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -30,6 +30,8 @@ import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.Requirements;
|
||||
import me.blackvein.quests.Stage;
|
||||
import me.blackvein.quests.events.quest.QuestQuitEvent;
|
||||
import me.blackvein.quests.events.quest.QuestTakeEvent;
|
||||
import me.blackvein.quests.exceptions.InvalidStageException;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
@ -613,39 +615,40 @@ public class CmdExecutor implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean questsQuit(final Player player, String[] args) {
|
||||
private void questsQuit(final Player player, String[] args) {
|
||||
if (plugin.getSettings().canAllowQuitting() == true) {
|
||||
if (((Player) player).hasPermission("quests.quit")) {
|
||||
if (args.length == 1) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get(player, "COMMAND_QUIT_HELP"));
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.getCurrentQuests().isEmpty() == false) {
|
||||
Quest quest = plugin.getQuest(MiscUtil.concatArgArray(args, 1, args.length - 1, ' '));
|
||||
if (quest == null) {
|
||||
player.sendMessage(ChatColor.RED + Lang.get(player, "questNotFound"));
|
||||
return true;
|
||||
Quest q = plugin.getQuest(MiscUtil.concatArgArray(args, 1, args.length - 1, ' '));
|
||||
if (q != null) {
|
||||
QuestQuitEvent event = new QuestQuitEvent(q, quester);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
quester.hardQuit(quest);
|
||||
quester.hardQuit(q);
|
||||
String msg = Lang.get("questQuit");
|
||||
msg = msg.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.YELLOW);
|
||||
msg = msg.replace("<quest>", ChatColor.DARK_PURPLE + q.getName() + ChatColor.YELLOW);
|
||||
player.sendMessage(ChatColor.YELLOW + msg);
|
||||
quester.saveData();
|
||||
quester.loadData();
|
||||
quester.updateJournal();
|
||||
return true;
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get(player, "questNotFound"));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "noActiveQuest"));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + Lang.get(player, "NoPermission"));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "questQuitDisabled"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -684,6 +687,11 @@ public class CmdExecutor implements CommandExecutor {
|
||||
if (questToFind != null) {
|
||||
final Quest q = questToFind;
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
QuestTakeEvent event = new QuestTakeEvent(q, quester);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (quester.getCurrentQuests().size() >= plugin.getSettings().getMaxQuests() && plugin.getSettings().getMaxQuests() > 0) {
|
||||
String msg = Lang.get(player, "questMaxAllowed");
|
||||
msg = msg.replace("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -140,7 +140,7 @@ public class NpcListener implements Listener {
|
||||
// TODO translate enchantment names
|
||||
for (Entry<Enchantment, Integer> e : esmeta.getStoredEnchants().entrySet()) {
|
||||
player.sendMessage(ChatColor.GRAY + "\u2515 " + ChatColor.DARK_GREEN
|
||||
+ Quester.prettyEnchantmentString(e.getKey()) + " " + RomanNumeral.getNumeral(e.getValue()) + "\n");
|
||||
+ ItemUtil.getPrettyEnchantmentName(e.getKey()) + " " + RomanNumeral.getNumeral(e.getValue()) + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -9,6 +9,7 @@
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************************************** */
|
||||
|
||||
package me.blackvein.quests.particle;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -9,6 +9,7 @@
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************************************** */
|
||||
|
||||
package me.blackvein.quests.particle;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -9,6 +9,7 @@
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************************************** */
|
||||
|
||||
package me.blackvein.quests.particle;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -16,9 +16,9 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import me.blackvein.quests.QuestFactory;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -54,7 +54,7 @@ public class BlocksPrompt extends FixedSetPrompt {
|
||||
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_BREAK_NAMES);
|
||||
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_BREAK_AMOUNTS);
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_DAMAGE_NAMES) == null) {
|
||||
@ -64,7 +64,7 @@ public class BlocksPrompt extends FixedSetPrompt {
|
||||
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_DAMAGE_NAMES);
|
||||
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS);
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_PLACE_NAMES) == null) {
|
||||
@ -74,7 +74,7 @@ public class BlocksPrompt extends FixedSetPrompt {
|
||||
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_PLACE_NAMES);
|
||||
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_PLACE_AMOUNTS);
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_USE_NAMES) == null) {
|
||||
@ -84,7 +84,7 @@ public class BlocksPrompt extends FixedSetPrompt {
|
||||
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_USE_NAMES);
|
||||
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_AMOUNTS);
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_CUT_NAMES) == null) {
|
||||
@ -94,7 +94,7 @@ public class BlocksPrompt extends FixedSetPrompt {
|
||||
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_CUT_NAMES);
|
||||
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_CUT_AMOUNTS);
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
}
|
||||
}
|
||||
text += ChatColor.GREEN + "" + ChatColor.BOLD + "6 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("done") + "\n";
|
||||
@ -140,7 +140,7 @@ public class BlocksPrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
|
||||
for (String s : getBlockNames(context)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + Quester.prettyItemString(s) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_BREAK_AMOUNTS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockAmounts") + " (" + Lang.get("noneSet") + ")\n";
|
||||
@ -357,7 +357,7 @@ public class BlocksPrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
|
||||
for (String s : getBlockNames(context)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + Quester.prettyItemString(s) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_DAMAGE_AMOUNTS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetDamageAmounts") + " (" + Lang.get("noneSet") + ")\n";
|
||||
@ -574,7 +574,7 @@ public class BlocksPrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
|
||||
for (String s : getBlockNames(context)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + Quester.prettyItemString(s) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_PLACE_AMOUNTS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetPlaceAmounts") + " (" + Lang.get("noneSet") + ")\n";
|
||||
@ -791,7 +791,7 @@ public class BlocksPrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
|
||||
for (String s : getBlockNames(context)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + Quester.prettyItemString(s) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_USE_AMOUNTS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noneSet") + ")\n";
|
||||
@ -1008,7 +1008,7 @@ public class BlocksPrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "1" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetBlockNames") + "\n";
|
||||
for (String s : getBlockNames(context)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + Quester.prettyItemString(s) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_CUT_AMOUNTS) == null) {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetCutAmounts") + " (" + Lang.get("noneSet") + ")\n";
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,3 +1,15 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************************************/
|
||||
|
||||
package me.blackvein.quests.prompts;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -32,7 +32,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
@ -376,7 +375,7 @@ public class ItemStackPrompt extends FixedSetPrompt {
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
String text = ChatColor.LIGHT_PURPLE + Lang.get("enchantmentsTitle") + "\n";
|
||||
for (Enchantment e : Enchantment.values()) {
|
||||
text += ChatColor.GREEN + Quester.prettyEnchantmentString(e) + ", ";
|
||||
text += ChatColor.GREEN + ItemUtil.getPrettyEnchantmentName(e) + ", ";
|
||||
}
|
||||
text = text.substring(0, text.length() - 2);
|
||||
return text + "\n" + ChatColor.YELLOW + Lang.get("itemCreateEnterEnch");
|
||||
@ -386,10 +385,10 @@ public class ItemStackPrompt extends FixedSetPrompt {
|
||||
public Prompt acceptInput(ConversationContext cc, String input) {
|
||||
String s = input.replace(":", "");
|
||||
if (s.equalsIgnoreCase(Lang.get("cmdClear")) == false && s.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
Enchantment e = Quests.getEnchantmentPretty(MiscUtil.getCapitalized(s));
|
||||
Enchantment e = ItemUtil.getEnchantmentFromPrettyName(MiscUtil.getCapitalized(s));
|
||||
if (e != null) {
|
||||
cc.setSessionData("tempEnchant", e);
|
||||
return new LevelPrompt(Quester.prettyEnchantmentString(e));
|
||||
return new LevelPrompt(ItemUtil.getPrettyEnchantmentName(e));
|
||||
} else {
|
||||
cc.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("itemCreateInvalidEnch"));
|
||||
return new EnchantmentPrompt();
|
||||
@ -490,14 +489,14 @@ public class ItemStackPrompt extends FixedSetPrompt {
|
||||
String item;
|
||||
if (cc.getSessionData("tempDisplay") == null) {
|
||||
String name = (String) cc.getSessionData("tempName");
|
||||
item = ChatColor.AQUA + Quester.prettyItemString(name);
|
||||
item = ChatColor.AQUA + ItemUtil.getPrettyItemName(name);
|
||||
if (cc.getSessionData("tempData") != null) {
|
||||
item += ":" + ChatColor.BLUE + (Short) cc.getSessionData("tempData");
|
||||
}
|
||||
} else {
|
||||
item = ChatColor.LIGHT_PURPLE + "" + ChatColor.ITALIC + (String) cc.getSessionData("tempDisplay") + ChatColor.RESET + "" + ChatColor.GRAY + " (";
|
||||
String name = (String) cc.getSessionData("tempName");
|
||||
item += ChatColor.AQUA + Quester.prettyItemString(name);
|
||||
item += ChatColor.AQUA + ItemUtil.getPrettyItemName(name);
|
||||
if (cc.getSessionData("tempData") != null) {
|
||||
item += ":" + ChatColor.BLUE + (Short) cc.getSessionData("tempData");
|
||||
}
|
||||
@ -513,7 +512,7 @@ public class ItemStackPrompt extends FixedSetPrompt {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Enchantment, Integer> enchantments = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
|
||||
for (Entry<Enchantment, Integer> e : enchantments.entrySet()) {
|
||||
item += ChatColor.GRAY + " - " + ChatColor.RED + Quester.prettyEnchantmentString(e.getKey()) + " " + RomanNumeral.getNumeral(e.getValue()) + "\n";
|
||||
item += ChatColor.GRAY + " - " + ChatColor.RED + ItemUtil.getPrettyEnchantmentName(e.getKey()) + " " + RomanNumeral.getNumeral(e.getValue()) + "\n";
|
||||
}
|
||||
}
|
||||
if (cc.getSessionData("tempLore") != null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -16,7 +16,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import me.blackvein.quests.QuestFactory;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
@ -90,7 +89,8 @@ public class ItemsPrompt extends FixedSetPrompt {
|
||||
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_ENCHANT_NAMES);
|
||||
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS);
|
||||
for (int i = 0; i < enchants.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyItemString(names.get(i)) + ChatColor.GRAY + " " + Lang.get("with") + " " + ChatColor.AQUA + Quester.prettyEnchantmentString(Quests.getEnchantment(enchants.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + ItemUtil.getPrettyItemName(names.get(i)) + ChatColor.GRAY + " " + Lang.get("with") + " " + ChatColor.AQUA
|
||||
+ ItemUtil.getPrettyEnchantmentName(ItemUtil.getEnchantmentFromProperName(enchants.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
}
|
||||
}
|
||||
text += ChatColor.GREEN + "" + ChatColor.BOLD + "4 " + ChatColor.RESET + ChatColor.DARK_PURPLE + "- " + Lang.get("done") + "\n";
|
||||
@ -255,7 +255,7 @@ public class ItemsPrompt extends FixedSetPrompt {
|
||||
} else {
|
||||
text += ChatColor.BLUE + "" + ChatColor.BOLD + "2" + ChatColor.RESET + ChatColor.YELLOW + " - " + Lang.get("stageEditorSetItemNames") + "\n";
|
||||
for (String s : getEnchantItems(context)) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + Quester.prettyItemString(s) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + ItemUtil.getPrettyItemName(s) + "\n";
|
||||
}
|
||||
}
|
||||
if (context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS) == null) {
|
||||
@ -349,9 +349,9 @@ public class ItemsPrompt extends FixedSetPrompt {
|
||||
String text = ChatColor.LIGHT_PURPLE + "- " + ChatColor.DARK_PURPLE + Lang.get("stageEditorEnchantments") + ChatColor.LIGHT_PURPLE + " -\n";
|
||||
for (int i = 0; i < Enchantment.values().length; i++) {
|
||||
if (i == Enchantment.values().length - 1) {
|
||||
text += ChatColor.GREEN + Quester.prettyEnchantmentString(Enchantment.values()[i]) + " ";
|
||||
text += ChatColor.GREEN + ItemUtil.getPrettyEnchantmentName(Enchantment.values()[i]) + " ";
|
||||
} else {
|
||||
text += ChatColor.GREEN + Quester.prettyEnchantmentString(Enchantment.values()[i]) + ", ";
|
||||
text += ChatColor.GREEN + ItemUtil.getPrettyEnchantmentName(Enchantment.values()[i]) + ", ";
|
||||
}
|
||||
}
|
||||
text = text.substring(0, text.length() - 1);
|
||||
@ -368,9 +368,9 @@ public class ItemsPrompt extends FixedSetPrompt {
|
||||
s = s.trim();
|
||||
valid = false;
|
||||
for (Enchantment e : Enchantment.values()) {
|
||||
if (Quester.prettyEnchantmentString(e).equalsIgnoreCase(s)) {
|
||||
if (ItemUtil.getPrettyEnchantmentName(e).equalsIgnoreCase(s)) {
|
||||
if (enchs.contains(s) == false) {
|
||||
enchs.add(Quester.prettyEnchantmentString(e));
|
||||
enchs.add(ItemUtil.getPrettyEnchantmentName(e));
|
||||
valid = true;
|
||||
break;
|
||||
} else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -31,7 +31,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
|
||||
import me.blackvein.quests.QuestFactory;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
@ -64,7 +63,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_MOB_AMOUNTS);
|
||||
if (context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS) == null) {
|
||||
for (int i = 0; i < mobs.size(); i++) {
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + Quester.prettyMobString(Quests.getMobType(mobs.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.AQUA + MiscUtil.getPrettyMobName(Quests.getMobType(mobs.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + "\n";
|
||||
}
|
||||
} else {
|
||||
LinkedList<String> locs = (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS);
|
||||
@ -73,7 +72,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
for (int i = 0; i < mobs.size(); i++) {
|
||||
String msg = Lang.get("blocksWithin");
|
||||
msg = msg.replaceAll("<amount>", ChatColor.DARK_PURPLE + "" + radii.get(i) + ChatColor.GRAY);
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + Quester.prettyMobString(Quests.getMobType(mobs.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + ChatColor.GRAY + msg + ChatColor.YELLOW + names.get(i) + " (" + locs.get(i) + ")\n";
|
||||
text += ChatColor.GRAY + " - " + ChatColor.BLUE + MiscUtil.getPrettyMobName(Quests.getMobType(mobs.get(i))) + ChatColor.GRAY + " x " + ChatColor.DARK_AQUA + amnts.get(i) + ChatColor.GRAY + msg + ChatColor.YELLOW + names.get(i) + " (" + locs.get(i) + ")\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -612,7 +611,7 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
if (Quests.getMobType(s) != null) {
|
||||
final EntityType type = Quests.getMobType(s);
|
||||
if (type.isAlive() || Tameable.class.isAssignableFrom(type.getEntityClass())) {
|
||||
mobTypes.add(Quester.prettyMobString(type));
|
||||
mobTypes.add(MiscUtil.getPrettyMobName(type));
|
||||
context.setSessionData(pref + CK.S_TAME_TYPES, mobTypes);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorInvalidMob"));
|
||||
@ -751,9 +750,9 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
final DyeColor[] colArr = DyeColor.values();
|
||||
for (int i = 0; i < colArr.length; i++) {
|
||||
if (i < (colArr.length - 1)) {
|
||||
cols += Quests.getDyeString(colArr[i]) + ", ";
|
||||
cols += MiscUtil.getDyeString(colArr[i]) + ", ";
|
||||
} else {
|
||||
cols += Quests.getDyeString(colArr[i]) + "\n";
|
||||
cols += MiscUtil.getDyeString(colArr[i]) + "\n";
|
||||
}
|
||||
}
|
||||
return cols + ChatColor.YELLOW + Lang.get("stageEditorShearColorsPrompt");
|
||||
@ -765,8 +764,8 @@ public class MobsPrompt extends FixedSetPrompt {
|
||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||
LinkedList<String> colors = new LinkedList<String>();
|
||||
for (String s : input.split(" ")) {
|
||||
if (Quests.getDyeColor(s) != null) {
|
||||
colors.add(Quests.getDyeString(Quests.getDyeColor(s)));
|
||||
if (MiscUtil.getDyeColor(s) != null) {
|
||||
colors.add(MiscUtil.getDyeString(MiscUtil.getDyeColor(s)));
|
||||
context.setSessionData(pref + CK.S_SHEAR_COLORS, colors);
|
||||
} else {
|
||||
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED + Lang.get("stageEditorInvalidDye"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -32,11 +32,11 @@ import com.herocraftonline.heroes.characters.classes.HeroClass;
|
||||
|
||||
import me.blackvein.quests.CustomReward;
|
||||
import me.blackvein.quests.QuestFactory;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.util.CK;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import me.blackvein.quests.util.MiscUtil;
|
||||
|
||||
public class RewardsPrompt extends FixedSetPrompt {
|
||||
|
||||
@ -502,7 +502,7 @@ public class RewardsPrompt extends FixedSetPrompt {
|
||||
for (String s : args) {
|
||||
if (Quests.getMcMMOSkill(s) != null) {
|
||||
if (skills.contains(s) == false) {
|
||||
skills.add(Quester.getCapitalized(s));
|
||||
skills.add(MiscUtil.getCapitalized(s));
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listDuplicate"));
|
||||
return new mcMMOSkillsPrompt();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -33,8 +33,6 @@ import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
||||
import me.blackvein.quests.Quester;
|
||||
|
||||
public class ItemUtil {
|
||||
|
||||
/**
|
||||
@ -442,7 +440,7 @@ public class ItemUtil {
|
||||
if (is.getEnchantments().isEmpty() == false) {
|
||||
text += " " + ChatColor.GRAY + Lang.get("with") + ChatColor.DARK_PURPLE;
|
||||
for (Entry<Enchantment, Integer> e : is.getEnchantments().entrySet()) {
|
||||
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
|
||||
text += " " + ItemUtil.getPrettyEnchantmentName(e.getKey()) + ":" + e.getValue();
|
||||
}
|
||||
}
|
||||
text += ChatColor.AQUA + " x " + is.getAmount();
|
||||
@ -468,7 +466,7 @@ public class ItemUtil {
|
||||
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
|
||||
text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.AQUA + " x " + is.getAmount();
|
||||
} else {
|
||||
text = ChatColor.AQUA + Quester.prettyItemString(is.getType().name());
|
||||
text = ChatColor.AQUA + getPrettyItemName(is.getType().name());
|
||||
if (is.getDurability() != 0) {
|
||||
text += ChatColor.AQUA + ":" + is.getDurability();
|
||||
}
|
||||
@ -491,7 +489,7 @@ public class ItemUtil {
|
||||
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
|
||||
text = "" + ChatColor.DARK_AQUA + ChatColor.ITALIC + is.getItemMeta().getDisplayName();
|
||||
} else {
|
||||
text = ChatColor.AQUA + Quester.prettyItemString(is.getType().name());
|
||||
text = ChatColor.AQUA + getPrettyItemName(is.getType().name());
|
||||
}
|
||||
return text;
|
||||
}
|
||||
@ -525,4 +523,124 @@ public class ItemUtil {
|
||||
return false;
|
||||
return is.getItemMeta().getDisplayName().equals(ChatColor.LIGHT_PURPLE + Lang.get("journalTitle"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cleans up item names. 'WOODEN_BUTTON' becomes 'Wooden Button'
|
||||
*
|
||||
* @param itemName any item name, ideally
|
||||
* @return cleaned-up string
|
||||
*/
|
||||
public static String getPrettyItemName(String itemName) {
|
||||
String baseString = Material.matchMaterial(itemName).toString();
|
||||
String[] substrings = baseString.split("_");
|
||||
String prettyString = "";
|
||||
int size = 1;
|
||||
for (String s : substrings) {
|
||||
prettyString = prettyString.concat(MiscUtil.getCapitalized(s));
|
||||
if (size < substrings.length) {
|
||||
prettyString = prettyString.concat(" ");
|
||||
}
|
||||
size++;
|
||||
}
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets player-friendly name from enchantment. 'FIRE_ASPECT' becomes 'Fire Aspect'
|
||||
*
|
||||
* @param e Enchantment to get pretty localized name of
|
||||
* @return pretty localized name
|
||||
*/
|
||||
public static String getPrettyEnchantmentName(Enchantment e) {
|
||||
String prettyString = getEnchantmentName(e);
|
||||
prettyString = MiscUtil.capitalsToSpaces(prettyString);
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name of enchantment exactly as it appears in lang file
|
||||
*
|
||||
* @param e Enchantment to get localized name of
|
||||
* @return localized name
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // since 1.13
|
||||
private static String getEnchantmentName(Enchantment e) {
|
||||
try {
|
||||
return (Lang.get("ENCHANTMENT_" + e.getName()));
|
||||
} catch (NullPointerException ne) {
|
||||
Bukkit.getLogger().warning(e.getName() + " was not found in Lang.yml, please ask the developer to "
|
||||
+ "update the file or simply add an entry for the enchantment");
|
||||
return e.getName().toLowerCase().replace("_", " ");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") // since 1.13
|
||||
public static Enchantment getEnchantmentFromProperName(String enchant) {
|
||||
String ench = Lang.getKey(enchant.replace(" ", ""));
|
||||
ench = ench.replace("ENCHANTMENT_", "");
|
||||
Enchantment e = Enchantment.getByName(ench);
|
||||
return e != null ? e : getEnchantmentFromProperLegacyName(ench.replace(" ", ""));
|
||||
}
|
||||
|
||||
public static Enchantment getEnchantmentFromProperLegacyName(String enchant) {
|
||||
if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_DAMAGE"))) {
|
||||
return Enchantment.ARROW_DAMAGE;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_FIRE"))) {
|
||||
return Enchantment.ARROW_FIRE;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_INFINITE"))) {
|
||||
return Enchantment.ARROW_INFINITE;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_ARROW_KNOCKBACK"))) {
|
||||
return Enchantment.ARROW_KNOCKBACK;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DAMAGE_ALL"))) {
|
||||
return Enchantment.DAMAGE_ALL;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DAMAGE_ARTHROPODS"))) {
|
||||
return Enchantment.DAMAGE_ARTHROPODS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DAMAGE_UNDEAD"))) {
|
||||
return Enchantment.DAMAGE_UNDEAD;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DIG_SPEED"))) {
|
||||
return Enchantment.DIG_SPEED;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_DURABILITY"))) {
|
||||
return Enchantment.DURABILITY;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_FIRE_ASPECT"))) {
|
||||
return Enchantment.FIRE_ASPECT;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_KNOCKBACK"))) {
|
||||
return Enchantment.KNOCKBACK;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LOOT_BONUS_BLOCKS"))) {
|
||||
return Enchantment.LOOT_BONUS_BLOCKS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LOOT_BONUS_MOBS"))) {
|
||||
return Enchantment.LOOT_BONUS_MOBS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LUCK"))) {
|
||||
return Enchantment.LOOT_BONUS_MOBS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_LURE"))) {
|
||||
return Enchantment.LOOT_BONUS_MOBS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_OXYGEN"))) {
|
||||
return Enchantment.OXYGEN;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_ENVIRONMENTAL"))) {
|
||||
return Enchantment.PROTECTION_ENVIRONMENTAL;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_EXPLOSIONS"))) {
|
||||
return Enchantment.PROTECTION_EXPLOSIONS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_FALL"))) {
|
||||
return Enchantment.PROTECTION_FALL;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_FIRE"))) {
|
||||
return Enchantment.PROTECTION_FIRE;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_PROTECTION_PROJECTILE"))) {
|
||||
return Enchantment.PROTECTION_PROJECTILE;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_SILK_TOUCH"))) {
|
||||
return Enchantment.SILK_TOUCH;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_THORNS"))) {
|
||||
return Enchantment.THORNS;
|
||||
} else if (enchant.equalsIgnoreCase(Lang.get("ENCHANTMENT_WATER_WORKER"))) {
|
||||
return Enchantment.WATER_WORKER;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Enchantment getEnchantmentFromPrettyName(String enchant) {
|
||||
while (MiscUtil.spaceToCapital(enchant) != null) {
|
||||
enchant = MiscUtil.spaceToCapital(enchant);
|
||||
}
|
||||
return getEnchantmentFromProperName(enchant);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -15,19 +15,44 @@ package me.blackvein.quests.util;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class MiscUtil {
|
||||
|
||||
public static String getCapitalized(String s) {
|
||||
if (s.isEmpty()) {
|
||||
return s;
|
||||
public static String getCapitalized(String input) {
|
||||
if (input.isEmpty()) {
|
||||
return input;
|
||||
}
|
||||
s = s.toLowerCase();
|
||||
String s2 = s.substring(0, 1);
|
||||
s2 = s2.toUpperCase();
|
||||
s = s.substring(1, s.length());
|
||||
return s2 + s;
|
||||
String firstLetter = input.substring(0, 1);
|
||||
String remainder = input.substring(1);
|
||||
String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
|
||||
return capitalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets player-friendly name from type. 'ENDER_DRAGON' becomes 'Ender Dragon'
|
||||
*
|
||||
* @param type any mob type, ideally
|
||||
* @return cleaned-up string
|
||||
*/
|
||||
public static String getPrettyMobName(EntityType type) {
|
||||
String baseString = type.toString();
|
||||
String[] substrings = baseString.split("_");
|
||||
String prettyString = "";
|
||||
int size = 1;
|
||||
for (String s : substrings) {
|
||||
prettyString = prettyString.concat(getCapitalized(s));
|
||||
if (size < substrings.length) {
|
||||
prettyString = prettyString.concat(" ");
|
||||
}
|
||||
size++;
|
||||
}
|
||||
if (type.equals((EntityType.OCELOT))) {
|
||||
prettyString = "Ocelot";
|
||||
}
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
public static String getProperMobName(EntityType type) {
|
||||
@ -51,6 +76,65 @@ public class MiscUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getPrettyDyeColorName(DyeColor color) {
|
||||
return Lang.get("COLOR_" + color.name());
|
||||
}
|
||||
|
||||
public static DyeColor getDyeColor(String s) {
|
||||
String col = Lang.getKey(getCapitalized(s));
|
||||
col = col.replace("COLOR_", "");
|
||||
DyeColor color = null;
|
||||
try {
|
||||
color = DyeColor.valueOf(col);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Do nothing
|
||||
}
|
||||
return color != null ? color : getDyeColorLegacy(s);
|
||||
}
|
||||
|
||||
public static DyeColor getDyeColorLegacy(String s) {
|
||||
if (s.equalsIgnoreCase("Black") || s.equalsIgnoreCase(Lang.get("COLOR_BLACK"))) {
|
||||
return DyeColor.BLACK;
|
||||
} else if (s.equalsIgnoreCase("Blue") || s.equalsIgnoreCase(Lang.get("COLOR_BLUE"))) {
|
||||
return DyeColor.BLUE;
|
||||
} else if (s.equalsIgnoreCase("Brown") || s.equalsIgnoreCase(Lang.get("COLOR_BROWN"))) {
|
||||
return DyeColor.BROWN;
|
||||
} else if (s.equalsIgnoreCase("Cyan") || s.equalsIgnoreCase(Lang.get("COLOR_CYAN"))) {
|
||||
return DyeColor.CYAN;
|
||||
} else if (s.equalsIgnoreCase("Gray") || s.equalsIgnoreCase(Lang.get("COLOR_GRAY"))) {
|
||||
return DyeColor.GRAY;
|
||||
} else if (s.equalsIgnoreCase("Green") || s.equalsIgnoreCase(Lang.get("COLOR_GREEN"))) {
|
||||
return DyeColor.GREEN;
|
||||
} else if (s.equalsIgnoreCase("LightBlue") || s.equalsIgnoreCase(Lang.get("COLOR_LIGHT_BLUE"))) {
|
||||
return DyeColor.LIGHT_BLUE;
|
||||
} else if (s.equalsIgnoreCase("Lime") || s.equalsIgnoreCase(Lang.get("COLOR_LIME"))) {
|
||||
return DyeColor.LIME;
|
||||
} else if (s.equalsIgnoreCase("Magenta") || s.equalsIgnoreCase(Lang.get("COLOR_MAGENTA"))) {
|
||||
return DyeColor.MAGENTA;
|
||||
} else if (s.equalsIgnoreCase("Orange") || s.equalsIgnoreCase(Lang.get("COLOR_ORAGE"))) {
|
||||
return DyeColor.ORANGE;
|
||||
} else if (s.equalsIgnoreCase("Pink") || s.equalsIgnoreCase(Lang.get("COLOR_PINK"))) {
|
||||
return DyeColor.PINK;
|
||||
} else if (s.equalsIgnoreCase("Purple") || s.equalsIgnoreCase(Lang.get("COLOR_PURPLE"))) {
|
||||
return DyeColor.PURPLE;
|
||||
} else if (s.equalsIgnoreCase("Red") || s.equalsIgnoreCase(Lang.get("COLOR_RED"))) {
|
||||
return DyeColor.RED;
|
||||
// 1.13 changed DyeColor.SILVER -> DyeColor.LIGHT_GRAY
|
||||
} else if (s.equalsIgnoreCase("Silver") || s.equalsIgnoreCase("LightGray") || s.equalsIgnoreCase(Lang.get("COLOR_SILVER"))) {
|
||||
return DyeColor.getByColor(Color.SILVER);
|
||||
} else if (s.equalsIgnoreCase("White") || s.equalsIgnoreCase(Lang.get("COLOR_WHITE"))) {
|
||||
return DyeColor.WHITE;
|
||||
} else if (s.equalsIgnoreCase("Yellow") || s.equalsIgnoreCase(Lang.get("COLOR_YELLOW"))) {
|
||||
return DyeColor.YELLOW;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDyeString(DyeColor dc) {
|
||||
return Lang.get("COLOR_" + dc.name());
|
||||
}
|
||||
|
||||
public static String concatArgArray(String[] args, int startingIndex, int endingIndex, char delimiter) {
|
||||
String s = "";
|
||||
for (int i = startingIndex; i <= endingIndex; i++) {
|
||||
@ -87,4 +171,38 @@ public class MiscUtil {
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single space in front of all capital letters
|
||||
*
|
||||
* @param s string to process
|
||||
* @return processed string
|
||||
*/
|
||||
public static String capitalsToSpaces(String s) {
|
||||
int max = s.length();
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Capitalize character after space
|
||||
*
|
||||
* @param s string to process
|
||||
* @return processed string
|
||||
*/
|
||||
public static String spaceToCapital(String s) {
|
||||
int index = s.indexOf(' ');
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
@ -43,5 +43,4 @@ public class RomanNumeral {
|
||||
}
|
||||
return map.get(l) + getNumeral(number-l);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
|
@ -18,4 +18,3 @@ show-titles: true
|
||||
translate-names: true
|
||||
translate-subcommands: false
|
||||
use-compass: true
|
||||
use-gps-plugin: true
|
4
pom.xml
4
pom.xml
@ -6,12 +6,12 @@
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>3.6.9</version>
|
||||
<version>3.7.0</version>
|
||||
<name>quests</name>
|
||||
<url>https://github.com/PikaMug/Quests/</url>
|
||||
|
||||
<properties>
|
||||
<revision>3.6.9</revision>
|
||||
<revision>3.7.0</revision>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>3.6.9</version>
|
||||
<version>3.7.0</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>3.6.9</version>
|
||||
<version>3.7.0</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>3.6.9</version>
|
||||
<version>3.7.0</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
Loading…
Reference in New Issue
Block a user