diff --git a/README.md b/README.md
index b6994178c..6e6f553bb 100644
--- a/README.md
+++ b/README.md
@@ -22,14 +22,14 @@ Maven repository:
Maven:
```
- elitemobs-repo/id>
+ elitemobs-repo
https://s01.oss.sonatype.org/content/repositories/snapshots
com.magmaguy
EliteMobs
- 8.7.4-SNAPSHOT
+ 9.0.2-SNAPSHOT
provided
```
@@ -43,7 +43,7 @@ repositories {
dependencies{
//EliteMobs
- compileOnly group: 'com.magmaguy', name: 'EliteMobs', version: '8.7.4-SNAPSHOT'
+ compileOnly group: 'com.magmaguy', name: 'EliteMobs', version: '9.0.2-SNAPSHOT'
}
```
diff --git a/build.gradle b/build.gradle
index 000c6649d..da02e0566 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,8 @@
-import org.apache.tools.ant.filters.ReplaceTokens
-
plugins {
id 'java-library'
id 'idea'
id 'maven-publish'
- id "com.github.johnrengelman.shadow" version "7.0.0"
+ id("io.github.goooler.shadow") version "8.1.8"
id 'signing'
}
@@ -12,7 +10,13 @@ plugins {
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
-//Fixes issues with utf-8 in the translations files. Why? Don't know.
+java {
+ toolchain {
+ languageVersion = JavaLanguageVersion.of(17)
+ }
+}
+
+//Fixes issues with utf-8 in the translations files.
processResources {
def props = [version: version]
inputs.properties props
@@ -23,7 +27,7 @@ processResources {
}
group 'com.magmaguy'
-version '8.7.16-SNAPSHOT'
+version '9.1.8'
repositories {
maven {
@@ -42,13 +46,16 @@ repositories {
mavenLocal()
//Spigot API & CloudCommands
- maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
- //maven { url = 'https://oss.sonatype.org/content/repositories/central' }
-
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots" }
- //FreeMinecraftModels
- maven { url = 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
+ //MagmaCore
+ maven {
+ url = 'https://repo.magmaguy.com/releases'
+ }
+ //MagmaCore
+ maven {
+ url = 'https://repo.magmaguy.com/snapshots'
+ }
//Bstats API
maven { url = 'https://repo.codemc.org/repository/maven-public' }
@@ -61,10 +68,8 @@ repositories {
maven { url = 'https://repo.md-5.net/content/groups/public/' }
//PlaceholderAPI
maven { url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
-
//WorldGuard API
maven { url = 'https://maven.enginehub.org/repo/' }
-
//Model Engine
maven {
url = 'https://mvn.lumine.io/repository/maven-public/'
@@ -72,27 +77,13 @@ repositories {
artifact()
}
}
-
}
dependencies {
//Spigot API
- compileOnly "org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT"
- // The full CraftBukkit server with no shadowing. Requires mavenLocal.
- //BStats API
- implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1'
+ compileOnly "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT"
//WorldGuard API
compileOnly group: 'com.sk89q.worldguard', name: 'worldguard-bukkit', version: '7.0.7'
- //WorldEdit API
- compileOnly group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.2.12'
- //CloudCommands
- implementation group: 'cloud.commandframework', name: 'cloud-paper', version: '1.7.1'
- //CloudCommands Minecraft Extras module
- implementation group: 'cloud.commandframework', name: 'cloud-minecraft-extras', version: '1.7.0'
- //CloudCommands Adventure Platform module
- implementation('net.kyori:adventure-platform-bukkit:4.1.1')
- //I can't remember what this was for but it's in CloudCommands
- implementation group: 'io.leangen.geantyref', name: 'geantyref', version: '1.3.4'
//Vault
compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
exclude group: 'org.bukkit', module: 'bukkit'
@@ -102,34 +93,29 @@ dependencies {
//SQLite
compileOnly group: 'org.xerial', name: 'sqlite-jdbc', version: '3.32.3'
//MySQL
- implementation 'mysql:mysql-connector-java:8.0.33'
+ compileOnly 'mysql:mysql-connector-java:8.0.33'
//LibsDisguises
compileOnly group: 'com.comphenix.protocol', name: 'ProtocolLib', version: '4.7.0'
compileOnly group: 'LibsDisguises', name: 'LibsDisguises', version: '10.0.26'
//PlaceholderAPI
compileOnly group: 'me.clip', name: 'placeholderapi', version: '2.10.9'
-
- implementation group: 'commons-io', name: 'commons-io', version: '2.7'
- implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
-
- //reflections - used for config initialization
- implementation group: 'org.reflections', name: 'reflections', version: '0.10.2'
-
//lombok
- compileOnly 'org.projectlombok:lombok:1.18.24'
- annotationProcessor 'org.projectlombok:lombok:1.18.24'
-
+ compileOnly 'org.projectlombok:lombok:1.18.34'
+ annotationProcessor 'org.projectlombok:lombok:1.18.34'
//Model Engine - legacy
compileOnly "com.ticxo.modelengine:api:R3.1.7"
-
//Free Minecraft Models
- compileOnly group: 'com.magmaguy', name: 'FreeMinecraftModels', version: '1.3.0-SNAPSHOT'
-
- //Advanced AI goals
- implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.11.2-SNAPSHOT'
-
+ compileOnly group: 'com.magmaguy', name: 'FreeMinecraftModels', version: '1.4.2'
// Mythic Mobs integration - currently only for arenas
compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5'
+
+ ///Shaded in
+ implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1'
+ implementation group: 'commons-io', name: 'commons-io', version: '2.7'
+ implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
+ implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.13.0'
+ implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT'
+
}
artifacts { // task 'build' runs generates uberjar
@@ -146,57 +132,22 @@ String packagePath = 'com.magmaguy.shaded'
shadowJar {
dependencies {
relocate('org.bstats', packagePath + '.bstats')
- relocate('cloud.commandframework', packagePath + '.cloud')
- relocate('net.kyori', packagePath + '.adventure-platform-bukkit')
- relocate('io.leangen.geantyref', packagePath + '.geantyref')
- relocate('org.reflections', packagePath + '.reflections')
}
archiveClassifier.set(null)
archiveFileName.set(project.name + ".jar")
destinationDirectory.set(new File("testbed/plugins"))
}
-tasks.withType(JavaCompile) {
- options.encoding = 'UTF-8'
-}
-
-ext {
- resourceTokens = [
- 'Version': version
- ]
-}
-
-processResources {
- filter ReplaceTokens, tokens: resourceTokens
-}
-
-//sonatype repo
-task javadocJar(type: Jar) {
- classifier = 'javadoc'
- from javadoc
-}
-
-task sourcesJar(type: Jar) {
- classifier = 'sources'
- from sourceSets.main.allSource
-}
-
-artifacts {
- archives javadocJar, sourcesJar
-}
-
-ext.isReleaseVersion = !version.contains("SNAPSHOT")
-
publishing {
repositories {
maven {
- def releaseRepo = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
- def snapshotRepo = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
- url = isReleaseVersion ? releaseRepo : snapshotRepo
+ name = "EliteMobs"
+ url = "http://magmaguy.com:50001/releases"
credentials {
username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user"
password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password"
}
+ allowInsecureProtocol = true
}
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ffed3a254..a59520664 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java b/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java
deleted file mode 100644
index ef5b50091..000000000
--- a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.magmaguy.elitemobs;
-
-import org.bukkit.ChatColor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by MagmaGuy on 13/05/2017.
- */
-public class ChatColorConverter {
-
- private ChatColorConverter() {
- }
-
- public static String convert(String string) {
- if (string == null) return "";
- return ChatColor.translateAlternateColorCodes('&', string);
- }
-
- public static List convert(List> list) {
- if (list == null)return new ArrayList<>();
- List convertedList = new ArrayList<>();
- for (Object value : list)
- convertedList.add(convert(value + ""));
- return convertedList;
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java
index 851495ecf..e57279907 100644
--- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java
+++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java
@@ -6,7 +6,6 @@
import com.magmaguy.easyminecraftgoals.NMSManager;
import com.magmaguy.elitemobs.commands.CommandHandler;
-import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
import com.magmaguy.elitemobs.config.*;
import com.magmaguy.elitemobs.config.commands.CommandsConfig;
import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfig;
@@ -26,28 +25,29 @@
import com.magmaguy.elitemobs.config.powers.PowersConfig;
import com.magmaguy.elitemobs.config.wormholes.WormholeConfig;
import com.magmaguy.elitemobs.dungeons.EMPackage;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
import com.magmaguy.elitemobs.economy.VaultCompatibility;
import com.magmaguy.elitemobs.entitytracker.CustomProjectileData;
import com.magmaguy.elitemobs.entitytracker.EntityTracker;
import com.magmaguy.elitemobs.events.ActionEvent;
import com.magmaguy.elitemobs.events.TimedEvent;
import com.magmaguy.elitemobs.explosionregen.Explosion;
-import com.magmaguy.elitemobs.gamemodes.nightmaremodeworld.DaylightWatchdog;
-import com.magmaguy.elitemobs.gamemodes.zoneworld.Grid;
import com.magmaguy.elitemobs.instanced.MatchInstance;
import com.magmaguy.elitemobs.items.LootTables;
import com.magmaguy.elitemobs.items.customenchantments.CustomEnchantment;
import com.magmaguy.elitemobs.items.customitems.CustomItem;
import com.magmaguy.elitemobs.menus.ProceduralShopMenu;
import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomMusic;
import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity;
import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
import com.magmaguy.elitemobs.mobconstructor.mobdata.PluginMobProperties;
-import com.magmaguy.elitemobs.mobs.passive.EggRunnable;
-import com.magmaguy.elitemobs.mobs.passive.PassiveEliteMobDeathHandler;
import com.magmaguy.elitemobs.npcs.NPCEntity;
+import com.magmaguy.elitemobs.pathfinding.Navigation;
import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory;
import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.elitemobs.powers.scripts.ScriptAction;
import com.magmaguy.elitemobs.powerstances.MajorPowerStanceMath;
import com.magmaguy.elitemobs.powerstances.MinorPowerStanceMath;
import com.magmaguy.elitemobs.quests.DynamicQuest;
@@ -59,16 +59,15 @@
import com.magmaguy.elitemobs.thirdparty.placeholderapi.Placeholders;
import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility;
import com.magmaguy.elitemobs.treasurechest.TreasureChest;
-import com.magmaguy.elitemobs.utils.InfoMessage;
+import com.magmaguy.elitemobs.utils.BossBarUtil;
import com.magmaguy.elitemobs.utils.ServerTime;
-import com.magmaguy.elitemobs.utils.WarningMessage;
import com.magmaguy.elitemobs.versionnotifier.VersionChecker;
-import com.magmaguy.elitemobs.worlds.CustomWorldLoading;
import com.magmaguy.elitemobs.wormhole.Wormhole;
+import com.magmaguy.magmacore.MagmaCore;
+import com.magmaguy.magmacore.util.Logger;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.World;
-import org.bukkit.entity.EntityType;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;
@@ -82,72 +81,65 @@ public class EliteMobs extends JavaPlugin {
public static List validWorldList = new ArrayList();
public static boolean worldGuardIsEnabled = false;
- public static List zoneBasedSpawningWorlds = new ArrayList<>();
- public static List nightmareWorlds = new ArrayList<>();
public static Metrics metrics;
public Object placeholders = null;
public static void initializeConfigs() {
//Initialized translations
- DefaultConfig.initializeConfig();
- SchematicsFolderConfig.initializeConfigs();
- ResourcePackDataConfig.initializeConfig();
- ItemSettingsConfig.initializeConfig();
- ProceduralItemGenerationSettingsConfig.initializeConfig();
+ new DefaultConfig();
+ new ItemSettingsConfig();
+ new ProceduralItemGenerationSettingsConfig();
PotionEffectsConfig.initializeConfigs();
- EconomySettingsConfig.initializeConfig();
- EventsConfig.initializeConfig();
+ new EconomySettingsConfig();
+ new EventsConfig();
new EnchantmentsConfig();
- AntiExploitConfig.initializeConfig();
- CombatTagConfig.initializeConfig();
- AntiExploitConfig.initializeConfig();
- AdventurersGuildConfig.initializeConfig();
- ValidWorldsConfig.initializeConfig();
+ new AntiExploitConfig();
+ new CombatTagConfig();
+ new AntiExploitConfig();
+ new AdventurersGuildConfig();
+ new ValidWorldsConfig();
new MenusConfig();
new PowersConfig();
MobPropertiesConfig.initializeConfigs();
CustomEnchantment.initializeCustomEnchantments();
- MobCombatSettingsConfig.initializeConfig();
+ new MobCombatSettingsConfig();
CommandsConfig.initializeConfigs();
- DiscordSRVConfig.initializeConfig();
- ItemUpgradeSystemConfig.initializeConfig();
+ new DiscordSRVConfig();
new CustomEventsConfig();
- QuestsConfig.initializeConfig();
- WormholesConfig.initializeConfig();
- ArenasConfig.initializeConfig();
- //SoundsConfig.initializeConfig();
+ new QuestsConfig();
+ new WormholesConfig();
+ new ArenasConfig();
//ModelsConfig.initializeConfig();
- DungeonsConfig.initializeConfig();
+ new DungeonsConfig();
+ new SoundsConfig();
}
public static void worldScanner() {
for (World world : Bukkit.getWorlds())
- if (ValidWorldsConfig.getFileConfiguration().getBoolean("Valid worlds." + world.getName())) {
+ if (ValidWorldsConfig.getInstance().getFileConfiguration().getBoolean("Valid worlds." + world.getName())) {
validWorldList.add(world);
- if (ValidWorldsConfig.getZoneBasedWorlds().contains(world.getName()))
- zoneBasedSpawningWorlds.add(world);
- if (ValidWorldsConfig.getNightmareWorlds().contains(world.getName())) {
- nightmareWorlds.add(world);
- DaylightWatchdog.preventDaylight(world);
- }
}
}
@Override
public void onEnable() {
-
Bukkit.getLogger().info(" _____ _ _____ _____ ________ ______________ _____");
Bukkit.getLogger().info("| ___| | |_ _|_ _| ___| \\/ | _ | ___ \\/ ___|");
Bukkit.getLogger().info("| |__ | | | | | | | |__ | . . | | | | |_/ /\\ `--.");
Bukkit.getLogger().info("| __|| | | | | | | __|| |\\/| | | | | ___ \\ `--. \\");
Bukkit.getLogger().info("| |___| |_____| |_ | | | |___| | | \\ \\_/ / |_/ //\\__/ /");
Bukkit.getLogger().info("\\____/\\_____/\\___/ \\_/ \\____/\\_| |_/\\___/\\____/ \\____/");
- MetadataHandler.PLUGIN = this;
Bukkit.getLogger().info("By MagmaGuy - v. " + MetadataHandler.PLUGIN.getDescription().getVersion());
+ if (VersionChecker.serverVersionOlderThan(21, 0)) {
+ Logger.warn("You are running a Minecraft version older than 1.21.0! EliteMobs 9.0 and later are only compatible with Minecraft 1.21.0 or later, if you are running an older Minecraft version you will need to use a pre-9.0 version of EliteMobs.");
+ Bukkit.getPluginManager().disablePlugin(this);
+ return;
+ }
+
ServerTime.startTickCounter();
NMSManager.initializeAdapter(this);
@@ -157,9 +149,9 @@ public void onEnable() {
try {
File spigotConfigContainer = new File(Paths.get(MetadataHandler.PLUGIN.getDataFolder().getParentFile().getCanonicalFile().getParentFile().toString() + "/spigot.yml").toString());
Bukkit.getServer().spigot().getConfig().save(spigotConfigContainer);
- new InfoMessage("New default max health set correctly!");
+ Logger.info("New default max health set correctly!");
} catch (IOException e) {
- new WarningMessage("Failed to save max health value! For the plugin to work correctly, you should increase your max health on the spigot.yml config file to " + 100000000);
+ Logger.warn("Failed to save max health value! For the plugin to work correctly, you should increase your max health on the spigot.yml config file to " + 100000000);
}
}
@@ -178,14 +170,14 @@ public void onEnable() {
//Reserves ModelEngine addresses if present
ModelEngineReservedAddresses.reserve();
- if (worldGuardIsEnabled) Bukkit.getLogger().info("[EliteMobs] WorldGuard compatibility is enabled!");
- else Bukkit.getLogger().info("[EliteMobs] WorldGuard compatibility is not enabled!");
+ if (worldGuardIsEnabled) Logger.info("WorldGuard compatibility is enabled!");
+ else Logger.info("WorldGuard compatibility is not enabled!");
//Enable Vault
try {
VaultCompatibility.vaultSetup();
} catch (Exception e) {
- Bukkit.getLogger().warning("[EliteMobs] Something went wrong with the vault configuration - your Vault " + "version is probably not compatible with this EliteMobs version. Please contact the dev about this error.");
+ Logger.warn("Something went wrong with the vault configuration - your Vault " + "version is probably not compatible with this EliteMobs version. Please contact the dev about this error.");
VaultCompatibility.VAULT_ENABLED = false;
}
@@ -193,7 +185,7 @@ public void onEnable() {
EventsRegistrer.registerEvents();
//Launch the local data cache
- DatabaseConfig.initializeConfig();
+ new DatabaseConfig();
PlayerData.initializeDatabaseConnection();
ElitePlayerInventory.initialize();
@@ -218,11 +210,6 @@ public void onEnable() {
MinorPowerStanceMath.initializeVectorCache();
MajorPowerStanceMath.initializeVectorCache();
- /*
- Scan for loaded SuperMobs
- */
- PassiveEliteMobDeathHandler.SuperMobScanner.scanSuperMobs();
-
// Small check to make sure that PlaceholderAPI is installed
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
Placeholders placeholders = new Placeholders();
@@ -236,7 +223,8 @@ public void onEnable() {
new CustomCharts();
//Imports custom configurations and mindungeons from the import folder
- ConfigurationImporter.initializeConfigs();
+// ConfigurationImporter.initializeConfigs();
+ MagmaCore.initializeImporter();
ConfigurationExporter.initializeConfigs();
//Import custom items after potentially importing new items
@@ -246,17 +234,6 @@ public void onEnable() {
//Initialize em package content, such as world loading
new DungeonPackagerConfig();
- //Load Adventurer's Guild
- if (AdventurersGuildConfig.isGuildWorldIsEnabled()) {
- try {
- CustomWorldLoading.startupWorldInitialization();
- AdventurersGuildCommand.defineTeleportLocation();
- if (AdventurersGuildConfig.getGuildWorldLocation() == null) AdventurersGuildConfig.toggleGuildInstall();
- } catch (Exception e) {
- AdventurersGuildConfig.toggleGuildInstall();
- new WarningMessage("Failed to initialize the Adventurer's Guild Hub! It is now disabled. You can try to" + "reenable it in /em setup");
- }
- }
//Initialize custom & regional bosses
new CustomBossesConfig();
@@ -274,7 +251,7 @@ public void onEnable() {
try {
if (emPackage.isInstalled()) emPackage.initializeContent();
} catch (Exception exception) {
- new WarningMessage("Failed to load EliteMobs Package " + emPackage.getDungeonPackagerConfigFields().getFilename() + " !");
+ Logger.warn("Failed to load EliteMobs Package " + emPackage.getDungeonPackagerConfigFields().getFilename() + " !");
exception.printStackTrace();
}
@@ -283,17 +260,18 @@ public void onEnable() {
try {
new CustomSpawnConfig();
} catch (Exception ex) {
- new WarningMessage("You are using a version of Spigot or a branch thereof (Paper, Purpur, so on) that is (probably) HORRIBLY outdated!" + " This issue will probably be fixed if you update your server version to the latest patch of the version" +
+ Logger.warn("You are using a version of Spigot or a branch thereof (Paper, Purpur, so on) that is (probably) HORRIBLY outdated!" + " This issue will probably be fixed if you update your server version to the latest patch of the version" +
" you are running.");
- new WarningMessage(" This does not mean that you have to update your Minecraft version, but it does mean you must update your server version to the latest patch" + " available for that Minecraft version. Download from trustworthy sources, as if you download Spigot from some random website other than Spigot," + " you are probably not getting the latest version (and also there's a high chance you'll get a virus).");
+ Logger.warn(" This does not mean that you have to update your Minecraft version, but it does mean you must update your server version to the latest patch" + " available for that Minecraft version. Download from trustworthy sources, as if you download Spigot from some random website other than Spigot," + " you are probably not getting the latest version (and also there's a high chance you'll get a virus).");
}
new CustomQuestsConfig();
//Commands
- new CommandHandler();
+// new CommandHandler();
+ CommandHandler.registerCommands();
- SpecialItemSystemsConfig.initializeConfig();
+ new SpecialItemSystemsConfig();
/*
Check for new plugin version or for dungeon updates
@@ -301,15 +279,20 @@ public void onEnable() {
VersionChecker.check();
DynamicQuest.startRandomizingQuests();
+ CustomBossEntity.startUpdatingDynamicLevels();
}
@Override
public void onLoad() {
+ //Initializes some core utilities that are shared across MagmaGuy's plugins
+ MetadataHandler.PLUGIN = this;
+ MagmaCore.createInstance(this);
+
//WorldGuard hook
try {
worldGuardIsEnabled = WorldGuardCompatibility.initialize();
} catch (NoClassDefFoundError | IllegalStateException ex) {
- Bukkit.getLogger().warning("[EliteMobs] Error loading WorldGuard. EliteMob-specific flags will not work." + " Except if you just reloaded the plugin, in which case they will totally work.");
+ Logger.warn("Error loading WorldGuard. EliteMob-specific flags will not work." + " Except if you just reloaded the plugin, in which case they will totally work.");
worldGuardIsEnabled = false;
}
if (!worldGuardIsEnabled)
@@ -319,43 +302,22 @@ public void onLoad() {
@Override
public void onDisable() {
-
- new InfoMessage("Starting EliteMobs shutdown sequence...");
-
- new InfoMessage("Regenerating exploded blocks...");
+ Logger.info("Starting EliteMobs shutdown sequence...");
Explosion.regenerateAllPendingBlocks();
-
- new InfoMessage("Cancelling tasks...");
Bukkit.getServer().getScheduler().cancelTasks(MetadataHandler.PLUGIN);
-
- new InfoMessage("Closing wormholes...");
Wormhole.shutdown();
-
- new InfoMessage("Spinning Regional Bosses down...");
- //save all pending respawns
RegionalBossEntity.save();
RegionalBossEntity.getTrackableCustomBosses().clear();
RegionalBossEntity.getRegionalBossEntitySet().clear();
InstancedBossEntity.shutdown();
NPCEntity.shutdown();
-
- new InfoMessage("Wiping Elite entities clean...");
PersistentObjectHandler.shutdown();
EntityTracker.wipeShutdown();
-
- new InfoMessage("Clearing events...");
TimedEvent.shutdown();
ActionEvent.shutdown();
-
- new InfoMessage("Clearing valid worlds...");
validWorldList.clear();
- new InfoMessage("Clearing zone based worlds...");
- zoneBasedSpawningWorlds.clear();
- new InfoMessage("Clearing config regional elites...");
CustomBossesConfigFields.getRegionalElites().clear();
- new InfoMessage("Clearing custom enchantments...");
CustomEnchantment.getCustomEnchantmentMap().clear();
- new InfoMessage("Clearing custom items...");
CustomItem.getCustomItems().clear();
CustomItem.getCustomItemStackList().clear();
CustomItem.getCustomItemStackShopList().clear();
@@ -364,46 +326,32 @@ public void onDisable() {
CustomItem.getFixedItems().clear();
CustomItem.getTieredLoot().clear();
CustomItem.getWeighedFixedItems().clear();
- new InfoMessage("Clearing Minidungeons...");
EMPackage.shutdown();
RegionalBossEntity.regionalBossesShutdown();
-
- new InfoMessage("Unregistering placeholders...");
if (this.placeholders != null) ((Placeholders) placeholders).unregister();
-
- new InfoMessage("Unregistering handlers...");
HandlerList.unregisterAll(MetadataHandler.PLUGIN);
-
- new InfoMessage("Clearing Treasure Chests...");
TreasureChest.clearTreasureChests();
-
- new InfoMessage("Untracking quests...");
QuestTracking.clear();
-
MatchInstance.shutdown();
-
CustomProjectileData.shutdown();
-
DynamicQuest.shutdown();
-
ProceduralShopMenu.shutdown();
-
- //save cached data
- Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases...");
+ EliteMobsWorld.shutdown();
+ Navigation.shutdown();
+ BossBarUtil.shutdown();
+ ScriptAction.shutdown();
+ CustomMusic.shutdown();
+ CustomBossEntity.shutdown();
+ Logger.info("Saving EliteMobs databases...");
PlayerData.closeConnection();
- Bukkit.getLogger().info("[EliteMobs] All done! Good night.");
-
+ MagmaCore.shutdown();
+ Logger.info("All done! Good night.");
}
/*
Repeating tasks that run as long as the server is on
*/
private void launchRunnables() {
- if (!zoneBasedSpawningWorlds.isEmpty()) Grid.initializeGrid();
- int eggTimerInterval = 20 * 60 * 10 / DefaultConfig.getSuperMobStackAmount();
- if (MobPropertiesConfig.getMobProperties().get(EntityType.CHICKEN).isEnabled() && DefaultConfig.getSuperMobStackAmount() > 0) {
- new EggRunnable().runTaskTimer(this, eggTimerInterval, eggTimerInterval);
- }
//save regional bosses when the files update
RegionalBossEntity.regionalDataSaver();
}
diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java
index 12d8569d8..246e9a667 100644
--- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java
+++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java
@@ -16,11 +16,10 @@
import com.magmaguy.elitemobs.config.*;
import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfig;
import com.magmaguy.elitemobs.config.powers.PowersConfig;
+import com.magmaguy.elitemobs.dungeons.DungeonProtector;
import com.magmaguy.elitemobs.entitytracker.EntityTracker;
import com.magmaguy.elitemobs.events.ActionEvent;
import com.magmaguy.elitemobs.explosionregen.Explosion;
-import com.magmaguy.elitemobs.gamemodes.nightmaremodeworld.DaylightWatchdog;
-import com.magmaguy.elitemobs.gamemodes.zoneworld.ZoneWarner;
import com.magmaguy.elitemobs.initialsetup.FirstTimeSetup;
import com.magmaguy.elitemobs.instanced.MatchInstance;
import com.magmaguy.elitemobs.instanced.arena.ArenaInstance;
@@ -29,12 +28,10 @@
import com.magmaguy.elitemobs.items.customenchantments.*;
import com.magmaguy.elitemobs.items.potioneffects.PlayerPotionEffects;
import com.magmaguy.elitemobs.menus.*;
-import com.magmaguy.elitemobs.mobconstructor.MergeHandler;
import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler;
import com.magmaguy.elitemobs.mobconstructor.custombosses.*;
import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand;
import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBossBlock;
-import com.magmaguy.elitemobs.mobs.passive.*;
import com.magmaguy.elitemobs.mobspawning.NaturalMobSpawnEventHandler;
import com.magmaguy.elitemobs.npcs.NPCDamageEvent;
import com.magmaguy.elitemobs.npcs.NPCEntity;
@@ -91,8 +88,6 @@ public static void registerEvents() {
register(new Navigation());
- register(new ResourcePackDataConfig.ResourcePackDataConfigEvents());
-
register(new DungeonKillTargetObjective.DungeonKillTargetObjectiveListener());
register(new VersionChecker.VersionCheckerEvents());
@@ -102,21 +97,17 @@ public static void registerEvents() {
register(new PlayerStatsTracker());
register(new PlayerQuestCooldownsLogout());
- register(new ChickenHandler());
- register(new CowHandler());
- register(new MushroomCowHandler());
- register(new PassiveEliteMobDeathHandler());
- register(new PigHandler());
- register(new SheepHandler());
- register(new FindSuperMobs());
if (ItemSettingsConfig.isPreventEliteItemEnchantment())
register(new ItemEnchantmentPrevention());
if (ItemSettingsConfig.isPreventEliteItemDisenchantment())
register(new ItemDisenchantPrevention());
- if (!VersionChecker.serverVersionOlderThan(15, 2))
- if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade())
- register(new PreventUpgradeDiamondToNetherite());
+ if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade())
+ register(new PreventUpgradeDiamondToNetherite());
+
+ register(new FixPlayerOnLoginOrRespawn());
+ register(new EnvironmentalDungeonDamage());
+ register(new PlayerQuitCleanup());
//Mob damage
register(new EliteMobGenericDamagedHandler());
@@ -149,7 +140,6 @@ public static void registerEvents() {
register(new EliteMobEnterCombatEvent.EliteMobEnterCombatEventFilter());
register(new PlayerPreTeleportEvent.PlayerPreTeleportEventEvents());
register(new PlayerTeleportEvent.PlayerTeleportEventExecutor());
- register(new SuperMobDamageEvent.SuperMobDamageEventFilter());
register(new EliteMobDamagedByPlayerEvent.EliteMobDamagedByPlayerEventFilter());
register(new EliteExplosionEvent.EliteExplosionEvents());
@@ -223,7 +213,6 @@ public static void registerEvents() {
register(new PersistentObjectHandler.PersistentObjectHandlerEvents());
register(new CustomBossTaunts());
register(new PhaseBossEntity.PhaseBossEntityListener());
- register(new RegionalBossEntity.RegionalBossEntityEvents());
register(new AdvancedAggroManager());
register(new TransitiveBossBlock());
register(new TransitiveBlockCommand.TemporaryBossBlockCommandEvents());
@@ -232,9 +221,6 @@ public static void registerEvents() {
//Metadata (player purger)
register(new MetadataHandler());
- //Mob merger
- register(new MergeHandler());
-
//Natural EliteMobs Spawning
register(new EntityTracker());
//Fix lingering entity after crashes
@@ -278,10 +264,7 @@ public static void registerEvents() {
register(new LootMenu.LootMenuEvents());
//Minecraft behavior canceller
- if (DefaultConfig.isPreventCreeperDamageToPassiveMobs())
- register(new PreventCreeperPassiveEntityDamage());
- if (!VersionChecker.serverVersionOlderThan(16, 0))
- register(new PreventEliteBeeHiveEnter());
+ register(new PreventEliteBeeHiveEnter());
register(new EnderDragonUnstuck());
if (DefaultConfig.isPreventVanillaReinforcementsForEliteEntities())
register(new VanillaReinforcementsCanceller());
@@ -290,6 +273,7 @@ public static void registerEvents() {
register(new AlternativeDurabilityLoss());
register(new EnderCrystalDamageProtectionBypass());
register(new NPCsBecomeWitches());
+ register(new PreventEliteSilverfishBlockEnter());
//Antiexploits
@@ -301,9 +285,7 @@ public static void registerEvents() {
register(new PreventItemPickupByMobs());
if (AntiExploitConfig.isAmbientDamageExploit())
register(new AmbientDamageExploit());
- if (!VersionChecker.serverVersionOlderThan(14, 0)) {
- register(new HoneyBlockJumpExploit());
- }
+ register(new HoneyBlockJumpExploit());
register(new EliteMobDamagedByPlayerAntiExploitListener());
if (AntiExploitConfig.isNoPathExploit())
register(new PreventPathfindingExploit());
@@ -344,6 +326,9 @@ public static void registerEvents() {
register(new QuestInventoryMenu.QuestInventoryMenuEvents());
register(new ArenaCompleteEvent.ArenaCompleteEventHandler());
+ //Songs
+ register(new CustomMusic.CustomMusicEvents());
+
//Arenas
register(new ArenaMenu.ArenaMenuEvents());
register(new ArenaInstance.ArenaInstanceEvents());
@@ -372,6 +357,7 @@ public static void registerEvents() {
register(new WorldGuardDungeonFlag());
register(new WorldGuardExplosionBlockDamageFlag());
}
+ register(new DungeonProtector());
register(new EntityTransformHandler());
register(new EliteBlazeWaterDamagePrevention());
@@ -382,10 +368,6 @@ public static void registerEvents() {
register(new TreasureChest.TreasureChestEvents());
- //Zone based spawning
- register(new ZoneWarner());
- register(new DaylightWatchdog());
-
//On death commands
register(new OnDeathCommands());
diff --git a/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java b/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java
index a0a785dc6..69083d1e8 100644
--- a/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java
+++ b/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java
@@ -1,8 +1,7 @@
package com.magmaguy.elitemobs;
-import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
-import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.java.JavaPlugin;
/**
* Created by MagmaGuy on 26/04/2017.
@@ -20,8 +19,7 @@ public class MetadataHandler implements Listener {
//third party compatibility
public final static String BETTERDROPS_COMPATIBILITY_MD = "betterdrops_ignore";
//plugin getter
- public static Plugin PLUGIN = Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS);
-
+ public static JavaPlugin PLUGIN;
public static int signatureID = 31173;
diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java
index a45629ebf..ead9234e5 100644
--- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java
+++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java
@@ -4,7 +4,7 @@
import com.magmaguy.elitemobs.config.AdventurersGuildConfig;
import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory;
import com.magmaguy.elitemobs.playerdata.database.PlayerData;
-import com.magmaguy.elitemobs.utils.Round;
+import com.magmaguy.magmacore.util.Round;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java
index 9c7724ecd..3d2525113 100644
--- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java
+++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java
@@ -1,12 +1,13 @@
package com.magmaguy.elitemobs.adventurersguild;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.config.AdventurersGuildConfig;
+import com.magmaguy.elitemobs.config.DefaultConfig;
import com.magmaguy.elitemobs.config.EconomySettingsConfig;
-import com.magmaguy.elitemobs.config.ResourcePackDataConfig;
+import com.magmaguy.elitemobs.config.SoundsConfig;
import com.magmaguy.elitemobs.config.menus.premade.GuildRankMenuConfig;
import com.magmaguy.elitemobs.economy.EconomyHandler;
import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldowns;
+import com.magmaguy.magmacore.util.ChatColorConverter;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@@ -20,15 +21,14 @@
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
public class GuildRankMenuHandler implements Listener {
private static final HashSet inventories = new HashSet<>();
- private static final ArrayList rankSlots = new ArrayList<>(Arrays.asList(
- 4, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 29, 30, 31, 32, 33, 38, 39, 40, 41, 42));
+ private static final ArrayList rankSlots = new ArrayList<>(new ArrayList<>(List.of(
+ 4, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 29, 30, 31, 32, 33, 38, 39, 40, 41, 42)));
private static final int prestigeRankSlot = 49;
private static void selectUnlockedRank(Player player, int guildRank) {
@@ -61,6 +61,7 @@ private static void selectRankToUnlock(Player player, int guildRank) {
command.replace("$player", player.getName())
.replace("$prestigeRank", GuildRank.getActiveGuildRank(player) + "")
.replace("$activeRank", GuildRank.getGuildPrestigeRank(player) + ""));
+ player.playSound(player.getLocation(), SoundsConfig.guildRankUpSound, 1, 1);
}
private static void selectPrestigeUnlock(Player player) {
@@ -94,6 +95,7 @@ private static void selectPrestigeUnlock(Player player) {
command.replace("$player", player.getName())
.replace("$prestigeRank", GuildRank.getActiveGuildRank(player) + "")
.replace("$activeRank", GuildRank.getGuildPrestigeRank(player) + ""));
+ player.playSound(player.getLocation(), SoundsConfig.guildPrestigeSound, 1, 1);
}
/**
@@ -111,7 +113,7 @@ private static void selectPrestigeUnlock(Player player) {
*/
public static Inventory initializeGuildRankMenu(Player player) {
String menuName = GuildRankMenuConfig.getMenuName();
- if (ResourcePackDataConfig.displayCustomMenuUnicodes)
+ if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager"))
menuName = ChatColor.WHITE + "\uF801\uDA90\uDEFA\uF805 " + menuName;
Inventory difficultyMenu = Bukkit.createInventory(player, 54, menuName);
difficultyMenu = populateInventory(difficultyMenu, player);
@@ -276,14 +278,14 @@ private static String healthBonusString(int prestigeLevel, int guildRank) {
private static String critBonusString(int prestigeLevel, int guildRank) {
if (!AdventurersGuildConfig.isAddMaxHealth()) return null;
- if (prestigeLevel < 3)
+ if (prestigeLevel < 2)
return null;
return GuildRankMenuConfig.getCritBonusMessage().replace("$amount", GuildRank.critBonusValue(prestigeLevel, guildRank) + "");
}
private static String dodgeBonusString(int prestigeLevel, int guildRank) {
if (!AdventurersGuildConfig.isAddMaxHealth()) return null;
- if (prestigeLevel < 4)
+ if (prestigeLevel < 3)
return null;
return GuildRankMenuConfig.getDodgeBonusMessage().replace("$amount", GuildRank.dodgeBonusValue(prestigeLevel, guildRank) + "");
}
diff --git a/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java b/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java
index f998b6b59..a3b7e0a85 100644
--- a/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java
+++ b/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java
@@ -1,8 +1,8 @@
package com.magmaguy.elitemobs.announcements;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.config.EventsConfig;
import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement;
+import com.magmaguy.magmacore.util.ChatColorConverter;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java
index eb97e1867..83d11f928 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java
@@ -8,12 +8,11 @@
public class EliteDamageEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
+ private final Event event;
private boolean isCancelled = false;
@Getter
private double damage;
- private final Event event;
-
/**
* Classes that deal with damage in EliteMobs extend this class in order to inherit modifiable and cancellable behavior.
* This is purely just used for API purposes, such as with the Elite Scripting system. Does not do anything on its own.
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java
index 1b4323c62..a86da6566 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java
@@ -6,6 +6,7 @@
import com.magmaguy.elitemobs.api.utils.EliteItemManager;
import com.magmaguy.elitemobs.config.ItemSettingsConfig;
import com.magmaguy.elitemobs.config.MobCombatSettingsConfig;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
import com.magmaguy.elitemobs.entitytracker.CustomProjectileData;
import com.magmaguy.elitemobs.entitytracker.EntityTracker;
import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
@@ -15,8 +16,7 @@
import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker;
import com.magmaguy.elitemobs.utils.EntityFinder;
import com.magmaguy.elitemobs.utils.EventCaller;
-import com.magmaguy.elitemobs.utils.Round;
-import com.magmaguy.elitemobs.versionnotifier.VersionChecker;
+import com.magmaguy.magmacore.util.Round;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -135,13 +135,13 @@ private static double secondaryEnchantmentDamageIncrease(Player player, LivingEn
if (ItemSettingsConfig.isUseEliteEnchantments()) return 0D;
if (livingEntity instanceof Spider || livingEntity instanceof Silverfish) {
int level = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).mainhand.getDamageArthropodsLevel(player.getInventory().getItemInMainHand(), false);
- level -= Enchantment.DAMAGE_ARTHROPODS.getMaxLevel();
+ level -= Enchantment.BANE_OF_ARTHROPODS.getMaxLevel();
if (level < 1) return 0D;
return level * 2.5D;
}
- if (livingEntity instanceof Zombie || livingEntity instanceof Skeleton || livingEntity instanceof Wither || livingEntity instanceof SkeletonHorse || livingEntity instanceof ZombieHorse || !VersionChecker.serverVersionOlderThan(16, 0) && livingEntity.getType().equals(EntityType.ZOMBIFIED_PIGLIN)) {
+ if (livingEntity instanceof Zombie || livingEntity instanceof Skeleton || livingEntity instanceof Wither || livingEntity instanceof SkeletonHorse || livingEntity instanceof ZombieHorse || livingEntity.getType().equals(EntityType.ZOMBIFIED_PIGLIN)) {
int level = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).mainhand.getDamageUndeadLevel(player.getInventory().getItemInMainHand(), false);
- level -= Enchantment.DAMAGE_UNDEAD.getMaxLevel();
+ level -= Enchantment.SMITE.getMaxLevel();
if (level < 1) return 0D;
return level * 2.5D;
}
@@ -256,9 +256,10 @@ else if (event.getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE))
}
private void runAntiexploit(EliteEntity eliteEntity, EntityDamageByEntityEvent event, EliteMobDamagedByPlayerEvent eliteMobDamagedByPlayerEvent) {
+ if (EliteMobsWorld.isEliteMobsWorld(event.getDamager().getWorld().getUID())) return;
if (EliteMobs.worldGuardIsEnabled) {
Boolean regionQuery = WorldGuardFlagChecker.checkNullableFlag(eliteEntity.getLocation(), WorldGuardCompatibility.getELITEMOBS_ANTIEXPLOIT());
- if (regionQuery != null && regionQuery == false) return;
+ if (regionQuery != null && !regionQuery) return;
}
if (event.getCause() != EntityDamageEvent.DamageCause.ENTITY_ATTACK &&
event.getCause() != EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK &&
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java
index 89309699c..888ce2e4a 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java
@@ -1,6 +1,7 @@
package com.magmaguy.elitemobs.api;
import com.magmaguy.elitemobs.EliteMobs;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
import com.magmaguy.elitemobs.entitytracker.EntityTracker;
import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility;
@@ -59,6 +60,8 @@ public void onEntityDamagedEvent(EntityDamageEvent event) {
//happens if it dies
if (!eliteEntity.isValid()) return;
+ if (EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return;
+
if (EliteMobs.worldGuardIsEnabled && !WorldGuardFlagChecker.checkFlag(eliteEntity.getLivingEntity().getLocation(),
WorldGuardCompatibility.getELITEMOBS_ANTIEXPLOIT()))
return;
diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java
index 87ffd7097..70e38bffd 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java
@@ -120,8 +120,8 @@ private static double eliteToPlayerDamageFormula(Player player, EliteEntity elit
double customBossDamageMultiplier = eliteEntity.getDamageMultiplier();
double potionEffectDamageReduction = 0;
- if (player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE))
- potionEffectDamageReduction = (player.getPotionEffect(PotionEffectType.DAMAGE_RESISTANCE).
+ if (player.hasPotionEffect(PotionEffectType.RESISTANCE))
+ potionEffectDamageReduction = (player.getPotionEffect(PotionEffectType.RESISTANCE).
getAmplifier() + 1) * MobCombatSettingsConfig.getResistanceDamageMultiplier();
double finalDamage;
@@ -197,8 +197,8 @@ else if (event.getDamager() instanceof Projectile && ((Projectile) event.getDama
ItemMeta itemMeta = player.getInventory().getItemInOffHand().getItemMeta();
org.bukkit.inventory.meta.Damageable damageable = (Damageable) itemMeta;
- if (player.getInventory().getItemInOffHand().getItemMeta().hasEnchant(Enchantment.DURABILITY) &&
- player.getInventory().getItemInOffHand().getItemMeta().getEnchantLevel(Enchantment.DURABILITY) / 20D > ThreadLocalRandom.current().nextDouble())
+ if (player.getInventory().getItemInOffHand().getItemMeta().hasEnchant(Enchantment.UNBREAKING) &&
+ player.getInventory().getItemInOffHand().getItemMeta().getEnchantLevel(Enchantment.UNBREAKING) / 20D > ThreadLocalRandom.current().nextDouble())
damageable.setDamage(damageable.getDamage() + 5);
player.getInventory().getItemInOffHand().setItemMeta(itemMeta);
if (Material.SHIELD.getMaxDurability() < damageable.getDamage())
diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java
index b1983fd1d..1974d0b5b 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java
@@ -1,9 +1,9 @@
package com.magmaguy.elitemobs.api;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.MetadataHandler;
import com.magmaguy.elitemobs.config.CombatTagConfig;
import com.magmaguy.elitemobs.utils.EventCaller;
+import com.magmaguy.magmacore.util.ChatColorConverter;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Location;
diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java
index e5a62b28f..05177dd22 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java
@@ -1,16 +1,12 @@
package com.magmaguy.elitemobs.api;
-import com.magmaguy.elitemobs.config.AdventurersGuildConfig;
-import com.magmaguy.elitemobs.dungeons.EMPackage;
-import com.magmaguy.elitemobs.dungeons.WorldPackage;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
import com.magmaguy.elitemobs.playerdata.database.PlayerData;
import com.magmaguy.elitemobs.utils.EventCaller;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.*;
-import java.util.Objects;
-
public class PlayerTeleportEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -68,17 +64,10 @@ public Location getOriginalLocation() {
}
public void executeTeleport() {
+ if (!EliteMobsWorld.isEliteMobsWorld(player.getLocation().getWorld().getUID()))
+ PlayerData.setBackTeleportLocation(player, originalLocation);
+
player.teleport(destination);
- for (EMPackage emPackage : EMPackage.getEmPackages().values())
- if (emPackage.isInstalled() &&
- emPackage instanceof WorldPackage &&
- ((WorldPackage) emPackage).getWorld() == destination.getWorld())
- return;
-
- if (AdventurersGuildConfig.getGuildWorldLocation() != null &&
- Objects.equals(AdventurersGuildConfig.getGuildWorldLocation().getWorld(), originalLocation.getWorld()))
- return;
- PlayerData.setBackTeleportLocation(player, originalLocation);
}
public static class PlayerTeleportEventExecutor implements Listener {
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java
index 3ed1bbf62..3e3cce76c 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java
@@ -1,10 +1,11 @@
package com.magmaguy.elitemobs.api;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.config.QuestsConfig;
+import com.magmaguy.elitemobs.config.SoundsConfig;
import com.magmaguy.elitemobs.playerdata.database.PlayerData;
import com.magmaguy.elitemobs.quests.CustomQuest;
import com.magmaguy.elitemobs.quests.Quest;
+import com.magmaguy.magmacore.util.ChatColorConverter;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -62,6 +63,8 @@ public void onQuestAccept(QuestAcceptEvent event) {
ChatColorConverter.convert(QuestsConfig.getQuestStartSubtitle().replace("$questName", event.getQuest().getQuestName())),
20, 60, 20);
+ boolean playedCustomSound = false;
+
if (event.getQuest() instanceof CustomQuest customQuest) {
customQuest.applyTemporaryPermissions(event.getPlayer());
@@ -71,15 +74,19 @@ public void onQuestAccept(QuestAcceptEvent event) {
for (String dialog : customQuest.getCustomQuestsConfigFields().getQuestAcceptDialog())
event.getPlayer().sendMessage(dialog);
- if (customQuest.getCustomQuestsConfigFields().getQuestAcceptSound() != null)
+ if (customQuest.getCustomQuestsConfigFields().getQuestAcceptSound() != null) {
Bukkit.getPlayer(customQuest.getPlayerUUID()).playSound(
Bukkit.getPlayer(customQuest.getPlayerUUID()),
customQuest.getCustomQuestsConfigFields().getQuestAcceptSound(),
1f, 1f);
+ playedCustomSound = true;
+ }
}
if (!QuestsConfig.isAutoTrackQuestsOnAccept())
event.getQuest().getQuestObjectives().displayTemporaryObjectivesScoreboard(event.getPlayer());
PlayerData.addQuest(event.getPlayer().getUniqueId(), event.getQuest());
+ if (!playedCustomSound)
+ event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questAcceptSound, 1, 1);
}
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java
index 8dc1db498..1422c3de3 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java
@@ -1,5 +1,6 @@
package com.magmaguy.elitemobs.api;
+import com.magmaguy.elitemobs.config.SoundsConfig;
import com.magmaguy.elitemobs.quests.CustomQuest;
import com.magmaguy.elitemobs.quests.Quest;
import com.magmaguy.elitemobs.utils.EventCaller;
@@ -50,6 +51,8 @@ public void onQuestComplete(QuestCompleteEvent event) {
Bukkit.getPlayer(customQuest.getPlayerUUID()),
customQuest.getCustomQuestsConfigFields().getQuestCompleteSound(),
1f, 1f);
+ else
+ event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questCompleteSound, 1, 1);
}
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java
index 32af2bc8e..57f8bf775 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java
@@ -2,6 +2,7 @@
import com.magmaguy.elitemobs.MetadataHandler;
import com.magmaguy.elitemobs.config.QuestsConfig;
+import com.magmaguy.elitemobs.config.SoundsConfig;
import com.magmaguy.elitemobs.playerdata.database.PlayerData;
import com.magmaguy.elitemobs.quests.CustomQuest;
import com.magmaguy.elitemobs.quests.Quest;
@@ -55,6 +56,8 @@ public void onQuestLeave(QuestLeaveEvent event) {
questTracking.stop();
}
}
+
+ event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questAbandonSound, 1, 1);
}
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java
index df2993bac..4b617ee6d 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java
@@ -1,6 +1,7 @@
package com.magmaguy.elitemobs.api;
import com.magmaguy.elitemobs.config.QuestsConfig;
+import com.magmaguy.elitemobs.config.SoundsConfig;
import com.magmaguy.elitemobs.playerdata.database.PlayerData;
import com.magmaguy.elitemobs.quests.Quest;
import com.magmaguy.elitemobs.quests.QuestTracking;
@@ -42,6 +43,7 @@ public void onQuestProgression(QuestProgressionEvent event) {
if (!QuestTracking.isTracking(event.player))
event.getQuest().getQuestObjectives().displayTemporaryObjectivesScoreboard(event.getPlayer());
PlayerData.updateQuestStatus(event.getPlayer().getUniqueId(), event.getQuest());
+ event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questProgressionSound, 1, 1);
}
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java
index 9a0eebdd2..c7a929cbb 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java
@@ -1,9 +1,9 @@
package com.magmaguy.elitemobs.api;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.config.QuestsConfig;
import com.magmaguy.elitemobs.playerdata.database.PlayerData;
import com.magmaguy.elitemobs.quests.Quest;
+import com.magmaguy.magmacore.util.ChatColorConverter;
import lombok.Getter;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
diff --git a/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java
new file mode 100644
index 000000000..2c9d55bb7
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java
@@ -0,0 +1,29 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import lombok.Getter;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class ScriptZoneEnterEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final EliteEntity eliteEntity;
+ @Getter
+ private final LivingEntity entity;
+
+ public ScriptZoneEnterEvent(EliteEntity customBossEntity, LivingEntity entity) {
+ this.eliteEntity = customBossEntity;
+ this.entity = entity;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java
new file mode 100644
index 000000000..6e2505042
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java
@@ -0,0 +1,29 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import lombok.Getter;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class ScriptZoneLeaveEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final EliteEntity eliteEntity;
+ @Getter
+ private final LivingEntity entity;
+
+ public ScriptZoneLeaveEvent(EliteEntity customBossEntity, LivingEntity entity) {
+ this.eliteEntity = customBossEntity;
+ this.entity = entity;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/SuperMobDamageEvent.java b/src/main/java/com/magmaguy/elitemobs/api/SuperMobDamageEvent.java
deleted file mode 100644
index 10c701992..000000000
--- a/src/main/java/com/magmaguy/elitemobs/api/SuperMobDamageEvent.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.magmaguy.elitemobs.api;
-
-import com.magmaguy.elitemobs.entitytracker.EntityTracker;
-import com.magmaguy.elitemobs.utils.EventCaller;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.*;
-import org.bukkit.event.entity.EntityDamageEvent;
-
-public class SuperMobDamageEvent extends Event implements Cancellable {
-
- private static final HandlerList handlers = new HandlerList();
- private final LivingEntity livingEntity;
- private final EntityDamageEvent entityDamageEvent;
- private boolean cancelled = false;
-
- public SuperMobDamageEvent(LivingEntity livingEntity, EntityDamageEvent entityDamageEvent) {
- this.livingEntity = livingEntity;
- this.entityDamageEvent = entityDamageEvent;
- }
-
- public static void callEvent(LivingEntity livingEntity, EntityDamageEvent entityDamageEvent) {
- new EventCaller(new SuperMobDamageEvent(livingEntity, entityDamageEvent));
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- /**
- * Returns the entity being converted to an EliteMobEntity
- *
- * @return Entity being converted into an Elite Mob
- */
- public LivingEntity getLivingEntity() {
- return this.livingEntity;
- }
-
- public EntityDamageEvent getEntityDamageEvent() {
- return this.entityDamageEvent;
- }
-
- /**
- * Returns a list of handlers
- *
- * @return List of handlers
- */
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- @Override
- public boolean isCancelled() {
- return this.cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-
- public static class SuperMobDamageEventFilter implements Listener {
- @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
- public void superMobDamageFilter(EntityDamageEvent event) {
- if (!EntityTracker.isSuperMob(event.getEntity())) return;
- SuperMobDamageEvent superMobDamageEvent = new SuperMobDamageEvent((LivingEntity) event.getEntity(), event);
- new EventCaller(superMobDamageEvent);
- if (superMobDamageEvent.isCancelled()) event.setCancelled(true);
- }
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/SuperMobDeathEvent.java b/src/main/java/com/magmaguy/elitemobs/api/SuperMobDeathEvent.java
deleted file mode 100644
index 3dd5bda68..000000000
--- a/src/main/java/com/magmaguy/elitemobs/api/SuperMobDeathEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.magmaguy.elitemobs.api;
-
-import com.magmaguy.elitemobs.api.internal.RemovalReason;
-import com.magmaguy.elitemobs.entitytracker.EntityTracker;
-import com.magmaguy.elitemobs.utils.EventCaller;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.Event;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityDeathEvent;
-
-public class SuperMobDeathEvent extends Event {
-
- private static final HandlerList handlers = new HandlerList();
- private final LivingEntity livingEntity;
-
- public SuperMobDeathEvent(LivingEntity livingEntity) {
- this.livingEntity = livingEntity;
- new SuperMobRemoveEvent(livingEntity, RemovalReason.DEATH);
- }
-
- public static void callEvent(LivingEntity livingEntity) {
- new EventCaller(new SuperMobDeathEvent(livingEntity));
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- /**
- * Returns the entity being converted to an EliteMobEntity
- *
- * @return Entity being converted into an Elite Mob
- */
- public LivingEntity getLivingEntity() {
- return this.livingEntity;
- }
-
- /**
- * Returns a list of handlers
- *
- * @return List of handlers
- */
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static class SuperMobDeathEventFilter implements Listener {
- @EventHandler
- public void onMobDeath(EntityDeathEvent event) {
- if (!EntityTracker.isSuperMob(event.getEntity())) return;
- new EventCaller(new SuperMobDeathEvent(event.getEntity()));
- }
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/SuperMobRemoveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/SuperMobRemoveEvent.java
deleted file mode 100644
index fba138a9d..000000000
--- a/src/main/java/com/magmaguy/elitemobs/api/SuperMobRemoveEvent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.magmaguy.elitemobs.api;
-
-import com.magmaguy.elitemobs.api.internal.RemovalReason;
-import com.magmaguy.elitemobs.entitytracker.EntityTracker;
-import com.magmaguy.elitemobs.utils.EventCaller;
-import lombok.Getter;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-public class SuperMobRemoveEvent extends Event {
-
- private static final HandlerList handlers = new HandlerList();
- @Getter
- private final LivingEntity livingEntity;
-
- public SuperMobRemoveEvent(LivingEntity livingEntity, RemovalReason removalReason) {
- this.livingEntity = livingEntity;
- EntityTracker.unregister(livingEntity, removalReason);
- }
-
- public static void callEvent(LivingEntity livingEntity, RemovalReason removalReason) {
- new EventCaller(new SuperMobRemoveEvent(livingEntity, removalReason));
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- /**
- * Returns a list of handlers
- *
- * @return List of handlers
- */
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/SuperMobSpawnEvent.java b/src/main/java/com/magmaguy/elitemobs/api/SuperMobSpawnEvent.java
deleted file mode 100644
index bbf6ab762..000000000
--- a/src/main/java/com/magmaguy/elitemobs/api/SuperMobSpawnEvent.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.magmaguy.elitemobs.api;
-
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-
-public class SuperMobSpawnEvent extends Event implements Cancellable {
-
- private static final HandlerList handlers = new HandlerList();
- private final LivingEntity livingEntity;
- private boolean isCancelled = false;
-
- public SuperMobSpawnEvent(LivingEntity livingEntity) {
- this.livingEntity = livingEntity;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- /**
- * Returns the entity being converted to an EliteMobEntity
- *
- * @return Entity being converted into an Elite Mob
- */
- public LivingEntity getLivingEntity() {
- return this.livingEntity;
- }
-
- /**
- * Returns if the event is cancelled
- *
- * @return If the event is cancelled
- */
- @Override
- public boolean isCancelled() {
- return this.isCancelled;
- }
-
- /**
- * Cancels the event. This will cancel the formation of the Elite Mob and remove the living entity. Once cancelled it can't be uncancelled.
- *
- * @param cancel Cancels the event
- */
- @Override
- public void setCancelled(boolean cancel) {
- this.isCancelled = cancel;
- }
-
- /**
- * Returns a list of handlers
- *
- * @return List of handlers
- */
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java
index 8d0122de3..e60e5268b 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java
@@ -8,8 +8,8 @@
public class MatchInstantiateEvent extends Event implements MatchEvent, Cancellable {
private static final HandlerList handlers = new HandlerList();
- private boolean cancelled = false;
private final MatchInstance matchInstance;
+ private boolean cancelled = false;
public MatchInstantiateEvent(MatchInstance matchInstance) {
this.matchInstance = matchInstance;
diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java
index 09448ca25..1378d400f 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java
@@ -9,9 +9,9 @@
public class MatchJoinEvent extends Event implements MatchEvent, MatchPlayerEvent, Cancellable {
private static final HandlerList handlers = new HandlerList();
- private boolean cancelled = false;
private final MatchInstance matchInstance;
private final Player player;
+ private boolean cancelled = false;
public MatchJoinEvent(MatchInstance matchInstance, Player player) {
this.matchInstance = matchInstance;
diff --git a/src/main/java/com/magmaguy/elitemobs/api/internal/NewSchematicPackageRelativeBossLocationEvent.java b/src/main/java/com/magmaguy/elitemobs/api/internal/NewSchematicPackageRelativeBossLocationEvent.java
deleted file mode 100644
index 6d5f59eb3..000000000
--- a/src/main/java/com/magmaguy/elitemobs/api/internal/NewSchematicPackageRelativeBossLocationEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.magmaguy.elitemobs.api.internal;
-
-import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields;
-import com.magmaguy.elitemobs.dungeons.SchematicDungeonPackage;
-import lombok.Getter;
-import org.bukkit.Location;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.jetbrains.annotations.NotNull;
-
-
-public class NewSchematicPackageRelativeBossLocationEvent extends Event implements Cancellable {
-
- private static final HandlerList handlers = new HandlerList();
- @Getter
- private final SchematicDungeonPackage schematicDungeonPackage;
- @Getter
- private final Location relativeLocation;
- @Getter
- private final Location realLocation;
- @Getter
- private final CustomBossesConfigFields customBossesConfigFields;
- private boolean isCancelled = false;
-
- public NewSchematicPackageRelativeBossLocationEvent(SchematicDungeonPackage schematicDungeonPackage,
- Location relativeLocation,
- Location realLocation,
- CustomBossesConfigFields customBossesConfigFields) {
- this.schematicDungeonPackage = schematicDungeonPackage;
- this.relativeLocation = relativeLocation;
- this.realLocation = realLocation;
- this.customBossesConfigFields = customBossesConfigFields;
- if (relativeLocation == null) setCancelled(true);
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- @Override
- public boolean isCancelled() {
- return this.isCancelled;
- }
-
- @Override
- public void setCancelled(boolean b) {
- this.isCancelled = b;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return null;
- }
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java b/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java
index 1dca78eac..a6457ac7b 100644
--- a/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java
+++ b/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java
@@ -163,20 +163,20 @@ public static double getEliteDamageFromEliteAttributes(@Nullable ItemStack itemS
public static double getEliteDamageFromEnchantments(@Nullable ItemStack itemStack) {
if (itemStack == null) return 0;
//Elite Items may have elite enchantments associated to an item
- int enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.DAMAGE_ALL.getKey());
+ int enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.SHARPNESS.getKey());
if (enchantmentLevel > 0 && ItemSettingsConfig.isUseEliteEnchantments()) {
- enchantmentLevel -= Enchantment.DAMAGE_ALL.getMaxLevel();
+ enchantmentLevel -= Enchantment.SHARPNESS.getMaxLevel();
if (enchantmentLevel < 0) enchantmentLevel = 0;
} else {
- enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.ARROW_DAMAGE.getKey());
+ enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.POWER.getKey());
if (enchantmentLevel > 0 && ItemSettingsConfig.isUseEliteEnchantments())
- enchantmentLevel -= Enchantment.ARROW_DAMAGE.getMaxLevel();
+ enchantmentLevel -= Enchantment.POWER.getMaxLevel();
if (enchantmentLevel < 0) enchantmentLevel = 0;
}
if (enchantmentLevel < 1)
//Note: this means sharpness works on bows and that power works on weapons. By default, this state is not reachable, so it doesn't really matter.
- enchantmentLevel += itemStack.getEnchantmentLevel(Enchantment.ARROW_DAMAGE) + itemStack.getEnchantmentLevel(Enchantment.DAMAGE_ALL);
+ enchantmentLevel += itemStack.getEnchantmentLevel(Enchantment.POWER) + itemStack.getEnchantmentLevel(Enchantment.SHARPNESS);
if (enchantmentLevel == 0) return 0;
//This is how vanilla sharpness works. Might as well use it for everything.
return 1 + enchantmentLevel * 0.5;
@@ -222,7 +222,7 @@ public static double getArmorLevel(@Nullable ItemStack itemStack) {
public static double getBonusEliteDefense(@Nullable ItemStack itemStack) {
if (itemStack == null || itemStack.getItemMeta() == null) return 0D;
int enchantmentLevel = 0;
- enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.PROTECTION_ENVIRONMENTAL.getKey());
+ enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.PROTECTION.getKey());
return enchantmentLevel * .25;
}
@@ -253,7 +253,7 @@ public static boolean isWeapon(@Nullable ItemStack itemStack) {
itemStack.getType().equals(Material.STONE_HOE) ||
itemStack.getType().equals(Material.IRON_HOE) ||
itemStack.getType().equals(Material.DIAMOND_HOE) ||
- itemStack.getType().equals(Material.NETHERITE_HOE) ))
+ itemStack.getType().equals(Material.NETHERITE_HOE)))
return true;
return getWeaponLevel(itemStack) > 3.0;
}
@@ -266,11 +266,11 @@ public static void setEliteLevel(@Nullable ItemStack itemStack, int level) {
if (itemStack == null) return;
registerEliteItem(itemStack);
if (isWeapon(itemStack)) {
- double damage = calculateEliteBonus(itemStack,level);
+ double damage = calculateEliteBonus(itemStack, level);
if (damage > 0)
ItemTagger.setEliteDamageAttribute(itemStack, damage);
} else if (isArmor(itemStack)) {
- double defense = calculateEliteBonus(itemStack,level);
+ double defense = calculateEliteBonus(itemStack, level);
if (defense > 0)
ItemTagger.setEliteDefenseAttribute(itemStack, defense);
}
@@ -281,15 +281,16 @@ public static void setEliteLevel(@Nullable ItemStack itemStack, int level) {
* This returns how much elite damage an item would give, based on a level. This should be used when a level wants to
* be calculated instead of read, which should only be true when you're doing something tricky like temporarily limiting
* the level of items for instanced dungeons
+ *
* @param itemStack ItemStack to check the level of
- * @param level Level to calculate
+ * @param level Level to calculate
* @return Amount of damage an elite weapon of that level would deal
*/
- public static double calculateEliteBonus(ItemStack itemStack, int level){
+ public static double calculateEliteBonus(ItemStack itemStack, int level) {
if (isWeapon(itemStack)) {
return level * CombatSystem.DPS_PER_LEVEL / 1 / getAttackSpeed(itemStack) - getBaseDamage(itemStack);
} else if (isArmor(itemStack)) {
- return (level - CombatSystem.getMaterialTier(itemStack.getType())) / 4D;
+ return (level - CombatSystem.getMaterialTier(itemStack.getType())) / 4D;
}
return 0;
}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java
index 0eaf6afa7..f805347df 100644
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java
@@ -1,19 +1,14 @@
package com.magmaguy.elitemobs.collateralminecraftchanges;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.api.utils.EliteItemManager;
import com.magmaguy.elitemobs.config.ItemSettingsConfig;
import com.magmaguy.elitemobs.items.ItemTagger;
-import com.magmaguy.elitemobs.utils.EntityFinder;
import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerItemDamageEvent;
import org.bukkit.inventory.ItemStack;
@@ -21,6 +16,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
public class AlternativeDurabilityLoss implements Listener {
@@ -30,7 +26,7 @@ private static double durabilityLoss(ItemStack itemStack) {
int maxDurability = itemStack.getType().getMaxDurability() > (isWeaponMaterial ? 2000 : 1000) ? (isWeaponMaterial ? 2000 : 1000) : itemStack.getType().getMaxDurability();
double baseModifier = isWeaponMaterial ? 2000 : 1000;
double durabilityLoss = ((baseModifier - maxDurability) / baseModifier) * ItemSettingsConfig.getEliteDurabilityMultiplier();
- double durabilityLevel = 1 + (ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.DURABILITY.getKey()) / 4d);
+ double durabilityLevel = 1 + (ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.UNBREAKING.getKey()) / 4d);
double defaultMultiplier = 0.5; //just tweaking defaults
return durabilityLoss / durabilityLevel * defaultMultiplier;
}
@@ -46,7 +42,7 @@ private static boolean isOnLastDamage(ItemStack itemStack) {
public static void doDurabilityLoss(Player player) {
if (!ItemSettingsConfig.isEliteDurability()) return;
- ArrayList itemsList = new ArrayList<>(Arrays.asList(player.getInventory().getArmorContents()));
+ List itemsList = new ArrayList<>(Arrays.stream(player.getInventory().getArmorContents()).toList());
itemsList.add(player.getInventory().getItemInMainHand());
itemsList.add(player.getInventory().getItemInOffHand());
@@ -65,8 +61,9 @@ public static void doDurabilityLoss(Player player) {
if (ItemSettingsConfig.isPreventEliteItemsFromBreaking()) {
damageable.setDamage(maxDurability - 1);
itemStack.setItemMeta(damageable);
- } else
+ } else {
itemStack.setAmount(0);
+ }
}
}
@@ -82,32 +79,10 @@ public void onPlayerDeath(PlayerDeathEvent event) {
doDurabilityLoss(event.getEntity());
}
- @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
- public void onPlayerDamaged(EntityDamageEvent event) {
- if (!event.getEntity().getType().equals(EntityType.PLAYER)) return;
- //citizens spams this really hard for some reason
- if (event.getEntity().hasMetadata("NPC")) return;
- Player player = (Player) event.getEntity();
- for (ItemStack itemStack : player.getInventory().getArmorContents())
- if (isOnLastDamage(itemStack)) {
- player.getWorld().dropItem(player.getLocation(), itemStack.clone());
- itemStack.setAmount(0);
- player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getLowArmorDurabilityItemDropMessage()));
- }
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void onPlayerShoot(EntityShootBowEvent event) {
+ if (!EliteItemManager.isEliteMobsItem(event.getBow())) return;
+ if (isOnLastDamage(event.getBow())) event.setCancelled(true);
}
- @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
- public void onPlayerDamage(EntityDamageByEntityEvent event) {
- LivingEntity livingEntity = EntityFinder.filterRangedDamagers(event.getDamager());
- if (livingEntity == null) return;
- if (!livingEntity.getType().equals(EntityType.PLAYER)) return;
- Player player = (Player) livingEntity;
- ItemStack itemStack = player.getInventory().getItemInMainHand();
- if (isOnLastDamage(itemStack)) {
- player.getWorld().dropItem(player.getLocation(), itemStack.clone());
- itemStack.setAmount(0);
- player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getLowWeaponDurabilityItemDropMessage()));
- event.setCancelled(true);
- }
- }
}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java
index 720a51bc9..5655c3116 100644
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java
@@ -1,55 +1,14 @@
package com.magmaguy.elitemobs.collateralminecraftchanges;
-import com.magmaguy.elitemobs.api.EliteMobDeathEvent;
-import com.magmaguy.elitemobs.config.powers.PowersConfigFields;
-import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
-import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties;
-import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardSpawnEventBypasser;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.MagmaCube;
-import org.bukkit.entity.Slime;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-
-import java.util.HashSet;
-import java.util.concurrent.ThreadLocalRandom;
+import org.bukkit.event.entity.SlimeSplitEvent;
public class EliteSlimeDeathSplit implements Listener {
- @EventHandler
- public void EliteMobDeathEvent(EliteMobDeathEvent event) {
- if (!event.getEntity().getType().equals(EntityType.SLIME) &&
- !event.getEntity().getType().equals(EntityType.MAGMA_CUBE)) return;
- Slime slime = (Slime) event.getEntity();
- int size = slime.getSize() / 2;
- if (size < 1) return;
- slime.setSize(1);
- for (int i = 0; i < ThreadLocalRandom.current().nextInt(2) + 2; i++) {
- WorldGuardSpawnEventBypasser.forceSpawn();
- Slime newSlime;
- if (event.getEntity().getType() == EntityType.SLIME)
- newSlime = (Slime) slime.getLocation().getWorld().spawnEntity(slime.getLocation(), EntityType.SLIME);
- else
- newSlime = (MagmaCube) slime.getLocation().getWorld().spawnEntity(slime.getLocation(), EntityType.MAGMA_CUBE);
- newSlime.setSize(size);
- EliteEntity eliteEntity = new EliteEntity();
- eliteEntity.setLevel(event.getEliteEntity().getLevel());
- eliteEntity.setLivingEntity(newSlime, CreatureSpawnEvent.SpawnReason.SLIME_SPLIT);
- EliteMobProperties.getPluginData(EntityType.SLIME);
- eliteEntity.setDamageMultiplier(eliteEntity.getDamageMultiplier() / 2D);
- eliteEntity.setHealthMultiplier(eliteEntity.getHealthMultiplier() / 2D);
- eliteEntity.setVanillaLoot(event.getEliteEntity().isVanillaLoot());
- eliteEntity.setEliteLoot(event.getEliteEntity().isEliteLoot());
- eliteEntity.setRandomLoot(event.getEliteEntity().isRandomLoot());
-
- //refreshes the max health
- eliteEntity.setMaxHealth();
- HashSet powersConfigFields = new HashSet<>();
- event.getEliteEntity().getElitePowers().forEach(elitePower -> {
- if (elitePower.getPowersConfigFields() instanceof PowersConfigFields powersConfigFields1)
- powersConfigFields.add(powersConfigFields1);
- });
- eliteEntity.applyPowers(powersConfigFields);
- }
+ @EventHandler (ignoreCancelled = true, priority = EventPriority.HIGHEST)
+ public void SlimeSplitEvent(SlimeSplitEvent event){
+ if (EntityTracker.isEliteMob(event.getEntity())) event.setCancelled(true);
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java
index 75f6b4f94..cd1b6ca52 100644
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java
@@ -11,7 +11,7 @@
public class EnderCrystalDamageProtectionBypass implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
- if (!event.getEntity().getType().equals(EntityType.ENDER_CRYSTAL)) return;
+ if (!event.getEntity().getType().equals(EntityType.END_CRYSTAL)) return;
LivingEntity entity = EntityFinder.filterRangedDamagers(event.getDamager());
if (entity == null || !entity.getType().equals(EntityType.PLAYER)) return;
event.setCancelled(false);
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java
new file mode 100644
index 000000000..347370d56
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java
@@ -0,0 +1,20 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.config.DungeonsConfig;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageEvent;
+
+public class EnvironmentalDungeonDamage implements Listener {
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void onDamage(EntityDamageEvent event) {
+ if (!EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return;
+ switch (event.getCause()) {
+ case POISON -> event.setDamage(event.getDamage() * DungeonsConfig.getPoisonDamageMultiplier());
+ case WITHER -> event.setDamage(event.getDamage() * DungeonsConfig.getWitherDamageMultiplier());
+ case FIRE_TICK -> event.setDamage(event.getDamage() * DungeonsConfig.getFireDamageMultiplier());
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java
deleted file mode 100644
index 5e14a0ac8..000000000
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.magmaguy.elitemobs.collateralminecraftchanges;
-
-import com.magmaguy.elitemobs.entitytracker.EntityTracker;
-import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.world.ChunkLoadEvent;
-
-public class FindSuperMobs implements Listener {
-
- @EventHandler
- public void findSuperMob(ChunkLoadEvent event) {
- for (Entity entity : event.getChunk().getEntities())
- if (SuperMobProperties.isValidSuperMobType(entity))
- if (((LivingEntity) entity).getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() ==
- SuperMobProperties.getDataInstance(entity).getSuperMobMaxHealth())
- if (!EntityTracker.isSuperMob(entity))
- EntityTracker.registerSuperMob((LivingEntity) entity);
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java
new file mode 100644
index 000000000..7293e3822
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerRespawnEvent;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+
+public class FixPlayerOnLoginOrRespawn implements Listener {
+ @EventHandler
+ public void onPlayerRespawn(PlayerRespawnEvent event) {
+ event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 0));
+ event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 0, 0));
+ if (DefaultConfig.isResetPlayerScaleOnLogin())
+ event.getPlayer().getAttribute(Attribute.GENERIC_SCALE).setBaseValue(1f);
+ }
+
+ @EventHandler
+ public void onPlayerJoin(PlayerJoinEvent event) {
+ event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 0));
+ event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 0, 0));
+ if (DefaultConfig.isResetPlayerScaleOnLogin())
+ event.getPlayer().getAttribute(Attribute.GENERIC_SCALE).setBaseValue(1f);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java
index 464bbdf7b..36e73ea9b 100644
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java
@@ -1,7 +1,7 @@
package com.magmaguy.elitemobs.collateralminecraftchanges;
import com.magmaguy.elitemobs.items.ItemTagger;
-import com.magmaguy.elitemobs.utils.ItemStackGenerator;
+import com.magmaguy.magmacore.util.ItemStackGenerator;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java
index bd7a645b4..a3566e5c7 100644
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java
@@ -10,9 +10,9 @@
import org.bukkit.event.entity.EntityDamageByEntityEvent;
public class LightningImmunity implements Listener {
- @EventHandler (priority = EventPriority.LOWEST, ignoreCancelled = true)
- public void onLightningStrike(EntityDamageByEntityEvent event){
- if (!event.getDamager().getType().equals(EntityType.LIGHTNING)) return;
+ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ public void onLightningStrike(EntityDamageByEntityEvent event) {
+ if (!event.getDamager().getType().equals(EntityType.LIGHTNING_BOLT)) return;
EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
if (eliteEntity == null) return;
if (eliteEntity.hasPower(PowersConfig.getPower("attack_lightning.yml")) ||
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java
index 0da51884d..e102cee26 100644
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java
@@ -24,7 +24,7 @@ public static void bypass() {
@EventHandler(priority = EventPriority.HIGHEST)
public void onLightningSpawn(EntitySpawnEvent event) {
if (!bypass) return;
- if (!event.getEntity().getType().equals(EntityType.LIGHTNING)) return;
+ if (!event.getEntity().getType().equals(EntityType.LIGHTNING_BOLT)) return;
bypass = true;
event.setCancelled(false);
}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java
index b63e8168d..b3e8ea913 100644
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java
@@ -1,11 +1,11 @@
package com.magmaguy.elitemobs.collateralminecraftchanges;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig;
import com.magmaguy.elitemobs.entitytracker.EntityTracker;
import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
import com.magmaguy.elitemobs.playerdata.PlayerStatsTracker;
+import com.magmaguy.magmacore.util.ChatColorConverter;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java
new file mode 100644
index 000000000..3a88714f5
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java
@@ -0,0 +1,14 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.powers.scripts.ScriptAction;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+public class PlayerQuitCleanup implements Listener {
+ @EventHandler
+ public void onPlayerQuit(PlayerQuitEvent event) {
+ if (ScriptAction.getInvulnerablePlayers().contains(event.getPlayer()))
+ event.getPlayer().setInvulnerable(false);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java
deleted file mode 100644
index 5ea4bc713..000000000
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package com.magmaguy.elitemobs.collateralminecraftchanges;
-
-import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties;
-import org.bukkit.entity.*;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityDamageEvent;
-
-/**
- * Created by MagmaGuy on 22/04/2017.
- */
-public class PreventCreeperPassiveEntityDamage implements Listener {
-
- //This cancels all creeper and entity-caused explosion damage on passive mobs
- @EventHandler (ignoreCancelled = true)
- public void superCreeperCollateralDamageAvoider(EntityDamageEvent event) {
-
- if (event.getCause() == EntityDamageEvent.DamageCause.ENTITY_EXPLOSION) {
-
- if (SuperMobProperties.isValidSuperMobType(event.getEntityType()) ||
- event.getEntity() instanceof Horse || event.getEntity() instanceof Villager ||
- event.getEntity() instanceof Bat || event.getEntity() instanceof ArmorStand ||
- event.getEntity() instanceof Rabbit) {
-
- event.setDamage(0);
-
- }
-
- }
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java
index 631dbe4b2..3de63fa7d 100644
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java
@@ -1,8 +1,7 @@
package com.magmaguy.elitemobs.collateralminecraftchanges;
import com.magmaguy.elitemobs.items.ItemTagger;
-import com.magmaguy.elitemobs.utils.ItemStackGenerator;
-import com.magmaguy.elitemobs.versionnotifier.VersionChecker;
+import com.magmaguy.magmacore.util.ItemStackGenerator;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -14,9 +13,8 @@ public void UpgradeItemEvent(PrepareSmithingEvent event) {
if (!ItemTagger.isEliteItem(event.getInventory().getItem(0)) &&
!ItemTagger.isEliteItem(event.getInventory().getItem(1)))
return;
- if (VersionChecker.serverVersionOlderThan(20, 0) ||
- event.getInventory().getItem(0) != null &&
- event.getInventory().getItem(0).getType().equals(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE))
+ if (event.getInventory().getItem(0) != null &&
+ event.getInventory().getItem(0).getType().equals(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE))
event.setResult(ItemStackGenerator.generateItemStack(Material.AIR));
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java
index 871d11266..16fe8fbe2 100644
--- a/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java
@@ -1,6 +1,5 @@
package com.magmaguy.elitemobs.combatsystem;
-import com.magmaguy.elitemobs.versionnotifier.VersionChecker;
import org.bukkit.Material;
public class CombatSystem {
@@ -55,11 +54,10 @@ public static int getMaterialTier(Material material) {
case TURTLE_HELMET:
return GOLD_WOOD_LEATHER_TIER_LEVEL;
default:
- if (!VersionChecker.serverVersionOlderThan(16, 0) &&
- (material.equals(Material.NETHERITE_HELMET) ||
- material.equals(Material.NETHERITE_CHESTPLATE) ||
- material.equals(Material.NETHERITE_LEGGINGS) ||
- material.equals(Material.NETHERITE_BOOTS)))
+ if (material.equals(Material.NETHERITE_HELMET) ||
+ material.equals(Material.NETHERITE_CHESTPLATE) ||
+ material.equals(Material.NETHERITE_LEGGINGS) ||
+ material.equals(Material.NETHERITE_BOOTS))
return CombatSystem.NETHERITE_TIER_LEVEL;
}
return 0;
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java
index 741dfd3df..11bc31e52 100644
--- a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java
@@ -8,7 +8,7 @@
public class EliteMobDamagedByEliteMobHandler implements Listener {
- @EventHandler (ignoreCancelled = true)
+ @EventHandler(ignoreCancelled = true)
public void onIronGolemDamage(EliteMobDamagedByEliteMobEvent event) {
if (event.getDamager().getLivingEntity() == null || event.getDamagee().getLivingEntity() == null) return;
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java
index a9f963907..8401ac810 100644
--- a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java
@@ -22,6 +22,7 @@ public static Projectile create(EntityType entityType, Entity shooter, Entity vi
projectile.setShooter((ProjectileSource) shooter);
projectile.setVelocity(shotVector);
projectile.setGravity(gravity);
+ projectile.setPersistent(false);
EntityTracker.registerProjectileEntity(projectile);
return projectile;
}
@@ -37,6 +38,7 @@ public static Projectile create(EntityType entityType, Entity shooter, Vector ta
projectile.setShooter((ProjectileSource) shooter);
projectile.setVelocity(targetterToTargetted);
projectile.setGravity(gravity);
+ projectile.setPersistent(false);
EntityTracker.registerProjectileEntity(projectile);
return projectile;
}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java
index 114fffe5c..05cd00243 100644
--- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java
@@ -7,7 +7,7 @@
public class AmbientDamageExploit implements Listener {
- @EventHandler (ignoreCancelled = true)
+ @EventHandler(ignoreCancelled = true)
public void onDamage(GenericAntiExploitEvent event) {
if (!event.getEliteMobEntity().getLivingEntity().hasAI()) return;
if (!(event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.HOT_FLOOR) ||
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java
index 1f9cb2187..51ee70bd9 100644
--- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java
@@ -2,7 +2,6 @@
import com.magmaguy.elitemobs.api.GenericAntiExploitEvent;
import com.magmaguy.elitemobs.config.AntiExploitConfig;
-import com.magmaguy.elitemobs.versionnotifier.VersionChecker;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -12,7 +11,6 @@ public class HoneyBlockJumpExploit implements Listener {
@EventHandler
public void onDamage(GenericAntiExploitEvent event) {
if (!AntiExploitConfig.isHoneyBlockExploit()) return;
- if (VersionChecker.serverVersionOlderThan(15, 0)) return;
if (event.ground == null) return;
if (!event.ground.equals(Material.HONEY_BLOCK)) return;
event.getEliteMobEntity().incrementAntiExploit(5, "honeyexploit");
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java
index e8de64095..c6f537c58 100644
--- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java
@@ -19,7 +19,7 @@ public void onEntityDamage(EliteMobDamagedByPlayerAntiExploitEvent event) {
private void antiHopper(EliteMobDamagedByPlayerAntiExploitEvent event) {
if (!AntiExploitConfig.isLargeDarkroomAntiExploit1()) return;
- if (event.getEliteMobEntity().getLivingEntity().getLocation().getBlock().getLocation().clone().subtract(new Vector(0, 1, 0)).getBlock().getType().equals(Material.HOPPER) ) {
+ if (event.getEliteMobEntity().getLivingEntity().getLocation().getBlock().getLocation().clone().subtract(new Vector(0, 1, 0)).getBlock().getType().equals(Material.HOPPER)) {
event.getEliteMobEntity().incrementAntiExploit(5, "largeRoomAntiExploit1");
event.setTriggered(true);
}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java
index c33e151cf..741ba3d44 100644
--- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java
@@ -4,7 +4,7 @@
import com.magmaguy.elitemobs.entitytracker.EntityTracker;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
-import org.spigotmc.event.entity.EntityMountEvent;
+import org.bukkit.event.entity.EntityMountEvent;
public class PreventMountExploit implements Listener {
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java
index 5d5f049e8..a1e9652a4 100644
--- a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java
@@ -2,6 +2,8 @@
import com.magmaguy.easyminecraftgoals.NMSManager;
import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerAntiExploitEvent;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
+import org.bukkit.entity.Mob;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -11,8 +13,11 @@ public void OnEliteDamagedbyPlayerEvent(EliteMobDamagedByPlayerAntiExploitEvent
if (event.isCancelled()) return;
if (event.getEliteMobEntity().getLivingEntity() == null) return;
if (!NMSManager.isEnabled()) return;
+ //Only mobs pathfind
+ if (!(event.getEliteMobEntity().getLivingEntity() instanceof Mob)) return;
if (NMSManager.getAdapter().canReach(event.getEliteMobEntity().getLivingEntity(), event.getEliteMobDamagedByPlayerEvent().getPlayer().getLocation()))
return;
+ if (EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return;
event.getEliteMobEntity().incrementAntiExploit(5, "no path to player");
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java
index 1c5589c79..adedaeaea 100644
--- a/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java
@@ -56,7 +56,7 @@ public void run() {
cancel();
if (player.isOnGround()) {
cancel();
- player.removePotionEffect(PotionEffectType.SLOW);
+ player.removePotionEffect(PotionEffectType.SLOWNESS);
}
}
}.runTaskTimer(MetadataHandler.PLUGIN, 0, 1);
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java
index a53f51b46..2426f38f3 100644
--- a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java
@@ -10,14 +10,15 @@
import com.magmaguy.elitemobs.items.customenchantments.CriticalStrikesEnchantment;
import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
import com.magmaguy.elitemobs.utils.DialogArmorStand;
-import com.magmaguy.elitemobs.utils.Round;
-import com.magmaguy.elitemobs.utils.VisualArmorStand;
+import com.magmaguy.elitemobs.utils.VisualDisplay;
+import com.magmaguy.magmacore.util.Round;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
+import org.bukkit.entity.TextDisplay;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@@ -64,7 +65,7 @@ public void onHit(EliteMobDamagedByPlayerEvent event) {
}
DialogArmorStand.createDialogArmorStand(event.getEliteMobEntity().getUnsyncedLivingEntity(), ChatColor.RED +
- colorPrefix + "" + ChatColor.BOLD + "" + Round.twoDecimalPlaces(event.getDamage()) + "", offset);
+ colorPrefix + ChatColor.BOLD + Round.twoDecimalPlaces(event.getDamage()), offset);
}
@@ -89,7 +90,7 @@ private void resistArmorStandCreator(EliteEntity eliteEntity, Player player, Mat
if (!eliteEntity.isValid() || !player.isValid() || !eliteEntity.getLocation().getWorld().equals(player.getWorld()))
return;
- ArmorStand armorStand = VisualArmorStand.VisualArmorStand(getResistLocation(player, eliteEntity), "Resist");
+ ArmorStand armorStand = VisualDisplay.generateTemporaryArmorStand(getResistLocation(player, eliteEntity), "Resist");
armorStand.getEquipment().setItemInMainHand(new ItemStack(material));
armorStand.addEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.REMOVING_OR_CHANGING);
armorStand.setRightArmPose(new EulerAngle(Math.PI / 2d, Math.PI + Math.PI / 2d, Math.PI));
@@ -125,9 +126,9 @@ private void weakArmorStandCreator(EliteEntity eliteEntity, Player player, Mater
if (!eliteEntity.isValid() || !player.isValid() || !eliteEntity.getLocation().getWorld().equals(player.getWorld()))
return;
- ArmorStand[] armorStands = new ArmorStand[2];
- armorStands[0] = generateWeakArmorStand(player, eliteEntity, material, -1);
- armorStands[1] = generateWeakArmorStand(player, eliteEntity, material, 1);
+ TextDisplay[] textDisplays = new TextDisplay[2];
+ textDisplays[0] = generateWeakArmorStand(player, eliteEntity, material, -1);
+ textDisplays[1] = generateWeakArmorStand(player, eliteEntity, material, 1);
new BukkitRunnable() {
int counter = 0;
@@ -135,12 +136,12 @@ private void weakArmorStandCreator(EliteEntity eliteEntity, Player player, Mater
@Override
public void run() {
if (counter > 10 || !eliteEntity.isValid() || !player.isValid() || !eliteEntity.getLocation().getWorld().equals(player.getWorld())) {
- EntityTracker.unregister(armorStands[0], RemovalReason.EFFECT_TIMEOUT);
- EntityTracker.unregister(armorStands[1], RemovalReason.EFFECT_TIMEOUT);
+ EntityTracker.unregister(textDisplays[0], RemovalReason.EFFECT_TIMEOUT);
+ EntityTracker.unregister(textDisplays[1], RemovalReason.EFFECT_TIMEOUT);
cancel();
return;
}
- for (ArmorStand armorStand : armorStands)
+ for (TextDisplay armorStand : textDisplays)
armorStand.teleport(armorStand.getLocation().add(eliteEntity.getLocation().add(new Vector(0, 0, 0))
.subtract(armorStand.getLocation()).toVector().normalize().multiply(.4)));
counter++;
@@ -148,15 +149,11 @@ public void run() {
}.runTaskTimer(MetadataHandler.PLUGIN, 1, 1);
}
- private ArmorStand generateWeakArmorStand(Player player, EliteEntity eliteEntity, Material material, int offset) {
+ private TextDisplay generateWeakArmorStand(Player player, EliteEntity eliteEntity, Material material, int offset) {
Vector armorsStandVector = player.getLocation().clone().add(new Vector(0, 2, 0)).subtract(eliteEntity.getLocation()).toVector().normalize().multiply(3.0).rotateAroundY(Math.PI / 8 * offset);
Location armorStandLocation = eliteEntity.getLocation().add(armorsStandVector);
armorStandLocation.setDirection(armorsStandVector.multiply(-1));
- ArmorStand armorStand = VisualArmorStand.VisualArmorStand(armorStandLocation, "Weak");
- armorStand.getEquipment().setHelmet(new ItemStack(material));
- armorStand.addEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.REMOVING_OR_CHANGING);
- armorStand.setHeadPose(new EulerAngle(-Math.PI - Math.PI / 4D, Math.PI / 4D, 0));
- return armorStand;
+ return VisualDisplay.generateTemporaryTextDisplay(armorStandLocation, "Weak");
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java
deleted file mode 100644
index 419fafcc7..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/AdminCommands.java
+++ /dev/null
@@ -1,983 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import cloud.commandframework.ArgumentDescription;
-import cloud.commandframework.Command;
-import cloud.commandframework.arguments.CommandArgument;
-import cloud.commandframework.arguments.standard.*;
-import cloud.commandframework.bukkit.BukkitCommandManager;
-import cloud.commandframework.meta.CommandMeta;
-import cloud.commandframework.types.tuples.Triplet;
-import com.magmaguy.elitemobs.ChatColorConverter;
-import com.magmaguy.elitemobs.api.utils.EliteItemManager;
-import com.magmaguy.elitemobs.commands.admin.*;
-import com.magmaguy.elitemobs.commands.quests.QuestCommand;
-import com.magmaguy.elitemobs.commands.setup.SetupMenu;
-import com.magmaguy.elitemobs.config.ConfigurationExporter;
-import com.magmaguy.elitemobs.config.DefaultConfig;
-import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
-import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields;
-import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfig;
-import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig;
-import com.magmaguy.elitemobs.config.npcs.NPCsConfig;
-import com.magmaguy.elitemobs.config.translations.TranslationsConfig;
-import com.magmaguy.elitemobs.config.wormholes.WormholeConfig;
-import com.magmaguy.elitemobs.dungeons.EMPackage;
-import com.magmaguy.elitemobs.entitytracker.EntityTracker;
-import com.magmaguy.elitemobs.events.TimedEvent;
-import com.magmaguy.elitemobs.items.ItemTagger;
-import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment;
-import com.magmaguy.elitemobs.items.customitems.CustomItem;
-import com.magmaguy.elitemobs.menus.CustomShopMenu;
-import com.magmaguy.elitemobs.menus.GetLootMenu;
-import com.magmaguy.elitemobs.menus.ProceduralShopMenu;
-import com.magmaguy.elitemobs.menus.SellMenu;
-import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
-import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
-import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
-import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand;
-import com.magmaguy.elitemobs.powers.meta.ElitePower;
-import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement;
-import com.magmaguy.elitemobs.utils.DebugMessage;
-import com.magmaguy.elitemobs.utils.DiscordLinks;
-import com.magmaguy.elitemobs.wormhole.Wormhole;
-import io.leangen.geantyref.TypeToken;
-import org.bukkit.Bukkit;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Fireball;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.Vector;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-public class AdminCommands {
-
- public AdminCommands(BukkitCommandManager manager, Command.Builder builder) {
-
- // /em setup
- manager.command(builder.literal("setup")
- .meta(CommandMeta.DESCRIPTION, "Opens the main setup menu")
- .senderType(Player.class)
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SetupHandler.setupMenuCommand((Player) commandContext.getSender())));
-
- // /em setup done
- manager.command(builder.literal("setup")
- .literal("done")
- .meta(CommandMeta.DESCRIPTION, "Stops showing messages on admin login.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> {
- DefaultConfig.toggleSetupDone();
- if (DefaultConfig.isSetupDone())
- commandContext.getSender().sendMessage(ChatColorConverter.convert("&8[EliteMobs] &aEliteMobs" +
- " will no longer send messages on login. You can do [/em setup done] again to revert this."));
- else commandContext.getSender().sendMessage(ChatColorConverter.convert("&8[EliteMobs] &aEliteMobs" +
- " will once again send messages on login. You can do [/em setup done] again to revert this."));
- }));
-
- // /em setup minidungeon
- manager.command(builder.literal("setup")
- .literal("minidungeon")
- .argument(StringArgument.newBuilder("minidungeonName"), ArgumentDescription.of("minidungeon name"))
- .meta(CommandMeta.DESCRIPTION, "Installs a Minidungeon")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SetupHandler.setupMinidungeonCommand((Player) commandContext.getSender(), commandContext.get("minidungeonName"))));
-
- // /em setup minidungeonNoPaste
- manager.command(builder.literal("setup")
- .literal("minidungeonNoPaste")
- .argument(StringArgument.newBuilder("minidungeonName"), ArgumentDescription.of("minidungeon name"))
- .meta(CommandMeta.DESCRIPTION, "Installs a Minidungeon without pasting the WorldEdit schematic")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SetupHandler.setupMinidungeonNoPasteCommand((Player) commandContext.getSender(), commandContext.get("minidungeonName"))));
-
- // /em setup unminidungeon
- manager.command(builder.literal("setup")
- .literal("unminidungeon")
- .argument(StringArgument.newBuilder("minidungeonName"), ArgumentDescription.of("minidungeon name"))
- .meta(CommandMeta.DESCRIPTION, "Uninstalls a Minidungeon")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SetupHandler.setupUnminidungeonCommand((Player) commandContext.getSender(), commandContext.get("minidungeonName"))));
-
-
- // /em setup area
- manager.command(builder.literal("setup")
- .literal("area")
- .argument(StringArgument.newBuilder("areaName"), ArgumentDescription.of("WorldGuard region name"))
- .meta(CommandMeta.DESCRIPTION, "Protects an area using WorldGuard, used for Minidungeons and the Adventurer's World Hub")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SetupHandler.setupAreaCommand((Player) commandContext.getSender(), commandContext.get("areaName"))));
-
- ArrayList powers = new ArrayList<>();
- for (String filename : ElitePower.getElitePowers().keySet())
- powers.add(filename);
- powers.add("custom");
-
- // /em spawnelite
- manager.command(builder.literal("spawnelite")
- .argument(EnumArgument.newBuilder(EntityType.class, "entityType"),
- ArgumentDescription.of("Minecraft Entity Type, must be a valid type for an Elite"))
- .argument(IntegerArgument.newBuilder("eliteLevel"), ArgumentDescription.of("Elite Mob level"))
- .argument(StringArrayArgument.optional("powers", ((commandContext, lastString) -> powers)),
- ArgumentDescription.of("List of powers"))
- .meta(CommandMeta.DESCRIPTION, "Spawns an Elite based on the entity type.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SpawnCommand.spawnEliteEntityTypeCommand(
- (Player) commandContext.getSender(),
- commandContext.get("entityType"),
- commandContext.get("eliteLevel"),
- commandContext.getOptional("powers"))));
-
- // /em spawnlocationelite
- manager.command(builder.literal("spawnlocationelite")
- .argument(EnumArgument.newBuilder(EntityType.class, "entityType"),
- ArgumentDescription.of("Minecraft Entity Type, must be a valid type for an Elite"))
- .argument(StringArgument.newBuilder("worldName"), ArgumentDescription.of("Name of the world"))
- .argumentTriplet("coords",
- TypeToken.get(Vector.class),
- Triplet.of("x", "y", "z"),
- Triplet.of(Integer.class, Integer.class, Integer.class),
- (sender, triplet) -> new Vector(triplet.getFirst(), triplet.getSecond(), triplet.getThird()),
- ArgumentDescription.of("Coordinates"))
- .argument(IntegerArgument.newBuilder("eliteLevel"), ArgumentDescription.of("Elite Mob level"))
- .argument(StringArrayArgument.optional("powers", ((commandContext, lastString) -> powers)),
- ArgumentDescription.of("List of powers"))
- .meta(CommandMeta.DESCRIPTION, "Spawns an Elite based on the entity type and location.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SpawnCommand.spawnEliteEntityTypeCommand(
- commandContext.getSender(),
- commandContext.get("entityType"),
- commandContext.get("worldName"),
- commandContext.get("coords"),
- commandContext.get("eliteLevel"),
- commandContext.getOptional("powers"))));
-
- ArrayList customBosses = new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet());
- ArrayList regionalBosses = new ArrayList<>(CustomBossesConfigFields.getRegionalElites().keySet());
-
- // /em spawncustom
- manager.command(builder.literal("spawncustom", "spawncustomboss")
- .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)),
- ArgumentDescription.of("Custom Boss configuration file name"))
- .meta(CommandMeta.DESCRIPTION, "Spawns an Elite based on the entity type.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SpawnCommand.spawnCustomBossCommand(
- (Player) commandContext.getSender(),
- commandContext.get("fileName"))));
-
- // /em spawncustomlevel
- manager.command(builder.literal("spawncustomlevel", "spawncustombosslevel")
- .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)),
- ArgumentDescription.of("Custom Boss configuration file name"))
- .argument(IntegerArgument.newBuilder("eliteLevel"), ArgumentDescription.of("Elite Mob level"))
- .meta(CommandMeta.DESCRIPTION, "Spawns a Custom Boss at a specific level.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SpawnCommand.spawnCustomBossCommand(
- (Player) commandContext.getSender(),
- commandContext.get("fileName"),
- commandContext.get("eliteLevel"))));
-
- // /em spawnlocationcustom
- manager.command(builder.literal("spawnlocationcustom", "spawnlocationcustomboss")
- .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)),
- ArgumentDescription.of("Custom Boss configuration file name"))
- .argument(StringArgument.newBuilder("worldName"), ArgumentDescription.of("Name of the world"))
- .argumentTriplet("coords",
- TypeToken.get(Vector.class),
- Triplet.of("x", "y", "z"),
- Triplet.of(Integer.class, Integer.class, Integer.class),
- (sender, triplet) -> new Vector(triplet.getFirst(), triplet.getSecond(), triplet.getThird()),
- ArgumentDescription.of("Coordinates"))
- .meta(CommandMeta.DESCRIPTION, "Spawns an Elite based on the entity type and location.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SpawnCommand.spawnCustomBossCommand(
- commandContext.getSender(),
- commandContext.get("fileName"),
- commandContext.get("worldName"),
- commandContext.get("coords"))));
-
- // /em spawnlocationcustomlevel
- manager.command(builder.literal("spawnlocationcustomlevel", "spawnlocationcustombosslevel")
- .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)),
- ArgumentDescription.of("Custom Boss configuration file name"))
- .argument(IntegerArgument.newBuilder("eliteLevel"), ArgumentDescription.of("Elite Mob level"))
- .argument(StringArgument.newBuilder("worldName"), ArgumentDescription.of("Name of the world"))
- .argumentTriplet("coords",
- TypeToken.get(Vector.class),
- Triplet.of("x", "y", "z"),
- Triplet.of(Integer.class, Integer.class, Integer.class),
- (sender, triplet) -> new Vector(triplet.getFirst(), triplet.getSecond(), triplet.getThird()),
- ArgumentDescription.of("Coordinates"))
- .meta(CommandMeta.DESCRIPTION, "Spawns an Elite based on the entity type and location.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SpawnCommand.spawnCustomBossCommand(
- commandContext.getSender(),
- commandContext.get("fileName"),
- commandContext.get("worldName"),
- commandContext.get("coords"),
- commandContext.get("eliteLevel"))));
-
- // /em spawnsuper
- manager.command(builder.literal("spawnsuper", "spawnsupermob")
- .argument(EnumArgument.newBuilder(EntityType.class, "entityType"),
- ArgumentDescription.of("Minecraft Entity Type, must be a valid type for a Super Mob"))
- .meta(CommandMeta.DESCRIPTION, "Spawns a Super Mob based on the entity type.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SpawnCommand.spawnSuperMobCommand(
- (Player) commandContext.getSender(),
- commandContext.get("entityType"))));
-
- // /em addSpawnLocation
- manager.command(builder.literal("addSpawnLocation", "asp")
- .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> regionalBosses)),
- ArgumentDescription.of("Custom Boss configuration file name"))
- .meta(CommandMeta.DESCRIPTION, "Adds a spawn location to a Regional Boss.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> CustomBossCommandHandler.addSpawnLocation(
- commandContext.get("fileName"), (Player) commandContext.getSender())));
-
- List treasureChestFilenames = new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet());
-
- // /em addTreasureChest
- manager.command(builder.literal("addTreasureChest", "atc")
- .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> treasureChestFilenames)),
- ArgumentDescription.of("Treasure Chest configuration file name"))
- .meta(CommandMeta.DESCRIPTION, "Adds a location to a Treasure Chest.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> CustomTreasureChestsConfig.addTreasureChestEntry(
- (Player) commandContext.getSender(), commandContext.get("fileName"))));
-
- ArrayList minidungeonFileNames = new ArrayList<>(EMPackage.getEmPackages().keySet());
-
- // /em addRelativeSpawnLocation
- manager.command(builder.literal("addRelativeSpawnLocation", "arsp")
- .argument(StringArgument.newBuilder("bossFileName").withSuggestionsProvider(((objectCommandContext, s) -> regionalBosses)),
- ArgumentDescription.of("Custom Boss configuration file name"))
- .argument(StringArgument.newBuilder("minidungeonFileName").withSuggestionsProvider(((objectCommandContext, s) -> minidungeonFileNames)),
- ArgumentDescription.of("Minidungeon configuration file name"))
- .meta(CommandMeta.DESCRIPTION, "Adds a spawn location to a Regional Boss.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> CustomBossCommandHandler.addRelativeSpawnLocation(
- (Player) commandContext.getSender(), commandContext.get("bossFileName"), commandContext.get("minidungeonFileName"))));
-
- // /em addRelativeTreasureChest
- manager.command(builder.literal("addRelativeTreasureChest", "artc")
- .argument(StringArgument.newBuilder("treasureChestFilename").withSuggestionsProvider(((objectCommandContext, s) -> treasureChestFilenames)),
- ArgumentDescription.of("Treasure Chest configuration file name"))
- .argument(StringArgument.newBuilder("minidungeonFileName").withSuggestionsProvider(((objectCommandContext, s) -> minidungeonFileNames)),
- ArgumentDescription.of("Minidungeon configuration file name"))
- .meta(CommandMeta.DESCRIPTION, "Adds a spawn location to a Regional Boss.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> TreasureChestCommands.addRelativeTreasureChest(
- (Player) commandContext.getSender(), commandContext.get("treasureChestFilename"), commandContext.get("minidungeonFileName"))));
-
- // /em setLeashRadius
- manager.command(builder.literal("setLeashRadius")
- .argument(StringArgument.newBuilder("fileName").withSuggestionsProvider(((objectCommandContext, s) -> regionalBosses)),
- ArgumentDescription.of("Custom Boss configuration file name"))
- .argument(DoubleArgument.newBuilder("radius"), ArgumentDescription.of("Radius of the Regional Boss leash"))
- .meta(CommandMeta.DESCRIPTION, "Adds a spawn location to a Regional Boss.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> CustomBossCommandHandler.setLeashRadius(
- commandContext.get("fileName"), commandContext.getSender(), commandContext.get("radius"))));
-
- // /em remove
- manager.command(builder.literal("remove", "r")
- .meta(CommandMeta.DESCRIPTION, "Permanently removes an Elite Mob entity. Elite/Regional/Super/NPCs all work.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> RemoveCommand.remove((Player) commandContext.getSender())));
-
-
- // /em debug
- manager.command(builder.literal("debug", "d")
- .argument(StringArgument.newBuilder("argument").withSuggestionsProvider(((objectCommandContext, s) -> {
- ArrayList arrayList = new ArrayList((Collection extends String>) regionalBosses.clone());
- Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName()));
- return arrayList;
- })),
- ArgumentDescription.of("Player name or regional boss file name"))
- .meta(CommandMeta.DESCRIPTION, "Opens a debug screen for players or regional bosses.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> DebugScreen.open((Player) commandContext.getSender(), commandContext.get("argument"))));
-
- ArrayList events = new ArrayList<>();
- TimedEvent.getBlueprintEvents().stream().forEach(event -> events.add(event.getCustomEventsConfigFields().getFilename()));
-
- // /em event
- manager.command(builder.literal("event")
- .argument(StringArgument.newBuilder("events").withSuggestionsProvider(((objectCommandContext, s) -> events)),
- ArgumentDescription.of("Custom Boss configuration file name"))
- .meta(CommandMeta.DESCRIPTION, "Opens a debug screen for players or regional bosses.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> EventCommand.trigger(commandContext.getSender(), commandContext.get("events"))));
-
- ArrayList npcs = new ArrayList<>(NPCsConfig.npcEntities.keySet());
-
- // /em spawnnpc
- manager.command(builder.literal("spawnnpc")
- .argument(StringArgument.newBuilder("npcFileName").withSuggestionsProvider(((objectCommandContext, s) -> npcs)),
- ArgumentDescription.of("Custom Boss configuration file name"))
- .meta(CommandMeta.DESCRIPTION, "Spawns an NPC")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> NPCCommands.set((Player) commandContext.getSender(), commandContext.get("npcFileName"))));
-
- // /em stats
- manager.command(builder.literal("stats")
- .meta(CommandMeta.DESCRIPTION, "Gets the stats for the currently active EliteMobs entities and players.")
- .senderType(CommandSender.class)
- .permission("elitemobs.stats")
- .handler(commandContext -> StatsCommand.statsHandler(commandContext.getSender())));
-
- // /em getloot
- manager.command(builder.literal("getloot")
- .meta(CommandMeta.DESCRIPTION, "Opens a menu where you can get any Custom Loot")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> new GetLootMenu((Player) commandContext.getSender())));
-
- ArrayList customItems = new ArrayList<>(CustomItem.getCustomItems().keySet());
-
- // /em getloot
- manager.command(builder.literal("getloot")
- .argument(StringArgument.newBuilder("customItem").withSuggestionsProvider(((objectCommandContext, s) -> customItems)),
- ArgumentDescription.of("File name of the custom item"))
- .meta(CommandMeta.DESCRIPTION, "Gets a specific custom item")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> LootCommand.get((Player) commandContext.getSender(), commandContext.get("customItem"))));
-
- // /em give
- manager.command(builder.literal("give")
- .argument(StringArgument.newBuilder("customItem").withSuggestionsProvider(((objectCommandContext, s) -> customItems)),
- ArgumentDescription.of("File name of the custom item"))
- .argument(StringArgument.newBuilder("player").withSuggestionsProvider(((objectCommandContext, s) -> {
- ArrayList arrayList = new ArrayList<>();
- Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName()));
- return arrayList;
- })),
- ArgumentDescription.of("Name of the player that will get the custom item"))
- .meta(CommandMeta.DESCRIPTION, "Gives a specific custom item to a player.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> LootCommand.give(commandContext.getSender(),
- commandContext.get("player"),
- commandContext.get("customItem"))));
-
- // /em simloot
- manager.command(builder.literal("simloot")
- .argument(IntegerArgument.newBuilder("level"),
- ArgumentDescription.of("Level of Elite Mob to simulate"))
- .meta(CommandMeta.DESCRIPTION, "Simulates drops from an Elite Mob from the set tier")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SimLootCommand.run((Player) commandContext.getSender(), commandContext.get("level"), true)));
-
- // /em randomloot
- manager.command(builder.literal("randomloot")
- .argument(IntegerArgument.newBuilder("level"),
- ArgumentDescription.of("Level of Elite Mob to randomize"))
- .argument(StringArgument.newBuilder("player").withSuggestionsProvider(((objectCommandContext, s) -> {
- ArrayList arrayList = new ArrayList<>();
- Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName()));
- return arrayList;
- })),
- ArgumentDescription.of("Name of the player that will get the custom item"))
- .meta(CommandMeta.DESCRIPTION, "Randomizes drops from an Elite Mob from the set level")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SimLootCommand.forcePositiveLoot(commandContext.getSender(), commandContext.get("player"), commandContext.get("level"))));
-
- // /em simloot
- manager.command(builder.literal("simloot")
- .argument(IntegerArgument.newBuilder("level"),
- ArgumentDescription.of("Level of Elite Mob to simulate"))
- .argument(IntegerArgument.newBuilder("times"),
- ArgumentDescription.of("Number of times that the simulation will run"))
- .meta(CommandMeta.DESCRIPTION, "Simulates drops from an Elite Mob from the set tier a set amount of times")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SimLootCommand.runMultipleTimes(
- (Player) commandContext.getSender(),
- commandContext.get("level"),
- commandContext.get("times"))));
-
- // /em simlootspecial
- manager.command(builder.literal("simlootspecial")
- .argument(IntegerArgument.newBuilder("times"),
- ArgumentDescription.of("Number of times that the simulation will run"))
- .meta(CommandMeta.DESCRIPTION, "Simulates special drops from an Elite Mob a set amount of times")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SimLootCommand.simulateSpecialLoot(
- (Player) commandContext.getSender(),
- commandContext.get("times"))));
-
- // /em simlootother
- manager.command(builder.literal("simlootother")
- .argument(IntegerArgument.newBuilder("level"),
- ArgumentDescription.of("Level of Elite Mob to simulate"))
- .meta(CommandMeta.DESCRIPTION, "Simulates drops from an Elite Mob from the set tier")
- .argument(StringArgument.newBuilder("player").withSuggestionsProvider(((objectCommandContext, s) -> {
- ArrayList arrayList = new ArrayList<>();
- Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName()));
- return arrayList;
- })),
- ArgumentDescription.of("Name of the player that will get the custom item"))
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SimLootCommand.run(commandContext.getSender(), commandContext.get("level"), commandContext.get("player"))));
-
- // /em simlootothermultiple
- manager.command(builder.literal("simlootothermultiple")
- .argument(IntegerArgument.newBuilder("level"),
- ArgumentDescription.of("Level of Elite Mob to simulate"))
- .argument(IntegerArgument.newBuilder("times"),
- ArgumentDescription.of("Number of times that the simulation will run"))
- .meta(CommandMeta.DESCRIPTION, "Simulates drops from an Elite Mob from the set tier a set amount of times")
- .argument(StringArgument.newBuilder("target").withSuggestionsProvider(((objectCommandContext, s) -> {
- ArrayList arrayList = new ArrayList<>();
- Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName()));
- return arrayList;
- })),
- ArgumentDescription.of("Name of the player that will get the custom item"))
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> SimLootCommand.runMultipleTimes(
- commandContext.getSender(),
- commandContext.get("level"),
- commandContext.get("times"),
- commandContext.get("target"))));
-
- // /em version
- manager.command(builder.literal("version")
- .meta(CommandMeta.DESCRIPTION, "Gets the version of the plugin")
- .senderType(CommandSender.class)
- .permission("elitemobs.version")
- .handler(commandContext -> VersionCommand.getVersion(commandContext.getSender())));
-
- // /em reload
- manager.command(builder.literal("reload")
- .meta(CommandMeta.DESCRIPTION, "Reloads the plugin. Works almost every time.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> ReloadCommand.reload(commandContext.getSender())));
-
- // /em killaggressive
- manager.command(builder.literal("killaggressive")
- .meta(CommandMeta.DESCRIPTION, "Kills all aggressive Elite Mobs.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> KillHandler.killAggressiveMobs(commandContext.getSender())));
-
- // /em killaggressive
- manager.command(builder.literal("killaggressive")
- .argument(IntegerArgument.newBuilder("radius"),
- ArgumentDescription.of("Distance to kill aggressive elite mobs in"))
- .meta(CommandMeta.DESCRIPTION, "Kills all aggressive Elite Mobs in a radius.")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> KillHandler.radiusKillAggressiveMobs((Player) commandContext.getSender(), commandContext.get("radius"))));
-
- // /em killpassive
- manager.command(builder.literal("killpassive")
- .meta(CommandMeta.DESCRIPTION, "Kills all passive Super Mobs")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> KillHandler.killPassiveMobs(commandContext.getSender())));
-
- // /em killpassive
- manager.command(builder.literal("killpassive")
- .argument(IntegerArgument.newBuilder("radius"),
- ArgumentDescription.of("Distance to kill aggressive elite mobs in"))
- .meta(CommandMeta.DESCRIPTION, "Kills all passive Super Mobs in a radius")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> KillHandler.radiusKillPassiveMobs((Player) commandContext.getSender(), commandContext.get("radius"))));
-
-
- // /em killtype
- manager.command(builder.literal("killtype")
- .argument(EnumArgument.newBuilder(EntityType.class, "entityType"),
- ArgumentDescription.of("Minecraft Entity Type to kill"))
- .meta(CommandMeta.DESCRIPTION, "Kills all elites of a specific type")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> KillHandler.killEntityType(commandContext.getSender(), commandContext.get("entityType"))));
-
- // /em killtype
- manager.command(builder.literal("killtype")
- .argument(EnumArgument.newBuilder(EntityType.class, "entityType"),
- ArgumentDescription.of("Minecraft Entity Type to kill"))
- .argument(IntegerArgument.newBuilder("radius"),
- ArgumentDescription.of("Distance to kill aggressive elite mobs in"))
- .meta(CommandMeta.DESCRIPTION, "Kills all elites of a specific type in a radius")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> KillHandler.radiusKillSpecificMobs((Player) commandContext.getSender(),
- commandContext.get("entityType"),
- commandContext.get("radius"))));
-
- // /em gettier
- manager.command(builder.literal("gettier")
- .argument(IntegerArgument.newBuilder("tier"),
- ArgumentDescription.of("Tier of the item to get"))
- .meta(CommandMeta.DESCRIPTION, "Gets debug items for testing purposes")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> GetTierCommand.get((Player) commandContext.getSender(), commandContext.get("tier"))));
-
-
- CommandArgument onlinePlayers = StringArgument.newBuilder("onlinePlayer")
- .withSuggestionsProvider(((objectCommandContext, s) -> {
- ArrayList arrayList = new ArrayList<>();
- Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName()));
- return arrayList;
- })).build();
-
- // /em money add
- manager.command(builder.literal("money")
- .literal("add")
- .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name"))
- .argument(IntegerArgument.newBuilder("amount"), ArgumentDescription.of("Amount of money to add"))
- .meta(CommandMeta.DESCRIPTION, "Adds a set amount of money to a player")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> CurrencyCommandsHandler.addCommand(commandContext.getSender(),
- commandContext.get("onlinePlayer"),
- commandContext.get("amount"))));
-
- // /em money addall
- manager.command(builder.literal("money")
- .literal("addall")
- .argument(IntegerArgument.newBuilder("amount"), ArgumentDescription.of("Amount of money to add"))
- .meta(CommandMeta.DESCRIPTION, "Adds a set amount of money to all online players")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> CurrencyCommandsHandler.addAllCommand(commandContext.getSender(),
- commandContext.get("amount"))));
-
- // /em money remove
- manager.command(builder.literal("money")
- .literal("remove")
- .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name"))
- .argument(IntegerArgument.newBuilder("amount"), ArgumentDescription.of("Amount of money to add"))
- .meta(CommandMeta.DESCRIPTION, "Removes a set amount of money from a player")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> CurrencyCommandsHandler.subtractCommand(commandContext.getSender(),
- commandContext.get("onlinePlayer"),
- commandContext.get("amount"))));
-
- // /em money set
- manager.command(builder.literal("money")
- .literal("set")
- .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name"))
- .argument(DoubleArgument.newBuilder("amount"), ArgumentDescription.of("Amount to be set"))
- .meta(CommandMeta.DESCRIPTION, "Sets the total currency amount of a player")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> CurrencyCommandsHandler.setCommand(commandContext.getSender(),
- commandContext.get("onlinePlayer"),
- commandContext.get("amount"))));
-
- // /em setrank
- manager.command(builder.literal("setrank")
- .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name"))
- .argument(IntegerArgument.newBuilder("prestigeRank"), ArgumentDescription.of("Prestige rank, 0-10"))
- .argument(IntegerArgument.newBuilder("guildRank"), ArgumentDescription.of("Guild rank, 0-20"))
- .meta(CommandMeta.DESCRIPTION, "Sets the guild rank of a player.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> GuildRankCommands.setGuildRank(commandContext.getSender(),
- commandContext.get("onlinePlayer"),
- commandContext.get("prestigeRank"),
- commandContext.get("guildRank"))));
-
- // /em discord
- manager.command(builder.literal("discord")
- .meta(CommandMeta.DESCRIPTION, "Gets the link for the support Discord server.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> commandContext.getSender().sendMessage(
- ChatColorConverter.convert("&8[EliteMobs] &6Discord room for support & downloads: &9" + DiscordLinks.mainLink))));
-
- // /em discord
- manager.command(builder.literal("discord")
- .argument(StringArgument.newBuilder("message").greedy().build(),
- ArgumentDescription.of("Message to be sent to Discord"))
- .meta(CommandMeta.DESCRIPTION, "Posts a debug message on Discord if DiscordSRV is configured correctly.")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> {
- new DiscordSRVAnnouncement(commandContext.get("message"));
- commandContext.getSender().sendMessage(ChatColorConverter.convert("&8[EliteMobs] &aAttempted to send a message to Discord!"));
- }));
-
- // /em forceunbind
- manager.command(builder.literal("forceunbind")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Unbinds a held soulbound item.")
- .handler(commandContext -> {
- ItemStack itemStack = ((Player) commandContext.getSender()).getInventory().getItemInMainHand();
- if (ItemTagger.isEliteItem(itemStack))
- SoulbindEnchantment.removeEnchantment(itemStack);
- }));
-
- // /em relativecoords
- manager.command(builder.literal("relativecoords")
- .argument(StringArgument.newBuilder("minidungeonFileName").withSuggestionsProvider(((objectCommandContext, s) -> minidungeonFileNames)),
- ArgumentDescription.of("Minidungeon configuration file name"))
- .senderType(Player.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Gets the relative coordinated to an installed dungeon.")
- .handler(commandContext -> RelativeCoordinatesCommand.get((Player) commandContext.getSender(), commandContext.get("minidungeonFileName"))));
-
- // /em wallet
- manager.command(builder.literal("wallet")
- .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name"))
- .senderType(CommandSender.class)
- .permission("elitemobs.currency.check.others")
- .meta(CommandMeta.DESCRIPTION, "Checks the currency of a specific player.")
- .handler(commandContext -> CurrencyCommandsHandler.checkCommand(commandContext.getSender(), commandContext.get("onlinePlayer"))));
-
- // /em fireball
- manager.command(builder.literal("fireball")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Fires a test Elite Fireball for explosion protection and regeneration testing purposes.")
- .handler(commandContext -> testFireball((Player) commandContext.getSender())));
-
- List blockTransitionPhases = new ArrayList<>(Arrays.asList("ON_SPAWN", "ON_REMOVE"));
-
- // /em registerblocks
- manager.command(builder.literal("registerblocks")
- .senderType(Player.class)
- .argument(StringArgument.newBuilder("regionalBoss").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)),
- ArgumentDescription.of("Regional Boss configuration file name"))
- .argument(StringArgument.newBuilder("blockTransitionPhase").withSuggestionsProvider(((objectCommandContext, s) -> blockTransitionPhases)),
- ArgumentDescription.of("Block transition phase"))
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Registers transitive blocks for use by regional bosses.")
- .handler(commandContext -> TransitiveBlockCommand.processCommand((Player) commandContext.getSender(),
- commandContext.get("regionalBoss"), commandContext.get("blockTransitionPhase"), false)));
-
- // /em registerblocksedit
- manager.command(builder.literal("registerblocksedit")
- .senderType(Player.class)
- .argument(StringArgument.newBuilder("regionalBoss").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)),
- ArgumentDescription.of("Regional Boss configuration file name"))
- .argument(StringArgument.newBuilder("blockTransitionPhase").withSuggestionsProvider(((objectCommandContext, s) -> blockTransitionPhases)),
- ArgumentDescription.of("Block transition phase"))
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Registers transitive blocks for use by regional bosses.")
- .handler(commandContext -> TransitiveBlockCommand.processCommand((Player) commandContext.getSender(),
- commandContext.get("regionalBoss"), commandContext.get("blockTransitionPhase"), true)));
-
- // /em registerblocksarea
- manager.command(builder.literal("registerblocksarea")
- .senderType(Player.class)
- .argument(StringArgument.newBuilder("regionalBoss").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)),
- ArgumentDescription.of("Regional Boss configuration file name"))
- .argument(StringArgument.newBuilder("blockTransitionPhase").withSuggestionsProvider(((objectCommandContext, s) -> blockTransitionPhases)),
- ArgumentDescription.of("Block transition phase"))
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Registers large transitive blocks areas for use by regional bosses.")
- .handler(commandContext -> TransitiveBlockCommand.processCommand((Player) commandContext.getSender(),
- commandContext.get("regionalBoss"), commandContext.get("blockTransitionPhase"), false, true)));
-
- // /em registerblocksareaedit
- manager.command(builder.literal("registerblocksareaedit")
- .senderType(Player.class)
- .argument(StringArgument.newBuilder("regionalBoss").withSuggestionsProvider(((objectCommandContext, s) -> customBosses)),
- ArgumentDescription.of("Regional Boss configuration file name"))
- .argument(StringArgument.newBuilder("blockTransitionPhase").withSuggestionsProvider(((objectCommandContext, s) -> blockTransitionPhases)),
- ArgumentDescription.of("Block transition phase"))
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Edits large transitive blocks areas for use by regional bosses.")
- .handler(commandContext -> TransitiveBlockCommand.processCommand((Player) commandContext.getSender(),
- commandContext.get("regionalBoss"), commandContext.get("blockTransitionPhase"), true, true)));
-
- // /em cancelblocks
- manager.command(builder.literal("cancelblocks")
- .senderType(Player.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Cancels transitive block registration for a player.")
- .handler(commandContext -> TransitiveBlockCommand.processCommand((Player) commandContext.getSender())));
-
- // /em debugmode
- manager.command(builder.literal("debugmode")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Toggles debug messages off and on.")
- .handler(commandContext -> DebugMessage.toggleDebugMode(commandContext.getSender())));
-
- // /em trace
- manager.command(builder.literal("trace")
- .senderType(CommandSender.class)
- .argument(StringArgument.newBuilder("uuid"),
- ArgumentDescription.of("EliteMobs UUID of the Custom Boss"))
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Traces the life of a custom boss entity. Used by the debug menu.")
- .handler(commandContext -> {
- for (EliteEntity eliteEntity : EntityTracker.getEliteMobEntities().values())
- if (eliteEntity.getEliteUUID().toString().equals(commandContext.get("uuid")))
- if (eliteEntity instanceof CustomBossEntity) {
- ((CustomBossEntity) eliteEntity).getBossTrace().postLog((Player) commandContext.getSender());
- return;
- }
- }));
-
- // /em debugtp
- manager.command(builder.literal("debugtp")
- .senderType(CommandSender.class)
- .argument(StringArgument.newBuilder("uuid"),
- ArgumentDescription.of("EliteMobs UUID of the Custom Boss"))
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Traces the life of a custom boss entity. Used by the debug menu.")
- .handler(commandContext -> {
- for (EliteEntity eliteEntity : EntityTracker.getEliteMobEntities().values())
- if (eliteEntity.getEliteUUID().toString().equals(commandContext.get("uuid")))
- if (eliteEntity instanceof CustomBossEntity) {
- if (eliteEntity.getLocation() != null)
- ((Player) commandContext.getSender()).teleport(eliteEntity.getLocation());
- return;
- }
- }));
-
- // /em generateresourcepack
- manager.command(builder.literal("generateresourcepack")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Generates a resource pack for EliteMobs using ModelEngine")
- .handler(commandContext -> ConfigurationExporter.createResourcePack(commandContext.getSender())));
-
- // /em quest reset player
- manager.command(builder.literal("quest")
- .literal("reset")
- .argument(StringArgument.newBuilder("player").withSuggestionsProvider(((objectCommandContext, s) -> {
- ArrayList arrayList = new ArrayList<>();
- Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName()));
- return arrayList;
- })))
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Resets player quest progress.")
- .handler(commandContext -> QuestCommand.resetQuests(commandContext.getSender(), commandContext.get("player"))));
-
- List questFilenames = new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet());
-
- // /em quest reset player questname
- manager.command(builder.literal("quest")
- .literal("reset")
- .argument(StringArgument.newBuilder("player").withSuggestionsProvider(((objectCommandContext, s) -> {
- ArrayList arrayList = new ArrayList<>();
- Bukkit.getOnlinePlayers().forEach(player -> arrayList.add(player.getName()));
- return arrayList;
- })))
- .argument(StringArgument.newBuilder("questName").withSuggestionsProvider((objectCommandContext, s) -> questFilenames), ArgumentDescription.of("Quest name"))
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Resets a specific quest for a player.")
- .handler(commandContext -> QuestCommand.resetQuest(commandContext.getSender(), commandContext.get("player"), commandContext.get("questName"))));
-
- // /em quest forcecomplete
- manager.command(builder.literal("quest")
- .literal("forcecomplete")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Forces completion of all player quests.")
- .handler(commandContext -> QuestCommand.completeQuest((Player) commandContext.getSender())));
-
- // /em quest bypass
- manager.command(builder.literal("quest")
- .literal("bypass")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Allows admins to temporarily bypass permission and previous quest requirements for quests.")
- .handler(commandContext -> QuestCommand.bypassQuestRequirements((Player) commandContext.getSender())));
-
- // /em forceresourcepack
- manager.command(builder.literal("forceresourcepack")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .meta(CommandMeta.DESCRIPTION, "Forces server resource packs to be used in your server.")
- .handler(commandContext -> SetupMenu.forceResourcePack((Player) commandContext.getSender())));
-
- // /em opendyamicshop
- manager.command(builder.literal("opendynamicshop")
- .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name"))
- .meta(CommandMeta.DESCRIPTION, "Opens the dynamic shop for a player")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> {
- try {
- ProceduralShopMenu.shopConstructor(Bukkit.getPlayer((String) commandContext.get("onlinePlayer")));
- } catch (Exception ex) {
- commandContext.getSender().sendMessage("Failed to get player with that username!");
- }
- }));
-
-
- // /em opencustomshop
- manager.command(builder.literal("opencustomshop")
- .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name"))
- .meta(CommandMeta.DESCRIPTION, "Opens the custom shop for a player")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> {
- try {
- CustomShopMenu.customShopConstructor(Bukkit.getPlayer((String) commandContext.get("onlinePlayer")));
- } catch (Exception ex) {
- commandContext.getSender().sendMessage("Failed to get player with that username!");
- }
- }));
-
- // /em opensellshop
- manager.command(builder.literal("opensellshop")
- .argument(onlinePlayers.copy(), ArgumentDescription.of("Player name"))
- .meta(CommandMeta.DESCRIPTION, "Opens the dynamic shop for a player")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> {
- SellMenu sellMenu = new SellMenu();
- try {
- sellMenu.constructSellMenu(Bukkit.getPlayer((String) commandContext.get("onlinePlayer")));
- } catch (Exception ex) {
- commandContext.getSender().sendMessage("Failed to get player with that username!");
- }
- }));
-
- manager.command(builder.literal("itemstats")
- .meta(CommandMeta.DESCRIPTION, "Debug command to check item stats")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> {
- Player player = ((Player) commandContext.getSender());
- ItemStack item = player.getInventory().getItemInMainHand();
- double attackSpeed = EliteItemManager.getAttackSpeed(item);
- double damage = EliteItemManager.getBaseDamage(item);
- double dps = EliteItemManager.getDPS(item);
- double itemLevel = EliteItemManager.getWeaponLevel(item);
- double bonusEDPS = EliteItemManager.getTotalDPS(item);
- commandContext.getSender().sendMessage("[EliteMobs] Item Stats:");
- commandContext.getSender().sendMessage("Item attack speed: " + attackSpeed);
- commandContext.getSender().sendMessage("Item damage: " + damage);
- commandContext.getSender().sendMessage("Item EDPS: " + dps);
- commandContext.getSender().sendMessage("Item level: " + itemLevel);
- commandContext.getSender().sendMessage("Item bonus EDPS: " + bonusEDPS);
- })
- );
-
- List wormholeList = new ArrayList<>(WormholeConfig.getWormholes().keySet());
- List wormholeOptions = new ArrayList<>(Arrays.asList("1", "2"));
-
- // /em setwormhole <1/2>
- manager.command(builder.literal("setwormhole")
- .argument(StringArgument.newBuilder("wormholeFilename").withSuggestionsProvider(((objectCommandContext, s) -> wormholeList)),
- ArgumentDescription.of("Wormhole filename"))
- .argument(StringArgument.newBuilder("wormholeOption").withSuggestionsProvider(((objectCommandContext, s) -> wormholeOptions)),
- ArgumentDescription.of("Wormhole option"))
- .senderType(Player.class)
- .permission("elitemobs.*")
- .handler(commandContext -> {
- for (Wormhole wormhole : Wormhole.getWormholes()) {
- if (wormhole.getWormholeConfigFields().getFilename().equals(commandContext.get("wormholeFilename")))
- switch ((String) commandContext.get("wormholeOption")) {
- case "1":
- wormhole.getWormholeEntry1().updateLocation((Player) commandContext.getSender());
- return;
- case "2":
- wormhole.getWormholeEntry2().updateLocation((Player) commandContext.getSender());
- return;
- default:
- commandContext.getSender().sendMessage("[EliteMobs] Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole.");
- }
- }
- commandContext.getSender().sendMessage("[EliteMobs] Failed to set location for this wormhole.");
- }));
-
- List languages = new ArrayList<>(TranslationsConfig.getTranslationConfigs().keySet());
- languages.add("english");
-
- // /em language
- manager.command(builder.literal("language")
- .argument(StringArgument.newBuilder("language").withSuggestionsProvider(((objectCommandContext, s) -> languages)),
- ArgumentDescription.of("Filename of the translation file to use"))
- .meta(CommandMeta.DESCRIPTION, "Sets the language of the plugin!")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> {
- if (languages.contains(commandContext.get("language"))) {
- DefaultConfig.setLanguage(commandContext.getSender(), commandContext.get("language"));
- commandContext.getSender().sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2Language set to " + commandContext.get("language") + " ! &4Translations are created and manged for free by the community through crowdin ( https://crowdin.com/project/elitemobs ), use at your own discretion!"));
- } else {
- String files = "";
- for (String language : languages)
- files += language + " ";
- commandContext.getSender().sendMessage(ChatColorConverter.convert("&8[EliteMobs] &cNot a valid language! Valid language files: " + files));
- }
- })
- );
-
- // /em package
- manager.command(builder.literal("package")
- .argument(StringArgument.newBuilder("dungeonName"), ArgumentDescription.of("Name of the dungeon to create"))
- .argument(StringArgument.newBuilder("dungeonVersion"), ArgumentDescription.of("Version of the dungeon"))
- .meta(CommandMeta.DESCRIPTION, "Packages a dungeon for distribution!")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> {
- new PackageCommand(commandContext.getSender(), commandContext.get("dungeonName"), commandContext.get("dungeonVersion"));
- })
- );
-
- // /em forcerespawn
- manager.command(builder.literal("forcerespawn")
- .meta(CommandMeta.DESCRIPTION, "Resets spawn cooldowns")
- .senderType(CommandSender.class)
- .permission("elitemobs.*")
- .handler(commandContext -> {
- RegionalBossEntity.getRegionalBossEntities().forEach(regionalBossEntity -> {
- if (regionalBossEntity.isRespawning()) regionalBossEntity.forceRespawn();
- });
- })
- );
-
- }
-
- private void testFireball(Player player) {
- Fireball fireball = (Fireball) player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREBALL);
- fireball.setDirection(player.getLocation().getDirection().normalize());
- fireball.setShooter(player);
- fireball.setYield(3F);
- EntityTracker.registerProjectileEntity(fireball);
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java
new file mode 100644
index 000000000..5ecc8de73
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class AdventurersGuildArgCommand extends AdvancedCommand {
+ public AdventurersGuildArgCommand() {
+ super(List.of("ag", "adventurersguild"));
+ setUsage("/em adventurersguild");
+ setPermission("elitemobs.adventurersguild.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java
new file mode 100644
index 000000000..1c6f75897
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+
+public class AdventurersGuildCommand extends AdvancedCommand {
+ public AdventurersGuildCommand() {
+ super(new ArrayList<>());
+ setUsage("/em adventurersguild");
+ setPermission("elitemobs.adventurersguild.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java
new file mode 100644
index 000000000..4a6f18b00
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class AltCommand extends AdvancedCommand {
+ public AltCommand() {
+ super(List.of("alt"));
+ setUsage("/em alt");
+ setDescription("Changes the style of the /em menu.");
+ setPermission("elitemobs.alt");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ PlayerData.setUseBookMenus(commandData.getPlayerSender(), !PlayerData.getUseBookMenus(commandData.getPlayerSender().getUniqueId()));
+ Logger.sendMessage(commandData.getCommandSender(), DefaultConfig.getSwitchEMStyleMessage());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java
new file mode 100644
index 000000000..9c97bb5ab
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.ArenaMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ArenaCommand extends AdvancedCommand {
+ public ArenaCommand() {
+ super(List.of("arena"));
+ addArgument("arenaID", new ArrayList<>());
+ setUsage("/em arena ");
+ setPermission("elitemobs.arena.start");
+ setDescription("Open the Arena menu.");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ new ArenaMenu().constructArenaMenu(commandData.getPlayerSender(), commandData.getStringArgument("arenaID"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java
deleted file mode 100644
index 9a1c4cd86..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommands.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.menus.ArenaMenu;
-import org.bukkit.entity.Player;
-
-public class ArenaCommands {
- public static void openArenaMenu(Player player, String arenaFilename) {
- ArenaMenu arenaMenu = new ArenaMenu();
- arenaMenu.constructArenaMenu(player, arenaFilename);
- }
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java
index 2a5faef8b..dfe83b9f2 100644
--- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java
+++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java
@@ -1,144 +1,106 @@
package com.magmaguy.elitemobs.commands;
-import cloud.commandframework.Command;
-import cloud.commandframework.CommandTree;
-import cloud.commandframework.arguments.standard.StringArgument;
-import cloud.commandframework.bukkit.BukkitCommandManager;
-import cloud.commandframework.execution.CommandExecutionCoordinator;
-import cloud.commandframework.meta.CommandMeta;
-import cloud.commandframework.minecraft.extras.MinecraftExceptionHandler;
-import cloud.commandframework.minecraft.extras.MinecraftHelp;
import com.magmaguy.elitemobs.MetadataHandler;
-import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
-import com.magmaguy.elitemobs.config.DefaultConfig;
-import com.magmaguy.elitemobs.items.ShareItem;
-import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen;
-import com.magmaguy.elitemobs.utils.WarningMessage;
-import net.kyori.adventure.platform.bukkit.BukkitAudiences;
-import net.kyori.adventure.text.format.NamedTextColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import java.lang.reflect.Method;
-import java.util.function.Function;
-
-import static net.kyori.adventure.text.Component.text;
-
-/**
- * Created by MagmaGuy on 21/01/2017.
- */
+import com.magmaguy.magmacore.command.CommandManager;
public class CommandHandler {
-
- private BukkitCommandManager manager;
- //private CommandConfirmationManager paymentConfirmationManager;
- private MinecraftHelp minecraftHelp;
- private BukkitAudiences bukkitAudiences;
-
- /*
- Commands powered by Cloud
- */
-
- public CommandHandler() {
- Function commandExecutionCoordinator = null;
- try {
- Class> c = Class.forName("cloud.commandframework.execution.CommandExecutionCoordinator");
- Method method = c.getDeclaredMethod("simpleCoordinator");
- commandExecutionCoordinator = (Function) method.invoke(Function.class);
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- manager = new BukkitCommandManager(
- /* Owning plugin */ MetadataHandler.PLUGIN,
- /* Coordinator function */ commandExecutionCoordinator,
- /* Command Sender -> C */ Function.identity(),
- /* C -> Command Sender */ Function.identity()
- );
- } catch (final Exception e) {
- new WarningMessage("Failed to initialize the command manager");
- /* Disable the plugin */
- MetadataHandler.PLUGIN.getServer().getPluginManager().disablePlugin(MetadataHandler.PLUGIN);
- return;
- }
-
- //try {
- // manager.registerBrigadier();
- //} catch (final Exception e) {
- // new WarningMessage("Failed to initialize Brigadier support: " + e.getMessage());
- //}
-
- // Create a BukkitAudiences instance (adventure) in order to use the minecraft-extras help system
- bukkitAudiences = BukkitAudiences.create(MetadataHandler.PLUGIN);
-
- minecraftHelp = new MinecraftHelp(
- "/elitemobs help",
- bukkitAudiences::sender,
- manager
- );
-
- // Override the default exception handlers
- new MinecraftExceptionHandler()
- .withInvalidSyntaxHandler()
- .withInvalidSenderHandler()
- .withNoPermissionHandler()
- .withArgumentParsingHandler()
- .withCommandExecutionHandler()
- .withDecorator(
- component -> text()
- .append(text("[", NamedTextColor.DARK_GRAY))
- .append(text("EliteMobs", NamedTextColor.GOLD))
- .append(text("] ", NamedTextColor.DARK_GRAY))
- .append(component).build()
- ).apply(manager, bukkitAudiences::sender);
-
- constructCommands();
+ private static CommandManager emCommand;
+ private static CommandManager adventurersGuildCommand;
+ private CommandHandler() {
}
- public void constructCommands() {
-
- // /ag
- final Command.Builder agBuilder = manager.commandBuilder("adventurersguild", "ag");
- manager.command(agBuilder.meta(CommandMeta.DESCRIPTION, "Teleports players to the Adventurers' Guild Hub")
- .senderType(Player.class)
- //permission is dealt inside of the command
- .handler(commandContext -> {
- if (DefaultConfig.isEmLeadsToStatusMenu())
- AdventurersGuildCommand.adventurersGuildCommand((Player) commandContext.getSender());
- }));
-
- // /shareitem
- final Command.Builder shareItemBuilder = manager.commandBuilder("shareitem");
- manager.command(shareItemBuilder.meta(CommandMeta.DESCRIPTION, "Shares a held Elite item on chat.")
- .senderType(Player.class)
- //permission is dealt inside of the command
- .permission("elitemobs.shareitem")
- .handler(commandContext -> ShareItem.showOnChat((Player) commandContext.getSender())));
-
- // Base command builder
- final Command.Builder builder = manager.commandBuilder("elitemobs", "em");
-
- manager.command(builder.literal("help")
- .argument(StringArgument.optional("query", StringArgument.StringMode.GREEDY))
- .handler(context -> {
- minecraftHelp.queryCommands(context.getOrDefault("query", ""), context.getSender());
- }));
-
- //// Create a world argument
- //final CommandArgument worldArgument = WorldArgument.of("world");
-
- // /em
- manager.command(builder
- .meta(CommandMeta.DESCRIPTION, "Opens the main player interface")
- .senderType(Player.class)
- .handler(commandContext -> {
- if (DefaultConfig.isEmLeadsToStatusMenu())
- new PlayerStatusScreen((Player) commandContext.getSender());
- }));
-
- new AdminCommands(manager, builder);
- new UserCommands(manager, builder);
-
+ public static void registerCommands() {
+ emCommand = new CommandManager(MetadataHandler.PLUGIN, "elitemobs");
+
+ //Admin commands
+ emCommand.registerCommand(new SetupCommand());
+ emCommand.registerCommand(new SetupDoneCommand());
+ emCommand.registerCommand(new SetupToggleCommand());
+ emCommand.registerCommand(new SpawnBossCommand());
+ emCommand.registerCommand(new SpawnBossLevelCommand());
+ emCommand.registerCommand(new SpawnBossAtCommand());
+ emCommand.registerCommand(new SpawnBossLevelAtCommand());
+ emCommand.registerCommand(new PlaceBossCommand());
+ emCommand.registerCommand(new PlaceTreasureChestCommand());
+ emCommand.registerCommand(new PlaceNPCCommand());
+ emCommand.registerCommand(new RemoveCommand());
+ emCommand.registerCommand(new DebugCommand());
+ emCommand.registerCommand(new EventCommand());
+ emCommand.registerCommand(new StatsCommand());
+ emCommand.registerCommand(new LootMenuCommand());
+ emCommand.registerCommand(new LootGiveCommand());
+ emCommand.registerCommand(new LootRandomCommand());
+ emCommand.registerCommand(new LootSimulateMultipleCommand());
+ emCommand.registerCommand(new LootSimulateCommand());
+ emCommand.registerCommand(new VersionCommand());
+ emCommand.registerCommand(new ReloadCommand());
+ emCommand.registerCommand(new KillCommand());
+ emCommand.registerCommand(new KillRadiusCommand());
+ emCommand.registerCommand(new KillTypeCommand());
+ emCommand.registerCommand(new KillTypeRadiusCommand());
+ emCommand.registerCommand(new LootDebugCommand());
+ emCommand.registerCommand(new MoneyAddCommand());
+ emCommand.registerCommand(new MoneyAddAllCommand());
+ emCommand.registerCommand(new MoneySetCommand());
+ emCommand.registerCommand(new MoneyCheckPlayerCommand());
+ emCommand.registerCommand(new UnbindForceCommand());
+ emCommand.registerCommand(new FireballCommand());
+ emCommand.registerCommand(new RespawnAllCommand());
+ emCommand.registerCommand(new PackageDungeonCommand());
+ emCommand.registerCommand(new LanguageCommand());
+ emCommand.registerCommand(new PlaceWormholeCommand());
+ emCommand.registerCommand(new LootStats());
+ emCommand.registerCommand(new ShopProceduralOtherCommand());
+ emCommand.registerCommand(new ShopCustomOtherCommand());
+ emCommand.registerCommand(new ShopSellOtherCommand());
+ emCommand.registerCommand(new QuestBypassCommand());
+ emCommand.registerCommand(new QuestCompleteCommand());
+ emCommand.registerCommand(new QuestCompleteQuestCommand());
+ emCommand.registerCommand(new QuestResetCommand());
+ emCommand.registerCommand(new QuestResetAllCommand());
+ emCommand.registerCommand(new TransitiveBlocksCancelCommand());
+ emCommand.registerCommand(new TransitiveBlocksRegisterCommand());
+ emCommand.registerCommand(new TransitiveBlocksEditCommand());
+ emCommand.registerCommand(new TransitiveBlocksRegisterAreaCommand());
+ emCommand.registerCommand(new TransitiveBlocksEditAreaCommand());
+ emCommand.registerCommand(new RankSetCommand());
+ emCommand.registerCommand(new SpawnElite());
+ emCommand.registerCommand(new SpawnEliteAtCommand());
+ emCommand.registerCommand(new DiscordMessageCommand());
+ emCommand.registerCommand(new DiscordCommand());
+ emCommand.registerCommand(new MoneyRemoveCommand());
+ emCommand.registerCommand(new ProtectionBypassCommand());
+
+ //User commands
+// emCommand.registerCommand(new AdventurersGuildCommand());
+ emCommand.registerCommand(new ShareItemCommand());
+ emCommand.registerCommand(new ShopDynamicCommand());
+ emCommand.registerCommand(new ShopCustomCommand());
+ emCommand.registerCommand(new RepairCommand());
+ emCommand.registerCommand(new EnchantCommand());
+ emCommand.registerCommand(new ScrapCommand());
+ emCommand.registerCommand(new UnbindCommand());
+ emCommand.registerCommand(new MoneyCheckCommand());
+ emCommand.registerCommand(new QuestAcceptCommand());
+ emCommand.registerCommand(new QuestTrackCommand());
+ emCommand.registerCommand(new QuestLeaveCommand());
+ emCommand.registerCommand(new RankCommand());
+ emCommand.registerCommand(new LootCommand());
+ emCommand.registerCommand(new QuitCommand());
+ emCommand.registerCommand(new StartCommand());
+ emCommand.registerCommand(new ArenaCommand());
+ emCommand.registerCommand(new DismissCommand());
+ emCommand.registerCommand(new AltCommand());
+ emCommand.registerCommand(new SpawnTeleportCommand());
+ emCommand.registerCommand(new DungeonTeleportCommand());
+ emCommand.registerCommand(new TrackBossCommand());
+ emCommand.registerCommand(new PayCommand());
+ emCommand.registerCommand(new AdventurersGuildArgCommand());
+
+ emCommand.registerCommand(new EliteMobsCommand());
+ emCommand.registerCommand(new HelpCommand());
+
+ adventurersGuildCommand =new CommandManager(MetadataHandler.PLUGIN, "adventurersguild");
+ adventurersGuildCommand.registerCommand(new AdventurersGuildCommand());
}
-
}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java
index 82373bb98..e11cdfd9e 100644
--- a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java
+++ b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java
@@ -1,9 +1,9 @@
package com.magmaguy.elitemobs.commands;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.config.EconomySettingsConfig;
import com.magmaguy.elitemobs.economy.EconomyHandler;
-import com.magmaguy.elitemobs.utils.Round;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import com.magmaguy.magmacore.util.Round;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -81,7 +81,7 @@ public static void addCommand(Player player, double amount) {
EconomyHandler.addCurrency(player.getUniqueId(), amount);
}
- public static void addCommand(CommandSender commandSender, String onlinePlayer, int amount) {
+ public static void addCommand(CommandSender commandSender, String onlinePlayer, double amount) {
Player player = Bukkit.getPlayer(onlinePlayer);
if (player == null) {
commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Player " + onlinePlayer + " &4is not valid!"));
@@ -92,7 +92,7 @@ public static void addCommand(CommandSender commandSender, String onlinePlayer,
commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2They now have " + EconomyHandler.checkCurrency(player.getUniqueId())));
}
- public static void addAllCommand(CommandSender commandSender, int amount) {
+ public static void addAllCommand(CommandSender commandSender, double amount) {
for (Player player : Bukkit.getOnlinePlayers())
addCommand(player, amount);
commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2You have added " + amount + " to all online players."));
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java
index 13f259eb9..71fbd2efb 100644
--- a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java
+++ b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java
@@ -1,11 +1,9 @@
package com.magmaguy.elitemobs.commands;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields;
-import com.magmaguy.elitemobs.dungeons.EMPackage;
-import com.magmaguy.elitemobs.dungeons.SchematicDungeonPackage;
import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
import com.magmaguy.elitemobs.utils.DebugBlockLocation;
+import com.magmaguy.magmacore.util.ChatColorConverter;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -42,28 +40,6 @@ public static void addSpawnLocation(String customBossConfigFieldsString, Player
}
}
- public static void addRelativeSpawnLocation(Player player, String customBossConfigFieldsString, String minidungeonString) {
- EMPackage emPackage = EMPackage.getEmPackages().get(minidungeonString);
- if (emPackage == null) {
- player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add relative location! Minidungeon is not valid!"));
- return;
- }
- if (!(emPackage instanceof SchematicDungeonPackage)) {
- player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Target EM package was not a schematic dungeon so this command won't work!"));
- return;
- }
- CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString);
- if (customBossesConfigFields == null)
- player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add relative location! Custom boss is not valid!"));
- else {
- Location safeSpawnLocation = autoSeekSafeSpawnLocation(player.getLocation());
- if (safeSpawnLocation == null)
- player.sendMessage("[EliteMobs] No safe spawn location found! Make sure the area is passable!");
- else
- ((SchematicDungeonPackage) emPackage).addBoss(customBossesConfigFields, safeSpawnLocation);
- }
- }
-
public static void setLeashRadius(String customBossConfigFieldsString, CommandSender commandSender, int leashRadius) {
CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString);
if (customBossesConfigFields == null) {
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java
new file mode 100644
index 000000000..34f06fa3b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.DebugScreen;
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DebugCommand extends AdvancedCommand {
+ public DebugCommand() {
+ super(List.of("debug"));
+ addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()));
+ setUsage("/em debug ");
+ setPermission("elitemobs.debug");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Debug bosses or players.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ DebugScreen.open(commandData.getPlayerSender(), commandData.getStringArgument("filename"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java
new file mode 100644
index 000000000..b06eb76f3
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.utils.DiscordLinks;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class DiscordCommand extends AdvancedCommand {
+ public DiscordCommand() {
+ super(List.of("discord"));
+ setUsage("/em discord");
+ setPermission("elitemobs.discord.link");
+ setDescription("Links to the EliteMobs discord.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ Logger.sendMessage(commandData.getPlayerSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java
new file mode 100644
index 000000000..64988902c
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DiscordMessageCommand extends AdvancedCommand {
+ public DiscordMessageCommand() {
+ super(List.of("discord"));
+ addArgument("message", new ArrayList<>());
+ setUsage("/em discord ");
+ setPermission("elitemobs.discord.message");
+ setDescription("Sends a message to the Discord via DiscordSRV, for debugging purposes");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ new DiscordSRVAnnouncement(commandData.getStringSequenceArgument("message"));
+ Logger.sendMessage(commandData.getCommandSender(), "&aAttempted to send a message to Discord!");
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java
new file mode 100644
index 000000000..bb1b02fd4
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class DismissCommand extends AdvancedCommand {
+ public DismissCommand() {
+ super(List.of("dismiss"));
+ setDescription("Dismisses /em menu message.");
+ setUsage("/em dismiss");
+ setPermission("elitemobs.dismiss");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ PlayerData.setDismissEMStatusScreenMessage(commandData.getPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(commandData.getPlayerSender().getUniqueId()));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java
index db1ec3dc1..4cbe96b1c 100644
--- a/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java
@@ -5,6 +5,7 @@
import com.magmaguy.elitemobs.dungeons.WorldInstancedDungeonPackage;
import com.magmaguy.elitemobs.instanced.MatchInstance;
import com.magmaguy.elitemobs.menus.InstancedDungeonBrowser;
+import com.magmaguy.elitemobs.wormhole.Wormhole;
import org.bukkit.entity.Player;
public class DungeonCommands {
@@ -24,8 +25,10 @@ public static void teleport(Player player, String minidungeonName) {
if (emPackage instanceof WorldInstancedDungeonPackage)
new InstancedDungeonBrowser(player, emPackage.getDungeonPackagerConfigFields().getFilename());
else {
- if (emPackage.getDungeonPackagerConfigFields().getTeleportLocation() != null)
+ if (emPackage.getDungeonPackagerConfigFields().getTeleportLocation() != null) {
PlayerPreTeleportEvent.teleportPlayer(player, emPackage.getDungeonPackagerConfigFields().getTeleportLocation());
+ Wormhole.addPlayerToCooldowns(player);
+ }
else
player.sendMessage("[EliteMobs] Can't teleport you to the dungeon because the teleport location isn't set!" +
" Ask an admin to reinstall the dungeon!");
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java
new file mode 100644
index 000000000..5c71e0f63
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DungeonTeleportCommand extends AdvancedCommand {
+ public DungeonTeleportCommand() {
+ super(List.of("dungeontp"));
+ addArgument("dungeonID", new ArrayList<>());
+ setPermission("elitemobs.dungeon.tp");
+ setDescription("Teleports players to Lairs, Minidungeons and Dungeons.");
+ setUsage("/em dungeontp ");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ DungeonCommands.teleport(commandData.getPlayerSender(), commandData.getStringArgument("dungeonID"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java
new file mode 100644
index 000000000..c41a1a6b2
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+
+public class EliteMobsCommand extends AdvancedCommand {
+ public EliteMobsCommand() {
+ super(new ArrayList<>());
+ setDescription("The main command for EliteMobs, opens the main menu.");
+ setUsage("/em");
+ setPermission("elitemobs.command");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (DefaultConfig.isEmLeadsToStatusMenu())
+ new PlayerStatusScreen(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java
new file mode 100644
index 000000000..1e7bfa81c
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.ItemEnchantmentMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class EnchantCommand extends AdvancedCommand {
+ public EnchantCommand() {
+ super(List.of("enchant"));
+ setUsage("/em enchant");
+ setPermission("elitemobs.enchant.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the enchantment menu or teleports the player to the Adventurer's Guild Hub");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender()))
+ new ItemEnchantmentMenu(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java
new file mode 100644
index 000000000..61a496b6d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.events.TimedEvent;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class EventCommand extends AdvancedCommand {
+ public EventCommand() {
+ super(List.of("event"));
+ addArgument("filename", TimedEvent.getBlueprintEvents().stream().map(timedEvent -> timedEvent.getCustomEventsConfigFields().getFilename()).toList());
+ setUsage("/em event ");
+ setPermission("elitemobs.event.start");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Triggers a timed event to start at the next available time and place.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ com.magmaguy.elitemobs.commands.admin.EventCommand.trigger(commandData.getCommandSender(), commandData.getStringArgument("filename"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java
new file mode 100644
index 000000000..f15b47354
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Fireball;
+
+import java.util.List;
+
+public class FireballCommand extends AdvancedCommand {
+ public FireballCommand() {
+ super(List.of("fireball"));
+ setUsage("/em fireball");
+ setPermission("elitemobs.fireball");
+ setDescription("Shoots a fireball, to test terrain protections and explosion regeneration.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ Fireball fireball = (Fireball) commandData.getPlayerSender().getWorld().spawnEntity(commandData.getPlayerSender().getLocation(), EntityType.FIREBALL);
+ fireball.setDirection(commandData.getPlayerSender().getLocation().getDirection().normalize());
+ fireball.setShooter(commandData.getPlayerSender());
+ fireball.setYield(3F);
+ EntityTracker.registerProjectileEntity(fireball);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java
index 76afff26c..7764a5f4b 100644
--- a/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java
+++ b/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java
@@ -1,7 +1,7 @@
package com.magmaguy.elitemobs.commands;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.adventurersguild.GuildRank;
+import com.magmaguy.magmacore.util.ChatColorConverter;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java
new file mode 100644
index 000000000..c2b49187d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java
@@ -0,0 +1,33 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.CommandManager;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+public class HelpCommand extends AdvancedCommand {
+ public HelpCommand() {
+ super(List.of("help"));
+ setUsage("/em help");
+ setPermission("elitemobs.help");
+ setDescription("Lists all commands.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ Logger.sendMessage(commandData.getCommandSender(), "Commands:");
+ for (CommandManager commandManager : CommandManager.getCommandManagers()) {
+ commandManager.commands.forEach(command -> {
+ if (commandData.getCommandSender() instanceof Player player) {
+ player.spigot().sendMessage(Logger.hoverMessage(command.getUsage(), command.getDescription()));
+ } else {
+ Logger.sendSimpleMessage(commandData.getCommandSender(), command.getUsage());
+ Logger.sendSimpleMessage(commandData.getCommandSender(), command.getDescription());
+ }
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java
new file mode 100644
index 000000000..70c740edd
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java
@@ -0,0 +1,21 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.KillHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.List;
+
+public class KillCommand extends AdvancedCommand {
+ public KillCommand() {
+ super(List.of("kill"));
+ setUsage("/em kill");
+ setPermission("elitemobs.kill.command");
+ setDescription("Kills all elites.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ KillHandler.killAggressiveMobs(commandData.getCommandSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java
new file mode 100644
index 000000000..978c494a7
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.KillHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class KillRadiusCommand extends AdvancedCommand {
+ public KillRadiusCommand() {
+ super(List.of("kill"));
+ addArgument("radius", new ArrayList<>());
+ setUsage("/em kill ");
+ setPermission("elitemobs.kill.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Kills all elites in the specified radius.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ KillHandler.radiusKillAggressiveMobs(commandData.getPlayerSender(), commandData.getIntegerArgument("radius"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java
new file mode 100644
index 000000000..03b0ffdc6
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.KillHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import org.bukkit.entity.EntityType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class KillTypeCommand extends AdvancedCommand {
+ public KillTypeCommand() {
+ super(List.of("kill"));
+ addLiteral("type");
+ addArgument("type", new ArrayList<>());
+ setUsage("/em kill type ");
+ setPermission("elitemobs.kill.command");
+ setDescription("Kills all elites of the specified type.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ KillHandler.killEntityType(commandData.getCommandSender(), EntityType.valueOf(commandData.getStringArgument("type")));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java
new file mode 100644
index 000000000..33cd0d2e8
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.KillHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import org.bukkit.entity.EntityType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class KillTypeRadiusCommand extends AdvancedCommand {
+ public KillTypeRadiusCommand() {
+ super(List.of("kill"));
+ addLiteral("type");
+ addArgument("type", new ArrayList<>());
+ addArgument("range", new ArrayList<>());
+ setUsage("/em kill type ");
+ setPermission("elitemobs.kill.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Kills all elites of the specified type within the specified radius.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ KillHandler.radiusKillSpecificMobs(commandData.getPlayerSender(),
+ EntityType.valueOf(commandData.getStringArgument("type")),
+ commandData.getIntegerArgument("range"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java
new file mode 100644
index 000000000..57d0aee9a
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java
@@ -0,0 +1,35 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.config.translations.TranslationsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LanguageCommand extends AdvancedCommand {
+ public LanguageCommand() {
+ super(List.of("language"));
+ List suggestions = new ArrayList<>(TranslationsConfig.getTranslationConfigs().keySet().stream().toList());
+ suggestions.add("english");
+ addArgument("language", suggestions);
+ setUsage("/em language ");
+ setPermission("elitemobs.language");
+ setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ String language = commandData.getStringArgument("language");
+ if (!TranslationsConfig.getTranslationConfigs().containsKey(language) && !language.equals("english")) {
+ Logger.sendMessage(commandData.getCommandSender(), "Language not found. Valid languages:");
+ TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(commandData.getCommandSender(), key));
+ return;
+ }
+ DefaultConfig.setLanguage(commandData.getCommandSender(), language);
+ Logger.sendMessage(commandData.getCommandSender(), "&2Language set to " + language +
+ " ! &4Translations are created and manged for free by the community through Crowdin ( https://crowdin.com/project/elitemobs ), use at your own discretion!");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java
new file mode 100644
index 000000000..d1035a41f
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.LootMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class LootCommand extends AdvancedCommand {
+ public LootCommand() {
+ super(List.of("loot"));
+ setUsage("/em loot");
+ setDescription("Open the loot menu for group loot.");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ LootMenu.openMenu(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java
new file mode 100644
index 000000000..ada2a14e9
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.GetTierCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LootDebugCommand extends AdvancedCommand {
+ public LootDebugCommand() {
+ super(List.of("loot"));
+ addLiteral("debug");
+ addArgument("level", new ArrayList<>());
+ setUsage("/em loot debug ");
+ setPermission("elitemobs.loot.debug");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Equips players with a complete armor set, weapons set of the specified level, and food for testing purposes.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ GetTierCommand.get(commandData.getPlayerSender(), commandData.getIntegerArgument("level"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java
new file mode 100644
index 000000000..5938e9cfb
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.LootCommand;
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LootGiveCommand extends AdvancedCommand {
+ public LootGiveCommand() {
+ super(List.of("loot"));
+ addLiteral("give");
+ addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ addArgument("playerName", new ArrayList<>());
+ setUsage("/em loot give ");
+ setPermission("elitemobs.loot.admin");
+ setDescription("Gives the specified loot to a specific player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ LootCommand.give(commandData.getCommandSender(), commandData.getStringArgument("playerName"), commandData.getStringArgument("filename"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java
new file mode 100644
index 000000000..9126a677b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.GetLootMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class LootMenuCommand extends AdvancedCommand {
+ public LootMenuCommand() {
+ super(List.of("loot"));
+ addLiteral("menu");
+ setUsage("/em loot menu");
+ setPermission("elitemobs.loot.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the loot menu.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ new GetLootMenu(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java
new file mode 100644
index 000000000..60c979976
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.SimLootCommand;
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LootRandomCommand extends AdvancedCommand {
+ public LootRandomCommand() {
+ super(List.of("loot"));
+ addLiteral("random");
+ addArgument("level", new ArrayList<>());
+ addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ setUsage("/em loot random ");
+ setPermission("elitemobs.loot.admin");
+ setDescription("Gives the player random loot of the specified level.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SimLootCommand.forcePositiveLoot(commandData.getCommandSender(), commandData.getStringArgument("playerName"), commandData.getIntegerArgument("level"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java
new file mode 100644
index 000000000..9dbd97527
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java
@@ -0,0 +1,31 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.SimLootCommand;
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LootSimulateCommand extends AdvancedCommand {
+ public LootSimulateCommand() {
+ super(List.of("loot"));
+ addLiteral("simulate");
+ addArgument("level", new ArrayList<>());
+ addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ setUsage("/em loot simulate ");
+ setPermission("elitemobs.loot.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Simulates loot drops for the specified level and player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SimLootCommand.run(
+ commandData.getPlayerSender(),
+ commandData.getIntegerArgument("level"),
+ commandData.getStringArgument("playerName"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java
new file mode 100644
index 000000000..a38e117cb
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java
@@ -0,0 +1,33 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.SimLootCommand;
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LootSimulateMultipleCommand extends AdvancedCommand {
+ public LootSimulateMultipleCommand() {
+ super(List.of("loot"));
+ addLiteral("simulate");
+ addArgument("level", new ArrayList<>());
+ addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ addArgument("playerName", new ArrayList<>());
+ setUsage("/em loot simulate ");
+ setPermission("elitemobs.loot.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Simulates loot drops for the specified amount of times for the specified level and player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SimLootCommand.runMultipleTimes(
+ commandData.getPlayerSender(),
+ commandData.getIntegerArgument("level"),
+ commandData.getIntegerArgument("times"),
+ commandData.getStringArgument("playerName"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java
new file mode 100644
index 000000000..9e81fb2f6
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java
@@ -0,0 +1,38 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.api.utils.EliteItemManager;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.List;
+
+public class LootStats extends AdvancedCommand {
+ public LootStats() {
+ super(List.of("loot"));
+ addLiteral("stats");
+ setUsage("/em loot stats");
+ setPermission("elitemobs.loot.stats");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Provides EliteMobs stats for the currently held item.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ Player player = commandData.getPlayerSender();
+ ItemStack item = player.getInventory().getItemInMainHand();
+ double attackSpeed = EliteItemManager.getAttackSpeed(item);
+ double damage = EliteItemManager.getBaseDamage(item);
+ double dps = EliteItemManager.getDPS(item);
+ double itemLevel = EliteItemManager.getWeaponLevel(item);
+ double bonusEDPS = EliteItemManager.getTotalDPS(item);
+ player.sendMessage("[EliteMobs] Item Stats:");
+ player.sendMessage("Item attack speed: " + attackSpeed);
+ player.sendMessage("Item damage: " + damage);
+ player.sendMessage("Item EDPS: " + dps);
+ player.sendMessage("Item level: " + itemLevel);
+ player.sendMessage("Item bonus EDPS: " + bonusEDPS);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java
new file mode 100644
index 000000000..176e7f042
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneyAddAllCommand extends AdvancedCommand {
+ public MoneyAddAllCommand() {
+ super(List.of("money"));
+ addLiteral("addAll");
+ addArgument("amount", new ArrayList<>());
+ setUsage("/em money addAll ");
+ setPermission("elitemobs.money.admin");
+ setDescription("Gives every player on the server the specified amount of money.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.addAllCommand(
+ commandData.getCommandSender(),
+ commandData.getDoubleArgument("amount"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java
new file mode 100644
index 000000000..e7089faa2
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneyAddCommand extends AdvancedCommand {
+ public MoneyAddCommand() {
+ super(List.of("money"));
+ addLiteral("add");
+ addArgument("player", new ArrayList<>());
+ addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ setUsage("/em money add ");
+ setPermission("elitemobs.money.admin");
+ setDescription("Gives the specified amount of money to the designated player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.addCommand(
+ commandData.getCommandSender(),
+ commandData.getStringArgument("player"),
+ commandData.getDoubleArgument("amount"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java
new file mode 100644
index 000000000..14cee4268
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class MoneyCheckCommand extends AdvancedCommand {
+ public MoneyCheckCommand() {
+ super(List.of("money"));
+ addLiteral("check");
+ setUsage("/em money check");
+ setPermission("elitemobs.money.check.self");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Checks your EliteMobs currency.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu())
+ new PlayerStatusScreen(commandData.getPlayerSender());
+ else
+ CurrencyCommandsHandler.walletCommand(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java
new file mode 100644
index 000000000..a73f8def9
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneyCheckPlayerCommand extends AdvancedCommand {
+ public MoneyCheckPlayerCommand() {
+ super(List.of("money"));
+ addLiteral("check");
+ addArgument("player", new ArrayList<>());
+ setUsage("/em money check ");
+ setPermission("elitemobs.money.check.others");
+ setDescription("Checks the currency of the specified player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.checkCommand(
+ commandData.getCommandSender(),
+ commandData.getStringArgument("player"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java
new file mode 100644
index 000000000..3bb188cd2
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneyRemoveCommand extends AdvancedCommand {
+ public MoneyRemoveCommand() {
+ super(List.of("money"));
+ addLiteral("remove");
+ addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ setUsage("/em money remove ");
+ setPermission("elitemobs.money.admin");
+ setDescription("Deducts the specified amount of currency from a player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.subtractCommand(
+ commandData.getStringArgument("player"),
+ commandData.getDoubleArgument("amount"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java
new file mode 100644
index 000000000..5a1c9802d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneySetCommand extends AdvancedCommand {
+ public MoneySetCommand() {
+ super(List.of("money"));
+ addLiteral("set");
+ addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ setUsage("/em money set ");
+ setPermission("elitemobs.money.admin");
+ setDescription("Sets the specified amount of currency for the specified player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.setCommand(
+ commandData.getCommandSender(),
+ commandData.getStringArgument("player"),
+ commandData.getDoubleArgument("amount"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java
index d1786284a..4a9c8131e 100644
--- a/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java
@@ -1,9 +1,9 @@
package com.magmaguy.elitemobs.commands;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.MetadataHandler;
-import com.magmaguy.elitemobs.utils.WarningMessage;
-import com.magmaguy.elitemobs.utils.ZipFile;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import com.magmaguy.magmacore.util.Logger;
+import com.magmaguy.magmacore.util.ZipFile;
import org.bukkit.command.CommandSender;
import java.io.File;
@@ -103,7 +103,7 @@ private void recursivelyGetFiles(File scannedFile, File destination) {
} else
Files.copy(scannedFile.toPath(), Path.of(destination.getAbsolutePath() + File.separatorChar + scannedFile.getName()), StandardCopyOption.REPLACE_EXISTING);
} catch (Exception exception) {
- new WarningMessage("Failed to recursively pack dungeon!");
+ Logger.warn("Failed to recursively pack dungeon!");
}
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java
new file mode 100644
index 000000000..1e867ea92
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PackageDungeonCommand extends AdvancedCommand {
+ public PackageDungeonCommand() {
+ super(List.of("package"));
+ addArgument("dungeonName", new ArrayList<>());
+ addArgument("version", new ArrayList<>());
+ setUsage("/em package ");
+ setPermission("elitemobs.package");
+ setDescription("Packages an EliteMobs dungeon for distribution.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ new PackageCommand(commandData.getCommandSender(),
+ commandData.getStringArgument("dungeonName"),
+ commandData.getStringArgument("version"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java
new file mode 100644
index 000000000..fdd48e0a0
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PayCommand extends AdvancedCommand {
+ public PayCommand() {
+ super(List.of("pay"));
+ addArgument("player", new ArrayList<>());
+ addArgument("amount", new ArrayList<>());
+ setDescription("Send money to a player, minus tax.");
+ setUsage("/em pay ");
+ setPermission("elitemobs.money.pay");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.payCommand(
+ commandData.getPlayerSender(),
+ commandData.getStringArgument("player"),
+ commandData.getDoubleArgument("amount"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java
new file mode 100644
index 000000000..2a65ae715
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java
@@ -0,0 +1,32 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class PlaceBossCommand extends AdvancedCommand {
+ public PlaceBossCommand() {
+ super(List.of("place"));
+ addLiteral("boss");
+ List regionalBosses = new ArrayList<>();
+ for (Map.Entry entry : CustomBossesConfig.getCustomBosses().entrySet())
+ if (entry.getValue().isRegionalBoss())
+ regionalBosses.add(entry.getKey());
+ addArgument("filename", regionalBosses);
+ setUsage("/em place boss ");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Add a spawn location for the specified boss at your current location.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CustomBossCommandHandler.addSpawnLocation(commandData.getStringArgument("filename"), commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java
new file mode 100644
index 000000000..c1f31c9cd
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.NPCCommands;
+import com.magmaguy.elitemobs.config.npcs.NPCsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlaceNPCCommand extends AdvancedCommand {
+ public PlaceNPCCommand() {
+ super(List.of("place"));
+ addLiteral("npc");
+ addArgument("filename", new ArrayList<>(NPCsConfig.npcEntities.keySet()));
+ setUsage("/em place npc ");
+ setPermission("elitemobs.place.npc");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Permanently adds an npc to the location the user is standing on.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ NPCCommands.set(commandData.getPlayerSender(), commandData.getStringArgument("filename"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java
new file mode 100644
index 000000000..b47ae3621
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlaceTreasureChestCommand extends AdvancedCommand {
+ public PlaceTreasureChestCommand() {
+ super(List.of("place"));
+ addLiteral("treasureChest");
+ addArgument("filename", new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet()));
+ setUsage("/em place treasureChest ");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Permanently adds a treasure chest to the location the user is standing on.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CustomTreasureChestsConfig.addTreasureChestEntry(commandData.getPlayerSender(), commandData.getStringArgument("filename"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java
new file mode 100644
index 000000000..04cb8aa06
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java
@@ -0,0 +1,42 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.wormholes.WormholeConfig;
+import com.magmaguy.elitemobs.wormhole.Wormhole;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlaceWormholeCommand extends AdvancedCommand {
+ public PlaceWormholeCommand() {
+ super(List.of("place"));
+ addLiteral("wormhole");
+ addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet()));
+ addArgument("wormholeOption", List.of(1, 2));
+ setUsage("/em place wormhole <1/2>");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Place a wormhole teleport at your current location.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ for (Wormhole wormhole : Wormhole.getWormholes()) {
+ if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("filename")))
+ switch (commandData.getStringArgument("wormholeOption")) {
+ case "1":
+ wormhole.getWormholeEntry1().updateLocation(commandData.getPlayerSender());
+ return;
+ case "2":
+ wormhole.getWormholeEntry2().updateLocation(commandData.getPlayerSender());
+ return;
+ default:
+ Logger.sendMessage(commandData.getCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole.");
+ }
+ }
+ Logger.sendMessage(commandData.getCommandSender(), "Failed to set location for this wormhole.");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java
new file mode 100644
index 000000000..89e65f2ed
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.dungeons.DungeonProtector;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class ProtectionBypassCommand extends AdvancedCommand {
+ public ProtectionBypassCommand() {
+ super(List.of("protection"));
+ addLiteral("bypass");
+ setPermission("elitemobs.protection.bypass");
+ setDescription("Allows admins to toggle bypassing protections");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ boolean outcome = DungeonProtector.toggleBypass(commandData.getPlayerSender().getUniqueId());
+ Logger.sendMessage(commandData.getCommandSender(), "Bypassing dungeon protections is now " + outcome);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java
new file mode 100644
index 000000000..e5526ea69
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestAcceptCommand extends AdvancedCommand {
+ public QuestAcceptCommand() {
+ super(List.of("quest"));
+ addLiteral("accept");
+ addArgument("questID", new ArrayList<>());
+ setUsage("/em quest accept ");
+ setPermission("elitemobs.quest.accept");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Accepts a quest. Used via menu, can't be directly used.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.joinQuest(commandData.getStringArgument("questID"), commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java
new file mode 100644
index 000000000..83619bbae
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldowns;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class QuestBypassCommand extends AdvancedCommand {
+ public QuestBypassCommand() {
+ super(List.of("quest"));
+ addLiteral("bypass");
+ setUsage("/em quest bypass");
+ setPermission("elitemobs.quest.bypass");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Bypasses permission restrictions for elite quests.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.bypassQuestRequirements(commandData.getPlayerSender());
+ if (PlayerQuestCooldowns.bypassesQuestRestrictions(commandData.getPlayerSender()))
+ Logger.sendMessage(commandData.getCommandSender(), "Now bypassing quest permission requirements!");
+ else
+ Logger.sendMessage(commandData.getCommandSender(), "No longer bypassing quest permission requirements!");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java
new file mode 100644
index 000000000..232fb266a
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class QuestCompleteCommand extends AdvancedCommand {
+ public QuestCompleteCommand() {
+ super(List.of("quest"));
+ addLiteral("complete");
+ setUsage("/em quest complete");
+ setPermission("elitemobs.quest.complete.force");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Forces all of your currently active elite quests to be completed. For debugging use only.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.completeQuest(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java
new file mode 100644
index 000000000..be7f31614
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestCompleteQuestCommand extends AdvancedCommand {
+ public QuestCompleteQuestCommand() {
+ super(List.of("quest"));
+ addLiteral("complete");
+ addArgument("id", new ArrayList<>());
+ setUsage("/em quest complete");
+ setPermission("elitemobs.quest.complete");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Completes a quest for a player. Meant to be used via menu, not directly.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.completeQuest(commandData.getStringArgument("id"), commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java
new file mode 100644
index 000000000..3472647ca
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestLeaveCommand extends AdvancedCommand {
+ public QuestLeaveCommand() {
+ super(List.of("quest"));
+ addLiteral("leave");
+ addArgument("questID", new ArrayList<>());
+ setUsage("/em quest leave");
+ setPermission("elitemobs.quest.leave");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Leaves a quest. Used via menu, can't be directly used.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.leaveQuest(commandData.getPlayerSender(), commandData.getStringArgument("questID"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java
new file mode 100644
index 000000000..18b968908
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestResetAllCommand extends AdvancedCommand {
+ public QuestResetAllCommand() {
+ super(List.of("quest"));
+ addLiteral("resetAll");
+ addArgument("player", new ArrayList<>());
+ setUsage("/em quest resetAll ");
+ setPermission("elitemobs.quest.reset.all");
+ setDescription("Resets all quests for a specific player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.resetQuests(commandData.getCommandSender(), commandData.getStringArgument("player"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java
new file mode 100644
index 000000000..f57951bbd
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestResetCommand extends AdvancedCommand {
+ public QuestResetCommand() {
+ super(List.of("quest"));
+ addLiteral("reset");
+ addArgument("player", new ArrayList<>());
+ addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet()));
+ setUsage("/em quest reset ");
+ setPermission("elitemobs.quest.reset");
+ setDescription("Resets a specific quest for a specific player.");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.resetQuest(commandData.getCommandSender(), commandData.getStringArgument("player"), commandData.getStringArgument("questName"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java
new file mode 100644
index 000000000..207a34243
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestTrackCommand extends AdvancedCommand {
+ public QuestTrackCommand() {
+ super(List.of("quest"));
+ addLiteral("track");
+ addArgument("questID", new ArrayList<>());
+ setUsage("/em quest track ");
+ setPermission("elitemobs.quest.track");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Tracks a quest. Used via menu, can't be directly used.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.trackQuest(commandData.getStringArgument("questID"), commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java
new file mode 100644
index 000000000..148b2b2bf
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class QuitCommand extends AdvancedCommand {
+ public QuitCommand() {
+ super(List.of("quit"));
+ setDescription("When in instanced content, makes the player leave the instance.");
+ setUsage("/em quit");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(commandData.getPlayerSender());
+ if (matchInstance != null)
+ matchInstance.removeAnyKind(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java
new file mode 100644
index 000000000..b85485726
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class RankCommand extends AdvancedCommand {
+ public RankCommand() {
+ super(List.of("rank"));
+ setUsage("/em rank");
+ setDescription("Opens the EliteMobs rank menu or teleports you to the Adventurer's Guild.");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender()))
+ AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java
new file mode 100644
index 000000000..b4730d04b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RankSetCommand extends AdvancedCommand {
+ public RankSetCommand() {
+ super(List.of("rank"));
+ addArgument("player", new ArrayList<>());
+ addArgument("prestigeLevel", new ArrayList<>());
+ addArgument("guildLevel", new ArrayList<>());
+ setUsage("/em rank ");
+ setPermission("elitemobs.rank.set");
+ setDescription("Manually sets a player's guild rank to a the prestige level and guild level specified.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ GuildRankCommands.setGuildRank(commandData.getCommandSender(),
+ commandData.getStringArgument("player"),
+ commandData.getIntegerArgument("prestigeLevel"),
+ commandData.getIntegerArgument("guildLevel"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java
new file mode 100644
index 000000000..efc3774b9
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.command.CommandSender;
+
+import java.util.List;
+
+public class ReloadCommand extends AdvancedCommand {
+ public ReloadCommand() {
+ super(List.of("reload"));
+ setUsage("/em reload");
+ setPermission("elitemobs.reload");
+ setDescription("Reloads EliteMobs.");
+ }
+
+ public static void reload(CommandSender commandSender) {
+ MetadataHandler.PLUGIN.onDisable();
+ MetadataHandler.PLUGIN.onLoad();
+ MetadataHandler.PLUGIN.onEnable();
+ Logger.sendMessage(commandSender, "Plugin reloaded!");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ reload(commandData.getCommandSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java
new file mode 100644
index 000000000..2110beb14
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class RemoveCommand extends AdvancedCommand {
+ public RemoveCommand() {
+ super(List.of("remove"));
+ setUsage("/em remove");
+ setPermission("elitemobs.remove");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ com.magmaguy.elitemobs.commands.admin.RemoveCommand.remove(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java
new file mode 100644
index 000000000..a1d6adeab
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.RepairMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class RepairCommand extends AdvancedCommand {
+ public RepairCommand() {
+ super(List.of("repair"));
+ setUsage("/em repair");
+ setPermission("elitemobs.repair.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the repair item menu or teleports the player to the Adventurer's Guild Hub.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) {
+ RepairMenu repairMenu = new RepairMenu();
+ repairMenu.constructRepairMenu(commandData.getPlayerSender());
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java
new file mode 100644
index 000000000..63766ad2d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.List;
+
+public class RespawnAllCommand extends AdvancedCommand {
+ public RespawnAllCommand() {
+ super(List.of("respawn"));
+ addLiteral("all");
+ setUsage("/em respawn all");
+ setPermission("elitemobs.respawn.force");
+ setDescription("Forces all regional bosses to respawn.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ RegionalBossEntity.getRegionalBossEntities().forEach(regionalBossEntity -> {
+ if (regionalBossEntity.isRespawning()) regionalBossEntity.forceRespawn();
+ });
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java
new file mode 100644
index 000000000..534216f7e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.ScrapperMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class ScrapCommand extends AdvancedCommand {
+ public ScrapCommand() {
+ super(List.of("scrap"));
+ setUsage("/em scrap");
+ setPermission("elitemobs.scrap.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the scrap menu or teleports the player to the Adventurer's Guild Hub.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) {
+ ScrapperMenu scrapperMenu = new ScrapperMenu();
+ scrapperMenu.constructScrapMenu(commandData.getPlayerSender());
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java
new file mode 100644
index 000000000..743545e32
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.setup.SetupMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class SetupCommand extends AdvancedCommand {
+ public SetupCommand() {
+ super(List.of("setup"));
+ setPermission("elitemobs.setup");
+ setSenderType(SenderType.PLAYER);
+ setDescription("The main command for setting up EliteMobs!");
+ setUsage("/em setup");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ new SetupMenu(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java
new file mode 100644
index 000000000..c94084e30
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class SetupDoneCommand extends AdvancedCommand {
+ public SetupDoneCommand() {
+ super(List.of("setup"));
+ addLiteral("done");
+ setUsage("/em setup done");
+ setPermission("elitemobs.setup");
+ setDescription("Toggles whether the setup message will show up.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ DefaultConfig.toggleSetupDone();
+ if (DefaultConfig.isSetupDone())
+ Logger.sendMessage(commandData.getCommandSender(), "&aEliteMobs will no longer send messages on login. You can do [/em setup done] again to revert this.");
+ else
+ Logger.sendMessage(commandData.getCommandSender(), "&aEliteMobs will once again send messages on login. You can do [/em setup done] again to revert this.");
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java
deleted file mode 100644
index 190fb6ea4..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/SetupHandler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.ChatColorConverter;
-import com.magmaguy.elitemobs.EliteMobs;
-import com.magmaguy.elitemobs.commands.setup.SetupMenu;
-import com.magmaguy.elitemobs.dungeons.EMPackage;
-import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-
-public class SetupHandler {
-
- public static void setupMenuCommand(Player player) {
- new SetupMenu(player);
- }
-
- public static void setupMinidungeonCommand(Player player, String minidungeonName) {
- EMPackage emPackage = EMPackage.getEmPackages().get(minidungeonName);
- emPackage.install(player, true);
- }
-
- public static void setupMinidungeonNoPasteCommand(Player player, String minidungeonName) {
- EMPackage emPackage = EMPackage.getEmPackages().get(minidungeonName);
- emPackage.install(player, false);
- }
-
- public static void setupUnminidungeonCommand(Player player, String minidungeonName) {
- EMPackage minidungeon = EMPackage.getEmPackages().get(minidungeonName);
- minidungeon.uninstall(player);
- player.performCommand("/undo");
- }
-
- public static void setupAreaCommand(Player player, String regionName) {
- if (!EliteMobs.worldGuardIsEnabled) {
- player.sendMessage("[EliteMobs] You don't have WorldGuard installed! It is not possible to correctly set " +
- "up a lair/minidungeon/dungeon without that plugin!");
- return;
- }
- if (!WorldGuardCompatibility.protectMinidungeonArea(regionName, player.getLocation())) {
- player.sendMessage(ChatColorConverter.convert("&4[EliteMobs] Failed to protect region! Was the region name correct?"));
- //worldguardextraflags
- if (Bukkit.getPluginManager().isPluginEnabled("WorldGuardExtraFlags")) {
- commandPackage("&2", "fly", "deny", player, regionName);
- } else {
- player.sendMessage(ChatColor.RED + "[EliteMobs] Warning: the WorldGuardExtraFlags plugin is not present. It is recommended for the use of the anti-flight flag.");
- }
-
- player.performCommand("rg info");
- } else
- player.sendMessage(ChatColorConverter.convert("&2[EliteMobs] Set all WorldGuard flags correctly!"));
-
- }
-
- private static void commandPackage(String colorCode, String flagString, String state, Player player, String regionName) {
- player.sendMessage(flagString(colorCode + flagString, player));
- player.performCommand(commandString(flagString, state, player, regionName));
- }
-
- private static String flagString(String flagString, Player player) {
- return ChatColorConverter.convert("&a[EliteMobs] Adding flag " + flagString);
- }
-
- private static String commandString(String flagString, String state, Player player, String regionName) {
- return "region flag " + regionName + " " + flagString + " " + state;
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java
new file mode 100644
index 000000000..89082a29f
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java
@@ -0,0 +1,35 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.dungeons.EMPackage;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class SetupToggleCommand extends AdvancedCommand {
+ public SetupToggleCommand() {
+ super(List.of("setup"));
+ addLiteral("toggle");
+ addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList()));
+ setUsage("/em setup toggle ");
+ setPermission("elitemobs.setup");
+ setDescription("Allows you to toggle the installation of specified EliteMobs content.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ String dungeon = commandData.getStringArgument("empackages");
+ if (dungeon.isEmpty() || EMPackage.getEmPackages().get(dungeon) == null)
+ Logger.sendMessage(commandData.getCommandSender(), "Not a valid em package!");
+ EMPackage emPackage = EMPackage.getEmPackages().get(dungeon);
+ if (emPackage.install()) {
+ if (emPackage.isInstalled())
+ Logger.sendMessage(commandData.getCommandSender(), "Successfully installed content!");
+ else
+ Logger.sendMessage(commandData.getCommandSender(), "Successfully uninstalled content!");
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java
new file mode 100644
index 000000000..46b26dea2
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.items.ShareItem;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class ShareItemCommand extends AdvancedCommand {
+ public ShareItemCommand() {
+ super(List.of("shareItem"));
+ setUsage("/em shareItem");
+ setPermission("elitemobs.shareitem");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Shares the stats of the currently held EliteMobs item in chat.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ ShareItem.showOnChat(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java
new file mode 100644
index 000000000..51d1ee9db
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.CustomShopMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class ShopCustomCommand extends AdvancedCommand {
+ public ShopCustomCommand() {
+ super(List.of("shop"));
+ addLiteral("custom");
+ setUsage("/em shop custom");
+ setPermission("elitemobs.shop.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender()))
+ CustomShopMenu.customShopInitializer(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java
new file mode 100644
index 000000000..2d005cc46
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.CustomShopMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.Bukkit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ShopCustomOtherCommand extends AdvancedCommand {
+ public ShopCustomOtherCommand() {
+ super(List.of("shop"));
+ addLiteral("custom");
+ addArgument("player", new ArrayList<>());
+ setUsage("/em shop custom ");
+ setPermission("elitemobs.shop.custom.other");
+ setDescription("Opens the EliteMobs shop for custom items for the specified player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ try {
+ CustomShopMenu.customShopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player")));
+ } catch (Exception ex) {
+ Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java
new file mode 100644
index 000000000..a4c047071
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.ProceduralShopMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class ShopDynamicCommand extends AdvancedCommand {
+ public ShopDynamicCommand() {
+ super(List.of("shop"));
+ addLiteral("dynamic");
+ setUsage("/em shop dynamic");
+ setPermission("elitemobs.shop.dynamic");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender()))
+ ProceduralShopMenu.shopInitializer(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java
new file mode 100644
index 000000000..5984710df
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.ProceduralShopMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.Bukkit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ShopProceduralOtherCommand extends AdvancedCommand {
+ public ShopProceduralOtherCommand() {
+ super(List.of("shop"));
+ addLiteral("procedural");
+ addArgument("player", new ArrayList<>());
+ setUsage("/em shop procedural ");
+ setPermission("elitemobs.*");
+ setDescription("Opens the EliteMobs shop for procedurally generated items.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ try {
+ ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player")));
+ } catch (Exception ex) {
+ Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java
new file mode 100644
index 000000000..f4af0c02d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java
@@ -0,0 +1,31 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.SellMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.Bukkit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ShopSellOtherCommand extends AdvancedCommand {
+ public ShopSellOtherCommand() {
+ super(List.of("shop"));
+ addLiteral("sell");
+ addArgument("player", new ArrayList<>());
+ setUsage("/em shop sell ");
+ setPermission("elitemobs.shop.sell.other");
+ setDescription("Opens the EliteMobs shop sell menu for the specified player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SellMenu sellMenu = new SellMenu();
+ try {
+ sellMenu.constructSellMenu(Bukkit.getPlayer(commandData.getStringArgument("player")));
+ } catch (Exception ex) {
+ Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java
new file mode 100644
index 000000000..8f2871d95
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java
@@ -0,0 +1,39 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import org.bukkit.Bukkit;
+import org.bukkit.generator.WorldInfo;
+import org.bukkit.util.Vector;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class SpawnBossAtCommand extends AdvancedCommand {
+ public SpawnBossAtCommand() {
+ super(List.of("spawn"));
+ addLiteral("bossAt");
+ addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()));
+ addArgument("worldName", Bukkit.getWorlds().stream().map(WorldInfo::getName).collect(Collectors.toList()));
+ addArgument("x", new ArrayList<>());
+ addArgument("y", new ArrayList<>());
+ addArgument("z", new ArrayList<>());
+ setUsage("/em spawn bossAt ");
+ setPermission("elitemobs.place.admin");
+ setDescription("Spawns a custom boss at the specified location.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SpawnCommand.spawnCustomBossCommand(
+ commandData.getCommandSender(),
+ commandData.getStringArgument("filename"),
+ commandData.getStringArgument("worldName"),
+ new Vector(
+ commandData.getDoubleArgument("x"),
+ commandData.getDoubleArgument("y"),
+ commandData.getDoubleArgument("z")));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java
new file mode 100644
index 000000000..2deb74068
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SpawnBossCommand extends AdvancedCommand {
+ public SpawnBossCommand() {
+ super(List.of("spawn"));
+ addLiteral("boss");
+ addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()));
+ setUsage("/em spawn boss ");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Spawns a custom boss at the location the user is looking at.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SpawnCommand.spawnCustomBossCommand(
+ commandData.getPlayerSender(),
+ commandData.getStringArgument("filename"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java
new file mode 100644
index 000000000..1fe0eecfc
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java
@@ -0,0 +1,41 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import org.bukkit.Bukkit;
+import org.bukkit.generator.WorldInfo;
+import org.bukkit.util.Vector;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class SpawnBossLevelAtCommand extends AdvancedCommand {
+ public SpawnBossLevelAtCommand() {
+ super(List.of("spawn"));
+ addLiteral("bossAt");
+ addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()));
+ addArgument("worldName", Bukkit.getWorlds().stream().map(WorldInfo::getName).collect(Collectors.toList()));
+ addArgument("x", new ArrayList<>());
+ addArgument("y", new ArrayList<>());
+ addArgument("z", new ArrayList<>());
+ addArgument("level", new ArrayList<>());
+ setUsage("/em spawn bossAt ");
+ setPermission("elitemobs.place.admin");
+ setDescription("Spawns a custom boss at the specified location with the specified level.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SpawnCommand.spawnCustomBossCommand(
+ commandData.getCommandSender(),
+ commandData.getStringArgument("filename"),
+ commandData.getStringArgument("worldName"),
+ new Vector(
+ commandData.getDoubleArgument("x"),
+ commandData.getDoubleArgument("y"),
+ commandData.getDoubleArgument("z")),
+ commandData.getIntegerArgument("level"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java
new file mode 100644
index 000000000..cb6a6515e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SpawnBossLevelCommand extends AdvancedCommand {
+ public SpawnBossLevelCommand() {
+ super(List.of("spawn"));
+ addLiteral("boss");
+ addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()));
+ addArgument("level", List.of("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"));
+ setUsage("/em spawn boss ");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Spawns a custom boss at the location the user is looking at with the specified level.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SpawnCommand.spawnCustomBossCommand(
+ commandData.getPlayerSender(),
+ commandData.getStringArgument("filename"),
+ commandData.getIntegerArgument("level"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java
index ef7ed08ba..322e88eeb 100644
--- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java
@@ -1,17 +1,15 @@
package com.magmaguy.elitemobs.commands;
-import com.magmaguy.elitemobs.ChatColorConverter;
import com.magmaguy.elitemobs.config.CustomConfigFields;
import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields;
import com.magmaguy.elitemobs.config.powers.PowersConfig;
import com.magmaguy.elitemobs.config.powers.PowersConfigFields;
import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
-import com.magmaguy.elitemobs.mobconstructor.SuperMobConstructor;
import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties;
-import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties;
import com.magmaguy.elitemobs.powers.meta.ElitePower;
+import com.magmaguy.magmacore.util.ChatColorConverter;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
@@ -29,13 +27,14 @@
*/
public class SpawnCommand {
- public static void spawnEliteEntityTypeCommand(Player player, EntityType entityType, Integer level, Optional powers) {
+ public static void spawnEliteEntityTypeCommand(Player player, EntityType entityType, Integer level, Optional powers) {
LivingEntity livingEntity = (LivingEntity) player.getLocation().getWorld().spawnEntity(getLocation(player), entityType);
EliteEntity eliteEntity = new EliteEntity();
eliteEntity.setLevel(level);
- if (powers.isPresent()){
- HashSet mobPowers = getPowers(powers.get(), player);
+ if (powers.isPresent()) {
+ String[] powersArray = powers.get().split(" ");
+ HashSet mobPowers = getPowers(powersArray, player);
eliteEntity.applyPowers(mobPowers);
} else {
eliteEntity.randomizePowers(EliteMobProperties.getPluginData(livingEntity));
@@ -48,7 +47,7 @@ public static void spawnEliteEntityTypeCommand(CommandSender commandSender,
String world,
Vector coords,
Integer level,
- Optional powers) {
+ Optional powers) {
try {
Location location = new Location(Bukkit.getWorld(world), coords.getX(), coords.getY(), coords.getZ());
spawnEliteEntityTypeCommand(commandSender,
@@ -65,14 +64,17 @@ public static void spawnEliteEntityTypeCommand(CommandSender commandSender,
Location location,
EntityType entityType,
Integer level,
- Optional powers) {
+ Optional powers) {
if (!EliteMobProperties.getValidMobTypes().contains(entityType)) {
commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Entity type " + entityType.toString() + " can't be an Elite!"));
return;
}
LivingEntity livingEntity = (LivingEntity) location.getWorld().spawnEntity(location, entityType);
HashSet mobPowers = new HashSet<>();
- if (powers.isPresent()) mobPowers = getPowers(powers.get(), commandSender);
+ if (powers.isPresent()) {
+ String[] powersArray = powers.get().split(" ");
+ mobPowers = getPowers(powersArray, commandSender);
+ }
EliteEntity eliteEntity = new EliteEntity();
eliteEntity.setLevel(level);
eliteEntity.setLivingEntity(livingEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
@@ -145,12 +147,6 @@ public static void spawnCustomBossCommand(Player player, String fileName) {
customBossEntity.spawn(false);
}
- public static void spawnSuperMobCommand(Player player, EntityType entityType) {
- if (SuperMobProperties.isValidSuperMobType(entityType))
- spawnSuperMob(entityType, getLocation(player));
- else
- player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Entity type " + entityType.toString() + " can't be a Super Mob!"));
- }
private static Location getLocation(Player player) {
return player.getTargetBlock(null, 30).getLocation().add(0.5, 1, 0.5);
@@ -160,25 +156,20 @@ private static HashSet getPowers(String[] mobPowers, Command
HashSet elitePowers = new HashSet<>();
- if (mobPowers.length > 0)
- for (String string : mobPowers) {
- PowersConfigFields powersConfigFields = PowersConfig.getPower(string);
- if (powersConfigFields == null) {
- commandSender.sendMessage("[EliteMobs] Power " + string + " is not a valid power! Valid powers:");
- StringBuilder allPowers = new StringBuilder();
- for (CustomConfigFields iteratedField : ElitePower.getElitePowers().values())
- allPowers.append(iteratedField.getFilename()).append(", ");
- allPowers.append("custom");
- commandSender.sendMessage(allPowers.toString());
- return new HashSet<>();
- }
- elitePowers.add(powersConfigFields);
+ for (String string : mobPowers) {
+ PowersConfigFields powersConfigFields = PowersConfig.getPower(string);
+ if (powersConfigFields == null) {
+ commandSender.sendMessage("[EliteMobs] Power " + string + " is not a valid power! Valid powers:");
+ StringBuilder allPowers = new StringBuilder();
+ for (CustomConfigFields iteratedField : ElitePower.getElitePowers().values())
+ allPowers.append(iteratedField.getFilename()).append(", ");
+ allPowers.append("custom");
+ commandSender.sendMessage(allPowers.toString());
+ return new HashSet<>();
}
+ elitePowers.add(powersConfigFields);
+ }
return elitePowers;
}
- private static void spawnSuperMob(EntityType entityType, Location location) {
- SuperMobConstructor.constructSuperMob((LivingEntity) location.getWorld().spawnEntity(location, entityType));
- }
-
}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java
new file mode 100644
index 000000000..4823c0c5e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java
@@ -0,0 +1,34 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.powers.meta.ElitePower;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import org.bukkit.entity.EntityType;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+public class SpawnElite extends AdvancedCommand {
+ public SpawnElite() {
+ super(List.of("spawn"));
+ addLiteral("elite");
+ addArgument("entityType", new ArrayList<>());
+ addArgument("level", new ArrayList<>());
+ addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList());
+ setUsage("/em spawn elite