if (player != null) {
player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("SelectPoints"));
}
return false;
}
PermissionGroup group = Residence.getPermissionManager().getGroup(owner, loc1.getWorld().getName());
boolean createpermission = group.canCreateResidences() || (player == null ? true : player.hasPermission("residence.create"));
if (!createpermission && !resadmin) {
if (player != null) {
player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("NoPermission"));
}
return false;
}
if (player != null) {
if (getOwnedZoneCount(player.getName()) >= group.getMaxZones() && !resadmin) {
player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("ResidenceTooMany"));
return false;
}
}
CuboidArea newArea = new CuboidArea(loc1, loc2);
ClaimedResidence newRes = new ClaimedResidence(owner, loc1.getWorld().getName());
newRes.getPermissions().applyDefaultFlags();
newRes.setEnterMessage(group.getDefaultEnterMessage());
newRes.setLeaveMessage(group.getDefaultLeaveMessage());
ResidenceCreationEvent resevent = new ResidenceCreationEvent(player, name, newRes, newArea);
Residence.getServ().getPluginManager().callEvent(resevent);
if (resevent.isCancelled()) {
return false;
}
newArea = resevent.getPhysicalArea();
name = resevent.getResidenceName();
if (residences.containsKey(name)) {
if (player != null) {
player.sendMessage(ChatColor.RED + Residence.getLanguage().getPhrase("ResidenceAlreadyExists", ChatColor.YELLOW + name + ChatColor.RED));
}
return false;
}
if (player != null) {
newRes.addArea(player, newArea, "main", resadmin);
} else {
newRes.addArea(newArea, "main");
}
if (newRes.getAreaCount() != 0) {
residences.put(name, newRes);
calculateChunks(name);
Residence.getLeaseManager().removeExpireTime(name);
if (player != null) {
player.sendMessage(ChatColor.GREEN + Residence.getLanguage().getPhrase("ResidenceCreate", ChatColor.YELLOW + name + ChatColor.GREEN));
}
if (Residence.getConfigManager().useLeases()) {
if (player != null) {
Residence.getLeaseManager().setExpireTime(player, name, group.getLeaseGiveTime());
} else {
Residence.getLeaseManager().setExpireTime(name, group.getLeaseGiveTime());
}
}
return true;
}
return false;