Fix for PreciousStones

This commit is contained in:
Jesse Boyd 2016-07-14 04:55:27 +10:00
parent ef06ca3b19
commit bdff04cff4

View File

@ -2,6 +2,8 @@ package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.bukkit.FaweBukkit; import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.regions.FaweMask;
import com.sk89q.worldedit.BlockVector;
import java.util.List; import java.util.List;
import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones; import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
import net.sacredlabyrinth.Phaed.PreciousStones.field.Field; import net.sacredlabyrinth.Phaed.PreciousStones.field.Field;
@ -23,20 +25,20 @@ public class PreciousStonesFeature extends BukkitMaskManager implements Listener
} }
@Override @Override
public BukkitMask getMask(final FawePlayer<Player> fp) { public FaweMask getMask(final FawePlayer<Player> fp) {
final Player player = fp.parent; final Player player = fp.parent;
final Location location = player.getLocation(); final Location location = player.getLocation();
final List<Field> fields = PreciousStones.API().getFieldsProtectingArea(FieldFlag.PLOT, location); final List<Field> fields = PreciousStones.API().getFieldsProtectingArea(FieldFlag.PLOT, location);
for (final Field myfield : fields) { if (fields.isEmpty()) {
if (myfield.getOwner().equalsIgnoreCase(player.getName()) || (myfield.getAllowed().contains(player.getName()))) { return null;
final Location pos1 = new Location(location.getWorld(), myfield.getCorners().get(0).getBlockX(), myfield.getCorners().get(0).getBlockY(), myfield.getCorners().get(0).getBlockZ()); }
final Location pos2 = new Location(location.getWorld(), myfield.getCorners().get(1).getBlockX(), myfield.getCorners().get(1).getBlockY(), myfield.getCorners().get(1).getBlockZ()); String name = player.getName();
return new BukkitMask(pos1, pos2) { boolean member = fp.hasPermission("fawe.preciousstones.member");
@Override for (final Field myField : fields) {
public String getName() { if (myField.isOwner(name) || (member && myField.getAllowed().contains(player.getName()))) {
return "FIELD:" + myfield.toString(); BlockVector pos1 = new BlockVector(myField.getMinx(), myField.getMiny(), myField.getMinz());
} BlockVector pos2 = new BlockVector(myField.getMaxx(), myField.getMaxy(), myField.getMaxz());
}; return new FaweMask(pos1, pos2, "FIELD: " + myField);
} }
} }
return null; return null;