mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Lets update signs and heads in hard way and lets make it more optimized
This commit is contained in:
parent
84681df41a
commit
c3ccf30b6d
@ -3,19 +3,24 @@ package com.gamingmesh.jobs.Signs;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Skull;
|
import org.bukkit.block.Skull;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||||
import com.gamingmesh.jobs.config.CommentedYamlConfiguration;
|
import com.gamingmesh.jobs.config.CommentedYamlConfiguration;
|
||||||
import com.gamingmesh.jobs.container.TopList;
|
import com.gamingmesh.jobs.container.TopList;
|
||||||
|
import com.gamingmesh.jobs.stuff.Debug;
|
||||||
|
|
||||||
public class SignUtil {
|
public class SignUtil {
|
||||||
|
|
||||||
@ -32,9 +37,9 @@ public class SignUtil {
|
|||||||
|
|
||||||
// Sign file
|
// Sign file
|
||||||
public void LoadSigns() {
|
public void LoadSigns() {
|
||||||
// Boolean false does not create a file
|
// Boolean false does not create a file
|
||||||
if (!Jobs.getGCManager().SignsEnabled)
|
if (!Jobs.getGCManager().SignsEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Signs.GetAllSigns().clear();
|
Signs.GetAllSigns().clear();
|
||||||
File file = new File(plugin.getDataFolder(), "Signs.yml");
|
File file = new File(plugin.getDataFolder(), "Signs.yml");
|
||||||
@ -65,8 +70,8 @@ public class SignUtil {
|
|||||||
|
|
||||||
// Signs save file
|
// Signs save file
|
||||||
public void saveSigns() {
|
public void saveSigns() {
|
||||||
if (!Jobs.getGCManager().SignsEnabled)
|
if (!Jobs.getGCManager().SignsEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
File f = new File(plugin.getDataFolder(), "Signs.yml");
|
File f = new File(plugin.getDataFolder(), "Signs.yml");
|
||||||
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
|
YamlConfiguration conf = YamlConfiguration.loadConfiguration(f);
|
||||||
@ -99,148 +104,184 @@ public class SignUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean SignUpdate(String JobName) {
|
public boolean SignUpdate(String JobName) {
|
||||||
if (!Jobs.getGCManager().SignsEnabled)
|
if (!Jobs.getGCManager().SignsEnabled)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
List<com.gamingmesh.jobs.Signs.Sign> Copy = new ArrayList<>(Signs.GetAllSigns().size());
|
|
||||||
for (com.gamingmesh.jobs.Signs.Sign foo : Signs.GetAllSigns()) {
|
|
||||||
Copy.add(foo);
|
|
||||||
}
|
|
||||||
int timelapse = 1;
|
int timelapse = 1;
|
||||||
for (com.gamingmesh.jobs.Signs.Sign one : Copy) {
|
|
||||||
|
List<TopList> PlayerList = new ArrayList<>();
|
||||||
|
|
||||||
|
if (JobName.equalsIgnoreCase("gtoplist"))
|
||||||
|
PlayerList = Jobs.getJobsDAO().getGlobalTopList(0);
|
||||||
|
|
||||||
|
for (com.gamingmesh.jobs.Signs.Sign one : new ArrayList<>(Signs.GetAllSigns())) {
|
||||||
String SignJobName = one.GetJobName();
|
String SignJobName = one.GetJobName();
|
||||||
|
|
||||||
if (JobName.equalsIgnoreCase(SignJobName)) {
|
if (!JobName.equalsIgnoreCase(SignJobName))
|
||||||
String SignsWorld = one.GetWorld();
|
continue;
|
||||||
double SignsX = one.GetX();
|
|
||||||
double SignsY = one.GetY();
|
|
||||||
double SignsZ = one.GetZ();
|
|
||||||
int number = one.GetNumber() - 1;
|
|
||||||
|
|
||||||
List<TopList> PlayerList = new ArrayList<>();
|
World world = Bukkit.getWorld(one.GetWorld());
|
||||||
if (!JobName.equalsIgnoreCase("gtoplist")) {
|
if (world == null)
|
||||||
PlayerList = Jobs.getJobsDAO().toplist(SignJobName, number);
|
continue;
|
||||||
} else {
|
|
||||||
PlayerList = Jobs.getJobsDAO().getGlobalTopList(number);
|
|
||||||
}
|
|
||||||
if (PlayerList.size() != 0) {
|
|
||||||
World world = Bukkit.getWorld(SignsWorld);
|
|
||||||
if (world == null)
|
|
||||||
continue;
|
|
||||||
Location nloc = new Location(world, SignsX, SignsY, SignsZ);
|
|
||||||
Block block = nloc.getBlock();
|
|
||||||
if (!(block.getState() instanceof org.bukkit.block.Sign)) {
|
|
||||||
Signs.GetAllSigns().remove(one);
|
|
||||||
saveSigns();
|
|
||||||
} else {
|
|
||||||
org.bukkit.block.Sign sign = (org.bukkit.block.Sign) block.getState();
|
|
||||||
if (!one.isSpecial()) {
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
if (i >= PlayerList.size())
|
|
||||||
break;
|
|
||||||
String PlayerName = PlayerList.get(i).getPlayerName();
|
|
||||||
|
|
||||||
if (PlayerName != null && PlayerName.length() > 8) {
|
double SignsX = one.GetX();
|
||||||
String PlayerNameStrip = PlayerName.split("(?<=\\G.{7})")[0];
|
double SignsY = one.GetY();
|
||||||
PlayerName = PlayerNameStrip + "~";
|
double SignsZ = one.GetZ();
|
||||||
}
|
int number = one.GetNumber() - 1;
|
||||||
|
|
||||||
if (PlayerName == null)
|
if (!JobName.equalsIgnoreCase("gtoplist")) {
|
||||||
PlayerName = "Unknown";
|
PlayerList = Jobs.getJobsDAO().toplist(SignJobName, number);
|
||||||
|
|
||||||
String line = Jobs.getLanguage().getMessage("signs.List");
|
|
||||||
line = line.replace("[number]", String.valueOf(i + number + 1));
|
|
||||||
line = line.replace("[player]", PlayerName);
|
|
||||||
line = line.replace("[level]", String.valueOf(PlayerList.get(i).getLevel()));
|
|
||||||
|
|
||||||
sign.setLine(i, line);
|
|
||||||
}
|
|
||||||
sign.update();
|
|
||||||
UpdateHead(sign, PlayerList.get(0).getPlayerName(), timelapse);
|
|
||||||
} else {
|
|
||||||
String PlayerName = PlayerList.get(0).getPlayerName();
|
|
||||||
if (PlayerName.length() > 8) {
|
|
||||||
String PlayerNameStrip = PlayerName.split("(?<=\\G.{7})")[0];
|
|
||||||
PlayerName = PlayerNameStrip + "~";
|
|
||||||
}
|
|
||||||
String line1 = Jobs.getLanguage().getMessage("signs.SpecialList.p" + one.GetNumber(),
|
|
||||||
"[number]", one.GetNumber() + number + 1,
|
|
||||||
"[player]", PlayerName,
|
|
||||||
"[level]", PlayerList.get(0).getLevel(),
|
|
||||||
"[job]", JobName);
|
|
||||||
|
|
||||||
sign.setLine(0, line1);
|
|
||||||
|
|
||||||
line1 = Jobs.getLanguage().getMessage("signs.SpecialList.name",
|
|
||||||
"[number]", one.GetNumber() + number + 1,
|
|
||||||
"[player]", PlayerName,
|
|
||||||
"[level]", PlayerList.get(0).getLevel(),
|
|
||||||
"[job]", JobName);
|
|
||||||
|
|
||||||
sign.setLine(1, line1);
|
|
||||||
|
|
||||||
line1 = Jobs.getLanguage().getMessage("signs.SpecialList.level",
|
|
||||||
"[number]", one.GetNumber() + number + 1,
|
|
||||||
"[player]", PlayerName,
|
|
||||||
"[level]", PlayerList.get(0).getLevel(),
|
|
||||||
"[job]", JobName);
|
|
||||||
|
|
||||||
sign.setLine(2, line1);
|
|
||||||
|
|
||||||
line1 = Jobs.getLanguage().getMessage("signs.SpecialList.bottom",
|
|
||||||
"[number]", one.GetNumber() + number + 1,
|
|
||||||
"[player]", PlayerName,
|
|
||||||
"[level]", PlayerList.get(0).getLevel(),
|
|
||||||
"[job]", JobName);
|
|
||||||
|
|
||||||
sign.setLine(3, line1);
|
|
||||||
sign.update();
|
|
||||||
UpdateHead(sign, PlayerList.get(0).getPlayerName(), timelapse);
|
|
||||||
}
|
|
||||||
|
|
||||||
timelapse++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PlayerList.isEmpty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Location nloc = new Location(world, SignsX, SignsY, SignsZ);
|
||||||
|
Block block = nloc.getBlock();
|
||||||
|
if (!(block.getState() instanceof org.bukkit.block.Sign)) {
|
||||||
|
Signs.GetAllSigns().remove(one);
|
||||||
|
saveSigns();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
org.bukkit.block.Sign sign = (org.bukkit.block.Sign) block.getState();
|
||||||
|
if (!one.isSpecial()) {
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
if (i >= PlayerList.size())
|
||||||
|
break;
|
||||||
|
String PlayerName = PlayerList.get(i).getPlayerName();
|
||||||
|
|
||||||
|
if (PlayerName != null && PlayerName.length() > 8) {
|
||||||
|
String PlayerNameStrip = PlayerName.split("(?<=\\G.{7})")[0];
|
||||||
|
PlayerName = PlayerNameStrip + "~";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PlayerName == null)
|
||||||
|
PlayerName = "Unknown";
|
||||||
|
|
||||||
|
String line = Jobs.getLanguage().getMessage("signs.List");
|
||||||
|
line = line.replace("[number]", String.valueOf(i + number + 1));
|
||||||
|
line = line.replace("[player]", PlayerName);
|
||||||
|
line = line.replace("[level]", String.valueOf(PlayerList.get(i).getLevel()));
|
||||||
|
|
||||||
|
sign.setLine(i, line);
|
||||||
|
}
|
||||||
|
sign.update();
|
||||||
|
if (!UpdateHead(sign, PlayerList.get(0).getPlayerName(), timelapse))
|
||||||
|
timelapse--;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
TopList pl = PlayerList.get(one.GetNumber() - 1);
|
||||||
|
|
||||||
|
String PlayerName = pl.getPlayerName();
|
||||||
|
|
||||||
|
if (PlayerName.length() > 8) {
|
||||||
|
String PlayerNameStrip = PlayerName.split("(?<=\\G.{7})")[0];
|
||||||
|
PlayerName = PlayerNameStrip + "~";
|
||||||
|
}
|
||||||
|
String line1 = Jobs.getLanguage().getMessage("signs.SpecialList.p" + one.GetNumber(),
|
||||||
|
"[number]", one.GetNumber() + number + 1,
|
||||||
|
"[player]", PlayerName,
|
||||||
|
"[level]", pl.getLevel(),
|
||||||
|
"[job]", JobName);
|
||||||
|
|
||||||
|
sign.setLine(0, line1);
|
||||||
|
|
||||||
|
line1 = Jobs.getLanguage().getMessage("signs.SpecialList.name",
|
||||||
|
"[number]", one.GetNumber() + number + 1,
|
||||||
|
"[player]", PlayerName,
|
||||||
|
"[level]", pl.getLevel(),
|
||||||
|
"[job]", JobName);
|
||||||
|
|
||||||
|
sign.setLine(1, line1);
|
||||||
|
|
||||||
|
line1 = Jobs.getLanguage().getMessage("signs.SpecialList.level",
|
||||||
|
"[number]", one.GetNumber() + number + 1,
|
||||||
|
"[player]", PlayerName,
|
||||||
|
"[level]", pl.getLevel(),
|
||||||
|
"[job]", JobName);
|
||||||
|
|
||||||
|
sign.setLine(2, line1);
|
||||||
|
|
||||||
|
line1 = Jobs.getLanguage().getMessage("signs.SpecialList.bottom",
|
||||||
|
"[number]", one.GetNumber() + number + 1,
|
||||||
|
"[player]", PlayerName,
|
||||||
|
"[level]", pl.getLevel(),
|
||||||
|
"[job]", JobName);
|
||||||
|
|
||||||
|
sign.setLine(3, line1);
|
||||||
|
sign.update();
|
||||||
|
|
||||||
|
if (!UpdateHead(sign, PlayerName, timelapse))
|
||||||
|
timelapse--;
|
||||||
|
}
|
||||||
|
|
||||||
|
timelapse++;
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateHead(final org.bukkit.block.Sign sign, final String Playername, final int timelapse) {
|
public boolean UpdateHead(final org.bukkit.block.Sign sign, final String Playername, int timelapse) {
|
||||||
|
try {
|
||||||
|
timelapse = timelapse < 1 ? 1 : timelapse;
|
||||||
|
org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) sign.getData();
|
||||||
|
BlockFace directionFacing = signMat.getFacing();
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
final Location loc = sign.getLocation().clone();
|
||||||
@Override
|
loc.add(0, 1, 0);
|
||||||
public void run() {
|
|
||||||
|
|
||||||
org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) sign.getData();
|
if (Playername == null)
|
||||||
BlockFace directionFacing = signMat.getFacing();
|
return false;
|
||||||
|
|
||||||
Location loc = sign.getLocation().clone();
|
Block block = loc.getBlock();
|
||||||
loc.add(0, 1, 0);
|
|
||||||
|
|
||||||
if (Playername == null)
|
if (block == null || !(block.getState() instanceof Skull))
|
||||||
|
loc.add(directionFacing.getOppositeFace().getModX(), 0, directionFacing.getOppositeFace().getModZ());
|
||||||
|
|
||||||
|
block = loc.getBlock();
|
||||||
|
|
||||||
|
if (block == null || !(block.getState() instanceof Skull))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Skull skull = (Skull) block.getState();
|
||||||
|
|
||||||
|
if (skull == null)
|
||||||
|
return false;
|
||||||
|
if (skull.getOwner() != null && skull.getOwner().equalsIgnoreCase(Playername))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
Block b = loc.getBlock();
|
||||||
|
final Material type = b.getType();
|
||||||
|
final BlockData data = b.getBlockData();
|
||||||
|
|
||||||
|
b.setType(Material.AIR);
|
||||||
|
|
||||||
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Block b = loc.getBlock();
|
||||||
|
|
||||||
|
b.setType(type);
|
||||||
|
b.setBlockData(data);
|
||||||
|
Skull skull = (Skull) b.getState();
|
||||||
|
if (skull == null)
|
||||||
|
return;
|
||||||
|
skull.setOwner(Playername);
|
||||||
|
skull.update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}, 1L);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
Block block = loc.getBlock();
|
}, timelapse * Jobs.getGCManager().InfoUpdateInterval * 20L);
|
||||||
|
} catch (Exception | Error e) {
|
||||||
if (block == null || !(block.getState() instanceof Skull))
|
e.printStackTrace();
|
||||||
loc.add(directionFacing.getOppositeFace().getModX(), 0, directionFacing.getOppositeFace().getModZ());
|
}
|
||||||
|
return true;
|
||||||
block = loc.getBlock();
|
|
||||||
|
|
||||||
if (block == null || !(block.getState() instanceof Skull))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Skull skull = (Skull) block.getState();
|
|
||||||
|
|
||||||
if (skull == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
skull.setOwner(Playername);
|
|
||||||
skull.update();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}, timelapse * Jobs.getGCManager().InfoUpdateInterval * 20L);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ public class LanguageManager {
|
|||||||
|
|
||||||
c.get("command.give.help.info", "Gives item by jobs name and item category name. Player name is optional");
|
c.get("command.give.help.info", "Gives item by jobs name and item category name. Player name is optional");
|
||||||
c.get("command.give.help.args", "[playername] [jobname] [items/limiteditems] [jobitemname]");
|
c.get("command.give.help.args", "[playername] [jobname] [items/limiteditems] [jobitemname]");
|
||||||
Jobs.getGCManager().commandArgs.put("give", Arrays.asList("[playername]", "[jobname]", "[jobitemname]"));
|
Jobs.getGCManager().commandArgs.put("give", Arrays.asList("[playername]", "[jobname]%%[jobitemname]", "[jobitemname]"));
|
||||||
c.get("command.give.output.notonline", "&4Player [%playername%] is not online!");
|
c.get("command.give.output.notonline", "&4Player [%playername%] is not online!");
|
||||||
c.get("command.give.output.noitem", "&4Can't find any item by given name!");
|
c.get("command.give.output.noitem", "&4Can't find any item by given name!");
|
||||||
|
|
||||||
|
@ -51,73 +51,80 @@ public class TabComplete implements TabCompleter {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
String arg = ArgsList.get(i - 1);
|
String arg = ArgsList.get(i - 1);
|
||||||
List<String> temp = new ArrayList<>();
|
List<String> t2 = new ArrayList<>();
|
||||||
|
|
||||||
if (arg.contains("%%"))
|
if (arg.contains("%%"))
|
||||||
for (String one : arg.split("%%")) {
|
for (String one : arg.split("%%")) {
|
||||||
temp.add(one);
|
t2.add(one);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
t2.add(arg);
|
||||||
|
|
||||||
switch (arg) {
|
List<String> temp = new ArrayList<>();
|
||||||
case "[jobname]":
|
for (String ar : t2) {
|
||||||
List<Job> Jobsai = Jobs.getJobs();
|
switch (ar) {
|
||||||
for (Job one : Jobsai) {
|
case "[jobname]":
|
||||||
temp.add(one.getName());
|
List<Job> Jobsai = Jobs.getJobs();
|
||||||
}
|
for (Job one : Jobsai) {
|
||||||
break;
|
temp.add(one.getName());
|
||||||
case "[playername]":
|
}
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
break;
|
||||||
temp.add(player.getName());
|
case "[playername]":
|
||||||
}
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
break;
|
temp.add(player.getName());
|
||||||
case "[action]":
|
}
|
||||||
for (ActionType action : ActionType.values()) {
|
break;
|
||||||
temp.add(action.getName());
|
case "[action]":
|
||||||
}
|
for (ActionType action : ActionType.values()) {
|
||||||
break;
|
temp.add(action.getName());
|
||||||
case "[jobitemname]":
|
}
|
||||||
if (args[3].equals("items")) {
|
break;
|
||||||
|
case "[jobitemname]":
|
||||||
for (Entry<String, JobItems> one : ItemBoostManager.getItems().entrySet()) {
|
for (Entry<String, JobItems> one : ItemBoostManager.getItems().entrySet()) {
|
||||||
temp.add(one.getValue().getNode());
|
temp.add(one.getValue().getNode());
|
||||||
}
|
}
|
||||||
} else if (args[3].equals("limiteditems")) {
|
if (args.length > 3 && args[3].equals("limiteditems")) {
|
||||||
Job oneJob = Jobs.getJob(args[i - 1]);
|
Job oneJob = Jobs.getJob(args[i - 1]);
|
||||||
if (oneJob != null)
|
if (oneJob != null)
|
||||||
if (args[3].equals("limiteditems")) {
|
if (args[3].equals("limiteditems")) {
|
||||||
for (Entry<String, JobLimitedItems> limitedItem : oneJob.getLimitedItems().entrySet()) {
|
for (Entry<String, JobLimitedItems> limitedItem : oneJob.getLimitedItems().entrySet()) {
|
||||||
temp.add(limitedItem.getValue().getNode());
|
temp.add(limitedItem.getValue().getNode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "[boosteditems]":
|
|
||||||
for (Entry<String, JobItems> one : ItemBoostManager.getItems().entrySet()) {
|
|
||||||
temp.add(one.getValue().getNode());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "[oldjob]":
|
|
||||||
JobsPlayer onePlayerJob = Jobs.getPlayerManager().getJobsPlayer(args[i - 1]);
|
|
||||||
if (onePlayerJob != null)
|
|
||||||
for (JobProgression oneOldJob : onePlayerJob.getJobProgression()) {
|
|
||||||
temp.add(oneOldJob.getJob().getName());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "[oldplayerjob]":
|
case "[boosteditems]":
|
||||||
if (sender instanceof Player) {
|
for (Entry<String, JobItems> one : ItemBoostManager.getItems().entrySet()) {
|
||||||
onePlayerJob = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
temp.add(one.getValue().getNode());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "[oldjob]":
|
||||||
|
JobsPlayer onePlayerJob = Jobs.getPlayerManager().getJobsPlayer(args[i - 1]);
|
||||||
if (onePlayerJob != null)
|
if (onePlayerJob != null)
|
||||||
for (JobProgression oneOldJob : onePlayerJob.getJobProgression()) {
|
for (JobProgression oneOldJob : onePlayerJob.getJobProgression()) {
|
||||||
temp.add(oneOldJob.getJob().getName());
|
temp.add(oneOldJob.getJob().getName());
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case "[oldplayerjob]":
|
||||||
case "[newjob]":
|
if (sender instanceof Player) {
|
||||||
if (sender instanceof Player) {
|
onePlayerJob = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||||
for (Job job : Jobs.getJobs()) {
|
if (onePlayerJob != null)
|
||||||
temp.add(job.getName());
|
for (JobProgression oneOldJob : onePlayerJob.getJobProgression()) {
|
||||||
|
temp.add(oneOldJob.getJob().getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case "[newjob]":
|
||||||
|
if (sender instanceof Player) {
|
||||||
|
for (Job job : Jobs.getJobs()) {
|
||||||
|
temp.add(job.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
temp.add(ar);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StringUtil.copyPartialMatches(PartOfCommand, temp, completionList);
|
StringUtil.copyPartialMatches(PartOfCommand, temp, completionList);
|
||||||
|
Loading…
Reference in New Issue
Block a user