mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-25 12:15:59 +01:00
Continued UUID Conversion (Needs testing)
Updated for 1.7.9.10
This commit is contained in:
parent
bd711ce14c
commit
75ab54a82e
Binary file not shown.
13
pom.xml
13
pom.xml
@ -25,16 +25,23 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit1</artifactId>
|
||||
<version>1.7.10-R0.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/craftbukkit-1.7.10-R0.1.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit3</artifactId>
|
||||
<version>1.7.9-R0.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/craftbukkit-1.7.2-R0.4.jar</systemPath>
|
||||
<systemPath>${project.basedir}/lib/craftbukkit-1.7.9-R0.3.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit2</artifactId>
|
||||
<version>1.7.9-R0.3</version>
|
||||
<version>1.7.2-R0.4</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/craftbukkit-1.7.9-R0.3.jar</systemPath>
|
||||
<systemPath>${project.basedir}/lib/craftbukkit-1.7.2-R0.4.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.citizensnpcs</groupId>
|
||||
|
68
src/main/java/me/blackvein/particles/Eff_1_7_R4.java
Normal file
68
src/main/java/me/blackvein/particles/Eff_1_7_R4.java
Normal file
@ -0,0 +1,68 @@
|
||||
package me.blackvein.particles;
|
||||
|
||||
import me.blackvein.quests.util.ReflectionUtil;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum Eff_1_7_R4 {
|
||||
|
||||
HUGE_EXPLOSION("hugeexplosion"),
|
||||
LARGE_EXPLODE("largeexplode"),
|
||||
FIREWORKS_SPARK("fireworksSpark"),
|
||||
BUBBLE("bubble"),
|
||||
SUSPEND("susgpend"),
|
||||
DEPTH_SUSPEND("depthSuspend"),
|
||||
TOWN_AURA("townaura"),
|
||||
CRIT("crit"),
|
||||
MAGIC_CRIT("magicCrit"),
|
||||
MOB_SPELL("mobSpell"),
|
||||
MOB_SPELL_AMBIENT("mobSpellAmbient"),
|
||||
SPELL("spell"),
|
||||
INSTANT_SPELL("instantSpell"),
|
||||
WITCH_MAGIC("witchMagic"),
|
||||
NOTE("note"),
|
||||
PORTAL("portal"),
|
||||
ENCHANTMENT_TABLE("enchantmenttable"),
|
||||
EXPLODE("explode"),
|
||||
FLAME("flame"),
|
||||
LAVA("lava"),
|
||||
FOOTSTEP("footstep"),
|
||||
SPLASH("splash"),
|
||||
LARGE_SMOKE("largesmoke"),
|
||||
CLOUD("cloud"),
|
||||
RED_DUST("reddust"),
|
||||
SNOWBALL_POOF("snowballpoof"),
|
||||
DRIP_WATER("dripWater"),
|
||||
DRIP_LAVA("dripLava"),
|
||||
SNOW_SHOVEL("snowshovel"),
|
||||
SLIME("slime"),
|
||||
HEART("heart"),
|
||||
ANGRY_VILLAGER("angryVillager"),
|
||||
HAPPY_VILLAGER("happyVillager"),
|
||||
ICONCRACK("iconcrack_"),
|
||||
TILECRACK("tilecrack_");
|
||||
|
||||
private final String particleName;
|
||||
|
||||
Eff_1_7_R4(String particleName) {
|
||||
this.particleName = particleName;
|
||||
}
|
||||
|
||||
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception {
|
||||
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
|
||||
ReflectionUtil.setValue(packet, "a", particleName);
|
||||
ReflectionUtil.setValue(packet, "b", (float) location.getX());
|
||||
ReflectionUtil.setValue(packet, "c", (float) location.getY());
|
||||
ReflectionUtil.setValue(packet, "d", (float) location.getZ());
|
||||
ReflectionUtil.setValue(packet, "e", offsetX);
|
||||
ReflectionUtil.setValue(packet, "f", offsetY);
|
||||
ReflectionUtil.setValue(packet, "g", offsetZ);
|
||||
ReflectionUtil.setValue(packet, "h", speed);
|
||||
ReflectionUtil.setValue(packet, "i", count);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
}
|
@ -83,7 +83,7 @@ public abstract class CustomObjective implements Listener {
|
||||
|
||||
public Map<String, Object> getDatamap(Player player, CustomObjective obj){
|
||||
|
||||
Quester quester = Quests.getInstance().getQuester(player.getName());
|
||||
Quester quester = Quests.getInstance().getQuester(player.getUniqueId());
|
||||
if(quester != null){
|
||||
|
||||
int index = -1;
|
||||
@ -114,7 +114,7 @@ public abstract class CustomObjective implements Listener {
|
||||
|
||||
public static void incrementObjective(Player player, CustomObjective obj, int count){
|
||||
|
||||
Quester quester = Quests.getInstance().getQuester(player.getName());
|
||||
Quester quester = Quests.getInstance().getQuester(player.getUniqueId());
|
||||
if(quester != null){
|
||||
|
||||
//Check if the player has Quest with objective
|
||||
@ -134,9 +134,9 @@ public abstract class CustomObjective implements Listener {
|
||||
|
||||
if(quester.customObjectiveCounts.containsKey(obj.getName())){
|
||||
int old = quester.customObjectiveCounts.get(obj.getName());
|
||||
Quests.getInstance().getQuester(player.getName()).customObjectiveCounts.put(obj.getName(), old + count);
|
||||
Quests.getInstance().getQuester(player.getUniqueId()).customObjectiveCounts.put(obj.getName(), old + count);
|
||||
}else{
|
||||
Quests.getInstance().getQuester(player.getName()).customObjectiveCounts.put(obj.getName(), count);
|
||||
Quests.getInstance().getQuester(player.getUniqueId()).customObjectiveCounts.put(obj.getName(), count);
|
||||
}
|
||||
|
||||
int index = -1;
|
||||
|
@ -250,8 +250,7 @@ public class Event {
|
||||
if (commands.isEmpty() == false) {
|
||||
|
||||
for (String s : commands) {
|
||||
quester.plugin.getServer().dispatchCommand(quester.plugin.getServer().getConsoleSender(), s.replaceAll("<player>", quester.name));
|
||||
|
||||
quester.plugin.getServer().dispatchCommand(quester.plugin.getServer().getConsoleSender(), s.replaceAll("<player>", quester.getPlayer().getName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package me.blackvein.quests;
|
||||
import me.blackvein.particles.Eff_1_7_R3;
|
||||
import java.util.List;
|
||||
import me.blackvein.particles.Eff_1_7_R1;
|
||||
import me.blackvein.particles.Eff_1_7_R4;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -24,7 +25,7 @@ public class NpcEffectThread implements Runnable{
|
||||
|
||||
for(Player player : plugin.getServer().getOnlinePlayers()){
|
||||
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0);
|
||||
if(nearby.isEmpty() == false){
|
||||
|
||||
@ -54,9 +55,121 @@ public class NpcEffectThread implements Runnable{
|
||||
showEffect_R1(player, npc);
|
||||
else if(Bukkit.getVersion().contains("1.7.9"))
|
||||
showEffect_R3(player, npc);
|
||||
else if(Bukkit.getVersion().contains("1.7.10"))
|
||||
showEffect_R4(player, npc);
|
||||
|
||||
}
|
||||
|
||||
private static void showEffect_R4(Player player, NPC npc){
|
||||
|
||||
if(Quests.effect.equalsIgnoreCase("enchant")){
|
||||
|
||||
try{
|
||||
Eff_1_7_R4.ENCHANTMENT_TABLE.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 10);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("crit")){
|
||||
|
||||
try{
|
||||
Eff_1_7_R4.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("spell")){
|
||||
|
||||
try{
|
||||
Eff_1_7_R4.INSTANT_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("magiccrit")){
|
||||
|
||||
try{
|
||||
Eff_1_7_R4.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("mobspell")){
|
||||
|
||||
try{
|
||||
Eff_1_7_R4.MOB_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("note")){
|
||||
|
||||
try{
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Eff_1_7_R4.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("portal")){
|
||||
|
||||
try{
|
||||
Eff_1_7_R4.PORTAL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 5);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("dust")){
|
||||
|
||||
try{
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Eff_1_7_R4.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("witch")){
|
||||
|
||||
try{
|
||||
Eff_1_7_R4.WITCH_MAGIC.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("snowball")){
|
||||
|
||||
try{
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Eff_1_7_R4.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("splash")){
|
||||
|
||||
try{
|
||||
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||
Eff_1_7_R4.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if(Quests.effect.equalsIgnoreCase("smoke")){
|
||||
|
||||
try{
|
||||
Eff_1_7_R4.TOWN_AURA.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 20);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void showEffect_R3(Player player, NPC npc){
|
||||
|
||||
if(Quests.effect.equalsIgnoreCase("enchant")){
|
||||
|
@ -42,7 +42,7 @@ public class NpcListener implements Listener {
|
||||
if (evt.getClicker().isConversing() == false) {
|
||||
|
||||
final Player player = evt.getClicker();
|
||||
final Quester quester = plugin.getQuester(player.getName());
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
boolean delivery = false;
|
||||
|
||||
if (quester.hasObjective("deliverItem") && player.getItemInHand() != null) {
|
||||
@ -217,7 +217,7 @@ public class NpcListener implements Listener {
|
||||
|
||||
if (okay) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.hasObjective("killNPC")) {
|
||||
quester.killNPC(evt.getNPC());
|
||||
}
|
||||
@ -238,7 +238,7 @@ public class NpcListener implements Listener {
|
||||
if (okay) {
|
||||
|
||||
Player player = (Player) damager;
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.hasObjective("killNPC")) {
|
||||
quester.killNPC(evt.getNPC());
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||
|
||||
final Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
final Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
final Player player = evt.getPlayer();
|
||||
|
||||
if (quester.hasObjective("useBlock")) {
|
||||
@ -179,7 +179,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent evt) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getWhoClicked().getName());
|
||||
Quester quester = plugin.getQuester(evt.getWhoClicked().getUniqueId());
|
||||
Player player = (Player) evt.getWhoClicked();
|
||||
|
||||
if (evt.getInventory().getTitle().equals("Quests")) {
|
||||
@ -267,7 +267,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
|
||||
if (quester.currentStage != null) {
|
||||
|
||||
@ -308,7 +308,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (quester.hasObjective("damageBlock")) {
|
||||
|
||||
quester.damageBlock(evt.getBlock().getType());
|
||||
@ -324,7 +324,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (quester.hasObjective("placeBlock")) {
|
||||
|
||||
if (evt.isCancelled() == false) {
|
||||
@ -342,7 +342,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (quester.hasObjective("breakBlock")) {
|
||||
|
||||
if (evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH) == false && evt.isCancelled() == false) {
|
||||
@ -382,7 +382,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (evt.getEntity().getType().equals(EntityType.SHEEP) && quester.hasObjective("shearSheep")) {
|
||||
|
||||
Sheep sheep = (Sheep) evt.getEntity();
|
||||
@ -402,7 +402,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
Player p = (Player) evt.getOwner();
|
||||
if (plugin.checkQuester(p.getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(p.getName());
|
||||
Quester quester = plugin.getQuester(p.getUniqueId());
|
||||
if (quester.hasObjective("tameMob")) {
|
||||
|
||||
quester.tameMob(evt.getEntityType());
|
||||
@ -420,7 +420,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (plugin.checkQuester(evt.getEnchanter().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getEnchanter().getName());
|
||||
Quester quester = plugin.getQuester(evt.getEnchanter().getUniqueId());
|
||||
if (quester.hasObjective("enchantItem")) {
|
||||
|
||||
for (Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||
@ -533,7 +533,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (okay) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
|
||||
if (quester.hasObjective("killMob")) {
|
||||
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
||||
@ -555,7 +555,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
if (okay) {
|
||||
|
||||
Player player = (Player) damager;
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.hasObjective("killMob")) {
|
||||
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
||||
}
|
||||
@ -600,7 +600,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (okay) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
|
||||
if (quester.hasObjective("killPlayer")) {
|
||||
quester.killPlayer(evt.getEntity().getName());
|
||||
@ -630,7 +630,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (okay) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.hasObjective("killPlayer")) {
|
||||
quester.killPlayer(evt.getEntity().getName());
|
||||
}
|
||||
@ -647,7 +647,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
Player player = evt.getEntity();
|
||||
if (plugin.checkQuester(player.getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if(quester.currentStage != null){
|
||||
if(quester.currentStage.deathEvent != null){
|
||||
quester.currentStage.deathEvent.fire(quester);
|
||||
@ -664,7 +664,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
Player player = evt.getPlayer();
|
||||
if (plugin.checkQuester(player.getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester.hasObjective("catchFish") && evt.getState().equals(State.CAUGHT_FISH)) {
|
||||
quester.catchFish();
|
||||
}
|
||||
@ -676,17 +676,19 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent evt) {
|
||||
|
||||
System.out.println("Joined: " + evt.getPlayer().getUniqueId());
|
||||
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = new Quester(plugin);
|
||||
quester.name = evt.getPlayer().getName();
|
||||
if (new File(plugin.getDataFolder(), "data/" + quester.name + ".yml").exists()) {
|
||||
quester.id = evt.getPlayer().getUniqueId();
|
||||
if (new File(plugin.getDataFolder(), "data/" + quester.id + ".yml").exists()) {
|
||||
quester.loadData();
|
||||
} else if (Quests.genFilesOnJoin) {
|
||||
quester.saveData();
|
||||
}
|
||||
|
||||
plugin.questers.put(evt.getPlayer().getName(), quester);
|
||||
plugin.questers.put(evt.getPlayer().getUniqueId(), quester);
|
||||
|
||||
for (String s : quester.completedQuests) {
|
||||
|
||||
@ -723,7 +725,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (plugin.checkQuester(evt.getPlayer().getName()) == false) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
if (quester.currentQuest != null) {
|
||||
|
||||
if (quester.currentStage.delay > -1) {
|
||||
@ -742,7 +744,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if(plugin.questFactory.selectingNPCs.contains(evt.getPlayer()))
|
||||
plugin.questFactory.selectingNPCs.remove(evt.getPlayer());
|
||||
plugin.questers.remove(quester.name);
|
||||
plugin.questers.remove(quester.id);
|
||||
|
||||
}
|
||||
|
||||
@ -762,7 +764,7 @@ public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
if (isPlayer) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||
|
||||
if (quester.hasObjective("reachLocation")) {
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class Quest {
|
||||
|
||||
public boolean testRequirements(Player player) {
|
||||
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
|
||||
if (moneyReq != 0 && Quests.economy.getBalance(player.getName()) < moneyReq) {
|
||||
return false;
|
||||
@ -269,7 +269,7 @@ public class Quest {
|
||||
|
||||
public void completeQuest(Quester q) {
|
||||
|
||||
Player player = plugin.getServer().getPlayerExact(q.name);
|
||||
Player player = plugin.getServer().getPlayer(q.id);
|
||||
q.resetObjectives();
|
||||
q.completedQuests.add(name);
|
||||
String none = ChatColor.GRAY + "- (" + Lang.get("none") + ")";
|
||||
@ -281,7 +281,7 @@ public class Quest {
|
||||
}
|
||||
|
||||
if (moneyReward > 0 && Quests.economy != null) {
|
||||
Quests.economy.depositPlayer(q.name, moneyReward);
|
||||
Quests.economy.depositPlayer(q.getOfflinePlayer(), moneyReward);
|
||||
none = null;
|
||||
}
|
||||
if (redoDelay > -1) {
|
||||
@ -511,7 +511,7 @@ public class Quest {
|
||||
|
||||
public void failQuest(Quester q) {
|
||||
|
||||
Player player = plugin.getServer().getPlayerExact(q.name);
|
||||
Player player = plugin.getServer().getPlayer(q.id);
|
||||
q.resetObjectives();
|
||||
|
||||
String title = Lang.get("questTitle");
|
||||
|
@ -15,6 +15,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -29,7 +30,7 @@ import org.bukkit.potion.Potion;
|
||||
|
||||
public class Quester {
|
||||
|
||||
String name;
|
||||
UUID id;
|
||||
boolean editorMode = false;
|
||||
boolean holdingQuestItemFromStorage = false;
|
||||
boolean delayOver = true;
|
||||
@ -79,14 +80,20 @@ public class Quester {
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
|
||||
return plugin.getServer().getPlayerExact(name);
|
||||
|
||||
|
||||
return Bukkit.getServer().getPlayer(id);
|
||||
|
||||
}
|
||||
|
||||
public OfflinePlayer getOfflinePlayer() {
|
||||
|
||||
return Bukkit.getServer().getOfflinePlayer(id);
|
||||
|
||||
}
|
||||
|
||||
public void takeQuest(Quest q, boolean override) {
|
||||
|
||||
Player player = plugin.getServer().getPlayer(name);
|
||||
Player player = getPlayer();
|
||||
|
||||
if (q.testRequirements(player) == true || override) {
|
||||
|
||||
@ -97,7 +104,7 @@ public class Quester {
|
||||
if (!override) {
|
||||
|
||||
if (q.moneyReq > 0) {
|
||||
Quests.economy.withdrawPlayer(name, q.moneyReq);
|
||||
Quests.economy.withdrawPlayer(getOfflinePlayer(), q.moneyReq);
|
||||
}
|
||||
|
||||
for (ItemStack is : q.items) {
|
||||
@ -893,7 +900,7 @@ public class Quester {
|
||||
String error = Lang.get("killNotValid");
|
||||
error = error.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(comparator - (currentTime - killTime)) + ChatColor.RED);
|
||||
error = error.replaceAll("<player>", ChatColor.DARK_PURPLE + player + ChatColor.RED);
|
||||
plugin.getServer().getPlayer(name).sendMessage(ChatColor.RED + error);
|
||||
getPlayer().sendMessage(ChatColor.RED + error);
|
||||
return;
|
||||
|
||||
}
|
||||
@ -1002,7 +1009,7 @@ public class Quester {
|
||||
|
||||
public void deliverItem(ItemStack i) {
|
||||
|
||||
Player player = plugin.getServer().getPlayer(name);
|
||||
Player player = getPlayer();
|
||||
|
||||
ItemStack found = null;
|
||||
|
||||
@ -1084,7 +1091,7 @@ public class Quester {
|
||||
|
||||
public void finishObjective(String objective, Material material, ItemStack itemstack, Enchantment enchantment, EntityType mob, String player, NPC npc, Location location, DyeColor color, String pass, CustomObjective co) {
|
||||
|
||||
Player p = plugin.getServer().getPlayerExact(name);
|
||||
Player p = getPlayer();
|
||||
|
||||
if (currentStage.objectiveOverride != null) {
|
||||
|
||||
@ -1643,7 +1650,7 @@ public class Quester {
|
||||
|
||||
FileConfiguration data = getBaseData();
|
||||
try {
|
||||
data.save(new File(plugin.getDataFolder(), "data/" + name + ".yml"));
|
||||
data.save(new File(plugin.getDataFolder(), "data/" + id + ".yml"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -2072,7 +2079,17 @@ public class Quester {
|
||||
|
||||
FileConfiguration data = new YamlConfiguration();
|
||||
try {
|
||||
data.load(new File(plugin.getDataFolder(), "data/" + name + ".yml"));
|
||||
|
||||
File dataFile = new File(plugin.getDataFolder(), "data/" + id.toString() + ".yml");
|
||||
if(dataFile.exists() == false) {
|
||||
OfflinePlayer p = getOfflinePlayer();
|
||||
dataFile = new File(plugin.getDataFolder(), "data/" + p.getName() + ".yml");
|
||||
if(dataFile.exists() == false)
|
||||
return false;
|
||||
}
|
||||
|
||||
data.load(dataFile);
|
||||
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
} catch (InvalidConfigurationException e) {
|
||||
@ -2168,7 +2185,7 @@ public class Quester {
|
||||
if (stage == null) {
|
||||
currentQuest = quest;
|
||||
currentQuest.completeQuest(this);
|
||||
Quests.log.log(Level.SEVERE, "[Quests] Invalid stage for player: \"" + name + "\". Quest ended.");
|
||||
Quests.log.log(Level.SEVERE, "[Quests] Invalid stage for player: \"" + id + "\". Quest ended.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2521,7 +2538,7 @@ public class Quester {
|
||||
} else {
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(plugin, this), (long) (currentStage.delay * 0.02));
|
||||
if (currentStage.delayMessage != null) {
|
||||
plugin.getServer().getPlayer(name).sendMessage(Quests.parseString((currentStage.delayMessage), currentQuest));
|
||||
plugin.getServer().getPlayer(id).sendMessage(Quests.parseString((currentStage.delayMessage), currentQuest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2581,10 +2598,10 @@ public class Quester {
|
||||
currentStage = null;
|
||||
currentStageIndex = 0;
|
||||
resetObjectives();
|
||||
if (plugin.getServer().getPlayer(name) != null) {
|
||||
if (plugin.getServer().getPlayer(id) != null) {
|
||||
String error = Lang.get("questModified");
|
||||
error = error.replaceAll("<quest>", ChatColor.DARK_PURPLE + currentQuest.name + ChatColor.RED);
|
||||
plugin.getServer().getPlayer(name).sendMessage(ChatColor.GOLD + "[Quests] " + ChatColor.RED + error);
|
||||
plugin.getServer().getPlayer(id).sendMessage(ChatColor.GOLD + "[Quests] " + ChatColor.RED + error);
|
||||
}
|
||||
currentQuest = null;
|
||||
|
||||
@ -2601,10 +2618,10 @@ public class Quester {
|
||||
currentStage = null;
|
||||
currentStageIndex = 0;
|
||||
resetObjectives();
|
||||
if (plugin.getServer().getPlayer(name) != null) {
|
||||
if (plugin.getServer().getPlayer(id) != null) {
|
||||
String error = Lang.get("questNotExist");
|
||||
error = error.replaceAll("<quest>", ChatColor.DARK_PURPLE + currentQuest.name + ChatColor.RED);
|
||||
plugin.getServer().getPlayer(name).sendMessage(ChatColor.GOLD + "[Quests] " + ChatColor.RED + error);
|
||||
plugin.getServer().getPlayer(id).sendMessage(ChatColor.GOLD + "[Quests] " + ChatColor.RED + error);
|
||||
}
|
||||
currentQuest = null;
|
||||
|
||||
|
@ -91,6 +91,7 @@ import java.util.Enumeration;
|
||||
import java.util.UUID;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
|
||||
public class Quests extends JavaPlugin implements ConversationAbandonedListener, ColorUtil {
|
||||
|
||||
@ -110,7 +111,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
public static int acceptTimeout = 20;
|
||||
public static int inviteTimeout = 20;
|
||||
public static String effect = "note";
|
||||
public final Map<String, Quester> questers = new HashMap<String, Quester>();
|
||||
public final Map<UUID, Quester> questers = new HashMap<UUID, Quester>();
|
||||
public final List<String> questerBlacklist = new LinkedList<String>();
|
||||
public final List<CustomRequirement> customRequirements = new LinkedList<CustomRequirement>();
|
||||
public final List<CustomReward> customRewards = new LinkedList<CustomReward>();
|
||||
@ -347,7 +348,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
printInfo("[Quests] Saving Quester data.");
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
|
||||
Quester quester = getQuester(p.getName());
|
||||
Quester quester = getQuester(p.getUniqueId());
|
||||
quester.saveData();
|
||||
|
||||
}
|
||||
@ -367,7 +368,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
if (abandonedEvent.getContext().getForWhom() != null) {
|
||||
|
||||
try {
|
||||
abandonedEvent.getContext().getForWhom().sendRawMessage(YELLOW + "Cancelled.");
|
||||
abandonedEvent.getContext().getForWhom().sendRawMessage(YELLOW + Lang.get("questTimeout"));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
@ -397,7 +398,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
|
||||
|
||||
getQuester(player.getName()).takeQuest(getQuest(getQuester(player.getName()).questToTake), false);
|
||||
getQuester(player.getUniqueId()).takeQuest(getQuest(getQuester(player.getUniqueId()).questToTake), false);
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
||||
} else if (s.equalsIgnoreCase(Lang.get("noWord"))) {
|
||||
@ -819,22 +820,20 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
points = Integer.parseInt(args[2]);
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
Quester quester = getQuester(target.getUniqueId());
|
||||
quester.questPoints += Math.abs(points);
|
||||
|
||||
String msg1 = Lang.get("giveQuestPoints");
|
||||
msg1 = msg1.replaceAll("<player>", GREEN + target.getName() + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
cs.sendMessage(GOLD + msg1);
|
||||
String msg2 = Lang.get("questPointsGiven");
|
||||
msg2 = msg2.replaceAll("<player>", GREEN + cs.getName() + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
String msg1 = Lang.get("giveQuestPoints");
|
||||
msg1 = msg1.replaceAll("<player>", GREEN + target.getName() + GOLD);
|
||||
msg1 = msg1.replaceAll("<number>", PURPLE + "" + points + GOLD);
|
||||
cs.sendMessage(GOLD + msg1);
|
||||
String msg2 = Lang.get("questPointsGiven");
|
||||
msg2 = msg2.replaceAll("<player>", GREEN + cs.getName() + GOLD);
|
||||
msg2 = msg2.replaceAll("<number>", PURPLE + "" + points + GOLD);
|
||||
target.sendMessage(GREEN + msg2);
|
||||
|
||||
quester.saveData();
|
||||
|
||||
return;
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
cs.sendMessage(YELLOW + Lang.get("inputNum"));
|
||||
@ -882,16 +881,17 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
return;
|
||||
|
||||
}
|
||||
Quester quester = getQuester(target.getName());
|
||||
Quester quester = getQuester(target.getUniqueId());
|
||||
quester.questPoints -= Math.abs(points);
|
||||
|
||||
String msg1 = Lang.get("takeQuestPoints");
|
||||
String msg1 = Lang.get("takeQuestPoints");
|
||||
msg1 = msg1.replaceAll("<player>", GREEN + target.getName() + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg1 = msg1.replaceAll("<number>", PURPLE + "" + points + GOLD);
|
||||
cs.sendMessage(GOLD + msg1);
|
||||
String msg2 = Lang.get("questPointsTaken");
|
||||
msg2 = msg2.replaceAll("<player>", GREEN + cs.getName() + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg2 = msg2.replaceAll("<number>", PURPLE + "" + points + GOLD);
|
||||
|
||||
target.sendMessage(GREEN + msg2);
|
||||
|
||||
quester.saveData();
|
||||
@ -938,16 +938,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
Quester quester = getQuester(target.getUniqueId());
|
||||
quester.questPoints = points;
|
||||
|
||||
String msg1 = Lang.get("setQuestPoints");
|
||||
msg1 = msg1.replaceAll("<player>", GREEN + target.getName() + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg1 = msg1.replaceAll("<number>", PURPLE + "" + points + GOLD);
|
||||
cs.sendMessage(GOLD + msg1);
|
||||
String msg2 = Lang.get("questPointsSet");
|
||||
msg2 = msg2.replaceAll("<player>", GREEN + cs.getName() + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg2 = msg2.replaceAll("<number>", PURPLE + "" + points + GOLD);
|
||||
target.sendMessage(GREEN + msg2);
|
||||
|
||||
quester.saveData();
|
||||
@ -1028,16 +1028,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
} else {
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
Quester quester = getQuester(target.getUniqueId());
|
||||
quester.resetObjectives();
|
||||
|
||||
String msg1 = Lang.get("questForceTake");
|
||||
msg1 = msg1.replaceAll("<player>", GREEN + target.getName() + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + (quester.currentQuest == null ? Lang.get("none") : quester.currentQuest.name)+ GOLD);
|
||||
cs.sendMessage(GOLD + msg1);
|
||||
String msg2 = Lang.get("questForcedTake");
|
||||
msg2 = msg2.replaceAll("<player>", GREEN + cs.getName() + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + (quester.currentQuest == null ? Lang.get("none") : quester.currentQuest.name)+ GOLD);
|
||||
target.sendMessage(GREEN + msg2);
|
||||
quester.takeQuest(questToGive, true);
|
||||
|
||||
@ -1170,7 +1170,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
} else {
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
Quester quester = getQuester(target.getUniqueId());
|
||||
if (quester.currentQuest == null) {
|
||||
|
||||
String msg = Lang.get("noCurrentQuest");
|
||||
@ -1181,11 +1181,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
String msg1 = Lang.get("questForceFinish");
|
||||
msg1 = msg1.replaceAll("<player>", GREEN + target.getName() + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + (quester.currentQuest == null ? Lang.get("none") : quester.currentQuest.name)+ GOLD);
|
||||
cs.sendMessage(GOLD + msg1);
|
||||
String msg2 = Lang.get("questForcedFinish");
|
||||
msg2 = msg2.replaceAll("<player>", GREEN + cs.getName() + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + (quester.currentQuest == null ? Lang.get("none") : quester.currentQuest.name)+ GOLD);
|
||||
target.sendMessage(GREEN + msg2);
|
||||
quester.currentQuest.completeQuest(quester);
|
||||
|
||||
@ -1245,7 +1245,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
} else {
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
Quester quester = getQuester(target.getUniqueId());
|
||||
if (quester.currentQuest == null) {
|
||||
|
||||
String msg = Lang.get("noCurrentQuest");
|
||||
@ -1295,7 +1295,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
} else {
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
Quester quester = getQuester(target.getUniqueId());
|
||||
if (quester.currentQuest == null) {
|
||||
|
||||
String msg = Lang.get("noCurrentQuest");
|
||||
@ -1306,11 +1306,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
String msg1 = Lang.get("questForceNextStage");
|
||||
msg1 = msg1.replaceAll("<player>", GREEN + target.getName() + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + (quester.currentQuest == null ? Lang.get("none") : quester.currentQuest.name)+ GOLD);
|
||||
cs.sendMessage(GOLD + msg1);
|
||||
String msg2 = Lang.get("questForcedNextStage");
|
||||
msg2 = msg2.replaceAll("<player>", GREEN + cs.getName() + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + (quester.currentQuest == null ? Lang.get("none") : quester.currentQuest.name)+ GOLD);
|
||||
target.sendMessage(GREEN + msg2);
|
||||
quester.currentQuest.nextStage(quester);
|
||||
|
||||
@ -1347,7 +1347,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
} else {
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
Quester quester = getQuester(target.getUniqueId());
|
||||
if (quester.currentQuest == null) {
|
||||
|
||||
String msg = Lang.get("noCurrentQuest");
|
||||
@ -1361,11 +1361,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
quester.currentStageIndex = 0;
|
||||
String msg1 = Lang.get("questForceQuit");
|
||||
msg1 = msg1.replaceAll("<player>", GREEN + target.getName() + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg1 = msg1.replaceAll("<quest>", PURPLE + (quester.currentQuest == null ? Lang.get("none") : quester.currentQuest.name)+ GOLD);
|
||||
cs.sendMessage(GOLD + msg1);
|
||||
String msg2 = Lang.get("questForcedQuit");
|
||||
msg2 = msg2.replaceAll("<player>", GREEN + cs.getName() + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + quester.currentQuest.name + GOLD);
|
||||
msg2 = msg2.replaceAll("<quest>", PURPLE + (quester.currentQuest == null ? Lang.get("none") : quester.currentQuest.name)+ GOLD);
|
||||
target.sendMessage(GREEN + msg2);
|
||||
quester.currentQuest = null;
|
||||
|
||||
@ -1397,15 +1397,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_TAKE"))) {
|
||||
|
||||
questsTake(cs, args);
|
||||
questsTake((Player) cs, args);
|
||||
|
||||
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_QUIT"))) {
|
||||
|
||||
questsQuit(cs);
|
||||
questsQuit((Player) cs);
|
||||
|
||||
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_STATS"))) {
|
||||
|
||||
questsStats(cs);
|
||||
questsStats((Player)cs);
|
||||
|
||||
} else if (args[0].equalsIgnoreCase(Lang.get("COMMAND_TOP"))) {
|
||||
|
||||
@ -1432,6 +1432,26 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
} else if (args.length == 1) {
|
||||
|
||||
if (args[0].equalsIgnoreCase("convert")) {
|
||||
|
||||
if(cs instanceof ConsoleCommandSender) {
|
||||
|
||||
convertQuesters();
|
||||
|
||||
}else {
|
||||
cs.sendMessage(YELLOW + Lang.get("questsUnknownCommand"));
|
||||
return true;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(YELLOW + "This command may only be performed in-game.");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(YELLOW + "This command may only be performed in-game.");
|
||||
@ -1542,14 +1562,14 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
return true;
|
||||
}
|
||||
|
||||
private void questsStats(final CommandSender cs) {
|
||||
Quester quester = getQuester(cs.getName());
|
||||
cs.sendMessage(GOLD + "- " + cs.getName() + " -");
|
||||
cs.sendMessage(YELLOW + Lang.get("questPointsDisplay") + " " + PURPLE + quester.questPoints + "/" + totalQuestPoints);
|
||||
private void questsStats(final Player player) {
|
||||
Quester quester = getQuester(player.getUniqueId());
|
||||
player.sendMessage(GOLD + "- " + player.getName() + " -");
|
||||
player.sendMessage(YELLOW + Lang.get("questPointsDisplay") + " " + PURPLE + quester.questPoints + "/" + totalQuestPoints);
|
||||
if (quester.currentQuest == null) {
|
||||
cs.sendMessage(YELLOW + Lang.get("currentQuest") + " " + PURPLE + Lang.get("none"));
|
||||
player.sendMessage(YELLOW + Lang.get("currentQuest") + " " + PURPLE + Lang.get("none"));
|
||||
} else {
|
||||
cs.sendMessage(YELLOW + Lang.get("currentQuest") + " " + PURPLE + quester.currentQuest.name);
|
||||
player.sendMessage(YELLOW + Lang.get("currentQuest") + " " + PURPLE + quester.currentQuest.name);
|
||||
}
|
||||
|
||||
String completed;
|
||||
@ -1575,16 +1595,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
cs.sendMessage(YELLOW + Lang.get("completedQuestsTitle"));
|
||||
cs.sendMessage(completed);
|
||||
player.sendMessage(YELLOW + Lang.get("completedQuestsTitle"));
|
||||
player.sendMessage(completed);
|
||||
}
|
||||
|
||||
private boolean questsQuit(final CommandSender cs) {
|
||||
private boolean questsQuit(final Player player) {
|
||||
if (allowQuitting == true) {
|
||||
|
||||
if (((Player) cs).hasPermission("quests.quit")) {
|
||||
if (((Player) player).hasPermission("quests.quit")) {
|
||||
|
||||
Quester quester = getQuester(cs.getName());
|
||||
Quester quester = getQuester(player.getUniqueId());
|
||||
if (quester.currentQuest != null) {
|
||||
|
||||
quester.resetObjectives();
|
||||
@ -1592,7 +1612,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
quester.currentStageIndex = 0;
|
||||
String msg = Lang.get("questQuit");
|
||||
msg = msg.replaceAll("<quest>", PURPLE + quester.currentQuest.name + YELLOW);
|
||||
cs.sendMessage(YELLOW + msg);
|
||||
player.sendMessage(YELLOW + msg);
|
||||
quester.currentQuest = null;
|
||||
quester.saveData();
|
||||
quester.loadData();
|
||||
@ -1600,34 +1620,33 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(YELLOW + Lang.get("noActiveQuest"));
|
||||
player.sendMessage(YELLOW + Lang.get("noActiveQuest"));
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(RED + Lang.get("questQuitNoPerms"));
|
||||
player.sendMessage(RED + Lang.get("questQuitNoPerms"));
|
||||
return true;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(YELLOW + Lang.get("questQuitDisabled"));
|
||||
player.sendMessage(YELLOW + Lang.get("questQuitDisabled"));
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void questsTake(final CommandSender cs, String[] args) {
|
||||
private void questsTake(final Player player, String[] args) {
|
||||
if (allowCommands == true) {
|
||||
|
||||
if (((Player) cs).hasPermission("quests.take")) {
|
||||
if (((Player) player).hasPermission("quests.take")) {
|
||||
|
||||
if (args.length == 1) {
|
||||
|
||||
cs.sendMessage(YELLOW + Lang.get("COMMAND_TAKE_USAGE"));
|
||||
return;
|
||||
player.sendMessage(YELLOW + Lang.get("COMMAND_TAKE_USAGE"));
|
||||
|
||||
} else {
|
||||
|
||||
@ -1672,40 +1691,40 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
if (questToFind != null) {
|
||||
|
||||
final Quest quest = questToFind;
|
||||
final Quester quester = getQuester(cs.getName());
|
||||
final Quest q = questToFind;
|
||||
final Quester quester = getQuester(player.getUniqueId());
|
||||
|
||||
if (quester.currentQuest != null) {
|
||||
cs.sendMessage(YELLOW + Lang.get("questOneActive"));
|
||||
} else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) {
|
||||
player.sendMessage(YELLOW + Lang.get("questOneActive"));
|
||||
} else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
|
||||
String msg = Lang.get("questAlreadyCompleted");
|
||||
msg = msg.replaceAll("<quest>", PURPLE + quest.name + YELLOW);
|
||||
cs.sendMessage(YELLOW + msg);
|
||||
} else if (quest.npcStart != null && allowCommandsForNpcQuests == false) {
|
||||
msg = msg.replaceAll("<quest>", PURPLE + q.name + YELLOW);
|
||||
player.sendMessage(YELLOW + msg);
|
||||
} else if (q.npcStart != null && allowCommandsForNpcQuests == false) {
|
||||
String msg = Lang.get("mustSpeakTo");
|
||||
msg = msg.replaceAll("<npc>", PURPLE + quest.npcStart.getName() + YELLOW);
|
||||
cs.sendMessage(YELLOW + msg);
|
||||
} else if (quest.blockStart != null) {
|
||||
msg = msg.replaceAll("<npc>", PURPLE + q.npcStart.getName() + YELLOW);
|
||||
player.sendMessage(YELLOW + msg);
|
||||
} else if (q.blockStart != null) {
|
||||
String msg = Lang.get("noCommandStart");
|
||||
msg = msg.replaceAll("<quest>", PURPLE + quest.name + YELLOW);
|
||||
cs.sendMessage(YELLOW + msg);
|
||||
msg = msg.replaceAll("<quest>", PURPLE + q.name + YELLOW);
|
||||
player.sendMessage(YELLOW + msg);
|
||||
} else {
|
||||
|
||||
boolean takeable = true;
|
||||
|
||||
if (quester.completedQuests.contains(quest.name)) {
|
||||
if (quester.completedQuests.contains(q.name)) {
|
||||
|
||||
if (quester.getDifference(quest) > 0) {
|
||||
if (quester.getDifference(q) > 0) {
|
||||
String early = Lang.get("questTooEarly");
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(quest)) + ChatColor.YELLOW);
|
||||
cs.sendMessage(YELLOW + early);
|
||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||
player.sendMessage(YELLOW + early);
|
||||
takeable = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (quest.region != null) {
|
||||
if (q.region != null) {
|
||||
|
||||
boolean inRegion = false;
|
||||
Player p = quester.getPlayer();
|
||||
@ -1713,7 +1732,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
Iterator<ProtectedRegion> it = rm.getApplicableRegions(p.getLocation()).iterator();
|
||||
while (it.hasNext()) {
|
||||
ProtectedRegion pr = it.next();
|
||||
if (pr.getId().equalsIgnoreCase(quest.region)) {
|
||||
if (pr.getId().equalsIgnoreCase(q.region)) {
|
||||
inRegion = true;
|
||||
break;
|
||||
}
|
||||
@ -1721,8 +1740,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
if (inRegion == false) {
|
||||
String msg = Lang.get("questInvalidLocation");
|
||||
msg = msg.replaceAll("<quest>", AQUA + quest.name + YELLOW);
|
||||
cs.sendMessage(YELLOW + msg);
|
||||
msg = msg.replaceAll("<quest>", AQUA + q.name + YELLOW);
|
||||
player.sendMessage(YELLOW + msg);
|
||||
takeable = false;
|
||||
}
|
||||
|
||||
@ -1730,11 +1749,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
if (takeable == true) {
|
||||
|
||||
if (cs instanceof Conversable) {
|
||||
if (player instanceof Conversable) {
|
||||
|
||||
if (((Player) cs).isConversing() == false) {
|
||||
if (((Player) player).isConversing() == false) {
|
||||
|
||||
quester.questToTake = quest.name;
|
||||
quester.questToTake = q.name;
|
||||
|
||||
String s
|
||||
= GOLD + "- " + PURPLE + quester.questToTake + GOLD + " -\n"
|
||||
@ -1742,20 +1761,17 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
+ RESET + getQuest(quester.questToTake).description + "\n";
|
||||
|
||||
for (String msg : s.split("<br>")) {
|
||||
cs.sendMessage(msg);
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
conversationFactory.buildConversation((Conversable) cs).begin();
|
||||
conversationFactory.buildConversation((Conversable) player).begin();
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(YELLOW + Lang.get("alreadyConversing"));
|
||||
player.sendMessage(YELLOW + Lang.get("alreadyConversing"));
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1763,23 +1779,20 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
}
|
||||
|
||||
} else {
|
||||
cs.sendMessage(YELLOW + Lang.get("questNotFound"));
|
||||
return;
|
||||
player.sendMessage(YELLOW + Lang.get("questNotFound"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(RED + Lang.get("questTakeNoPerms"));
|
||||
return;
|
||||
player.sendMessage(RED + Lang.get("questTakeNoPerms"));
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(YELLOW + Lang.get("questTakeDisabled"));
|
||||
return;
|
||||
player.sendMessage(YELLOW + Lang.get("questTakeDisabled"));
|
||||
|
||||
}
|
||||
}
|
||||
@ -1811,14 +1824,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
}
|
||||
|
||||
listQuests((Player) cs, page);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(RED + Lang.get("questListNoPerms"));
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
@ -1842,7 +1853,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
if (args.length == 0) {
|
||||
|
||||
showObjectives(cs);
|
||||
showObjectives((Player) cs);
|
||||
|
||||
} else {
|
||||
|
||||
@ -1890,32 +1901,32 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
}
|
||||
}
|
||||
|
||||
Quest quest = findQuest(name);
|
||||
Quest q = findQuest(name);
|
||||
|
||||
if (quest != null) {
|
||||
if (q != null) {
|
||||
|
||||
Player player = (Player) cs;
|
||||
Quester quester = getQuester(player.getName());
|
||||
Quester quester = getQuester(player.getUniqueId());
|
||||
|
||||
cs.sendMessage(GOLD + "- " + quest.name + " -");
|
||||
cs.sendMessage(GOLD + "- " + q.name + " -");
|
||||
cs.sendMessage(" ");
|
||||
if (quest.redoDelay > -1) {
|
||||
if (q.redoDelay > -1) {
|
||||
|
||||
if (quest.redoDelay == 0) {
|
||||
if (q.redoDelay == 0) {
|
||||
cs.sendMessage(DARKAQUA + Lang.get("readoable"));
|
||||
} else {
|
||||
String msg = Lang.get("redoableEvery");
|
||||
msg = msg.replaceAll("<time>", AQUA + getTime(quest.redoDelay) + DARKAQUA);
|
||||
msg = msg.replaceAll("<time>", AQUA + getTime(q.redoDelay) + DARKAQUA);
|
||||
cs.sendMessage(DARKAQUA + msg);
|
||||
}
|
||||
|
||||
}
|
||||
if (quest.npcStart != null) {
|
||||
if (q.npcStart != null) {
|
||||
String msg = Lang.get("speakTo");
|
||||
msg = msg.replaceAll("<npc>", quest.npcStart.getName());
|
||||
msg = msg.replaceAll("<npc>", q.npcStart.getName());
|
||||
cs.sendMessage(YELLOW + msg);
|
||||
} else {
|
||||
cs.sendMessage(YELLOW + quest.description);
|
||||
cs.sendMessage(YELLOW + q.description);
|
||||
}
|
||||
|
||||
cs.sendMessage(" ");
|
||||
@ -1924,9 +1935,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
cs.sendMessage(GOLD + Lang.get("requirements"));
|
||||
|
||||
if (quest.permissionReqs.isEmpty() == false) {
|
||||
if (q.permissionReqs.isEmpty() == false) {
|
||||
|
||||
for (String perm : quest.permissionReqs) {
|
||||
for (String perm : q.permissionReqs) {
|
||||
|
||||
if (permission.has(player, perm)) {
|
||||
cs.sendMessage(GREEN + Lang.get("permissionDisplay") + " " + perm);
|
||||
@ -1938,32 +1949,32 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
if (quest.heroesPrimaryClassReq != null) {
|
||||
if (q.heroesPrimaryClassReq != null) {
|
||||
|
||||
if (this.testPrimaryHeroesClass(quest.heroesPrimaryClassReq, player.getName())) {
|
||||
cs.sendMessage(BOLD + "" + GREEN + quest.heroesPrimaryClassReq + RESET + "" + DARKGREEN + " " + Lang.get("heroesClass"));
|
||||
if (this.testPrimaryHeroesClass(q.heroesPrimaryClassReq, player.getName())) {
|
||||
cs.sendMessage(BOLD + "" + GREEN + q.heroesPrimaryClassReq + RESET + "" + DARKGREEN + " " + Lang.get("heroesClass"));
|
||||
} else {
|
||||
cs.sendMessage(BOLD + "" + DARKRED + quest.heroesPrimaryClassReq + RESET + "" + RED + " " + Lang.get("heroesClass"));
|
||||
cs.sendMessage(BOLD + "" + DARKRED + q.heroesPrimaryClassReq + RESET + "" + RED + " " + Lang.get("heroesClass"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (quest.heroesSecondaryClassReq != null) {
|
||||
if (q.heroesSecondaryClassReq != null) {
|
||||
|
||||
if (this.testSecondaryHeroesClass(quest.heroesSecondaryClassReq, player.getName())) {
|
||||
cs.sendMessage(BOLD + "" + DARKRED + quest.heroesSecondaryClassReq + RESET + "" + RED + " " + Lang.get("heroesClass"));
|
||||
if (this.testSecondaryHeroesClass(q.heroesSecondaryClassReq, player.getName())) {
|
||||
cs.sendMessage(BOLD + "" + DARKRED + q.heroesSecondaryClassReq + RESET + "" + RED + " " + Lang.get("heroesClass"));
|
||||
} else {
|
||||
cs.sendMessage(BOLD + "" + GREEN + quest.heroesSecondaryClassReq + RESET + "" + DARKGREEN + " " + Lang.get("heroesClass"));
|
||||
cs.sendMessage(BOLD + "" + GREEN + q.heroesSecondaryClassReq + RESET + "" + DARKGREEN + " " + Lang.get("heroesClass"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (quest.mcMMOSkillReqs.isEmpty() == false) {
|
||||
if (q.mcMMOSkillReqs.isEmpty() == false) {
|
||||
|
||||
for (String skill : quest.mcMMOSkillReqs) {
|
||||
for (String skill : q.mcMMOSkillReqs) {
|
||||
|
||||
int level = Quests.getMCMMOSkillLevel(Quests.getMcMMOSkill(skill), player.getName());
|
||||
int req = quest.mcMMOAmountReqs.get(quest.mcMMOSkillReqs.indexOf(skill));
|
||||
int req = q.mcMMOAmountReqs.get(q.mcMMOSkillReqs.indexOf(skill));
|
||||
String skillName = MiscUtil.getCapitalized(skill);
|
||||
|
||||
if (level >= req) {
|
||||
@ -1976,37 +1987,37 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
if (quest.questPointsReq != 0) {
|
||||
if (q.questPointsReq != 0) {
|
||||
|
||||
if (quester.questPoints >= quest.questPointsReq) {
|
||||
cs.sendMessage(GRAY + "- " + GREEN + quest.questPointsReq + " " + Lang.get("questPoints"));
|
||||
if (quester.questPoints >= q.questPointsReq) {
|
||||
cs.sendMessage(GRAY + "- " + GREEN + q.questPointsReq + " " + Lang.get("questPoints"));
|
||||
} else {
|
||||
cs.sendMessage(GRAY + "- " + RED + quest.questPointsReq + " " + Lang.get("questPoints"));
|
||||
cs.sendMessage(GRAY + "- " + RED + q.questPointsReq + " " + Lang.get("questPoints"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (quest.moneyReq != 0) {
|
||||
if (q.moneyReq != 0) {
|
||||
|
||||
if (economy.getBalance(quester.name) >= quest.moneyReq) {
|
||||
if (quest.moneyReq == 1) {
|
||||
cs.sendMessage(GRAY + "- " + GREEN + quest.moneyReq + " " + Quests.getCurrency(false));
|
||||
if (economy.getBalance(quester.getOfflinePlayer()) >= q.moneyReq) {
|
||||
if (q.moneyReq == 1) {
|
||||
cs.sendMessage(GRAY + "- " + GREEN + q.moneyReq + " " + Quests.getCurrency(false));
|
||||
} else {
|
||||
cs.sendMessage(GRAY + "- " + GREEN + quest.moneyReq + " " + Quests.getCurrency(true));
|
||||
cs.sendMessage(GRAY + "- " + GREEN + q.moneyReq + " " + Quests.getCurrency(true));
|
||||
}
|
||||
} else {
|
||||
if (quest.moneyReq == 1) {
|
||||
cs.sendMessage(GRAY + "- " + RED + quest.moneyReq + " " + Quests.getCurrency(false));
|
||||
if (q.moneyReq == 1) {
|
||||
cs.sendMessage(GRAY + "- " + RED + q.moneyReq + " " + Quests.getCurrency(false));
|
||||
} else {
|
||||
cs.sendMessage(GRAY + "- " + RED + quest.moneyReq + " " + Quests.getCurrency(true));
|
||||
cs.sendMessage(GRAY + "- " + RED + q.moneyReq + " " + Quests.getCurrency(true));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (quest.items.isEmpty() == false) {
|
||||
if (q.items.isEmpty() == false) {
|
||||
|
||||
for (ItemStack is : quest.items) {
|
||||
for (ItemStack is : q.items) {
|
||||
|
||||
if (hasItem(player, is) == true) {
|
||||
cs.sendMessage(GRAY + "- " + GREEN + ItemUtil.getString(is));
|
||||
@ -2018,9 +2029,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
if (quest.neededQuests.isEmpty() == false) {
|
||||
if (q.neededQuests.isEmpty() == false) {
|
||||
|
||||
for (String s : quest.neededQuests) {
|
||||
for (String s : q.neededQuests) {
|
||||
|
||||
if (quester.completedQuests.contains(s)) {
|
||||
cs.sendMessage(GRAY + "- " + GREEN + Lang.get("complete") + " " + ITALIC + s);
|
||||
@ -2032,9 +2043,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
if (quest.blockQuests.isEmpty() == false) {
|
||||
if (q.blockQuests.isEmpty() == false) {
|
||||
|
||||
for (String s : quest.blockQuests) {
|
||||
for (String s : q.blockQuests) {
|
||||
|
||||
if (quester.completedQuests.contains(s)) {
|
||||
String msg = Lang.get("haveCompleted");
|
||||
@ -2055,35 +2066,32 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
} else {
|
||||
|
||||
cs.sendMessage(YELLOW + Lang.get("questNotFound"));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(RED + Lang.get("questInfoNoPerms"));
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void showObjectives(final CommandSender cs) {
|
||||
if (getQuester(cs.getName()).currentQuest != null) {
|
||||
private void showObjectives(final Player player) {
|
||||
if (getQuester(player.getUniqueId()).currentQuest != null) {
|
||||
|
||||
if (getQuester(cs.getName()).delayStartTime == 0) {
|
||||
cs.sendMessage(GOLD + Lang.get("questObjectivesTitle"));
|
||||
if (getQuester(player.getUniqueId()).delayStartTime == 0) {
|
||||
player.sendMessage(GOLD + Lang.get("questObjectivesTitle"));
|
||||
}
|
||||
|
||||
for (String s : getQuester(cs.getName()).getObjectivesReal()) {
|
||||
for (String s : getQuester(player.getUniqueId()).getObjectivesReal()) {
|
||||
|
||||
cs.sendMessage(s);
|
||||
player.sendMessage(s);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(YELLOW + Lang.get("noActiveQuest"));
|
||||
return;
|
||||
player.sendMessage(YELLOW + Lang.get("noActiveQuest"));
|
||||
|
||||
}
|
||||
}
|
||||
@ -2160,9 +2168,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
numOrder++;
|
||||
}
|
||||
|
||||
for (Quest quest : subQuests) {
|
||||
for (Quest q : subQuests) {
|
||||
|
||||
player.sendMessage(YELLOW + Integer.toString(numOrder) + ". " + quest.name);
|
||||
player.sendMessage(YELLOW + Integer.toString(numOrder) + ". " + q.name);
|
||||
numOrder++;
|
||||
|
||||
}
|
||||
@ -2199,29 +2207,29 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
public Quester getQuester(String player) {
|
||||
public Quester getQuester(UUID id) {
|
||||
|
||||
Quester quester = null;
|
||||
|
||||
if (questers.containsKey(player)) {
|
||||
quester = questers.get(player);
|
||||
if (questers.containsKey(id)) {
|
||||
quester = questers.get(id);
|
||||
}
|
||||
|
||||
if (quester == null) {
|
||||
|
||||
if (debug == true) {
|
||||
log.log(Level.WARNING, "[Quests] Quester data for player \"" + player + "\" not stored. Attempting manual data retrieval..");
|
||||
log.log(Level.WARNING, "[Quests] Quester data for player \"" + id.toString() + "\" not stored. Attempting manual data retrieval..");
|
||||
}
|
||||
|
||||
quester = new Quester(this);
|
||||
quester.name = player;
|
||||
quester.id = id;
|
||||
if (quester.loadData() == false) {
|
||||
log.severe("[Quests] Quester not found for player \"" + player + "\". Consider adding them to the Quester blacklist.");
|
||||
log.severe("[Quests] Quester not found for player \"" + id.toString() + "\". Consider adding them to the Quester blacklist.");
|
||||
} else {
|
||||
if (debug == true) {
|
||||
log.log(Level.INFO, "[Quests] Manual data retrieval succeeded for player \"" + player + "\"");
|
||||
log.log(Level.INFO, "[Quests] Manual data retrieval succeeded for player \"" + id.toString() + "\"");
|
||||
}
|
||||
questers.put(player, quester);
|
||||
questers.put(id, quester);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2229,18 +2237,18 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
public Map<String, Quester> getOnlineQuesters() {
|
||||
public Map<UUID, Quester> getOnlineQuesters() {
|
||||
|
||||
Map<String, Quester> qs = new HashMap<String, Quester>();
|
||||
Map<UUID, Quester> qs = new HashMap<UUID, Quester>();
|
||||
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
|
||||
Quester quester = new Quester(this);
|
||||
quester.name = p.getName();
|
||||
quester.id = p.getUniqueId();
|
||||
if (quester.loadData() == false) {
|
||||
quester.saveData();
|
||||
}
|
||||
qs.put(p.getName(), quester);
|
||||
qs.put(p.getUniqueId(), quester);
|
||||
|
||||
}
|
||||
|
||||
@ -2254,7 +2262,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
public void loadQuests() {
|
||||
|
||||
boolean failedToLoad = false;
|
||||
boolean failedToLoad;
|
||||
totalQuestPoints = 0;
|
||||
needsSaving = false;
|
||||
|
||||
@ -2406,10 +2414,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
}
|
||||
}
|
||||
catch (SkipQuest ex) {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
catch (StageFailedException ex) {
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4957,7 +4965,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
}else {
|
||||
log.severe("[Quests] Enable debug to view the error log.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@ -5008,12 +5015,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
failed++;
|
||||
}
|
||||
|
||||
names.add(name);
|
||||
names.add(name.toLowerCase());
|
||||
succeeded++;
|
||||
|
||||
}
|
||||
|
||||
Quests.printInfo("Completed: " + succeeded + "Success(es). " + failed + " Failure(s). " + numQuesters + " Total.");
|
||||
Quests.printInfo("Completed: " + succeeded + " Success(es). " + failed + " Failure(s). " + numQuesters + " Total.");
|
||||
Quests.printInfo("Preparing to convert data.");
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this, new Runnable() {
|
||||
@ -5021,7 +5028,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
@Override
|
||||
public void run() {
|
||||
Quests.printInfo("Done. Converting data...");
|
||||
|
||||
System.out.println("names: " + names);
|
||||
int converted = 0;
|
||||
int failed = 0;
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class StageTimer implements Runnable{
|
||||
|
||||
if(quester.delayOver){
|
||||
|
||||
Player player = plugin.getServer().getPlayerExact(quester.name);
|
||||
Player player = quester.getPlayer();
|
||||
|
||||
if(quester.currentQuest != null){
|
||||
|
||||
|
@ -54,6 +54,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
|
||||
try {
|
||||
|
||||
context.setSessionData(pref, Boolean.TRUE);
|
||||
|
||||
String text = PINK + "- " + AQUA + (String) context.getSessionData(CK.Q_NAME) + PINK + " | " + Lang.get("stageEditorStage") + " " + PURPLE + stageNum + PINK + " -\n";
|
||||
@ -104,14 +106,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
|
||||
text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + Lang.get("stageEditorUseBlocks") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += PINK + "" + BOLD + "4 " + RESET + PURPLE + "- " + Lang.get("stageEditorUseBlocks") + "\n";
|
||||
|
||||
|
||||
LinkedList<Integer> ids = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_IDS);
|
||||
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_USE_AMOUNTS);
|
||||
|
||||
for (int i = 0; i < ids.size(); i++) {
|
||||
text += GRAY + " - " + BLUE + Quester.prettyItemString(ids.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (context.getSessionData(pref + CK.S_CUT_IDS) == null) {
|
||||
@ -364,7 +365,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
|
||||
text += RED + "" + BOLD + "25 " + RESET + PURPLE + "- " + Lang.get("stageEditorDelete") + "\n";
|
||||
text += GREEN + "" + BOLD + "26 " + RESET + PURPLE + "- " + Lang.get("done") + "\n";
|
||||
|
||||
|
||||
return text;
|
||||
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "a";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,8 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
menu += YELLOW + "" + BOLD + "4. " + RESET + "" + GOLD + Lang.get("itemCreateSetEnchs") + "\n";
|
||||
menu += YELLOW + "" + BOLD + "5. " + RESET + "" + ITALIC + GOLD + Lang.get("itemCreateSetName") + "\n";
|
||||
menu += YELLOW + "" + BOLD + "6. " + RESET + "" + ITALIC + GOLD + Lang.get("itemCreateSetLore") + "\n";
|
||||
menu += YELLOW + "" + BOLD + "7. " + RESET + "" + GREEN + Lang.get("cancel") + "\n";
|
||||
menu += YELLOW + "" + BOLD + "8. " + RESET + "" + RED + Lang.get("done") + "\n";
|
||||
menu += YELLOW + "" + BOLD + "7. " + RESET + "" + RED + Lang.get("cancel") + "\n";
|
||||
menu += YELLOW + "" + BOLD + "8. " + RESET + "" + GREEN + Lang.get("done") + "\n";
|
||||
return menu;
|
||||
}
|
||||
|
||||
@ -154,7 +154,17 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase("7")){
|
||||
}else if(input.equalsIgnoreCase("7")) {
|
||||
|
||||
cc.setSessionData("tempStack", null);
|
||||
cc.setSessionData("tempId", null);
|
||||
cc.setSessionData("tempAmount", null);
|
||||
cc.setSessionData("tempData", null);
|
||||
cc.setSessionData("tempEnchantments", null);
|
||||
cc.setSessionData("tempName", null);
|
||||
cc.setSessionData("tempLore", null);
|
||||
|
||||
}else if(input.equalsIgnoreCase("8")){
|
||||
|
||||
if(cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null){
|
||||
|
||||
@ -199,15 +209,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
|
||||
}else if(input.equalsIgnoreCase("8"))
|
||||
cc.setSessionData("tempStack", null);
|
||||
|
||||
cc.setSessionData("tempId", null);
|
||||
cc.setSessionData("tempAmount", null);
|
||||
cc.setSessionData("tempData", null);
|
||||
cc.setSessionData("tempEnchantments", null);
|
||||
cc.setSessionData("tempName", null);
|
||||
cc.setSessionData("tempLore", null);
|
||||
}
|
||||
|
||||
try{
|
||||
return oldPrompt;
|
||||
|
@ -30,7 +30,7 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
|
||||
public String getPromptText(ConversationContext cc) {
|
||||
|
||||
quests = (LinkedList<Quest>) cc.getSessionData("quests");
|
||||
quester = plugin.getQuester(((Player) cc.getForWhom()).getName());
|
||||
quester = plugin.getQuester(((Player) cc.getForWhom()).getUniqueId());
|
||||
|
||||
String npc = (String) cc.getSessionData("npc");
|
||||
String text = Lang.get("questNPCListTitle");
|
||||
|
@ -49,14 +49,14 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
text = DARKAQUA + lang + "\n";
|
||||
|
||||
if (context.getSessionData(CK.REQ_MONEY) == null) {
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqSetMoney") + " " + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqSetMoney") + " " + GRAY + "(" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
int moneyReq = (Integer) context.getSessionData(CK.REQ_MONEY);
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqSetMoney") + " (" + moneyReq + " " + (moneyReq > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + ")\n";
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.REQ_QUEST_POINTS) == null) {
|
||||
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetQuestPoints") + " " + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetQuestPoints") + " " + GRAY + "(" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetQuestPoints") + " " + GRAY + "(" + AQUA + context.getSessionData(CK.REQ_QUEST_POINTS) + " " + Lang.get("questPoints") + GRAY + ")\n";
|
||||
}
|
||||
@ -398,7 +398,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
String text = GOLD + Lang.get("itemRequirementsTitle") + "\n";
|
||||
if (context.getSessionData(CK.REQ_ITEMS) == null) {
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqAddItem") + "\n";
|
||||
text += GRAY + "2 - " + Lang.get("reqSetRemoveItems") + "(" + Lang.get("reqNoItemsSet") + ")\n";
|
||||
text += GRAY + "2 - " + Lang.get("reqSetRemoveItems") + " (" + Lang.get("reqNoItemsSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
|
||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
|
||||
} else {
|
||||
@ -412,7 +412,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqAddItem") + "\n";
|
||||
|
||||
if (context.getSessionData(CK.REQ_ITEMS_REMOVE) == null) {
|
||||
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetRemoveItems") + "(" + Lang.get("reqNoValuesSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetRemoveItems") + " (" + Lang.get("reqNoValuesSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetRemoveItems") + "\n";
|
||||
|
@ -60,7 +60,7 @@ public class CK {
|
||||
public static final String S_PLACE_AMOUNTS = "placeAmounts";
|
||||
public static final String S_USE_IDS = "useIds";
|
||||
public static final String S_USE_AMOUNTS = "useAmounts";
|
||||
public static final String S_CUT_IDS = "useIds";
|
||||
public static final String S_CUT_IDS = "cutIds";
|
||||
public static final String S_CUT_AMOUNTS = "cutAmounts";
|
||||
public static final String S_FISH = "fish";
|
||||
public static final String S_PLAYER_KILL = "playerKill";
|
||||
|
@ -991,6 +991,7 @@ public class Lang {
|
||||
langMap.put("exited", "Exited");
|
||||
langMap.put("cancel", "Cancel");
|
||||
langMap.put("cancelled", "Cancelled");
|
||||
langMap.put("questTimeout", "Cancelled.");
|
||||
langMap.put("back", "Back");
|
||||
langMap.put("yesWord", "Yes");
|
||||
langMap.put("noWord", "No");
|
||||
@ -1108,7 +1109,6 @@ public class Lang {
|
||||
} else {
|
||||
|
||||
newLangs = true;
|
||||
System.out.println("COULD NOT FIND KEY FOR: \"" + entry.getKey() + "\"");
|
||||
newMap.put(entry.getKey(), entry.getValue());
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package me.blackvein.quests.util;
|
||||
|
||||
import me.blackvein.quests.Quester;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MiscUtil {
|
||||
|
||||
@ -114,4 +117,5 @@ public class MiscUtil {
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user