Fixed flag resolution algorithm not catching NoSuchElementException correctly. Now the spawn flag works. Note that the IDs for the spawn and farewell/greeting flags were changed.

This commit is contained in:
sk89q 2011-04-02 17:49:11 -07:00
parent b823446e28
commit 50870a9b32
2 changed files with 10 additions and 5 deletions

View File

@ -26,6 +26,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import com.sk89q.worldguard.LocalPlayer;
@ -280,7 +281,11 @@ public <T extends Flag<V>, V> V getFlag(T flag) {
lastPriority = region.getPriority();
}
try {
return needsClear.values().iterator().next();
} catch (NoSuchElementException e) {
return null;
}
}
/**

View File

@ -39,16 +39,16 @@ public final class DefaultFlag {
public static final StateFlag LAVA_FLOW = new StateFlag("lava-flow", true);
public static final StateFlag USE = new StateFlag("use", false);
public static final StateFlag PLACE_VEHICLE = new StateFlag("vehicle-place", false);
public static final StringFlag GREET_MESSAGE = new StringFlag("greet-message");
public static final StringFlag FAREWELL_MESSAGE = new StringFlag("farewell-message");
public static final StringFlag GREET_MESSAGE = new StringFlag("greeting");
public static final StringFlag FAREWELL_MESSAGE = new StringFlag("farewell");
public static final BooleanFlag NOTIFY_GREET = new BooleanFlag("notify-greet");
public static final BooleanFlag NOTIFY_FAREWELL = new BooleanFlag("notify-farewell");
public static final StringFlag DENY_SPAWN = new StringFlag("deny-spawn");
public static final IntegerFlag HEAL_DELAY = new IntegerFlag("heal-delay");
public static final IntegerFlag HEAL_AMOUNT = new IntegerFlag("heal-amount");
public static final VectorFlag TELE_LOC = new VectorFlag("teleport-loc");
public static final VectorFlag TELE_LOC = new VectorFlag("teleport");
public static final RegionGroupFlag TELE_PERM = new RegionGroupFlag("teleport-group");
public static final VectorFlag SPAWN_LOC = new VectorFlag("spawn-location");
public static final VectorFlag SPAWN_LOC = new VectorFlag("spawn");
public static final RegionGroupFlag SPAWN_PERM = new RegionGroupFlag("spawn-group");
public static final BooleanFlag BUYABLE = new BooleanFlag("buyable");
public static final DoubleFlag PRICE = new DoubleFlag("price");