Adds some missing annotations
This commit is contained in:
parent
37a773511d
commit
d3a1ed2145
@ -6,6 +6,9 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The plugin main class
|
||||||
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public final class ClearOnWorldGuard extends JavaPlugin {
|
public final class ClearOnWorldGuard extends JavaPlugin {
|
||||||
|
|
||||||
|
@ -60,12 +60,24 @@ public class WorldGuardListener implements Listener {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadRegions(world, worldsSection, worldId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads clear regions for a world
|
||||||
|
*
|
||||||
|
* @param world <p>The world to load regions for</p>
|
||||||
|
* @param worldsSection <p>The configuration section listing all worlds and regions</p>
|
||||||
|
* @param worldId <p>The user-specified identifier for the currently processed world</p>
|
||||||
|
*/
|
||||||
|
private void loadRegions(@NotNull World world, @NotNull ConfigurationSection worldsSection, @NotNull String worldId) {
|
||||||
// Get a region manager for the world
|
// Get a region manager for the world
|
||||||
RegionManager regionManager = regionContainer.get(BukkitAdapter.adapt(world));
|
RegionManager regionManager = regionContainer.get(BukkitAdapter.adapt(world));
|
||||||
if (regionManager == null) {
|
if (regionManager == null) {
|
||||||
ClearOnWorldGuard.logger().log(Level.WARNING, "Unable to get region manager for world: " +
|
ClearOnWorldGuard.logger().log(Level.WARNING, "Unable to get region manager for world: " +
|
||||||
world.getName());
|
world.getName());
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<ProtectedRegion> regions = new HashSet<>();
|
Set<ProtectedRegion> regions = new HashSet<>();
|
||||||
@ -81,10 +93,9 @@ public class WorldGuardListener implements Listener {
|
|||||||
}
|
}
|
||||||
protectedRegions.put(world, regions);
|
protectedRegions.put(world, regions);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onMove(PlayerMoveEvent event) {
|
public void onMove(@NotNull PlayerMoveEvent event) {
|
||||||
if (event.getTo() == null || event.getFrom().getWorld() == null) {
|
if (event.getTo() == null || event.getFrom().getWorld() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -109,7 +120,8 @@ public class WorldGuardListener implements Listener {
|
|||||||
* @param playerRegions <p>The regions the player is in or will be in</p>
|
* @param playerRegions <p>The regions the player is in or will be in</p>
|
||||||
* @return <p>All clear regions found in playerRegions</p>
|
* @return <p>All clear regions found in playerRegions</p>
|
||||||
*/
|
*/
|
||||||
private Set<ProtectedRegion> getOccupiedClearRegions(World playerWorld, Set<ProtectedRegion> playerRegions) {
|
private Set<ProtectedRegion> getOccupiedClearRegions(@NotNull World playerWorld,
|
||||||
|
@NotNull Set<ProtectedRegion> playerRegions) {
|
||||||
Set<ProtectedRegion> possibleRegions = protectedRegions.get(playerWorld);
|
Set<ProtectedRegion> possibleRegions = protectedRegions.get(playerWorld);
|
||||||
Set<ProtectedRegion> result = new HashSet<>();
|
Set<ProtectedRegion> result = new HashSet<>();
|
||||||
for (ProtectedRegion region : playerRegions) {
|
for (ProtectedRegion region : playerRegions) {
|
||||||
|
Loading…
Reference in New Issue
Block a user