Skip to content

Commit 8acfca8

Browse files
committed
Fix some bugs (with functions)
1 parent e9bfb3d commit 8acfca8

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

src/main/java/ch/njol/skript/lang/TriggerItem.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ public final static boolean walk(final TriggerItem start, final Event e) {
107107
if (ex.getStackTrace().length != 0) // empty exceptions have already been printed
108108
Skript.exception(ex, i);
109109
} finally {
110-
assert timing != null;
111-
timing.stop(); // Whatever happened, end the timing
110+
if (Timings.enabled()) {
111+
assert timing != null;
112+
timing.stop(); // Whatever happened, end the timing
113+
}
112114
}
113115
return false;
114116
}

src/main/java/ch/njol/skript/lang/function/FunctionReference.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ public boolean validateFunction(final boolean first) {
7878
else
7979
Skript.error("The function '" + functionName + "' was deleted or renamed, but is still used in other script(s)."
8080
+ " These will continue to use the old version of the function until Skript restarts.");
81+
82+
function = (Function<? extends T>) new Function<Object>("empty_placeholder", new Parameter<?>[0], null, true) {
83+
84+
@Override
85+
@Nullable
86+
public Object[] execute(FunctionEvent e, Object[][] params) {
87+
return null;
88+
}
89+
90+
};
8191
return false;
8292
}
8393
if (newFunc == function)

src/main/java/ch/njol/skript/lang/function/ScriptFunction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.eclipse.jdt.annotation.Nullable;
2525

2626
import ch.njol.skript.ScriptLoader;
27+
import ch.njol.skript.Skript;
2728
import ch.njol.skript.classes.ClassInfo;
2829
import ch.njol.skript.config.SectionNode;
2930
import ch.njol.skript.effects.EffReturn;
@@ -66,6 +67,7 @@ public ScriptFunction(final String name, final Parameter<?>[] parameters, final
6667
* @param value
6768
*/
6869
public final void setReturnValue(final FunctionEvent e, final @Nullable T[] value) {
70+
Skript.info("Trigger is " + trigger.toString());
6971
assert !returnValueSet;
7072
returnValueSet = true;
7173
returnValue = value;

src/main/java/ch/njol/skript/util/WeatherType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public final static WeatherType parse(final String s) {
7474

7575
public static WeatherType fromWorld(final World world) {
7676
assert world != null;
77-
if (world.isThundering())
77+
if (world.isThundering() && world.hasStorm()) // Sometimes thundering but no storm
7878
return THUNDER;
7979
if (world.hasStorm())
8080
return RAIN;

0 commit comments

Comments
 (0)