mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
!anti-cheat support
This commit is contained in:
parent
239d70117d
commit
0bf926eba3
BIN
lib/SpartanAPI.jar
Normal file
BIN
lib/SpartanAPI.jar
Normal file
Binary file not shown.
7
pom.xml
7
pom.xml
@ -201,5 +201,12 @@
|
|||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/lib/PlaceholderAPI.jar</systemPath>
|
<systemPath>${basedir}/lib/PlaceholderAPI.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.vagdedes</groupId>
|
||||||
|
<artifactId>spartan</artifactId>
|
||||||
|
<version>Univsersal</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${basedir}/lib/SpartanAPI.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -32,6 +32,8 @@ import net.Indyuce.mmocore.command.QuestsCommand;
|
|||||||
import net.Indyuce.mmocore.command.SkillsCommand;
|
import net.Indyuce.mmocore.command.SkillsCommand;
|
||||||
import net.Indyuce.mmocore.command.WaypointsCommand;
|
import net.Indyuce.mmocore.command.WaypointsCommand;
|
||||||
import net.Indyuce.mmocore.command.WithdrawCommand;
|
import net.Indyuce.mmocore.command.WithdrawCommand;
|
||||||
|
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.CitizenInteractEventListener;
|
||||||
import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader;
|
import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader;
|
||||||
import net.Indyuce.mmocore.comp.flags.DefaultFlags;
|
import net.Indyuce.mmocore.comp.flags.DefaultFlags;
|
||||||
@ -98,7 +100,7 @@ import net.mmogroup.mmolib.version.SpigotPlugin;
|
|||||||
|
|
||||||
public class MMOCore extends JavaPlugin {
|
public class MMOCore extends JavaPlugin {
|
||||||
public static MMOCore plugin;
|
public static MMOCore plugin;
|
||||||
|
|
||||||
public ConfigManager configManager;
|
public ConfigManager configManager;
|
||||||
public WaypointManager waypointManager;
|
public WaypointManager waypointManager;
|
||||||
public RestrictionManager restrictionManager;
|
public RestrictionManager restrictionManager;
|
||||||
@ -106,6 +108,7 @@ public class MMOCore extends JavaPlugin {
|
|||||||
public ConfigItemManager configItems;
|
public ConfigItemManager configItems;
|
||||||
public VaultEconomy economy;
|
public VaultEconomy economy;
|
||||||
public HologramSupport hologramSupport;
|
public HologramSupport hologramSupport;
|
||||||
|
public AntiCheatSupport antiCheatSupport;
|
||||||
public InventoryManager inventoryManager;
|
public InventoryManager inventoryManager;
|
||||||
public RegionHandler regionHandler = new DefaultRegionHandler();
|
public RegionHandler regionHandler = new DefaultRegionHandler();
|
||||||
public FlagPlugin flagPlugin = new DefaultFlags();
|
public FlagPlugin flagPlugin = new DefaultFlags();
|
||||||
@ -151,12 +154,12 @@ public class MMOCore extends JavaPlugin {
|
|||||||
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null)
|
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null)
|
||||||
loadManager.registerLoader(new MythicMobsMMOLoader());
|
loadManager.registerLoader(new MythicMobsMMOLoader());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WorldGuard closes the flag registry after 'onLoad()',
|
* WorldGuard closes the flag registry after 'onLoad()', so it must be
|
||||||
* so it must be registered here or it will throw an IllegalStateException
|
* registered here or it will throw an IllegalStateException
|
||||||
*/
|
*/
|
||||||
if(Bukkit.getPluginManager().getPlugin("WorldGuard") != null)
|
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null)
|
||||||
flagPlugin = new WorldGuardFlags();
|
flagPlugin = new WorldGuardFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,11 +167,11 @@ public class MMOCore extends JavaPlugin {
|
|||||||
new SpigotPlugin(70575, this).checkForUpdate();
|
new SpigotPlugin(70575, this).checkForUpdate();
|
||||||
new Metrics(this);
|
new Metrics(this);
|
||||||
saveDefaultConfig();
|
saveDefaultConfig();
|
||||||
|
|
||||||
if (getConfig().isConfigurationSection("mysql") && getConfig().getBoolean("mysql.enabled"))
|
if (getConfig().isConfigurationSection("mysql") && getConfig().getBoolean("mysql.enabled"))
|
||||||
dataProvider = new MySQLDataProvider(getConfig());
|
dataProvider = new MySQLDataProvider(getConfig());
|
||||||
|
|
||||||
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 (Bukkit.getPluginManager().getPlugin("Vault") != null)
|
if (Bukkit.getPluginManager().getPlugin("Vault") != null)
|
||||||
@ -203,14 +206,19 @@ public class MMOCore extends JavaPlugin {
|
|||||||
getLogger().log(Level.INFO, "Hooked onto Holograms");
|
getLogger().log(Level.INFO, "Hooked onto Holograms");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("Spartan") != null) {
|
||||||
|
antiCheatSupport = new SpartanPlugin();
|
||||||
|
getLogger().log(Level.INFO, "Hooked onto Spartan");
|
||||||
|
}
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) {
|
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) {
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new MythicMobsDrops(), this);
|
Bukkit.getServer().getPluginManager().registerEvents(new MythicMobsDrops(), this);
|
||||||
MMOCore.plugin.getLogger().log(Level.INFO, "Hooked onto MythicMobs");
|
MMOCore.plugin.getLogger().log(Level.INFO, "Hooked onto MythicMobs");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* resource regeneration. must check if entity is dead otherwise regen
|
* resource regeneration. must check if entity is dead otherwise regen will make
|
||||||
* will make the 'respawn' button glitched plus HURT entity effect bug
|
* the 'respawn' button glitched plus HURT entity effect bug
|
||||||
*/
|
*/
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -225,9 +233,8 @@ public class MMOCore extends JavaPlugin {
|
|||||||
}.runTaskTimer(MMOCore.plugin, 100, 20);
|
}.runTaskTimer(MMOCore.plugin, 100, 20);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* clean active loot chests every 5 minutes. cannot register this
|
* clean active loot chests every 5 minutes. cannot register this runnable in
|
||||||
* runnable in the loot chest manager because it is instanced when the
|
* the loot chest manager because it is instanced when the plugin loads
|
||||||
* plugin loads
|
|
||||||
*/
|
*/
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -238,14 +245,16 @@ public class MMOCore extends JavaPlugin {
|
|||||||
}.runTaskTimer(this, 5 * 60 * 20, 5 * 60 * 20);
|
}.runTaskTimer(this, 5 * 60 * 20, 5 * 60 * 20);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For the sake of the lord, make sure they aren't using MMOItems Mana
|
* For the sake of the lord, make sure they aren't using MMOItems Mana and
|
||||||
* and Stamina Addon...This should prevent a couple error reports
|
* Stamina Addon...This should prevent a couple error reports produced by people
|
||||||
* produced by people not reading the installation guide...
|
* not reading the installation guide...
|
||||||
*/
|
*/
|
||||||
if (Bukkit.getPluginManager().getPlugin("MMOItemsMana") != null) {
|
if (Bukkit.getPluginManager().getPlugin("MMOItemsMana") != null) {
|
||||||
getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "MMOCore is not meant to be used with MMOItems ManaAndStamina");
|
getLogger().log(Level.SEVERE,
|
||||||
|
ChatColor.DARK_RED + "MMOCore is not meant to be used with MMOItems ManaAndStamina");
|
||||||
getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "Please read the installation guide!");
|
getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "Please read the installation guide!");
|
||||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with MMOItems ManaAndStamina");
|
Bukkit.broadcastMessage(
|
||||||
|
ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with MMOItems ManaAndStamina");
|
||||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!");
|
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -253,7 +262,8 @@ public class MMOCore extends JavaPlugin {
|
|||||||
reloadPlugin();
|
reloadPlugin();
|
||||||
|
|
||||||
if (getConfig().getBoolean("vanilla-exp-redirection.enabled"))
|
if (getConfig().getBoolean("vanilla-exp-redirection.enabled"))
|
||||||
Bukkit.getPluginManager().registerEvents(new RedirectVanillaExp(getConfig().getDouble("vanilla-exp-redirection.ratio")), this);
|
Bukkit.getPluginManager().registerEvents(
|
||||||
|
new RedirectVanillaExp(getConfig().getDouble("vanilla-exp-redirection.ratio")), this);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* enable debug mode for extra debug tools.
|
* enable debug mode for extra debug tools.
|
||||||
@ -285,10 +295,9 @@ public class MMOCore extends JavaPlugin {
|
|||||||
Bukkit.getPluginManager().registerEvents(new PlayerCollectStats(), this);
|
Bukkit.getPluginManager().registerEvents(new PlayerCollectStats(), this);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize player data from all online players. this is very
|
* initialize player data from all online players. this is very important to do
|
||||||
* important to do that after registering all the professses otherwise
|
* that after registering all the professses otherwise the player datas can't
|
||||||
* the player datas can't recognize what profess the player has and
|
* recognize what profess the player has and professes will be lost
|
||||||
* professes will be lost
|
|
||||||
*/
|
*/
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> dataProvider.getDataManager().setup(player));
|
Bukkit.getOnlinePlayers().forEach(player -> dataProvider.getDataManager().setup(player));
|
||||||
|
|
||||||
@ -364,7 +373,7 @@ public class MMOCore extends JavaPlugin {
|
|||||||
for (Guild guild : dataProvider.getGuildManager().getAll())
|
for (Guild guild : dataProvider.getGuildManager().getAll())
|
||||||
dataProvider.getGuildManager().save(guild);
|
dataProvider.getGuildManager().save(guild);
|
||||||
dataProvider.close();
|
dataProvider.close();
|
||||||
|
|
||||||
mineManager.resetRemainingBlocks();
|
mineManager.resetRemainingBlocks();
|
||||||
|
|
||||||
lootChests.getActive().forEach(chest -> chest.unregister(false));
|
lootChests.getActive().forEach(chest -> chest.unregister(false));
|
||||||
@ -372,7 +381,7 @@ public class MMOCore extends JavaPlugin {
|
|||||||
|
|
||||||
public void reloadPlugin() {
|
public void reloadPlugin() {
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
|
|
||||||
configManager = new ConfigManager();
|
configManager = new ConfigManager();
|
||||||
|
|
||||||
skillManager.reload();
|
skillManager.reload();
|
||||||
@ -392,7 +401,7 @@ public class MMOCore extends JavaPlugin {
|
|||||||
|
|
||||||
// experience must be loaded before professions and classes
|
// experience must be loaded before professions and classes
|
||||||
experience.reload();
|
experience.reload();
|
||||||
|
|
||||||
// drop tables must be loaded before professions
|
// drop tables must be loaded before professions
|
||||||
dropTableManager.clear();
|
dropTableManager.clear();
|
||||||
dropTableManager.reload();
|
dropTableManager.reload();
|
||||||
@ -415,7 +424,7 @@ public class MMOCore extends JavaPlugin {
|
|||||||
requestManager = new RequestManager();
|
requestManager = new RequestManager();
|
||||||
configItems = new ConfigItemManager(new ConfigFile("items").getConfig());
|
configItems = new ConfigItemManager(new ConfigFile("items").getConfig());
|
||||||
|
|
||||||
if(getConfig().isConfigurationSection("action-bar"))
|
if (getConfig().isConfigurationSection("action-bar"))
|
||||||
actionBarManager.reload(getConfig().getConfigurationSection("action-bar"));
|
actionBarManager.reload(getConfig().getConfigurationSection("action-bar"));
|
||||||
|
|
||||||
StatType.load();
|
StatType.load();
|
||||||
@ -434,7 +443,7 @@ public class MMOCore extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void debug(int value, Level level, String message) {
|
public static void debug(int value, Level level, String message) {
|
||||||
if(DebugMode.level > (value - 1))
|
if (DebugMode.level > (value - 1))
|
||||||
plugin.getLogger().log(level, message);
|
plugin.getLogger().log(level, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,6 +451,10 @@ public class MMOCore extends JavaPlugin {
|
|||||||
return getFile();
|
return getFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasAntiCheat() {
|
||||||
|
return antiCheatSupport != null;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasHolograms() {
|
public boolean hasHolograms() {
|
||||||
return hologramSupport != null;
|
return hologramSupport != null;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ public class PlayerProfessions {
|
|||||||
|
|
||||||
// display hologram
|
// display hologram
|
||||||
if (MMOCore.plugin.getConfig().getBoolean("display-exp-holograms") && playerData.isOnline())
|
if (MMOCore.plugin.getConfig().getBoolean("display-exp-holograms") && playerData.isOnline())
|
||||||
if (loc != null && MMOCore.plugin.hologramSupport != null)
|
if (loc != null && MMOCore.plugin.hasHolograms())
|
||||||
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5),
|
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5),
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer());
|
MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer());
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ public class PlayerData extends OfflinePlayerData {
|
|||||||
|
|
||||||
// display hologram
|
// display hologram
|
||||||
if (MMOCore.plugin.getConfig().getBoolean("display-exp-holograms") && isOnline())
|
if (MMOCore.plugin.getConfig().getBoolean("display-exp-holograms") && isOnline())
|
||||||
if (loc != null && MMOCore.plugin.hologramSupport != null)
|
if (loc != null && MMOCore.plugin.hasHolograms())
|
||||||
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5),
|
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5),
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), getPlayer());
|
MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), getPlayer());
|
||||||
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package net.Indyuce.mmocore.comp.anticheat;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public abstract class AntiCheatSupport {
|
||||||
|
public abstract void disableAntiCheat(Player player, Map<CheatType, Integer> map);
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package net.Indyuce.mmocore.comp.anticheat;
|
||||||
|
|
||||||
|
public enum CheatType {
|
||||||
|
GENERAL_EXPLOITS("Exploits"),
|
||||||
|
NO_SWING("NoSwing"),
|
||||||
|
MOVEMENT("IrregularMovements"),
|
||||||
|
CLIPPING("Clip"),
|
||||||
|
IMPOSSIBLE_ACTION("ImpossibleActions"),
|
||||||
|
INVENTORY_CLEAR("ItemDrops"),
|
||||||
|
INVENTORY_CLICKS("InventoryClicks"),
|
||||||
|
AUTO_SPRINT("Sprint"),
|
||||||
|
JESUS("Jesus"),
|
||||||
|
NO_SLOWDOWN("NoSlowdown"),
|
||||||
|
CRITICAL_HITS("Criticals"),
|
||||||
|
NUKER("Nuker"),
|
||||||
|
GHOST_HAND("GhostHand"),
|
||||||
|
LIQUIDS("Liquids"),
|
||||||
|
BLOCK_REACH("BlockReach"),
|
||||||
|
ELYTRA("ElytraMove"),
|
||||||
|
BOAT("BoatMove"),
|
||||||
|
FAST_BOW("FastBow"),
|
||||||
|
FAST_CLICK("FastClicks"),
|
||||||
|
FAST_HEAL("FastHeal"),
|
||||||
|
FLYING("Fly"),
|
||||||
|
HIT_REACH("HitReach"),
|
||||||
|
FAST_BREAK("FastBreak"),
|
||||||
|
FAST_PLACE("FastPlace"),
|
||||||
|
SPEED("Speed"),
|
||||||
|
NO_FALL("NoFall"),
|
||||||
|
ILLEGAL_POS("IllegalPosition"),
|
||||||
|
FAST_EAT("FastEat"),
|
||||||
|
VELOCITY("Velocity"),
|
||||||
|
KILLAURA("KillAura");
|
||||||
|
|
||||||
|
private final String spartan;
|
||||||
|
|
||||||
|
CheatType(String spartan) {
|
||||||
|
this.spartan = spartan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toSpartan() {
|
||||||
|
return spartan;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package net.Indyuce.mmocore.comp.anticheat;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import me.vagdedes.spartan.api.API;
|
||||||
|
import me.vagdedes.spartan.system.Enums.HackType;
|
||||||
|
|
||||||
|
public class SpartanPlugin extends AntiCheatSupport {
|
||||||
|
@Override
|
||||||
|
public void disableAntiCheat(Player player, Map<CheatType, Integer> map) {
|
||||||
|
for(Entry<CheatType, Integer> entry : map.entrySet())
|
||||||
|
API.cancelCheck(player, fromCheatType(entry.getKey()), entry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
private HackType fromCheatType(CheatType ct) {
|
||||||
|
return HackType.valueOf(ct.toSpartan());
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +1,21 @@
|
|||||||
package net.Indyuce.mmocore.comp.mythicmobs;
|
package net.Indyuce.mmocore.comp.mythicmobs;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
import com.google.common.base.Enums;
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
|
||||||
import io.lumine.xikage.mythicmobs.MythicMobs;
|
import io.lumine.xikage.mythicmobs.MythicMobs;
|
||||||
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.skill.Skill;
|
import net.Indyuce.mmocore.api.skill.Skill;
|
||||||
import net.Indyuce.mmocore.api.skill.SkillResult;
|
import net.Indyuce.mmocore.api.skill.SkillResult;
|
||||||
@ -17,9 +23,11 @@ import net.Indyuce.mmocore.api.skill.SkillResult.CancelReason;
|
|||||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||||
import net.Indyuce.mmocore.api.util.math.formula.IntegerLinearValue;
|
import net.Indyuce.mmocore.api.util.math.formula.IntegerLinearValue;
|
||||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||||
|
import net.Indyuce.mmocore.comp.anticheat.CheatType;
|
||||||
|
|
||||||
public class MythicMobSkill extends Skill {
|
public class MythicMobSkill extends Skill {
|
||||||
private final io.lumine.xikage.mythicmobs.skills.Skill skill;
|
private final io.lumine.xikage.mythicmobs.skills.Skill skill;
|
||||||
|
private final Map<CheatType, Integer> antiCheat = new HashMap<>();
|
||||||
|
|
||||||
// private final BiFunction<PlayerDataManager, SkillInfo, SkillResult> cast;
|
// private final BiFunction<PlayerDataManager, SkillInfo, SkillResult> cast;
|
||||||
|
|
||||||
@ -29,7 +37,7 @@ public class MythicMobSkill extends Skill {
|
|||||||
String mmId = config.getString("mythicmobs-skill-id");
|
String mmId = config.getString("mythicmobs-skill-id");
|
||||||
Validate.notNull(mmId, "Could not find MM skill ID");
|
Validate.notNull(mmId, "Could not find MM skill ID");
|
||||||
|
|
||||||
Optional<io.lumine.xikage.mythicmobs.skills.Skill> opt = MythicMobs.inst().getSkillManager().getSkill(mmId);
|
java.util.Optional<io.lumine.xikage.mythicmobs.skills.Skill> opt = MythicMobs.inst().getSkillManager().getSkill(mmId);
|
||||||
Validate.isTrue(opt.isPresent(), "Could not find MM skill " + mmId);
|
Validate.isTrue(opt.isPresent(), "Could not find MM skill " + mmId);
|
||||||
skill = opt.get();
|
skill = opt.get();
|
||||||
|
|
||||||
@ -46,6 +54,14 @@ public class MythicMobSkill extends Skill {
|
|||||||
addModifier(key, readLinearValue((ConfigurationSection) mod));
|
addModifier(key, readLinearValue((ConfigurationSection) mod));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.isConfigurationSection("disable-anti-cheat"))
|
||||||
|
for(String key : config.getConfigurationSection("").getKeys(false)) {
|
||||||
|
Optional<CheatType> optional = Enums.getIfPresent(CheatType.class, "");
|
||||||
|
if(optional.isPresent() && config.isInt("disable-anti-cheat." + key))
|
||||||
|
antiCheat.put(optional.get(), config.getInt("disable-anti-cheat." + key));
|
||||||
|
else MMOCore.log(Level.WARNING, "Invalid Anti-Cheat configuration for '" + id + "'!");
|
||||||
|
}
|
||||||
|
|
||||||
// cast = config.getBoolean("target") ? (data, info) -> new
|
// cast = config.getBoolean("target") ? (data, info) -> new
|
||||||
// TargetSkillResult(data, info, def(config.getDouble("range"), 50)) :
|
// TargetSkillResult(data, info, def(config.getDouble("range"), 50)) :
|
||||||
// (data, info) -> new SkillResult(data, info);
|
// (data, info) -> new SkillResult(data, info);
|
||||||
@ -71,12 +87,13 @@ public class MythicMobSkill extends Skill {
|
|||||||
targets.add(data.getPlayer());
|
targets.add(data.getPlayer());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cache placeholders so they can be retrieved later by MythicMobs math
|
* cache placeholders so they can be retrieved later by MythicMobs math formulas
|
||||||
* formulas
|
|
||||||
*/
|
*/
|
||||||
data.getSkillData().cacheModifiers(this, cast);
|
data.getSkillData().cacheModifiers(this, cast);
|
||||||
|
|
||||||
if (!MythicMobs.inst().getAPIHelper().castSkill(data.getPlayer(), this.skill.getInternalName(), data.getPlayer(), data.getPlayer().getEyeLocation(), targets, null, 1))
|
if(MMOCore.plugin.hasAntiCheat()) MMOCore.plugin.antiCheatSupport.disableAntiCheat(data.getPlayer(), antiCheat);
|
||||||
|
if (!MythicMobs.inst().getAPIHelper().castSkill(data.getPlayer(), this.skill.getInternalName(),
|
||||||
|
data.getPlayer(), data.getPlayer().getEyeLocation(), targets, null, 1))
|
||||||
cast.abort(CancelReason.OTHER);
|
cast.abort(CancelReason.OTHER);
|
||||||
|
|
||||||
return cast;
|
return cast;
|
||||||
|
Loading…
Reference in New Issue
Block a user