use of net.citizensnpcs.api.command.Command in project Sentinel by mcmonkey4eva.
the class SentinelInfoCommands method info.
@Command(aliases = { "sentinel" }, usage = "info", desc = "Shows info on the current NPC.", modifiers = { "info" }, permission = "sentinel.info", min = 1, max = 2)
@Requirements(livingEntity = true, ownership = true, traits = { SentinelTrait.class })
public void info(CommandContext args, CommandSender sender, SentinelTrait sentinel) {
String guardName = null;
LivingEntity guarded = sentinel.getGuardingEntity();
if (guarded != null) {
guardName = guarded.getName();
} else if (sentinel.guardedNPC >= 0 && CitizensAPI.getNPCRegistry().getById(sentinel.guardedNPC) != null) {
guardName = "NPC " + sentinel.guardedNPC + ": " + CitizensAPI.getNPCRegistry().getById(sentinel.guardedNPC).getFullName();
} else if (sentinel.getGuarding() != null) {
OfflinePlayer player = Bukkit.getOfflinePlayer(sentinel.getGuarding());
if (player != null && player.getName() != null) {
guardName = player.getName();
}
}
Paginator paginator = new Paginator().header(SentinelCommand.prefixGood + sentinel.getNPC().getFullName());
addLineIfNeeded(paginator, "Owned by", SentinelPlugin.instance.getOwner(sentinel.getNPC(), ""));
addLineIfNeeded(paginator, "Guarding", (guardName == null ? "" : guardName));
addLineIfNeeded(paginator, "Damage", sentinel.damage + SentinelCommand.colorBasic + " Calculated: " + SentinelCommand.colorEmphasis + sentinel.getDamage(true));
addLineIfNeeded(paginator, "Armor", sentinel.armor + (sentinel.getNPC().isSpawned() ? SentinelCommand.colorBasic + " Calculated: " + SentinelCommand.colorEmphasis + sentinel.getArmor(sentinel.getLivingEntity()) : ""));
addLineIfNeeded(paginator, "Health", (sentinel.getNPC().isSpawned() ? sentinel.getLivingEntity().getHealth() + "/" : "") + sentinel.health);
addLineIfNeeded(paginator, "Range", sentinel.range);
addLineIfNeeded(paginator, "Avoidance Range", sentinel.avoidRange);
addLineIfNeeded(paginator, "Attack Rate", (sentinel.attackRate / 20.0));
addLineIfNeeded(paginator, "Ranged Attack Rate", (sentinel.attackRateRanged / 20.0));
addLineIfNeeded(paginator, "Heal Rate", (sentinel.healRate / 20.0));
addLineIfNeeded(paginator, "Respawn Time", (sentinel.respawnTime / 20.0));
addLineIfNeeded(paginator, "Accuracy", sentinel.accuracy);
addLineIfNeeded(paginator, "Reach", sentinel.reach);
addLineIfNeeded(paginator, "Projectile Range", sentinel.projectileRange);
addLineIfNeeded(paginator, "Greeting", (sentinel.greetingText == null ? "" : sentinel.greetingText));
addLineIfNeeded(paginator, "Warning", (sentinel.warningText == null ? "" : sentinel.warningText));
addLineIfNeeded(paginator, "Greeting Range", sentinel.greetRange);
addLineIfNeeded(paginator, "Greeting Rate", sentinel.greetRate);
addLineIfNeeded(paginator, "Guard Distance Minimum", sentinel.guardDistanceMinimum);
addLineIfNeeded(paginator, "Guard Selection Range", sentinel.guardSelectionRange);
addLineIfNeeded(paginator, "Invincibility Enabled", sentinel.invincible);
addLineIfNeeded(paginator, "Protected Enabled", sentinel.protectFromIgnores);
addLineIfNeeded(paginator, "Fightback Enabled", sentinel.fightback);
addLineIfNeeded(paginator, "Ranged Chasing Enabled", sentinel.rangedChase);
addLineIfNeeded(paginator, "Close-Quarters Chasing Enabled", sentinel.closeChase);
addLineIfNeeded(paginator, "Maximum chase range", sentinel.chaseRange);
addLineIfNeeded(paginator, "Safe-Shot Enabled", sentinel.safeShot);
addLineIfNeeded(paginator, "Enemy-Drops Enabled", sentinel.enemyDrops);
addLineIfNeeded(paginator, "Autoswitch Enabled", sentinel.autoswitch);
addLineIfNeeded(paginator, "Realistic Targeting Enabled", sentinel.realistic);
addLineIfNeeded(paginator, "Knockback allowed", sentinel.allowKnockback);
addLineIfNeeded(paginator, "Run-Away Enabled", sentinel.runaway);
addLineIfNeeded(paginator, "Squad", (sentinel.squad == null ? "" : sentinel.squad));
addLineIfNeeded(paginator, "Spawnpoint", (sentinel.spawnPoint == null ? "" : sentinel.spawnPoint.toVector().toBlockVector().toString()));
addLineIfNeeded(paginator, "Per-weapon damage values", sentinel.weaponDamage.toString());
addLineIfNeeded(paginator, "Weapon redirections", sentinel.weaponRedirects.toString());
addLineIfNeeded(paginator, "Drops", sentinel.drops == null ? "" : sentinel.drops.size());
addLineIfNeeded(paginator, "Death XP", sentinel.deathXP);
if (SentinelPlugin.instance.hasWorldGuard) {
addLineIfNeeded(paginator, "WorldGuard region limit", sentinel.worldguardRegion);
}
int page = 1;
if (args.argsLength() == 2) {
try {
page = args.getInteger(1);
} catch (NumberFormatException ex) {
sender.sendMessage(SentinelCommand.prefixBad + "First argument must be a valid page number.");
}
}
paginator.sendPage(sender, page);
}
Aggregations