1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Let's clean up code

- We use the default colors from the lang file
- Fixed enchantments not working in GUI
- Fix BossBar console error message
- Now if the signs is enabled then use the command
- Fixed the place of brewing stand stayed when the player break, #205
- Now if the Signs.Enable boolean true, then only create a file
- Fixed version checker not working correctly
This commit is contained in:
montlikadani 2018-09-23 17:02:48 +02:00
parent 5a471f3e6e
commit ebc6c99dc2
46 changed files with 214 additions and 238 deletions

View File

@ -584,6 +584,9 @@ public class ItemManager {
}
public boolean isAlive() {
if (version.isLower(Version.v1_9_R1))
return true; // TODO: Fixing NullPointerException
return getType().isAlive();
}

View File

@ -151,7 +151,7 @@ public class GuiManager {
for (ActionType actionType : ActionType.values()) {
List<JobInfo> info = job.getJobInfo(actionType);
if (info != null && !info.isEmpty()) {
Lore.add(ChatColor.translateAlternateColorCodes('&', "&e" + Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase()
Lore.add(ChatColor.translateAlternateColorCodes('&', Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase()
+ ".info")));
}
}
@ -210,7 +210,7 @@ public class GuiManager {
continue;
ArrayList<String> Lore = new ArrayList<>();
Lore.add(ChatColor.translateAlternateColorCodes('&', "&e" + Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase()
Lore.add(ChatColor.translateAlternateColorCodes('&', Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase()
+ ".info")));
int y = 1;
for (int z = 0; z < info.size(); z++) {
@ -260,7 +260,7 @@ public class GuiManager {
GuiItem = job.getGuiItem();
Lore = new ArrayList<>();
Lore.add(ChatColor.translateAlternateColorCodes('&', "&e" + Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase()
Lore.add(ChatColor.translateAlternateColorCodes('&', Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase()
+ ".info")));
i++;
}

View File

@ -780,9 +780,6 @@ public class Jobs extends JavaPlugin {
YmlMaker jobConfig = new YmlMaker(this, "jobConfig.yml");
jobConfig.saveDefaultConfig();
YmlMaker jobSigns = new YmlMaker(this, "Signs.yml");
jobSigns.saveDefaultConfig();
YmlMaker jobSchedule = new YmlMaker(this, "schedule.yml");
jobSchedule.saveDefaultConfig();
@ -809,6 +806,11 @@ public class Jobs extends JavaPlugin {
startup();
if (GconfigManager.SignsEnabled) {
YmlMaker jobSigns = new YmlMaker(this, "Signs.yml");
jobSigns.saveDefaultConfig();
}
// register the listeners
getServer().getPluginManager().registerEvents(new JobsListener(this), this);
getServer().getPluginManager().registerEvents(new JobsPaymentListener(this), this);

View File

@ -3,9 +3,10 @@ package com.gamingmesh.jobs.MyPet;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.plugin.Plugin;
import com.gamingmesh.jobs.Jobs;
import de.Keyle.MyPet.MyPetApi;
import de.Keyle.MyPet.api.entity.MyPet;
import de.Keyle.MyPet.api.entity.MyPetBukkitEntity;
@ -53,7 +54,7 @@ public class MyPetManager {
mp = MyPetApi.getPlayerManager();
mppm = MyPetApi.getMyPetManager();
enabled = true;
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &6MyPet detected"));
Jobs.consoleMsg("&e[Jobs] &6MyPet detected");
}
}

View File

@ -1,7 +1,6 @@
package com.gamingmesh.jobs.MythicMobs;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity;
import org.bukkit.plugin.Plugin;
@ -48,13 +47,12 @@ public class MythicMobs2 implements MythicMobInterface {
Class.forName("net.elseland.xikage.MythicMobs.Mobs.MythicMob");
} catch (ClassNotFoundException e) {
// Disabling
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&',
"&e[Jobs] &6MythicMobs was found - &cBut your version is outdated, please update for full support."));
Jobs.consoleMsg("&e[Jobs] &6MythicMobs was found - &cBut your version is outdated, please update for full support.");
return false;
}
MMAPI = ((MythicMobs) mm).getAPI();
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &6MythicMobs2 was found - Enabling capabilities."));
Jobs.consoleMsg("&e[Jobs] &6MythicMobs2 was found - Enabling capabilities.");
return true;
}

View File

@ -65,6 +65,4 @@ public class MythicMobs2Listener implements Listener {
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent);
}
}

View File

@ -1,7 +1,6 @@
package com.gamingmesh.jobs.MythicMobs;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity;
import org.bukkit.plugin.Plugin;
@ -48,13 +47,12 @@ public class MythicMobs4 implements MythicMobInterface {
Class.forName("io.lumine.xikage.mythicmobs.MythicMobs");
} catch (ClassNotFoundException e) {
// Disabling
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&',
"&e[Jobs] &6MythicMobs was found - &cBut your version is outdated, please update for full support."));
Jobs.consoleMsg("&e[Jobs] &6MythicMobs was found - &cBut your version is outdated, please update for full support.");
return false;
}
MMAPI = ((MythicMobs) mm).getAPIHelper();
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &6MythicMobs4 was found - Enabling capabilities."));
Jobs.consoleMsg("&e[Jobs] &6MythicMobs4 was found - Enabling capabilities.");
return true;
}

View File

@ -66,6 +66,4 @@ public class MythicMobs4Listener implements Listener {
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent);
}
}

View File

@ -28,7 +28,6 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
@ -556,10 +555,10 @@ public class PlayerManager {
else
message = Jobs.getLanguage().getMessage("message.levelup.nobroadcast");
message = message.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE);
message = message.replace("%jobname%", job.getChatColor() + job.getName());
if (levelUpEvent.getOldTitle() != null)
message = message.replace("%titlename%", levelUpEvent.getOldTitleColor() + levelUpEvent.getOldTitleName() + ChatColor.WHITE);
message = message.replace("%titlename%", levelUpEvent.getOldTitleColor() + levelUpEvent.getOldTitleName());
if (player != null)
message = message.replace("%playername%", player.getDisplayName());
@ -604,8 +603,8 @@ public class PlayerManager {
else
message = message.replace("%playername%", jPlayer.getUserName());
message = message.replace("%titlename%", levelUpEvent.getNewTitleColor() + levelUpEvent.getNewTitleName() + ChatColor.WHITE);
message = message.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE);
message = message.replace("%titlename%", levelUpEvent.getNewTitleColor() + levelUpEvent.getNewTitleName());
message = message.replace("%jobname%", job.getChatColor() + job.getName());
for (String line : message.split("\n")) {
if (Jobs.getGCManager().isBroadcastingSkillups())
Bukkit.getServer().broadcastMessage(line);

View File

@ -335,7 +335,7 @@ public class JobsCommands implements CommandExecutor {
public void jobInfoMessage(CommandSender sender, JobsPlayer player, Job job, String type, int page) {
if (job == null) {
// job doesn't exist
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return;
}
@ -356,20 +356,20 @@ public class JobsCommands implements CommandExecutor {
}
if (job.getBoost().get(CurrencyType.EXP) != 0D)
message.add(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.expboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.EXP)) + 1));
message.add(Jobs.getLanguage().getMessage("command.expboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.EXP)) + 1));
if (job.getBoost().get(CurrencyType.MONEY) != 0D)
message.add(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.moneyboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.MONEY)) + 1));
message.add(Jobs.getLanguage().getMessage("command.moneyboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.MONEY)) + 1));
if (job.getBoost().get(CurrencyType.POINTS) != 0D)
message.add(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.pointboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.POINTS)) + 1));
message.add(Jobs.getLanguage().getMessage("command.pointboost.output.infostats", "%boost%", (job.getBoost().get(CurrencyType.POINTS)) + 1));
if (Jobs.getGCManager().useDynamicPayment) {
if ((int) (job.getBonus() * 100) / 100.0 != 0) {
if ((int) (job.getBonus() * 100) / 100.0 < 0) {
message.add(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.info.help.penalty", "[penalty]", (int) (job.getBonus() * 100) / 100.0 * -1));
message.add(Jobs.getLanguage().getMessage("command.info.help.penalty", "[penalty]", (int) (job.getBonus() * 100) / 100.0 * -1));
} else {
message.add(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.info.help.bonus", "[bonus]", (int) (job.getBonus() * 100) / 100.0));
message.add(Jobs.getLanguage().getMessage("command.info.help.bonus", "[bonus]", (int) (job.getBonus() * 100) / 100.0));
}
}
}
@ -385,7 +385,7 @@ public class JobsCommands implements CommandExecutor {
message.add(m);
} else if (showAllTypes == 0) {
String myMessage = Jobs.getLanguage().getMessage("command.info.output." + actionType.getName().toLowerCase() + ".none");
myMessage = myMessage.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE);
myMessage = myMessage.replace("%jobname%", job.getChatColor() + job.getName());
message.add(myMessage);
}
}
@ -499,7 +499,7 @@ public class JobsCommands implements CommandExecutor {
public String jobStatsMessage(JobProgression jobProg) {
String message = Jobs.getLanguage().getMessage("command.stats.output",
"%joblevel%", jobProg.getLevel(),
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName() + ChatColor.WHITE,
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),
"%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0,
"%jobmaxxp%", jobProg.getMaxExperience());
return " " + jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience()) + " " + message;
@ -537,7 +537,7 @@ public class JobsCommands implements CommandExecutor {
int exp = jPlayer.getExpAfterRejoin(jobProg, jPlayer.getLevelAfterRejoin(jobProg));
String message = Jobs.getLanguage().getMessage("command.stats.output",
"%joblevel%", level,
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName() + ChatColor.WHITE,
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),
"%jobxp%", Math.round(exp * 100.0) / 100.0,
"%jobmaxxp%", jobProg.getMaxExperience(level));
return " " + jobProgressMessage(jobProg.getMaxExperience(level), exp) + " " + message;

View File

@ -46,7 +46,7 @@ public class archive implements Cmd {
for (JobProgression jobInfo : AllJobs) {
RawMessage rm = new RawMessage();
if (jobInfo.canRejoin())
rm.add(ChatColor.GREEN + "+" + Jobs.getCommandManager().jobStatsMessageArchive(jPlayer, jobInfo), "Click to rejoin this job", "jobs join " + jobInfo.getJob().getName());
rm.add(ChatColor.GREEN + "+" + Jobs.getCommandManager().jobStatsMessageArchive(jPlayer, jobInfo), Jobs.getLanguage().getMessage("command.join.rejoin"), "jobs join " + jobInfo.getJob().getName());
else
rm.add(ChatColor.RED + "-" + Jobs.getCommandManager().jobStatsMessageArchive(jPlayer, jobInfo), Jobs.getLanguage().getMessage("command.join.error.rejoin", "[time]", jobInfo
.getRejoinTimeMessage()));

View File

@ -25,7 +25,7 @@ public class browse implements Cmd {
List<Job> jobList = new ArrayList<>(Jobs.getJobs());
if (jobList.size() == 0) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.browse.error.nojobs"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs"));
return true;
}
@ -219,7 +219,7 @@ public class browse implements Cmd {
}
if (lines.size() == 0) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.browse.error.nojobs"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.error.nojobs"));
return true;
}

View File

@ -12,7 +12,6 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.Convert;
import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
import com.gamingmesh.jobs.stuff.ChatColor;
public class convert implements Cmd {
@ -36,7 +35,7 @@ public class convert implements Cmd {
archivelist = Jobs.getJobsDAO().convertDatabase("archive");
} catch (SQLException e) {
e.printStackTrace();
sender.sendMessage(ChatColor.RED + "Can't read data from data base, please send error log to dev's.");
Jobs.consoleMsg("&cCan't write data to data base, please send error log to dev's.");
return true;
}

View File

@ -8,7 +8,6 @@ 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 employ implements Cmd {
@ -24,7 +23,7 @@ public class employ implements Cmd {
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
@ -35,9 +34,7 @@ public class employ implements Cmd {
if (jPlayer.isInJob(job)) {
// already in job message
String message = ChatColor.RED + Jobs.getLanguage().getMessage("command.employ.error.alreadyin", "%jobname%", job.getChatColor() + job.getName()
+ ChatColor.RED);
sender.sendMessage(message);
sender.sendMessage(Jobs.getLanguage().getMessage("command.employ.error.alreadyin", "%jobname%", job.getChatColor() + job.getName()));
return true;
}
try {
@ -45,11 +42,11 @@ public class employ implements Cmd {
Jobs.getPlayerManager().joinJob(jPlayer, job);
Player player = jPlayer.getPlayer();
if (player != null)
player.sendMessage(Jobs.getLanguage().getMessage("command.employ.output.target", "%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE));
player.sendMessage(Jobs.getLanguage().getMessage("command.employ.output.target", "%jobname%", job.getChatColor() + job.getName()));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
}
return true;
}

View File

@ -1,6 +1,5 @@
package com.gamingmesh.jobs.commands.list;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import com.gamingmesh.jobs.Jobs;
@ -43,7 +42,7 @@ public class entitylist implements Cmd {
msg += type.name().toLowerCase();
}
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
sender.sendMessage(org.bukkit.ChatColor.translateAlternateColorCodes('&', msg));
return true;
}

View File

@ -9,7 +9,6 @@ import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.ChatColor;
public class exp implements Cmd {
@ -67,7 +66,7 @@ public class exp implements Cmd {
}
if (job == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
@ -96,7 +95,7 @@ public class exp implements Cmd {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
}
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
}
return true;
}

View File

@ -7,7 +7,6 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.stuff.ChatColor;
public class expboost implements Cmd {
@ -41,7 +40,7 @@ public class expboost implements Cmd {
for (Job one : Jobs.getJobs()) {
one.addBoost(CurrencyType.EXP, 1.0);
}
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.allreset"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.allreset"));
return true;
} else if (args[0].equalsIgnoreCase("reset")) {
boolean found = false;
@ -54,7 +53,7 @@ public class expboost implements Cmd {
}
if (found) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.expboost.output.jobsboostreset", "%jobname%", job.getName()));
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.jobsboostreset", "%jobname%", job.getName()));
return true;
}
}
@ -65,15 +64,15 @@ public class expboost implements Cmd {
one.addBoost(CurrencyType.EXP, rate);
}
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
return true;
}
if (job == null) {
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.EXP, rate);
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
return true;
}
}

View File

@ -11,7 +11,6 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.ExploreChunk;
import com.gamingmesh.jobs.container.ExploreRegion;
import com.gamingmesh.jobs.stuff.ChatColor;
public class explored implements Cmd {
@ -29,7 +28,7 @@ public class explored implements Cmd {
HashMap<String, ExploreRegion> worlds = Jobs.getExplore().getWorlds();
if (!worlds.containsKey(world.getName())) {
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
return false;
}
@ -38,16 +37,16 @@ public class explored implements Cmd {
ExploreChunk chunk = regions.getChunk(player.getLocation().getChunk());
if (chunk == null) {
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.explored.error.noexplore"));
return false;
}
int i = 0;
for (String one : chunk.getPlayers()) {
i++;
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.explored.list", "%place%", i, "%playername%", one));
sender.sendMessage(Jobs.getLanguage().getMessage("command.explored.list", "%place%", i, "%playername%", one));
}
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.info.separator"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
return true;
}

View File

@ -8,7 +8,6 @@ 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 fire implements Cmd {
@ -24,7 +23,7 @@ public class fire implements Cmd {
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
@ -34,21 +33,19 @@ public class fire implements Cmd {
}
if (!jPlayer.isInJob(job)) {
String message = ChatColor.RED + Jobs.getLanguage().getMessage("command.fire.error.nojob", "%jobname%", job.getChatColor() + job.getName() + ChatColor.RED);
sender.sendMessage(message);
sender.sendMessage(Jobs.getLanguage().getMessage("command.fire.error.nojob", "%jobname%", job.getChatColor() + job.getName()));
return true;
}
try {
Jobs.getPlayerManager().leaveJob(jPlayer, job);
Player player = jPlayer.getPlayer();
if (player != null) {
String message = Jobs.getLanguage().getMessage("command.fire.output.target", "%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE);
player.sendMessage(message);
player.sendMessage(Jobs.getLanguage().getMessage("command.fire.output.target", "%jobname%", job.getChatColor() + job.getName()));
}
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
}
return true;
}

View File

@ -10,7 +10,6 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.ChatColor;
public class fireall implements Cmd {
@ -42,7 +41,7 @@ public class fireall implements Cmd {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
}
return true;
}

View File

@ -9,7 +9,6 @@ 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 grantxp implements Cmd {
@ -25,18 +24,18 @@ public class grantxp implements Cmd {
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
double xpGained;
try {
xpGained = Double.parseDouble(args[2]);
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
return true;
}
if (xpGained <= 0) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
return true;
}
@ -52,7 +51,7 @@ public class grantxp implements Cmd {
Player player = jPlayer.getPlayer();
if (player != null) {
String message = Jobs.getLanguage().getMessage("command.grantxp.output.target",
"%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE,
"%jobname%", job.getChatColor() + job.getName(),
"%xpgained%", xpGained);
player.sendMessage(message);
}

View File

@ -11,7 +11,6 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.RawMessage;
public class gtop implements Cmd {
@ -49,7 +48,7 @@ public class gtop implements Cmd {
List<TopList> FullList = Jobs.getJobsDAO().getGlobalTopList(st);
if (FullList.size() <= 0) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.gtop.error.nojob"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.gtop.error.nojob"));
return true;
}

View File

@ -8,7 +8,6 @@ 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 info implements Cmd {
@ -32,13 +31,13 @@ public class info implements Cmd {
String jobName = args[0];
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
if (Jobs.getGCManager().hideJobsInfoWithoutPermission)
if (!Jobs.getCommandManager().hasJobPermission(pSender, job)) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.permission"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission"));
return true;
}

View File

@ -10,7 +10,6 @@ import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.RawMessage;
public class join implements Cmd {
@ -40,27 +39,27 @@ public class join implements Cmd {
Job job = Jobs.getJob(jobName);
if (job == null) {
// job does not exist
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
if (!Jobs.getCommandManager().hasJobPermission(pSender, job)) {
// you do not have permission to join the job
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.permission"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission"));
return true;
}
if (jPlayer.isInJob(job)) {
// already in job message
String message = ChatColor.RED + Jobs.getLanguage().getMessage("command.join.error.alreadyin");
message = message.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.RED);
String message = Jobs.getLanguage().getMessage("command.join.error.alreadyin");
message = message.replace("%jobname%", job.getChatColor() + job.getName());
sender.sendMessage(message);
return true;
}
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
String message = ChatColor.RED + Jobs.getLanguage().getMessage("command.join.error.fullslots");
message = message.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.RED);
String message = Jobs.getLanguage().getMessage("command.join.error.fullslots");
message = message.replace("%jobname%", job.getChatColor() + job.getName());
sender.sendMessage(message);
return true;
}
@ -68,7 +67,7 @@ public class join implements Cmd {
int confMaxJobs = Jobs.getGCManager().getMaxJobs();
short PlayerMaxJobs = (short) jPlayer.getJobProgression().size();
if (confMaxJobs > 0 && PlayerMaxJobs >= confMaxJobs && !Jobs.getPlayerManager().getJobsLimit(jPlayer, PlayerMaxJobs)) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.join.error.maxjobs"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.maxjobs"));
return true;
}
@ -90,7 +89,7 @@ public class join implements Cmd {
Jobs.getPlayerManager().joinJob(jPlayer, job);
String message = Jobs.getLanguage().getMessage("command.join.success");
message = message.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE);
message = message.replace("%jobname%", job.getChatColor() + job.getName());
sender.sendMessage(message);
return true;
}

View File

@ -8,7 +8,6 @@ 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 leave implements Cmd {
@ -29,14 +28,14 @@ public class leave implements Cmd {
String jobName = args[0];
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
if (Jobs.getPlayerManager().leaveJob(jPlayer, job)) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.leave.success", "%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE));
sender.sendMessage(Jobs.getLanguage().getMessage("command.leave.success", "%jobname%", job.getChatColor() + job.getName()));
} else
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}

View File

@ -7,7 +7,6 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.stuff.ChatColor;
public class moneyboost implements Cmd {
@ -42,7 +41,7 @@ public class moneyboost implements Cmd {
for (Job one : Jobs.getJobs()) {
one.addBoost(CurrencyType.MONEY, 1.0);
}
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.allreset"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.allreset"));
return true;
} else if (args[0].equalsIgnoreCase("reset")) {
boolean found = false;
@ -55,7 +54,7 @@ public class moneyboost implements Cmd {
}
if (found) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset", "%jobname%", job.getName()));
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.jobsboostreset", "%jobname%", job.getName()));
return true;
}
}
@ -66,15 +65,15 @@ public class moneyboost implements Cmd {
one.addBoost(CurrencyType.MONEY, rate);
}
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
return true;
}
if (job == null) {
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.MONEY, rate);
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
return true;
}
}

View File

@ -7,7 +7,6 @@ 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 {
@ -25,7 +24,7 @@ public class playerinfo implements Cmd {
String jobName = args[1];
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
String type = "";

View File

@ -7,7 +7,6 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.stuff.ChatColor;
public class pointboost implements Cmd {
@ -42,7 +41,7 @@ public class pointboost implements Cmd {
for (Job one : Jobs.getJobs()) {
one.addBoost(CurrencyType.POINTS, 1.0);
}
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.allreset"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.allreset"));
return true;
} else if (args[0].equalsIgnoreCase("reset")) {
boolean found = false;
@ -55,7 +54,7 @@ public class pointboost implements Cmd {
}
if (found) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.pointboost.output.jobsboostreset", "%jobname%", job.getName()));
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.jobsboostreset", "%jobname%", job.getName()));
return true;
}
}
@ -66,15 +65,15 @@ public class pointboost implements Cmd {
one.addBoost(CurrencyType.POINTS, rate);
}
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate));
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate));
return true;
}
if (job == null) {
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.POINTS, rate);
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
sender.sendMessage(Jobs.getLanguage().getMessage("command.pointboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
return true;
}
}

View File

@ -8,7 +8,6 @@ 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 promote implements Cmd {
@ -24,7 +23,7 @@ public class promote implements Cmd {
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
if (jPlayer == null) {
@ -40,14 +39,14 @@ public class promote implements Cmd {
Player player = jPlayer.getPlayer();
if (player != null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.promote.output.target",
"%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE,
"%jobname%", job.getChatColor() + job.getName(),
"%levelsgained%", levelsGained));
}
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
}
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
}
return true;
}

View File

@ -1,12 +1,10 @@
package com.gamingmesh.jobs.commands.list;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.stuff.ChatColor;
public class reload implements Cmd {
@Override
@ -16,9 +14,8 @@ public class reload implements Cmd {
Jobs.reload();
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
String message = org.bukkit.ChatColor.translateAlternateColorCodes('&', "&4There was an error when performing a reload: ");
Bukkit.getServer().getConsoleSender().sendMessage(message);
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
Jobs.consoleMsg("&4There was an error when performing a reload: ");
e.printStackTrace();
}
return true;

View File

@ -9,7 +9,6 @@ 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 removexp implements Cmd {
@ -30,18 +29,18 @@ public class removexp implements Cmd {
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
double xpLost;
try {
xpLost = Double.parseDouble(args[2]);
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
return true;
}
if (xpLost <= 0) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
return true;
}
// check if player already has the job
@ -51,7 +50,7 @@ public class removexp implements Cmd {
Player player = jPlayer.getPlayer();
if (player != null) {
player.sendMessage(Jobs.getLanguage().getMessage("command.removexp.output.target",
"%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE,
"%jobname%", job.getChatColor() + job.getName(),
"%xplost%", xpLost));
}

View File

@ -6,13 +6,15 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.stuff.ChatColor;
public class signupdate implements Cmd {
@Override
@JobCommand(2700)
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.getGCManager().SignsEnabled)
return true;
if (args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "signupdate");
return true;
@ -21,7 +23,7 @@ public class signupdate implements Cmd {
Job oldjob = Jobs.getJob(args[0]);
if (oldjob == null && !args[0].equalsIgnoreCase("gtoplist")) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
if (!args[0].equalsIgnoreCase("gtoplist") && oldjob != null)

View File

@ -8,7 +8,6 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.ChatColor;
public class toggle implements Cmd {
@ -39,21 +38,21 @@ public class toggle implements Cmd {
if (Jobs.getActionbarToggleList().containsKey(PlayerName))
if (Jobs.getActionbarToggleList().get(PlayerName)) {
Jobs.getActionbarToggleList().put(PlayerName, false);
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.toggle.output.off"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off"));
} else {
Jobs.getActionbarToggleList().put(PlayerName, true);
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.toggle.output.on"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
}
else {
Jobs.getActionbarToggleList().put(PlayerName, true);
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.toggle.output.on"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
}
if (args[0].equalsIgnoreCase("bossbar"))
if (Jobs.getBossBarToggleList().containsKey(PlayerName))
if (Jobs.getBossBarToggleList().get(PlayerName)) {
Jobs.getBossBarToggleList().put(PlayerName, false);
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.toggle.output.off"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.off"));
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player.getUniqueId());
@ -62,11 +61,11 @@ public class toggle implements Cmd {
} else {
Jobs.getBossBarToggleList().put(PlayerName, true);
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.toggle.output.on"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
}
else {
Jobs.getBossBarToggleList().put(PlayerName, true);
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.toggle.output.on"));
sender.sendMessage(Jobs.getLanguage().getMessage("command.toggle.output.on"));
}
return true;

View File

@ -12,7 +12,6 @@ import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.RawMessage;
public class top implements Cmd {
@ -39,17 +38,18 @@ public class top implements Cmd {
}
int page = 1;
if (args.length == 2)
if (args.length == 2) {
try {
page = Integer.parseInt(args[1]);
} catch (NumberFormatException e) {
return true;
}
}
if (page < 1)
page = 1;
if (Jobs.getJob(args[0]) == null) {
player.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("command.top.error.nojob"));
player.sendMessage(Jobs.getLanguage().getMessage("command.top.error.nojob"));
return false;
}
int showPageNum = Jobs.getGCManager().JobsTopAmount;
@ -57,7 +57,7 @@ public class top implements Cmd {
List<TopList> FullList = Jobs.getJobsDAO().toplist(args[0], st);
if (FullList.size() <= 0) {
player.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.noinfo"));
player.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfo"));
return true;
}

View File

@ -9,7 +9,6 @@ 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 transfer implements Cmd {
@ -29,11 +28,11 @@ public class transfer implements Cmd {
Job oldjob = Jobs.getJob(args[1]);
Job newjob = Jobs.getJob(args[2]);
if (oldjob == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
if (newjob == null) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.error.job"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
try {
@ -43,15 +42,15 @@ public class transfer implements Cmd {
Player player = jPlayer.getPlayer();
if (player != null) {
String message = Jobs.getLanguage().getMessage("command.transfer.output.target",
"%oldjobname%", oldjob.getChatColor() + oldjob.getName() + ChatColor.WHITE,
"%newjobname%", newjob.getChatColor() + newjob.getName() + ChatColor.WHITE);
"%oldjobname%", oldjob.getChatColor() + oldjob.getName(),
"%newjobname%", newjob.getChatColor() + newjob.getName());
player.sendMessage(message);
}
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.success"));
}
} catch (Exception e) {
sender.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("general.admin.error"));
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
}
return true;
}

View File

@ -7,7 +7,6 @@ import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
@ -78,7 +77,7 @@ public class BossBarManager {
String message = Jobs.getLanguage().getMessage("command.stats.output",
"%joblevel%", Integer.valueOf(jobProg.getLevel()).toString(),
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName() + ChatColor.WHITE,
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),
"%jobxp%", formatter.format(Math.round(jobProg.getExperience() * 100.0) / 100.0),
"%jobmaxxp%", jobProg.getMaxExperience());

View File

@ -551,20 +551,7 @@ public class ConfigManager {
ConfigurationSection guiSection = jobSection.getConfigurationSection("Gui");
if (guiSection.contains("Id") && guiSection.contains("Data") && guiSection.isInt("Id") && guiSection.isInt("Data")) {
GUIitem = CMIMaterial.get(guiSection.getInt("Id"), guiSection.getInt("Data")).newItemStack();
} else if (guiSection.contains("CustomSkull")) {
String skullOwner = guiSection.getString("CustomSkull");
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
SkullMeta skullMeta = (SkullMeta) GUIitem.getItemMeta();
if (skullOwner.length() == 36) {
try {
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner));
skullMeta.setOwner(offPlayer.getName());
} catch (Exception e) {
}
} else
skullMeta.setOwner(skullOwner);
GUIitem.setItemMeta(skullMeta);
} else if (guiSection.contains("Enchantments")) {
if (guiSection.contains("Enchantments")) {
List<String> enchants = guiSection.getStringList("Enchantments");
if (enchants.size() > 0) {
for (String str4 : enchants) {
@ -578,6 +565,20 @@ public class ConfigManager {
}
}
}
}
} else if (guiSection.contains("CustomSkull")) {
String skullOwner = guiSection.getString("CustomSkull");
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
SkullMeta skullMeta = (SkullMeta) GUIitem.getItemMeta();
if (skullOwner.length() == 36) {
try {
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(skullOwner));
skullMeta.setOwner(offPlayer.getName());
} catch (Exception e) {
}
} else
skullMeta.setOwner(skullOwner);
GUIitem.setItemMeta(skullMeta);
} else
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid Gui property. Please fix this if you want to use it!");
}

View File

@ -844,7 +844,7 @@ public class GeneralConfigManager {
c.getW().addComment("BossBar.Enabled", "Enables BossBar feature", "Works only from 1.9 mc version");
BossBarEnabled = c.get("BossBar.Enabled", true);
if (BossBarEnabled = true && Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) {
if (BossBarEnabled == true && Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) {
BossBarEnabled = false;
Jobs.consoleMsg("&c[Jobs] Your server version don't support BossBar. This feature will be disabled");
}

View File

@ -403,8 +403,8 @@ public class LanguageManager {
c.get("command.join.error.fullslots", "You cannot join the job %jobname%, there are no slots available.");
c.get("command.join.error.maxjobs", "You have already joined too many jobs.");
c.get("command.join.error.rejoin", "&cCan't rejoin this job. Wait [time]");
c.get("command.join.rejoin", "&aClick to rejoin this job: ");
c.get("command.join.success", "You have joined the job %jobname%.");
c.get("command.join.confirm", "&2Click to confirm join action for &7[jobname] &2job.");
c.get("command.leave.help.info", "Leave the selected job.");

View File

@ -364,7 +364,7 @@ public class ShopManager {
List<String> lore = new ArrayList<>();
if (NameSection.getStringList("Icon.Lore") != null)
for (String eachLine : NameSection.getStringList("Icon.Lore")) {
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
lore.add(ChatColor.translateAlternateColorCodes('&', eachLine));
}
Sitem.setIconLore(lore);
}
@ -401,7 +401,7 @@ public class ShopManager {
List<String> cmd = new ArrayList<>();
if (NameSection.getStringList("PerformCommands") != null)
for (String eachLine : NameSection.getStringList("PerformCommands")) {
cmd.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
cmd.add(ChatColor.translateAlternateColorCodes('&', eachLine));
}
Sitem.setCommands(cmd);
}
@ -430,12 +430,12 @@ public class ShopManager {
String name = null;
if (itemSection.isString("Name"))
name = org.bukkit.ChatColor.translateAlternateColorCodes('&', itemSection.getString("Name"));
name = ChatColor.translateAlternateColorCodes('&', itemSection.getString("Name"));
List<String> lore = new ArrayList<>();
if (itemSection.getStringList("Lore") != null)
for (String eachLine : itemSection.getStringList("Lore")) {
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
lore.add(ChatColor.translateAlternateColorCodes('&', eachLine));
}
HashMap<Enchantment, Integer> enchants = new HashMap<>();

View File

@ -29,7 +29,6 @@ import org.bukkit.OfflinePlayer;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.api.JobsPaymentEvent;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.VersionChecker.Version;
import com.gamingmesh.jobs.tasks.BufferedPaymentTask;
@ -178,7 +177,7 @@ public class BufferedEconomy {
if (Jobs.getGCManager().UseServerAccount) {
if (!hasMoney) {
Jobs.getActionBar().send(payment.getOfflinePlayer().getPlayer(), ChatColor.RED + Jobs.getLanguage().getMessage("economy.error.nomoney"));
Jobs.getActionBar().send(payment.getOfflinePlayer().getPlayer(), Jobs.getLanguage().getMessage("economy.error.nomoney"));
continue;
}
if (Jobs.getGCManager().isEconomyAsync()) {

View File

@ -700,7 +700,7 @@ public class JobsListener implements Listener {
return false;
if (oneItem.getName() != null && name != null) {
if (!org.bukkit.ChatColor.translateAlternateColorCodes('&', oneItem.getName()).equalsIgnoreCase(name)) {
if (!ChatColor.translateAlternateColorCodes('&', oneItem.getName()).equalsIgnoreCase(name)) {
return false;
}
}

View File

@ -161,7 +161,7 @@ public class JobsPaymentListener implements Listener {
//Check if inventory is full and using shift click, possible money dupping fix
if (player.getInventory().firstEmpty() == -1 && event.isShiftClick()) {
player.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("message.crafting.fullinventory"));
player.sendMessage(Jobs.getLanguage().getMessage("message.crafting.fullinventory"));
return;
}
@ -359,6 +359,8 @@ public class JobsPaymentListener implements Listener {
return;
if (block.getType() == Material.FURNACE && block.hasMetadata(furnaceOwnerMetadata))
FurnaceBrewingHandling.removeFurnace(block);
if (block.getType() == Material.BREWING_STAND && block.hasMetadata(brewingOwnerMetadata))
FurnaceBrewingHandling.removeBrewing(block);
// make sure plugin is enabled
if (!this.plugin.isEnabled())
@ -547,7 +549,7 @@ public class JobsPaymentListener implements Listener {
//Check if inventory is full and using shift click, possible money dupping fix
if (player.getInventory().firstEmpty() == -1 && event.isShiftClick()) {
player.sendMessage(ChatColor.RED + Jobs.getLanguage().getMessage("message.crafting.fullinventory"));
player.sendMessage(Jobs.getLanguage().getMessage("message.crafting.fullinventory"));
return;
}
@ -1413,6 +1415,9 @@ public class JobsPaymentListener implements Listener {
if (block.getType() == Material.FURNACE && block.hasMetadata(furnaceOwnerMetadata))
FurnaceBrewingHandling.removeFurnace(block);
if (block.getType() == Material.BREWING_STAND && block.hasMetadata(brewingOwnerMetadata))
FurnaceBrewingHandling.removeBrewing(block);
if (Jobs.getGCManager().useBlockProtection)
if (block.getState().hasMetadata(BlockMetadata))
return;

View File

@ -84,7 +84,7 @@ public class ActionBar {
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(), payment.getPoints()));
if (payment.getExp() != 0D)
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), payment.getExp()));
send(abp, ChatColor.GREEN + Message);
send(abp, Message);
}
}

View File

@ -16,14 +16,13 @@ import com.gamingmesh.jobs.Jobs;
public class VersionChecker {
private Jobs plugin;
private int resource = 4216;
private static Version version = null;
public VersionChecker(Jobs plugin) {
this.plugin = plugin;
version = getCurrent();
}
private static Version version = Version.v1_11_R1;
public Version getVersion() {
return version;
}
@ -53,9 +52,9 @@ public class VersionChecker {
private Integer value;
private String shortVersion;
Version(Integer value, String ShortVersion) {
Version(Integer value, String shortVersion) {
this.value = value;
shortVersion = ShortVersion;
this.shortVersion = shortVersion;
}
public Integer getValue() {
@ -92,8 +91,8 @@ public class VersionChecker {
return getValue() >= version.getValue();
}
public static boolean isCurrentEqualOrHigher(Version v) {
return version.getValue() >= v.getValue();
public static boolean isCurrentEqualOrHigher(Version version) {
return VersionChecker.version.getValue() >= version.getValue();
}
}
@ -108,20 +107,20 @@ public class VersionChecker {
return null;
}
public boolean isLower(Version v) {
return version.getValue() < v.getValue();
public boolean isLower(Version version) {
return VersionChecker.version.getValue() < version.getValue();
}
public boolean isLowerEquals(Version v) {
return version.getValue() <= v.getValue();
public boolean isLowerEquals(Version version) {
return VersionChecker.version.getValue() <= version.getValue();
}
public boolean isHigher(Version v) {
return version.getValue() > v.getValue();
public boolean isHigher(Version version) {
return VersionChecker.version.getValue() > version.getValue();
}
public boolean isHigherEquals(Version v) {
return version.getValue() >= v.getValue();
public boolean isHigherEquals(Version version) {
return VersionChecker.version.getValue() >= version.getValue();
}
public void VersionCheck(final Player player) {

View File

@ -55,33 +55,33 @@ command:
info: 'Növeli a pénzszerzést minden játékos számára'
args: '[munkanév] [arány]'
output:
allreset: 'Minden pénzbővítés kikapcsolt'
jobsboostreset: 'Pénznövekedés a(z) %jobname% munkánál kikapcsolva'
nothingtoreset: 'Semmi nem állítható vissza'
boostalladded: 'Pénznövekedés %boost% minden munkához hozzáadva!'
boostadded: 'Pénznövekedés &e%boost% &ahozzáadva a következőhöz: &e%jobname%!'
allreset: '&aMinden pénzbővítés kikapcsolva.'
jobsboostreset: '&cPénznövekedés a(z) %jobname% munkánál kikapcsolva.'
nothingtoreset: '&cSemmi nem állítható vissza.'
boostalladded: '&aPénznövekedés %boost% minden munkához hozzáadva!'
boostadded: '&aPénznövekedés &e%boost% &ahozzáadva a következőhöz: &e%jobname%!'
infostats: '&c-----> &aPénz aránya x%boost% engedélyezve&c <-------'
pointboost:
help:
info: 'Növeli a játékosok pontszerzését minden játékos számára'
args: '[munkanév] [arány]'
output:
allreset: 'Minden pont lendülete kikapcsolt'
jobsboostreset: 'Pontok lendületet adnak %jobname% kikapcsolva'
nothingtoreset: 'Semmi nem állítható vissza'
boostalladded: 'A pontok növelése %boost% minden munkához hozzáadva!'
boostadded: 'A pontok növelése &e%boost% &ahozzáadva a(z) &e%jobname% &amunkához!'
allreset: '&aMinden pont lendülete kikapcsolva.'
jobsboostreset: '&cPontok lendületei %jobname% visszaállítva.'
nothingtoreset: '&cSemmi nem állítható vissza.'
boostalladded: '&aA pontok növelése %boost% minden munkához hozzáadva!'
boostadded: '&aA pontok növelése &e%boost% &ahozzáadva a(z) &e%jobname% &amunkához!'
infostats: '&c-----> &aPontszám x%boost% engedélyezve&c <-------'
expboost:
help:
info: 'Növeli az összes játékos nyereségét'
args: '[munkanév] [arány]'
output:
allreset: 'Minden tapasztalat növelés kikapcsolva'
jobsboostreset: 'Tapasztalat lendület a(z) %jobname% munkánál kikapcsolva'
nothingtoreset: 'Semmi nem állítható vissza'
boostalladded: 'Tapasztalat növelése %boost% minden munkához hozzáadva!'
boostadded: 'Tapasztalat növelése &e%boost% &ahozzáadva &e%jobname% &amunkához!'
allreset: '&aMinden tapasztalat növelés kikapcsolva.'
jobsboostreset: '&cTapasztalat lendület a(z) %jobname% munkánál kikapcsolva.'
nothingtoreset: '&cSemmi nem állítható vissza.'
boostalladded: '&aTapasztalat növelése %boost% minden munkához hozzáadva!'
boostadded: '&aTapasztalat növelése &e%boost% &ahozzáadva &e%jobname% &amunkához!'
infostats: '&c-----> &aTapasztalat arány x%boost% engedélyezve&c <-------'
bonus:
help:
@ -198,7 +198,7 @@ command:
info: 'Kilistázza azokat a munkákat, amelyikbe beléptél.'
args: '[játékosnév]'
error:
nojob: 'Először csatlakozz egy munkához.'
nojob: '&cElőször csatlakozz egy munkához.'
output: ' lvl%joblevel% %jobname% : %jobxp%/%jobmaxxp% xp'
shop:
help:
@ -223,7 +223,7 @@ command:
info: 'A felhasználó által archivált összes munkát jeleníti meg.'
args: '[játékos]'
error:
nojob: 'Nincs mentett munka.'
nojob: '&cNincs mentett munka.'
output: 'lvl %joblevel% (%getbackjoblevel%) %jobname%'
give:
help:
@ -237,9 +237,9 @@ command:
title: '&2*** &eJobs&2 ***'
info: 'Megmutatja, hogy mennyi minden munkát fizet, és miért.'
penalty: '&eEz a munka &c[penalty]% &ebüntetés miatt túl sok játékos dolgozik benne.'
bonus: '&eEz a minka &2[bonus]% &ebónusz, mert nem elég játékos dolgozik benne.'
bonus: '&eEz a munka &2[bonus]% &ebónusz, mert nem elég játékos dolgozik benne.'
args: '[munkanév] [akció]'
actions: '&eAz érvényes cselekvések: &f%actions%'
actions: '&eAz érvényes akciók: &f%actions%'
max: ' - &eMax. szint:&f '
newMax: '&eMaximális szint: &f[max]'
material: '&7%material%'
@ -250,7 +250,7 @@ command:
points: ' &6%points% pont'
exp: ' &e%exp%xp'
gui:
pickjob: '&eVálaszd ki a munkáját!'
pickjob: '&eVálassz egy munkát!'
jobinfo: '&e[jobname] info!'
actions: '&eÉrvényes akciók:'
leftClick: '&eTovábbi információért kattints bal gombbal'
@ -261,61 +261,61 @@ command:
back: '&e<<< Vissza'
output:
break:
info: 'Eltör'
info: '&eEltör'
none: '%jobname% nem kap pénzt a blokkok kitörésére.'
tntbreak:
info: 'TNT robbantás'
info: '&eTNT robbantás'
none: '%jobname% nem kap pénzt, ha a blokkot tnt-vel robbantja ki.'
place:
info: 'Lerak'
info: '&eLerak'
none: '%jobname% nem kap pénzt, ha blokkot helyez le.'
kill:
info: 'Megöl'
info: '&eMegöl'
none: '%jobname% nem kap pénzt, ha szörnyet gyilkol.'
mmkill:
info: 'MMKill'
info: '&eMMKill'
none: '%jobname% nem kap pénzt, ha Mythic szörnyeket gyilkol.'
fish:
info: 'Horgász'
info: '&eHorgász'
none: '%jobname% nem kap pénzt, ha horgászik.'
craft:
info: 'Barkácsol'
info: '&eBarkácsol'
none: '%jobname% nem kap pénzt, ha barkácsol.'
smelt:
info: 'Olvaszt'
info: '&eOlvaszt'
none: '%jobname% nem kap pénzt, ha olvaszt.'
brew:
info: 'Főzés'
info: '&eFőzés'
none: '%jobname% nem kap pénzt, ha bájitalt főz.'
eat:
info: 'Elfogyaszt'
info: '&eElfogyaszt'
none: '%jobname% nem kap pénzt, ha étkezik.'
dye:
info: 'Festék'
info: '&eFesték'
none: '%jobname% nem kap pénzt, ha fest.'
enchant:
info: 'Varázs'
info: '&eVarázs'
none: '%jobname% nem kap pénzt, ha varázsól.'
repair:
info: 'Javít'
info: '&eJavít'
none: '%jobname% nem kap pénzt, ha javít.'
breed:
info: 'Tenyészt'
info: '&eTenyészt'
none: '%jobname% nem kap pénzt, ha tenészt.'
tame:
info: 'Megszelídít'
info: '&eMegszelídít'
none: '%jobname% nem kap pénzt, ha szelídít.'
milk:
info: 'Tej'
info: '&eTej'
none: '%jobname% nem kap pénzt, ha megfej egy tehenet.'
shear:
info: 'Nyír'
info: '&eNyír'
none: '%jobname% nem kap pénzt, ha bárányokat nyír.'
explore:
info: 'Feltör'
info: '&eFeltör'
none: '%jobname% nem kap pénzt felfedezni.'
custom-kill:
info: 'Egyéni gyilkolás'
info: '&eEgyéni gyilkolás'
none: '%jobname% nem kap pénzt, ha játékost gyilkol.'
playerinfo:
help:
@ -327,9 +327,10 @@ command:
args: '[munkanév]'
error:
alreadyin: '&cMár csatlakoztál a(z) %jobname%&c munkához!'
fullslots: 'Nem tudsz csatlakozni a(z) %jobname% munkához, mert nincsenek rendelkezésre álló helyek.'
maxjobs: 'Már túl sok munkát vállaltál.'
fullslots: '&cNem tudsz csatlakozni a(z) %jobname% munkához, mert nincsenek rendelkezésre álló helyek.'
maxjobs: '&cMár túl sok munkát vállaltál.'
rejoin: '&cNem csatlakozhatsz ebbe a munkába. Várj [time]'
rejoin: '&aKattints ide, hogy újra csatlakozz ebbe a munkába: '
success: '&aSikeresen csatlakoztál a(z) %jobname%&a munkához!'
confirm: '&2Kattints ide, hogy a &7[jobname]&2 munkát megerősítse.'
leave:
@ -347,13 +348,13 @@ command:
help:
info: 'Ellenőrzi, ki látogatta meg ezt a darabot'
error:
noexplore: 'Senki nem látogatta meg ezt a darabot'
list: '&e%place%. %playername%'
noexplore: '&cSenki nem látogatta meg ezt a darabot'
list: '&a%place%. %playername%'
browse:
help:
info: 'Listázza a jelenleg elérhető munkákat.'
error:
nojobs: 'Nincsenek olyan munkák, amelyekhez csatlakozhatsz.'
nojobs: '&cNincsenek olyan munkák, amelyekhez csatlakozhatsz.'
output:
header: 'A következő munkákhoz csatlakozhatsz:'
footer: 'További információkért a&7 /jobs info [munkanév]&f paranccsal.'
@ -378,7 +379,7 @@ command:
info: 'Lásd a rendelkezésre álló küldetések listáját.'
args: '(játékosnév)'
error:
noquests: 'Nincsenek küldetések.'
noquests: '&cNincsenek küldetések.'
toplineseparator: '&7*********************** &6[playerName]&2(&f[questsDone]&2)
&7***********************'
output:
@ -393,7 +394,7 @@ command:
info: 'Játékos kirúgása a munkából.'
args: '[játékos] [munkanév]'
error:
nojob: 'A játékosnak nincs munkája %jobname%.'
nojob: '&cA játékosnak nincs munkája %jobname%.'
output:
target: '%jobname% munkából kirúgva.'
fireall:
@ -401,7 +402,7 @@ command:
info: 'Tűzoltás minden munkából.'
args: '[játékos]'
error:
nojobs: 'A játékosnak nincsenek olyan munkái, amelyekről ki lehet rúgni!'
nojobs: '&cA játékosnak nincsenek olyan munkái, amelyekről ki lehet rúgni!'
output:
target: 'Minden munkából kirúgtak.'
employ:
@ -409,7 +410,7 @@ command:
info: 'Megfogja a játékost, hogy a megadott munkához csatlakozzon.'
args: '[játékos] [munkanév]'
error:
alreadyin: 'A játékos már dolgozik %jobname% munkánál.'
alreadyin: '&cA játékos már dolgozik %jobname% munkánál.'
output:
target: 'Most már a(z) %jobname% munkánál dolgozik.'
top:
@ -417,7 +418,7 @@ command:
info: 'Top %amount% játékosok a ranglistán.'
args: '[munkanév]'
error:
nojob: 'Nem találok semmilyen munkát ezzel a névvel.'
nojob: '&cNem találok semmilyen munkát ezzel a névvel.'
output:
topline: '&aA top&e %amount% &ajátékosok a(z) &e%jobname% &amunkából'
list: '&e%number%&a. &e%playername% &alvl &e%level% %exp% exp'
@ -429,7 +430,7 @@ command:
info: 'A top %amount% legjobb játékosokat mutatja a globális munkákon.'
args: ''
error:
nojob: 'Nem találok semmilyen információt.'
nojob: '&cNem találok semmilyen információt.'
output:
topline: '&aTop&e %amount% &ajátékosok a globális munkahelyi szinten.'
list: '&e%number%&a. &e%playername% &alvl &e%level%&e %exp% &aexp'
@ -483,7 +484,7 @@ command:
nodata: '&cAz adatok nem találhatóak'
transfer:
help:
info: 'A játékos munkájának áthelyezése régi munkáról egy új feladatra.'
info: 'A játékos munkájának áthelyezése régi munkáról egy új munkába.'
args: '[játékos] [régimunka] [újmunka]'
output:
target: 'Átkerültél %oldjobname% munkából %newjobname% munkába.'
@ -568,7 +569,7 @@ message:
boostStarted: '&eMegkezdődött a munka növelése!'
boostStoped: '&eA munka növelési ideje befejeződött!'
crafting:
fullinventory: 'Az eszköztárad megtelt!'
fullinventory: '&cAz eszköztárad megtelt!'
signs:
List: '&0[number].&8[player]&7:&4[level]'
SpecialList: