3 Commits
1.3.2 ... 1.3.3

Author SHA1 Message Date
Govindas
8864ed4b30 1.3.3 2021-06-26 13:12:55 +03:00
Govindas
b815f50cf2 fix expressions in queries, thanks to TPGamesNL 2021-06-26 13:10:19 +03:00
Govindas
310536c085 fix skript 2.6 support 2021-06-24 18:28:51 +03:00
3 changed files with 36 additions and 30 deletions

View File

@@ -6,7 +6,7 @@
<groupId>com.btk5h</groupId>
<artifactId>skript-db</artifactId>
<version>1.3.1</version>
<version>1.3.3</version>
<packaging>jar</packaging>
<repositories>

View File

@@ -105,41 +105,43 @@ public class EffExecuteStatement extends Effect {
if (getNext() != null) {
//if local variables are present
if (locals != null) {
//bring back local variables
//bring back local variables
//populate SQL data into variables
if (!(res instanceof String)) {
//populate SQL data into variables
if (!(res instanceof String)) {
//also set variables in the sql query complete event
//also set variables in the sql query complete event
//TEMPORARILY DISABLED, AS THIS WOULD WORSEN PERFORMANCE OF THE QUERIES AND NOT BE USED BY MOST PEOPLE.
//I may add config option to enable this later?
//TEMPORARILY DISABLED, AS THIS WOULD WORSEN PERFORMANCE OF THE QUERIES AND NOT BE USED BY MOST PEOPLE.
//I may add config option to enable this later?
//SQLQueryCompleteEvent event = new SQLQueryCompleteEvent(this.query.getSingle(e));
//((Map<String, Object>) res).forEach((name, value) -> setVariable(event, name, value));
//SkriptDB.getPlugin(SkriptDB.class).getServer().getPluginManager().callEvent(event);
}
if (isSync || finalSync) {
//SQLQueryCompleteEvent event = new SQLQueryCompleteEvent(this.query.getSingle(e));
//((Map<String, Object>) res).forEach((name, value) -> setVariable(event, name, value));
//SkriptDB.getPlugin(SkriptDB.class).getServer().getPluginManager().callEvent(event);
}
if (isSync || finalSync) {
if (locals != null) {
Variables.setLocalVariables(e, locals);
}
if (!(res instanceof String)) {
((Map<String, Object>) res).forEach((name, value) -> setVariable(e, name, value));
}
TriggerItem.walk(getNext(), e);
Variables.removeLocals(e);
} else {
Bukkit.getScheduler().runTask(SkriptDB.getInstance(), () -> {
if (locals != null) {
Variables.setLocalVariables(e, locals);
}
if (!(res instanceof String)) {
((Map<String, Object>) res).forEach((name, value) -> setVariable(e, name, value));
}
TriggerItem.walk(getNext(), e);
//the line below is required to prevent memory leaks
//no functionality difference notice with it being removed from my test, but the memory gets filled with leaks
//so it must be kept
Variables.removeLocals(e);
} else {
Bukkit.getScheduler().runTask(SkriptDB.getInstance(), () -> {
Variables.setLocalVariables(e, locals);
if (!(res instanceof String)) {
((Map<String, Object>) res).forEach((name, value) -> setVariable(e, name, value));
}
TriggerItem.walk(getNext(), e);
//the line below is required to prevent memory leaks
//no functionality difference notice with it being removed from my test, but the memory gets filled with leaks
//so it must be kept
Variables.removeLocals(e);
});
}
});
}
}
});
@@ -174,7 +176,11 @@ public class EffExecuteStatement extends Effect {
if (o instanceof String) {
sb.append(o);
} else {
Expression<?> expr = SkriptUtil.getExpressionFromInfo(o);
Expression<?> expr;
if (o instanceof Expression)
expr = (Expression<?>) o;
else
expr = SkriptUtil.getExpressionFromInfo(o);
String before = getString(objects, i - 1);
String after = getString(objects, i + 1);
@@ -328,4 +334,4 @@ public class EffExecuteStatement extends Effect {
}
return true;
}
}
}

View File

@@ -1,6 +1,6 @@
name: skript-db
version: 1.3.1
version: 1.3.3
main: com.btk5h.skriptdb.SkriptDB
depend: [Skript]
authors: [btk5h, FranKusmiruk, Govindas]
authors: [btk5h, FranKusmiruk, Govindas, TPGamesNL]
api-version: 1.13