mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Employ safer collections in factories, fixes #2212
This commit is contained in:
parent
0b19116362
commit
a7e9e41d68
@ -16,14 +16,14 @@ import org.bukkit.conversations.ConversationFactory;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
|
||||
public interface QuestFactory {
|
||||
|
||||
Set<UUID> getSelectingNpcs();
|
||||
ConcurrentSkipListSet<UUID> getSelectingNpcs();
|
||||
|
||||
void setSelectingNpcs(final Set<UUID> selectingNpcs);
|
||||
void setSelectingNpcs(final ConcurrentSkipListSet<UUID> selectingNpcs);
|
||||
|
||||
List<String> getNamesOfQuestsBeingEdited();
|
||||
|
||||
|
@ -20,8 +20,8 @@ import me.pikamug.quests.player.Quester;
|
||||
import me.pikamug.quests.quests.Quest;
|
||||
import me.pikamug.quests.util.BukkitConfigUtil;
|
||||
import me.pikamug.quests.util.BukkitFakeConversable;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
@ -46,20 +46,20 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class BukkitActionFactory implements ActionFactory, ConversationAbandonedListener {
|
||||
|
||||
private final BukkitQuestsPlugin plugin;
|
||||
private final ConversationFactory conversationFactory;
|
||||
private Map<UUID, Block> selectedExplosionLocations = new HashMap<>();
|
||||
private Map<UUID, Block> selectedEffectLocations = new HashMap<>();
|
||||
private Map<UUID, Block> selectedMobLocations = new HashMap<>();
|
||||
private Map<UUID, Block> selectedLightningLocations = new HashMap<>();
|
||||
private Map<UUID, Block> selectedTeleportLocations = new HashMap<>();
|
||||
private ConcurrentHashMap<UUID, Block> selectedExplosionLocations = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<UUID, Block> selectedEffectLocations = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<UUID, Block> selectedMobLocations = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<UUID, Block> selectedLightningLocations = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<UUID, Block> selectedTeleportLocations = new ConcurrentHashMap<>();
|
||||
private List<String> editingActionNames = new LinkedList<>();
|
||||
|
||||
public BukkitActionFactory(final BukkitQuestsPlugin plugin) {
|
||||
@ -78,44 +78,43 @@ public class BukkitActionFactory implements ActionFactory, ConversationAbandoned
|
||||
}
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedExplosionLocations() {
|
||||
public ConcurrentHashMap<UUID, Block> getSelectedExplosionLocations() {
|
||||
return selectedExplosionLocations;
|
||||
}
|
||||
|
||||
public void setSelectedExplosionLocations(final Map<UUID, Block> selectedExplosionLocations) {
|
||||
public void setSelectedExplosionLocations(final ConcurrentHashMap<UUID, Block> selectedExplosionLocations) {
|
||||
this.selectedExplosionLocations = selectedExplosionLocations;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedEffectLocations() {
|
||||
public ConcurrentHashMap<UUID, Block> getSelectedEffectLocations() {
|
||||
return selectedEffectLocations;
|
||||
}
|
||||
|
||||
public void setSelectedEffectLocations(final Map<UUID, Block> selectedEffectLocations) {
|
||||
public void setSelectedEffectLocations(final ConcurrentHashMap<UUID, Block> selectedEffectLocations) {
|
||||
this.selectedEffectLocations = selectedEffectLocations;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedMobLocations() {
|
||||
public ConcurrentHashMap<UUID, Block> getSelectedMobLocations() {
|
||||
return selectedMobLocations;
|
||||
}
|
||||
|
||||
public void setSelectedMobLocations(final Map<UUID, Block> selectedMobLocations) {
|
||||
public void setSelectedMobLocations(final ConcurrentHashMap<UUID, Block> selectedMobLocations) {
|
||||
this.selectedMobLocations = selectedMobLocations;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedLightningLocations() {
|
||||
public ConcurrentHashMap<UUID, Block> getSelectedLightningLocations() {
|
||||
return selectedLightningLocations;
|
||||
}
|
||||
|
||||
public void setSelectedLightningLocations(final Map<UUID, Block> selectedLightningLocations) {
|
||||
public void setSelectedLightningLocations(final ConcurrentHashMap<UUID, Block> selectedLightningLocations) {
|
||||
this.selectedLightningLocations = selectedLightningLocations;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedTeleportLocations() {
|
||||
public ConcurrentHashMap<UUID, Block> getSelectedTeleportLocations() {
|
||||
return selectedTeleportLocations;
|
||||
}
|
||||
|
||||
public void setSelectedTeleportLocations(
|
||||
final Map<UUID, Block> selectedTeleportLocations) {
|
||||
public void setSelectedTeleportLocations(final ConcurrentHashMap<UUID, Block> selectedTeleportLocations) {
|
||||
this.selectedTeleportLocations = selectedTeleportLocations;
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,9 @@ import me.pikamug.quests.quests.Quest;
|
||||
import me.pikamug.quests.quests.components.Stage;
|
||||
import me.pikamug.quests.util.BukkitConfigUtil;
|
||||
import me.pikamug.quests.util.BukkitItemUtil;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.BukkitMiscUtil;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
@ -43,8 +43,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
||||
|
||||
@ -528,7 +528,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
||||
return new ActionMobAmountPrompt(context, questMob);
|
||||
case 4:
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedMobLocations
|
||||
= plugin.getActionFactory().getSelectedMobLocations();
|
||||
selectedMobLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getActionFactory().setSelectedMobLocations(selectedMobLocations);
|
||||
return new ActionMobLocationPrompt(context, questMob);
|
||||
@ -542,13 +543,16 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
||||
return new ActionMobListPrompt(context);
|
||||
case 7:
|
||||
if (questMob.getType() == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("eventEditorMustSetMobTypesFirst"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ BukkitLang.get("eventEditorMustSetMobTypesFirst"));
|
||||
return new ActionMobPrompt(context, questMob);
|
||||
} else if (questMob.getSpawnLocation() == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("eventEditorMustSetMobLocationFirst"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ BukkitLang.get("eventEditorMustSetMobLocationFirst"));
|
||||
return new ActionMobPrompt(context, questMob);
|
||||
} else if (questMob.getSpawnAmounts() == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("eventEditorMustSetMobAmountsFirst"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ BukkitLang.get("eventEditorMustSetMobAmountsFirst"));
|
||||
return new ActionMobPrompt(context, questMob);
|
||||
}
|
||||
final LinkedList<QuestMob> list = context.getSessionData(Key.A_MOBS) == null ? new LinkedList<>()
|
||||
@ -957,7 +961,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
||||
}
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(BukkitLang.get("cmdAdd"))) {
|
||||
final Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedMobLocations
|
||||
= plugin.getActionFactory().getSelectedMobLocations();
|
||||
final Block block = selectedMobLocations.get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
final Location loc = block.getLocation();
|
||||
@ -970,7 +975,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
||||
}
|
||||
return new ActionMobPrompt(context, questMob);
|
||||
} else if (input.equalsIgnoreCase(BukkitLang.get("cmdCancel"))) {
|
||||
final Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedMobLocations
|
||||
= plugin.getActionFactory().getSelectedMobLocations();
|
||||
selectedMobLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedMobLocations(selectedMobLocations);
|
||||
return new ActionMobPrompt(context, questMob);
|
||||
|
@ -16,10 +16,10 @@ import me.pikamug.quests.convo.actions.ActionsEditorStringPrompt;
|
||||
import me.pikamug.quests.convo.actions.main.ActionMainPrompt;
|
||||
import me.pikamug.quests.events.editor.actions.ActionsEditorPostOpenNumericPromptEvent;
|
||||
import me.pikamug.quests.events.editor.actions.ActionsEditorPostOpenStringPromptEvent;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.BukkitConfigUtil;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.BukkitMiscUtil;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
@ -34,6 +34,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
|
||||
|
||||
@ -146,7 +147,8 @@ public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
|
||||
return new ActionEffectSoundListPrompt(context);
|
||||
case 2:
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedExplosionLocations
|
||||
= plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
selectedExplosionLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getActionFactory().setSelectedExplosionLocations(selectedExplosionLocations);
|
||||
return new ActionEffectExplosionPrompt(context);
|
||||
@ -270,7 +272,8 @@ public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
|
||||
return new ActionEffectSoundListPrompt(context);
|
||||
} else {
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedEffectLocations
|
||||
= plugin.getActionFactory().getSelectedEffectLocations();
|
||||
selectedEffectLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getActionFactory().setSelectedEffectLocations(selectedEffectLocations);
|
||||
return new ActionEffectSoundLocationPrompt(context);
|
||||
@ -364,7 +367,7 @@ public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
|
||||
}
|
||||
context.setSessionData(Key.A_EFFECTS, effects);
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory()
|
||||
final ConcurrentHashMap<UUID, Block> selectedEffectLocations = plugin.getActionFactory()
|
||||
.getSelectedEffectLocations();
|
||||
selectedEffectLocations.remove(((Player)context.getForWhom()).getUniqueId());
|
||||
plugin.getActionFactory().setSelectedEffectLocations(selectedEffectLocations);
|
||||
@ -377,8 +380,8 @@ public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
|
||||
}
|
||||
} else {
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory()
|
||||
.getSelectedEffectLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedEffectLocations
|
||||
= plugin.getActionFactory().getSelectedEffectLocations();
|
||||
selectedEffectLocations.remove(((Player)context.getForWhom()).getUniqueId());
|
||||
plugin.getActionFactory().setSelectedEffectLocations(selectedEffectLocations);
|
||||
}
|
||||
@ -441,7 +444,8 @@ public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
|
||||
}
|
||||
return new ActionEffectSoundListPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(BukkitLang.get("cmdCancel"))) {
|
||||
final Map<UUID, Block> selectedEffectLocations = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedEffectLocations
|
||||
= plugin.getActionFactory().getSelectedEffectLocations();
|
||||
selectedEffectLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedEffectLocations(selectedEffectLocations);
|
||||
return new ActionEffectSoundListPrompt(context);
|
||||
@ -484,7 +488,8 @@ public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
|
||||
}
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(BukkitLang.get("cmdAdd"))) {
|
||||
final Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedExplosionLocations
|
||||
= plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final Block block = selectedExplosionLocations.get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
final Location loc = block.getLocation();
|
||||
@ -507,12 +512,14 @@ public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
|
||||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(BukkitLang.get("cmdClear"))) {
|
||||
context.setSessionData(Key.A_EXPLOSIONS, null);
|
||||
final Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedExplosionLocations
|
||||
= plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
selectedExplosionLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedExplosionLocations(selectedExplosionLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(BukkitLang.get("cmdCancel"))) {
|
||||
final Map<UUID, Block> selectedExplosionLocations = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedExplosionLocations
|
||||
= plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
selectedExplosionLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedExplosionLocations(selectedExplosionLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
|
@ -17,11 +17,11 @@ import me.pikamug.quests.convo.actions.main.ActionMainPrompt;
|
||||
import me.pikamug.quests.convo.generic.ItemStackPrompt;
|
||||
import me.pikamug.quests.events.editor.actions.ActionsEditorPostOpenNumericPromptEvent;
|
||||
import me.pikamug.quests.events.editor.actions.ActionsEditorPostOpenStringPromptEvent;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.BukkitConfigUtil;
|
||||
import me.pikamug.quests.util.BukkitItemUtil;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.BukkitMiscUtil;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.RomanNumeral;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -36,9 +36,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ActionPlayerPrompt extends ActionsEditorNumericPrompt {
|
||||
|
||||
@ -244,7 +244,8 @@ public class ActionPlayerPrompt extends ActionsEditorNumericPrompt {
|
||||
return new ActionPlayerHealthPrompt(context);
|
||||
case 7:
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedTeleportLocations
|
||||
= plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
selectedTeleportLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getActionFactory().setSelectedTeleportLocations(selectedTeleportLocations);
|
||||
return new ActionPlayerTeleportPrompt(context);
|
||||
@ -962,8 +963,8 @@ public class ActionPlayerPrompt extends ActionsEditorNumericPrompt {
|
||||
}
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(BukkitLang.get("cmdDone"))) {
|
||||
final Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory()
|
||||
.getSelectedTeleportLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedTeleportLocations
|
||||
= plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
final Block block = selectedTeleportLocations.get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
final Location loc = block.getLocation();
|
||||
@ -977,14 +978,14 @@ public class ActionPlayerPrompt extends ActionsEditorNumericPrompt {
|
||||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(BukkitLang.get("cmdClear"))) {
|
||||
context.setSessionData(Key.A_TELEPORT, null);
|
||||
final Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory()
|
||||
.getSelectedTeleportLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedTeleportLocations
|
||||
= plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
selectedTeleportLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedTeleportLocations(selectedTeleportLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(BukkitLang.get("cmdCancel"))) {
|
||||
final Map<UUID, Block> selectedTeleportLocations = plugin.getActionFactory()
|
||||
.getSelectedTeleportLocations();
|
||||
final ConcurrentHashMap<UUID, Block> selectedTeleportLocations
|
||||
= plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
selectedTeleportLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedTeleportLocations(selectedTeleportLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
|
@ -16,10 +16,10 @@ import me.pikamug.quests.convo.actions.ActionsEditorStringPrompt;
|
||||
import me.pikamug.quests.convo.actions.main.ActionMainPrompt;
|
||||
import me.pikamug.quests.events.editor.actions.ActionsEditorPostOpenNumericPromptEvent;
|
||||
import me.pikamug.quests.events.editor.actions.ActionsEditorPostOpenStringPromptEvent;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.BukkitConfigUtil;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.BukkitMiscUtil;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -31,9 +31,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ActionWeatherPrompt extends ActionsEditorNumericPrompt {
|
||||
|
||||
@ -156,7 +156,7 @@ public class ActionWeatherPrompt extends ActionsEditorNumericPrompt {
|
||||
return new ActionThunderPrompt(context);
|
||||
case 3:
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> selectedLightningLocations
|
||||
final ConcurrentHashMap<UUID, Block> selectedLightningLocations
|
||||
= plugin.getActionFactory().getSelectedLightningLocations();
|
||||
selectedLightningLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getActionFactory().setSelectedLightningLocations(selectedLightningLocations);
|
||||
@ -642,7 +642,7 @@ public class ActionWeatherPrompt extends ActionsEditorNumericPrompt {
|
||||
}
|
||||
final Player player = (Player) context.getForWhom();
|
||||
if (input.equalsIgnoreCase(BukkitLang.get("cmdAdd"))) {
|
||||
final Map<UUID, Block> selectedLightningLocations
|
||||
final ConcurrentHashMap<UUID, Block> selectedLightningLocations
|
||||
= plugin.getActionFactory().getSelectedLightningLocations();
|
||||
final Block block = selectedLightningLocations.get(player.getUniqueId());
|
||||
if (block != null) {
|
||||
@ -666,13 +666,13 @@ public class ActionWeatherPrompt extends ActionsEditorNumericPrompt {
|
||||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(BukkitLang.get("cmdClear"))) {
|
||||
context.setSessionData(Key.A_LIGHTNING, null);
|
||||
final Map<UUID, Block> selectedLightningLocations
|
||||
final ConcurrentHashMap<UUID, Block> selectedLightningLocations
|
||||
= plugin.getActionFactory().getSelectedLightningLocations();
|
||||
selectedLightningLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedLightningLocations(selectedLightningLocations);
|
||||
return new ActionMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(BukkitLang.get("cmdCancel"))) {
|
||||
final Map<UUID, Block> selectedLightningLocations
|
||||
final ConcurrentHashMap<UUID, Block> selectedLightningLocations
|
||||
= plugin.getActionFactory().getSelectedLightningLocations();
|
||||
selectedLightningLocations.remove(player.getUniqueId());
|
||||
plugin.getActionFactory().setSelectedLightningLocations(selectedLightningLocations);
|
||||
|
@ -16,9 +16,9 @@ import me.pikamug.quests.convo.conditions.ConditionsEditorStringPrompt;
|
||||
import me.pikamug.quests.convo.conditions.main.ConditionMainPrompt;
|
||||
import me.pikamug.quests.events.editor.conditions.ConditionsEditorPostOpenNumericPromptEvent;
|
||||
import me.pikamug.quests.events.editor.conditions.ConditionsEditorPostOpenStringPromptEvent;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.BukkitMiscUtil;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
@ -31,8 +31,8 @@ import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
|
||||
public class ConditionEntityPrompt extends ConditionsEditorNumericPrompt {
|
||||
|
||||
@ -254,7 +254,7 @@ public class ConditionEntityPrompt extends ConditionsEditorNumericPrompt {
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.add(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
return ChatColor.YELLOW + BukkitLang.get("questEditorClickNPCStart");
|
||||
@ -294,7 +294,7 @@ public class ConditionEntityPrompt extends ConditionsEditorNumericPrompt {
|
||||
context.setSessionData(Key.C_WHILE_RIDING_NPC, npcs);
|
||||
}
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
}
|
||||
|
@ -21,13 +21,13 @@ import me.pikamug.quests.convo.quests.planner.QuestPlannerPrompt;
|
||||
import me.pikamug.quests.convo.quests.requirements.QuestRequirementsPrompt;
|
||||
import me.pikamug.quests.convo.quests.rewards.QuestRewardsPrompt;
|
||||
import me.pikamug.quests.convo.quests.stages.QuestStageMenuPrompt;
|
||||
import me.pikamug.quests.dependencies.reflect.worldguard.WorldGuardAPI;
|
||||
import me.pikamug.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||
import me.pikamug.quests.events.editor.quests.QuestsEditorPostOpenStringPromptEvent;
|
||||
import me.pikamug.quests.quests.Quest;
|
||||
import me.pikamug.quests.dependencies.reflect.worldguard.WorldGuardAPI;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.BukkitItemUtil;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -48,8 +48,9 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
|
||||
public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@ -276,7 +277,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
case 5:
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> blockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
final ConcurrentHashMap<UUID, Block> blockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
blockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getQuestFactory().setSelectedBlockStarts(blockStarts);
|
||||
return new QuestBlockStartPrompt(context);
|
||||
@ -485,7 +486,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.add(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
return ChatColor.YELLOW + BukkitLang.get("questEditorClickNPCStart");
|
||||
@ -510,7 +511,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
context.setSessionData(Key.Q_START_NPC, uuid.toString());
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
}
|
||||
@ -524,7 +525,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(Key.Q_START_NPC, null);
|
||||
}
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
}
|
||||
@ -576,14 +577,16 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
return new QuestBlockStartPrompt(context);
|
||||
}
|
||||
} else {
|
||||
final Map<UUID, Block> selectedBlockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
final ConcurrentHashMap<UUID, Block> selectedBlockStarts
|
||||
= plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
selectedBlockStarts.remove(player.getUniqueId());
|
||||
plugin.getQuestFactory().setSelectedBlockStarts(selectedBlockStarts);
|
||||
}
|
||||
return new QuestMainPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(BukkitLang.get("cmdClear"))) {
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> selectedBlockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
final ConcurrentHashMap<UUID, Block> selectedBlockStarts
|
||||
= plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
selectedBlockStarts.remove(player.getUniqueId());
|
||||
plugin.getQuestFactory().setSelectedBlockStarts(selectedBlockStarts);
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ import me.pikamug.quests.convo.quests.QuestsEditorStringPrompt;
|
||||
import me.pikamug.quests.convo.quests.stages.QuestStageMainPrompt;
|
||||
import me.pikamug.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||
import me.pikamug.quests.events.editor.quests.QuestsEditorPostOpenStringPromptEvent;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.BukkitConfigUtil;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.BukkitMiscUtil;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
@ -39,6 +39,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class QuestMobsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@ -417,7 +418,7 @@ public class QuestMobsPrompt extends QuestsEditorNumericPrompt {
|
||||
return new QuestMobsAmountsPrompt(context);
|
||||
case 3:
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||
return new QuestMobsLocationPrompt(context);
|
||||
@ -672,7 +673,7 @@ public class QuestMobsPrompt extends QuestsEditorNumericPrompt {
|
||||
locations.add(BukkitConfigUtil.getLocationInfo(loc));
|
||||
}
|
||||
context.setSessionData(pref + Key.S_MOB_KILL_LOCATIONS, locations);
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
temp.remove(player.getUniqueId());
|
||||
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||
} else {
|
||||
@ -681,7 +682,7 @@ public class QuestMobsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
return new QuestMobsKillListPrompt(context);
|
||||
} else if (input.equalsIgnoreCase(BukkitLang.get("cmdCancel"))) {
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
temp.remove(player.getUniqueId());
|
||||
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||
return new QuestMobsKillListPrompt(context);
|
||||
|
@ -17,9 +17,9 @@ import me.pikamug.quests.convo.quests.QuestsEditorStringPrompt;
|
||||
import me.pikamug.quests.convo.quests.stages.QuestStageMainPrompt;
|
||||
import me.pikamug.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||
import me.pikamug.quests.events.editor.quests.QuestsEditorPostOpenStringPromptEvent;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.BukkitItemUtil;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
@ -30,8 +30,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
|
||||
public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
|
||||
@ -393,7 +393,8 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
if (one == two) {
|
||||
if (context.getSessionData(pref + Key.S_DELIVERY_MESSAGES) == null && one != 0) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("stageEditorNoDeliveryMessage"));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ BukkitLang.get("stageEditorNoDeliveryMessage"));
|
||||
return new QuestNpcsDeliveryListPrompt(context);
|
||||
} else {
|
||||
return new QuestNpcsPrompt(stageNum, context);
|
||||
@ -431,7 +432,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.add(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
return ChatColor.YELLOW + BukkitLang.get("questEditorClickNPCStart");
|
||||
@ -463,7 +464,8 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
return new QuestNpcDeliveryNpcsPrompt(context);
|
||||
}
|
||||
} catch (final IllegalArgumentException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("stageEditorNotListOfUniqueIds")
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ BukkitLang.get("stageEditorNotListOfUniqueIds")
|
||||
.replace("<data>", input));
|
||||
return new QuestNpcDeliveryNpcsPrompt(context);
|
||||
}
|
||||
@ -474,13 +476,13 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (context.getSessionData(pref + Key.S_DELIVERY_MESSAGES) != null) {
|
||||
messages = (LinkedList<String>) context.getSessionData(pref + Key.S_DELIVERY_MESSAGES);
|
||||
}
|
||||
if (messages != null && messages.size() == 0) {
|
||||
if (messages != null && messages.isEmpty()) {
|
||||
messages.add(BukkitLang.get("thankYouMore"));
|
||||
}
|
||||
context.setSessionData(pref + Key.S_DELIVERY_MESSAGES, messages);
|
||||
}
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
}
|
||||
@ -509,7 +511,8 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
= new QuestsEditorPostOpenStringPromptEvent(context, this);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return ChatColor.YELLOW + getQueryText(context) + "\n" + ChatColor.GOLD + BukkitLang.get("stageEditorNPCNote");
|
||||
return ChatColor.YELLOW + getQueryText(context) + "\n" + ChatColor.GOLD
|
||||
+ BukkitLang.get("stageEditorNPCNote");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -549,7 +552,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.add(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
return ChatColor.YELLOW + BukkitLang.get("questEditorClickNPCStart");
|
||||
@ -564,7 +567,8 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
if (!input.equalsIgnoreCase(BukkitLang.get("cmdCancel")) && !input.equalsIgnoreCase(BukkitLang.get("cmdClear"))) {
|
||||
if (!input.equalsIgnoreCase(BukkitLang.get("cmdCancel"))
|
||||
&& !input.equalsIgnoreCase(BukkitLang.get("cmdClear"))) {
|
||||
final String[] args = input.split(" ");
|
||||
final LinkedList<String> npcs = context.getSessionData(pref + Key.S_NPCS_TO_TALK_TO) != null
|
||||
? (LinkedList<String>) context.getSessionData(pref + Key.S_NPCS_TO_TALK_TO) : new LinkedList<>();
|
||||
@ -582,8 +586,8 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
return new QuestNpcsIdsToTalkToPrompt(context);
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("stageEditorNotListOfUniqueIds")
|
||||
.replace("<data>", s));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ BukkitLang.get("stageEditorNotListOfUniqueIds").replace("<data>", s));
|
||||
return new QuestNpcsIdsToTalkToPrompt(context);
|
||||
}
|
||||
}
|
||||
@ -592,7 +596,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.setSessionData(pref + Key.S_NPCS_TO_TALK_TO, null);
|
||||
}
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
}
|
||||
@ -654,7 +658,8 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null || plugin.getDependencies().getZnpcsPlusApi() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null
|
||||
|| plugin.getDependencies().getZnpcsPlusApi() != null) {
|
||||
if (context.getSessionData(pref + Key.S_NPCS_TO_KILL) == null) {
|
||||
return ChatColor.GRAY + "(" + BukkitLang.get("noneSet") + ")";
|
||||
} else {
|
||||
@ -774,7 +779,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.add(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
return ChatColor.YELLOW + BukkitLang.get("questEditorClickNPCStart");
|
||||
@ -807,8 +812,8 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
return new QuestNpcIdsToKillPrompt(context);
|
||||
}
|
||||
} catch (final IllegalArgumentException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("stageEditorNotListOfUniqueIds")
|
||||
.replace("<data>", s));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ BukkitLang.get("stageEditorNotListOfUniqueIds").replace("<data>", s));
|
||||
return new QuestNpcIdsToKillPrompt(context);
|
||||
}
|
||||
}
|
||||
@ -827,7 +832,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
context.setSessionData(pref + Key.S_NPCS_TO_KILL_AMOUNTS, amounts);
|
||||
}
|
||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||
selectingNpcs.remove(((Player) context.getForWhom()).getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(selectingNpcs);
|
||||
return new QuestNpcsKillListPrompt(context);
|
||||
@ -877,8 +882,8 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
return new QuestNpcAmountsToKillPrompt(context);
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + BukkitLang.get("stageEditorNotListOfUniqueIds")
|
||||
.replace("<data>", s));
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||
+ BukkitLang.get("stageEditorNotListOfUniqueIds").replace("<data>", s));
|
||||
return new QuestNpcAmountsToKillPrompt(context);
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,9 @@
|
||||
|
||||
package me.pikamug.quests.convo.quests.stages;
|
||||
|
||||
import me.pikamug.quests.BukkitQuestsPlugin;
|
||||
import me.pikamug.quests.actions.Action;
|
||||
import me.pikamug.quests.conditions.Condition;
|
||||
import me.pikamug.quests.module.CustomObjective;
|
||||
import me.pikamug.quests.BukkitQuestsPlugin;
|
||||
import me.pikamug.quests.convo.QuestsNumericPrompt;
|
||||
import me.pikamug.quests.convo.generic.OverridePrompt;
|
||||
import me.pikamug.quests.convo.quests.QuestsEditorNumericPrompt;
|
||||
@ -24,10 +23,11 @@ import me.pikamug.quests.convo.quests.objectives.QuestMobsPrompt;
|
||||
import me.pikamug.quests.convo.quests.objectives.QuestNpcsPrompt;
|
||||
import me.pikamug.quests.events.editor.quests.QuestsEditorPostOpenNumericPromptEvent;
|
||||
import me.pikamug.quests.events.editor.quests.QuestsEditorPostOpenStringPromptEvent;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.module.CustomObjective;
|
||||
import me.pikamug.quests.util.BukkitConfigUtil;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.BukkitMiscUtil;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -48,6 +48,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeSet;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class QuestStageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
@ -750,7 +751,7 @@ public class QuestStageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
if (context.getForWhom() instanceof Player) {
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||
plugin.getQuestFactory().setSelectedReachLocations(temp);
|
||||
return new QuestReachLocationPrompt(context);
|
||||
@ -882,12 +883,12 @@ public class QuestStageMainPrompt extends QuestsEditorNumericPrompt {
|
||||
player.sendMessage(ChatColor.RED + BukkitLang.get("stageEditorNoBlockSelected"));
|
||||
return new QuestReachLocationPrompt(context);
|
||||
}
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||
temp.remove(player.getUniqueId());
|
||||
plugin.getQuestFactory().setSelectedReachLocations(temp);
|
||||
return new QuestReachListPrompt(context);
|
||||
} else if (input != null && input.equalsIgnoreCase(BukkitLang.get("cmdCancel"))) {
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||
temp.remove(player.getUniqueId());
|
||||
plugin.getQuestFactory().setSelectedReachLocations(temp);
|
||||
return new QuestReachListPrompt(context);
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
package me.pikamug.quests.listeners;
|
||||
|
||||
import me.pikamug.quests.quests.BukkitQuest;
|
||||
import me.pikamug.quests.player.BukkitQuester;
|
||||
import me.pikamug.quests.BukkitQuestsPlugin;
|
||||
import me.pikamug.quests.enums.ObjectiveType;
|
||||
import me.pikamug.quests.player.BukkitQuester;
|
||||
import me.pikamug.quests.player.Quester;
|
||||
import me.pikamug.quests.quests.BukkitQuest;
|
||||
import me.pikamug.quests.quests.Quest;
|
||||
import me.pikamug.quests.quests.components.Stage;
|
||||
import me.pikamug.quests.util.BukkitItemUtil;
|
||||
@ -65,10 +65,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
|
||||
public class BukkitPlayerListener implements Listener {
|
||||
@ -237,7 +237,8 @@ public class BukkitPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
final ConcurrentHashMap<UUID, Block> temp
|
||||
= plugin.getQuestFactory().getSelectedBlockStarts();
|
||||
temp.put(player.getUniqueId(), block);
|
||||
plugin.getQuestFactory().setSelectedBlockStarts(temp);
|
||||
if (loc.getWorld() != null) {
|
||||
@ -254,12 +255,13 @@ public class BukkitPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp
|
||||
= plugin.getActionFactory().getSelectedExplosionLocations();
|
||||
temp.put(player.getUniqueId(), block);
|
||||
plugin.getActionFactory().setSelectedExplosionLocations(temp);
|
||||
if (loc.getWorld() != null) {
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation") + " "
|
||||
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation")
|
||||
+ " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
+ loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
|
||||
+ BukkitItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
}
|
||||
@ -271,12 +273,13 @@ public class BukkitPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getActionFactory().getSelectedEffectLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp
|
||||
= plugin.getActionFactory().getSelectedEffectLocations();
|
||||
temp.put(player.getUniqueId(), block);
|
||||
plugin.getActionFactory().setSelectedEffectLocations(temp);
|
||||
if (loc.getWorld() != null) {
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation") + " "
|
||||
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation")
|
||||
+ " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
+ loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
|
||||
+ BukkitItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
}
|
||||
@ -288,12 +291,13 @@ public class BukkitPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getActionFactory().getSelectedMobLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp
|
||||
= plugin.getActionFactory().getSelectedMobLocations();
|
||||
temp.put(player.getUniqueId(), block);
|
||||
plugin.getActionFactory().setSelectedMobLocations(temp);
|
||||
if (loc.getWorld() != null) {
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation") + " "
|
||||
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation")
|
||||
+ " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
+ loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
|
||||
+ BukkitItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
}
|
||||
@ -305,12 +309,13 @@ public class BukkitPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getActionFactory().getSelectedLightningLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp
|
||||
= plugin.getActionFactory().getSelectedLightningLocations();
|
||||
temp.put(player.getUniqueId(), block);
|
||||
plugin.getActionFactory().setSelectedLightningLocations(temp);
|
||||
if (loc.getWorld() != null) {
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation") + " "
|
||||
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation")
|
||||
+ " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
+ loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
|
||||
+ BukkitItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
}
|
||||
@ -322,12 +327,13 @@ public class BukkitPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp
|
||||
= plugin.getActionFactory().getSelectedTeleportLocations();
|
||||
temp.put(player.getUniqueId(), block);
|
||||
plugin.getActionFactory().setSelectedTeleportLocations(temp);
|
||||
if (loc.getWorld() != null) {
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation") + " "
|
||||
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation")
|
||||
+ " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
+ loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
|
||||
+ BukkitItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
}
|
||||
@ -339,12 +345,13 @@ public class BukkitPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp
|
||||
= plugin.getQuestFactory().getSelectedKillLocations();
|
||||
temp.put(player.getUniqueId(), block);
|
||||
plugin.getQuestFactory().setSelectedKillLocations(temp);
|
||||
if (loc.getWorld() != null) {
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation") + " "
|
||||
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation")
|
||||
+ " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
+ loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
|
||||
+ BukkitItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
}
|
||||
@ -356,12 +363,13 @@ public class BukkitPlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
final Location loc = block.getLocation();
|
||||
final Map<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
|
||||
final ConcurrentHashMap<UUID, Block> temp
|
||||
= plugin.getQuestFactory().getSelectedReachLocations();
|
||||
temp.put(player.getUniqueId(), block);
|
||||
plugin.getQuestFactory().setSelectedReachLocations(temp);
|
||||
if (loc.getWorld() != null) {
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation") + " "
|
||||
+ ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questSelectedLocation")
|
||||
+ " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", "
|
||||
+ loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN
|
||||
+ BukkitItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
|
||||
}
|
||||
@ -397,7 +405,8 @@ public class BukkitPlayerListener implements Listener {
|
||||
}
|
||||
for (final Quest currentQuest : quester.getCurrentQuests().keySet()) {
|
||||
if (currentQuest.getId().equals(bukkitQuest.getId())) {
|
||||
BukkitLang.send(player, ChatColor.RED + BukkitLang.get(player, "questAlreadyOn"));
|
||||
BukkitLang.send(player, ChatColor.RED + BukkitLang.get(player,
|
||||
"questAlreadyOn"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -939,7 +948,7 @@ public class BukkitPlayerListener implements Listener {
|
||||
}
|
||||
|
||||
if (plugin.getQuestFactory().getSelectingNpcs().contains(event.getPlayer().getUniqueId())) {
|
||||
final Set<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
final ConcurrentSkipListSet<UUID> temp = plugin.getQuestFactory().getSelectingNpcs();
|
||||
temp.remove(event.getPlayer().getUniqueId());
|
||||
plugin.getQuestFactory().setSelectingNpcs(temp);
|
||||
}
|
||||
|
@ -932,7 +932,7 @@ public class BukkitQuester implements Quester {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((available.size() + rows) <= (page * rows) || available.size() == 0) {
|
||||
if ((available.size() + rows) <= (page * rows) || available.isEmpty()) {
|
||||
BukkitLang.send(player, ChatColor.YELLOW + BukkitLang.get(player, "pageNotExist"));
|
||||
} else {
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questListTitle"));
|
||||
@ -959,7 +959,7 @@ public class BukkitQuester implements Quester {
|
||||
BukkitLang.send(player, ChatColor.GOLD + msg);
|
||||
}
|
||||
} else {
|
||||
if ((quests.size() + rows) <= (page * rows) || quests.size() == 0) {
|
||||
if ((quests.size() + rows) <= (page * rows) || quests.isEmpty()) {
|
||||
BukkitLang.send(player, ChatColor.YELLOW + BukkitLang.get(player, "pageNotExist"));
|
||||
} else {
|
||||
BukkitLang.send(player, ChatColor.GOLD + BukkitLang.get(player, "questListTitle"));
|
||||
|
@ -22,11 +22,11 @@ import me.pikamug.quests.quests.components.Planner;
|
||||
import me.pikamug.quests.quests.components.Requirements;
|
||||
import me.pikamug.quests.quests.components.Rewards;
|
||||
import me.pikamug.quests.quests.components.Stage;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import me.pikamug.quests.util.BukkitConfigUtil;
|
||||
import me.pikamug.quests.util.BukkitFakeConversable;
|
||||
import me.pikamug.quests.util.BukkitLang;
|
||||
import me.pikamug.quests.util.BukkitMiscUtil;
|
||||
import me.pikamug.quests.util.Key;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
@ -49,23 +49,23 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
|
||||
public class BukkitQuestFactory implements QuestFactory, ConversationAbandonedListener {
|
||||
|
||||
private final BukkitQuestsPlugin plugin;
|
||||
private final ConversationFactory conversationFactory;
|
||||
private Map<UUID, Block> selectedBlockStarts = new HashMap<>();
|
||||
private Map<UUID, Block> selectedKillLocations = new HashMap<>();
|
||||
private Map<UUID, Block> selectedReachLocations = new HashMap<>();
|
||||
private Set<UUID> selectingNpcs = new HashSet<>();
|
||||
private ConcurrentHashMap<UUID, Block> selectedBlockStarts = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<UUID, Block> selectedKillLocations = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<UUID, Block> selectedReachLocations = new ConcurrentHashMap<>();
|
||||
private ConcurrentSkipListSet<UUID> selectingNpcs = new ConcurrentSkipListSet<>();
|
||||
private List<String> editingQuestNames = new LinkedList<>();
|
||||
|
||||
public BukkitQuestFactory(final BukkitQuestsPlugin plugin) {
|
||||
@ -84,35 +84,35 @@ public class BukkitQuestFactory implements QuestFactory, ConversationAbandonedLi
|
||||
}
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedBlockStarts() {
|
||||
public ConcurrentHashMap<UUID, Block> getSelectedBlockStarts() {
|
||||
return selectedBlockStarts;
|
||||
}
|
||||
|
||||
public void setSelectedBlockStarts(final Map<UUID, Block> selectedBlockStarts) {
|
||||
public void setSelectedBlockStarts(final ConcurrentHashMap<UUID, Block> selectedBlockStarts) {
|
||||
this.selectedBlockStarts = selectedBlockStarts;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedKillLocations() {
|
||||
public ConcurrentHashMap<UUID, Block> getSelectedKillLocations() {
|
||||
return selectedKillLocations;
|
||||
}
|
||||
|
||||
public void setSelectedKillLocations(final Map<UUID, Block> selectedKillLocations) {
|
||||
public void setSelectedKillLocations(final ConcurrentHashMap<UUID, Block> selectedKillLocations) {
|
||||
this.selectedKillLocations = selectedKillLocations;
|
||||
}
|
||||
|
||||
public Map<UUID, Block> getSelectedReachLocations() {
|
||||
public ConcurrentHashMap<UUID, Block> getSelectedReachLocations() {
|
||||
return selectedReachLocations;
|
||||
}
|
||||
|
||||
public void setSelectedReachLocations(final Map<UUID, Block> selectedReachLocations) {
|
||||
public void setSelectedReachLocations(final ConcurrentHashMap<UUID, Block> selectedReachLocations) {
|
||||
this.selectedReachLocations = selectedReachLocations;
|
||||
}
|
||||
|
||||
public Set<UUID> getSelectingNpcs() {
|
||||
public ConcurrentSkipListSet<UUID> getSelectingNpcs() {
|
||||
return selectingNpcs;
|
||||
}
|
||||
|
||||
public void setSelectingNpcs(final Set<UUID> selectingNpcs) {
|
||||
public void setSelectingNpcs(final ConcurrentSkipListSet<UUID> selectingNpcs) {
|
||||
this.selectingNpcs = selectingNpcs;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user