File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
src/main/java/ch/njol/skript Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 4848import com .sk89q .worldedit .BlockVector ;
4949import com .sk89q .worldguard .bukkit .WorldGuardPlugin ;
5050import com .sk89q .worldguard .domains .DefaultDomain ;
51+ import com .sk89q .worldguard .protection .ApplicableRegionSet ;
52+ import com .sk89q .worldguard .protection .managers .RegionManager ;
5153import 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 ;
Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments