Use trivial block for selection, fixes #2217

This commit is contained in:
PikaMug 2024-05-31 13:20:02 -04:00
parent dde8aa252b
commit d3ee8c6c4b
7 changed files with 27 additions and 11 deletions

View File

@ -31,6 +31,7 @@ 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 org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.block.Block;
@ -530,7 +531,8 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
if (context.getForWhom() instanceof Player) {
final ConcurrentHashMap<UUID, Block> selectedMobLocations
= plugin.getActionFactory().getSelectedMobLocations();
selectedMobLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
selectedMobLocations.put(((Player) context.getForWhom()).getUniqueId(),
Bukkit.getWorlds().get(0).getBlockAt(0,0,0));
plugin.getActionFactory().setSelectedMobLocations(selectedMobLocations);
return new ActionMobLocationPrompt(context, questMob);
} else {

View File

@ -20,6 +20,7 @@ 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.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
@ -149,7 +150,8 @@ public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
if (context.getForWhom() instanceof Player) {
final ConcurrentHashMap<UUID, Block> selectedExplosionLocations
= plugin.getActionFactory().getSelectedExplosionLocations();
selectedExplosionLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
selectedExplosionLocations.put(((Player) context.getForWhom()).getUniqueId(),
Bukkit.getWorlds().get(0).getBlockAt(0,0,0));
plugin.getActionFactory().setSelectedExplosionLocations(selectedExplosionLocations);
return new ActionEffectExplosionPrompt(context);
} else {
@ -274,7 +276,8 @@ public class ActionEffectPrompt extends ActionsEditorNumericPrompt {
if (context.getForWhom() instanceof Player) {
final ConcurrentHashMap<UUID, Block> selectedEffectLocations
= plugin.getActionFactory().getSelectedEffectLocations();
selectedEffectLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
selectedEffectLocations.put(((Player) context.getForWhom()).getUniqueId(),
Bukkit.getWorlds().get(0).getBlockAt(0,0,0));
plugin.getActionFactory().setSelectedEffectLocations(selectedEffectLocations);
return new ActionEffectSoundLocationPrompt(context);
} else {

View File

@ -23,6 +23,7 @@ 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.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.block.Block;
@ -246,7 +247,8 @@ public class ActionPlayerPrompt extends ActionsEditorNumericPrompt {
if (context.getForWhom() instanceof Player) {
final ConcurrentHashMap<UUID, Block> selectedTeleportLocations
= plugin.getActionFactory().getSelectedTeleportLocations();
selectedTeleportLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
selectedTeleportLocations.put(((Player) context.getForWhom()).getUniqueId(),
Bukkit.getWorlds().get(0).getBlockAt(0,0,0));
plugin.getActionFactory().setSelectedTeleportLocations(selectedTeleportLocations);
return new ActionPlayerTeleportPrompt(context);
} else {

View File

@ -20,6 +20,7 @@ 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.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
@ -158,7 +159,8 @@ public class ActionWeatherPrompt extends ActionsEditorNumericPrompt {
if (context.getForWhom() instanceof Player) {
final ConcurrentHashMap<UUID, Block> selectedLightningLocations
= plugin.getActionFactory().getSelectedLightningLocations();
selectedLightningLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
selectedLightningLocations.put(((Player) context.getForWhom()).getUniqueId(),
Bukkit.getWorlds().get(0).getBlockAt(0,0,0));
plugin.getActionFactory().setSelectedLightningLocations(selectedLightningLocations);
return new ActionLightningPrompt(context);
} else {

View File

@ -28,6 +28,7 @@ import me.pikamug.quests.quests.Quest;
import me.pikamug.quests.util.BukkitItemUtil;
import me.pikamug.quests.util.BukkitLang;
import me.pikamug.quests.util.Key;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
@ -270,7 +271,8 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
case 3:
return new QuestFinishMessagePrompt(context);
case 4:
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) {
return new QuestNPCStartPrompt(context);
} else {
return new QuestMainPrompt(context);
@ -278,7 +280,8 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
case 5:
if (context.getForWhom() instanceof Player) {
final ConcurrentHashMap<UUID, Block> blockStarts = plugin.getQuestFactory().getSelectedBlockStarts();
blockStarts.put(((Player) context.getForWhom()).getUniqueId(), null);
blockStarts.put(((Player) context.getForWhom()).getUniqueId(),
Bukkit.getWorlds().get(0).getBlockAt(0,0,0));
plugin.getQuestFactory().setSelectedBlockStarts(blockStarts);
return new QuestBlockStartPrompt(context);
} else {
@ -292,7 +295,8 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
return new QuestMainPrompt(context);
}
case 7:
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) {
return new QuestGuiDisplayPrompt(context);
} else {
return new QuestMainPrompt(context);

View File

@ -20,6 +20,7 @@ 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.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Location;
@ -36,7 +37,6 @@ import java.util.Arrays;
import java.util.Comparator;
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;
@ -419,7 +419,8 @@ public class QuestMobsPrompt extends QuestsEditorNumericPrompt {
case 3:
if (context.getForWhom() instanceof Player) {
final ConcurrentHashMap<UUID, Block> temp = plugin.getQuestFactory().getSelectedKillLocations();
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
temp.put(((Player) context.getForWhom()).getUniqueId(),
Bukkit.getWorlds().get(0).getBlockAt(0,0,0));
plugin.getQuestFactory().setSelectedKillLocations(temp);
return new QuestMobsLocationPrompt(context);
} else {

View File

@ -30,6 +30,7 @@ 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.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.block.Block;
@ -752,7 +753,8 @@ public class QuestStageMainPrompt extends QuestsEditorNumericPrompt {
case 1:
if (context.getForWhom() instanceof Player) {
final ConcurrentHashMap<UUID, Block> temp = plugin.getQuestFactory().getSelectedReachLocations();
temp.put(((Player) context.getForWhom()).getUniqueId(), null);
temp.put(((Player) context.getForWhom()).getUniqueId(),
Bukkit.getWorlds().get(0).getBlockAt(0,0,0));
plugin.getQuestFactory().setSelectedReachLocations(temp);
return new QuestReachLocationPrompt(context);
} else {