package com.volumetricpixels.politics.protection;

import java.util.Collection;

import org.spout.api.Spout;
import org.spout.api.geo.Protection;
import org.spout.api.geo.World;
import org.spout.api.geo.discrete.Point;
import org.spout.api.plugin.services.ProtectionService;

import com.volumetricpixels.politics.Politics;

public class PoliticsProtectionService extends ProtectionService {
    private static PoliticsProtectionService instance;

    public PoliticsProtectionService() {
        instance = this;

        Spout.getEventManager().registerEvents(new PoliticsProtectionServiceListener(), Politics.getPlugin());
    }

    @Override
    public Collection<Protection> getAllProtections() {
        return null;
    }

    @Override
    public Collection<Protection> getAllProtections(World world) {
        return null;
    }

    @Override
    public Collection<Protection> getAllProtections(Point location) {
        return null;
    }

    @Override
    public Protection getProtection(String name) {
        return null;
    }

    public static PoliticsProtectionService getInstance() {
        return instance;
    }
}

@@ -61,26 +61,77 @@
 va.util.
-Collection
+ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.List
 ;%0A%0Aimpor
@@ -491,16 +491,95 @@
 tance;%0A%0A
+    private final List%3CProtection%3E protections = new ArrayList%3CProtection%3E();%0A%0A
     publ
@@ -832,36 +832,43 @@
 %0A        return 
-null
+protections
 ;%0A    %7D%0A%0A    @Ov
@@ -953,131 +953,555 @@
     
-return null;%0A    %7D%0A%0A    @Override%0A    public Collection%3CProtection%3E getAllProtections(Point location) %7B%0A        return null
+Collection%3CProtection%3E result = new ArrayList%3CProtection%3E();%0A        for (Protection p : protections) %7B%0A            if (p.getWorld().equals(world)) %7B%0A                result.add(p);%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A%0A    @Override%0A    public Collection%3CProtection%3E getAllProtections(Point location) %7B%0A        Collection%3CProtection%3E result = new ArrayList%3CProtection%3E();%0A        for (Protection p : protections) %7B%0A            if (p.contains(location)) %7B%0A                result.add(p);%0A            %7D%0A        %7D%0A        return result
 ;%0A  

Implement ProtectionService methods