forked from Upstream/mmocore
Merge
This commit is contained in:
commit
6247bf4fe2
@ -4,6 +4,7 @@
|
||||
<id>nexus</id>
|
||||
<username>${env.M2_REPO_USER}</username>
|
||||
<password>${env.M2_REPO_PASS}</password>
|
||||
<blocked>false</blocked>
|
||||
</server>
|
||||
<server>
|
||||
<id>lumine</id>
|
||||
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="MavenCustomPomFilePath">
|
||||
<option name="mavenPomFileUrl" value="file://$MODULE_DIR$/dependency-reduced-pom.xml" />
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$/src/main/java">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
</content>
|
||||
<content url="file://$MODULE_DIR$/src/main/resources">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
492
pom.xml
492
pom.xml
@ -1,280 +1,284 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<version>1.9.5</version>
|
||||
<name>MMOCore</name>
|
||||
<description>Offer your players a brand new RPG experience!!</description>
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<version>1.9.5</version>
|
||||
<name>MMOCore</name>
|
||||
<description>Offer your players a brand new RPG experience!!</description>
|
||||
|
||||
<properties>
|
||||
<downloadSources>false</downloadSources>
|
||||
<downloadJavadocs>false</downloadJavadocs>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
<properties>
|
||||
<downloadSources>false</downloadSources>
|
||||
<downloadJavadocs>false</downloadJavadocs>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Releases</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Snapshots</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Releases</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Snapshots</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
|
||||
</distributionManagement>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<build>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
|
||||
</plugin>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
|
||||
<configuration>
|
||||
<source>9</source>
|
||||
<target>9</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<compilerArgument>-proc:none</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<configuration>
|
||||
<source>16</source>
|
||||
<target>16</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<compilerArgument>-proc:none</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<configuration>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<configuration>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>phoenix</id>
|
||||
<url>http://la-grange-evasion.pro.dns-orange.fr:8081/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>lumine</id>
|
||||
<url>https://mvn.lumine.io/repository/maven/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>lumine</id>
|
||||
<url>https://mvn.lumine.io/repository/maven/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sk89q-repo</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependencies>
|
||||
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-1.17.1</artifactId>
|
||||
<version>dev</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Extra libs -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>19.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.papermc</groupId>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.20</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Plugin dependencies -->
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>MythicLib-dist</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>Mythic-Dist</artifactId>
|
||||
<version>5.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.9.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>Citizens</artifactId>
|
||||
<version>2.0.25</version>
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-1.17.1</artifactId>
|
||||
<version>dev</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
<!-- Party plugins -->
|
||||
<dependency>
|
||||
<groupId>de.simonsator</groupId>
|
||||
<artifactId>PartyAndFriends</artifactId>
|
||||
<version>1.0.65</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Extra libs -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alessiodp</groupId>
|
||||
<artifactId>Parties</artifactId>
|
||||
<version>3.1.14</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.papermc</groupId>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.209</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.20</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.erethon</groupId>
|
||||
<artifactId>DungeonsXL</artifactId>
|
||||
<version>0.18-PRE-02</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Plugin dependencies -->
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>MythicLib-dist</artifactId>
|
||||
<version> 1.3.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.denizen</groupId>
|
||||
<artifactId>Dungeons</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>Mythic-Dist</artifactId>
|
||||
<version>5.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!--Quest Plugin-->
|
||||
<dependency>
|
||||
<groupId>me.blackvein</groupId>
|
||||
<artifactId>Quests</artifactId>
|
||||
<version>4.4.1-b340</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.skytasul.quests</groupId>
|
||||
<artifactId>BeautyQuests</artifactId>
|
||||
<version>0.19.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.guillaumevdn</groupId>
|
||||
<artifactId>QuestCreator</artifactId>
|
||||
<version>6.39.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.guillaumevdn</groupId>
|
||||
<artifactId>GCore</artifactId>
|
||||
<version>8.39.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.9.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>Citizens</artifactId>
|
||||
<version>2.0.25</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Party plugins -->
|
||||
<dependency>
|
||||
<groupId>de.simonsator</groupId>
|
||||
<artifactId>PartyAndFriends</artifactId>
|
||||
<version>1.0.65</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alessiodp</groupId>
|
||||
<artifactId>Parties</artifactId>
|
||||
<version>3.1.14</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.209</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.erethon</groupId>
|
||||
<artifactId>DungeonsXL</artifactId>
|
||||
<version>0.18-PRE-02</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.denizen</groupId>
|
||||
<artifactId>Dungeons</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!--Quest Plugin-->
|
||||
<dependency>
|
||||
<groupId>me.blackvein</groupId>
|
||||
<artifactId>Quests</artifactId>
|
||||
<version>4.4.1-b340</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.skytasul.quests</groupId>
|
||||
<artifactId>BeautyQuests</artifactId>
|
||||
<version>0.19.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.guillaumevdn</groupId>
|
||||
<artifactId>QuestCreator</artifactId>
|
||||
<version>6.39.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.guillaumevdn</groupId>
|
||||
<artifactId>GCore</artifactId>
|
||||
<version>8.39.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Guild plugins -->
|
||||
<dependency>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>Factions</artifactId>
|
||||
<version>1.6.9.5-2.9.8-RC</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Guild plugins -->
|
||||
<dependency>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>Factions</artifactId>
|
||||
<version>1.6.9.5-2.9.8-RC</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.ulrich</groupId>
|
||||
<artifactId>UltimateClans</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.ulrich</groupId>
|
||||
<artifactId>UltimateClans</artifactId>
|
||||
<version>4.2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.glaremasters</groupId>
|
||||
<artifactId>Guilds</artifactId>
|
||||
<version>3.5.6.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.glaremasters</groupId>
|
||||
<artifactId>Guilds</artifactId>
|
||||
<version>3.5.6.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.kingdoms.main</groupId>
|
||||
<artifactId>Kingdoms</artifactId>
|
||||
<version>1.11.15.0.0.0.1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kingdoms.main</groupId>
|
||||
<artifactId>Kingdoms</artifactId>
|
||||
<version>1.11.15.0.0.0.1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Quest plugins -->
|
||||
<!-- Quest plugins -->
|
||||
|
||||
</dependencies>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -12,7 +12,6 @@ import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||
import net.Indyuce.mmocore.api.util.debug.DebugMode;
|
||||
import net.Indyuce.mmocore.command.*;
|
||||
import net.Indyuce.mmocore.comp.MMOCoreTargetRestriction;
|
||||
import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener;
|
||||
import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.MythicHook;
|
||||
@ -59,256 +58,267 @@ import java.util.Iterator;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class MMOCore extends LuminePlugin {
|
||||
public static MMOCore plugin;
|
||||
public static MMOCore plugin;
|
||||
|
||||
public final WaypointManager waypointManager = new WaypointManager();
|
||||
public final SoundManager soundManager = new SoundManager();
|
||||
public final RequestManager requestManager = new RequestManager();
|
||||
public final ConfigItemManager configItems = new ConfigItemManager();
|
||||
public final PlayerActionBar actionBarManager = new PlayerActionBar();
|
||||
public final SkillManager skillManager = new SkillManager();
|
||||
public final ClassManager classManager = new ClassManager();
|
||||
public final DropTableManager dropTableManager = new DropTableManager();
|
||||
public final BoosterManager boosterManager = new BoosterManager();
|
||||
public final AttributeManager attributeManager = new AttributeManager();
|
||||
public final PartyManager partyManager = new PartyManager();
|
||||
public final QuestManager questManager = new QuestManager();
|
||||
public final ProfessionManager professionManager = new ProfessionManager();
|
||||
public final ExperienceManager experience = new ExperienceManager();
|
||||
public final LootChestManager lootChests = new LootChestManager();
|
||||
public final MMOLoadManager loadManager = new MMOLoadManager();
|
||||
public final RestrictionManager restrictionManager = new RestrictionManager();
|
||||
public final SkillTreeManager skillTreeManager = new SkillTreeManager();
|
||||
public final WaypointManager waypointManager = new WaypointManager();
|
||||
public final SoundManager soundManager = new SoundManager();
|
||||
public final RequestManager requestManager = new RequestManager();
|
||||
public final ConfigItemManager configItems = new ConfigItemManager();
|
||||
public final PlayerActionBar actionBarManager = new PlayerActionBar();
|
||||
public final SkillManager skillManager = new SkillManager();
|
||||
public final ClassManager classManager = new ClassManager();
|
||||
public final DropTableManager dropTableManager = new DropTableManager();
|
||||
public final BoosterManager boosterManager = new BoosterManager();
|
||||
public final AttributeManager attributeManager = new AttributeManager();
|
||||
public final PartyManager partyManager = new PartyManager();
|
||||
public final QuestManager questManager = new QuestManager();
|
||||
public final ProfessionManager professionManager = new ProfessionManager();
|
||||
public final ExperienceManager experience = new ExperienceManager();
|
||||
public final LootChestManager lootChests = new LootChestManager();
|
||||
public final MMOLoadManager loadManager = new MMOLoadManager();
|
||||
public final RestrictionManager restrictionManager = new RestrictionManager();
|
||||
public final SkillTreeManager skillTreeManager = new SkillTreeManager();
|
||||
|
||||
// Profession managers
|
||||
public final CustomBlockManager mineManager = new CustomBlockManager();
|
||||
public final FishingManager fishingManager = new FishingManager();
|
||||
public final AlchemyManager alchemyManager = new AlchemyManager();
|
||||
public final EnchantManager enchantManager = new EnchantManager();
|
||||
public final SmithingManager smithingManager = new SmithingManager();
|
||||
// Profession managers
|
||||
public final CustomBlockManager mineManager = new CustomBlockManager();
|
||||
public final FishingManager fishingManager = new FishingManager();
|
||||
public final AlchemyManager alchemyManager = new AlchemyManager();
|
||||
public final EnchantManager enchantManager = new EnchantManager();
|
||||
public final SmithingManager smithingManager = new SmithingManager();
|
||||
|
||||
@NotNull
|
||||
public ConfigManager configManager;
|
||||
public VaultEconomy economy;
|
||||
public RegionHandler regionHandler = new DefaultRegionHandler();
|
||||
public PlaceholderParser placeholderParser = new DefaultParser();
|
||||
public DataProvider dataProvider = new YAMLDataProvider();
|
||||
@NotNull
|
||||
public ConfigManager configManager;
|
||||
public VaultEconomy economy;
|
||||
public RegionHandler regionHandler = new DefaultRegionHandler();
|
||||
public PlaceholderParser placeholderParser = new DefaultParser();
|
||||
public DataProvider dataProvider = new YAMLDataProvider();
|
||||
|
||||
// Modules
|
||||
@NotNull
|
||||
public PartyModule partyModule;
|
||||
// Modules
|
||||
@NotNull
|
||||
public PartyModule partyModule;
|
||||
|
||||
public boolean shouldDebugSQL = false;
|
||||
public boolean shouldDebugSQL = false;
|
||||
|
||||
private static final int MYTHICLIB_COMPATIBILITY_INDEX = 7;
|
||||
private static final int MYTHICLIB_COMPATIBILITY_INDEX = 7;
|
||||
|
||||
public MMOCore() {
|
||||
plugin = this;
|
||||
}
|
||||
public MMOCore() {
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
public void load() {
|
||||
public void load() {
|
||||
|
||||
// Check if the ML build matches
|
||||
if (MYTHICLIB_COMPATIBILITY_INDEX != MythicLib.MMOCORE_COMPATIBILITY_INDEX) {
|
||||
getLogger().log(Level.WARNING, "Your versions of MythicLib and MMOCore do not match. Make sure you are using the latest builds of both plugins");
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
// Check if the ML build matches
|
||||
if (MYTHICLIB_COMPATIBILITY_INDEX != MythicLib.MMOCORE_COMPATIBILITY_INDEX) {
|
||||
getLogger().log(Level.WARNING, "Your versions of MythicLib and MMOCore do not match. Make sure you are using the latest builds of both plugins");
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
|
||||
// Register target restrictions due to MMOCore in MythicLib
|
||||
MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction());
|
||||
// Register target restrictions due to MMOCore in MythicLib
|
||||
MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction());
|
||||
|
||||
// Register extra objective, drop items...
|
||||
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null)
|
||||
loadManager.registerLoader(new WorldGuardMMOLoader());
|
||||
// Register extra objective, drop items...
|
||||
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null)
|
||||
loadManager.registerLoader(new WorldGuardMMOLoader());
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("Citizens") != null)
|
||||
loadManager.registerLoader(new CitizensMMOLoader());
|
||||
if (Bukkit.getPluginManager().getPlugin("Citizens") != null)
|
||||
loadManager.registerLoader(new CitizensMMOLoader());
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") != null) loadManager.registerLoader(new VaultMMOLoader());
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") != null) loadManager.registerLoader(new VaultMMOLoader());
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null)
|
||||
loadManager.registerLoader(new MythicMobsMMOLoader());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null)
|
||||
loadManager.registerLoader(new MythicMobsMMOLoader());
|
||||
}
|
||||
|
||||
public void enable() {
|
||||
new SpigotPlugin(70575, this).checkForUpdate();
|
||||
new Metrics(this);
|
||||
saveDefaultConfig();
|
||||
public void enable() {
|
||||
new SpigotPlugin(70575, this).checkForUpdate();
|
||||
new Metrics(this);
|
||||
saveDefaultConfig();
|
||||
|
||||
final int configVersion = getConfig().contains("config-version", true) ? getConfig().getInt("config-version") : -1;
|
||||
final int defConfigVersion = getConfig().getDefaults().getInt("config-version");
|
||||
if (configVersion != defConfigVersion) {
|
||||
getLogger().warning("You may be using an outdated config.yml!");
|
||||
getLogger().warning("(Your config version: '" + configVersion + "' | Expected config version: '" + defConfigVersion + "')");
|
||||
}
|
||||
final int configVersion = getConfig().contains("config-version", true) ? getConfig().getInt("config-version") : -1;
|
||||
final int defConfigVersion = getConfig().getDefaults().getInt("config-version");
|
||||
if (configVersion != defConfigVersion) {
|
||||
getLogger().warning("You may be using an outdated config.yml!");
|
||||
getLogger().warning("(Your config version: '" + configVersion + "' | Expected config version: '" + defConfigVersion + "')");
|
||||
}
|
||||
|
||||
if (getConfig().isConfigurationSection("mysql") && getConfig().getBoolean("mysql.enabled"))
|
||||
dataProvider = new MySQLDataProvider(getConfig());
|
||||
shouldDebugSQL = getConfig().getBoolean("mysql.debug");
|
||||
if (getConfig().isConfigurationSection("mysql") && getConfig().getBoolean("mysql.enabled"))
|
||||
dataProvider = new MySQLDataProvider(getConfig());
|
||||
shouldDebugSQL = getConfig().getBoolean("mysql.debug");
|
||||
|
||||
if (getConfig().isConfigurationSection("default-playerdata"))
|
||||
dataProvider.getDataManager().loadDefaultData(getConfig().getConfigurationSection("default-playerdata"));
|
||||
if (getConfig().isConfigurationSection("default-playerdata"))
|
||||
dataProvider.getDataManager().loadDefaultData(getConfig().getConfigurationSection("default-playerdata"));
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") != null) economy = new VaultEconomy();
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") != null) economy = new VaultEconomy();
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
placeholderParser = new PlaceholderAPIParser();
|
||||
getLogger().log(Level.INFO, "Hooked onto PlaceholderAPI");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
placeholderParser = new PlaceholderAPIParser();
|
||||
getLogger().log(Level.INFO, "Hooked onto PlaceholderAPI");
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("Citizens") != null) {
|
||||
Bukkit.getPluginManager().registerEvents(new CitizenInteractEventListener(), this);
|
||||
getLogger().log(Level.INFO, "Hooked onto Citizens");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("Citizens") != null) {
|
||||
Bukkit.getPluginManager().registerEvents(new CitizenInteractEventListener(), this);
|
||||
getLogger().log(Level.INFO, "Hooked onto Citizens");
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) {
|
||||
regionHandler = new WorldGuardRegionHandler();
|
||||
getLogger().log(Level.INFO, "Hooked onto WorldGuard");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) {
|
||||
regionHandler = new WorldGuardRegionHandler();
|
||||
getLogger().log(Level.INFO, "Hooked onto WorldGuard");
|
||||
}
|
||||
|
||||
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new MythicHook(), this);
|
||||
MMOCore.plugin.getLogger().log(Level.INFO, "Hooked onto MythicMobs");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("MythicMobs") != null) {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new MythicHook(), this);
|
||||
MMOCore.plugin.getLogger().log(Level.INFO, "Hooked onto MythicMobs");
|
||||
}
|
||||
|
||||
/*
|
||||
* Resource regeneration. Must check if entity is dead otherwise regen will make
|
||||
* the 'respawn' button glitched plus HURT entity effect bug
|
||||
*/
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
for (PlayerData player : PlayerData.getAll())
|
||||
if (player.isOnline() && !player.getPlayer().isDead())
|
||||
for (PlayerResource resource : PlayerResource.values()) {
|
||||
double regenAmount = player.getProfess().getHandler(resource).getRegen(player);
|
||||
if (regenAmount != 0)
|
||||
resource.regen(player, regenAmount);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOCore.plugin, 100, 20);
|
||||
/*
|
||||
* Resource regeneration. Must check if entity is dead otherwise regen will make
|
||||
* the 'respawn' button glitched plus HURT entity effect bug
|
||||
*/
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
for (PlayerData player : PlayerData.getAll())
|
||||
if (player.isOnline() && !player.getPlayer().isDead())
|
||||
for (PlayerResource resource : PlayerResource.values()) {
|
||||
double regenAmount = player.getProfess().getHandler(resource).getRegen(player);
|
||||
if (regenAmount != 0)
|
||||
resource.regen(player, regenAmount);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOCore.plugin, 100, 20);
|
||||
|
||||
/*
|
||||
* Clean active loot chests every 5 minutes. Cannot register this runnable in
|
||||
* the loot chest manager because it is instanced when the plugin loads
|
||||
*/
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
Iterator<LootChest> iterator = lootChests.getActive().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
LootChest next = iterator.next();
|
||||
if (next.shouldExpire()) {
|
||||
iterator.remove();
|
||||
next.expire(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(this, 5 * 60 * 20, 5 * 60 * 20);
|
||||
/*
|
||||
* Clean active loot chests every 5 minutes. Cannot register this runnable in
|
||||
* the loot chest manager because it is instanced when the plugin loads
|
||||
*/
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
Iterator<LootChest> iterator = lootChests.getActive().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
LootChest next = iterator.next();
|
||||
if (next.shouldExpire()) {
|
||||
iterator.remove();
|
||||
next.expire(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(this, 5 * 60 * 20, 5 * 60 * 20);
|
||||
|
||||
/*
|
||||
* For the sake of the lord, make sure they aren't using MMOItems Mana and
|
||||
* Stamina Addon...This should prevent a couple error reports produced by people
|
||||
* not reading the installation guide...
|
||||
*/
|
||||
if (Bukkit.getPluginManager().getPlugin("MMOMana") != null) {
|
||||
getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "MMOCore is not meant to be used with MMOItems ManaAndStamina");
|
||||
getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "Please read the installation guide!");
|
||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with MMOItems ManaAndStamina");
|
||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!");
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* For the sake of the lord, make sure they aren't using MMOItems Mana and
|
||||
* Stamina Addon...This should prevent a couple error reports produced by people
|
||||
* not reading the installation guide...
|
||||
*/
|
||||
if (Bukkit.getPluginManager().getPlugin("MMOMana") != null) {
|
||||
getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "MMOCore is not meant to be used with MMOItems ManaAndStamina");
|
||||
getLogger().log(Level.SEVERE, ChatColor.DARK_RED + "Please read the installation guide!");
|
||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] MMOCore is not meant to be used with MMOItems ManaAndStamina");
|
||||
Bukkit.broadcastMessage(ChatColor.DARK_RED + "[MMOCore] Please read the installation guide!");
|
||||
return;
|
||||
}
|
||||
|
||||
initializePlugin(false);
|
||||
initializePlugin(false);
|
||||
|
||||
if (getConfig().getBoolean("vanilla-exp-redirection.enabled"))
|
||||
Bukkit.getPluginManager().registerEvents(new RedirectVanillaExp(getConfig().getDouble("vanilla-exp-redirection.ratio")), this);
|
||||
if (getConfig().getBoolean("vanilla-exp-redirection.enabled"))
|
||||
Bukkit.getPluginManager().registerEvents(new RedirectVanillaExp(getConfig().getDouble("vanilla-exp-redirection.ratio")), this);
|
||||
|
||||
// Enable debug mode for extra debug tools
|
||||
if (getConfig().contains("debug")) {
|
||||
DebugMode.setLevel(getConfig().getInt("debug", 0));
|
||||
DebugMode.enableActionBar();
|
||||
}
|
||||
// Enable debug mode for extra debug tools
|
||||
if (getConfig().contains("debug")) {
|
||||
DebugMode.setLevel(getConfig().getInt("debug", 0));
|
||||
DebugMode.enableActionBar();
|
||||
}
|
||||
|
||||
// Load quest module
|
||||
try {
|
||||
String questPluginName = UtilityMethods.enumName(getConfig().getString("quest-plugin"));
|
||||
PartyModuleType moduleType = PartyModuleType.valueOf(questPluginName);
|
||||
Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed");
|
||||
partyModule = moduleType.provideModule();
|
||||
} catch (RuntimeException exception) {
|
||||
getLogger().log(Level.WARNING, "Could not initialize quest module: " + exception.getMessage());
|
||||
partyModule = new MMOCorePartyModule();
|
||||
}
|
||||
// Load quest module
|
||||
try {
|
||||
String questPluginName = UtilityMethods.enumName(getConfig().getString("quest-plugin"));
|
||||
PartyModuleType moduleType = PartyModuleType.valueOf(questPluginName);
|
||||
Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed");
|
||||
partyModule = moduleType.provideModule();
|
||||
} catch (RuntimeException exception) {
|
||||
getLogger().log(Level.WARNING, "Could not initialize quest module: " + exception.getMessage());
|
||||
partyModule = new MMOCorePartyModule();
|
||||
}
|
||||
|
||||
|
||||
// Load party module
|
||||
try {
|
||||
String partyPluginName = UtilityMethods.enumName(getConfig().getString("party-plugin"));
|
||||
PartyModuleType moduleType = PartyModuleType.valueOf(partyPluginName);
|
||||
Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed");
|
||||
partyModule = moduleType.provideModule();
|
||||
} catch (RuntimeException exception) {
|
||||
getLogger().log(Level.WARNING, "Could not initialize party module: " + exception.getMessage());
|
||||
partyModule = new MMOCorePartyModule();
|
||||
}
|
||||
|
||||
// Load party module
|
||||
try {
|
||||
String partyPluginName = UtilityMethods.enumName(getConfig().getString("party-plugin"));
|
||||
PartyModuleType moduleType = PartyModuleType.valueOf(partyPluginName);
|
||||
Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed");
|
||||
partyModule = moduleType.provideModule();
|
||||
} catch (RuntimeException exception) {
|
||||
getLogger().log(Level.WARNING, "Could not initialize party module: " + exception.getMessage());
|
||||
partyModule = new MMOCorePartyModule();
|
||||
}
|
||||
|
||||
// Skill casting
|
||||
try {
|
||||
SkillCastingMode mode = SkillCastingMode.valueOf(UtilityMethods.enumName(getConfig().getString("skill-casting.mode")));
|
||||
Bukkit.getPluginManager().registerEvents(mode.loadFromConfig(getConfig().getConfigurationSection("skill-casting")), this);
|
||||
} catch (RuntimeException exception) {
|
||||
getLogger().log(Level.WARNING, "Could not load skill casting: " + exception.getMessage());
|
||||
}
|
||||
// Load guild module
|
||||
try {
|
||||
String pluginName = UtilityMethods.enumName(getConfig().getString("guild-plugin"));
|
||||
GuildModuleType moduleType = GuildModuleType.valueOf(pluginName);
|
||||
Validate.isTrue(moduleType.isValid(), "Plugin '" + moduleType.name() + "' is not installed");
|
||||
guildModule = moduleType.provideModule();
|
||||
} catch (RuntimeException exception) {
|
||||
getLogger().log(Level.WARNING, "Could not initialize guild module: " + exception.getMessage());
|
||||
guildModule = new MMOCoreGuildModule();
|
||||
}
|
||||
|
||||
if (configManager.overrideVanillaExp = getConfig().getBoolean("override-vanilla-exp"))
|
||||
Bukkit.getPluginManager().registerEvents(new VanillaExperienceOverride(), this);
|
||||
// Skill casting
|
||||
try {
|
||||
SkillCastingMode mode = SkillCastingMode.valueOf(UtilityMethods.enumName(getConfig().getString("skill-casting.mode")));
|
||||
Bukkit.getPluginManager().registerEvents(mode.loadFromConfig(getConfig().getConfigurationSection("skill-casting")), this);
|
||||
} catch (RuntimeException exception) {
|
||||
getLogger().log(Level.WARNING, "Could not load skill casting: " + exception.getMessage());
|
||||
}
|
||||
|
||||
if (getConfig().getBoolean("hotbar-swapping.enabled"))
|
||||
try {
|
||||
Bukkit.getPluginManager().registerEvents(new HotbarSwap(getConfig().getConfigurationSection("hotbar-swapping")), this);
|
||||
} catch (RuntimeException exception) {
|
||||
getLogger().log(Level.WARNING, "Could not load hotbar swapping: " + exception.getMessage());
|
||||
}
|
||||
if (configManager.overrideVanillaExp = getConfig().getBoolean("override-vanilla-exp"))
|
||||
Bukkit.getPluginManager().registerEvents(new VanillaExperienceOverride(), this);
|
||||
|
||||
if (getConfig().getBoolean("prevent-spawner-xp"))
|
||||
Bukkit.getPluginManager().registerEvents(new NoSpawnerEXP(), this);
|
||||
if (getConfig().getBoolean("hotbar-swapping.enabled"))
|
||||
try {
|
||||
Bukkit.getPluginManager().registerEvents(new HotbarSwap(getConfig().getConfigurationSection("hotbar-swapping")), this);
|
||||
} catch (RuntimeException exception) {
|
||||
getLogger().log(Level.WARNING, "Could not load hotbar swapping: " + exception.getMessage());
|
||||
}
|
||||
|
||||
if (getConfig().getBoolean("death-exp-loss.enabled"))
|
||||
Bukkit.getPluginManager().registerEvents(new DeathExperienceLoss(), this);
|
||||
if (getConfig().getBoolean("prevent-spawner-xp"))
|
||||
Bukkit.getPluginManager().registerEvents(new NoSpawnerEXP(), this);
|
||||
|
||||
if (getConfig().getBoolean("shift-click-player-profile-check"))
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerProfileCheck(), this);
|
||||
if (getConfig().getBoolean("death-exp-loss.enabled"))
|
||||
Bukkit.getPluginManager().registerEvents(new DeathExperienceLoss(), this);
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new WaypointsListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new GoldPouchesListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new BlockListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new LootableChestsListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new GuildListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new FishingListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerCollectStats(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerPressKeyListener(), this);
|
||||
// Bukkit.getPluginManager().registerEvents(new ClassTriggers(), this);
|
||||
if (getConfig().getBoolean("shift-click-player-profile-check"))
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerProfileCheck(), this);
|
||||
|
||||
/*
|
||||
* Initialize player data from all online players. This is very important to do
|
||||
* that after registering all the professses otherwise the player datas can't
|
||||
* recognize what profess the player has and professes will be lost
|
||||
*/
|
||||
Bukkit.getOnlinePlayers().forEach(player -> dataProvider.getDataManager().setup(player.getUniqueId()));
|
||||
Bukkit.getPluginManager().registerEvents(new WaypointsListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new GoldPouchesListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new BlockListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new LootableChestsListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new GuildListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new FishingListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerCollectStats(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new PlayerPressKeyListener(), this);
|
||||
// Bukkit.getPluginManager().registerEvents(new ClassTriggers(), this);
|
||||
|
||||
// load guild data after loading player data
|
||||
dataProvider.getGuildManager().load();
|
||||
/*
|
||||
* Initialize player data from all online players. This is very important to do
|
||||
* that after registering all the professses otherwise the player datas can't
|
||||
* recognize what profess the player has and professes will be lost
|
||||
*/
|
||||
Bukkit.getOnlinePlayers().forEach(player -> dataProvider.getDataManager().setup(player.getUniqueId()));
|
||||
|
||||
// Command
|
||||
try {
|
||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
// load guild data after loading player data
|
||||
dataProvider.getGuildManager().load();
|
||||
|
||||
bukkitCommandMap.setAccessible(true);
|
||||
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
||||
// Command
|
||||
try {
|
||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
|
||||
FileConfiguration config = new ConfigFile("commands").getConfig();
|
||||
bukkitCommandMap.setAccessible(true);
|
||||
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
||||
|
||||
FileConfiguration config = new ConfigFile("commands").getConfig();
|
||||
|
||||
if (config.contains("player"))
|
||||
commandMap.register("mmocore", new PlayerStatsCommand(config.getConfigurationSection("player")));
|
||||
@ -340,129 +350,128 @@ public class MMOCore extends LuminePlugin {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot();
|
||||
getCommand("mmocore").setExecutor(mmoCoreCommand);
|
||||
getCommand("mmocore").setTabCompleter(mmoCoreCommand);
|
||||
MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot();
|
||||
getCommand("mmocore").setExecutor(mmoCoreCommand);
|
||||
getCommand("mmocore").setTabCompleter(mmoCoreCommand);
|
||||
|
||||
if (getConfig().getBoolean("auto-save.enabled")) {
|
||||
int autosave = getConfig().getInt("auto-save.interval") * 20;
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
if (getConfig().getBoolean("auto-save.enabled")) {
|
||||
int autosave = getConfig().getInt("auto-save.interval") * 20;
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
|
||||
// Save player data
|
||||
for (PlayerData data : PlayerData.getAll())
|
||||
if (data.isFullyLoaded())
|
||||
dataProvider.getDataManager().saveData(data);
|
||||
// Save player data
|
||||
for (PlayerData data : PlayerData.getAll())
|
||||
if (data.isFullyLoaded())
|
||||
dataProvider.getDataManager().saveData(data);
|
||||
|
||||
// Save guild info
|
||||
for (Guild guild : dataProvider.getGuildManager().getAll())
|
||||
dataProvider.getGuildManager().save(guild);
|
||||
}
|
||||
}.runTaskTimerAsynchronously(MMOCore.plugin, autosave, autosave);
|
||||
}
|
||||
}
|
||||
// Save guild info
|
||||
for (Guild guild : dataProvider.getGuildManager().getAll())
|
||||
dataProvider.getGuildManager().save(guild);
|
||||
}
|
||||
}.runTaskTimerAsynchronously(MMOCore.plugin, autosave, autosave);
|
||||
}
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
public void disable() {
|
||||
|
||||
// Save player data
|
||||
for (PlayerData data : PlayerData.getAll())
|
||||
if (data.isFullyLoaded()) {
|
||||
data.close();
|
||||
dataProvider.getDataManager().saveData(data);
|
||||
}
|
||||
// Save player data
|
||||
for (PlayerData data : PlayerData.getAll())
|
||||
if (data.isFullyLoaded()) {
|
||||
data.close();
|
||||
dataProvider.getDataManager().saveData(data);
|
||||
}
|
||||
|
||||
// Save guild info
|
||||
for (Guild guild : dataProvider.getGuildManager().getAll())
|
||||
dataProvider.getGuildManager().save(guild);
|
||||
// Save guild info
|
||||
for (Guild guild : dataProvider.getGuildManager().getAll())
|
||||
dataProvider.getGuildManager().save(guild);
|
||||
|
||||
// Close MySQL data provider (memory leaks)
|
||||
if (dataProvider instanceof MySQLDataProvider)
|
||||
((MySQLDataProvider) dataProvider).close();
|
||||
// Close MySQL data provider (memory leaks)
|
||||
if (dataProvider instanceof MySQLDataProvider)
|
||||
((MySQLDataProvider) dataProvider).close();
|
||||
|
||||
// Reset active blocks
|
||||
mineManager.resetRemainingBlocks();
|
||||
// Reset active blocks
|
||||
mineManager.resetRemainingBlocks();
|
||||
|
||||
// Clear spawned loot chests
|
||||
lootChests.getActive().forEach(chest -> chest.expire(false));
|
||||
}
|
||||
// Clear spawned loot chests
|
||||
lootChests.getActive().forEach(chest -> chest.expire(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called either when the server starts when initializing the manager for
|
||||
* the first time, or when issuing a plugin reload; in that case, stuff
|
||||
* like listeners must all be cleared before.
|
||||
* <p>
|
||||
* Also see {@link MMOCoreManager}
|
||||
*
|
||||
* @param clearBefore True when issuing a plugin reload
|
||||
*/
|
||||
public void initializePlugin(boolean clearBefore) {
|
||||
if (clearBefore)
|
||||
reloadConfig();
|
||||
/**
|
||||
* Called either when the server starts when initializing the manager for
|
||||
* the first time, or when issuing a plugin reload; in that case, stuff
|
||||
* like listeners must all be cleared before.
|
||||
*
|
||||
* Also see {@link MMOCoreManager}
|
||||
*
|
||||
* @param clearBefore True when issuing a plugin reload
|
||||
*/
|
||||
public void initializePlugin(boolean clearBefore) {
|
||||
if (clearBefore)
|
||||
reloadConfig();
|
||||
|
||||
configManager = new ConfigManager();
|
||||
configManager = new ConfigManager();
|
||||
|
||||
if (clearBefore)
|
||||
MythicLib.plugin.getSkills().initialize(true);
|
||||
skillManager.initialize(clearBefore);
|
||||
mineManager.initialize(clearBefore);
|
||||
partyManager.initialize(clearBefore);
|
||||
attributeManager.initialize(clearBefore);
|
||||
if (clearBefore)
|
||||
MythicLib.plugin.getSkills().initialize(true);
|
||||
skillManager.initialize(clearBefore);
|
||||
mineManager.initialize(clearBefore);
|
||||
partyManager.initialize(clearBefore);
|
||||
attributeManager.initialize(clearBefore);
|
||||
|
||||
// Experience must be loaded before professions and classes
|
||||
experience.initialize(clearBefore);
|
||||
// Experience must be loaded before professions and classes
|
||||
experience.initialize(clearBefore);
|
||||
|
||||
// Drop tables must be loaded before professions
|
||||
dropTableManager.initialize(clearBefore);
|
||||
// Drop tables must be loaded before professions
|
||||
dropTableManager.initialize(clearBefore);
|
||||
|
||||
professionManager.initialize(clearBefore);
|
||||
classManager.initialize(clearBefore);
|
||||
professionManager.initialize(clearBefore);
|
||||
classManager.initialize(clearBefore);
|
||||
|
||||
InventoryManager.load();
|
||||
InventoryManager.load();
|
||||
|
||||
questManager.initialize(clearBefore);
|
||||
lootChests.initialize(clearBefore);
|
||||
restrictionManager.initialize(clearBefore);
|
||||
waypointManager.initialize(clearBefore);
|
||||
requestManager.initialize(clearBefore);
|
||||
soundManager.initialize(clearBefore);
|
||||
configItems.initialize(clearBefore);
|
||||
skillTreeManager.initialize(clearBefore);
|
||||
questManager.initialize(clearBefore);
|
||||
lootChests.initialize(clearBefore);
|
||||
restrictionManager.initialize(clearBefore);
|
||||
waypointManager.initialize(clearBefore);
|
||||
requestManager.initialize(clearBefore);
|
||||
soundManager.initialize(clearBefore);
|
||||
configItems.initialize(clearBefore);
|
||||
|
||||
if (getConfig().isConfigurationSection("action-bar"))
|
||||
actionBarManager.reload(getConfig().getConfigurationSection("action-bar"));
|
||||
if (getConfig().isConfigurationSection("action-bar"))
|
||||
actionBarManager.reload(getConfig().getConfigurationSection("action-bar"));
|
||||
|
||||
StatType.load();
|
||||
StatType.load();
|
||||
|
||||
if (clearBefore)
|
||||
PlayerData.getAll().forEach(PlayerData::update);
|
||||
}
|
||||
if (clearBefore)
|
||||
PlayerData.getAll().forEach(PlayerData::update);
|
||||
}
|
||||
|
||||
public static void log(String message) {
|
||||
log(Level.INFO, message);
|
||||
}
|
||||
public static void log(String message) {
|
||||
log(Level.INFO, message);
|
||||
}
|
||||
|
||||
public static void debug(int value, String message) {
|
||||
debug(value, Level.INFO, message);
|
||||
}
|
||||
public static void debug(int value, String message) {
|
||||
debug(value, Level.INFO, message);
|
||||
}
|
||||
|
||||
public static void log(Level level, String message) {
|
||||
plugin.getLogger().log(level, message);
|
||||
}
|
||||
public static void log(Level level, String message) {
|
||||
plugin.getLogger().log(level, message);
|
||||
}
|
||||
|
||||
public static void debug(int value, Level level, String message) {
|
||||
if (DebugMode.level > (value - 1)) plugin.getLogger().log(level, message);
|
||||
}
|
||||
public static void debug(int value, Level level, String message) {
|
||||
if (DebugMode.level > (value - 1)) plugin.getLogger().log(level, message);
|
||||
}
|
||||
|
||||
public File getJarFile() {
|
||||
return getFile();
|
||||
}
|
||||
public File getJarFile() {
|
||||
return getFile();
|
||||
}
|
||||
|
||||
public boolean hasEconomy() {
|
||||
return economy != null && economy.isValid();
|
||||
}
|
||||
public boolean hasEconomy() {
|
||||
return economy != null && economy.isValid();
|
||||
}
|
||||
|
||||
public static void sqlDebug(String s) {
|
||||
if (!MMOCore.plugin.shouldDebugSQL) return;
|
||||
MMOCore.plugin.getLogger().warning("- [SQL Debug] " + s);
|
||||
}
|
||||
public static void sqlDebug(String s) {
|
||||
if(!MMOCore.plugin.shouldDebugSQL) return;
|
||||
MMOCore.plugin.getLogger().warning("- [SQL Debug] " + s);
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,13 @@ import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.guild.provided.Guild;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.guild.provided.Guild;
|
||||
|
||||
public class ConfigFile {
|
||||
private final File file;
|
||||
private final String name;
|
||||
|
@ -6,11 +6,11 @@ import io.lumine.mythic.lib.skill.handler.SkillHandler;
|
||||
import io.lumine.mythic.lib.skill.result.SkillResult;
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerMetadata;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.party.AbstractParty;
|
||||
import net.Indyuce.mmocore.skill.CastableSkill;
|
||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@ -1,73 +1,72 @@
|
||||
package net.Indyuce.mmocore.api;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerActivity;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
|
||||
public class PlayerActionBar extends BukkitRunnable {
|
||||
boolean initialized = false;
|
||||
|
||||
private ActionBarConfig config;
|
||||
private DecimalFormat digit;
|
||||
|
||||
public void reload(ConfigurationSection cfg) {
|
||||
config = new ActionBarConfig(cfg);
|
||||
digit = MythicLib.plugin.getMMOConfig().newDecimalFormat(config.digit);
|
||||
|
||||
if(!initialized && config.enabled) {
|
||||
runTaskTimer(MMOCore.plugin, 0, config.ticks);
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
public long getTimeOut() {
|
||||
return config.timeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (PlayerData data : PlayerData.getAll())
|
||||
if (data.isOnline() && !data.getPlayer().isDead() && !data.isCasting() && data.getActivityTimeOut(PlayerActivity.ACTION_BAR_MESSAGE) == 0) {
|
||||
data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(data.getPlayer(),
|
||||
MythicLib.plugin.parseColors((data.getProfess().hasActionBar() ? data.getProfess().getActionBar() : config.format)
|
||||
.replace("{health}", digit.format(data.getPlayer().getHealth()))
|
||||
.replace("{max_health}", "" + StatType.MAX_HEALTH.format(data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()))
|
||||
.replace("{mana_icon}", data.getProfess().getManaDisplay().getIcon())
|
||||
.replace("{mana}", digit.format(data.getMana()))
|
||||
.replace("{max_mana}", "" + StatType.MAX_MANA.format(data.getStats().getStat(StatType.MAX_MANA)))
|
||||
.replace("{stamina}", digit.format(data.getStamina()))
|
||||
.replace("{max_stamina}", "" + StatType.MAX_STAMINA.format(data.getStats().getStat(StatType.MAX_STAMINA)))
|
||||
.replace("{stellium}", digit.format(data.getStellium()))
|
||||
.replace("{max_stellium}", "" + StatType.MAX_STELLIUM.format(data.getStats().getStat(StatType.MAX_STELLIUM)))
|
||||
.replace("{class}", data.getProfess().getName())
|
||||
.replace("{xp}", "" + data.getExperience())
|
||||
.replace("{armor}", "" + StatType.ARMOR.format(data.getPlayer().getAttribute(Attribute.GENERIC_ARMOR).getValue()))
|
||||
.replace("{level}", "" + data.getLevel())
|
||||
.replace("{name}", data.getPlayer().getDisplayName())))));
|
||||
}
|
||||
}
|
||||
|
||||
private static class ActionBarConfig {
|
||||
private final boolean enabled;
|
||||
private final int ticks, timeout;
|
||||
private final String digit, format;
|
||||
|
||||
private ActionBarConfig(ConfigurationSection config) {
|
||||
enabled = config.getBoolean("enabled", false);
|
||||
timeout = config.getInt("", 60);
|
||||
digit = config.getString("decimal", "0.#");
|
||||
ticks = config.getInt("ticks-to-update", 5);
|
||||
format = config.getString("format", "please format me :c");
|
||||
}
|
||||
}
|
||||
}
|
||||
package net.Indyuce.mmocore.api;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerActivity;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.player.stats.StatInfo;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class PlayerActionBar extends BukkitRunnable {
|
||||
boolean initialized = false;
|
||||
|
||||
private ActionBarConfig config;
|
||||
private DecimalFormat digit;
|
||||
|
||||
public void reload(ConfigurationSection cfg) {
|
||||
config = new ActionBarConfig(cfg);
|
||||
digit = MythicLib.plugin.getMMOConfig().newDecimalFormat(config.digit);
|
||||
|
||||
if (!initialized && config.enabled) {
|
||||
runTaskTimer(MMOCore.plugin, 0, config.ticks);
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
public long getTimeOut() {
|
||||
return config.timeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (PlayerData data : PlayerData.getAll())
|
||||
if (data.isOnline() && !data.getPlayer().isDead() && !data.isCasting() && data.getActivityTimeOut(PlayerActivity.ACTION_BAR_MESSAGE) == 0) {
|
||||
data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(data.getPlayer(),
|
||||
MythicLib.plugin.parseColors((data.getProfess().hasActionBar() ? data.getProfess().getActionBar() : config.format)
|
||||
.replace("{health}", digit.format(data.getPlayer().getHealth()))
|
||||
.replace("{max_health}", StatInfo.valueOf("MAX_HEALTH").format(data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()))
|
||||
.replace("{mana_icon}", data.getProfess().getManaDisplay().getIcon())
|
||||
.replace("{mana}", digit.format(data.getMana()))
|
||||
.replace("{max_mana}", StatInfo.valueOf("MAX_MANA").format(data.getStats().getStat("MAX_MANA")))
|
||||
.replace("{stamina}", digit.format(data.getStamina()))
|
||||
.replace("{max_stamina}", StatInfo.valueOf("MAX_STAMINA").format(data.getStats().getStat("MAX_STAMINA")))
|
||||
.replace("{stellium}", digit.format(data.getStellium()))
|
||||
.replace("{max_stellium}", StatInfo.valueOf("MAX_STELLIUM").format(data.getStats().getStat("MAX_STELLIUM")))
|
||||
.replace("{class}", data.getProfess().getName())
|
||||
.replace("{xp}", MythicLib.plugin.getMMOConfig().decimal.format(data.getExperience()))
|
||||
.replace("{armor}", StatInfo.valueOf("ARMOR").format(data.getPlayer().getAttribute(Attribute.GENERIC_ARMOR).getValue()))
|
||||
.replace("{level}", "" + data.getLevel())
|
||||
.replace("{name}", data.getPlayer().getDisplayName())))));
|
||||
}
|
||||
}
|
||||
|
||||
private static class ActionBarConfig {
|
||||
private final boolean enabled;
|
||||
private final int ticks, timeout;
|
||||
private final String digit, format;
|
||||
|
||||
private ActionBarConfig(ConfigurationSection config) {
|
||||
enabled = config.getBoolean("enabled", false);
|
||||
timeout = config.getInt("", 60);
|
||||
digit = config.getString("decimal", "0.#");
|
||||
ticks = config.getInt("ticks-to-update", 5);
|
||||
format = config.getString("format", "please format me :c");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,175 +1,175 @@
|
||||
package net.Indyuce.mmocore.api.block;
|
||||
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import io.lumine.mythic.lib.api.condition.type.BlockCondition;
|
||||
import io.lumine.mythic.lib.api.condition.type.MMOCondition;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.loot.droptable.DropTable;
|
||||
import net.Indyuce.mmocore.loot.LootBuilder;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class BlockInfo {
|
||||
private final BlockType block;
|
||||
private final DropTable table;
|
||||
private final RegenInfo regen;
|
||||
private final List<Trigger> triggers = new ArrayList<>();
|
||||
private final List<BlockCondition> conditions = new ArrayList<>();
|
||||
private final Map<BlockInfoOption, Boolean> options = new HashMap<>();
|
||||
|
||||
public BlockInfo(ConfigurationSection config) {
|
||||
Validate.notNull(config, "Could not load config");
|
||||
Validate.isTrue(config.contains("material"), "Could not find block type");
|
||||
|
||||
block = MMOCore.plugin.loadManager.loadBlockType(new MMOLineConfig(config.getString("material")));
|
||||
table = config.contains("drop-table") ? MMOCore.plugin.dropTableManager.loadDropTable(config.get("drop-table")) : null;
|
||||
|
||||
regen = config.contains("regen") ? new RegenInfo(config.getConfigurationSection("regen")) : null;
|
||||
|
||||
if (config.contains("options"))
|
||||
for (String key : config.getConfigurationSection("options").getKeys(false))
|
||||
try {
|
||||
BlockInfoOption option = BlockInfoOption.valueOf(key.toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||
options.put(option, config.getBoolean("options." + key));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING,
|
||||
"Could not load option '" + key + "' from block info '" + block.generateKey() + "': " + exception.getMessage());
|
||||
}
|
||||
|
||||
if (config.contains("triggers")) {
|
||||
List<String> list = config.getStringList("triggers");
|
||||
Validate.notNull(list, "Could not load triggers");
|
||||
|
||||
for (String key : list)
|
||||
try {
|
||||
triggers.add(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(key)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING,
|
||||
"Could not load trigger '" + key + "' from block info '" + block.generateKey() + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (config.isList("conditions"))
|
||||
for (String key : config.getStringList("conditions")) {
|
||||
MMOCondition condition = UtilityMethods.getCondition(key);
|
||||
if (condition instanceof BlockCondition)
|
||||
conditions.add((BlockCondition) condition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean getOption(BlockInfoOption option) {
|
||||
return options.getOrDefault(option, option.getDefault());
|
||||
}
|
||||
|
||||
public BlockType getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DropTable getDropTable() {
|
||||
return Objects.requireNonNull(table, "Block has no drop table");
|
||||
}
|
||||
|
||||
public boolean hasDropTable() {
|
||||
return table != null;
|
||||
}
|
||||
|
||||
public List<ItemStack> collectDrops(LootBuilder builder) {
|
||||
return table != null ? table.collect(builder) : new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean hasRegen() {
|
||||
return regen != null;
|
||||
}
|
||||
|
||||
public boolean regenerates() {
|
||||
return regen != null;
|
||||
}
|
||||
|
||||
public RegenInfo getRegenerationInfo() {
|
||||
return regen;
|
||||
}
|
||||
|
||||
public RegeneratingBlock startRegeneration(BlockData data, Location loc) {
|
||||
return new RegeneratingBlock(data, loc, this);
|
||||
}
|
||||
|
||||
public boolean hasTriggers() {
|
||||
return !triggers.isEmpty();
|
||||
}
|
||||
|
||||
public List<Trigger> getTriggers() {
|
||||
return triggers;
|
||||
}
|
||||
|
||||
public boolean checkConditions(Block block) {
|
||||
for (BlockCondition condition : conditions)
|
||||
if (!condition.check(block))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static enum BlockInfoOption {
|
||||
|
||||
/**
|
||||
* When disabled, removes the vanilla drops when a block is mined
|
||||
*/
|
||||
VANILLA_DROPS(true),
|
||||
|
||||
/**
|
||||
* When disabled, removes exp holograms when mined
|
||||
*/
|
||||
EXP_HOLOGRAMS(true);
|
||||
|
||||
private final boolean def;
|
||||
|
||||
private BlockInfoOption(boolean def) {
|
||||
this.def = def;
|
||||
}
|
||||
|
||||
public boolean getDefault() {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RegeneratingBlock {
|
||||
private final BlockData data;
|
||||
private final Location loc;
|
||||
private final BlockInfo regenerating;
|
||||
|
||||
private final long date = System.currentTimeMillis();
|
||||
|
||||
public RegeneratingBlock(BlockData data, Location loc, BlockInfo regenerating) {
|
||||
this.data = data;
|
||||
this.loc = loc;
|
||||
this.regenerating = regenerating;
|
||||
}
|
||||
|
||||
public boolean isTimedOut() {
|
||||
return date + regenerating.getRegenerationInfo().getTime() * 50 < System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public BlockData getBlockData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return loc;
|
||||
}
|
||||
|
||||
public BlockInfo getRegeneratingBlock() {
|
||||
return regenerating;
|
||||
}
|
||||
}
|
||||
}
|
||||
package net.Indyuce.mmocore.api.block;
|
||||
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import io.lumine.mythic.lib.api.condition.type.BlockCondition;
|
||||
import io.lumine.mythic.lib.api.condition.type.MMOCondition;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import net.Indyuce.mmocore.loot.droptable.DropTable;
|
||||
import net.Indyuce.mmocore.loot.LootBuilder;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class BlockInfo {
|
||||
private final BlockType block;
|
||||
private final DropTable table;
|
||||
private final RegenInfo regen;
|
||||
private final List<Trigger> triggers = new ArrayList<>();
|
||||
private final List<BlockCondition> conditions = new ArrayList<>();
|
||||
private final Map<BlockInfoOption, Boolean> options = new HashMap<>();
|
||||
|
||||
public BlockInfo(ConfigurationSection config) {
|
||||
Validate.notNull(config, "Could not load config");
|
||||
Validate.isTrue(config.contains("material"), "Could not find block type");
|
||||
|
||||
block = MMOCore.plugin.loadManager.loadBlockType(new MMOLineConfig(config.getString("material")));
|
||||
table = config.contains("drop-table") ? MMOCore.plugin.dropTableManager.loadDropTable(config.get("drop-table")) : null;
|
||||
|
||||
regen = config.contains("regen") ? new RegenInfo(config.getConfigurationSection("regen")) : null;
|
||||
|
||||
if (config.contains("options"))
|
||||
for (String key : config.getConfigurationSection("options").getKeys(false))
|
||||
try {
|
||||
BlockInfoOption option = BlockInfoOption.valueOf(key.toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||
options.put(option, config.getBoolean("options." + key));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING,
|
||||
"Could not load option '" + key + "' from block info '" + block.generateKey() + "': " + exception.getMessage());
|
||||
}
|
||||
|
||||
if (config.contains("triggers")) {
|
||||
List<String> list = config.getStringList("triggers");
|
||||
Validate.notNull(list, "Could not load triggers");
|
||||
|
||||
for (String key : list)
|
||||
try {
|
||||
triggers.addAll(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(key)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING,
|
||||
"Could not load trigger '" + key + "' from block info '" + block.generateKey() + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (config.isList("conditions"))
|
||||
for (String key : config.getStringList("conditions")) {
|
||||
MMOCondition condition = UtilityMethods.getCondition(key);
|
||||
if (condition instanceof BlockCondition)
|
||||
conditions.add((BlockCondition) condition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean getOption(BlockInfoOption option) {
|
||||
return options.getOrDefault(option, option.getDefault());
|
||||
}
|
||||
|
||||
public BlockType getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DropTable getDropTable() {
|
||||
return Objects.requireNonNull(table, "Block has no drop table");
|
||||
}
|
||||
|
||||
public boolean hasDropTable() {
|
||||
return table != null;
|
||||
}
|
||||
|
||||
public List<ItemStack> collectDrops(LootBuilder builder) {
|
||||
return table != null ? table.collect(builder) : new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean hasRegen() {
|
||||
return regen != null;
|
||||
}
|
||||
|
||||
public boolean regenerates() {
|
||||
return regen != null;
|
||||
}
|
||||
|
||||
public RegenInfo getRegenerationInfo() {
|
||||
return regen;
|
||||
}
|
||||
|
||||
public RegeneratingBlock startRegeneration(BlockData data, Location loc) {
|
||||
return new RegeneratingBlock(data, loc, this);
|
||||
}
|
||||
|
||||
public boolean hasTriggers() {
|
||||
return !triggers.isEmpty();
|
||||
}
|
||||
|
||||
public List<Trigger> getTriggers() {
|
||||
return triggers;
|
||||
}
|
||||
|
||||
public boolean checkConditions(Block block) {
|
||||
for (BlockCondition condition : conditions)
|
||||
if (!condition.check(block))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static enum BlockInfoOption {
|
||||
|
||||
/**
|
||||
* When disabled, removes the vanilla drops when a block is mined
|
||||
*/
|
||||
VANILLA_DROPS(true),
|
||||
|
||||
/**
|
||||
* When disabled, removes exp holograms when mined
|
||||
*/
|
||||
EXP_HOLOGRAMS(true);
|
||||
|
||||
private final boolean def;
|
||||
|
||||
private BlockInfoOption(boolean def) {
|
||||
this.def = def;
|
||||
}
|
||||
|
||||
public boolean getDefault() {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RegeneratingBlock {
|
||||
private final BlockData data;
|
||||
private final Location loc;
|
||||
private final BlockInfo regenerating;
|
||||
|
||||
private final long date = System.currentTimeMillis();
|
||||
|
||||
public RegeneratingBlock(BlockData data, Location loc, BlockInfo regenerating) {
|
||||
this.data = data;
|
||||
this.loc = loc;
|
||||
this.regenerating = regenerating;
|
||||
}
|
||||
|
||||
public boolean isTimedOut() {
|
||||
return date + regenerating.getRegenerationInfo().getTime() * 50 < System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public BlockData getBlockData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return loc;
|
||||
}
|
||||
|
||||
public BlockInfo getRegeneratingBlock() {
|
||||
return regenerating;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,29 @@
|
||||
package net.Indyuce.mmocore.api.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock;
|
||||
|
||||
public interface BlockType {
|
||||
|
||||
/**
|
||||
* Called when placing temporary blocks
|
||||
*/
|
||||
void place(RegeneratingBlock placed);
|
||||
|
||||
/**
|
||||
* Called when regenerating an older block with block regen
|
||||
*/
|
||||
void regenerate(RegeneratingBlock regenerating);
|
||||
|
||||
/**
|
||||
* Generates a key used to store the BlockInfo instance in the manager map,
|
||||
* the key depends on the block type to make sure there is no interference
|
||||
*/
|
||||
String generateKey();
|
||||
|
||||
/**
|
||||
* Applies some extra break restrictions; returns TRUE if the block can be
|
||||
* broken. This method is used to prevent non mature crops from being broken
|
||||
* for example
|
||||
*/
|
||||
boolean breakRestrictions(Block block);
|
||||
}
|
||||
package net.Indyuce.mmocore.api.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
public interface BlockType {
|
||||
|
||||
/**
|
||||
* Called when placing temporary blocks
|
||||
*/
|
||||
void place(BlockInfo.RegeneratingBlock placed);
|
||||
|
||||
/**
|
||||
* Called when regenerating an older block with block regen
|
||||
*/
|
||||
void regenerate(BlockInfo.RegeneratingBlock regenerating);
|
||||
|
||||
/**
|
||||
* Generates a key used to store the BlockInfo instance in the manager map,
|
||||
* the key depends on the block type to make sure there is no interference
|
||||
*/
|
||||
String generateKey();
|
||||
|
||||
/**
|
||||
* Applies some extra break restrictions; returns TRUE if the block can be
|
||||
* broken. This method is used to prevent non mature crops from being broken
|
||||
* for example
|
||||
*/
|
||||
boolean breakRestrictions(Block block);
|
||||
}
|
||||
|
@ -1,31 +1,31 @@
|
||||
package net.Indyuce.mmocore.api.block;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
public class RegenInfo {
|
||||
private final BlockType temporary;
|
||||
private final int regenTime;
|
||||
|
||||
public RegenInfo(ConfigurationSection config) {
|
||||
Validate.notNull(config, "Could not read regen info config");
|
||||
|
||||
temporary = config.contains("temp-block") ? MMOCore.plugin.loadManager.loadBlockType(new MMOLineConfig(config.getString("temp-block"))) : null;
|
||||
regenTime = config.getInt("time", 2 * 60 * 20);
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return regenTime;
|
||||
}
|
||||
|
||||
public boolean hasTemporaryBlock() {
|
||||
return temporary != null;
|
||||
}
|
||||
|
||||
public BlockType getTemporaryBlock() {
|
||||
return temporary;
|
||||
}
|
||||
}
|
||||
package net.Indyuce.mmocore.api.block;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
public class RegenInfo {
|
||||
private final BlockType temporary;
|
||||
private final int regenTime;
|
||||
|
||||
public RegenInfo(ConfigurationSection config) {
|
||||
Validate.notNull(config, "Could not read regen info config");
|
||||
|
||||
temporary = config.contains("temp-block") ? MMOCore.plugin.loadManager.loadBlockType(new MMOLineConfig(config.getString("temp-block"))) : null;
|
||||
regenTime = config.getInt("time", 2 * 60 * 20);
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return regenTime;
|
||||
}
|
||||
|
||||
public boolean hasTemporaryBlock() {
|
||||
return temporary != null;
|
||||
}
|
||||
|
||||
public BlockType getTemporaryBlock() {
|
||||
return temporary;
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,59 @@
|
||||
package net.Indyuce.mmocore.api.block;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
|
||||
public class SkullBlockType implements BlockType {
|
||||
private final String value;
|
||||
|
||||
public SkullBlockType(MMOLineConfig config) {
|
||||
config.validate("value");
|
||||
|
||||
value = config.getString("value");
|
||||
}
|
||||
|
||||
public SkullBlockType(Block block) {
|
||||
value = MythicLib.plugin.getVersion().getWrapper().getSkullValue(block);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void place(RegeneratingBlock block) {
|
||||
Location loc = block.getLocation();
|
||||
loc.getBlock().setType(VersionMaterial.PLAYER_HEAD.toMaterial());
|
||||
|
||||
// save skull orientation if replaced block is a player head
|
||||
if (MMOCoreUtils.isPlayerHead(block.getBlockData().getMaterial()))
|
||||
loc.getBlock().setBlockData(block.getBlockData());
|
||||
|
||||
MythicLib.plugin.getVersion().getWrapper().setSkullValue(loc.getBlock(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerate(RegeneratingBlock block) {
|
||||
Location loc = block.getLocation();
|
||||
// This makes sure that if a skull loses its original rotation
|
||||
// it can revert back to it when the base block is regenerated
|
||||
loc.getBlock().setBlockData(block.getBlockData());
|
||||
MythicLib.plugin.getVersion().getWrapper().setSkullValue(loc.getBlock(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateKey() {
|
||||
return "vanilla-skull-" + value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean breakRestrictions(Block block) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
package net.Indyuce.mmocore.api.block;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
|
||||
public class SkullBlockType implements BlockType {
|
||||
private final String value;
|
||||
|
||||
public SkullBlockType(MMOLineConfig config) {
|
||||
config.validate("value");
|
||||
|
||||
value = config.getString("value");
|
||||
}
|
||||
|
||||
public SkullBlockType(Block block) {
|
||||
value = MythicLib.plugin.getVersion().getWrapper().getSkullValue(block);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void place(RegeneratingBlock block) {
|
||||
Location loc = block.getLocation();
|
||||
loc.getBlock().setType(VersionMaterial.PLAYER_HEAD.toMaterial());
|
||||
|
||||
// save skull orientation if replaced block is a player head
|
||||
if (MMOCoreUtils.isPlayerHead(block.getBlockData().getMaterial()))
|
||||
loc.getBlock().setBlockData(block.getBlockData());
|
||||
|
||||
MythicLib.plugin.getVersion().getWrapper().setSkullValue(loc.getBlock(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerate(RegeneratingBlock block) {
|
||||
Location loc = block.getLocation();
|
||||
// This makes sure that if a skull loses its original rotation
|
||||
// it can revert back to it when the base block is regenerated
|
||||
loc.getBlock().setBlockData(block.getBlockData());
|
||||
MythicLib.plugin.getVersion().getWrapper().setSkullValue(loc.getBlock(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateKey() {
|
||||
return "vanilla-skull-" + value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean breakRestrictions(Block block) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,69 +1,69 @@
|
||||
package net.Indyuce.mmocore.api.block;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
public class VanillaBlockType implements BlockType {
|
||||
private final Material type;
|
||||
|
||||
/*
|
||||
* allows to plant back crops with a custom age so that it does not always
|
||||
* have to full grow again-
|
||||
*/
|
||||
private final int age;
|
||||
|
||||
public VanillaBlockType(MMOLineConfig config) {
|
||||
config.validate("type");
|
||||
|
||||
type = Material.valueOf(config.getString("type").toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||
age = config.getInt("age", 0);
|
||||
|
||||
Validate.isTrue(age >= 0 && age < 8, "Age must be between 0 and 7");
|
||||
}
|
||||
|
||||
public VanillaBlockType(Block block) {
|
||||
type = block.getType();
|
||||
age = 0;
|
||||
}
|
||||
|
||||
public Material getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void place(RegeneratingBlock block) {
|
||||
Location loc = block.getLocation();
|
||||
block.getLocation().getBlock().setType(type);
|
||||
|
||||
BlockData state = block.getLocation().getBlock().getBlockData();
|
||||
if (age > 0 && state instanceof Ageable) {
|
||||
((Ageable) state).setAge(age);
|
||||
loc.getBlock().setBlockData(state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerate(RegeneratingBlock block) {
|
||||
Location loc = block.getLocation();
|
||||
loc.getBlock().setType(type);
|
||||
// Sets the original blocks old data (only when regenerating)
|
||||
loc.getBlock().setBlockData(block.getBlockData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateKey() {
|
||||
return "vanilla-block-" + type.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean breakRestrictions(Block block) {
|
||||
return age == 0 || (block.getBlockData() instanceof Ageable && ((Ageable) block.getBlockData()).getAge() >= age);
|
||||
}
|
||||
}
|
||||
package net.Indyuce.mmocore.api.block;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import net.Indyuce.mmocore.api.block.BlockInfo.RegeneratingBlock;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
public class VanillaBlockType implements BlockType {
|
||||
private final Material type;
|
||||
|
||||
/*
|
||||
* allows to plant back crops with a custom age so that it does not always
|
||||
* have to full grow again-
|
||||
*/
|
||||
private final int age;
|
||||
|
||||
public VanillaBlockType(MMOLineConfig config) {
|
||||
config.validate("type");
|
||||
|
||||
type = Material.valueOf(config.getString("type").toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||
age = config.getInt("age", 0);
|
||||
|
||||
Validate.isTrue(age >= 0 && age < 8, "Age must be between 0 and 7");
|
||||
}
|
||||
|
||||
public VanillaBlockType(Block block) {
|
||||
type = block.getType();
|
||||
age = 0;
|
||||
}
|
||||
|
||||
public Material getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void place(RegeneratingBlock block) {
|
||||
Location loc = block.getLocation();
|
||||
block.getLocation().getBlock().setType(type);
|
||||
|
||||
BlockData state = block.getLocation().getBlock().getBlockData();
|
||||
if (age > 0 && state instanceof Ageable) {
|
||||
((Ageable) state).setAge(age);
|
||||
loc.getBlock().setBlockData(state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerate(RegeneratingBlock block) {
|
||||
Location loc = block.getLocation();
|
||||
loc.getBlock().setType(type);
|
||||
// Sets the original blocks old data (only when regenerating)
|
||||
loc.getBlock().setBlockData(block.getBlockData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateKey() {
|
||||
return "vanilla-block-" + type.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean breakRestrictions(Block block) {
|
||||
return age == 0 || (block.getBlockData() instanceof Ageable && ((Ageable) block.getBlockData()).getAge() >= age);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -16,7 +17,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.util.item.CurrencyItemBuilder;
|
||||
import io.lumine.mythic.lib.api.util.SmartGive;
|
||||
|
||||
|
@ -2,10 +2,10 @@ package net.Indyuce.mmocore.api.event;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
|
||||
|
@ -4,11 +4,12 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class PlayerLevelUpEvent extends PlayerDataEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
// if null, this is main level
|
||||
// If null, this is main level
|
||||
private final Profession profession;
|
||||
private final int oldLevel, newLevel;
|
||||
|
||||
@ -36,6 +37,7 @@ public class PlayerLevelUpEvent extends PlayerDataEvent {
|
||||
return profession != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Profession getProfession() {
|
||||
return profession;
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package net.Indyuce.mmocore.api.event;
|
||||
|
||||
import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.StaminaTrigger;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.StelliumTrigger;
|
||||
import net.Indyuce.mmocore.command.rpg.admin.ResourceCommandTreeNode;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||
import net.Indyuce.mmocore.skill.list.Neptune_Gift;
|
||||
@ -104,14 +108,14 @@ public class PlayerResourceUpdateEvent extends PlayerDataEvent implements Cancel
|
||||
|
||||
/**
|
||||
* Used by quests triggers
|
||||
* - {@link net.Indyuce.mmocore.api.quest.trigger.ManaTrigger}
|
||||
* - {@link net.Indyuce.mmocore.api.quest.trigger.StaminaTrigger}
|
||||
* - {@link net.Indyuce.mmocore.api.quest.trigger.StelliumTrigger}
|
||||
* - {@link ManaTrigger}
|
||||
* - {@link StaminaTrigger}
|
||||
* - {@link StelliumTrigger}
|
||||
*/
|
||||
TRIGGER,
|
||||
|
||||
/**
|
||||
* When using the resource command {@link net.Indyuce.mmocore.command.rpg.admin.ResourceCommandTreeNode}
|
||||
* When using the resource command {@link ResourceCommandTreeNode}
|
||||
*/
|
||||
COMMAND,
|
||||
|
||||
|
@ -1,13 +1,16 @@
|
||||
package net.Indyuce.mmocore.api.load;
|
||||
|
||||
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
|
||||
import net.Indyuce.mmocore.experience.source.*;
|
||||
import net.Indyuce.mmocore.loot.chest.condition.*;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.ConfigFile;
|
||||
import net.Indyuce.mmocore.api.block.BlockType;
|
||||
import net.Indyuce.mmocore.api.block.SkullBlockType;
|
||||
import net.Indyuce.mmocore.api.block.VanillaBlockType;
|
||||
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
|
||||
import net.Indyuce.mmocore.experience.source.*;
|
||||
import net.Indyuce.mmocore.loot.chest.condition.*;
|
||||
import org.apache.commons.math3.analysis.function.Exp;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem;
|
||||
|
||||
import net.Indyuce.mmocore.loot.droptable.dropitem.DropTableDropItem;
|
||||
@ -30,34 +33,53 @@ import net.Indyuce.mmocore.api.quest.trigger.StaminaTrigger;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.StelliumTrigger;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class DefaultMMOLoader extends MMOLoader {
|
||||
|
||||
@Override
|
||||
public Trigger loadTrigger(MMOLineConfig config) {
|
||||
public List<Trigger> loadTrigger(MMOLineConfig config) {
|
||||
if (config.getKey().equals("from")) {
|
||||
String source = config.getString("source");
|
||||
ConfigFile configFile = new ConfigFile("triggers");
|
||||
if (!configFile.getConfig().contains(source)) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Couldn't find " + source + " in experience-sources.yml");
|
||||
return null;
|
||||
}
|
||||
List<Trigger> list = new ArrayList<>();
|
||||
for (String trigger : configFile.getConfig().getStringList(source)) {
|
||||
list.addAll(loadTrigger(new MMOLineConfig(trigger)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
if (config.getKey().equals("message"))
|
||||
return new MessageTrigger(config);
|
||||
return Arrays.asList(new MessageTrigger(config));
|
||||
|
||||
if (config.getKey().equals("sound") || config.getKey().equals("playsound"))
|
||||
return new SoundTrigger(config);
|
||||
return Arrays.asList(new SoundTrigger(config));
|
||||
|
||||
if (config.getKey().equals("mana"))
|
||||
return new ManaTrigger(config);
|
||||
return Arrays.asList(new ManaTrigger(config));
|
||||
|
||||
if (config.getKey().equals("stamina"))
|
||||
return new StaminaTrigger(config);
|
||||
return Arrays.asList(new StaminaTrigger(config));
|
||||
|
||||
if (config.getKey().equals("stellium"))
|
||||
return new StelliumTrigger(config);
|
||||
return Arrays.asList(new StelliumTrigger(config));
|
||||
|
||||
if (config.getKey().equals("command"))
|
||||
return new CommandTrigger(config);
|
||||
return Arrays.asList(new CommandTrigger(config));
|
||||
|
||||
if (config.getKey().equals("item") || config.getKey().equals("vanilla"))
|
||||
return new ItemTrigger(config);
|
||||
return Arrays.asList(new ItemTrigger(config));
|
||||
|
||||
if (config.getKey().equals("exp") || config.getKey().equals("experience"))
|
||||
return new ExperienceTrigger(config);
|
||||
return Arrays.asList(new ExperienceTrigger(config));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -97,77 +119,111 @@ public class DefaultMMOLoader extends MMOLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Condition loadCondition(MMOLineConfig config) {
|
||||
public List<Condition> loadCondition(MMOLineConfig config) {
|
||||
if (config.getKey().equals("from")) {
|
||||
String source = config.getString("source");
|
||||
ConfigFile configFile = new ConfigFile("conditions");
|
||||
if (!configFile.getConfig().contains(source)) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Couldn't find " + source + " in experience-sources.yml");
|
||||
return null;
|
||||
}
|
||||
List<Condition> list = new ArrayList<>();
|
||||
for (String condition : configFile.getConfig().getStringList(source)) {
|
||||
list.addAll(loadCondition(new MMOLineConfig(condition)));
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
if (config.getKey().equals("distance"))
|
||||
return new DistanceCondition(config);
|
||||
return Arrays.asList(new DistanceCondition(config));
|
||||
|
||||
if (config.getKey().equals("world"))
|
||||
return new WorldCondition(config);
|
||||
return Arrays.asList(new WorldCondition(config));
|
||||
|
||||
if (config.getKey().equals("biome"))
|
||||
return new BiomeCondition(config);
|
||||
return Arrays.asList(new BiomeCondition(config));
|
||||
|
||||
if (config.getKey().equals("level"))
|
||||
return new LevelCondition(config);
|
||||
return Arrays.asList(new LevelCondition(config));
|
||||
|
||||
if (config.getKey().equals("permission"))
|
||||
return new PermissionCondition(config);
|
||||
return Arrays.asList(new PermissionCondition(config));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ExperienceSource<?> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) {
|
||||
public List<ExperienceSource<?>> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) {
|
||||
if (config.getKey().equals("from")) {
|
||||
String source = config.getString("source");
|
||||
ConfigFile configFile = new ConfigFile("exp-sources");
|
||||
if (!configFile.getConfig().contains(source)) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Couldn't find " + source + " in experience-sources.yml");
|
||||
return null;
|
||||
}
|
||||
List<ExperienceSource<?>> list = new ArrayList<>();
|
||||
for (String expSource : configFile.getConfig().getStringList(source)) {
|
||||
list.addAll(loadExperienceSource(new MMOLineConfig(expSource), dispenser));
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
if (config.getKey().equals("resource"))
|
||||
return new ResourceExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new ResourceExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("climb"))
|
||||
return new ClimbExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new ClimbExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("eat")) {
|
||||
return Arrays.asList(new EatExperienceSource(dispenser, config));
|
||||
}
|
||||
|
||||
if (config.getKey().equals("damagedealt"))
|
||||
return new DamageDealtExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new DamageDealtExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("damagetaken"))
|
||||
return new DamageTakenExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new DamageTakenExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("move"))
|
||||
return new MoveExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new MoveExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("play"))
|
||||
return new PlayExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new PlayExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("projectile"))
|
||||
return new ProjectileExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new ProjectileExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("ride"))
|
||||
return new RideExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new RideExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("tame"))
|
||||
return new TameExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new TameExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("killmob"))
|
||||
return new KillMobExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new KillMobExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("mineblock"))
|
||||
return new MineBlockExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new MineBlockExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("placeblock"))
|
||||
return new PlaceBlockExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new PlaceBlockExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("brewpotion"))
|
||||
return new BrewPotionExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new BrewPotionExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("smeltitem"))
|
||||
return new SmeltItemExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new SmeltItemExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("enchantitem"))
|
||||
return new EnchantItemExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new EnchantItemExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("repairitem"))
|
||||
return new RepairItemExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new RepairItemExperienceSource(dispenser, config));
|
||||
|
||||
if (config.getKey().equals("craftitem"))
|
||||
return new CraftItemExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new CraftItemExperienceSource(dispenser, config));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -2,14 +2,16 @@ package net.Indyuce.mmocore.api.load;
|
||||
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import net.Indyuce.mmocore.api.block.BlockType;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import net.Indyuce.mmocore.loot.chest.condition.Condition;
|
||||
import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem;
|
||||
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
|
||||
import net.Indyuce.mmocore.experience.source.type.ExperienceSource;
|
||||
import net.Indyuce.mmocore.api.quest.objective.Objective;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* MMOLoader was initially an interface but it is now a
|
||||
* class so devs do not have to add a new method
|
||||
@ -17,11 +19,11 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
*/
|
||||
public class MMOLoader {
|
||||
|
||||
public Condition loadCondition(MMOLineConfig config) {
|
||||
public List<Condition> loadCondition(MMOLineConfig config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Trigger loadTrigger(MMOLineConfig config) {
|
||||
public List<Trigger> loadTrigger(MMOLineConfig config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -33,7 +35,7 @@ public class MMOLoader {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ExperienceSource<?> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) {
|
||||
public List<ExperienceSource<?>> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,14 @@
|
||||
package net.Indyuce.mmocore.api.player;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.player.MMOPlayerData;
|
||||
import io.lumine.mythic.lib.player.TemporaryPlayerData;
|
||||
import io.lumine.mythic.lib.player.cooldown.CooldownMap;
|
||||
import io.lumine.mythic.lib.player.modifier.PlayerModifier;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.ConfigMessage;
|
||||
import net.Indyuce.mmocore.api.SoundEvent;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import net.Indyuce.mmocore.player.Unlockable;
|
||||
import net.Indyuce.mmocore.tree.IntegerCoordinates;
|
||||
import net.Indyuce.mmocore.tree.NodeState;
|
||||
import net.Indyuce.mmocore.tree.SkillTreeNode;
|
||||
import net.Indyuce.mmocore.tree.skilltree.AutomaticSkillTree;
|
||||
import net.Indyuce.mmocore.tree.skilltree.LinkedSkillTree;
|
||||
import net.Indyuce.mmocore.tree.skilltree.SkillTree;
|
||||
import net.Indyuce.mmocore.tree.skilltree.display.DisplayInfo;
|
||||
import net.Indyuce.mmocore.tree.skilltree.display.Icon;
|
||||
import net.Indyuce.mmocore.waypoint.CostType;
|
||||
import net.Indyuce.mmocore.waypoint.Waypoint;
|
||||
import net.Indyuce.mmocore.api.event.PlayerExperienceGainEvent;
|
||||
import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent;
|
||||
@ -47,7 +39,6 @@ import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||
import net.Indyuce.mmocore.skill.cast.SkillCastingHandler;
|
||||
import net.Indyuce.mmocore.waypoint.WaypointOption;
|
||||
import net.java.truecommons.shed.Link;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.apache.commons.lang.Validate;
|
||||
@ -62,8 +53,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class PlayerData extends OfflinePlayerData implements Closable, ExperienceTableClaimer {
|
||||
@ -113,6 +102,8 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
*/
|
||||
private final Map<String, Integer> tableItemClaims = new HashMap<>();
|
||||
|
||||
// NON-FINAL player data stuff made public to facilitate field change
|
||||
public int skillGuiDisplayOffset;
|
||||
public boolean noCooldown;
|
||||
public CombatRunnable combat;
|
||||
|
||||
@ -179,6 +170,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
} catch (NullPointerException exception) {
|
||||
MMOCore.log(Level.SEVERE, "[Userdata] Could not find class " + getProfess().getId() + " while refreshing player data.");
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
while (j < boundSkills.size())
|
||||
try {
|
||||
@ -501,8 +493,11 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
return guild != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return If the item is unlocked by the player
|
||||
*/
|
||||
public boolean hasUnlocked(Unlockable unlockable) {
|
||||
throw new RuntimeException("Not implemented yet");
|
||||
return unlockedItems.contains(unlockable.getUnlockNamespacedKey());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -511,7 +506,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
* @return If the item was already unlocked when calling this method
|
||||
*/
|
||||
public boolean unlock(Unlockable unlockable) {
|
||||
throw new RuntimeException("Not implemented yet");
|
||||
return unlockedItems.add(unlockable.getUnlockNamespacedKey());
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
@ -544,7 +539,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
public void refreshVanillaExp() {
|
||||
if (!isOnline() || !MMOCore.plugin.configManager.overrideVanillaExp)
|
||||
return;
|
||||
|
||||
getPlayer().sendExperienceChange(0.01f);
|
||||
getPlayer().setLevel(getLevel());
|
||||
getPlayer().setExp(Math.max(0, Math.min(1, (float) experience / (float) getLevelUpExperience())));
|
||||
}
|
||||
@ -718,6 +713,63 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
}.runTaskTimer(MMOCore.plugin, 0, 1);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
|
||||
//We create the JSON corresponding to player Data
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
MMOCore.sqlDebug("Saving data for: '" + getUniqueId() + "'...");
|
||||
|
||||
jsonObject.addProperty("class_points", getClassPoints());
|
||||
jsonObject.addProperty("skill_points", getSkillPoints());
|
||||
jsonObject.addProperty("attribute_points", getAttributePoints());
|
||||
jsonObject.addProperty("attribute_realloc_points", getAttributeReallocationPoints());
|
||||
jsonObject.addProperty("level", getLevel());
|
||||
jsonObject.addProperty("experience", getExperience());
|
||||
jsonObject.addProperty("class", getProfess().getId());
|
||||
jsonObject.addProperty("last_login", getLastLogin());
|
||||
jsonObject.addProperty("guild", hasGuild() ? getGuild().getId() : null);
|
||||
|
||||
jsonObject.addProperty("waypoints", MMOCoreUtils.arrayToJsonString(getWaypoints()));
|
||||
jsonObject.addProperty("friends", MMOCoreUtils.arrayToJsonString(getFriends().stream().map(UUID::toString).collect(Collectors.toList())));
|
||||
jsonObject.addProperty("bound_skills", MMOCoreUtils.arrayToJsonString(getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).collect(Collectors.toList())));
|
||||
|
||||
jsonObject.addProperty("skills", MMOCoreUtils.entrySetToJsonString(mapSkillLevels().entrySet()));
|
||||
jsonObject.addProperty("times_claimed", MMOCoreUtils.entrySetToJsonString(getItemClaims().entrySet()));
|
||||
|
||||
jsonObject.addProperty("attributes", getAttributes().toJsonString());
|
||||
jsonObject.addProperty("professions", getCollectionSkills().toJsonString());
|
||||
jsonObject.addProperty("quests", getQuestData().toJsonString());
|
||||
jsonObject.addProperty("class_info", createClassInfoData(this).toString());
|
||||
|
||||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
|
||||
public static JsonObject createClassInfoData(PlayerData data) {
|
||||
JsonObject json = new JsonObject();
|
||||
for (String c : data.getSavedClasses()) {
|
||||
SavedClassInformation info = data.getClassInfo(c);
|
||||
JsonObject classinfo = new JsonObject();
|
||||
classinfo.addProperty("level", info.getLevel());
|
||||
classinfo.addProperty("experience", info.getExperience());
|
||||
classinfo.addProperty("skill-points", info.getSkillPoints());
|
||||
classinfo.addProperty("attribute-points", info.getAttributePoints());
|
||||
classinfo.addProperty("attribute-realloc-points", info.getAttributeReallocationPoints());
|
||||
JsonObject skillinfo = new JsonObject();
|
||||
for (String skill : info.getSkillKeys())
|
||||
skillinfo.addProperty(skill, info.getSkillLevel(skill));
|
||||
classinfo.add("skill", skillinfo);
|
||||
JsonObject attributeinfo = new JsonObject();
|
||||
for (String attribute : info.getAttributeKeys())
|
||||
attributeinfo.addProperty(attribute, info.getAttributeLevel(attribute));
|
||||
classinfo.add("attribute", attributeinfo);
|
||||
|
||||
json.add(c, classinfo);
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public boolean hasReachedMaxLevel() {
|
||||
return getProfess().getMaxLevel() > 0 && getLevel() >= getProfess().getMaxLevel();
|
||||
}
|
||||
@ -742,6 +794,9 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
* @param splitExp Should the exp be split among party members
|
||||
*/
|
||||
public void giveExperience(double value, EXPSource source, @Nullable Location hologramLocation, boolean splitExp) {
|
||||
if (value <= 0)
|
||||
return;
|
||||
|
||||
if (hasReachedMaxLevel()) {
|
||||
setExperience(0);
|
||||
return;
|
||||
@ -751,14 +806,18 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
value *= 1 + getStats().getStat(StatType.ADDITIONAL_EXPERIENCE) / 100;
|
||||
|
||||
// Splitting exp through party members
|
||||
AbstractParty party = getParty();
|
||||
if (splitExp && party != null) {
|
||||
List<PlayerData> onlineMembers = getParty().getOnlineMembers();
|
||||
AbstractParty party;
|
||||
if (splitExp && (party = getParty()) != null) {
|
||||
List<PlayerData> onlineMembers = party.getOnlineMembers();
|
||||
value /= onlineMembers.size();
|
||||
for (PlayerData member : onlineMembers)
|
||||
member.giveExperience(value, EXPSource.PARTY_SHARING, null, false);
|
||||
if (!equals(member))
|
||||
member.giveExperience(value, source, null, false);
|
||||
}
|
||||
|
||||
// Apply buffs AFTER splitting exp
|
||||
value *= (1 + getStats().getStat("ADDITIONAL_EXPERIENCE") / 100) * MMOCore.plugin.boosterManager.getMultiplier(null);
|
||||
|
||||
PlayerExperienceGainEvent event = new PlayerExperienceGainEvent(this, value, source);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
@ -766,7 +825,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
|
||||
// Experience hologram
|
||||
if (hologramLocation != null && isOnline())
|
||||
MMOCoreUtils.displayIndicator(hologramLocation, MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", String.valueOf(event.getExperience())).message());
|
||||
MMOCoreUtils.displayIndicator(hologramLocation, MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", MythicLib.plugin.getMMOConfig().decimal.format(event.getExperience())).message());
|
||||
|
||||
experience = Math.max(0, experience + event.getExperience());
|
||||
|
||||
@ -781,6 +840,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
|
||||
experience -= needed;
|
||||
level = getLevel() + 1;
|
||||
|
||||
// Apply class experience table
|
||||
if (getProfess().hasExperienceTable())
|
||||
getProfess().getExperienceTable().claim(this, level, getProfess());
|
||||
}
|
||||
|
||||
if (level > oldLevel) {
|
||||
@ -800,6 +863,8 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
refreshVanillaExp();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public double getExperience() {
|
||||
return experience;
|
||||
}
|
||||
@ -821,7 +886,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
public void giveMana(double amount, PlayerResourceUpdateEvent.UpdateReason reason) {
|
||||
|
||||
// Avoid calling useless event
|
||||
double max = getStats().getStat(StatType.MAX_MANA);
|
||||
double max = getStats().getStat("MAX_MANA");
|
||||
double newest = Math.max(0, Math.min(mana + amount, max));
|
||||
if (mana == newest)
|
||||
return;
|
||||
@ -846,7 +911,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
public void giveStamina(double amount, PlayerResourceUpdateEvent.UpdateReason reason) {
|
||||
|
||||
// Avoid calling useless event
|
||||
double max = getStats().getStat(StatType.MAX_STAMINA);
|
||||
double max = getStats().getStat("MAX_STAMINA");
|
||||
double newest = Math.max(0, Math.min(stamina + amount, max));
|
||||
if (stamina == newest)
|
||||
return;
|
||||
@ -871,7 +936,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
public void giveStellium(double amount, PlayerResourceUpdateEvent.UpdateReason reason) {
|
||||
|
||||
// Avoid calling useless event
|
||||
double max = getStats().getStat(StatType.MAX_STELLIUM);
|
||||
double max = getStats().getStat("MAX_STELLIUM");
|
||||
double newest = Math.max(0, Math.min(stellium + amount, max));
|
||||
if (stellium == newest)
|
||||
return;
|
||||
@ -906,15 +971,15 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
}
|
||||
|
||||
public void setMana(double amount) {
|
||||
mana = Math.max(0, Math.min(amount, getStats().getStat(StatType.MAX_MANA)));
|
||||
mana = Math.max(0, Math.min(amount, getStats().getStat("MAX_MANA")));
|
||||
}
|
||||
|
||||
public void setStamina(double amount) {
|
||||
stamina = Math.max(0, Math.min(amount, getStats().getStat(StatType.MAX_STAMINA)));
|
||||
stamina = Math.max(0, Math.min(amount, getStats().getStat("MAX_STAMINA")));
|
||||
}
|
||||
|
||||
public void setStellium(double amount) {
|
||||
stellium = Math.max(0, Math.min(amount, getStats().getStat(StatType.MAX_STELLIUM)));
|
||||
stellium = Math.max(0, Math.min(amount, getStats().getStat("MAX_STELLIUM")));
|
||||
}
|
||||
|
||||
public boolean isFullyLoaded() {
|
||||
@ -947,6 +1012,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
Validate.isTrue(isCasting(), "Player not in casting mode");
|
||||
skillCasting.close();
|
||||
this.skillCasting = null;
|
||||
setLastActivity(PlayerActivity.ACTION_BAR_MESSAGE, 0); // Reset action bar
|
||||
}
|
||||
|
||||
public void displayActionBar(String message) {
|
||||
@ -1099,6 +1165,34 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
combat = new CombatRunnable(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The savingPlayerData object corresponding to the playerData
|
||||
*/
|
||||
public SavingPlayerData getSavingPlayerData() {
|
||||
return new SavingPlayerData(
|
||||
getUniqueId(),
|
||||
getClassPoints(),
|
||||
getSkillPoints(),
|
||||
getAttributePoints(),
|
||||
getAttributeReallocationPoints(),
|
||||
getLevel(),
|
||||
getExperience(),
|
||||
getProfess().getId(),
|
||||
getLastLogin(),
|
||||
hasGuild() ? getGuild().getId() : null,
|
||||
getWaypoints(),
|
||||
getFriends(),
|
||||
getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).toList(),
|
||||
mapSkillLevels(),
|
||||
getItemClaims(),
|
||||
getAttributes().toJsonString(),
|
||||
getCollectionSkills().toJsonString(),
|
||||
getQuestData().toJsonString(),
|
||||
createClassInfoData(this).toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return mmoData.hashCode();
|
||||
|
@ -0,0 +1,42 @@
|
||||
package net.Indyuce.mmocore.api.player;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes;
|
||||
import net.Indyuce.mmocore.api.quest.PlayerQuests;
|
||||
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Just a container holding the basic playerData information that are needed to save it in a database.
|
||||
*/
|
||||
public record SavingPlayerData(
|
||||
UUID uuid,
|
||||
int classPoints,
|
||||
int skillPoints,
|
||||
int attributePoints,
|
||||
int attributeReallocationPoints,
|
||||
int level,
|
||||
double experience,
|
||||
String classId,
|
||||
long lastLogin,
|
||||
String guildId,
|
||||
Set<String> waypoints,
|
||||
List<UUID> friends,
|
||||
List<String> boundSkills,
|
||||
Map<String,Integer> skills,
|
||||
Map<String,Integer> itemClaims,
|
||||
String attributes,
|
||||
String collectionsSkills,
|
||||
String questData,
|
||||
String classInfoData)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -12,6 +12,7 @@ import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AttributeModifier extends PlayerModifier {
|
||||
private final String attribute;
|
||||
@ -74,9 +75,10 @@ public class AttributeModifier extends PlayerModifier {
|
||||
public AttributeModifier(ConfigObject object) {
|
||||
super(object.getString("key"), EquipmentSlot.OTHER, ModifierSource.OTHER);
|
||||
|
||||
String str = Objects.requireNonNull(object.getString("value"));
|
||||
type = str.toCharArray()[str.length() - 1] == '%' ? ModifierType.RELATIVE : ModifierType.FLAT;
|
||||
value = Double.parseDouble(type == ModifierType.RELATIVE ? str.substring(0, str.length() - 1) : str);
|
||||
this.attribute = object.getString("attribute");
|
||||
this.value = object.getDouble("value");
|
||||
type = object.getBoolean("multiplicative", false) ? ModifierType.RELATIVE : ModifierType.FLAT;
|
||||
}
|
||||
|
||||
public String getAttribute() {
|
||||
|
@ -3,57 +3,109 @@ package net.Indyuce.mmocore.api.player.attribute;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.stat.modifier.StatModifier;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.experience.ExpCurve;
|
||||
import net.Indyuce.mmocore.experience.ExperienceObject;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class PlayerAttribute {
|
||||
private final String id, name;
|
||||
private final int max;
|
||||
public class PlayerAttribute implements ExperienceObject {
|
||||
private final String id, name;
|
||||
private final int max;
|
||||
private final ExperienceTable expTable;
|
||||
|
||||
/**
|
||||
* Used to store stats using StatType, but attributes also need to access
|
||||
* non basic MMOCore stats hence the string maps keys
|
||||
*/
|
||||
private final Set<StatModifier> buffs = new HashSet<>();
|
||||
/**
|
||||
* All buffs granted by an attribute. These are normalized and
|
||||
* must be multiplied by the player level first
|
||||
*/
|
||||
private final Set<StatModifier> buffs = new HashSet<>();
|
||||
|
||||
public PlayerAttribute(ConfigurationSection config) {
|
||||
Validate.notNull(config, "Could not load config");
|
||||
id = config.getName().toLowerCase().replace("_", "-").replace(" ", "-");
|
||||
public PlayerAttribute(ConfigurationSection config) {
|
||||
Validate.notNull(config, "Could not load config");
|
||||
id = config.getName().toLowerCase().replace("_", "-").replace(" ", "-");
|
||||
|
||||
name = MythicLib.plugin.parseColors(config.getString("name", "Attribute"));
|
||||
max = config.contains("max-points") ? Math.max(1, config.getInt("max-points")) : 0;
|
||||
name = MythicLib.plugin.parseColors(config.getString("name", "Attribute"));
|
||||
max = config.contains("max-points") ? Math.max(1, config.getInt("max-points")) : 0;
|
||||
|
||||
if (config.contains("buff"))
|
||||
for (String key : config.getConfigurationSection("buff").getKeys(false))
|
||||
try {
|
||||
String stat = key.toUpperCase().replace("-", "_").replace(" ", "_");
|
||||
buffs.add(new StatModifier("attribute." + id, stat, config.getString("buff." + key)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.log(Level.WARNING, "Could not load buff '" + key + "' from attribute '" + id + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
if (config.contains("buff"))
|
||||
for (String key : config.getConfigurationSection("buff").getKeys(false))
|
||||
try {
|
||||
String stat = key.toUpperCase().replace("-", "_").replace(" ", "_");
|
||||
buffs.add(new StatModifier("attribute." + id, stat, config.getString("buff." + key)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.log(Level.WARNING, "Could not load buff '" + key + "' from attribute '" + id + "': " + exception.getMessage());
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
// Load exp table
|
||||
ExperienceTable expTable = null;
|
||||
if (config.contains("exp-table"))
|
||||
try {
|
||||
expTable = MMOCore.plugin.experience.loadExperienceTable(config.get("exp-table"));
|
||||
} catch (RuntimeException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp table from class '" + id + "': " + exception.getMessage());
|
||||
}
|
||||
this.expTable = expTable;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean hasMax() {
|
||||
return max > 0;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getMax() {
|
||||
return max;
|
||||
}
|
||||
public boolean hasMax() {
|
||||
return max > 0;
|
||||
}
|
||||
|
||||
public Set<StatModifier> getBuffs() {
|
||||
return buffs;
|
||||
}
|
||||
public int getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
public Set<StatModifier> getBuffs() {
|
||||
return buffs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return "attribute:" + getId().replace("-", "_");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ExperienceTable getExperienceTable() {
|
||||
return Objects.requireNonNull(expTable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasExperienceTable() {
|
||||
return expTable != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ExpCurve getExpCurve() {
|
||||
throw new RuntimeException("Attributes don't have experience");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, @NotNull EXPSource source) {
|
||||
throw new RuntimeException("Attributes don't have experience");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldHandle(PlayerData playerData) {
|
||||
throw new RuntimeException("Attributes don't have experience");
|
||||
}
|
||||
}
|
||||
|
@ -159,14 +159,14 @@ public class PlayerAttributes {
|
||||
return map.get(key);
|
||||
}
|
||||
|
||||
public void addModifier(String key, double value) {
|
||||
addModifier(new AttributeModifier(key, id, value, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER));
|
||||
public AttributeModifier addModifier(String key, double value) {
|
||||
return addModifier(new AttributeModifier(key, id, value, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER));
|
||||
}
|
||||
|
||||
public void addModifier(AttributeModifier modifier) {
|
||||
map.put(modifier.getKey(), modifier);
|
||||
|
||||
public AttributeModifier addModifier(AttributeModifier modifier) {
|
||||
AttributeModifier mod = map.put(modifier.getKey(), modifier);
|
||||
update();
|
||||
return mod;
|
||||
}
|
||||
|
||||
public Set<String> getKeys() {
|
||||
@ -177,7 +177,7 @@ public class PlayerAttributes {
|
||||
return map.containsKey(key);
|
||||
}
|
||||
|
||||
public void removeModifier(String key) {
|
||||
public AttributeModifier removeModifier(String key) {
|
||||
AttributeModifier mod = map.remove(key);
|
||||
|
||||
/*
|
||||
@ -190,12 +190,13 @@ public class PlayerAttributes {
|
||||
((Closeable) mod).close();
|
||||
update();
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
PlayerAttribute attribute = MMOCore.plugin.attributeManager.get(id);
|
||||
PlayerAttribute attr = MMOCore.plugin.attributeManager.get(id);
|
||||
int total = getTotal();
|
||||
attribute.getBuffs().forEach(buff -> buff.multiply(total).register(data.getMMOPlayerData()));
|
||||
attr.getBuffs().forEach(buff -> buff.multiply(total).register(data.getMMOPlayerData()));
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
@ -1,52 +1,58 @@
|
||||
package net.Indyuce.mmocore.api.player.profess;
|
||||
|
||||
public enum ClassOption {
|
||||
|
||||
/**
|
||||
* If the class should be applied to newcomers
|
||||
*/
|
||||
DEFAULT,
|
||||
|
||||
/**
|
||||
* If the class should in the /class GUI
|
||||
*/
|
||||
DISPLAY(true),
|
||||
|
||||
/**
|
||||
* Health only regens when out of combat
|
||||
*/
|
||||
OFF_COMBAT_HEALTH_REGEN,
|
||||
|
||||
/**
|
||||
* Mana only regens when out of combat
|
||||
*/
|
||||
OFF_COMBAT_MANA_REGEN,
|
||||
|
||||
/**
|
||||
* Stamina only regens when out of combat
|
||||
*/
|
||||
OFF_COMBAT_STAMINA_REGEN,
|
||||
|
||||
/**
|
||||
* Stellium only regens when out of combat
|
||||
*/
|
||||
OFF_COMBAT_STELLIUM_REGEN;
|
||||
|
||||
private final boolean def;
|
||||
|
||||
ClassOption() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
ClassOption(boolean def) {
|
||||
this.def = def;
|
||||
}
|
||||
|
||||
public boolean getDefault() {
|
||||
return def;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return name().toLowerCase().replace("_", "-");
|
||||
}
|
||||
package net.Indyuce.mmocore.api.player.profess;
|
||||
|
||||
public enum ClassOption {
|
||||
|
||||
/**
|
||||
* If the class should be applied to newcomers
|
||||
*/
|
||||
DEFAULT,
|
||||
|
||||
/**
|
||||
* When set to true any player has to have the
|
||||
* mmocore.class.lower_case_name permission to use the class
|
||||
*/
|
||||
NEEDS_PERMISSION,
|
||||
|
||||
/**
|
||||
* If the class should in the /class GUI
|
||||
*/
|
||||
DISPLAY(true),
|
||||
|
||||
/**
|
||||
* Health only regens when out of combat
|
||||
*/
|
||||
OFF_COMBAT_HEALTH_REGEN,
|
||||
|
||||
/**
|
||||
* Mana only regens when out of combat
|
||||
*/
|
||||
OFF_COMBAT_MANA_REGEN,
|
||||
|
||||
/**
|
||||
* Stamina only regens when out of combat
|
||||
*/
|
||||
OFF_COMBAT_STAMINA_REGEN,
|
||||
|
||||
/**
|
||||
* Stellium only regens when out of combat
|
||||
*/
|
||||
OFF_COMBAT_STELLIUM_REGEN;
|
||||
|
||||
private final boolean def;
|
||||
|
||||
ClassOption() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
ClassOption(boolean def) {
|
||||
this.def = def;
|
||||
}
|
||||
|
||||
public boolean getDefault() {
|
||||
return def;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return name().toLowerCase().replace("_", "-");
|
||||
}
|
||||
}
|
@ -8,26 +8,27 @@ import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import io.lumine.mythic.lib.api.util.PostLoadObject;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.event.EventTrigger;
|
||||
import net.Indyuce.mmocore.api.player.profess.resource.ManaDisplayOptions;
|
||||
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||
import net.Indyuce.mmocore.api.player.profess.resource.ResourceRegeneration;
|
||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.Indyuce.mmocore.loot.chest.particle.CastingParticle;
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.experience.ExpCurve;
|
||||
import net.Indyuce.mmocore.experience.ExperienceObject;
|
||||
import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
||||
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
|
||||
import net.Indyuce.mmocore.experience.dispenser.ClassExperienceDispenser;
|
||||
import net.Indyuce.mmocore.experience.source.type.ExperienceSource;
|
||||
import net.Indyuce.mmocore.loot.chest.particle.CastingParticle;
|
||||
import net.Indyuce.mmocore.player.playerclass.ClassTrigger;
|
||||
import net.Indyuce.mmocore.player.playerclass.ClassTriggerType;
|
||||
import net.Indyuce.mmocore.player.stats.StatInfo;
|
||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -51,7 +52,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
private final ExpCurve expCurve;
|
||||
private final ExperienceTable expTable;
|
||||
|
||||
private final Map<StatType, LinearValue> stats = new HashMap<>();
|
||||
private final Map<String, LinearValue> stats = new HashMap<>();
|
||||
private final Map<String, ClassSkill> skills = new LinkedHashMap<>();
|
||||
private final List<Subclass> subclasses = new ArrayList<>();
|
||||
|
||||
@ -83,7 +84,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
profileField.set(meta, gp);
|
||||
icon.setItemMeta(meta);
|
||||
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException
|
||||
| SecurityException exception) {
|
||||
| SecurityException exception) {
|
||||
throw new IllegalArgumentException("Could not apply playerhead texture: " + exception.getMessage());
|
||||
}
|
||||
|
||||
@ -124,7 +125,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
if (config.contains("attributes"))
|
||||
for (String key : config.getConfigurationSection("attributes").getKeys(false))
|
||||
try {
|
||||
stats.put(StatType.valueOf(key.toUpperCase().replace("-", "_")),
|
||||
stats.put(UtilityMethods.enumName(key),
|
||||
new LinearValue(config.getConfigurationSection("attributes." + key)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load stat info '" + key + "' from class '"
|
||||
@ -155,12 +156,12 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
"Could not load option '" + key + "' from class '" + key + "': " + exception.getMessage());
|
||||
}
|
||||
|
||||
if (config.contains("main-exp-sources")) {
|
||||
ExperienceDispenser dispenser = new ClassExperienceDispenser(this);
|
||||
for (String key : config.getStringList("main-exp-sources"))
|
||||
if (config.contains("main-exp-sources.yml")) {
|
||||
for (String key : config.getStringList("main-exp-sources.yml"))
|
||||
try {
|
||||
ExperienceSource<?> source = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), dispenser);
|
||||
MMOCore.plugin.experience.registerSource(source);
|
||||
List<ExperienceSource<?>> list = MMOCore.plugin.loadManager.loadExperienceSource(new MMOLineConfig(key), this);
|
||||
for (ExperienceSource source : list)
|
||||
MMOCore.plugin.experience.registerSource(source);
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Could not load exp source '" + key + "' from class '"
|
||||
+ id + "': " + exception.getMessage());
|
||||
@ -187,11 +188,12 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to generate the default Human class if no one is
|
||||
* specified after loading all the player classes. This is
|
||||
* a very basic class that will make sure MMOCore can still
|
||||
* continue to run without having to stop the server because
|
||||
* some option was not provided
|
||||
* Used to generate the default Human class if no one is specified
|
||||
* after loading all the player classes.
|
||||
* <p>
|
||||
* This is a very basic class that will make sure MMOCore can still
|
||||
* continue to run without having to stop the server because some
|
||||
* option was not provided.
|
||||
*/
|
||||
public PlayerClass(String id, String name, Material material) {
|
||||
super(null);
|
||||
@ -205,7 +207,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
expTable = null;
|
||||
castParticle = new CastingParticle(Particle.SPELL_INSTANT);
|
||||
actionBarFormat = "";
|
||||
|
||||
this.icon = new ItemStack(material);
|
||||
setOption(ClassOption.DISPLAY, false);
|
||||
setOption(ClassOption.DEFAULT, false);
|
||||
@ -296,7 +297,19 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
}
|
||||
|
||||
public boolean hasOption(ClassOption option) {
|
||||
return options.containsKey(option) ? options.get(option) : option.getDefault();
|
||||
return options.getOrDefault(option, option.getDefault());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveExperience(PlayerData playerData, double experience, @Nullable Location hologramLocation, EXPSource source) {
|
||||
hologramLocation = !MMOCore.plugin.getConfig().getBoolean("display-main-class-exp-holograms") ? null
|
||||
: hologramLocation;
|
||||
playerData.giveExperience(experience, source, hologramLocation, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldHandle(PlayerData playerData) {
|
||||
return equals(playerData.getProfess());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -320,16 +333,11 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
return eventTriggers.get(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setStat(StatType type, double base, double perLevel) {
|
||||
setStat(type, new LinearValue(base, perLevel));
|
||||
public void setDefaultStatFormula(String type, LinearValue value) {
|
||||
stats.put(UtilityMethods.enumName(type), value);
|
||||
}
|
||||
|
||||
public void setStat(StatType type, LinearValue value) {
|
||||
stats.put(type, value);
|
||||
}
|
||||
|
||||
public double calculateStat(StatType stat, int level) {
|
||||
public double calculateStat(String stat, int level) {
|
||||
return getStatInfo(stat).calculate(level);
|
||||
}
|
||||
|
||||
@ -363,19 +371,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
return getSkill(skill.getHandler().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces map checkups when skills are being checked on events that are
|
||||
* commonly called like EntityDamageEvent or regen events.
|
||||
* <p>
|
||||
* Examples:
|
||||
* - {@link net.Indyuce.mmocore.skill.list.Neptune_Gift}
|
||||
* - {@link net.Indyuce.mmocore.skill.list.Ambers}
|
||||
*/
|
||||
public Optional<ClassSkill> findSkill(RegisteredSkill skill) {
|
||||
ClassSkill found = skills.get(skill.getHandler().getId());
|
||||
return found == null ? Optional.empty() : Optional.of(found);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ClassSkill getSkill(String id) {
|
||||
return skills.get(id);
|
||||
@ -385,8 +380,10 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
return skills.values();
|
||||
}
|
||||
|
||||
private LinearValue getStatInfo(StatType type) {
|
||||
return stats.containsKey(type) ? stats.get(type) : type.getDefault();
|
||||
@NotNull
|
||||
private LinearValue getStatInfo(String stat) {
|
||||
LinearValue found = stats.get(stat);
|
||||
return found == null ? StatInfo.valueOf(stat).getDefaultFormula() : found;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -394,6 +391,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
return obj instanceof PlayerClass && ((PlayerClass) obj).id.equals(id);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getActionBar() {
|
||||
return actionBarFormat;
|
||||
}
|
||||
|
@ -6,15 +6,15 @@ import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
||||
import net.Indyuce.mmocore.manager.data.PlayerDataManager;
|
||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||
import net.Indyuce.mmocore.manager.data.PlayerDataManager.DefaultPlayerData;
|
||||
|
||||
public class SavedClassInformation {
|
||||
private final int level, skillPoints, attributePoints, attributeReallocationPoints;
|
||||
@ -60,7 +60,7 @@ public class SavedClassInformation {
|
||||
player.getAttributes().mapPoints(), player.mapSkillLevels());
|
||||
}
|
||||
|
||||
public SavedClassInformation(DefaultPlayerData data) {
|
||||
public SavedClassInformation(PlayerDataManager.DefaultPlayerData data) {
|
||||
this(data.getLevel(), 0, data.getSkillPoints(), data.getAttributePoints(), data.getAttrReallocPoints());
|
||||
}
|
||||
|
||||
|
@ -1,23 +1,23 @@
|
||||
package net.Indyuce.mmocore.api.player.profess;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
public class Subclass {
|
||||
private final PlayerClass profess;
|
||||
private final int level;
|
||||
|
||||
public Subclass(PlayerClass profess, int level) {
|
||||
Validate.notNull(profess, "Subclass cannot be null");
|
||||
|
||||
this.profess = profess;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public PlayerClass getProfess() {
|
||||
return profess;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
package net.Indyuce.mmocore.api.player.profess;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
public class Subclass {
|
||||
private final PlayerClass profess;
|
||||
private final int level;
|
||||
|
||||
public Subclass(PlayerClass profess, int level) {
|
||||
Validate.notNull(profess, "Subclass cannot be null");
|
||||
|
||||
this.profess = profess;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public PlayerClass getProfess() {
|
||||
return profess;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ package net.Indyuce.mmocore.api.player.profess.event;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
@ -26,7 +25,7 @@ public class EventTrigger {
|
||||
|
||||
for (String format : list)
|
||||
try {
|
||||
triggers.add(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(format)));
|
||||
triggers.addAll(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(format)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING,
|
||||
"Could not load trigger '" + format + "' from event trigger '" + event + "': " + exception.getMessage());
|
||||
|
@ -2,8 +2,8 @@ package net.Indyuce.mmocore.api.player.profess.event.trigger;
|
||||
|
||||
import io.lumine.mythic.lib.api.event.PlayerAttackEvent;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.event.EventTriggerHandler;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.Indyuce.mmocore.api.player.profess.event.trigger;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent;
|
||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||
import net.Indyuce.mmocore.api.player.profess.event.EventTriggerHandler;
|
||||
|
||||
@Deprecated
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.Indyuce.mmocore.api.player.profess.event.trigger;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.PlayerLevelUpEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.event.EventTriggerHandler;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.Indyuce.mmocore.api.player.profess.resource;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger;
|
||||
import net.Indyuce.mmocore.command.rpg.admin.ResourceCommandTreeNode;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.ClassOption;
|
||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
@ -20,27 +20,27 @@ public enum PlayerResource {
|
||||
(data, amount) -> data.getPlayer().setHealth(amount)),
|
||||
|
||||
MANA(PlayerData::getMana,
|
||||
data -> data.getStats().getStat(StatType.MAX_MANA),
|
||||
data -> data.getStats().getStat("MAX_MANA"),
|
||||
(data, amount) -> data.giveMana(amount, PlayerResourceUpdateEvent.UpdateReason.REGENERATION),
|
||||
(data, amount) -> data.giveMana(amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND),
|
||||
(data, amount) -> data.giveMana(-amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND),
|
||||
(data, amount) -> data.setMana(amount)),
|
||||
|
||||
STAMINA(PlayerData::getStamina,
|
||||
data -> data.getStats().getStat(StatType.MAX_STAMINA),
|
||||
data -> data.getStats().getStat("MAX_STAMINA"),
|
||||
(data, amount) -> data.giveStamina(amount, PlayerResourceUpdateEvent.UpdateReason.REGENERATION),
|
||||
(data, amount) -> data.giveStamina(amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND),
|
||||
(data, amount) -> data.giveStamina(-amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND),
|
||||
(data, amount) -> data.setStamina(amount)),
|
||||
|
||||
STELLIUM(PlayerData::getStellium,
|
||||
data -> data.getStats().getStat(StatType.MAX_STELLIUM),
|
||||
data -> data.getStats().getStat("MAX_STELLIUM"),
|
||||
(data, amount) -> data.giveStellium(amount, PlayerResourceUpdateEvent.UpdateReason.REGENERATION),
|
||||
(data, amount) -> data.giveStellium(amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND),
|
||||
(data, amount) -> data.giveStellium(-amount, PlayerResourceUpdateEvent.UpdateReason.COMMAND),
|
||||
(data, amount) -> data.setStellium(amount));
|
||||
|
||||
private final StatType regenStat, maxRegenStat;
|
||||
private final String regenStat, maxRegenStat;
|
||||
private final ClassOption offCombatRegen;
|
||||
private final Function<PlayerData, Double> current, max;
|
||||
private final BiConsumer<PlayerData, Double> regen;
|
||||
@ -54,8 +54,8 @@ public enum PlayerResource {
|
||||
BiConsumer<PlayerData, Double> give,
|
||||
BiConsumer<PlayerData, Double> take,
|
||||
BiConsumer<PlayerData, Double> set) {
|
||||
this.regenStat = StatType.valueOf(name() + "_REGENERATION");
|
||||
this.maxRegenStat = StatType.valueOf("MAX_" + name() + "_REGENERATION");
|
||||
this.regenStat = name() + "_REGENERATION";
|
||||
this.maxRegenStat = "MAX_" + name() + "_REGENERATION";
|
||||
this.offCombatRegen = ClassOption.valueOf("OFF_COMBAT_" + name() + "_REGEN");
|
||||
this.current = current;
|
||||
this.max = max;
|
||||
@ -68,14 +68,14 @@ public enum PlayerResource {
|
||||
/**
|
||||
* @return Stat which corresponds to flat resource regeneration
|
||||
*/
|
||||
public StatType getRegenStat() {
|
||||
public String getRegenStat() {
|
||||
return regenStat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Stat which corresponds to resource regeneration scaling with the player's max health
|
||||
*/
|
||||
public StatType getMaxRegenStat() {
|
||||
public String getMaxRegenStat() {
|
||||
return maxRegenStat;
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ public enum PlayerResource {
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by MMOCore admin commands here: {@link net.Indyuce.mmocore.command.rpg.admin.ResourceCommandTreeNode}
|
||||
* Used by MMOCore admin commands here: {@link ResourceCommandTreeNode}
|
||||
*/
|
||||
public BiConsumer<PlayerData, Double> getConsumer(ManaTrigger.Operation operation) {
|
||||
switch (operation) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.Indyuce.mmocore.api.player.profess.resource;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
|
@ -6,19 +6,16 @@ import io.lumine.mythic.lib.api.stat.StatMap;
|
||||
import io.lumine.mythic.lib.api.stat.modifier.StatModifier;
|
||||
import io.lumine.mythic.lib.player.modifier.ModifierSource;
|
||||
import io.lumine.mythic.lib.player.modifier.ModifierType;
|
||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
import net.Indyuce.mmocore.player.stats.StatInfo;
|
||||
|
||||
public class PlayerStats {
|
||||
private final PlayerData data;
|
||||
|
||||
/**
|
||||
* Utilclass to easily manipulate the MMOLib stat map
|
||||
* Util class to easily manipulate the MMOLib stat map
|
||||
*
|
||||
* @param data Playerdata
|
||||
*/
|
||||
@ -34,6 +31,7 @@ public class PlayerStats {
|
||||
return data.getMMOPlayerData().getStatMap();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public StatInstance getInstance(StatType stat) {
|
||||
return getMap().getInstance(stat.name());
|
||||
}
|
||||
@ -42,35 +40,26 @@ public class PlayerStats {
|
||||
return getMap().getInstance(stat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for stat type enum to have dynamic professions.
|
||||
* ID FORMAT: STAT_TYPE_HERE_PROFESSION_HERE
|
||||
*
|
||||
* @param type the type of stat
|
||||
* @param profession the stat's specific permission
|
||||
* @return instance of found stat
|
||||
* @author Ehhthan
|
||||
*/
|
||||
@NotNull
|
||||
public StatInstance getInstance(StatType type, @Nullable Profession profession) {
|
||||
if (profession == null)
|
||||
return getInstance(type);
|
||||
else {
|
||||
String id = (type.name() + '_' + profession.getId()).replace('-', '_').replace(' ', '_').toUpperCase(Locale.ROOT);
|
||||
return getInstance(id);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* applies relative attributes on the base stat too
|
||||
*/
|
||||
public double getStat(StatType stat) {
|
||||
public double getStat(String stat) {
|
||||
return getInstance(stat).getTotal();
|
||||
}
|
||||
|
||||
public double getBase(StatType stat) {
|
||||
return data.getProfess().calculateStat(stat,
|
||||
stat.hasProfession() ? data.getCollectionSkills().getLevel(stat.getProfession()) : data.getLevel());
|
||||
/**
|
||||
* MMOCore base stat value differs from the on in MythicLib.
|
||||
* <p>
|
||||
* MythicLib: the base stat value is only defined for stats
|
||||
* which are based on vanilla player attributes. It corresponds
|
||||
* to the stat amount any player has with NO attribute modifier whatsoever.
|
||||
* <p>
|
||||
* MMOCore: the base stat value corresponds to the stat amount
|
||||
* the player CLASS grants. It can be similar or equal to the one
|
||||
* in MMOCore but it really is completely different.
|
||||
*
|
||||
* @return MMOCore base stat value
|
||||
*/
|
||||
public double getBase(String stat) {
|
||||
Profession profession = StatInfo.valueOf(stat).profession;
|
||||
return data.getProfess().calculateStat(stat, profession == null ? data.getLevel() : data.getCollectionSkills().getLevel(profession));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,7 +70,7 @@ public class PlayerStats {
|
||||
* see {@link PlayerData#update()} for more info
|
||||
*/
|
||||
public synchronized void updateStats() {
|
||||
for (StatType stat : StatType.values()) {
|
||||
for (StatType stat : StatType.values()) { // TODO fix
|
||||
StatInstance instance = getMap().getInstance(stat.name());
|
||||
StatInstance.ModifierPacket packet = instance.newPacket();
|
||||
|
||||
@ -89,7 +78,7 @@ public class PlayerStats {
|
||||
packet.removeIf(str -> str.equals("mmocoreClass"));
|
||||
|
||||
// Add newest one
|
||||
double total = getBase(stat) - instance.getBase();
|
||||
double total = getBase(stat.name()) - instance.getBase();
|
||||
if (total != 0)
|
||||
packet.addModifier(new StatModifier("mmocoreClass", stat.name(), total, ModifierType.FLAT, EquipmentSlot.OTHER, ModifierSource.OTHER));
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.Indyuce.mmocore.api.player.stats;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.ConfigFile;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import net.Indyuce.mmocore.player.stats.StatInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Objects;
|
||||
|
||||
@Deprecated
|
||||
public enum StatType {
|
||||
|
||||
// Vanilla stats
|
||||
@ -87,17 +87,17 @@ public enum StatType {
|
||||
/**
|
||||
* Reduces amount of tugs needed to fish
|
||||
*/
|
||||
FISHING_STRENGTH("fishing"),
|
||||
FISHING_STRENGTH,
|
||||
|
||||
/**
|
||||
* Chance of instant success when fishing
|
||||
*/
|
||||
CRITICAL_FISHING_CHANCE("fishing"),
|
||||
CRITICAL_FISHING_CHANCE,
|
||||
|
||||
/**
|
||||
* Chance of crit fishing failure
|
||||
*/
|
||||
CRITICAL_FISHING_FAILURE_CHANCE("fishing"),
|
||||
CRITICAL_FISHING_FAILURE_CHANCE,
|
||||
|
||||
/**
|
||||
* Chance of dropping more minerals when mining.
|
||||
@ -114,49 +114,35 @@ public enum StatType {
|
||||
*/
|
||||
LUCK_OF_THE_FIELD;
|
||||
|
||||
private String profession;
|
||||
|
||||
private LinearValue defaultInfo;
|
||||
private DecimalFormat format;
|
||||
|
||||
StatType() {
|
||||
// Completely custom stat
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
StatType(String profession) {
|
||||
this.profession = profession;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getProfession() {
|
||||
return profession;
|
||||
return findProfession().getId();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public Profession findProfession() {
|
||||
return MMOCore.plugin.professionManager.get(profession);
|
||||
return StatInfo.valueOf(name()).profession;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean hasProfession() {
|
||||
return profession != null;
|
||||
return findProfession() != null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public LinearValue getDefault() {
|
||||
return defaultInfo;
|
||||
return StatInfo.valueOf(name()).getDefaultFormula();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean matches(Profession profession) {
|
||||
return this.profession != null && this.profession.equals(profession.getId());
|
||||
return Objects.equals(findProfession(), profession);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String format(double value) {
|
||||
return format.format(value);
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
FileConfiguration config = new ConfigFile("stats").getConfig();
|
||||
for (StatType stat : values()) {
|
||||
stat.defaultInfo = config.contains("default." + stat.name()) ? new LinearValue(config.getConfigurationSection("default." + stat.name())) : new LinearValue(0, 0);
|
||||
stat.format = MythicLib.plugin.getMMOConfig().newDecimalFormat(config.contains("decimal-format." + stat.name()) ? config.getString("decimal-format." + stat.name()) : "0.#");
|
||||
}
|
||||
return StatInfo.valueOf(name()).format(value);
|
||||
}
|
||||
}
|
||||
|
@ -100,6 +100,7 @@ public class PlayerQuests implements Closable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (jo.has("finished"))
|
||||
for (Entry<String, JsonElement> entry : jo.getAsJsonObject("finished").entrySet())
|
||||
finished.put(entry.getKey(), entry.getValue().getAsLong());
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmocore.api.quest.objective;
|
||||
|
||||
import net.Indyuce.mmocore.api.quest.ObjectiveProgress;
|
||||
import net.Indyuce.mmocore.api.quest.QuestProgress;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -11,8 +13,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import net.Indyuce.mmocore.api.quest.ObjectiveProgress;
|
||||
import net.Indyuce.mmocore.api.quest.QuestProgress;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
public class ClickonObjective extends Objective {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmocore.api.quest.objective;
|
||||
|
||||
import net.Indyuce.mmocore.api.quest.ObjectiveProgress;
|
||||
import net.Indyuce.mmocore.api.quest.QuestProgress;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -10,8 +12,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
import net.Indyuce.mmocore.api.quest.ObjectiveProgress;
|
||||
import net.Indyuce.mmocore.api.quest.QuestProgress;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
public class GoToObjective extends Objective {
|
||||
|
@ -1,13 +1,13 @@
|
||||
package net.Indyuce.mmocore.api.quest.objective;
|
||||
|
||||
import io.lumine.mythic.lib.api.event.PlayerKillEntityEvent;
|
||||
import net.Indyuce.mmocore.api.quest.ObjectiveProgress;
|
||||
import net.Indyuce.mmocore.api.quest.QuestProgress;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import net.Indyuce.mmocore.api.quest.ObjectiveProgress;
|
||||
import net.Indyuce.mmocore.api.quest.QuestProgress;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
public class KillMobObjective extends Objective {
|
||||
|
@ -1,5 +1,8 @@
|
||||
package net.Indyuce.mmocore.api.quest.objective;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.CustomBlockMineEvent;
|
||||
import net.Indyuce.mmocore.api.quest.ObjectiveProgress;
|
||||
import net.Indyuce.mmocore.api.quest.QuestProgress;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -7,9 +10,6 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.CustomBlockMineEvent;
|
||||
import net.Indyuce.mmocore.api.quest.ObjectiveProgress;
|
||||
import net.Indyuce.mmocore.api.quest.QuestProgress;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
public class MineBlockObjective extends Objective {
|
||||
|
@ -30,7 +30,7 @@ public abstract class Objective {
|
||||
|
||||
for (String key : config.getStringList("triggers"))
|
||||
try {
|
||||
triggers.add(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(key)));
|
||||
triggers.addAll(MMOCore.plugin.loadManager.loadTrigger(new MMOLineConfig(key)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING,
|
||||
"Could not load trigger '" + key + "' from objective '" + id + "': " + exception.getMessage());
|
||||
|
@ -1,12 +1,11 @@
|
||||
package net.Indyuce.mmocore.api.quest.trigger;
|
||||
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.experience.SimpleExperienceObject;
|
||||
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
|
||||
import net.Indyuce.mmocore.experience.dispenser.ProfessionExperienceDispenser;
|
||||
import net.Indyuce.mmocore.experience.dispenser.SimpleExperienceDispenser;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.RandomAmount;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
@ -28,9 +27,9 @@ public class ExperienceTrigger extends Trigger {
|
||||
if (config.contains("profession")) {
|
||||
String id = config.getString("profession").toLowerCase().replace("_", "-");
|
||||
Validate.isTrue(MMOCore.plugin.professionManager.has(id), "Could not find profession");
|
||||
dispenser = new ProfessionExperienceDispenser(MMOCore.plugin.professionManager.get(id));
|
||||
dispenser = MMOCore.plugin.professionManager.get(id);
|
||||
} else
|
||||
dispenser = new SimpleExperienceDispenser();
|
||||
dispenser = new SimpleExperienceObject();
|
||||
amount = new RandomAmount(config.getString("amount"));
|
||||
source = config.contains("source") ? EXPSource.valueOf(config.getString("source").toUpperCase()) : EXPSource.QUEST;
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.Indyuce.mmocore.api.util;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.hologram.Hologram;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import io.lumine.mythic.utils.holograms.Hologram;
|
||||
import io.lumine.mythic.utils.serialize.Position;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -104,8 +105,7 @@ public class MMOCoreUtils {
|
||||
* @param message Message to display
|
||||
*/
|
||||
public static void displayIndicator(Location loc, String message) {
|
||||
Hologram holo = Hologram.create(Position.of(loc), Arrays.asList(message));
|
||||
holo.spawn();
|
||||
Hologram holo = Hologram.create(loc, Arrays.asList(message));
|
||||
Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> holo.despawn(), 20);
|
||||
}
|
||||
|
||||
@ -180,6 +180,27 @@ public class MMOCoreUtils {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
public static Collection<String> jsonArrayToList(String json) {
|
||||
return new ArrayList<>(Arrays.asList(MythicLib.plugin.getJson().parse(json, String[].class)));
|
||||
}
|
||||
|
||||
public static String arrayToJsonString(Collection<String> array) {
|
||||
JsonArray object = new JsonArray();
|
||||
for (String str : array) {
|
||||
object.add(str);
|
||||
}
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
public static String entrySetToJsonString(Set<Map.Entry<String, Integer>> entrySet) {
|
||||
JsonObject object = new JsonObject();
|
||||
for (Map.Entry<String, Integer> entry : entrySet) {
|
||||
object.addProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get all entities surrounding a location. This method does not
|
||||
* take every entity in the world but rather takes all the entities from the
|
||||
@ -236,7 +257,7 @@ public class MMOCoreUtils {
|
||||
*/
|
||||
public static void decreaseDurability(Player player, EquipmentSlot slot, int damage) {
|
||||
ItemStack item = player.getInventory().getItem(slot);
|
||||
if (!item.hasItemMeta() || !(item.getItemMeta() instanceof Damageable) || item.getItemMeta().isUnbreakable())
|
||||
if (item == null || item.getType().getMaxDurability() == 0 || !item.hasItemMeta() || !(item.getItemMeta() instanceof Damageable) || item.getItemMeta().isUnbreakable())
|
||||
return;
|
||||
|
||||
PlayerItemDamageEvent event = new PlayerItemDamageEvent(player, item, damage);
|
||||
|
@ -1,32 +1,32 @@
|
||||
package net.Indyuce.mmocore.api.util.debug;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
public class ActionBarRunnable extends BukkitRunnable {
|
||||
|
||||
/*
|
||||
* how to enable it: set 'debug' to true in the config and use the
|
||||
* 'debug-action-bar' string parameter. hot changes, only need /mmocore
|
||||
* reload.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getOnlinePlayers().forEach(this::sendActionBar);
|
||||
}
|
||||
|
||||
private void sendActionBar(Player player) {
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(player, getMessage())));
|
||||
}
|
||||
|
||||
private String getMessage() {
|
||||
String str = MMOCore.plugin.getConfig().getString("debug-action-bar.format");
|
||||
return str == null ? "" : str;
|
||||
}
|
||||
}
|
||||
package net.Indyuce.mmocore.api.util.debug;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
public class ActionBarRunnable extends BukkitRunnable {
|
||||
|
||||
/*
|
||||
* how to enable it: set 'debug' to true in the config and use the
|
||||
* 'debug-action-bar' string parameter. hot changes, only need /mmocore
|
||||
* reload.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getOnlinePlayers().forEach(this::sendActionBar);
|
||||
}
|
||||
|
||||
private void sendActionBar(Player player) {
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(player, getMessage())));
|
||||
}
|
||||
|
||||
private String getMessage() {
|
||||
String str = MMOCore.plugin.getConfig().getString("debug-action-bar.format");
|
||||
return str == null ? "" : str;
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
package net.Indyuce.mmocore.api.util.debug;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
|
||||
public class DebugMode {
|
||||
/*
|
||||
* Debug Levels:
|
||||
* 1:
|
||||
* - Print WorldGuard Flag Registry
|
||||
* 2:
|
||||
* - Print Profession Trigger Things
|
||||
* 3:
|
||||
* - Debug Action Bar
|
||||
*/
|
||||
public static int level = 0;
|
||||
|
||||
public static void setLevel(int i) {
|
||||
level = i;
|
||||
}
|
||||
|
||||
public static void enableActionBar() {
|
||||
if (level > 2 && MMOCore.plugin.getConfig().getBoolean("debug-action-bar.enabled"))
|
||||
new ActionBarRunnable().runTaskTimer(MMOCore.plugin, 0, 10);
|
||||
}
|
||||
}
|
||||
package net.Indyuce.mmocore.api.util.debug;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
|
||||
public class DebugMode {
|
||||
/*
|
||||
* Debug Levels:
|
||||
* 1:
|
||||
* - Print WorldGuard Flag Registry
|
||||
* 2:
|
||||
* - Print Profession Trigger Things
|
||||
* 3:
|
||||
* - Debug Action Bar
|
||||
*/
|
||||
public static int level = 0;
|
||||
|
||||
public static void setLevel(int i) {
|
||||
level = i;
|
||||
}
|
||||
|
||||
public static void enableActionBar() {
|
||||
if (level > 2 && MMOCore.plugin.getConfig().getBoolean("debug-action-bar.enabled"))
|
||||
new ActionBarRunnable().runTaskTimer(MMOCore.plugin, 0, 10);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.api.util.input;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -11,7 +12,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.util.Consumer;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
|
||||
public class AnvilGUI extends PlayerInput {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.api.util.input;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -8,8 +9,6 @@ import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.util.Consumer;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
|
||||
public class ChatInput extends PlayerInput {
|
||||
public ChatInput(Player player, InputType type, Consumer<String> output) {
|
||||
super(player, output);
|
||||
|
@ -1,12 +1,11 @@
|
||||
package net.Indyuce.mmocore.api.util.input;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.util.Consumer;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
|
||||
public abstract class PlayerInput implements Listener {
|
||||
private final Player player;
|
||||
private final Consumer<String> output;
|
||||
|
@ -110,4 +110,16 @@ public class LinearValue {
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LinearValue{" +
|
||||
"base=" + base +
|
||||
", perLevel=" + perLevel +
|
||||
", min=" + min +
|
||||
", max=" + max +
|
||||
", hasmin=" + hasmin +
|
||||
", hasmax=" + hasmax +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmocore.command;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -7,9 +9,7 @@ import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
|
||||
public class AttributesCommand extends BukkitCommand {
|
||||
public AttributesCommand(ConfigurationSection config) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmocore.command;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -7,9 +9,7 @@ import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
|
||||
public class ClassCommand extends BukkitCommand {
|
||||
public ClassCommand(ConfigurationSection config) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.command;
|
||||
|
||||
import net.Indyuce.mmocore.gui.eco.DepositMenu;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -7,8 +8,6 @@ import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.gui.eco.DepositMenu;
|
||||
|
||||
public class DepositCommand extends BukkitCommand {
|
||||
public DepositCommand(ConfigurationSection config) {
|
||||
super(config.getString("main"));
|
||||
|
@ -2,11 +2,11 @@ package net.Indyuce.mmocore.command;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import net.Indyuce.mmocore.api.player.OfflinePlayerData;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.social.FriendRequest;
|
||||
import net.Indyuce.mmocore.api.player.social.Request;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -2,6 +2,9 @@ package net.Indyuce.mmocore.command;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -10,12 +13,9 @@ import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.social.Request;
|
||||
import net.Indyuce.mmocore.guild.provided.GuildInvite;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
|
||||
public class GuildCommand extends BukkitCommand {
|
||||
|
||||
|
@ -33,6 +33,5 @@ public class MMOCoreCommandTreeRoot extends CommandTreeRoot implements CommandEx
|
||||
addChild(new BoosterCommandTreeNode(this));
|
||||
addChild(new WaypointsCommandTreeNode(this));
|
||||
addChild(new QuestCommandTreeNode(this));
|
||||
addChild(new WaypointsCommandTreeNode(this));
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,9 @@ package net.Indyuce.mmocore.command;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import net.Indyuce.mmocore.party.provided.MMOCorePartyModule;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -11,12 +14,9 @@ import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.party.provided.PartyInvite;
|
||||
import net.Indyuce.mmocore.api.player.social.Request;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
|
||||
public class PartyCommand extends BukkitCommand {
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmocore.command;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -7,9 +9,7 @@ import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
|
||||
public class PlayerStatsCommand extends BukkitCommand {
|
||||
public PlayerStatsCommand(ConfigurationSection config) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.Indyuce.mmocore.command;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
|
||||
public class QuestsCommand extends BukkitCommand {
|
||||
public QuestsCommand(ConfigurationSection config) {
|
||||
|
@ -1,15 +1,15 @@
|
||||
package net.Indyuce.mmocore.command;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
|
||||
public class SkillsCommand extends BukkitCommand {
|
||||
public SkillsCommand(ConfigurationSection config) {
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.Indyuce.mmocore.command;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.command;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -9,7 +10,6 @@ import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.eco.Withdraw;
|
||||
|
||||
public class WithdrawCommand extends BukkitCommand {
|
||||
|
@ -1,10 +1,9 @@
|
||||
package net.Indyuce.mmocore.command.rpg;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
|
||||
public class ReloadCommandTreeNode extends CommandTreeNode {
|
||||
|
@ -15,6 +15,7 @@ public class AdminCommandTreeNode extends CommandTreeNode {
|
||||
addChild(new InfoCommandTreeNode(this));
|
||||
addChild(new ClassCommandTreeNode(this));
|
||||
addChild(new ForceClassCommandTreeNode(this));
|
||||
addChild(new TransferDataTreeNode(this));
|
||||
|
||||
addChild(new ExperienceCommandTreeNode(this));
|
||||
addChild(new LevelCommandTreeNode(this));
|
||||
|
@ -1,15 +1,15 @@
|
||||
package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes;
|
||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
|
||||
@ -61,7 +61,7 @@ public class AttributeCommandTreeNode extends CommandTreeNode {
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
AttributeInstance instance = PlayerData.get(player).getAttributes().getInstance(attribute);
|
||||
PlayerAttributes.AttributeInstance instance = PlayerData.get(player).getAttributes().getInstance(attribute);
|
||||
instance.setBase(Math.min(attribute.getMax(), instance.getBase() + c * amount));
|
||||
CommandVerbose.verbose(sender, CommandVerbose.CommandType.ATTRIBUTE, ChatColor.GOLD + player.getName() + ChatColor.YELLOW
|
||||
+ " now has " + ChatColor.GOLD + instance.getBase() + ChatColor.YELLOW + " " + attribute.getName() + ".");
|
||||
|
@ -1,15 +1,15 @@
|
||||
package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.PlayerChangeClassEvent;
|
||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.PlayerChangeClassEvent;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||
import net.Indyuce.mmocore.api.player.profess.SavedClassInformation;
|
||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
|
@ -1,12 +1,13 @@
|
||||
package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
||||
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import org.apache.commons.lang.Validate;
|
||||
@ -23,9 +24,9 @@ public class ExperienceCommandTreeNode extends CommandTreeNode {
|
||||
|
||||
addChild(new ActionCommandTreeNode(this, "set", PlayerData::setExperience, PlayerProfessions::setExperience));
|
||||
addChild(new ActionCommandTreeNode(this, "give", (data, value) -> data.giveExperience(value, EXPSource.COMMAND), (professions, profession,
|
||||
value) -> professions.giveExperience(profession, value, EXPSource.COMMAND, professions.getPlayerData().getPlayer().getLocation())));
|
||||
value) -> professions.giveExperience(profession, value, EXPSource.COMMAND)));
|
||||
addChild(new ActionCommandTreeNode(this, "take", (data, value) -> data.giveExperience(-value, EXPSource.COMMAND), (professions, profession,
|
||||
value) -> professions.giveExperience(profession, -value, EXPSource.COMMAND, professions.getPlayerData().getPlayer().getLocation())));
|
||||
value) -> professions.giveExperience(profession, -value, EXPSource.COMMAND)));
|
||||
}
|
||||
|
||||
public static class ActionCommandTreeNode extends CommandTreeNode {
|
||||
@ -58,8 +59,8 @@ public class ExperienceCommandTreeNode extends CommandTreeNode {
|
||||
int amount;
|
||||
try {
|
||||
amount = Integer.parseInt(args[5]);
|
||||
Validate.isTrue(amount > 0);
|
||||
} catch (NumberFormatException exception) {
|
||||
Validate.isTrue(amount >= 0);
|
||||
} catch (RuntimeException exception) {
|
||||
sender.sendMessage(ChatColor.RED + args[5] + " is not a valid number.");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
@ -68,7 +69,7 @@ public class ExperienceCommandTreeNode extends CommandTreeNode {
|
||||
if (args[4].equalsIgnoreCase("main")) {
|
||||
main.accept(data, amount);
|
||||
CommandVerbose.verbose(sender, CommandVerbose.CommandType.EXPERIENCE, ChatColor.GOLD + player.getName() + ChatColor.YELLOW
|
||||
+ " now has " + ChatColor.GOLD + data.getExperience() + ChatColor.YELLOW + " EXP.");
|
||||
+ " now has " + ChatColor.GOLD + MythicLib.plugin.getMMOConfig().decimal.format(data.getExperience()) + ChatColor.YELLOW + " EXP.");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
@ -33,7 +34,7 @@ public class InfoCommandTreeNode extends CommandTreeNode {
|
||||
sender.sendMessage(ChatColor.YELLOW + "----------------------------------------------------");
|
||||
sender.sendMessage(ChatColor.YELLOW + "Class: " + ChatColor.GOLD + playerData.getProfess().getName());
|
||||
sender.sendMessage(ChatColor.YELLOW + "Level: " + ChatColor.GOLD + playerData.getLevel());
|
||||
sender.sendMessage(ChatColor.YELLOW + "Experience: " + ChatColor.GOLD + playerData.getExperience() + ChatColor.YELLOW + " / " + ChatColor.GOLD
|
||||
sender.sendMessage(ChatColor.YELLOW + "Experience: " + ChatColor.GOLD + MythicLib.plugin.getMMOConfig().decimal.format(playerData.getExperience()) + ChatColor.YELLOW + " / " + ChatColor.GOLD
|
||||
+ playerData.getLevelUpExperience());
|
||||
sender.sendMessage(ChatColor.YELLOW + "Class Points: " + ChatColor.GOLD + playerData.getClassPoints());
|
||||
sender.sendMessage(ChatColor.YELLOW + "Quests: " + ChatColor.GOLD + playerData.getQuestData().getFinishedQuests().size() + ChatColor.YELLOW
|
||||
|
@ -2,14 +2,14 @@ package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes.AttributeInstance;
|
||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
@ -171,7 +171,7 @@ public class ResetCommandTreeNode extends CommandTreeNode {
|
||||
if (args.length > 4 && args[4].equalsIgnoreCase("-reallocate")) {
|
||||
|
||||
int points = 0;
|
||||
for (AttributeInstance ins : data.getAttributes().getInstances()) {
|
||||
for (PlayerAttributes.AttributeInstance ins : data.getAttributes().getInstances()) {
|
||||
points += ins.getBase();
|
||||
ins.setBase(0);
|
||||
}
|
||||
|
@ -2,9 +2,9 @@ package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger;
|
||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -0,0 +1,108 @@
|
||||
package net.Indyuce.mmocore.command.rpg.admin;
|
||||
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.SavingPlayerData;
|
||||
import net.Indyuce.mmocore.guild.provided.Guild;
|
||||
import net.Indyuce.mmocore.manager.data.DataProvider;
|
||||
import net.Indyuce.mmocore.manager.data.mysql.MySQLDataProvider;
|
||||
import net.Indyuce.mmocore.manager.data.yaml.YAMLDataProvider;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* This command allows to transfer data from your actual storage type
|
||||
* to the other one which lets the user switch between storage types.
|
||||
*/
|
||||
public class TransferDataTreeNode extends CommandTreeNode {
|
||||
public TransferDataTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "transferdata");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender commandSender, String[] strings) {
|
||||
|
||||
final List<UUID> playerUUIDs = new ArrayList<>();
|
||||
if (MMOCore.plugin.dataProvider instanceof YAMLDataProvider) {
|
||||
File folder = new File(MMOCore.plugin.getDataFolder() + "/userdata");
|
||||
playerUUIDs.addAll(Arrays.stream(folder.listFiles())
|
||||
.map(file -> UUID.fromString(file.getName().replace(".yml", "")))
|
||||
.collect(Collectors.toList()));
|
||||
} else {
|
||||
((MySQLDataProvider) MMOCore.plugin.dataProvider).getResult(
|
||||
"SELECT uuid from mmocore_playerdata", (result) -> {
|
||||
try {
|
||||
|
||||
while (result.next()) {
|
||||
playerUUIDs.add(UUID.fromString(result.getString("uuid")));
|
||||
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
List<SavingPlayerData> savingPlayerDataList = new ArrayList<>();
|
||||
for (UUID uuid : playerUUIDs) {
|
||||
MMOCore.plugin.dataProvider.getDataManager().loadSavingPlayerData(uuid, savingPlayerDataList);
|
||||
}
|
||||
|
||||
|
||||
final DataProvider provider;
|
||||
if (MMOCore.plugin.dataProvider instanceof YAMLDataProvider) {
|
||||
provider = new MySQLDataProvider(MMOCore.plugin.getConfig());
|
||||
((MySQLDataProvider) provider).load();
|
||||
} else {
|
||||
provider = new YAMLDataProvider();
|
||||
}
|
||||
|
||||
|
||||
//5 seconds later we put all this data into the other data storage.
|
||||
new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// Save player data
|
||||
for (SavingPlayerData data : savingPlayerDataList)
|
||||
provider.getDataManager().saveData(data);
|
||||
|
||||
// Save guild info
|
||||
for (Guild guild : provider.getGuildManager().getAll())
|
||||
provider.getGuildManager().save(guild);
|
||||
} catch (Exception e) {
|
||||
commandSender.sendMessage("Couldn't transfer properly the data.");
|
||||
e.printStackTrace();
|
||||
if (provider != null && provider instanceof MySQLDataProvider) {
|
||||
((MySQLDataProvider) provider).close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(MMOCore.plugin, 100L);
|
||||
|
||||
|
||||
//We close the connection 10 s later to avoid memory leaks.
|
||||
new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (provider != null && provider instanceof MySQLDataProvider) {
|
||||
((MySQLDataProvider) provider).close();
|
||||
}
|
||||
}
|
||||
}.runTaskLater(MMOCore.plugin, 200);
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
@ -2,12 +2,12 @@ package net.Indyuce.mmocore.command.rpg.booster;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.ConfigMessage;
|
||||
import net.Indyuce.mmocore.experience.Booster;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.Indyuce.mmocore.command.rpg.booster;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.Booster;
|
||||
import net.Indyuce.mmocore.api.util.math.format.DelayFormat;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
|
@ -3,10 +3,10 @@ package net.Indyuce.mmocore.command.rpg.booster;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.experience.Booster;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.Indyuce.mmocore.command.rpg.debug;
|
||||
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.stat.StatInstance;
|
||||
import io.lumine.mythic.lib.api.stat.modifier.StatModifier;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -15,10 +15,7 @@ public class StatModifiersCommandTreeNode extends CommandTreeNode {
|
||||
public StatModifiersCommandTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "statmods");
|
||||
|
||||
addParameter(new Parameter("<stat>", (explorer, list) -> {
|
||||
for (StatType stat : StatType.values())
|
||||
list.add(stat.name());
|
||||
}));
|
||||
addParameter(new Parameter("<stat>", (explorer, list) -> list.add("STAT_ID")));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -32,15 +29,7 @@ public class StatModifiersCommandTreeNode extends CommandTreeNode {
|
||||
}
|
||||
PlayerData data = PlayerData.get((Player) sender);
|
||||
|
||||
StatType stat;
|
||||
try {
|
||||
stat = StatType.valueOf(args[2].toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find stat: " + args[2] + ".");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
StatInstance instance = data.getStats().getInstance(stat);
|
||||
StatInstance instance = data.getStats().getInstance(UtilityMethods.enumName(args[2]));
|
||||
sender.sendMessage("Stat Modifiers (" + instance.getKeys().size() + "):");
|
||||
for (String key : instance.getKeys()) {
|
||||
StatModifier mod = instance.getModifier(key);
|
||||
|
@ -1,51 +1,36 @@
|
||||
package net.Indyuce.mmocore.command.rpg.debug;
|
||||
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.player.stats.StatInfo;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
|
||||
public class StatValueCommandTreeNode extends CommandTreeNode {
|
||||
public StatValueCommandTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "statvalue");
|
||||
public StatValueCommandTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "statvalue");
|
||||
|
||||
addParameter(new Parameter("<stat>", (explorer, list) -> {
|
||||
for (StatType stat : StatType.values())
|
||||
list.add(stat.name());
|
||||
}));
|
||||
addParameter(new Parameter("(formatted)", (explorer, list) -> list.add("true")));
|
||||
}
|
||||
addParameter(new Parameter("<stat>", (explorer, list) -> list.add("STAT_ID")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
if (args.length < 3)
|
||||
return CommandResult.THROW_USAGE;
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
if (args.length < 3)
|
||||
return CommandResult.THROW_USAGE;
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(ChatColor.RED + "This command can only be used by a player.");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
PlayerData data = PlayerData.get((Player) sender);
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(ChatColor.RED + "This command can only be used by a player.");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
PlayerData data = PlayerData.get((Player) sender);
|
||||
|
||||
StatType stat;
|
||||
try {
|
||||
stat = StatType.valueOf(args[2].toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find stat: " + args[2] + ".");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
StatInfo stat = StatInfo.valueOf(UtilityMethods.enumName(args[2]));
|
||||
sender.sendMessage(DebugCommandTreeNode.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name + ChatColor.WHITE + "): "
|
||||
+ ChatColor.GREEN + data.getStats().getStat(stat.name));
|
||||
|
||||
if (args.length > 3 && args[3].equals("true"))
|
||||
sender.sendMessage(DebugCommandTreeNode.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): "
|
||||
+ ChatColor.GREEN + stat.format(data.getStats().getStat(stat)) + ChatColor.WHITE + " *");
|
||||
else
|
||||
sender.sendMessage(DebugCommandTreeNode.commandPrefix + "Stat Value (" + ChatColor.BLUE + stat.name() + ChatColor.WHITE + "): "
|
||||
+ ChatColor.GREEN + data.getStats().getStat(stat));
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -1,43 +1,43 @@
|
||||
package net.Indyuce.mmocore.command.rpg.quest;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.quest.PlayerQuests;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
|
||||
public class CancelCommandTreeNode extends CommandTreeNode {
|
||||
public CancelCommandTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "cancel");
|
||||
|
||||
addParameter(Parameter.PLAYER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
if (args.length < 3)
|
||||
return CommandResult.THROW_USAGE;
|
||||
|
||||
Player player = Bukkit.getPlayer(args[2]);
|
||||
if (player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find player called " + args[2] + ".");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
PlayerQuests quests = PlayerData.get(player).getQuestData();
|
||||
if (!quests.hasCurrent()) {
|
||||
if (sender instanceof Player)
|
||||
sender.sendMessage(ChatColor.RED + player.getName() + " has no ongoing quest.");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
quests.start(null);
|
||||
if (sender instanceof Player)
|
||||
sender.sendMessage(ChatColor.YELLOW + player.getName() + " no longer has any ongoing quest.");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
package net.Indyuce.mmocore.command.rpg.quest;
|
||||
|
||||
import net.Indyuce.mmocore.api.quest.PlayerQuests;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
|
||||
public class CancelCommandTreeNode extends CommandTreeNode {
|
||||
public CancelCommandTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "cancel");
|
||||
|
||||
addParameter(Parameter.PLAYER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
if (args.length < 3)
|
||||
return CommandResult.THROW_USAGE;
|
||||
|
||||
Player player = Bukkit.getPlayer(args[2]);
|
||||
if (player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find player called " + args[2] + ".");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
PlayerQuests quests = PlayerData.get(player).getQuestData();
|
||||
if (!quests.hasCurrent()) {
|
||||
if (sender instanceof Player)
|
||||
sender.sendMessage(ChatColor.RED + player.getName() + " has no ongoing quest.");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
quests.start(null);
|
||||
if (sender instanceof Player)
|
||||
sender.sendMessage(ChatColor.YELLOW + player.getName() + " no longer has any ongoing quest.");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package net.Indyuce.mmocore.command.rpg.quest;
|
||||
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.quest.PlayerQuests;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,21 +1,21 @@
|
||||
package net.Indyuce.mmocore.command.rpg.quest;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
|
||||
public class QuestCommandTreeNode extends CommandTreeNode {
|
||||
|
||||
public QuestCommandTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "quest");
|
||||
|
||||
addChild(new StartCommandTreeNode(this));
|
||||
addChild(new CancelCommandTreeNode(this));
|
||||
addChild(new FinishCommandTreeNode(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
return CommandResult.THROW_USAGE;
|
||||
}
|
||||
}
|
||||
package net.Indyuce.mmocore.command.rpg.quest;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
|
||||
public class QuestCommandTreeNode extends CommandTreeNode {
|
||||
|
||||
public QuestCommandTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "quest");
|
||||
|
||||
addChild(new StartCommandTreeNode(this));
|
||||
addChild(new CancelCommandTreeNode(this));
|
||||
addChild(new FinishCommandTreeNode(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
return CommandResult.THROW_USAGE;
|
||||
}
|
||||
}
|
||||
|
@ -1,55 +1,55 @@
|
||||
package net.Indyuce.mmocore.command.rpg.quest;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.quest.PlayerQuests;
|
||||
import net.Indyuce.mmocore.api.quest.Quest;
|
||||
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
|
||||
public class StartCommandTreeNode extends CommandTreeNode {
|
||||
public StartCommandTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "start");
|
||||
|
||||
addParameter(Parameter.PLAYER);
|
||||
addParameter(MMOCoreCommandTreeRoot.QUEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
if (args.length < 4)
|
||||
return CommandResult.THROW_USAGE;
|
||||
|
||||
Player player = Bukkit.getPlayer(args[2]);
|
||||
if (player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find player called " + args[2] + ".");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
Quest quest;
|
||||
try {
|
||||
quest = MMOCore.plugin.questManager.get(args[3].replace("_", "-").toLowerCase());
|
||||
} catch (Exception exception) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find quest with ID " + args[3].replace("_", "-").toLowerCase() + ".");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
PlayerQuests quests = PlayerData.get(player).getQuestData();
|
||||
if (quests.hasCurrent()) {
|
||||
if (sender instanceof Player)
|
||||
sender.sendMessage(ChatColor.RED + player.getName() + " already has an ongoing quest.");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
quests.start(quest);
|
||||
if (sender instanceof Player)
|
||||
sender.sendMessage(ChatColor.YELLOW + player.getName() + " successfully started " + quest.getName() + ".");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
package net.Indyuce.mmocore.command.rpg.quest;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.quest.PlayerQuests;
|
||||
import net.Indyuce.mmocore.api.quest.Quest;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
|
||||
public class StartCommandTreeNode extends CommandTreeNode {
|
||||
public StartCommandTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "start");
|
||||
|
||||
addParameter(Parameter.PLAYER);
|
||||
addParameter(MMOCoreCommandTreeRoot.QUEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
if (args.length < 4)
|
||||
return CommandResult.THROW_USAGE;
|
||||
|
||||
Player player = Bukkit.getPlayer(args[2]);
|
||||
if (player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find player called " + args[2] + ".");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
Quest quest;
|
||||
try {
|
||||
quest = MMOCore.plugin.questManager.get(args[3].replace("_", "-").toLowerCase());
|
||||
} catch (Exception exception) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find quest with ID " + args[3].replace("_", "-").toLowerCase() + ".");
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
PlayerQuests quests = PlayerData.get(player).getQuestData();
|
||||
if (quests.hasCurrent()) {
|
||||
if (sender instanceof Player)
|
||||
sender.sendMessage(ChatColor.RED + player.getName() + " already has an ongoing quest.");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
|
||||
quests.start(quest);
|
||||
if (sender instanceof Player)
|
||||
sender.sendMessage(ChatColor.YELLOW + player.getName() + " successfully started " + quest.getName() + ".");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package net.Indyuce.mmocore.command.rpg.waypoint;
|
||||
|
||||
import io.lumine.mythic.lib.api.util.SmartGive;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.waypoint.Waypoint;
|
||||
import net.Indyuce.mmocore.util.item.WaypointBookBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ItemCommandTreeNode extends CommandTreeNode {
|
||||
public ItemCommandTreeNode(CommandTreeNode parent) {
|
||||
super(parent, "item");
|
||||
|
||||
addParameter(new Parameter("<waypoint>", (explorer, list) -> MMOCore.plugin.waypointManager.getAll().forEach(way -> list.add(way.getId()))));
|
||||
addParameter(Parameter.PLAYER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandResult execute(CommandSender sender, String[] args) {
|
||||
if (args.length < 4)
|
||||
return CommandResult.THROW_USAGE;
|
||||
|
||||
if (!MMOCore.plugin.waypointManager.has(args[2])) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find waypoint " + args[2]);
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
Player player = Bukkit.getPlayer(args[3]);
|
||||
if (player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Could not find player " + args[3]);
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
Waypoint waypoint = MMOCore.plugin.waypointManager.get(args[2]);
|
||||
new SmartGive(player).give(new WaypointBookBuilder(waypoint).build());
|
||||
sender.sendMessage(ChatColor.GOLD + "Gave " + player.getName() + ChatColor.YELLOW + " a waypoint book of " + ChatColor.GOLD + waypoint.getId()
|
||||
+ ChatColor.YELLOW + ".");
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.command.rpg.waypoint;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -27,7 +28,7 @@ public class OpenCommandTreeNode extends CommandTreeNode {
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
InventoryManager.WAYPOINTS.newInventory(net.Indyuce.mmocore.api.player.PlayerData.get(player)).open();
|
||||
InventoryManager.WAYPOINTS.newInventory(PlayerData.get(player)).open();
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.Indyuce.mmocore.command.rpg.waypoint;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.waypoint.Waypoint;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.waypoint.Waypoint;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
|
@ -11,6 +11,7 @@ public class WaypointsCommandTreeNode extends CommandTreeNode {
|
||||
addChild(new UnlockCommandTreeNode(this));
|
||||
addChild(new OpenCommandTreeNode(this));
|
||||
addChild(new TeleportCommandTreeNode(this));
|
||||
addChild(new ItemCommandTreeNode(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,28 +0,0 @@
|
||||
package net.Indyuce.mmocore.comp;
|
||||
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.comp.target.TargetRestriction;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.party.AbstractParty;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class MMOCoreTargetRestriction implements TargetRestriction {
|
||||
|
||||
@Override
|
||||
public boolean canTarget(Player player, LivingEntity target, InteractionType interaction) {
|
||||
|
||||
if (interaction.isOffense() && target instanceof Player && PlayerData.has(target.getUniqueId())) {
|
||||
PlayerData targetData = PlayerData.get(target.getUniqueId());
|
||||
|
||||
// Check for the same party
|
||||
AbstractParty party = targetData.getParty();
|
||||
if (party != null && party.hasMember(player))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -4,11 +4,11 @@ import io.lumine.mythic.bukkit.MythicBukkit;
|
||||
import io.lumine.mythic.bukkit.events.MythicDropLoadEvent;
|
||||
import io.lumine.mythic.bukkit.events.MythicReloadedEvent;
|
||||
import io.lumine.mythic.core.skills.placeholders.Placeholder;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.load.CurrencyItemDrop;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.load.CurrencyItemDrop;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.load.GoldPouchDrop;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -1,22 +1,25 @@
|
||||
package net.Indyuce.mmocore.comp.mythicmobs;
|
||||
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.load.*;
|
||||
import net.Indyuce.mmocore.api.load.MMOLoader;
|
||||
import net.Indyuce.mmocore.api.quest.objective.Objective;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.load.*;
|
||||
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
|
||||
import net.Indyuce.mmocore.experience.source.type.ExperienceSource;
|
||||
import net.Indyuce.mmocore.loot.droptable.dropitem.DropItem;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MythicMobsMMOLoader extends MMOLoader {
|
||||
|
||||
@Override
|
||||
public Trigger loadTrigger(MMOLineConfig config) {
|
||||
public List<Trigger> loadTrigger(MMOLineConfig config) {
|
||||
|
||||
if (config.getKey().equalsIgnoreCase("mmskill") || config.getKey().equalsIgnoreCase("mythicmobskill"))
|
||||
return new MythicSkillTrigger(config);
|
||||
return Arrays.asList(new MythicSkillTrigger(config));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -42,12 +45,12 @@ public class MythicMobsMMOLoader extends MMOLoader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExperienceSource<?> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) {
|
||||
public List<ExperienceSource<?>> loadExperienceSource(MMOLineConfig config, ExperienceDispenser dispenser) {
|
||||
|
||||
if (config.getKey().equalsIgnoreCase("killmythicmob"))
|
||||
return new KillMythicMobExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new KillMythicMobExperienceSource(dispenser, config));
|
||||
if (config.getKey().equalsIgnoreCase("killmythicfaction"))
|
||||
return new KillMythicFactionExperienceSource(dispenser, config);
|
||||
return Arrays.asList(new KillMythicFactionExperienceSource(dispenser, config));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -1,17 +1,16 @@
|
||||
package net.Indyuce.mmocore.comp.mythicmobs.load;
|
||||
|
||||
import io.lumine.mythic.api.adapters.AbstractItemStack;
|
||||
import io.lumine.mythic.api.config.MythicLineConfig;
|
||||
import io.lumine.mythic.api.drops.DropMetadata;
|
||||
import io.lumine.mythic.api.drops.IMultiDrop;
|
||||
import io.lumine.mythic.api.drops.IItemDrop;
|
||||
import io.lumine.mythic.bukkit.adapters.BukkitItemStack;
|
||||
import io.lumine.mythic.core.drops.Drop;
|
||||
import io.lumine.mythic.core.drops.LootBag;
|
||||
import io.lumine.mythic.core.drops.droppables.ItemDrop;
|
||||
import net.Indyuce.mmocore.util.item.CurrencyItemBuilder;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class CurrencyItemDrop extends Drop implements IMultiDrop {
|
||||
public class CurrencyItemDrop extends Drop implements IItemDrop {
|
||||
private final String key;
|
||||
private final int minw;
|
||||
private final int maxw;
|
||||
@ -26,12 +25,9 @@ public class CurrencyItemDrop extends Drop implements IMultiDrop {
|
||||
maxw = config.getInteger("maxw", 1);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public LootBag get(DropMetadata metadata) {
|
||||
LootBag loot = new LootBag(metadata);
|
||||
loot.add(new ItemDrop(this.getLine(), this.getConfig(), new BukkitItemStack(new CurrencyItemBuilder(key, random(minw, maxw)).build())));
|
||||
return loot;
|
||||
public AbstractItemStack getDrop(DropMetadata dropMetadata, double v) {
|
||||
return new BukkitItemStack(new CurrencyItemBuilder(key, random(minw, maxw)).build());
|
||||
}
|
||||
|
||||
private int random(int a, int b) {
|
||||
|
@ -1,12 +1,11 @@
|
||||
package net.Indyuce.mmocore.comp.mythicmobs.load;
|
||||
|
||||
import io.lumine.mythic.api.adapters.AbstractItemStack;
|
||||
import io.lumine.mythic.api.config.MythicLineConfig;
|
||||
import io.lumine.mythic.api.drops.DropMetadata;
|
||||
import io.lumine.mythic.api.drops.IMultiDrop;
|
||||
import io.lumine.mythic.api.drops.IItemDrop;
|
||||
import io.lumine.mythic.bukkit.adapters.BukkitItemStack;
|
||||
import io.lumine.mythic.core.drops.Drop;
|
||||
import io.lumine.mythic.core.drops.LootBag;
|
||||
import io.lumine.mythic.core.drops.droppables.ItemDrop;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
@ -17,7 +16,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class GoldPouchDrop extends Drop implements IMultiDrop {
|
||||
public class GoldPouchDrop extends Drop implements IItemDrop {
|
||||
private final int min;
|
||||
private final int max;
|
||||
|
||||
@ -30,10 +29,8 @@ public class GoldPouchDrop extends Drop implements IMultiDrop {
|
||||
max = config.getInteger("max", 10);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public LootBag get(DropMetadata metadata) {
|
||||
LootBag loot = new LootBag(metadata);
|
||||
public AbstractItemStack getDrop(DropMetadata dropMetadata, double v) {
|
||||
NBTItem nbt = NBTItem.get(new SimpleItemBuilder("MOB_GOLD_POUCH").build());
|
||||
|
||||
ItemStack[] content = new ItemStack[18];
|
||||
@ -52,8 +49,7 @@ public class GoldPouchDrop extends Drop implements IMultiDrop {
|
||||
}
|
||||
|
||||
nbt.addTag(new ItemTag("RpgPouchSize", 18), new ItemTag("RpgPouchMob", true), new ItemTag("RpgPouchInventory", MMOCoreUtils.toBase64(content)));
|
||||
loot.add(new ItemDrop(this.getLine(), this.getConfig(), new BukkitItemStack(nbt.toItem())));
|
||||
return loot;
|
||||
return new BukkitItemStack(nbt.toItem());
|
||||
}
|
||||
|
||||
private ItemStack setAmount(ItemStack item, int amount) {
|
||||
|
@ -4,6 +4,7 @@ import io.lumine.mythic.bukkit.events.MythicMobDeathEvent;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
|
||||
import net.Indyuce.mmocore.experience.source.type.SpecificExperienceSource;
|
||||
import net.Indyuce.mmocore.manager.profession.ExperienceSourceManager;
|
||||
@ -33,7 +34,7 @@ public class KillMythicMobExperienceSource extends SpecificExperienceSource<Stri
|
||||
PlayerData data = PlayerData.get((Player) event.getKiller());
|
||||
for (KillMythicMobExperienceSource source : getSources())
|
||||
if (source.matches(data, event.getMobType().getInternalName()))
|
||||
source.giveExperience(data, 1, event.getEntity().getLocation());
|
||||
source.giveExperience(data, 1, MMOCoreUtils.getCenterLocation(event.getEntity()));
|
||||
}, 2);
|
||||
}
|
||||
};
|
||||
|
@ -5,7 +5,6 @@ import io.lumine.mythic.api.mobs.GenericCaster;
|
||||
import io.lumine.mythic.api.skills.Skill;
|
||||
import io.lumine.mythic.api.skills.SkillCaster;
|
||||
import io.lumine.mythic.api.skills.SkillMetadata;
|
||||
import io.lumine.mythic.api.skills.SkillTrigger;
|
||||
import io.lumine.mythic.bukkit.BukkitAdapter;
|
||||
import io.lumine.mythic.bukkit.MythicBukkit;
|
||||
import io.lumine.mythic.core.skills.SkillMetadataImpl;
|
||||
@ -15,7 +14,6 @@ import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -4,9 +4,9 @@ import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||
import net.Indyuce.mmocore.api.quest.PlayerQuests;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.player.stats.StatInfo;
|
||||
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
||||
import net.Indyuce.mmocore.experience.Profession;
|
||||
import net.Indyuce.mmocore.party.AbstractParty;
|
||||
@ -72,11 +72,11 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
}
|
||||
|
||||
else if (identifier.equals("health") && player.isOnline()) {
|
||||
return StatType.MAX_HEALTH.format(player.getPlayer().getHealth());
|
||||
return StatInfo.valueOf("MAX_HEALTH").format(player.getPlayer().getHealth());
|
||||
}
|
||||
|
||||
else if (identifier.equals("max_health") && player.isOnline()) {
|
||||
return StatType.MAX_HEALTH.format(player.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||
return StatInfo.valueOf("MAX_HEALTH").format(player.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||
}
|
||||
|
||||
else if (identifier.equals("health_bar") && player.isOnline()) {
|
||||
@ -128,7 +128,7 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
.valueOf(playerData.getCollectionSkills().getLevel(identifier.substring(11).replace(" ", "-").replace("_", "-").toLowerCase()));
|
||||
|
||||
else if (identifier.equals("experience"))
|
||||
return String.valueOf(playerData.getExperience());
|
||||
return MythicLib.plugin.getMMOConfig().decimal.format(playerData.getExperience());
|
||||
|
||||
else if (identifier.equals("next_level"))
|
||||
return String.valueOf(playerData.getLevelUpExperience());
|
||||
@ -153,7 +153,7 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
return MythicLib.plugin.getMMOConfig().decimal.format(playerData.getMana());
|
||||
|
||||
else if (identifier.equals("mana_bar")) {
|
||||
return playerData.getProfess().getManaDisplay().generateBar(playerData.getMana(), playerData.getStats().getStat(StatType.MAX_MANA));
|
||||
return playerData.getProfess().getManaDisplay().generateBar(playerData.getMana(), playerData.getStats().getStat("MAX_MANA"));
|
||||
}
|
||||
|
||||
else if (identifier.startsWith("exp_multiplier_")) {
|
||||
@ -173,7 +173,7 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
|
||||
else if (identifier.equals("stamina_bar")) {
|
||||
StringBuilder format = new StringBuilder();
|
||||
double ratio = 20 * playerData.getStamina() / playerData.getStats().getStat(StatType.MAX_STAMINA);
|
||||
double ratio = 20 * playerData.getStamina() / playerData.getStats().getStat("MAX_STAMINA");
|
||||
for (double j = 1; j < 20; j++)
|
||||
format.append(ratio >= j ? MMOCore.plugin.configManager.staminaFull
|
||||
: ratio >= j - .5 ? MMOCore.plugin.configManager.staminaHalf : MMOCore.plugin.configManager.staminaEmpty)
|
||||
@ -182,8 +182,8 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
}
|
||||
|
||||
else if (identifier.startsWith("stat_")) {
|
||||
StatType type = StatType.valueOf(identifier.substring(5).toUpperCase());
|
||||
return type == null ? "Invalid Stat" : type.format(playerData.getStats().getStat(type));
|
||||
StatInfo info = StatInfo.valueOf(identifier.substring(5).toUpperCase());
|
||||
return info.format(playerData.getStats().getStat(info.name));
|
||||
}
|
||||
|
||||
else if (identifier.equals("stellium"))
|
||||
@ -191,7 +191,7 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
|
||||
else if (identifier.equals("stellium_bar")) {
|
||||
StringBuilder format = new StringBuilder();
|
||||
double ratio = 20 * playerData.getStellium() / playerData.getStats().getStat(StatType.MAX_STELLIUM);
|
||||
double ratio = 20 * playerData.getStellium() / playerData.getStats().getStat("MAX_STELLIUM");
|
||||
for (double j = 1; j < 20; j++)
|
||||
format.append(ratio >= j ? ChatColor.BLUE : ratio >= j - .5 ? ChatColor.AQUA : ChatColor.WHITE).append(AltChar.listSquare);
|
||||
return format.toString();
|
||||
@ -226,9 +226,9 @@ public class RPGPlaceholders extends PlaceholderExpansion {
|
||||
else if (placeholder.equalsIgnoreCase("leader"))
|
||||
return Bukkit.getOfflinePlayer(playerData.getGuild().getOwner()).getName();
|
||||
else if (placeholder.equalsIgnoreCase("members"))
|
||||
return "" + playerData.getGuild().getMembers().count();
|
||||
return String.valueOf(playerData.getGuild().countMembers());
|
||||
else if (placeholder.equalsIgnoreCase("online_members"))
|
||||
return "" + playerData.getGuild().getMembers().countOnline();
|
||||
return String.valueOf(playerData.getGuild().countOnlineMembers());
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -4,13 +4,16 @@ import net.Indyuce.mmocore.loot.chest.condition.Condition;
|
||||
import net.Indyuce.mmocore.api.load.MMOLoader;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class WorldGuardMMOLoader extends MMOLoader {
|
||||
|
||||
@Override
|
||||
public Condition loadCondition(MMOLineConfig config) {
|
||||
public List<Condition> loadCondition(MMOLineConfig config) {
|
||||
|
||||
if (config.getKey().equals("region"))
|
||||
return new RegionCondition(config);
|
||||
return Arrays.asList(new RegionCondition(config));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package net.Indyuce.mmocore.comp.vault;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.RandomAmount;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
|
@ -2,9 +2,9 @@ package net.Indyuce.mmocore.comp.vault;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
public class VaultEconomy {
|
||||
|
@ -1,16 +1,19 @@
|
||||
package net.Indyuce.mmocore.comp.vault;
|
||||
|
||||
import net.Indyuce.mmocore.api.load.MMOLoader;
|
||||
import net.Indyuce.mmocore.api.quest.trigger.Trigger;
|
||||
import net.Indyuce.mmocore.api.load.MMOLoader;
|
||||
import io.lumine.mythic.lib.api.MMOLineConfig;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class VaultMMOLoader extends MMOLoader {
|
||||
|
||||
@Override
|
||||
public Trigger loadTrigger(MMOLineConfig config) {
|
||||
public List<Trigger> loadTrigger(MMOLineConfig config) {
|
||||
|
||||
if (config.getKey().equalsIgnoreCase("money"))
|
||||
return new MoneyTrigger(config);
|
||||
return Arrays.asList(new MoneyTrigger(config));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.Indyuce.mmocore.experience;
|
||||
|
||||
import net.Indyuce.mmocore.manager.social.BoosterManager;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -14,7 +16,7 @@ public class Booster {
|
||||
* Length is not final because boosters can stacks. This allows to reduce
|
||||
* the amount of boosters displayed in the main player menu
|
||||
*
|
||||
* See {@link net.Indyuce.mmocore.manager.social.BoosterManager#register(Booster)}
|
||||
* See {@link BoosterManager#register(Booster)}
|
||||
*/
|
||||
private long length;
|
||||
|
||||
|
@ -19,7 +19,10 @@ public enum EXPSource {
|
||||
|
||||
/**
|
||||
* When party members share exp
|
||||
*
|
||||
* @deprecated Not used anymore
|
||||
*/
|
||||
@Deprecated
|
||||
PARTY_SHARING,
|
||||
|
||||
/**
|
||||
|
@ -1,16 +1,20 @@
|
||||
package net.Indyuce.mmocore.experience;
|
||||
|
||||
import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
||||
import net.Indyuce.mmocore.experience.dispenser.ExperienceDispenser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Either a profession or a class
|
||||
* General implementation for professions, classes and attributes.
|
||||
* <p>
|
||||
* An experience object is a type of object that can level up.
|
||||
* It has an experience curve and table and can receive EXP
|
||||
*
|
||||
* @author jules
|
||||
*/
|
||||
public interface ExperienceObject {
|
||||
public interface ExperienceObject extends ExperienceDispenser {
|
||||
|
||||
String getKey();
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user