Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
import com.sk89q.worldguard.protection.flags.RegionGroup;
import com.sk89q.worldguard.protection.flags.RegionGroupFlag;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public abstract class WorldGuardInterface {

Expand All @@ -31,7 +34,16 @@ public abstract class WorldGuardInterface {

public abstract RegionGroup parseFlagInput(RegionGroupFlag flag, String input) throws InvalidFlagFormat;

public abstract List<String> tabCompleteRegions(String regionName, World world);
public List<String> tabCompleteRegions(String regionName, World world) {
Map<String, ProtectedRegion> regions = this.getRegionManager(world).getRegions();
List<String> regionIds = new ArrayList<>();
for(Map.Entry<String, ProtectedRegion> entry : regions.entrySet()) {
if(entry.getKey().toLowerCase().startsWith(regionName.toLowerCase())) {
regionIds.add(entry.getValue().getId());
}
}
return regionIds;
}

public abstract Flag fuzzyMatchFlag(String id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,4 @@ public RegionGroup parseFlagInput(RegionGroupFlag flag, String input) throws Inv
return flag.parseInput(WorldGuardPlugin.inst(), null, input);
}

@Override
public List<String> tabCompleteRegions(String regionName, World world) {
Map<String, ProtectedRegion> regions = this.getRegionManager(world).getRegions();
List<String> regionIds = new ArrayList<>();
for(Map.Entry<String, ProtectedRegion> entry : regions.entrySet()) {
if(entry.getKey().toLowerCase().startsWith(regionName.toLowerCase())) {
regionIds.add(entry.getValue().getId());
}
}
return regionIds;
}

}
12 changes: 0 additions & 12 deletions wg7adapter/src/main/java/net/alex9849/adapters/WorldGuard7.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,4 @@ public RegionGroup parseFlagInput(RegionGroupFlag flag, String input) throws Inv
return flag.parseInput(FlagContext.create().setInput(input).build());
}

@Override
public List<String> tabCompleteRegions(String regionName, World world) {
Map<String, ProtectedRegion> regions = this.getRegionManager(world).getRegions();
List<String> regionIds = new ArrayList<>();
for(Map.Entry<String, ProtectedRegion> entry : regions.entrySet()) {
if(entry.getKey().toLowerCase().startsWith(regionName.toLowerCase())) {
regionIds.add(entry.getValue().getId());
}
}
return regionIds;
}

}