Java源码示例:com.massivecraft.massivecore.ps.PS

示例1
@Override
public List<ChunkPos> getClaims() {
    List<ChunkPos> target = new LinkedList<>();
    for (Set<PS> ps : BoardColl.get().getFactionToChunks().values()) {
        target.addAll(psToChunkPos(ps));
    }
    return target;
}
 
示例2
@Override
public List<ChunkPos> getClaims() {
    List<ChunkPos> target = new LinkedList<>();
    for (Set<PS> ps : BoardColl.get().getFactionToChunks().values()) {
        target.addAll(psToChunkPos(ps));
    }
    return target;
}
 
示例3
@Override
public List<ChunkPos> getClaims() {
    List<ChunkPos> target = new LinkedList<>();
    for (Set<PS> ps : BoardColl.get().getFactionToChunks().values()) {
        target.addAll(psToChunkPos(ps));
    }
    return target;
}
 
示例4
private boolean checkSurroundingFactions(Location loc) {
    int distance = range / 2;
    Vector top = new Vector(loc.getX() + distance, loc.getY(), loc.getZ() + distance);
    Vector bottom = new Vector(loc.getX() - distance, loc.getY(), loc.getZ() - distance);
    for (int z = bottom.getBlockZ(); z <= top.getBlockZ(); z++) {
        for (int x = bottom.getBlockX(); x <= top.getBlockX(); x++) {
            if (BoardColl.get().getFactionAt(PS.valueOf(new Location(loc.getWorld(), loc.getX() + x, loc.getY(), loc.getZ() + z))).isNone())
                return true;
        }
    }
    return false;
}
 
示例5
@EventHandler(ignoreCancelled = true)
public void onCreateFac(EventFactionsChunksChange event) {
    if (RedProtect.get().config.configRoot().hooks.factions.claim_over_rps) {
        return;
    }
    for (PS chunk : event.getChunks()) {
        Player p = event.getMPlayer().getPlayer();
        Set<Region> regs = RedProtect.get().rm.getRegionsForChunk(chunk.asBukkitChunk());
        if (regs.size() > 0 && !p.hasPermission("redprotect.bypass")) {
            event.setCancelled(true);
            RedProtect.get().lang.sendMessage(p, "rpfactions.cantclaim");
        }
    }
}
 
示例6
@Override
public boolean isFactionOffline(Location loc) {
    Faction faction = BoardColl.get().getFactionAt(PS.valueOf(loc));
    if ((faction.isNone()) ||
            ChatColor.stripColor(faction.getName()).equalsIgnoreCase("safezone") ||
            ChatColor.stripColor(faction.getName()).equalsIgnoreCase("warzone")) {
        //ObsidianDestroyer.debug("Factions25x.isFactionOffline: false");
        return false;
    }
    //ObsidianDestroyer.debug("Factions25x.isFactionOffline: " + faction.isFactionConsideredOffline());
    return faction.isFactionConsideredOffline() && faction.getFlag(MFlag.ID_OFFLINEEXPLOSIONS);
}
 
示例7
@Override
public String getFactionAt(String worldName, int chunkX, int chunkZ) {
    Faction faction = BoardColl.get().getFactionAt(PS.valueOf(worldName, chunkX, chunkZ));
    return faction == null ? Factions.ID_NONE : faction.getId();
}
 
示例8
private Set<ChunkPos> psToChunkPos(Set<PS> positions) {
    return positions.stream().map(this::psToChunkPos).collect(Collectors.toSet());
}
 
示例9
private ChunkPos psToChunkPos(PS ps) {
    return ChunkPos.of(ps.getWorld(), ps.getChunkX(), ps.getChunkZ());
}
 
示例10
@Override
public String getFactionAt(String worldName, int chunkX, int chunkZ) {
    Faction faction = BoardColl.get().getFactionAt(PS.valueOf(worldName, chunkX, chunkZ));
    return faction == null ? Factions.ID_NONE : faction.getId();
}
 
示例11
private Set<ChunkPos> psToChunkPos(Set<PS> positions) {
    return positions.stream().map(this::psToChunkPos).collect(Collectors.toSet());
}
 
示例12
private ChunkPos psToChunkPos(PS ps) {
    return ChunkPos.of(ps.getWorld(), ps.getChunkX(), ps.getChunkZ());
}
 
示例13
@Override
public String getFactionAt(String worldName, int chunkX, int chunkZ) {
    Faction faction = BoardColl.get().getFactionAt(PS.valueOf(worldName, chunkX, chunkZ));
    return faction == null ? Factions.ID_NONE : faction.getId();
}
 
示例14
private Set<ChunkPos> psToChunkPos(Set<PS> positions) {
    return positions.stream().map(this::psToChunkPos).collect(Collectors.toSet());
}
 
示例15
private ChunkPos psToChunkPos(PS ps) {
    return ChunkPos.of(ps.getWorld(), ps.getChunkX(), ps.getChunkZ());
}
 
示例16
@Override
public boolean canBuild(Player player, Location location) {
    return BoardColl.get().getFactionAt(PS.valueOf(location)) == null;
}
 
示例17
@Override
public boolean canBuild(Player player, World world, int chunkX, int chunkZ) {
    return BoardColl.get().getFactionAt(PS.valueOf(world.getName(), chunkX, chunkZ)) == null;
}
 
示例18
@Override
public boolean isExplosionsEnabled(Location loc) {
    Faction faction = BoardColl.get().getFactionAt(PS.valueOf(loc));
    //ObsidianDestroyer.debug("Factions25x.isExplosionsEnabled: " + faction.getFlag(FFlag.EXPLOSIONS));
    return faction == null || faction.getFlag(MFlag.ID_EXPLOSIONS);
}
 
示例19
@Override
public boolean isFactionAtPower(Location loc) {
    Faction faction = BoardColl.get().getFactionAt(PS.valueOf(loc));
    return faction.getPower() >= faction.getLandCount();
}
 
示例20
private boolean factionsClaim(Location loc) {

        if (wild.getConfig().getBoolean("Factions")) {
            Faction faction = BoardColl.get().getFactionAt(PS.valueOf(loc));
            if (!faction.isNone() && !checkSurroundingFactions(loc))

                return true;

            else
                return false;

        } else
            return false;

    }