forked from Upstream/mmocore
SQL Update +debug trigger
This commit is contained in:
parent
71773b0c8c
commit
b76127e904
@ -4,6 +4,7 @@
|
||||
<id>nexus</id>
|
||||
<username>${env.M2_REPO_USER}</username>
|
||||
<password>${env.M2_REPO_PASS}</password>
|
||||
<blocked>false</blocked>
|
||||
</server>
|
||||
<server>
|
||||
<id>lumine</id>
|
||||
|
@ -1,40 +0,0 @@
|
||||
<?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>
|
@ -1,50 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
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() {
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
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());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
name: MMOCore
|
||||
main: fr.phoenix.mmocore.bungee.Bungee
|
||||
author: PhoenixDevelopment
|
98
dist/pom.xml
vendored
98
dist/pom.xml
vendored
@ -1,98 +0,0 @@
|
||||
<?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>
|
318
pom.xml
318
pom.xml
@ -1,44 +1,286 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<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>
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOCore</artifactId>
|
||||
<version>1.9.3</version>
|
||||
<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>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
<properties>
|
||||
<downloadSources>false</downloadSources>
|
||||
<downloadJavadocs>false</downloadJavadocs>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>auto-clean</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Releases</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>nexus</id>
|
||||
<name>Lumine Snapshots</name>
|
||||
<url>https://mvn.lumine.io/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
|
||||
</distributionManagement>
|
||||
|
||||
<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>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>lumine</id>
|
||||
<url>https://mvn.lumine.io/repository/maven/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>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.9.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>Citizens</artifactId>
|
||||
<version>2.0.25</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Party plugins -->
|
||||
<dependency>
|
||||
<groupId>de.simonsator</groupId>
|
||||
<artifactId>PartyAndFriends</artifactId>
|
||||
<version>1.0.65</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alessiodp</groupId>
|
||||
<artifactId>Parties</artifactId>
|
||||
<version>3.1.14</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.209</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.erethon</groupId>
|
||||
<artifactId>DungeonsXL</artifactId>
|
||||
<version>0.18-PRE-02</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.denizen</groupId>
|
||||
<artifactId>Dungeons</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!--Quest Plugin-->
|
||||
<dependency>
|
||||
<groupId>me.blackvein</groupId>
|
||||
<artifactId>Quests</artifactId>
|
||||
<version>4.4.1-b340</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.skytasul.quests</groupId>
|
||||
<artifactId>BeautyQuests</artifactId>
|
||||
<version>0.19.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.guillaumevdn</groupId>
|
||||
<artifactId>QuestCreator</artifactId>
|
||||
<version>6.39.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.guillaumevdn</groupId>
|
||||
<artifactId>GCore</artifactId>
|
||||
<version>8.39.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Guild plugins -->
|
||||
<dependency>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>Factions</artifactId>
|
||||
<version>1.6.9.5-2.9.8-RC</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<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>
|
||||
|
@ -1,255 +0,0 @@
|
||||
<?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>
|
@ -1,260 +0,0 @@
|
||||
package net.Indyuce.mmocore.manager.data.mysql;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.OfflinePlayerData;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||
import net.Indyuce.mmocore.api.player.profess.SavedClassInformation;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.guild.provided.Guild;
|
||||
import net.Indyuce.mmocore.manager.data.PlayerDataManager;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.Socket;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.Indyuce.mmocore.api.player.PlayerData.createClassInfoData;
|
||||
|
||||
public class MySQLPlayerDataManager extends PlayerDataManager {
|
||||
private final MySQLDataProvider provider;
|
||||
|
||||
public MySQLPlayerDataManager(MySQLDataProvider provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(PlayerData data) {
|
||||
provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + data.getUniqueId() + "';", (result) -> {
|
||||
try {
|
||||
MMOCore.sqlDebug("Loading data for: '" + data.getUniqueId() + "'...");
|
||||
|
||||
// Initialize custom resources
|
||||
if (!data.hasUsedTemporaryData()) {
|
||||
data.setMana(data.getStats().getStat("MAX_MANA"));
|
||||
data.setStamina(data.getStats().getStat("MAX_STAMINA"));
|
||||
data.setStellium(data.getStats().getStat("MAX_STELLIUM"));
|
||||
}
|
||||
|
||||
if (!result.next()) {
|
||||
data.setLevel(getDefaultData().getLevel());
|
||||
data.setClassPoints(getDefaultData().getClassPoints());
|
||||
data.setSkillPoints(getDefaultData().getSkillPoints());
|
||||
data.setAttributePoints(getDefaultData().getAttributePoints());
|
||||
data.setAttributeReallocationPoints(getDefaultData().getAttrReallocPoints());
|
||||
data.setExperience(0);
|
||||
data.getQuestData().updateBossBar();
|
||||
|
||||
data.setFullyLoaded();
|
||||
MMOCore.sqlDebug("Loaded DEFAULT data for: '" + data.getUniqueId() + "' as no saved data was found.");
|
||||
return;
|
||||
}
|
||||
|
||||
data.setClassPoints(result.getInt("class_points"));
|
||||
data.setSkillPoints(result.getInt("skill_points"));
|
||||
data.setAttributePoints(result.getInt("attribute_points"));
|
||||
data.setAttributeReallocationPoints(result.getInt("attribute_realloc_points"));
|
||||
data.setLevel(result.getInt("level"));
|
||||
data.setExperience(result.getInt("experience"));
|
||||
if (!isEmpty(result.getString("class")))
|
||||
data.setClass(MMOCore.plugin.classManager.get(result.getString("class")));
|
||||
|
||||
if (!isEmpty(result.getString("times_claimed"))) {
|
||||
JsonObject json = new JsonParser().parse(result.getString("times_claimed")).getAsJsonObject();
|
||||
json.entrySet().forEach(entry -> data.getItemClaims().put(entry.getKey(), entry.getValue().getAsInt()));
|
||||
}
|
||||
|
||||
if (!isEmpty(result.getString("guild"))) {
|
||||
Guild guild = MMOCore.plugin.dataProvider.getGuildManager().getGuild(result.getString("guild"));
|
||||
data.setGuild(guild.hasMember(data.getUniqueId()) ? guild : null);
|
||||
}
|
||||
if (!isEmpty(result.getString("attributes"))) data.getAttributes().load(result.getString("attributes"));
|
||||
if (!isEmpty(result.getString("professions")))
|
||||
data.getCollectionSkills().load(result.getString("professions"));
|
||||
if (!isEmpty(result.getString("quests"))) data.getQuestData().load(result.getString("quests"));
|
||||
data.getQuestData().updateBossBar();
|
||||
if (!isEmpty(result.getString("waypoints")))
|
||||
data.getWaypoints().addAll(MMOCoreUtils.jsonArrayToList(result.getString("waypoints")));
|
||||
if (!isEmpty(result.getString("friends")))
|
||||
MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> data.getFriends().add(UUID.fromString(str)));
|
||||
if (!isEmpty(result.getString("skills"))) {
|
||||
JsonObject object = MythicLib.plugin.getJson().parse(result.getString("skills"), JsonObject.class);
|
||||
for (Entry<String, JsonElement> entry : object.entrySet())
|
||||
data.setSkillLevel(entry.getKey(), entry.getValue().getAsInt());
|
||||
}
|
||||
if (!isEmpty(result.getString("bound_skills")))
|
||||
for (String skill : MMOCoreUtils.jsonArrayToList(result.getString("bound_skills")))
|
||||
if (data.getProfess().hasSkill(skill))
|
||||
data.getBoundSkills().add(data.getProfess().getSkill(skill));
|
||||
if (!isEmpty(result.getString("class_info"))) {
|
||||
JsonObject object = MythicLib.plugin.getJson().parse(result.getString("class_info"), JsonObject.class);
|
||||
for (Entry<String, JsonElement> entry : object.entrySet()) {
|
||||
try {
|
||||
PlayerClass profess = MMOCore.plugin.classManager.get(entry.getKey());
|
||||
Validate.notNull(profess, "Could not find class '" + entry.getKey() + "'");
|
||||
data.applyClassInfo(profess, new SavedClassInformation(entry.getValue().getAsJsonObject()));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOCore.log(Level.WARNING, "Could not load class info '" + entry.getKey() + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//We now change the saved status to false because the data on SQL won't be the same as in the RAM
|
||||
MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId());
|
||||
|
||||
|
||||
data.setFullyLoaded();
|
||||
MMOCore.sqlDebug("Loaded saved data for: '" + data.getUniqueId() + "'!");
|
||||
MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel()));
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isEmpty(String s) {
|
||||
return s == null || s.equalsIgnoreCase("null") || s.equalsIgnoreCase("{}") || s.equalsIgnoreCase("[]") || s.equalsIgnoreCase("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData(PlayerData data) {
|
||||
|
||||
if (MMOCore.plugin.hasBungee) {
|
||||
//Initialize a connection with bungee using Sockets
|
||||
try {
|
||||
Socket socket=new Socket("localhost",25580);
|
||||
BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
|
||||
writer.write("BONJOUR");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
DataOutputStream outStream = new DataOutputStream(out);
|
||||
try {
|
||||
outStream.writeChars(data.toJson());
|
||||
} catch (IOException e) {
|
||||
MMOCore.plugin.getLogger().log(Level.SEVERE, "Couldn't send the data to Bungee for player " + data.getPlayer().getName());
|
||||
return;
|
||||
}
|
||||
MMOCore.plugin.getLogger().log(Level.WARNING, "BUNGEE"+ Bukkit.getOnlinePlayers().size());
|
||||
|
||||
|
||||
MMOCore.sqlDebug("Sent data to bungee for: " + data.getUniqueId());
|
||||
MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel()));
|
||||
|
||||
|
||||
} else {
|
||||
MySQLTableEditor sql = new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, data.getUniqueId());
|
||||
MMOCore.sqlDebug("Saving data for: '" + data.getUniqueId() + "'...");
|
||||
|
||||
sql.updateData("class_points", data.getClassPoints());
|
||||
sql.updateData("skill_points", data.getSkillPoints());
|
||||
sql.updateData("attribute_points", data.getAttributePoints());
|
||||
sql.updateData("attribute_realloc_points", data.getAttributeReallocationPoints());
|
||||
sql.updateData("level", data.getLevel());
|
||||
sql.updateData("experience", data.getExperience());
|
||||
sql.updateData("class", data.getProfess().getId());
|
||||
sql.updateData("last_login", data.getLastLogin());
|
||||
sql.updateData("guild", data.hasGuild() ? data.getGuild().getId() : null);
|
||||
|
||||
sql.updateJSONArray("waypoints", data.getWaypoints());
|
||||
sql.updateJSONArray("friends", data.getFriends().stream().map(UUID::toString).collect(Collectors.toList()));
|
||||
sql.updateJSONArray("bound_skills", data.getBoundSkills().stream().map(skill -> skill.getSkill().getHandler().getId()).collect(Collectors.toList()));
|
||||
|
||||
sql.updateJSONObject("skills", data.mapSkillLevels().entrySet());
|
||||
sql.updateJSONObject("times_claimed", data.getItemClaims().entrySet());
|
||||
|
||||
sql.updateData("attributes", data.getAttributes().toJsonString());
|
||||
sql.updateData("professions", data.getCollectionSkills().toJsonString());
|
||||
sql.updateData("quests", data.getQuestData().toJsonString());
|
||||
|
||||
sql.updateData("class_info", createClassInfoData(data).toString());
|
||||
|
||||
|
||||
MMOCore.sqlDebug("Saved data for: " + data.getUniqueId());
|
||||
MMOCore.sqlDebug(String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel()));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public OfflinePlayerData getOffline(UUID uuid) {
|
||||
return isLoaded(uuid) ? get(uuid) : new MySQLOfflinePlayerData(uuid);
|
||||
}
|
||||
|
||||
|
||||
public class MySQLOfflinePlayerData extends OfflinePlayerData {
|
||||
private int level;
|
||||
private long lastLogin;
|
||||
private PlayerClass profess;
|
||||
private List<UUID> friends;
|
||||
|
||||
public MySQLOfflinePlayerData(UUID uuid) {
|
||||
super(uuid);
|
||||
|
||||
provider.getResult("SELECT * FROM mmocore_playerdata WHERE uuid = '" + uuid + "';", (result) -> {
|
||||
try {
|
||||
MMOCore.sqlDebug("Loading OFFLINE data for '" + uuid + "'.");
|
||||
if (!result.next()) {
|
||||
level = 0;
|
||||
lastLogin = 0;
|
||||
profess = MMOCore.plugin.classManager.getDefaultClass();
|
||||
friends = new ArrayList<>();
|
||||
MMOCore.sqlDebug("Default OFFLINE data loaded.");
|
||||
} else {
|
||||
level = result.getInt("level");
|
||||
lastLogin = result.getLong("last_login");
|
||||
profess = isEmpty(result.getString("class")) ? MMOCore.plugin.classManager.getDefaultClass() : MMOCore.plugin.classManager.get(result.getString("class"));
|
||||
if (!isEmpty(result.getString("friends")))
|
||||
MMOCoreUtils.jsonArrayToList(result.getString("friends")).forEach(str -> friends.add(UUID.fromString(str)));
|
||||
else friends = new ArrayList<>();
|
||||
MMOCore.sqlDebug("Saved OFFLINE data loaded.");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFriend(UUID uuid) {
|
||||
friends.remove(uuid);
|
||||
new MySQLTableEditor(MySQLTableEditor.Table.PLAYERDATA, uuid).updateData("friends", friends.stream().map(UUID::toString).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFriend(UUID uuid) {
|
||||
return friends.contains(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerClass getProfess() {
|
||||
return profess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastLogin() {
|
||||
return lastLogin;
|
||||
}
|
||||
}
|
||||
}
|
@ -351,8 +351,8 @@ public class MMOCore extends LuminePlugin {
|
||||
}
|
||||
|
||||
MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot();
|
||||
getCommand("net/Indyuce/mmocore").setExecutor(mmoCoreCommand);
|
||||
getCommand("net/Indyuce/mmocore").setTabCompleter(mmoCoreCommand);
|
||||
getCommand("mmocore").setExecutor(mmoCoreCommand);
|
||||
getCommand("mmocore").setTabCompleter(mmoCoreCommand);
|
||||
|
||||
if (getConfig().getBoolean("auto-save.enabled")) {
|
||||
int autosave = getConfig().getInt("auto-save.interval") * 20;
|
@ -637,6 +637,10 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
|
||||
experience -= needed;
|
||||
level = getLevel() + 1;
|
||||
|
||||
// Apply class experience table
|
||||
if (getProfess().hasExperienceTable())
|
||||
getProfess().getExperienceTable().claim(this, level, getProfess());
|
||||
}
|
||||
|
||||
if (level > oldLevel) {
|
||||
@ -648,9 +652,6 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
}
|
||||
getStats().updateStats();
|
||||
|
||||
// Apply class experience table
|
||||
if (getProfess().hasExperienceTable())
|
||||
getProfess().getExperienceTable().claim(this, level, getProfess());
|
||||
}
|
||||
|
||||
refreshVanillaExp();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user