forked from Limework/skript-db
Fix blob column types & Use Java 9
This commit is contained in:
parent
2a24a974ef
commit
32f40af484
6
pom.xml
6
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.btk5h</groupId>
|
<groupId>com.btk5h</groupId>
|
||||||
<artifactId>skript-db</artifactId>
|
<artifactId>skript-db</artifactId>
|
||||||
<version>1.3.4</version>
|
<version>1.3.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
@ -45,8 +45,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.6.1</version>
|
<version>3.6.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>8</source>
|
<source>9</source>
|
||||||
<target>8</target>
|
<target>9</target>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -10,10 +10,14 @@ import com.btk5h.skriptdb.SkriptDB;
|
|||||||
import com.btk5h.skriptdb.SkriptUtil;
|
import com.btk5h.skriptdb.SkriptUtil;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import javax.sql.rowset.CachedRowSet;
|
import javax.sql.rowset.CachedRowSet;
|
||||||
|
import javax.sql.rowset.serial.SerialBlob;
|
||||||
|
import javax.sql.rowset.serial.SerialException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSetMetaData;
|
import java.sql.ResultSetMetaData;
|
||||||
@ -299,6 +303,19 @@ public class EffExecuteStatement extends Effect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setVariable(Event e, String name, Object obj) {
|
private void setVariable(Event e, String name, Object obj) {
|
||||||
|
|
||||||
|
//fix mediumblob and similar column types, so they return a String correctly
|
||||||
|
if (obj.getClass().getName().equals("[B")) {
|
||||||
|
obj = new String((byte[]) obj);
|
||||||
|
|
||||||
|
//in some servers instead of being byte array, it appears as SerialBlob (depends on mc version, 1.12.2 is bvte array, 1.16.5 SerialBlob)
|
||||||
|
} else if (obj instanceof SerialBlob) {
|
||||||
|
try {
|
||||||
|
obj = new String(((SerialBlob) obj).getBinaryStream().readAllBytes());
|
||||||
|
} catch (IOException | SerialException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
Variables.setVariable(name.toLowerCase(Locale.ENGLISH), obj, e, isLocal);
|
Variables.setVariable(name.toLowerCase(Locale.ENGLISH), obj, e, isLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: skript-db
|
name: skript-db
|
||||||
version: 1.3.4
|
version: 1.3.5
|
||||||
main: com.btk5h.skriptdb.SkriptDB
|
main: com.btk5h.skriptdb.SkriptDB
|
||||||
depend: [Skript]
|
depend: [Skript]
|
||||||
authors: [btk5h, FranKusmiruk, Govindas, TPGamesNL]
|
authors: [btk5h, FranKusmiruk, Govindas, TPGamesNL]
|
||||||
|
Loading…
Reference in New Issue
Block a user