forked from Upstream/mmocore
fixed enum names
This commit is contained in:
parent
408703b4f4
commit
00ca007ecc
7
pom.xml
7
pom.xml
@ -170,13 +170,6 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.bekvon.bukkit.residence</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
<version>4.8.7.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>Citizens</artifactId>
|
||||
|
@ -1,10 +1,12 @@
|
||||
package net.Indyuce.mmocore;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.comp.Metrics;
|
||||
import io.lumine.mythic.lib.version.SpigotPlugin;
|
||||
import io.lumine.mythic.utils.plugin.LuminePlugin;
|
||||
import net.Indyuce.mmocore.api.ConfigFile;
|
||||
import net.Indyuce.mmocore.api.PlayerActionBar;
|
||||
import net.Indyuce.mmocore.comp.MMOCoreTargetRestriction;
|
||||
import net.Indyuce.mmocore.loot.chest.LootChest;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||
@ -16,10 +18,6 @@ import net.Indyuce.mmocore.comp.anticheat.AntiCheatSupport;
|
||||
import net.Indyuce.mmocore.comp.anticheat.SpartanPlugin;
|
||||
import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener;
|
||||
import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader;
|
||||
import net.Indyuce.mmocore.comp.flags.DefaultFlags;
|
||||
import net.Indyuce.mmocore.comp.flags.FlagPlugin;
|
||||
import net.Indyuce.mmocore.comp.flags.ResidenceFlags;
|
||||
import net.Indyuce.mmocore.comp.flags.WorldGuardFlags;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.MythicHook;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.MythicMobsMMOLoader;
|
||||
import net.Indyuce.mmocore.comp.placeholder.DefaultParser;
|
||||
@ -67,7 +65,6 @@ public class MMOCore extends LuminePlugin {
|
||||
public VaultEconomy economy;
|
||||
public AntiCheatSupport antiCheatSupport;
|
||||
public RegionHandler regionHandler = new DefaultRegionHandler();
|
||||
public FlagPlugin flagPlugin = new DefaultFlags();
|
||||
public PlaceholderParser placeholderParser = new DefaultParser();
|
||||
public DataProvider dataProvider = new YAMLDataProvider();
|
||||
public final PlayerActionBar actionBarManager = new PlayerActionBar();
|
||||
@ -101,6 +98,9 @@ public class MMOCore extends LuminePlugin {
|
||||
|
||||
public void load() {
|
||||
|
||||
// Register target restrictions due to MMOCore in MythicLib
|
||||
MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction());
|
||||
|
||||
/*
|
||||
* register extra objective, drop items...
|
||||
*/
|
||||
@ -119,7 +119,7 @@ public class MMOCore extends LuminePlugin {
|
||||
* WorldGuard closes the flag registry after 'onLoad()', so it must be
|
||||
* registered here or it will throw an IllegalStateException
|
||||
*/
|
||||
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) flagPlugin = new WorldGuardFlags();
|
||||
// if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) flagPlugin = new WorldGuardFlags();
|
||||
}
|
||||
|
||||
public void enable() {
|
||||
@ -156,9 +156,6 @@ public class MMOCore extends LuminePlugin {
|
||||
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) {
|
||||
regionHandler = new WorldGuardRegionHandler();
|
||||
getLogger().log(Level.INFO, "Hooked onto WorldGuard");
|
||||
} else if (Bukkit.getPluginManager().getPlugin("Residence") != null) {
|
||||
flagPlugin = new ResidenceFlags();
|
||||
getLogger().log(Level.INFO, "Hooked onto Residence");
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("Spartan") != null) {
|
||||
|
@ -1,20 +1,15 @@
|
||||
package net.Indyuce.mmocore.api.player.social;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.ConfigMessage;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.gui.api.PluginInventory;
|
||||
import net.Indyuce.mmocore.gui.social.party.EditablePartyView.PartyViewInventory;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class Party {
|
||||
private final PartyMembers members = new PartyMembers();
|
||||
@ -76,7 +71,8 @@ public class Party {
|
||||
// transfer ownership
|
||||
if (owner.equals(data)) {
|
||||
owner = members.get(0);
|
||||
if(notify && owner.isOnline()) MMOCore.plugin.configManager.getSimpleMessage("transfer-party-ownership").send(owner.getPlayer());
|
||||
if (notify && owner.isOnline())
|
||||
MMOCore.plugin.configManager.getSimpleMessage("transfer-party-ownership").send(owner.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,7 +96,7 @@ public class Party {
|
||||
public void sendPartyInvite(PlayerData inviter, PlayerData target) {
|
||||
invites.put(target.getUniqueId(), System.currentTimeMillis());
|
||||
Request request = new PartyInvite(this, inviter, target);
|
||||
if(inviter.isOnline() && target.isOnline())
|
||||
if (inviter.isOnline() && target.isOnline())
|
||||
new ConfigMessage("party-invite").addPlaceholders("player", inviter.getPlayer().getName(), "uuid", request.getUniqueId().toString())
|
||||
.sendAsJSon(target.getPlayer());
|
||||
MMOCore.plugin.requestManager.registerRequest(request);
|
||||
@ -126,6 +122,13 @@ public class Party {
|
||||
return members.contains(player);
|
||||
}
|
||||
|
||||
public boolean has(Player player) {
|
||||
for (PlayerData member : members)
|
||||
if (member.getUniqueId().equals(player.getUniqueId()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void add(PlayerData player) {
|
||||
members.add(player);
|
||||
|
||||
|
@ -2,6 +2,7 @@ package net.Indyuce.mmocore.api.util;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import io.lumine.mythic.utils.holograms.Hologram;
|
||||
import io.lumine.mythic.utils.serialize.Position;
|
||||
@ -116,8 +117,8 @@ public class MMOCoreUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static final String[] romanChars = { "I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M" };
|
||||
private static final int[] romanQuantities = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000 };
|
||||
private static final String[] romanChars = {"I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"};
|
||||
private static final int[] romanQuantities = {1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000};
|
||||
|
||||
public static String intToRoman(int input) {
|
||||
if (input < 1)
|
||||
@ -141,19 +142,24 @@ public class MMOCoreUtils {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/*
|
||||
* method to get all entities surrounding a location. this method does not
|
||||
/**
|
||||
* Method to get all entities surrounding a location. This method does not
|
||||
* take every entity in the world but rather takes all the entities from the
|
||||
* 9 chunks around the entity, so even if the location is at the border of a
|
||||
* chunk (worst case border of 4 chunks), the entity will still be included
|
||||
*/
|
||||
public static List<Entity> getNearbyChunkEntities(Location loc) {
|
||||
|
||||
/*
|
||||
* another method to save performance is if an entity bounding box
|
||||
* calculation is made twice in the same tick then the method does not
|
||||
* Another method to save performance is: if an entity bounding box
|
||||
* calculation is made twice in the same tick, then the method does not
|
||||
* need to be called twice, it can utilize the same entity list since
|
||||
* the entities have not moved (e.g fireball which does 2+ calculations
|
||||
* per tick)
|
||||
*
|
||||
* Of course we're assuming that the projectile does move at a speed
|
||||
* lower than 1 chunk per second which is most likely true, otherwise
|
||||
* just use ray casting.
|
||||
*/
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
|
||||
@ -173,32 +179,18 @@ public class MMOCoreUtils {
|
||||
* @return If the player can attack the entity
|
||||
*/
|
||||
public static boolean canTarget(PlayerData player, Entity target) {
|
||||
return canTarget(player, target, false);
|
||||
return canTarget(player, target, InteractionType.OFFENSE_SKILL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player Player casting a spell/basic attack
|
||||
* @param target The target entity
|
||||
* @param buff Used when the attack is not an attack but a positive buff.
|
||||
* Buffs or heals can be applied on party members, whereas
|
||||
* attacks can't target party members.
|
||||
* @return If the player can target the entity given the attack type
|
||||
* (buff or attack)
|
||||
* @param interaction Whether the action is an attack or a buff, this does
|
||||
* impact the outcome of the friendly fire check
|
||||
* @return If the player can target the entity given the attack type (buff or attack)
|
||||
*/
|
||||
// TODO worldguard flags support for no target
|
||||
public static boolean canTarget(PlayerData player, Entity target, boolean buff) {
|
||||
|
||||
// Basic checks
|
||||
if (!player.isOnline() || !(target instanceof LivingEntity) || player.getPlayer().equals(target) || target.isDead() || MythicLib.plugin.getEntities().findCustom(target))
|
||||
return false;
|
||||
|
||||
// Party check
|
||||
if (!buff && target instanceof Player) {
|
||||
PlayerData targetData = PlayerData.get((Player) target);
|
||||
return !targetData.hasParty() || !targetData.getParty().getMembers().has(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
public static boolean canTarget(PlayerData player, Entity target, InteractionType interaction) {
|
||||
return target instanceof LivingEntity && MythicLib.plugin.getEntities().canTarget(player.getPlayer(), (LivingEntity) target, interaction);
|
||||
}
|
||||
|
||||
public static void heal(LivingEntity target, double value) {
|
||||
@ -225,7 +217,7 @@ public class MMOCoreUtils {
|
||||
ItemStack item = player.getInventory().getItem(slot);
|
||||
NBTItem nbt = NBTItem.get(item);
|
||||
|
||||
if(!nbt.hasTag("MMOITEMS_MAX_DURABILITY")){
|
||||
if (!nbt.hasTag("MMOITEMS_MAX_DURABILITY")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,24 @@
|
||||
package net.Indyuce.mmocore.comp;
|
||||
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.comp.target.TargetRestriction;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MMOCoreTargetRestriction implements TargetRestriction {
|
||||
|
||||
@Override
|
||||
public boolean canTarget(Player player, LivingEntity target, InteractionType interaction) {
|
||||
|
||||
if (interaction.isOffense() && target instanceof Player) {
|
||||
PlayerData targetData = PlayerData.get(target.getUniqueId());
|
||||
|
||||
// Check for the same party
|
||||
if (targetData.hasParty() && targetData.getParty().getMembers().has(player))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package net.Indyuce.mmocore.comp.flags;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DefaultFlags implements FlagPlugin {
|
||||
// @Override
|
||||
// public boolean isPvpAllowed(Location loc) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isFlagAllowed(Player player, CustomFlag flag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlagAllowed(Location loc, CustomFlag flag) {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package net.Indyuce.mmocore.comp.flags;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface FlagPlugin {
|
||||
// public boolean isPvpAllowed(Location loc);
|
||||
|
||||
boolean isFlagAllowed(Player player, CustomFlag flag);
|
||||
|
||||
boolean isFlagAllowed(Location loc, CustomFlag flag);
|
||||
|
||||
enum CustomFlag {
|
||||
SKILLS;
|
||||
|
||||
public String getPath() {
|
||||
return "mmocore-" + name().toLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package net.Indyuce.mmocore.comp.flags;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bekvon.bukkit.residence.Residence;
|
||||
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
||||
import com.bekvon.bukkit.residence.protection.FlagPermissions;
|
||||
|
||||
public class ResidenceFlags implements FlagPlugin {
|
||||
public ResidenceFlags() {
|
||||
for (CustomFlag flag : CustomFlag.values())
|
||||
FlagPermissions.addFlag(flag.getPath());
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean isPvpAllowed(Location loc) {
|
||||
// ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(loc);
|
||||
// return res == null || res.getPermissions().has(Flags.pvp, true);
|
||||
// }
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean isFlagAllowed(Player player, CustomFlag flag) {
|
||||
ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(player);
|
||||
return res == null || res.getPermissions().playerHas(player, flag.getPath(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlagAllowed(Location loc, CustomFlag flag) {
|
||||
ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(loc);
|
||||
return res == null || res.getPermissions().has(flag.getPath(), true, true);
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package net.Indyuce.mmocore.comp.flags;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
|
||||
public class WorldGuardFlags implements FlagPlugin {
|
||||
private final WorldGuard worldguard;
|
||||
private final WorldGuardPlugin worldguardPlugin;
|
||||
private final Map<String, StateFlag> flags = new HashMap<>();
|
||||
|
||||
public WorldGuardFlags() {
|
||||
this.worldguard = WorldGuard.getInstance();
|
||||
this.worldguardPlugin = ((WorldGuardPlugin) Bukkit.getServer().getPluginManager()
|
||||
.getPlugin("WorldGuard"));
|
||||
|
||||
FlagRegistry registry = worldguard.getFlagRegistry();
|
||||
for (CustomFlag customFlag : CustomFlag.values()) {
|
||||
StateFlag flag = new StateFlag(customFlag.getPath(), true);
|
||||
try {
|
||||
registry.register(flag);
|
||||
flags.put(customFlag.getPath(), flag);
|
||||
MMOCore.debug(1, "[FLAGDEBUG] Registered WG Flag\n"
|
||||
+ " - Info{name=" + flag.getName() + ",path=" + customFlag.getPath() + "}");
|
||||
} catch (Exception exception) {
|
||||
MMOCore.debug(1, Level.SEVERE, "[FLAGDEBUG] FAILED to register WG Flag\n"
|
||||
+ " - Info{name=" + flag.getName() + ",path=" + customFlag.getPath() + "}");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean isPvpAllowed(Location loc) {
|
||||
// return getApplicableRegion(loc).queryState(null, Flags.PVP) != StateFlag.State.DENY;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isFlagAllowed(Location loc, CustomFlag customFlag) {
|
||||
return getApplicableRegion(loc).queryValue(null, flags.get(customFlag.getPath())) != StateFlag.State.DENY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlagAllowed(Player player, CustomFlag customFlag) {
|
||||
return getApplicableRegion(player.getLocation()).queryValue(worldguardPlugin.wrapPlayer(player),
|
||||
flags.get(customFlag.getPath())) != StateFlag.State.DENY;
|
||||
}
|
||||
|
||||
private ApplicableRegionSet getApplicableRegion(Location loc) {
|
||||
return worldguard.getPlatform().getRegionContainer().createQuery()
|
||||
.getApplicableRegions(BukkitAdapter.adapt(loc));
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.comp.mythicmobs.skill.handlers;
|
||||
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.skill.MythicSkill;
|
||||
@ -20,7 +21,7 @@ public class PlayerDamageByEntitySkillHandler extends PassiveMythicSkillHandler
|
||||
|
||||
@EventHandler
|
||||
private void a(EntityDamageByEntityEvent event) {
|
||||
if (event.getEntity().getType() == EntityType.PLAYER && MMOCoreUtils.canTarget(PlayerData.get(event.getEntity().getUniqueId()), event.getDamager()))
|
||||
if (event.getEntity().getType() == EntityType.PLAYER && MMOCoreUtils.canTarget(PlayerData.get(event.getEntity().getUniqueId()), event.getDamager(), InteractionType.OFFENSE_SKILL))
|
||||
castSkill(PlayerData.get((Player) event.getEntity()), event.getDamager());
|
||||
}
|
||||
}
|
||||
|
@ -43,9 +43,12 @@ public class PartyListener implements Listener {
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* cancel damage of players from the same party
|
||||
/**
|
||||
* Cancel damage of players from the same party
|
||||
*
|
||||
* @deprecated This should be useful with the {@link io.lumine.mythic.lib.comp.target.TargetRestriction} update
|
||||
*/
|
||||
@Deprecated
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void b(PlayerAttackEvent event) {
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
@ -1,6 +1,7 @@
|
||||
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;
|
||||
@ -13,7 +14,7 @@ public class PlayerProfileCheck implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void a(PlayerInteractEntityEvent event) {
|
||||
if (event.getRightClicked().getType() != EntityType.PLAYER || MythicLib.plugin.getEntities().findCustom(event.getRightClicked()))
|
||||
if (event.getRightClicked().getType() != EntityType.PLAYER || !MythicLib.plugin.getEntities().canTarget(event.getPlayer(), event.getRightClicked(), InteractionType.SUPPORT_ACTION))
|
||||
return;
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.skill.list;
|
||||
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.Indyuce.mmocore.api.util.math.particle.SmallParticleEffect;
|
||||
import net.Indyuce.mmocore.skill.CasterMetadata;
|
||||
@ -25,7 +26,7 @@ public class Greater_Healings extends Skill {
|
||||
|
||||
@Override
|
||||
public SkillMetadata whenCast(CasterMetadata caster, SkillInfo skill) {
|
||||
SkillMetadata cast = caster.getPlayer().isSneaking() ? new SkillMetadata(caster, skill) : new TargetSkillMetadata(caster, skill, 50, true);
|
||||
SkillMetadata cast = caster.getPlayer().isSneaking() ? new SkillMetadata(caster, skill) : new TargetSkillMetadata(caster, skill, 50, InteractionType.SUPPORT_SKILL);
|
||||
if (!cast.isSuccessful())
|
||||
return cast;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.skill.list;
|
||||
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
@ -35,7 +36,7 @@ public class Human_Shield extends Skill {
|
||||
|
||||
@Override
|
||||
public SkillMetadata whenCast(CasterMetadata caster, SkillInfo skill) {
|
||||
TargetSkillMetadata cast = new TargetSkillMetadata(caster, skill, 7, true);
|
||||
TargetSkillMetadata cast = new TargetSkillMetadata(caster, skill, 7, InteractionType.SUPPORT_SKILL);
|
||||
if (!cast.isSuccessful())
|
||||
return cast;
|
||||
|
||||
|
@ -20,8 +20,6 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
;
|
||||
|
||||
public class Ice_Spikes extends Skill {
|
||||
private static final double radius = 3;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.skill.list;
|
||||
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.Indyuce.mmocore.api.util.math.particle.SmallParticleEffect;
|
||||
import net.Indyuce.mmocore.skill.CasterMetadata;
|
||||
@ -25,7 +26,7 @@ public class Minor_Healings extends Skill {
|
||||
|
||||
@Override
|
||||
public SkillMetadata whenCast(CasterMetadata caster, SkillInfo skill) {
|
||||
SkillMetadata cast = caster.getPlayer().isSneaking() ? new SkillMetadata(caster, skill) : new TargetSkillMetadata(caster, skill, 50, true);
|
||||
SkillMetadata cast = caster.getPlayer().isSneaking() ? new SkillMetadata(caster, skill) : new TargetSkillMetadata(caster, skill, 50, InteractionType.SUPPORT_SKILL);
|
||||
if (!cast.isSuccessful())
|
||||
return cast;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.skill.metadata;
|
||||
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.skill.CasterMetadata;
|
||||
import net.Indyuce.mmocore.skill.Skill.SkillInfo;
|
||||
@ -16,23 +17,24 @@ public class LocationSkillMetadata extends SkillMetadata {
|
||||
* @param range Skill raycast range
|
||||
*/
|
||||
public LocationSkillMetadata(CasterMetadata caster, SkillInfo skill, double range) {
|
||||
this(caster, skill, range, false);
|
||||
this(caster, skill, range, InteractionType.OFFENSE_SKILL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param caster Player casting the skill
|
||||
* @param skill Skill being cast
|
||||
* @param range Skill raycast range
|
||||
* @param buff If the skill is a buff ie if it can be cast on party members
|
||||
* @param interaction If the skill is a friendly or offense skill. This determines if it
|
||||
* can be cast on party members or not.
|
||||
*/
|
||||
public LocationSkillMetadata(CasterMetadata caster, SkillInfo skill, double range, boolean buff) {
|
||||
public LocationSkillMetadata(CasterMetadata caster, SkillInfo skill, double range, InteractionType interaction) {
|
||||
super(caster, skill);
|
||||
|
||||
if (isSuccessful()) {
|
||||
|
||||
RayTraceResult result = caster.getPlayer().getWorld().rayTrace(caster.getPlayer().getEyeLocation(),
|
||||
caster.getPlayer().getEyeLocation().getDirection(), range, FluidCollisionMode.ALWAYS, true, 1.0D,
|
||||
entity -> MMOCoreUtils.canTarget(caster.getPlayerData(), entity, buff));
|
||||
entity -> MMOCoreUtils.canTarget(caster.getPlayerData(), entity, interaction));
|
||||
if (result == null)
|
||||
abort(CancelReason.OTHER);
|
||||
else
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.Indyuce.mmocore.skill.metadata;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.comp.flags.CustomFlag;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.comp.flags.FlagPlugin.CustomFlag;
|
||||
import net.Indyuce.mmocore.skill.CasterMetadata;
|
||||
import net.Indyuce.mmocore.skill.Skill;
|
||||
import net.Indyuce.mmocore.skill.Skill.SkillInfo;
|
||||
@ -30,7 +30,7 @@ public class SkillMetadata {
|
||||
: mana > data.getMana() ? CancelReason.MANA
|
||||
: stamina > data.getStamina() ? CancelReason.STAMINA
|
||||
: !data.isOnline() ? CancelReason.OTHER
|
||||
: !MMOCore.plugin.flagPlugin.isFlagAllowed(data.getPlayer(), CustomFlag.SKILLS) ? CancelReason.FLAG
|
||||
: !MythicLib.plugin.getFlags().isFlagAllowed(data.getPlayer(), CustomFlag.MMO_ABILITIES) ? CancelReason.FLAG
|
||||
: null;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package net.Indyuce.mmocore.skill.metadata;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.MMORayTraceResult;
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.skill.CasterMetadata;
|
||||
import net.Indyuce.mmocore.skill.Skill.SkillInfo;
|
||||
@ -16,20 +17,21 @@ public class TargetSkillMetadata extends SkillMetadata {
|
||||
* @param range Skill raycast range
|
||||
*/
|
||||
public TargetSkillMetadata(CasterMetadata caster, SkillInfo skill, double range) {
|
||||
this(caster, skill, range, false);
|
||||
this(caster, skill, range, InteractionType.OFFENSE_SKILL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param caster Player casting the skill
|
||||
* @param skill Skill being cast
|
||||
* @param range Skill raycast range
|
||||
* @param buff If the skill is a buff ie if it can be cast on party members
|
||||
* @param interaction If the skill is a friendly or offense skill. This determines if it
|
||||
* can be cast on party members or not.
|
||||
*/
|
||||
public TargetSkillMetadata(CasterMetadata caster, SkillInfo skill, double range, boolean buff) {
|
||||
public TargetSkillMetadata(CasterMetadata caster, SkillInfo skill, double range, InteractionType interaction) {
|
||||
super(caster, skill);
|
||||
|
||||
if (isSuccessful()) {
|
||||
MMORayTraceResult result = MythicLib.plugin.getVersion().getWrapper().rayTrace(caster.getPlayer(), range, entity -> MMOCoreUtils.canTarget(caster.getPlayerData(), entity, buff));
|
||||
MMORayTraceResult result = MythicLib.plugin.getVersion().getWrapper().rayTrace(caster.getPlayer(), range, entity -> MMOCoreUtils.canTarget(caster.getPlayerData(), entity, interaction));
|
||||
if (!result.hasHit())
|
||||
abort();
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user