Merge remote-tracking branch 'origin/master'

This commit is contained in:
Indyuce 2021-10-28 23:01:06 +02:00
commit 1ce89703a7
7 changed files with 79 additions and 28 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.Indyuce</groupId> <groupId>net.Indyuce</groupId>
<artifactId>MMOCore</artifactId> <artifactId>MMOCore</artifactId>
<version>1.8.0</version> <version>1.8.1</version>
<name>MMOCore</name> <name>MMOCore</name>
<description>Offer your players a brand new RPG experience!!</description> <description>Offer your players a brand new RPG experience!!</description>

View File

@ -90,6 +90,11 @@ public class MMOCore extends LuminePlugin {
public final MMOLoadManager loadManager = new MMOLoadManager(); public final MMOLoadManager loadManager = new MMOLoadManager();
public boolean healthRegenFlat;
public boolean manaRegenFlat;
public boolean staminaRegenFlat;
public boolean stelliumRegenFlat;
public boolean shouldDebugSQL = false; public boolean shouldDebugSQL = false;
public MMOCore() { public MMOCore() {
@ -141,6 +146,13 @@ public class MMOCore extends LuminePlugin {
if (getConfig().isConfigurationSection("default-playerdata")) if (getConfig().isConfigurationSection("default-playerdata"))
dataProvider.getDataManager().loadDefaultData(getConfig().getConfigurationSection("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("Vault") != null) economy = new VaultEconomy();
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
@ -177,8 +189,33 @@ public class MMOCore extends LuminePlugin {
for (PlayerData player : PlayerData.getAll()) for (PlayerData player : PlayerData.getAll())
if (player.isOnline() && !player.getPlayer().isDead()) if (player.isOnline() && !player.getPlayer().isDead())
for (PlayerResource resource : PlayerResource.values()) { for (PlayerResource resource : PlayerResource.values()) {
double d = player.getProfess().getHandler(resource).getRegen(player); double regenAmount = player.getProfess().getHandler(resource).getRegen(player);
if (d != 0) resource.regen(player, d); 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); }.runTaskTimer(MMOCore.plugin, 100, 20);

View File

@ -14,7 +14,7 @@ public class CustomBlockMineEvent extends PlayerDataEvent implements Cancellable
private final Block block; private final Block block;
private final BlockInfo info; private final BlockInfo info;
private final List<ItemStack> drops; private List<ItemStack> drops;
private boolean cancelled; private boolean cancelled;
@ -39,6 +39,10 @@ public class CustomBlockMineEvent extends PlayerDataEvent implements Cancellable
return info; return info;
} }
public void setDrops(List<ItemStack> list) {
this.drops = list;
}
@Override @Override
public boolean isCancelled() { public boolean isCancelled() {
return cancelled; return cancelled;

View File

@ -102,6 +102,8 @@ public class BlockListener implements Listener {
return; return;
} }
drops = called.getDrops();
/* /*
* Remove vanilla drops if needed and * Remove vanilla drops if needed and
* decreases the durability of the item * decreases the durability of the item

View File

@ -1,19 +1,14 @@
package net.Indyuce.mmocore.listener.option; 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.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.Inventory;
public class PlayerProfileCheck implements Listener { public class PlayerProfileCheck implements Listener {
@EventHandler @EventHandler
public void a(PlayerInteractEntityEvent event) { public void a(PlayerInteractEntityEvent event) {
/**
if (event.getRightClicked().getType() != EntityType.PLAYER || !MythicLib.plugin.getEntities().canTarget(event.getPlayer(), event.getRightClicked(), InteractionType.SUPPORT_ACTION)) if (event.getRightClicked().getType() != EntityType.PLAYER || !MythicLib.plugin.getEntities().canTarget(event.getPlayer(), event.getRightClicked(), InteractionType.SUPPORT_ACTION))
return; return;
@ -24,7 +19,10 @@ public class PlayerProfileCheck implements Listener {
* Opening inventories like that to other players does NOT * Opening inventories like that to other players does NOT
* necessarily works for any other custom inventory. * necessarily works for any other custom inventory.
* */ * */
/**
Inventory inv = InventoryManager.PLAYER_STATS.newInventory(PlayerData.get(event.getRightClicked().getUniqueId())).getInventory(); Inventory inv = InventoryManager.PLAYER_STATS.newInventory(PlayerData.get(event.getRightClicked().getUniqueId())).getInventory();
event.getPlayer().openInventory(inv); event.getPlayer().openInventory(inv);
**/
} }
} }

View File

@ -1,6 +1,14 @@
package net.Indyuce.mmocore.skill.list; 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.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.Material;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -9,23 +17,13 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector; 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 class Fire_Storm extends Skill {
public Fire_Storm() { public Fire_Storm() {
super(); super();
setMaterial(Material.BLAZE_POWDER); 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("mana", new LinearValue(15, 2));
addModifier("damage", new LinearValue(5, 3)); addModifier("damage", new LinearValue(5, 3));
@ -36,8 +34,7 @@ public class Fire_Storm extends Skill {
@Override @Override
public SkillMetadata whenCast(CasterMetadata caster, SkillInfo skill) { public SkillMetadata whenCast(CasterMetadata caster, SkillInfo skill) {
TargetSkillMetadata cast = new TargetSkillMetadata(caster, skill, 20); TargetSkillMetadata cast = new TargetSkillMetadata(caster, skill, 20);
if (!cast.isSuccessful() ) if (!cast.isSuccessful()) return cast;
return cast;
LivingEntity target = cast.getTarget(); LivingEntity target = cast.getTarget();
@ -50,7 +47,8 @@ public class Fire_Storm extends Skill {
@Override @Override
public void run() { 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(); cancel();
return; return;
} }
@ -58,7 +56,8 @@ public class Fire_Storm extends Skill {
// TODO dynamic target location // TODO dynamic target location
caster.getPlayer().getWorld().playSound(caster.getPlayer().getLocation(), Sound.BLOCK_FIRE_AMBIENT, 1, 1); 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().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); 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); caster.attack(target, damage, DamageType.SKILL, DamageType.PROJECTILE, DamageType.MAGIC);

View File

@ -8,7 +8,7 @@
# a Spigot Plugin by Team Requiem # a Spigot Plugin by Team Requiem
# DO NOT TOUCH # DO NOT TOUCH
config-version: 7 config-version: 8
# Auto-Save feature automatically saves playerdata # Auto-Save feature automatically saves playerdata
# (class, level, etc.) and guild data # (class, level, etc.) and guild data
@ -42,6 +42,17 @@ default-playerdata:
attribute-points: 0 attribute-points: 0
attribute-realloc-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 # The list of all conditions which must be met for the
# BLOCK REGEN and BLOCK RESTRICTIONS to apply. Set to # BLOCK REGEN and BLOCK RESTRICTIONS to apply. Set to
# 'custom-mine-conditions: []' to disable custom mining entirely. # 'custom-mine-conditions: []' to disable custom mining entirely.