mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 12:46:46 +01:00
Don't enable presets with prices if economy is disabled (#3497)
This commit is contained in:
parent
951767dc64
commit
6fbd1376ca
@ -128,7 +128,7 @@ public class ComponentPresetManager {
|
||||
0,
|
||||
"",
|
||||
"<rainbow:2>Disco Floor</rainbow>",
|
||||
Arrays.asList("<gold>Spice up your plot floor</gold>"),
|
||||
List.of("<gold>Spice up your plot floor</gold>"),
|
||||
ItemTypes.YELLOW_WOOL
|
||||
));
|
||||
yamlConfiguration.set("presets", defaultPreset.stream().map(ComponentPreset::serialize).collect(Collectors.toList()));
|
||||
@ -210,7 +210,13 @@ public class ComponentPresetManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (componentPreset.getCost() > 0.0D && econHandler.isEnabled(plot.getArea())) {
|
||||
if (componentPreset.getCost() > 0.0D) {
|
||||
if (!econHandler.isEnabled(plot.getArea())) {
|
||||
getPlayer().sendMessage(
|
||||
TranslatableCaption.of("preset.economy_disabled"),
|
||||
Template.of("preset", componentPreset.getDisplayName()));
|
||||
return false;
|
||||
}
|
||||
if (econHandler.getMoney(getPlayer()) < componentPreset.getCost()) {
|
||||
getPlayer().sendMessage(TranslatableCaption.of("preset.preset_cannot_afford"));
|
||||
return false;
|
||||
@ -246,11 +252,16 @@ public class ComponentPresetManager {
|
||||
for (int i = 0; i < allowedPresets.size(); i++) {
|
||||
final ComponentPreset preset = allowedPresets.get(i);
|
||||
final List<String> lore = new ArrayList<>();
|
||||
if (preset.getCost() > 0 && this.econHandler.isEnabled(plot.getArea())) {
|
||||
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
|
||||
TranslatableCaption.of("preset.preset_lore_cost").getComponent(player),
|
||||
Template.of("cost", String.format("%.2f", preset.getCost()))
|
||||
)));
|
||||
if (preset.getCost() > 0) {
|
||||
if (!this.econHandler.isEnabled(plot.getArea())) {
|
||||
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
|
||||
TranslatableCaption.of("preset.preset_lore_economy_disabled").getComponent(player))));
|
||||
} else {
|
||||
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
|
||||
TranslatableCaption.of("preset.preset_lore_cost").getComponent(player),
|
||||
Template.of("cost", String.format("%.2f", preset.getCost()))
|
||||
)));
|
||||
}
|
||||
}
|
||||
lore.add(MINI_MESSAGE.serialize(MINI_MESSAGE.parse(
|
||||
TranslatableCaption.of("preset.preset_lore_component").getComponent(player),
|
||||
|
@ -460,9 +460,11 @@
|
||||
"backups.backup_automatic_failure": "<prefix><red>The automatic backup process failed. Your pending action has been canceled. Reason: </red><gray><reason></gray>",
|
||||
"preset.preset_cannot_afford": "<prefix><red>You cannot afford that preset.</red>",
|
||||
"preset.preset_invalid": "<prefix><red>Could not generate a pattern from that preset.</red>",
|
||||
"preset.preset_lore_cost": "<prefix><gray>Cost: </gray><gold><cost></gold>",
|
||||
"preset.preset_lore_cost": "<gray>Cost: </gray><gold><cost></gold>",
|
||||
"preset.preset_lore_economy_disabled": "<gray>Cost: </gray><red>Economy is disabled</red>",
|
||||
"preset.preset_lore_component": "<gray>Component: </gray><gold><component></gold>",
|
||||
"preset.title": "Plot Components",
|
||||
"preset.economy_disabled": "<prefix><red>The component preset '<preset>' has a price set but economy is disabled.</red>",
|
||||
"generic.generic_other": "<gray>other</gray>",
|
||||
"generic.generic_merged": "<gray>merged</gray>",
|
||||
"generic.generic_unowned": "<gray>unowned</gray>",
|
||||
|
Loading…
Reference in New Issue
Block a user