mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-24 17:21:40 +01:00
Improve use of Actions Editor through console
This commit is contained in:
parent
25350ed2a2
commit
c1b8161630
@ -562,10 +562,15 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||||||
case 2:
|
case 2:
|
||||||
return new ActionMobTypePrompt(context, mobIndex, questMob);
|
return new ActionMobTypePrompt(context, mobIndex, questMob);
|
||||||
case 3:
|
case 3:
|
||||||
final Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
if (context.getForWhom() instanceof Player) {
|
||||||
selectedMobLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
final Map<UUID, Block> selectedMobLocations = plugin.getActionFactory().getSelectedMobLocations();
|
||||||
plugin.getActionFactory().setSelectedMobLocations(selectedMobLocations);
|
selectedMobLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||||
return new ActionMobLocationPrompt(context, mobIndex, questMob);
|
plugin.getActionFactory().setSelectedMobLocations(selectedMobLocations);
|
||||||
|
return new ActionMobLocationPrompt(context, mobIndex, questMob);
|
||||||
|
} else {
|
||||||
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("consoleError"));
|
||||||
|
return new ActionMainPrompt(context);
|
||||||
|
}
|
||||||
case 4:
|
case 4:
|
||||||
return new ActionMobAmountPrompt(context, mobIndex, questMob);
|
return new ActionMobAmountPrompt(context, mobIndex, questMob);
|
||||||
case 5:
|
case 5:
|
||||||
@ -715,12 +720,11 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
if (MiscUtil.getProperMobType(input) != null) {
|
if (MiscUtil.getProperMobType(input) != null) {
|
||||||
questMob.setType(MiscUtil.getProperMobType(input));
|
questMob.setType(MiscUtil.getProperMobType(input));
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
|
||||||
+ Lang.get("stageEditorInvalidMob"));
|
+ Lang.get("stageEditorInvalidMob"));
|
||||||
return new ActionMobTypePrompt(context, mobIndex, questMob);
|
return new ActionMobTypePrompt(context, mobIndex, questMob);
|
||||||
}
|
}
|
||||||
@ -760,18 +764,19 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
try {
|
try {
|
||||||
final int i = Integer.parseInt(input);
|
final int i = Integer.parseInt(input);
|
||||||
if (i < 1) {
|
if (i < 1) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
|
||||||
|
.replace("<number>", "1"));
|
||||||
return new ActionMobAmountPrompt(context, mobIndex, questMob);
|
return new ActionMobAmountPrompt(context, mobIndex, questMob);
|
||||||
}
|
}
|
||||||
questMob.setSpawnAmounts(i);
|
questMob.setSpawnAmounts(i);
|
||||||
return new ActionMobPrompt(context, mobIndex, questMob);
|
return new ActionMobPrompt(context, mobIndex, questMob);
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", input));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||||
|
.replace("<input>", input));
|
||||||
return new ActionMobAmountPrompt(context, mobIndex, questMob);
|
return new ActionMobAmountPrompt(context, mobIndex, questMob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -921,19 +926,18 @@ public class ActionMainPrompt extends ActionsEditorNumericPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
|
||||||
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
|
||||||
if (plugin.getDependencies().getDenizenApi().containsScript(input)) {
|
if (plugin.getDependencies().getDenizenApi().containsScript(input)) {
|
||||||
context.setSessionData(CK.E_DENIZEN, input.toUpperCase());
|
context.setSessionData(CK.E_DENIZEN, input.toUpperCase());
|
||||||
return new ActionMainPrompt(context);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("stageEditorInvalidScript"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidScript"));
|
||||||
return new ActionDenizenPrompt(context);
|
return new ActionDenizenPrompt(context);
|
||||||
}
|
}
|
||||||
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
context.setSessionData(CK.E_DENIZEN, null);
|
context.setSessionData(CK.E_DENIZEN, null);
|
||||||
player.sendMessage(ChatColor.YELLOW + Lang.get("stageEditorDenizenCleared"));
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("stageEditorDenizenCleared"));
|
||||||
return new ActionMainPrompt(context);
|
return new ActionMainPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new ActionMainPrompt(context);
|
return new ActionMainPrompt(context);
|
||||||
|
@ -610,7 +610,6 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
final LinkedList<String> effTypes = new LinkedList<String>();
|
final LinkedList<String> effTypes = new LinkedList<String>();
|
||||||
for (final String s : input.split(" ")) {
|
for (final String s : input.split(" ")) {
|
||||||
@ -618,7 +617,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
|
|||||||
effTypes.add(PotionEffectType.getByName(s.toUpperCase()).getName());
|
effTypes.add(PotionEffectType.getByName(s.toUpperCase()).getName());
|
||||||
context.setSessionData(CK.E_POTION_TYPES, effTypes);
|
context.setSessionData(CK.E_POTION_TYPES, effTypes);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + s + " " + ChatColor.RED
|
||||||
+ Lang.get("eventEditorInvalidPotionType"));
|
+ Lang.get("eventEditorInvalidPotionType"));
|
||||||
return new PlayerPotionTypesPrompt(context);
|
return new PlayerPotionTypesPrompt(context);
|
||||||
}
|
}
|
||||||
@ -655,7 +654,6 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
final LinkedList<Long> effDurations = new LinkedList<Long>();
|
final LinkedList<Long> effDurations = new LinkedList<Long>();
|
||||||
for (final String s : input.split(" ")) {
|
for (final String s : input.split(" ")) {
|
||||||
@ -663,12 +661,14 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
|
|||||||
final int i = Integer.parseInt(s);
|
final int i = Integer.parseInt(s);
|
||||||
final long l = i * 1000;
|
final long l = i * 1000;
|
||||||
if (l < 1000) {
|
if (l < 1000) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
|
||||||
|
.replace("<number>", "1"));
|
||||||
return new PlayerPotionDurationsPrompt(context);
|
return new PlayerPotionDurationsPrompt(context);
|
||||||
}
|
}
|
||||||
effDurations.add(l / 50L);
|
effDurations.add(l / 50L);
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", s));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||||
|
.replace("<input>", s));
|
||||||
return new PlayerPotionDurationsPrompt(context);
|
return new PlayerPotionDurationsPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -705,19 +705,20 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
final LinkedList<Integer> magAmounts = new LinkedList<Integer>();
|
final LinkedList<Integer> magAmounts = new LinkedList<Integer>();
|
||||||
for (final String s : input.split(" ")) {
|
for (final String s : input.split(" ")) {
|
||||||
try {
|
try {
|
||||||
final int i = Integer.parseInt(s);
|
final int i = Integer.parseInt(s);
|
||||||
if (i < 1) {
|
if (i < 1) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("invalidMinimum").replace("<number>", "1"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidMinimum")
|
||||||
|
.replace("<number>", "1"));
|
||||||
return new PlayerPotionMagnitudesPrompt(context);
|
return new PlayerPotionMagnitudesPrompt(context);
|
||||||
}
|
}
|
||||||
magAmounts.add(i);
|
magAmounts.add(i);
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
player.sendMessage(ChatColor.RED + Lang.get("reqNotANumber").replace("<input>", s));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
|
||||||
|
.replace("<input>", s));
|
||||||
return new PlayerPotionMagnitudesPrompt(context);
|
return new PlayerPotionMagnitudesPrompt(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -758,7 +759,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
|
|||||||
try {
|
try {
|
||||||
final int i = Integer.parseInt(input);
|
final int i = Integer.parseInt(input);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||||
+ Lang.get("invalidMinimum").replace("<number>", "0"));
|
+ Lang.get("invalidMinimum").replace("<number>", "0"));
|
||||||
return new PlayerHungerPrompt(context);
|
return new PlayerHungerPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
@ -807,7 +808,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
|
|||||||
try {
|
try {
|
||||||
final int i = Integer.parseInt(input);
|
final int i = Integer.parseInt(input);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||||
+ Lang.get("invalidMinimum").replace("<number>", "0"));
|
+ Lang.get("invalidMinimum").replace("<number>", "0"));
|
||||||
return new PlayerSaturationPrompt(context);
|
return new PlayerSaturationPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
@ -856,7 +857,7 @@ public class PlayerPrompt extends ActionsEditorNumericPrompt {
|
|||||||
try {
|
try {
|
||||||
final int i = Integer.parseInt(input);
|
final int i = Integer.parseInt(input);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED
|
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||||
+ Lang.get("invalidMinimum").replace("<number>", "0"));
|
+ Lang.get("invalidMinimum").replace("<number>", "0"));
|
||||||
return new PlayerHealthPrompt(context);
|
return new PlayerHealthPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
|
@ -146,11 +146,16 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt {
|
|||||||
case 2:
|
case 2:
|
||||||
return new ThunderPrompt(context);
|
return new ThunderPrompt(context);
|
||||||
case 3:
|
case 3:
|
||||||
final Map<UUID, Block> selectedLightningLocations
|
if (context.getForWhom() instanceof Player) {
|
||||||
= plugin.getActionFactory().getSelectedLightningLocations();
|
final Map<UUID, Block> selectedLightningLocations
|
||||||
selectedLightningLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
= plugin.getActionFactory().getSelectedLightningLocations();
|
||||||
plugin.getActionFactory().setSelectedLightningLocations(selectedLightningLocations);
|
selectedLightningLocations.put(((Player) context.getForWhom()).getUniqueId(), null);
|
||||||
return new LightningPrompt(context);
|
plugin.getActionFactory().setSelectedLightningLocations(selectedLightningLocations);
|
||||||
|
return new LightningPrompt(context);
|
||||||
|
} else {
|
||||||
|
context.getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("consoleError"));
|
||||||
|
return new WeatherPrompt(context);
|
||||||
|
}
|
||||||
case 4:
|
case 4:
|
||||||
return new ActionMainPrompt(context);
|
return new ActionMainPrompt(context);
|
||||||
default:
|
default:
|
||||||
@ -307,12 +312,11 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
if (plugin.getServer().getWorld(input) != null) {
|
if (plugin.getServer().getWorld(input) != null) {
|
||||||
context.setSessionData(CK.E_WORLD_STORM, plugin.getServer().getWorld(input).getName());
|
context.setSessionData(CK.E_WORLD_STORM, plugin.getServer().getWorld(input).getName());
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
|
||||||
+ Lang.get("eventEditorInvalidWorld"));
|
+ Lang.get("eventEditorInvalidWorld"));
|
||||||
return new StormWorldPrompt(context);
|
return new StormWorldPrompt(context);
|
||||||
}
|
}
|
||||||
@ -517,12 +521,11 @@ public class WeatherPrompt extends ActionsEditorNumericPrompt {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Prompt acceptInput(final ConversationContext context, final String input) {
|
public Prompt acceptInput(final ConversationContext context, final String input) {
|
||||||
final Player player = (Player) context.getForWhom();
|
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
if (plugin.getServer().getWorld(input) != null) {
|
if (plugin.getServer().getWorld(input) != null) {
|
||||||
context.setSessionData(CK.E_WORLD_THUNDER, plugin.getServer().getWorld(input).getName());
|
context.setSessionData(CK.E_WORLD_THUNDER, plugin.getServer().getWorld(input).getName());
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + input + " " + ChatColor.RED
|
||||||
+ Lang.get("eventEditorInvalidWorld"));
|
+ Lang.get("eventEditorInvalidWorld"));
|
||||||
return new ThunderWorldPrompt(context);
|
return new ThunderWorldPrompt(context);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user