mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-23 00:05:52 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
6a896fcc32
@ -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>
|
40
bungee-plugin/pom.xml
Normal file
40
bungee-plugin/pom.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<parent>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>bungee-plugin</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.19-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,50 @@
|
||||
package fr.phoenix.mmocore.bungee;
|
||||
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Bungee extends Plugin {
|
||||
public static Bungee plugin;
|
||||
public CacheManager cacheManager = new CacheManager();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
//Register a new communication channel
|
||||
getProxy().registerChannel("give_mmocore_player");
|
||||
getProxy().registerChannel("get_mmocore_player");
|
||||
getProxy().getPluginManager().registerListener(this, new MessageListener());
|
||||
|
||||
|
||||
try {
|
||||
getProxy().getLogger().log(Level.WARNING,"enabling socket");
|
||||
ServerSocket serverSocket= new ServerSocket(25580);
|
||||
Socket clientSocket=serverSocket.accept();
|
||||
getProxy().getLogger().log(Level.WARNING,"port: "+clientSocket.getPort());
|
||||
|
||||
BufferedReader bufferedReader= new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
|
||||
String line;
|
||||
while((line=bufferedReader.readLine())!=null) {
|
||||
getProxy().getLogger().log(Level.WARNING,line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
plugin = this;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package fr.phoenix.mmocore.bungee;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class CacheManager {
|
||||
private final HashMap<UUID,String> cachedPlayers= new HashMap<>();
|
||||
|
||||
|
||||
public String getCachedPlayer(UUID uuid) {
|
||||
return cachedPlayers.get(uuid);
|
||||
}
|
||||
public boolean hasCachedPlayer(UUID uuid) {
|
||||
return cachedPlayers.containsKey(uuid);
|
||||
}
|
||||
|
||||
public void addCachedPlayer(UUID uuid,String playerData) {
|
||||
cachedPlayers.put(uuid,playerData);
|
||||
}
|
||||
|
||||
|
||||
public void save() {
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package fr.phoenix.mmocore.bungee;
|
||||
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.UUID;
|
||||
|
||||
public class MessageListener implements Listener {
|
||||
|
||||
/**
|
||||
* Used to register in the cached Players the data that is sent
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPluginMessage(PluginMessageEvent e) throws IOException {
|
||||
|
||||
//When a server gives the player data
|
||||
if (e.getTag().equals("give_mmocore_player")) {
|
||||
|
||||
byte[] data = e.getData();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(e.getData());
|
||||
DataInputStream inputStream = new DataInputStream(in);
|
||||
|
||||
UUID uuid = UUID.fromString(inputStream.readUTF());
|
||||
String jsonMsg = inputStream.readUTF();
|
||||
|
||||
//We put this data into the CacheManager
|
||||
Bungee.plugin.cacheManager.addCachedPlayer(uuid,jsonMsg);
|
||||
}
|
||||
|
||||
|
||||
//When a server asks for the player data
|
||||
if (e.getTag().equals("get_mmocore_player")) {
|
||||
byte[] data = e.getData();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(e.getData());
|
||||
DataInputStream inputStream = new DataInputStream(in);
|
||||
UUID uuid = UUID.fromString(inputStream.readUTF());
|
||||
|
||||
|
||||
|
||||
String response=Bungee.plugin.cacheManager.hasCachedPlayer(uuid)?
|
||||
Bungee.plugin.cacheManager.getCachedPlayer(uuid):"{}";
|
||||
//We format the data corresponding to the player
|
||||
ByteArrayOutputStream out=new ByteArrayOutputStream();
|
||||
DataOutputStream outputStream= new DataOutputStream(out);
|
||||
outputStream.writeChars(response);
|
||||
|
||||
//We get the corresponding player
|
||||
ProxiedPlayer proxiedPlayer= Bungee.plugin.getProxy().getPlayer(uuid);
|
||||
//We send the answer
|
||||
proxiedPlayer.getServer().getInfo().sendData("get_mmocore_player",out.toByteArray());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
3
bungee-plugin/src/main/resources/bungee.yml
Normal file
3
bungee-plugin/src/main/resources/bungee.yml
Normal file
@ -0,0 +1,3 @@
|
||||
name: MMOCore
|
||||
main: fr.phoenix.mmocore.bungee.Bungee
|
||||
author: PhoenixDevelopment
|
98
dist/pom.xml
vendored
Normal file
98
dist/pom.xml
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<parent>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>dist</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<finalName>MMOCore-${revision}</finalName>
|
||||
<outputDirectory>../target</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- This plugin makes sure that there are no placeholders in the final
|
||||
pom.xml version string because having ${revision} would cause issues when
|
||||
using MythicLib-dist as a dependency
|
||||
|
||||
The flatten plugin must run AFTER the shade plugin, otherwise an issue pops up.
|
||||
To do that, run the flatten plugin on the 'package' phase
|
||||
|
||||
https://stackoverflow.com/questions/52552329/use-maven-flatten-plugin-and-maven-shade-plugin-at-the-same-time
|
||||
-->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>flatten</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>flatten.clean</id>
|
||||
<phase>clean</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>bungee-plugin</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>spigot-plugin</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
252
pom.xml
252
pom.xml
@ -4,11 +4,18 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<version>1.9.3</version>
|
||||
<packaging>pom</packaging>
|
||||
<version>${revision}</version>
|
||||
<modules>
|
||||
<module>bungee-plugin</module>
|
||||
<module>spigot-plugin</module>
|
||||
<module>dist</module>
|
||||
</modules>
|
||||
<name>MMOCore</name>
|
||||
<description>Offer your players a brand new RPG experience!!</description>
|
||||
|
||||
<properties>
|
||||
<revision>1.9.3</revision>
|
||||
<downloadSources>false</downloadSources>
|
||||
<downloadJavadocs>false</downloadJavadocs>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@ -16,255 +23,22 @@
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<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>
|
||||
|
||||
<configuration>
|
||||
<source>9</source>
|
||||
<target>9</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>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<id>auto-clean</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
<url>https://mvn.lumine.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>phoenix</id>
|
||||
<url>http://la-grange-evasion.pro.dns-orange.fr:8081/repository/maven-public/</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>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>
|
||||
|
||||
</repositories>
|
||||
|
||||
<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.11.1</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.30-b2571</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>
|
||||
|
||||
<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>org.kingdoms.main</groupId>
|
||||
<artifactId>Kingdoms</artifactId>
|
||||
<version>1.11.15.0.0.0.1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Quest plugins -->
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
255
spigot-plugin/pom.xml
Normal file
255
spigot-plugin/pom.xml
Normal file
@ -0,0 +1,255 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<parent>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>spigot-plugin</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources/</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
|
||||
<!--
|
||||
This fixes the following issue
|
||||
|
||||
https://stackoverflow.com/questions/36248959/bad-service-configuration-file-or-exception-thrown-while-constructing-processor
|
||||
-->
|
||||
<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>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>phoenix</id>
|
||||
<url>http://la-grange-evasion.pro.dns-orange.fr:8081/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
<url>https://mvn.lumine.io/repository/maven-public/</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>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>
|
||||
|
||||
</repositories>
|
||||
|
||||
<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.11.1</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.30-b2571</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>
|
||||
|
||||
<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>org.kingdoms.main</groupId>
|
||||
<artifactId>Kingdoms</artifactId>
|
||||
<version>1.11.15.0.0.0.1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Quest plugins -->
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -5,6 +5,10 @@ import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.comp.Metrics;
|
||||
import io.lumine.mythic.lib.version.SpigotPlugin;
|
||||
import io.lumine.mythic.utils.plugin.LuminePlugin;
|
||||
import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener;
|
||||
import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.MythicHook;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.MythicMobsMMOLoader;
|
||||
import net.Indyuce.mmocore.api.ConfigFile;
|
||||
import net.Indyuce.mmocore.api.PlayerActionBar;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
@ -12,10 +16,6 @@ import net.Indyuce.mmocore.api.player.attribute.AttributeModifier;
|
||||
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||
import net.Indyuce.mmocore.api.util.debug.DebugMode;
|
||||
import net.Indyuce.mmocore.command.*;
|
||||
import net.Indyuce.mmocore.comp.citizens.CitizenInteractEventListener;
|
||||
import net.Indyuce.mmocore.comp.citizens.CitizensMMOLoader;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.MythicHook;
|
||||
import net.Indyuce.mmocore.comp.mythicmobs.MythicMobsMMOLoader;
|
||||
import net.Indyuce.mmocore.comp.placeholder.DefaultParser;
|
||||
import net.Indyuce.mmocore.comp.placeholder.PlaceholderAPIParser;
|
||||
import net.Indyuce.mmocore.comp.placeholder.PlaceholderParser;
|
||||
@ -30,6 +30,7 @@ import net.Indyuce.mmocore.guild.GuildModuleType;
|
||||
import net.Indyuce.mmocore.guild.provided.Guild;
|
||||
import net.Indyuce.mmocore.guild.provided.MMOCoreGuildModule;
|
||||
import net.Indyuce.mmocore.listener.*;
|
||||
import net.Indyuce.mmocore.listener.bungee.GetMMOCorePlayerListener;
|
||||
import net.Indyuce.mmocore.listener.event.PlayerPressKeyListener;
|
||||
import net.Indyuce.mmocore.listener.option.*;
|
||||
import net.Indyuce.mmocore.listener.profession.FishingListener;
|
||||
@ -54,6 +55,7 @@ import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spigotmc.SpigotConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
@ -103,7 +105,7 @@ public class MMOCore extends LuminePlugin {
|
||||
@NotNull
|
||||
public GuildModule guildModule;
|
||||
|
||||
public boolean shouldDebugSQL = false;
|
||||
public boolean shouldDebugSQL, hasBungee;
|
||||
|
||||
private static final int MYTHICLIB_COMPATIBILITY_INDEX = 7;
|
||||
|
||||
@ -124,9 +126,10 @@ public class MMOCore extends LuminePlugin {
|
||||
MythicLib.plugin.getEntities().registerRestriction(new MMOCoreTargetRestriction());
|
||||
MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject));
|
||||
|
||||
// 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());
|
||||
@ -178,21 +181,31 @@ public class MMOCore extends LuminePlugin {
|
||||
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);
|
||||
// Checks if the server runs with Bungee
|
||||
hasBungee = SpigotConfig.bungee & !Bukkit.getServer().getOnlineMode();
|
||||
|
||||
//Setups the channel for Bungee
|
||||
if(hasBungee) {
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this,"namespace:give_mmocore_player");
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this,"namespace:get_mmocore_player");
|
||||
getServer().getMessenger().registerIncomingPluginChannel(this,"namespace:get_mmocore_player",new GetMMOCorePlayerListener());
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
/*
|
||||
* For the sake of the lord, make sure they aren't using MMOItems Mana and
|
||||
@ -218,27 +231,27 @@ public class MMOCore extends LuminePlugin {
|
||||
DebugMode.enableActionBar();
|
||||
}
|
||||
|
||||
// Load quest module
|
||||
try {
|
||||
String pluginName = UtilityMethods.enumName(getConfig().getString("quest-plugin"));
|
||||
PartyModuleType moduleType = PartyModuleType.valueOf(pluginName);
|
||||
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 pluginName = UtilityMethods.enumName(getConfig().getString("party-plugin"));
|
||||
PartyModuleType moduleType = PartyModuleType.valueOf(pluginName);
|
||||
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();
|
||||
}
|
||||
|
||||
// Load guild module
|
||||
try {
|
@ -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,72 +1,72 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
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.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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -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,13 @@
|
||||
package net.Indyuce.mmocore.api.load;
|
||||
|
||||
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.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
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.loot.droptable.dropitem.DropItem;
|
||||
|
||||
import net.Indyuce.mmocore.loot.droptable.dropitem.DropTableDropItem;
|
@ -2,12 +2,12 @@ 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;
|
||||
|
||||
/**
|
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.api.player;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.player.MMOPlayerData;
|
||||
import io.lumine.mythic.lib.player.TemporaryPlayerData;
|
||||
@ -23,12 +24,10 @@ import net.Indyuce.mmocore.api.util.Closable;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.experience.ExperienceObject;
|
||||
import net.Indyuce.mmocore.experience.ExperienceTableClaimer;
|
||||
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
||||
import net.Indyuce.mmocore.experience.droptable.ExperienceItem;
|
||||
import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
||||
import net.Indyuce.mmocore.guild.provided.Guild;
|
||||
import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect;
|
||||
import net.Indyuce.mmocore.manager.data.mysql.MySQLTableEditor;
|
||||
import net.Indyuce.mmocore.party.AbstractParty;
|
||||
import net.Indyuce.mmocore.party.provided.Party;
|
||||
import net.Indyuce.mmocore.player.Unlockable;
|
||||
@ -37,6 +36,9 @@ import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||
import net.Indyuce.mmocore.skill.cast.SkillCastingHandler;
|
||||
import net.Indyuce.mmocore.waypoint.Waypoint;
|
||||
import net.Indyuce.mmocore.waypoint.WaypointOption;
|
||||
import net.Indyuce.mmocore.experience.ExperienceTableClaimer;
|
||||
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
||||
import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.apache.commons.lang.Validate;
|
||||
@ -51,6 +53,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class PlayerData extends OfflinePlayerData implements Closable, ExperienceTableClaimer {
|
||||
@ -509,6 +512,64 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
}.runTaskTimer(MMOCore.plugin, 0, 1);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
|
||||
//We create the JSON correspondign to player Data
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, getUniqueId());
|
||||
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();
|
||||
}
|
@ -3,11 +3,11 @@ 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.api.player.PlayerData;
|
||||
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 net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
@ -1,52 +1,52 @@
|
||||
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,
|
||||
|
||||
/**
|
||||
* 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,6 +8,9 @@ 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.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.skill.list.Ambers;
|
||||
import net.Indyuce.mmocore.skill.list.Neptune_Gift;
|
||||
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;
|
||||
@ -15,7 +18,6 @@ import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||
import net.Indyuce.mmocore.api.player.profess.resource.ResourceRegeneration;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
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;
|
||||
@ -374,8 +376,8 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
* commonly called like EntityDamageEvent or regen events.
|
||||
* <p>
|
||||
* Examples:
|
||||
* - {@link net.Indyuce.mmocore.skill.list.Neptune_Gift}
|
||||
* - {@link net.Indyuce.mmocore.skill.list.Ambers}
|
||||
* - {@link Neptune_Gift}
|
||||
* - {@link Ambers}
|
||||
*/
|
||||
public Optional<ClassSkill> findSkill(RegisteredSkill skill) {
|
||||
ClassSkill found = skills.get(skill.getHandler().getId());
|
@ -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;
|
@ -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,9 +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.quest.trigger.ManaTrigger;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
@ -111,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,10 +6,10 @@ 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.player.stats.StatInfo;
|
||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
|
||||
public class PlayerStats {
|
||||
private final PlayerData data;
|
@ -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 {
|
@ -1,11 +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 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;
|
@ -1,5 +1,7 @@
|
||||
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.version.VersionMaterial;
|
||||
import io.lumine.mythic.utils.holograms.Hologram;
|
||||
@ -26,9 +28,7 @@ import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class MMOCoreUtils {
|
||||
public static boolean pluginItem(ItemStack item) {
|
||||
@ -140,6 +140,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
|
@ -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;
|
@ -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) {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user