2016-03-30 15:42:36 +02:00
|
|
|
package com.gamingmesh.jobs.commands.list;
|
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.OfflinePlayer;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
|
|
|
|
import com.gamingmesh.jobs.Jobs;
|
|
|
|
import com.gamingmesh.jobs.JobsPlugin;
|
|
|
|
import com.gamingmesh.jobs.commands.Cmd;
|
|
|
|
import com.gamingmesh.jobs.commands.JobCommand;
|
|
|
|
import com.gamingmesh.jobs.container.Job;
|
|
|
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
|
|
|
import com.gamingmesh.jobs.stuff.ChatColor;
|
|
|
|
|
|
|
|
public class playerinfo implements Cmd {
|
|
|
|
|
2016-06-25 17:56:59 +02:00
|
|
|
@Override
|
2016-03-30 15:42:36 +02:00
|
|
|
@JobCommand(1300)
|
|
|
|
public boolean perform(JobsPlugin plugin, final CommandSender sender, final String[] args) {
|
|
|
|
if (args.length < 2) {
|
|
|
|
Jobs.getCommandManager().sendUsage(sender, "playerinfo");
|
|
|
|
Jobs.getCommandManager().sendValidActions(sender);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
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 + Jobs.getLanguage().getMessage("general.error.job"));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
String type = "";
|
|
|
|
if (args.length >= 3) {
|
2016-06-27 16:37:31 +02:00
|
|
|
try {
|
|
|
|
Integer.parseInt(args[2]);
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
type = args[2];
|
|
|
|
}
|
2016-03-30 15:42:36 +02:00
|
|
|
}
|
2016-06-27 16:37:31 +02:00
|
|
|
|
|
|
|
int page = 1;
|
|
|
|
try {
|
|
|
|
page = Integer.parseInt(args[args.length - 1]);
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
}
|
|
|
|
|
|
|
|
Jobs.getCommandManager().jobInfoMessage(sender, jPlayer, job, type, page);
|
|
|
|
|
2016-03-30 15:42:36 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|