From e653bf32e30c8b3ee34ed8b2df92d5115e3dfed9 Mon Sep 17 00:00:00 2001 From: ASangarin Date: Fri, 3 Sep 2021 18:21:51 +0200 Subject: [PATCH 1/5] test --- .../mmocore/skill/list/Fire_Storm.java | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/skill/list/Fire_Storm.java b/src/main/java/net/Indyuce/mmocore/skill/list/Fire_Storm.java index 000c3c76..b69a9918 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/list/Fire_Storm.java +++ b/src/main/java/net/Indyuce/mmocore/skill/list/Fire_Storm.java @@ -1,6 +1,14 @@ package net.Indyuce.mmocore.skill.list; +import io.lumine.mythic.lib.damage.DamageType; +import io.lumine.mythic.lib.version.VersionSound; +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.util.math.formula.LinearValue; +import net.Indyuce.mmocore.api.util.math.particle.ParabolicProjectile; import net.Indyuce.mmocore.skill.CasterMetadata; +import net.Indyuce.mmocore.skill.Skill; +import net.Indyuce.mmocore.skill.metadata.SkillMetadata; +import net.Indyuce.mmocore.skill.metadata.TargetSkillMetadata; import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.Sound; @@ -9,23 +17,13 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.skill.Skill; -import net.Indyuce.mmocore.skill.metadata.SkillMetadata; -import net.Indyuce.mmocore.skill.metadata.TargetSkillMetadata; -import net.Indyuce.mmocore.api.util.math.formula.LinearValue; -import net.Indyuce.mmocore.api.util.math.particle.ParabolicProjectile; -import io.lumine.mythic.lib.MythicLib; -import io.lumine.mythic.lib.api.AttackResult; -import io.lumine.mythic.lib.damage.DamageType;; -import io.lumine.mythic.lib.version.VersionSound; - public class Fire_Storm extends Skill { public Fire_Storm() { super(); setMaterial(Material.BLAZE_POWDER); - setLore("Casts a flurry of 6 fire projectiles onto", "nearby enemies, proritizing the initial", "target. Each projectile deals &c{damage} &7damage", "and ignite the target for &c{ignite} &7seconds.", "", "&e{cooldown}s Cooldown", "&9Costs {mana} {mana_name}"); + setLore("Casts a flurry of 6 fire projectiles onto", "nearby enemies, proritizing the initial", + "target. Each projectile deals &c{damage} &7damage", "and ignite the target for &c{ignite} &7seconds.", "", + "&e{cooldown}s Cooldown", "&9Costs {mana} {mana_name}"); addModifier("mana", new LinearValue(15, 2)); addModifier("damage", new LinearValue(5, 3)); @@ -36,8 +34,7 @@ public class Fire_Storm extends Skill { @Override public SkillMetadata whenCast(CasterMetadata caster, SkillInfo skill) { TargetSkillMetadata cast = new TargetSkillMetadata(caster, skill, 20); - if (!cast.isSuccessful() ) - return cast; + if (!cast.isSuccessful()) return cast; LivingEntity target = cast.getTarget(); @@ -50,7 +47,8 @@ public class Fire_Storm extends Skill { @Override public void run() { - if (j++ > 5 || caster.getPlayer().isDead() || !caster.getPlayer().isOnline() || target.isDead() || !caster.getPlayer().getWorld().equals(target.getWorld())) { + if (j++ > 5 || caster.getPlayer().isDead() || !caster.getPlayer().isOnline() || target.isDead() || !caster.getPlayer().getWorld() + .equals(target.getWorld())) { cancel(); return; } @@ -58,7 +56,8 @@ public class Fire_Storm extends Skill { // TODO dynamic target location caster.getPlayer().getWorld().playSound(caster.getPlayer().getLocation(), Sound.BLOCK_FIRE_AMBIENT, 1, 1); - new ParabolicProjectile(caster.getPlayer().getLocation().add(0, 1, 0), target.getLocation().add(0, target.getHeight() / 2, 0), randomVector(caster.getPlayer()), () -> { + new ParabolicProjectile(caster.getPlayer().getLocation().add(0, 1, 0), target.getLocation().add(0, target.getHeight() / 2, 0), + randomVector(caster.getPlayer()), () -> { target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 1, 2); target.getWorld().spawnParticle(Particle.SMOKE_NORMAL, target.getLocation().add(0, target.getHeight() / 2, 0), 8, 0, 0, 0, .15); caster.attack(target, damage, DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGIC); From d48ac2aaaebe06ae4289a5e63f2dd15f855f3ad2 Mon Sep 17 00:00:00 2001 From: ASangarin Date: Fri, 3 Sep 2021 18:29:26 +0200 Subject: [PATCH 2/5] another test --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1bb18315..f308891d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.Indyuce MMOCore - 1.8.0 + 1.8.1 MMOCore Offer your players a brand new RPG experience!! From 15cb4d7aa2fc59a5a57d22c4638245cca0115b25 Mon Sep 17 00:00:00 2001 From: Joshua Date: Fri, 3 Sep 2021 20:27:20 -0500 Subject: [PATCH 3/5] remove right click profile interact, was rushed. --- .../mmocore/listener/option/PlayerProfileCheck.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java b/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java index 86569824..eaac9db1 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java +++ b/src/main/java/net/Indyuce/mmocore/listener/option/PlayerProfileCheck.java @@ -1,19 +1,14 @@ package net.Indyuce.mmocore.listener.option; -import io.lumine.mythic.lib.MythicLib; -import io.lumine.mythic.lib.comp.target.InteractionType; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.manager.InventoryManager; -import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.inventory.Inventory; public class PlayerProfileCheck implements Listener { @EventHandler public void a(PlayerInteractEntityEvent event) { + /** if (event.getRightClicked().getType() != EntityType.PLAYER || !MythicLib.plugin.getEntities().canTarget(event.getPlayer(), event.getRightClicked(), InteractionType.SUPPORT_ACTION)) return; @@ -24,7 +19,10 @@ public class PlayerProfileCheck implements Listener { * Opening inventories like that to other players does NOT * necessarily works for any other custom inventory. * */ + /** Inventory inv = InventoryManager.PLAYER_STATS.newInventory(PlayerData.get(event.getRightClicked().getUniqueId())).getInventory(); event.getPlayer().openInventory(inv); + **/ } + } From c5b661e3e2201cec8dd8f5a828f9ac83468aec70 Mon Sep 17 00:00:00 2001 From: Dancull47 Date: Wed, 20 Oct 2021 02:08:27 -0400 Subject: [PATCH 4/5] Stats can now be regenerated as FLAT or PERCENTAGE based values. This includes the Health, Mana, Stamina, Stellium stats. By default, the stats are regenerated off the flat value of their respective Regeneration stats. Example, if Health Regeneration is 10, the player will gain 10 HP upon regeneration. For percentage, the stats will be regenerated with the following formula (Stat Regen * Max Stat). So for example, if your Health Regeneration is .5 and your Max Health is 100, you'll gain 50 HP upon regeneration. Refresh your config.yml or add this directly to it if you wish to adjust them from the default true. ```# Should these Stats regenrate with a FLAT value or PERCENTAGE value? # By default, they are set to TRUE, which means they will regenerate # based off the FLAT Regeneration value for the respective stat # Setting a stat to FALSE means that it will regenerate # with the formula (Stat Regen * Max Stat) for example (Mana Regeneration * Max Mana) stat-regen-flat: health: true mana: true stamina: true stellium: true ``` --- .../java/net/Indyuce/mmocore/MMOCore.java | 41 ++++++++++++++++++- src/main/resources/config.yml | 13 +++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/MMOCore.java b/src/main/java/net/Indyuce/mmocore/MMOCore.java index 58ccdf20..6dfbffc3 100644 --- a/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -90,6 +90,11 @@ public class MMOCore extends LuminePlugin { public final MMOLoadManager loadManager = new MMOLoadManager(); + public boolean healthRegenFlat; + public boolean manaRegenFlat; + public boolean staminaRegenFlat; + public boolean stelliumRegenFlat; + public boolean shouldDebugSQL = false; public MMOCore() { @@ -141,6 +146,13 @@ public class MMOCore extends LuminePlugin { if (getConfig().isConfigurationSection("default-playerdata")) dataProvider.getDataManager().loadDefaultData(getConfig().getConfigurationSection("default-playerdata")); + if (getConfig().isConfigurationSection("stat-regen-flat")) { + healthRegenFlat = getConfig().getBoolean("stat-regen-flat.health", true); + manaRegenFlat = getConfig().getBoolean("stat-regen-flat.mana", true); + staminaRegenFlat = getConfig().getBoolean("stat-regen-flat.stamina", true); + stelliumRegenFlat = getConfig().getBoolean("stat-regen-flat.stellium", true); + } + if (Bukkit.getPluginManager().getPlugin("Vault") != null) economy = new VaultEconomy(); if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { @@ -177,8 +189,33 @@ public class MMOCore extends LuminePlugin { for (PlayerData player : PlayerData.getAll()) if (player.isOnline() && !player.getPlayer().isDead()) for (PlayerResource resource : PlayerResource.values()) { - double d = player.getProfess().getHandler(resource).getRegen(player); - if (d != 0) resource.regen(player, d); + double regenAmount = player.getProfess().getHandler(resource).getRegen(player); + switch (resource) { + case HEALTH: + if (healthRegenFlat && regenAmount != 0) + resource.regen(player, regenAmount); + else if (!healthRegenFlat && regenAmount * player.getStats().getStat(StatType.HEALTH_REGENERATION) != 0) + resource.regen(player, player.getStats().getStat(StatType.MAX_HEALTH) * regenAmount); + break; + case MANA: + if (manaRegenFlat && regenAmount != 0) + resource.regen(player, regenAmount); + else if (!manaRegenFlat && regenAmount * player.getStats().getStat(StatType.MANA_REGENERATION) != 0) + resource.regen(player, player.getStats().getStat(StatType.MAX_MANA) * regenAmount); + break; + case STAMINA: + if (staminaRegenFlat && regenAmount != 0) + resource.regen(player, regenAmount); + else if (!staminaRegenFlat && regenAmount * player.getStats().getStat(StatType.STAMINA_REGENERATION) != 0) + resource.regen(player, player.getStats().getStat(StatType.MAX_STAMINA) * regenAmount); + break; + case STELLIUM: + if (stelliumRegenFlat && regenAmount != 0) + resource.regen(player, regenAmount); + else if (!stelliumRegenFlat && regenAmount * player.getStats().getStat(StatType.STELLIUM_REGENERATION) != 0) + resource.regen(player, player.getStats().getStat(StatType.MAX_STELLIUM) * regenAmount); + break; + } } } }.runTaskTimer(MMOCore.plugin, 100, 20); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 44313ada..00a56201 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -8,7 +8,7 @@ # a Spigot Plugin by Team Requiem # DO NOT TOUCH -config-version: 7 +config-version: 8 # Auto-Save feature automatically saves playerdata # (class, level, etc.) and guild data @@ -42,6 +42,17 @@ default-playerdata: attribute-points: 0 attribute-realloc-points: 0 +# Should these Stats regenrate with a FLAT value or PERCENTAGE value? +# By default, they are set to TRUE, which means they will regenerate +# based off the FLAT Regeneration value for the respective stat +# Setting a stat to FALSE means that it will regenerate +# with the formula (Stat Regen * Max Stat) for example (Mana Regeneration * Max Mana) +stat-regen-flat: + health: true + mana: true + stamina: true + stellium: true + # The list of all conditions which must be met for the # BLOCK REGEN and BLOCK RESTRICTIONS to apply. Set to # 'custom-mine-conditions: []' to disable custom mining entirely. From 3014cc0a725bf9649d07c69d47b672e524c16b19 Mon Sep 17 00:00:00 2001 From: Dancull47 Date: Mon, 25 Oct 2021 03:44:08 -0400 Subject: [PATCH 5/5] API Change: Added setter for CustomBlockMineEvent drops If issues arise with MMOCore Block Regen Drops @Monzter :D --- .../net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java | 6 +++++- .../java/net/Indyuce/mmocore/listener/BlockListener.java | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java index f4f02577..93102780 100644 --- a/src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java +++ b/src/main/java/net/Indyuce/mmocore/api/event/CustomBlockMineEvent.java @@ -14,7 +14,7 @@ public class CustomBlockMineEvent extends PlayerDataEvent implements Cancellable private final Block block; private final BlockInfo info; - private final List drops; + private List drops; private boolean cancelled; @@ -39,6 +39,10 @@ public class CustomBlockMineEvent extends PlayerDataEvent implements Cancellable return info; } + public void setDrops(List list) { + this.drops = list; + } + @Override public boolean isCancelled() { return cancelled; diff --git a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java b/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java index aa0c8576..5aeddc78 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/BlockListener.java @@ -102,6 +102,8 @@ public class BlockListener implements Listener { return; } + drops = called.getDrops(); + /* * Remove vanilla drops if needed and * decreases the durability of the item