Skip to content

Commit 2738bc4

Browse files
committed
And more bug fixes
Region fix, hopefully
1 parent eba3a9c commit 2738bc4

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>ch.njol</groupId>
44
<artifactId>skript</artifactId>
5-
<version>2.2-dev14b</version>
5+
<version>2.2-dev14c</version>
66
<name>Skript</name>
77
<description>A plugin for the Minecraft server API Bukkit that allows to create scripts in natural language.</description>
88
<url>http://njol.ch/projects/skript/</url>

src/main/java/ch/njol/skript/hooks/regions/WorldGuardHook.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
import com.sk89q.worldedit.BlockVector;
4949
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
5050
import com.sk89q.worldguard.domains.DefaultDomain;
51+
import com.sk89q.worldguard.protection.ApplicableRegionSet;
52+
import com.sk89q.worldguard.protection.managers.RegionManager;
5153
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
5254

5355
/**
@@ -240,8 +242,15 @@ public int hashCode() {
240242
@SuppressWarnings("null")
241243
@Override
242244
public Collection<? extends Region> getRegionsAt_i(final Location l) {
243-
final Iterator<ProtectedRegion> i = plugin.getRegionManager(l.getWorld()).getApplicableRegions(l).iterator();
244245
final ArrayList<Region> r = new ArrayList<Region>();
246+
247+
RegionManager manager = plugin.getRegionManager(l.getWorld());
248+
if (manager == null)
249+
return r;
250+
ApplicableRegionSet applicable = manager.getApplicableRegions(l);
251+
if (applicable == null)
252+
return r;
253+
final Iterator<ProtectedRegion> i = applicable.iterator();
245254
while (i.hasNext())
246255
r.add(new WorldGuardRegion(l.getWorld(), i.next()));
247256
return r;

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ public boolean validateFunction(final boolean first) {
166166
return true;
167167
}
168168

169-
@SuppressWarnings("null")
170169
@Nullable
171170
protected T[] execute(final Event e) {
172171
if (function == null)
@@ -182,16 +181,21 @@ protected T[] execute(final Event e) {
182181
for (int i = 0; i < params.length; i++)
183182
params[i] = parameters[i].getArray(e); // TODO what if an argument is not available? pass null or abort?
184183
}
184+
assert function != null;
185185
return function.execute(params);
186186
}
187187

188188
public boolean isSingle() {
189189
return single;
190190
}
191191

192-
@SuppressWarnings("null")
192+
@SuppressWarnings("unchecked")
193193
public Class<? extends T> getReturnType() {
194-
return function.returnType.getC();
194+
if (function == null)
195+
return (Class<? extends T>) Void.class; // No function = no return
196+
assert function != null;
197+
ClassInfo<? extends T> ret = function.getReturnType();
198+
return (Class<? extends T>) (ret == null ? Void.class : ret);
195199
}
196200

197201
public String toString(@Nullable final Event e, final boolean debug) {

0 commit comments

Comments
 (0)