Skip to content

Commit

Permalink
And more bug fixes
Browse files Browse the repository at this point in the history
Region fix, hopefully
  • Loading branch information
bensku committed May 8, 2016
1 parent eba3a9c commit 2738bc4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ch.njol</groupId>
<artifactId>skript</artifactId>
<version>2.2-dev14b</version>
<version>2.2-dev14c</version>
<name>Skript</name>
<description>A plugin for the Minecraft server API Bukkit that allows to create scripts in natural language.</description>
<url>http://njol.ch/projects/skript/</url>
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/ch/njol/skript/hooks/regions/WorldGuardHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.domains.DefaultDomain;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;

/**
Expand Down Expand Up @@ -240,8 +242,15 @@ public int hashCode() {
@SuppressWarnings("null")
@Override
public Collection<? extends Region> getRegionsAt_i(final Location l) {
final Iterator<ProtectedRegion> i = plugin.getRegionManager(l.getWorld()).getApplicableRegions(l).iterator();
final ArrayList<Region> r = new ArrayList<Region>();

RegionManager manager = plugin.getRegionManager(l.getWorld());
if (manager == null)
return r;
ApplicableRegionSet applicable = manager.getApplicableRegions(l);
if (applicable == null)
return r;
final Iterator<ProtectedRegion> i = applicable.iterator();
while (i.hasNext())
r.add(new WorldGuardRegion(l.getWorld(), i.next()));
return r;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ public boolean validateFunction(final boolean first) {
return true;
}

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

public boolean isSingle() {
return single;
}

@SuppressWarnings("null")
@SuppressWarnings("unchecked")
public Class<? extends T> getReturnType() {
return function.returnType.getC();
if (function == null)
return (Class<? extends T>) Void.class; // No function = no return
assert function != null;
ClassInfo<? extends T> ret = function.getReturnType();
return (Class<? extends T>) (ret == null ? Void.class : ret);
}

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

0 comments on commit 2738bc4

Please sign in to comment.