use of com.gamingmesh.jobs.container.JobsPlayer in project Jobs by GamingMesh.
the class JobsCommands method playerinfo.
@JobCommand
public boolean playerinfo(CommandSender sender, String[] args) {
if (args.length < 2) {
sendUsage(sender, "playerinfo");
sendValidActions(sender);
return true;
}
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(args[0]);
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayerOffline(offlinePlayer);
String jobName = args[1];
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(ChatColor.RED + Language.getMessage("command.error.job"));
return true;
}
String type = "";
if (args.length >= 3) {
type = args[2];
}
sender.sendMessage(jobInfoMessage(jPlayer, job, type).split("\n"));
return true;
}
use of com.gamingmesh.jobs.container.JobsPlayer in project Jobs by GamingMesh.
the class JobsCommands method stats.
@JobCommand
public boolean stats(CommandSender sender, String[] args) {
JobsPlayer jPlayer = null;
if (args.length >= 1) {
if (!sender.hasPermission("jobs.command.admin.stats")) {
sender.sendMessage(ChatColor.RED + Language.getMessage("command.error.permission"));
return true;
}
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(args[0]);
jPlayer = Jobs.getPlayerManager().getJobsPlayerOffline(offlinePlayer);
} else if (sender instanceof Player) {
jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
}
if (jPlayer == null) {
sendUsage(sender, "stats");
return true;
}
if (jPlayer.getJobProgression().size() == 0) {
sender.sendMessage(Language.getMessage("command.stats.error.nojob"));
return true;
}
for (JobProgression jobProg : jPlayer.getJobProgression()) {
sender.sendMessage(jobStatsMessage(jobProg).split("\n"));
}
return true;
}
use of com.gamingmesh.jobs.container.JobsPlayer in project Jobs by GamingMesh.
the class JobsCommands method promote.
@JobCommand
public boolean promote(CommandSender sender, String[] args) {
if (args.length < 3) {
sendUsage(sender, "promote");
return true;
}
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(args[0]);
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayerOffline(offlinePlayer);
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(ChatColor.RED + Language.getMessage("command.error.job"));
return true;
}
try {
// check if player already has the job
if (jPlayer.isInJob(job)) {
Integer levelsGained = Integer.parseInt(args[2]);
Jobs.getPlayerManager().promoteJob(jPlayer, job, levelsGained);
Player player = Bukkit.getServer().getPlayer(offlinePlayer.getUniqueId());
if (player != null) {
String message = Language.getMessage("command.promote.output.target");
message = message.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE);
message = message.replace("%levelsgained%", Integer.valueOf(levelsGained).toString());
player.sendMessage(message);
}
sender.sendMessage(Language.getMessage("command.admin.success"));
}
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + Language.getMessage("command.admin.error"));
}
return true;
}
Aggregations