From f1e5173b128c3007e77f8b51e47c26af9c28faf8 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 11 Oct 2021 11:44:35 +0300 Subject: [PATCH 1/8] Added time-to-exempt config option for Tornado enchantment and started exempting players that were hit by Tornado from being detectedf by AntiCheats. --- .../enchantments/ecoenchants/normal/Tornado.java | 10 +++++++++- .../src/main/resources/enchants/normal/tornado.yml | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java index a038668b..c2f83953 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java @@ -1,9 +1,11 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; +import com.willfp.eco.core.integrations.anticheat.AnticheatManager; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; @@ -25,6 +27,12 @@ public class Tornado extends EcoEnchant { Vector toAdd = new Vector(0, yVelocity, 0); - this.getPlugin().getScheduler().runLater(() -> victim.setVelocity(victim.getVelocity().clone().add(toAdd)), 1); + this.getPlugin().getScheduler().runLater(() -> { + if (victim instanceof Player player) { + AnticheatManager.exemptPlayer(player); + this.getPlugin().getScheduler().runLater(() -> AnticheatManager.unexemptPlayer(player), this.getConfig().getInt("time-to-exempt")); + } + victim.setVelocity(victim.getVelocity().clone().add(toAdd)); + }, 1); } } diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml index 3dcc58cc..d6383875 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml @@ -29,4 +29,5 @@ general-config: maximum-level: 2 config: - velocity-per-level: 0.25 \ No newline at end of file + velocity-per-level: 0.25 + time-to-exempt: 60 #In ticks. Time to exempt hit player from being detected by your Anti-Cheat for flying (The higher max velocity is - the higher should be this value) \ No newline at end of file From 06e1ebd1e8c7d16759a0e18c6626ba9d5c6015dd Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 11 Oct 2021 14:55:34 +0300 Subject: [PATCH 2/8] Fixed Diurnal enchantment --- .../ecoenchants/enchantments/ecoenchants/normal/Diurnal.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java index 14cf3c6a..7b83df31 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java @@ -20,11 +20,12 @@ public class Diurnal extends EcoEnchant { @NotNull final LivingEntity victim, final int level, @NotNull final EntityDamageByEntityEvent event) { + if (!attacker.getWorld().getEnvironment().equals(World.Environment.NORMAL)) { return; } - if (!(attacker.getWorld().getTime() < 12300 && attacker.getWorld().getTime() > 23850)) { + if (!(attacker.getWorld().getTime() < 12000 && attacker.getWorld().getTime() > 0)) { return; } From 445ad5bb185c642355e8c92a1411e39740ebc5df Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 11 Oct 2021 11:44:35 +0300 Subject: [PATCH 3/8] Added time-to-exempt config option for Tornado enchantment and started exempting players that were hit by Tornado from being detectedf by AntiCheats. --- .../enchantments/ecoenchants/normal/Tornado.java | 14 -------------- .../src/main/resources/enchants/normal/tornado.yml | 3 ++- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java index 3afc824c..a038668b 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java @@ -1,11 +1,9 @@ package com.willfp.ecoenchants.enchantments.ecoenchants.normal; -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchants; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; @@ -27,18 +25,6 @@ public class Tornado extends EcoEnchant { Vector toAdd = new Vector(0, yVelocity, 0); - if (victim instanceof Player pVictim) { - AnticheatManager.exemptPlayer(pVictim); - - this.getPlugin().getScheduler().runLater(() -> { - AnticheatManager.unexemptPlayer(pVictim); - }, 40); - } - - this.getPlugin().getScheduler().run(() -> { - victim.setVelocity(victim.getVelocity().clone().add(toAdd)); - }); - this.getPlugin().getScheduler().runLater(() -> victim.setVelocity(victim.getVelocity().clone().add(toAdd)), 1); } } diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml index 3dcc58cc..d6383875 100644 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml +++ b/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml @@ -29,4 +29,5 @@ general-config: maximum-level: 2 config: - velocity-per-level: 0.25 \ No newline at end of file + velocity-per-level: 0.25 + time-to-exempt: 60 #In ticks. Time to exempt hit player from being detected by your Anti-Cheat for flying (The higher max velocity is - the higher should be this value) \ No newline at end of file From 766c451a9cfbf11cc0db34692904f15fd7c0e05d Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 11 Oct 2021 14:55:34 +0300 Subject: [PATCH 4/8] Fixed Diurnal enchantment --- .../ecoenchants/enchantments/ecoenchants/normal/Diurnal.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java index 14cf3c6a..7b83df31 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java @@ -20,11 +20,12 @@ public class Diurnal extends EcoEnchant { @NotNull final LivingEntity victim, final int level, @NotNull final EntityDamageByEntityEvent event) { + if (!attacker.getWorld().getEnvironment().equals(World.Environment.NORMAL)) { return; } - if (!(attacker.getWorld().getTime() < 12300 && attacker.getWorld().getTime() > 23850)) { + if (!(attacker.getWorld().getTime() < 12000 && attacker.getWorld().getTime() > 0)) { return; } From f80bb796649cc592c5b78440aabd88e6b88eb2ea Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 11 Oct 2021 14:58:24 +0300 Subject: [PATCH 5/8] Fixed Diurnal enchantment --- .../ecoenchants/enchantments/ecoenchants/normal/Diurnal.java | 1 - 1 file changed, 1 deletion(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java index 7b83df31..fcce7324 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java @@ -20,7 +20,6 @@ public class Diurnal extends EcoEnchant { @NotNull final LivingEntity victim, final int level, @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getWorld().getEnvironment().equals(World.Environment.NORMAL)) { return; } From f49e9e11ab563718af1a9b0c725f91268f1df731 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 11 Oct 2021 15:00:45 +0300 Subject: [PATCH 6/8] Fixed Diurnal enchantment --- .../ecoenchants/normal/Tornado.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java index c2f83953..2d3cdd91 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java @@ -27,12 +27,18 @@ public class Tornado extends EcoEnchant { Vector toAdd = new Vector(0, yVelocity, 0); - this.getPlugin().getScheduler().runLater(() -> { - if (victim instanceof Player player) { - AnticheatManager.exemptPlayer(player); - this.getPlugin().getScheduler().runLater(() -> AnticheatManager.unexemptPlayer(player), this.getConfig().getInt("time-to-exempt")); - } + if (victim instanceof Player pVictim) { + AnticheatManager.exemptPlayer(pVictim); + + this.getPlugin().getScheduler().runLater(() -> { + AnticheatManager.unexemptPlayer(pVictim); + }, 40); + } + + this.getPlugin().getScheduler().run(() -> { victim.setVelocity(victim.getVelocity().clone().add(toAdd)); - }, 1); + }); + + this.getPlugin().getScheduler().runLater(() -> victim.setVelocity(victim.getVelocity().clone().add(toAdd)), 1); } -} +} \ No newline at end of file From 6295aaec0d5ef43ec955d077de33fb62e495de67 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 11 Oct 2021 22:27:30 +0300 Subject: [PATCH 7/8] Added data.yml file and its handler to store descriptions state per player (and something else if needed, storage is per uuid). Added /ecoenchants toggledescriptions subcommand to disable descriptions for sender. Added new messages to lang.yml for ToggleDescriptions command. --- .../willfp/ecoenchants/EcoEnchantsPlugin.java | 14 ++++++ .../command/CommandEcoEnchants.java | 3 +- .../ecoenchants/command/CommandReload.java | 7 +++ .../command/CommandToggleDescriptions.java | 31 ++++++++++++ .../willfp/ecoenchants/config/DataYml.java | 49 +++++++++++++++++++ .../ecoenchants/display/EnchantDisplay.java | 10 +++- .../display/options/DescriptionOptions.java | 14 ++++++ .../core-plugin/src/main/resources/data.yml | 0 .../core-plugin/src/main/resources/lang.yml | 4 ++ 9 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java create mode 100644 eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/DataYml.java create mode 100644 eco-core/core-plugin/src/main/resources/data.yml diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java index 21cca9d2..ea7b2e8d 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java @@ -8,6 +8,7 @@ import com.willfp.eco.core.integrations.IntegrationLoader; import com.willfp.eco.util.TelekinesisUtils; import com.willfp.ecoenchants.command.CommandEcoEnchants; import com.willfp.ecoenchants.command.CommandEnchantinfo; +import com.willfp.ecoenchants.config.DataYml; import com.willfp.ecoenchants.config.RarityYml; import com.willfp.ecoenchants.config.TargetYml; import com.willfp.ecoenchants.config.VanillaEnchantsYml; @@ -31,6 +32,7 @@ import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.jetbrains.annotations.Nullable; +import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -54,6 +56,12 @@ public class EcoEnchantsPlugin extends EcoPlugin { @Getter private final TargetYml targetYml; + /** + * Data.yml. + */ + @Getter + private final DataYml dataYml; + /** * VanillaEnchants.yml. */ @@ -69,6 +77,7 @@ public class EcoEnchantsPlugin extends EcoPlugin { rarityYml = new RarityYml(this); targetYml = new TargetYml(this); + dataYml = new DataYml(this); vanillaEnchantsYml = new VanillaEnchantsYml(this); } @@ -81,6 +90,11 @@ public class EcoEnchantsPlugin extends EcoPlugin { @Override protected void handleDisable() { + try { + this.dataYml.save(); + } catch (IOException e) { + e.printStackTrace(); + } for (World world : Bukkit.getServer().getWorlds()) { world.getPopulators().removeIf(blockPopulator -> blockPopulator instanceof LootPopulator); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEcoEnchants.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEcoEnchants.java index bd164f57..cc13ea95 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEcoEnchants.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEcoEnchants.java @@ -18,7 +18,8 @@ public class CommandEcoEnchants extends PluginCommand { .addSubcommand(new CommandReload(plugin)) .addSubcommand(new CommandGiverandombook(plugin)) .addSubcommand(new CommandRandomenchant(plugin)) - .addSubcommand(new CommandLocale(plugin)); + .addSubcommand(new CommandLocale(plugin)) + .addSubcommand(new CommandToggleDescriptions(plugin)); } @Override diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandReload.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandReload.java index 3f019600..bd4e1d3e 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandReload.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandReload.java @@ -5,6 +5,8 @@ import com.willfp.eco.core.command.impl.Subcommand; import com.willfp.ecoenchants.EcoEnchantsPlugin; import org.jetbrains.annotations.NotNull; +import java.io.IOException; + public class CommandReload extends Subcommand { /** * Instantiate a new command handler. @@ -18,6 +20,11 @@ public class CommandReload extends Subcommand { @Override public CommandHandler getHandler() { return (sender, args) -> { + try { + ((EcoEnchantsPlugin) this.getPlugin()).getDataYml().save(); + } catch (IOException e) { + e.printStackTrace(); + } this.getPlugin().reload(); sender.sendMessage(this.getPlugin().getLangYml().getMessage("reloaded")); }; diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java new file mode 100644 index 00000000..20f8fe7a --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java @@ -0,0 +1,31 @@ +package com.willfp.ecoenchants.command; + +import com.willfp.eco.core.command.CommandHandler; +import com.willfp.eco.core.command.impl.Subcommand; +import com.willfp.ecoenchants.EcoEnchantsPlugin; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +public class CommandToggleDescriptions extends Subcommand { + /** + * Instantiate a new command handler. + * + * @param plugin The plugin for the commands to listen for. + */ + public CommandToggleDescriptions(@NotNull final EcoEnchantsPlugin plugin) { + super(plugin, "toggledescriptions", "ecoenchants.command.toggledescriptions", true); + } + + @Override + public CommandHandler getHandler() { + return (sender, args) -> { + if (!((EcoEnchantsPlugin) this.getPlugin()).getDisplayModule().getOptions().getDescriptionOptions().isEnabled()){ + sender.sendMessage(this.getPlugin().getLangYml().getMessage("descriptions-disabled")); + return; + } + Player player = (Player) sender; + ((EcoEnchantsPlugin) this.getPlugin()).getDataYml().toggleDescriptions(player); + player.sendMessage(this.getPlugin().getLangYml().getMessage("descriptions-enabled."+((EcoEnchantsPlugin) this.getPlugin()).getDataYml().isDescriptionEnabled(player))); + }; + } +} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/DataYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/DataYml.java new file mode 100644 index 00000000..e3448199 --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/DataYml.java @@ -0,0 +1,49 @@ +package com.willfp.ecoenchants.config; + +import com.willfp.eco.core.EcoPlugin; +import com.willfp.eco.core.config.yaml.YamlBaseConfig; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +public class DataYml extends YamlBaseConfig { + + /** + * Instantiate data.yml. + * + * @param plugin Instance of EcoEnchants. + */ + public DataYml(@NotNull final EcoPlugin plugin) { + super("data", false, plugin); + } + + /** + * Get descriptions state (enabled/disabled) for the given player. + * + * @param player A player to get the descriptions state of. + * @return Descriptions state for the given player. + */ + public boolean isDescriptionEnabled(@NotNull final Player player) { + if (this.getBoolOrNull(player.getUniqueId() + ".describe") == null) return true; + return this.getBool(player.getUniqueId() + ".describe"); + } + + /** + * Set descriptions state (enabled/disabled) for the given player. + * + * @param player A player to set the given state for. + * @param enabled The state to set for the given player. + */ + public void setDescriptionEnabled(@NotNull final Player player, final boolean enabled) { + this.set(player.getUniqueId() + ".describe", enabled); + } + + /** + * Toggle descriptions state (enabled->disabled | disabled->enabled) for the given player. + * + * @param player A player to toggle the state for. + */ + public void toggleDescriptions(@NotNull final Player player) { + setDescriptionEnabled(player, !isDescriptionEnabled(player)); + } + +} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java index aeaa7ef8..91f78624 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java @@ -129,7 +129,10 @@ public class EnchantDisplay extends DisplayModule { lore.add(Display.PREFIX + name); if (!options.getDescriptionOptions().isShowingAtBottom()) { - if (enchantments.size() <= options.getDescriptionOptions().getThreshold() && options.getDescriptionOptions().isEnabled()) { + if (enchantments.size() <= options.getDescriptionOptions().getThreshold() + && options.getDescriptionOptions().isEnabled() + && options.getDescriptionOptions().playerEnabled(player) + ) { lore.addAll(EnchantmentCache.getEntry(enchantment).getDescription(level)); } } @@ -159,7 +162,10 @@ public class EnchantDisplay extends DisplayModule { } if (options.getDescriptionOptions().isShowingAtBottom()) { - if (enchantments.size() <= options.getDescriptionOptions().getThreshold() && options.getDescriptionOptions().isEnabled()) { + if (enchantments.size() <= options.getDescriptionOptions().getThreshold() + && options.getDescriptionOptions().isEnabled() + && options.getDescriptionOptions().playerEnabled(player) + ) { for (Map.Entry entry : enchantments.entrySet()) { lore.addAll(EnchantmentCache.getEntry(entry.getKey()).getDescription(entry.getValue())); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java index 0457859f..ca79f43e 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java @@ -2,8 +2,11 @@ package com.willfp.ecoenchants.display.options; import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.PluginDependent; +import com.willfp.ecoenchants.EcoEnchantsPlugin; import lombok.Getter; +import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class DescriptionOptions extends PluginDependent { /** @@ -48,4 +51,15 @@ public class DescriptionOptions extends PluginDependent { color = this.getPlugin().getLangYml().getString("description-color"); showingAtBottom = this.getPlugin().getConfigYml().getBool("lore.describe.at-bottom"); } + + /** + * Get description state for a player + * + * @param player - a player to get the state for. + */ + public boolean playerEnabled(@Nullable final Player player) { + if (player == null) return true; + return ((EcoEnchantsPlugin) this.getPlugin()).getDataYml().isDescriptionEnabled(player); + } + } diff --git a/eco-core/core-plugin/src/main/resources/data.yml b/eco-core/core-plugin/src/main/resources/data.yml new file mode 100644 index 00000000..e69de29b diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml index c3596666..38f4025b 100644 --- a/eco-core/core-plugin/src/main/resources/lang.yml +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -31,6 +31,10 @@ messages: downloaded-locale: "Locale downloaded! Reload config to enact changes." invalid-locale: "&cYou must supply a valid locale! Check the wiki for more information." specify-locale-subcommand: "&cYou must specify whether to export or download a locale!" + descriptions-enabled: + true: "&fYou have successfully &aenabled &fenchantment descriptions!" + false: "&fYou have successfully &cdisabled &fenchantment descriptions!" + descriptions-disabled: "&cEnchantment descriptions are disabled on this server." no-targets: "&cCannot be applied" no-conflicts: "&cNo conflicts" From b19220e1c3a4f0407c99b31975aa78500a98edfc Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Tue, 12 Oct 2021 13:15:09 +0300 Subject: [PATCH 8/8] Removed Diurnal dix for the PR --- .../enchantments/ecoenchants/normal/Diurnal.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java index fcce7324..20af5a40 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java @@ -24,7 +24,9 @@ public class Diurnal extends EcoEnchant { return; } - if (!(attacker.getWorld().getTime() < 12000 && attacker.getWorld().getTime() > 0)) { + long time = attacker.getWorld().getTime(); + + if (time > 12300 && time < 23850) { return; } @@ -32,4 +34,4 @@ public class Diurnal extends EcoEnchant { event.setDamage(event.getDamage() * (1 + (level * multiplier))); } -} +} \ No newline at end of file