public boolean canReceive(AMChatRadio radio, Player player) { if (player.hasPermission("amchat.radio.hearall") || player.isOp()) { return true; } if (!isRadioOn(player)) { // The player doesn't even have his radio on return false; } if (!radio.getLoc().getWorld().equals(player.getWorld())) { // we can't talk to the other side. return false; } if (radio.getChan() < (playerRadioChannel.get(player) - playerRadioCutoff.get(player))) { // Radio chat is below cutoff limit return false; } else if (radio.getChan() > (playerRadioChannel.get(player) + playerRadioCutoff.get(player))) { // Radio channel is above the cutoff limit return false; } if ((!playerRadioChannel.get(player).equals(radio.getChan())) && (!playerRadioCode.get(player).equals(radio.getCode())) && (playerRadioFilter.get(player))) { // message is encrypted and we don't want to hear that. return false; } if (varLimitRadioChat) { if (!radio.isAdmin() && (amcTools.getDistance(radio.getLoc(), player.getLocation()) > radio.getMaxDistance())) { return false; } } return true; }
public boolean canRead(AMChatRadio radio, Player player) { // Sender is not encrypting chat if (radio.getCode() == 0) { return true; } // Receiver has read all permission if (player.hasPermission("amchat.radio.readall") || player.isOp()) { return true; } // the player and receiver are on the same channel with the same key if ((playerRadioCode.get(player).equals(radio.getCode())) && (playerRadioChannel.get(player).equals(radio.getChan()))) { return true; } return false; }
public boolean canLink(AMChatRadio radio, Player player) { if (player.hasPermission("amchat.radio.override.link") || player.isOp()) { return true; } if (!isRadioOn(player)) { // The player doesn't even have his radio on return false; } if (!radio.getLoc().getWorld().equals(player.getWorld())) { // we can't talk to the other side. return false; } if (varLimitRadioChat) { if (!radio.isAdmin() && (amcTools.getDistance(radio.getLoc(), player.getLocation()) > radio.getMaxDistance())) { return false; } } return true; }