Skip to content

Commit b985841

Browse files
Pablete1234twizmwazin
authored andcommitted
Add better defaults than null
1 parent 2e4bb13 commit b985841

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/main/java/in/twizmwaz/cardinal/Cardinal.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public static MatchThread getMatchThread(@NonNull CommandSender who) {
183183
return matchThread;
184184
}
185185
}
186-
return null;
186+
throw new IllegalStateException("Player is not in a match thread");
187187
}
188188

189189
/**

src/main/java/in/twizmwaz/cardinal/module/spawn/SpawnModule.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import in.twizmwaz.cardinal.module.kit.KitModule;
4343
import in.twizmwaz.cardinal.module.region.Region;
4444
import in.twizmwaz.cardinal.module.region.RegionModule;
45+
import in.twizmwaz.cardinal.module.region.type.PointRegion;
4546
import in.twizmwaz.cardinal.module.region.type.modifications.PointProviderRegion;
4647
import in.twizmwaz.cardinal.module.team.Team;
4748
import in.twizmwaz.cardinal.module.team.TeamModule;
@@ -301,8 +302,9 @@ private Spawn getDefaultSpawn(@NonNull Match match) {
301302
return spawn;
302303
}
303304
}
304-
// This should never happen as the match will not load without a default spawn.
305-
return null;
305+
// This should never happen as the match will not load without a default spawn. But just in case, use world spawn.
306+
return new Spawn(true, null, false, false, false, false, false,
307+
Lists.newArrayList(new PointRegion(match, match.getWorld().getSpawnLocation())));
306308
}
307309

308310
/**

0 commit comments

Comments
 (0)