Skip to content

Commit

Permalink
add message for disabled spells
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Dec 9, 2023
1 parent c48c23d commit e8715b2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ public static void handle(MinecraftServer server, ServerPlayer player, ServerGam
server.execute(() -> {
MagicCaster caster = player.getComponent(ArcanusComponents.MAGIC_CASTER);

if (!player.getComponent(ArcanusComponents.SPELL_MEMORY).hasSpell(spell) || (spell instanceof CanBeDisabled canBeDisabled && !canBeDisabled.enabled())) {
if (!player.getComponent(ArcanusComponents.SPELL_MEMORY).hasSpell(spell)) {
player.displayClientMessage(Arcanus.translate("error", "unknown_spell").withStyle(ChatFormatting.RED), true);
return;
}

if (spell instanceof CanBeDisabled canBeDisabled && !canBeDisabled.enabled()) {
player.displayClientMessage(Arcanus.translate("error", "disabled_spell").withStyle(ChatFormatting.RED), false);
return;
}

int realManaCost = (int) (spell.getManaCost() * ArcanusEntityAttributes.getManaCost(player));

if (!player.isCreative() && (!ArcanusConfig.haveBurnout || caster.getMana() <= 0) && (ArcanusConfig.haveBurnout || caster.getMana() < realManaCost)) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/arcanus/lang/en_gb.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"error.arcanus.missing_spell": "This spell doesn't exist",
"error.arcanus.disabled_spell": "This spell is disabled",
"error.arcanus.unknown_spell": "You don't know this spell yet",
"error.arcanus.not_enough_mana": "You don't have enough mana to cast this spell",
"error.arcanus.burnout": "You're feeling a bit worn out...",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/arcanus/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"error.arcanus.missing_spell": "This spell doesn't exist",
"error.arcanus.disabled_spell": "This spell is disabled",
"error.arcanus.unknown_spell": "You don't know this spell yet",
"error.arcanus.not_enough_mana": "You don't have enough mana to cast this spell",
"error.arcanus.burnout": "You're feeling a bit worn out...",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/arcanus/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"error.arcanus.missing_spell": "这个咒语并不存在",
"error.arcanus.disabled_spell": "This spell is disabled",
"error.arcanus.unknown_spell": "你还不知道这个咒语",
"error.arcanus.not_enough_mana": "你没有足够的法力来施展这个法术",
"error.arcanus.burnout": "你感觉有点疲惫...",
Expand Down

0 comments on commit e8715b2

Please sign in to comment.