mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
New placeholders to get user points
- /jobs employ command needs max slots check
This commit is contained in:
parent
80f43d3f47
commit
82f5ad0fd4
4
pom.xml
4
pom.xml
@ -31,9 +31,9 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.1.2</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${basedir}/libs/mcMMO.jar</systemPath>
|
<systemPath>${basedir}/libs/mcMMO2.1.2.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Vault -->
|
<!-- Vault -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -21,7 +21,7 @@ import com.gamingmesh.jobs.container.JobItems;
|
|||||||
|
|
||||||
public class ItemBoostManager {
|
public class ItemBoostManager {
|
||||||
|
|
||||||
private static HashMap<String, JobItems> items = new HashMap<String, JobItems>();
|
private static HashMap<String, JobItems> items = new HashMap<>();
|
||||||
|
|
||||||
public ItemBoostManager() {
|
public ItemBoostManager() {
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public class ItemBoostManager {
|
|||||||
ConfigReader cfg = null;
|
ConfigReader cfg = null;
|
||||||
try {
|
try {
|
||||||
cfg = new ConfigReader("boostedItems.yml");
|
cfg = new ConfigReader("boostedItems.yml");
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class ItemBoostManager {
|
|||||||
cfg.getC().set(oneI.getKey() + ".name", item.getItemStack(null).getItemMeta().hasDisplayName() ? CMIChatColor.deColorize(item.getItemStack(null).getItemMeta().getDisplayName()) : null);
|
cfg.getC().set(oneI.getKey() + ".name", item.getItemStack(null).getItemMeta().hasDisplayName() ? CMIChatColor.deColorize(item.getItemStack(null).getItemMeta().getDisplayName()) : null);
|
||||||
cfg.getC().set(oneI.getKey() + ".lore", item.getItemStack(null).getItemMeta().hasLore() ? CMIChatColor.deColorize(item.getItemStack(null).getItemMeta().getLore()) : null);
|
cfg.getC().set(oneI.getKey() + ".lore", item.getItemStack(null).getItemMeta().hasLore() ? CMIChatColor.deColorize(item.getItemStack(null).getItemMeta().getLore()) : null);
|
||||||
}
|
}
|
||||||
List<String> ench = new ArrayList<String>();
|
List<String> ench = new ArrayList<>();
|
||||||
for (Entry<Enchantment, Integer> oneE : item.getItemStack(null).getEnchantments().entrySet()) {
|
for (Entry<Enchantment, Integer> oneE : item.getItemStack(null).getEnchantments().entrySet()) {
|
||||||
ench.add(oneE.getKey().getName() + "=" + oneE.getValue());
|
ench.add(oneE.getKey().getName() + "=" + oneE.getValue());
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ public class ItemBoostManager {
|
|||||||
cfg = null;
|
cfg = null;
|
||||||
try {
|
try {
|
||||||
cfg = new ConfigReader("boostedItems.yml");
|
cfg = new ConfigReader("boostedItems.yml");
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (cfg == null)
|
if (cfg == null)
|
||||||
@ -159,16 +159,16 @@ public class ItemBoostManager {
|
|||||||
|
|
||||||
List<String> jobsS = cfg.get(one + ".jobs", Arrays.asList(""));
|
List<String> jobsS = cfg.get(one + ".jobs", Arrays.asList(""));
|
||||||
|
|
||||||
List<Job> jobs = new ArrayList<Job>();
|
List<Job> jobs = new ArrayList<>();
|
||||||
for (String oneJ : jobsS) {
|
for (String oneJ : jobsS) {
|
||||||
Job job = Jobs.getJob(oneJ);
|
Job job = Jobs.getJob(oneJ);
|
||||||
if (job == null && !oneJ.equalsIgnoreCase("all")) {
|
if (job == null && !oneJ.equalsIgnoreCase("all")) {
|
||||||
Jobs.getPluginLogger().warning("Cant determine job by " + oneJ + " name for " + one + " boosted item!");
|
Jobs.getPluginLogger().warning("Cant determine job by " + oneJ + " name for " + one + " boosted item!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (oneJ.equalsIgnoreCase("all")) {
|
if (oneJ.equalsIgnoreCase("all"))
|
||||||
jobs.addAll(Jobs.getJobs());
|
jobs.addAll(Jobs.getJobs());
|
||||||
} else if (job != null)
|
else if (job != null)
|
||||||
jobs.add(job);
|
jobs.add(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,12 +178,11 @@ public class ItemBoostManager {
|
|||||||
}
|
}
|
||||||
JobItems item = new JobItems(one.toLowerCase(), mat, 1, name, lore, enchants, b, jobs);
|
JobItems item = new JobItems(one.toLowerCase(), mat, 1, name, lore, enchants, b, jobs);
|
||||||
|
|
||||||
if (cfg.getC().isInt(one + ".levelFrom")) {
|
if (cfg.getC().isInt(one + ".levelFrom"))
|
||||||
item.setFromLevel(cfg.get(one + ".levelFrom", 0));
|
item.setFromLevel(cfg.get(one + ".levelFrom", 0));
|
||||||
}
|
|
||||||
if (cfg.getC().isInt(one + ".levelUntil")) {
|
if (cfg.getC().isInt(one + ".levelUntil"))
|
||||||
item.setUntilLevel(cfg.get(one + ".levelUntil", 1000));
|
item.setUntilLevel(cfg.get(one + ".levelUntil", 1000));
|
||||||
}
|
|
||||||
|
|
||||||
for (Job oneJ : jobs) {
|
for (Job oneJ : jobs) {
|
||||||
if (oneJ == null)
|
if (oneJ == null)
|
||||||
@ -199,7 +198,7 @@ public class ItemBoostManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<JobItems> getItemsByJob(Job job) {
|
public static List<JobItems> getItemsByJob(Job job) {
|
||||||
List<JobItems> ls = new ArrayList<JobItems>();
|
List<JobItems> ls = new ArrayList<>();
|
||||||
for (Entry<String, JobItems> one : items.entrySet()) {
|
for (Entry<String, JobItems> one : items.entrySet()) {
|
||||||
if (one.getValue().getJobs().contains(job))
|
if (one.getValue().getJobs().contains(job))
|
||||||
ls.add(one.getValue());
|
ls.add(one.getValue());
|
||||||
@ -208,7 +207,7 @@ public class ItemBoostManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<String, JobItems> getItemsMapByJob(Job job) {
|
public static HashMap<String, JobItems> getItemsMapByJob(Job job) {
|
||||||
HashMap<String, JobItems> i = new HashMap<String, JobItems>();
|
HashMap<String, JobItems> i = new HashMap<>();
|
||||||
for (Entry<String, JobItems> one : items.entrySet()) {
|
for (Entry<String, JobItems> one : items.entrySet()) {
|
||||||
if (one.getValue().getJobs().contains(job))
|
if (one.getValue().getJobs().contains(job))
|
||||||
i.put(one.getKey(), one.getValue());
|
i.put(one.getKey(), one.getValue());
|
||||||
|
@ -13,6 +13,7 @@ import com.gamingmesh.jobs.container.CurrencyType;
|
|||||||
import com.gamingmesh.jobs.container.Job;
|
import com.gamingmesh.jobs.container.Job;
|
||||||
import com.gamingmesh.jobs.container.JobProgression;
|
import com.gamingmesh.jobs.container.JobProgression;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
import com.gamingmesh.jobs.container.PlayerPoints;
|
||||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||||
|
|
||||||
public class Placeholder {
|
public class Placeholder {
|
||||||
@ -39,6 +40,8 @@ public class Placeholder {
|
|||||||
user_issaved,
|
user_issaved,
|
||||||
user_displayhonorific,
|
user_displayhonorific,
|
||||||
user_joinedjobcount,
|
user_joinedjobcount,
|
||||||
|
user_points,
|
||||||
|
user_total_points,
|
||||||
user_boost_$1_$2("jname/number", "money/exp/points"),
|
user_boost_$1_$2("jname/number", "money/exp/points"),
|
||||||
user_isin_$1("jname/number"),
|
user_isin_$1("jname/number"),
|
||||||
user_canjoin_$1("jname/number"),
|
user_canjoin_$1("jname/number"),
|
||||||
@ -103,27 +106,24 @@ public class Placeholder {
|
|||||||
if (one.isComplex())
|
if (one.isComplex())
|
||||||
continue;
|
continue;
|
||||||
// String n = one.name().replace("_", "");
|
// String n = one.name().replace("_", "");
|
||||||
if (one.getName().equalsIgnoreCase(name)) {
|
if (one.getName().equalsIgnoreCase(name))
|
||||||
return one;
|
return one;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
name = pref + name;
|
name = pref + name;
|
||||||
for (JobsPlaceHolders one : JobsPlaceHolders.values()) {
|
for (JobsPlaceHolders one : JobsPlaceHolders.values()) {
|
||||||
if (one.isComplex())
|
if (one.isComplex())
|
||||||
continue;
|
continue;
|
||||||
String n = one.getName();
|
String n = one.getName();
|
||||||
if (n.equalsIgnoreCase(name)) {
|
if (n.equalsIgnoreCase(name))
|
||||||
return one;
|
return one;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
name = "%" + pref + "_" + original + "%";
|
name = "%" + pref + "_" + original + "%";
|
||||||
for (JobsPlaceHolders one : JobsPlaceHolders.values()) {
|
for (JobsPlaceHolders one : JobsPlaceHolders.values()) {
|
||||||
if (!one.isComplex())
|
if (!one.isComplex())
|
||||||
continue;
|
continue;
|
||||||
if (!one.getComplexRegexMatchers(name).isEmpty()) {
|
if (!one.getComplexRegexMatchers(name).isEmpty())
|
||||||
return one;
|
return one;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// For MVdWPlaceholderAPI
|
// For MVdWPlaceholderAPI
|
||||||
// if (Jobs.getInstance().isMVdWPlaceholderAPIEnabled() && original.startsWith(pref+"_")) {
|
// if (Jobs.getInstance().isMVdWPlaceholderAPIEnabled() && original.startsWith(pref+"_")) {
|
||||||
// String t = "{" + original + "}";
|
// String t = "{" + original + "}";
|
||||||
@ -379,7 +379,7 @@ public class Placeholder {
|
|||||||
if (placeHolder == null)
|
if (placeHolder == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// Placeholders by JobsPLayer object
|
// Placeholders by JobsPlayer object
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
switch (placeHolder) {
|
switch (placeHolder) {
|
||||||
case user_id:
|
case user_id:
|
||||||
@ -398,6 +398,12 @@ public class Placeholder {
|
|||||||
return TimeManage.to24hourShort(System.currentTimeMillis() - user.getSeen());
|
return TimeManage.to24hourShort(System.currentTimeMillis() - user.getSeen());
|
||||||
case user_totallevels:
|
case user_totallevels:
|
||||||
return String.valueOf(user.getTotalLevels());
|
return String.valueOf(user.getTotalLevels());
|
||||||
|
case user_points:
|
||||||
|
PlayerPoints pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(user.getPlayerUUID());
|
||||||
|
return String.valueOf(pointInfo.getCurrentPoints());
|
||||||
|
case user_total_points:
|
||||||
|
pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(user.getPlayerUUID());
|
||||||
|
return String.valueOf(pointInfo.getTotalPoints());
|
||||||
case user_issaved:
|
case user_issaved:
|
||||||
return convert(user.isSaved());
|
return convert(user.isSaved());
|
||||||
case user_displayhonorific:
|
case user_displayhonorific:
|
||||||
@ -469,23 +475,19 @@ public class Placeholder {
|
|||||||
if (job == null)
|
if (job == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
if (!Jobs.getCommandManager().hasJobPermission(player, job)) {
|
if (!Jobs.getCommandManager().hasJobPermission(player, job))
|
||||||
return convert(false);
|
return convert(false);
|
||||||
}
|
|
||||||
|
|
||||||
if (user.isInJob(job)) {
|
if (user.isInJob(job))
|
||||||
return convert(false);
|
return convert(false);
|
||||||
}
|
|
||||||
|
|
||||||
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
|
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots())
|
||||||
return convert(false);
|
return convert(false);
|
||||||
}
|
|
||||||
|
|
||||||
int confMaxJobs = Jobs.getGCManager().getMaxJobs();
|
int confMaxJobs = Jobs.getGCManager().getMaxJobs();
|
||||||
short PlayerMaxJobs = (short) user.getJobProgression().size();
|
short PlayerMaxJobs = (short) user.getJobProgression().size();
|
||||||
if (confMaxJobs > 0 && PlayerMaxJobs >= confMaxJobs && !Jobs.getPlayerManager().getJobsLimit(user, PlayerMaxJobs)) {
|
if (confMaxJobs > 0 && PlayerMaxJobs >= confMaxJobs && !Jobs.getPlayerManager().getJobsLimit(user, PlayerMaxJobs))
|
||||||
return convert(false);
|
return convert(false);
|
||||||
}
|
|
||||||
|
|
||||||
return convert(true);
|
return convert(true);
|
||||||
|
|
||||||
|
@ -22,21 +22,17 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
|
|
||||||
import com.gamingmesh.jobs.api.JobsJoinEvent;
|
import com.gamingmesh.jobs.api.JobsJoinEvent;
|
||||||
import com.gamingmesh.jobs.api.JobsLeaveEvent;
|
import com.gamingmesh.jobs.api.JobsLeaveEvent;
|
||||||
@ -58,7 +54,6 @@ import com.gamingmesh.jobs.dao.JobsDAO;
|
|||||||
import com.gamingmesh.jobs.dao.JobsDAOData;
|
import com.gamingmesh.jobs.dao.JobsDAOData;
|
||||||
import com.gamingmesh.jobs.economy.PaymentData;
|
import com.gamingmesh.jobs.economy.PaymentData;
|
||||||
import com.gamingmesh.jobs.economy.PointsData;
|
import com.gamingmesh.jobs.economy.PointsData;
|
||||||
import com.gamingmesh.jobs.stuff.Debug;
|
|
||||||
import com.gamingmesh.jobs.stuff.PerformCommands;
|
import com.gamingmesh.jobs.stuff.PerformCommands;
|
||||||
|
|
||||||
public class PlayerManager {
|
public class PlayerManager {
|
||||||
@ -727,19 +722,13 @@ public class PlayerManager {
|
|||||||
|
|
||||||
public BoostMultiplier getItemBoostNBT(Player player, Job prog) {
|
public BoostMultiplier getItemBoostNBT(Player player, Job prog) {
|
||||||
|
|
||||||
HashMap<Job, ItemBonusCache> cj = cache.get(player.getUniqueId());
|
HashMap<Job, ItemBonusCache> cj = cache == null ? new HashMap<Job, ItemBonusCache>() : cache.get(player.getUniqueId());
|
||||||
|
|
||||||
if (cj == null) {
|
if (cj == null) {
|
||||||
cj = new HashMap<>();
|
cj = new HashMap<>();
|
||||||
cache.put(player.getUniqueId(), cj);
|
cache.put(player.getUniqueId(), cj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache.get(player.getUniqueId()) != null)
|
|
||||||
cj = cache.get(player.getUniqueId());
|
|
||||||
|
|
||||||
if (cj == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
ItemBonusCache c = cj.get(prog);
|
ItemBonusCache c = cj.get(prog);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
c = new ItemBonusCache(player, prog);
|
c = new ItemBonusCache(player, prog);
|
||||||
@ -762,7 +751,7 @@ public class PlayerManager {
|
|||||||
data.add(jitem.getBoost(this.getJobsPlayer(player).getJobProgression(prog)));
|
data.add(jitem.getBoost(this.getJobsPlayer(player).getJobProgression(prog)));
|
||||||
|
|
||||||
for (ItemStack OneArmor : player.getInventory().getArmorContents()) {
|
for (ItemStack OneArmor : player.getInventory().getArmorContents()) {
|
||||||
if (OneArmor == null || OneArmor.getType() == Material.AIR)
|
if (OneArmor == null || OneArmor.getType() == org.bukkit.Material.AIR)
|
||||||
continue;
|
continue;
|
||||||
JobItems armorboost = getJobsItemByNbt(OneArmor);
|
JobItems armorboost = getJobsItemByNbt(OneArmor);
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ 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;
|
||||||
@ -17,10 +16,8 @@ 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 {
|
||||||
|
|
||||||
@ -279,7 +276,7 @@ public class SignUtil {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, timelapse * Jobs.getGCManager().InfoUpdateInterval * 20L);
|
}, timelapse * Jobs.getGCManager().InfoUpdateInterval * 20L);
|
||||||
} catch (Exception | Error e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -39,6 +39,14 @@ public class employ implements Cmd {
|
|||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.employ.error.alreadyin", "%jobname%", job.getChatColor() + job.getName()));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.employ.error.alreadyin", "%jobname%", job.getChatColor() + job.getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
|
||||||
|
String message = Jobs.getLanguage().getMessage("command.join.error.fullslots");
|
||||||
|
message = message.replace("%jobname%", job.getChatColor() + job.getName());
|
||||||
|
sender.sendMessage(message);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// check if player already has the job
|
// check if player already has the job
|
||||||
Jobs.getPlayerManager().joinJob(jPlayer, job);
|
Jobs.getPlayerManager().joinJob(jPlayer, job);
|
||||||
|
@ -505,6 +505,7 @@ public class LanguageManager {
|
|||||||
c.get("command.employ.help.args", "[playername] [jobname]");
|
c.get("command.employ.help.args", "[playername] [jobname]");
|
||||||
Jobs.getGCManager().commandArgs.put("employ", Arrays.asList("[playername]", "[jobname]"));
|
Jobs.getGCManager().commandArgs.put("employ", Arrays.asList("[playername]", "[jobname]"));
|
||||||
c.get("command.employ.error.alreadyin", "Player is already in the job %jobname%.");
|
c.get("command.employ.error.alreadyin", "Player is already in the job %jobname%.");
|
||||||
|
c.get("command.employ.error.fullslots", "You cannot join the job %jobname%, there are no slots available.");
|
||||||
c.get("command.employ.output.target", "You have been employed as a %jobname%.");
|
c.get("command.employ.output.target", "You have been employed as a %jobname%.");
|
||||||
|
|
||||||
c.get("command.top.help.info", "Shows top %amount% players by jobs name.");
|
c.get("command.top.help.info", "Shows top %amount% players by jobs name.");
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package com.gamingmesh.jobs.config;
|
package com.gamingmesh.jobs.config;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package com.gamingmesh.jobs.config;
|
package com.gamingmesh.jobs.config;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.CMILib.ConfigReader;
|
import com.gamingmesh.jobs.CMILib.ConfigReader;
|
||||||
@ -53,7 +50,7 @@ public class TitleManager {
|
|||||||
ConfigReader c = null;
|
ConfigReader c = null;
|
||||||
try {
|
try {
|
||||||
c = new ConfigReader("titleConfig.yml");
|
c = new ConfigReader("titleConfig.yml");
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (c == null)
|
if (c == null)
|
||||||
|
@ -33,7 +33,6 @@ import com.gamingmesh.jobs.dao.JobsDAO;
|
|||||||
import com.gamingmesh.jobs.economy.PaymentData;
|
import com.gamingmesh.jobs.economy.PaymentData;
|
||||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||||
import com.gamingmesh.jobs.stuff.Debug;
|
|
||||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
||||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public class JobsListener implements Listener {
|
|||||||
if (!player.hasPermission("jobs.area.select"))
|
if (!player.hasPermission("jobs.area.select"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (player.getGameMode() == GameMode.CREATIVE)
|
if (player.getGameMode().equals(GameMode.CREATIVE))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
@ -190,6 +190,9 @@ public class JobsListener implements Listener {
|
|||||||
|
|
||||||
Player player = (Player) event.getWhoClicked();
|
Player player = (Player) event.getWhoClicked();
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!Jobs.getShopManager().GuiList.containsKey(player.getName()))
|
if (!Jobs.getShopManager().GuiList.containsKey(player.getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -348,6 +351,9 @@ public class JobsListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!isInteractOk(player))
|
if (!isInteractOk(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -388,6 +394,9 @@ public class JobsListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Sign sign = (Sign) block.getState();
|
Sign sign = (Sign) block.getState();
|
||||||
String FirstLine = sign.getLine(0);
|
String FirstLine = sign.getLine(0);
|
||||||
if (FirstLine.equalsIgnoreCase(Jobs.getLanguage().getMessage("signs.topline")))
|
if (FirstLine.equalsIgnoreCase(Jobs.getLanguage().getMessage("signs.topline")))
|
||||||
@ -445,6 +454,9 @@ public class JobsListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!player.hasPermission("jobs.command.signs")) {
|
if (!player.hasPermission("jobs.command.signs")) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("signs.cantcreate"));
|
player.sendMessage(Jobs.getLanguage().getMessage("signs.cantcreate"));
|
||||||
@ -640,7 +652,10 @@ public class JobsListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
ItemStack iih = player.getItemInHand();
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ItemStack iih = Jobs.getNms().getItemInMainHand(player);
|
||||||
|
|
||||||
if (iih == null)
|
if (iih == null)
|
||||||
return;
|
return;
|
||||||
@ -810,25 +825,23 @@ public class JobsListener implements Listener {
|
|||||||
newArmorType = ArmorTypes.matchType(hotbarItem);
|
newArmorType = ArmorTypes.matchType(hotbarItem);
|
||||||
newArmorPiece = hotbarItem;
|
newArmorPiece = hotbarItem;
|
||||||
oldArmorPiece = event.getClickedInventory().getItem(event.getSlot());
|
oldArmorPiece = event.getClickedInventory().getItem(event.getSlot());
|
||||||
} else {
|
} else
|
||||||
newArmorType = ArmorTypes.matchType(oldArmorPiece != null && oldArmorPiece.getType() != Material.AIR ? oldArmorPiece : event.getCursor());
|
newArmorType = ArmorTypes.matchType(oldArmorPiece != null && oldArmorPiece.getType() != Material.AIR ? oldArmorPiece : event.getCursor());
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
} else {
|
|
||||||
newArmorType = ArmorTypes.matchType(oldArmorPiece != null && oldArmorPiece.getType() != Material.AIR ? oldArmorPiece : event.getCursor());
|
newArmorType = ArmorTypes.matchType(oldArmorPiece != null && oldArmorPiece.getType() != Material.AIR ? oldArmorPiece : event.getCursor());
|
||||||
}
|
|
||||||
if (newArmorType != null && event.getRawSlot() == newArmorType.getSlot()) {
|
if (newArmorType != null && event.getRawSlot() == newArmorType.getSlot()) {
|
||||||
EquipMethod method = EquipMethod.DRAG;
|
EquipMethod method = EquipMethod.DRAG;
|
||||||
if (event.getAction().equals(InventoryAction.HOTBAR_SWAP) || numberkey)
|
if (event.getAction().equals(InventoryAction.HOTBAR_SWAP) || numberkey)
|
||||||
method = EquipMethod.HOTBAR_SWAP;
|
method = EquipMethod.HOTBAR_SWAP;
|
||||||
JobsArmorChangeEvent armorEquipEvent = new JobsArmorChangeEvent((Player) event.getWhoClicked(), method, newArmorType, oldArmorPiece, newArmorPiece);
|
JobsArmorChangeEvent armorEquipEvent = new JobsArmorChangeEvent((Player) event.getWhoClicked(), method, newArmorType, oldArmorPiece, newArmorPiece);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(armorEquipEvent);
|
Bukkit.getServer().getPluginManager().callEvent(armorEquipEvent);
|
||||||
if (armorEquipEvent.isCancelled()) {
|
if (armorEquipEvent.isCancelled())
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void playerInteractEvent(PlayerInteractEvent event) {
|
public void playerInteractEvent(PlayerInteractEvent event) {
|
||||||
|
@ -99,7 +99,6 @@ import com.gamingmesh.jobs.container.ExploreRespond;
|
|||||||
import com.gamingmesh.jobs.container.FastPayment;
|
import com.gamingmesh.jobs.container.FastPayment;
|
||||||
import com.gamingmesh.jobs.container.JobProgression;
|
import com.gamingmesh.jobs.container.JobProgression;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
import com.gamingmesh.jobs.stuff.Debug;
|
|
||||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
||||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling.ownershipFeedback;
|
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling.ownershipFeedback;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
@ -86,12 +86,10 @@ public class TabComplete implements TabCompleter {
|
|||||||
if (args.length > 3 && 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")) {
|
|
||||||
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;
|
break;
|
||||||
case "[boosteditems]":
|
case "[boosteditems]":
|
||||||
for (Entry<String, JobItems> one : ItemBoostManager.getItems().entrySet()) {
|
for (Entry<String, JobItems> one : ItemBoostManager.getItems().entrySet()) {
|
||||||
|
@ -196,17 +196,17 @@ Jobs:
|
|||||||
# if not given, then there is no limit
|
# if not given, then there is no limit
|
||||||
# this can be used for any action
|
# this can be used for any action
|
||||||
until-level: 30
|
until-level: 30
|
||||||
13:
|
gravel:
|
||||||
# you can use minuses to take away money if the player break this block
|
# you can use minuses to take away money if the player break this block
|
||||||
income: -1.0
|
income: -1.0
|
||||||
experience: -1.0
|
experience: -1.0
|
||||||
# payment for stripping wood logs, only for 1.13+ servers
|
# payment for stripping wood logs, only for 1.13+ servers
|
||||||
StripLogs:
|
StripLogs:
|
||||||
STRIPPED_ACACIA_LOG:
|
stripped_acacia_log:
|
||||||
income: 1.0
|
income: 1.0
|
||||||
points: 1.0
|
points: 1.0
|
||||||
experience: 1.0
|
experience: 1.0
|
||||||
STRIPPED_OAK_LOG:
|
stripped_oak_log:
|
||||||
income: 1.0
|
income: 1.0
|
||||||
points: 1.0
|
points: 1.0
|
||||||
experience: 1.0
|
experience: 1.0
|
||||||
@ -314,7 +314,7 @@ Jobs:
|
|||||||
Green:
|
Green:
|
||||||
income: 2.0
|
income: 2.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
Light_Blue:
|
Navy:
|
||||||
income: 2.0
|
income: 2.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
Lime:
|
Lime:
|
||||||
@ -1723,7 +1723,7 @@ Jobs:
|
|||||||
income: 4.0
|
income: 4.0
|
||||||
points: 4.0
|
points: 4.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
Light_Blue:
|
Navy:
|
||||||
income: 4.0
|
income: 4.0
|
||||||
points: 4.0
|
points: 4.0
|
||||||
experience: 5.0
|
experience: 5.0
|
||||||
|
@ -85,6 +85,16 @@ command:
|
|||||||
boostalladded: '&aTapasztalat növelése %boost% minden munkához hozzáadva!'
|
boostalladded: '&aTapasztalat növelése %boost% minden munkához hozzáadva!'
|
||||||
boostadded: '&aTapasztalat növelése &e%boost% &ahozzáadva a(z) &e%jobname% &amunkához!'
|
boostadded: '&aTapasztalat növelése &e%boost% &ahozzáadva a(z) &e%jobname% &amunkához!'
|
||||||
infostats: '&c-----> &aTapasztalat arány x%boost% engedélyezve&c <-------'
|
infostats: '&c-----> &aTapasztalat arány x%boost% engedélyezve&c <-------'
|
||||||
|
itembonus:
|
||||||
|
help:
|
||||||
|
info: 'Ellenőrzi az elem bónuszt.'
|
||||||
|
args: ''
|
||||||
|
output:
|
||||||
|
list: '&e[jobname]: %money% %points% %exp%'
|
||||||
|
edititembonus:
|
||||||
|
help:
|
||||||
|
info: 'Tárgybónusz szerkesztése.'
|
||||||
|
args: 'list/add/remove [jobname] [boosteditems]'
|
||||||
bonus:
|
bonus:
|
||||||
help:
|
help:
|
||||||
info: 'A munkabónuszok megjelenítése.'
|
info: 'A munkabónuszok megjelenítése.'
|
||||||
@ -247,7 +257,7 @@ command:
|
|||||||
give:
|
give:
|
||||||
help:
|
help:
|
||||||
info: 'A tárgyakat a feladatok neve és az elemek kategóriája alapján adja meg. A játékos neve opcionális.'
|
info: 'A tárgyakat a feladatok neve és az elemek kategóriája alapján adja meg. A játékos neve opcionális.'
|
||||||
args: '[playername] [jobname] [items/limiteditems] [jobitemname]'
|
args: '[playername] [jobname]/[jobitemname] [items/limiteditems] [jobitemname]'
|
||||||
output:
|
output:
|
||||||
notonline: '&4[%playername%] nem elérhető!'
|
notonline: '&4[%playername%] nem elérhető!'
|
||||||
noitem: '&4Nincs találat ezzel a névvel lévő tárgyról!'
|
noitem: '&4Nincs találat ezzel a névvel lévő tárgyról!'
|
||||||
@ -288,6 +298,9 @@ command:
|
|||||||
place:
|
place:
|
||||||
info: '&eLerak'
|
info: '&eLerak'
|
||||||
none: '%jobname%&c nem kap pénzt, ha blokkot helyez le.'
|
none: '%jobname%&c nem kap pénzt, ha blokkot helyez le.'
|
||||||
|
striplogs:
|
||||||
|
info: '&eFa hántolás'
|
||||||
|
none: '%jobname% nem kap pénzt a fák hántolásáért.'
|
||||||
kill:
|
kill:
|
||||||
info: '&eMegöl'
|
info: '&eMegöl'
|
||||||
none: '%jobname%&c nem kap pénzt, ha szörnyet gyilkol.'
|
none: '%jobname%&c nem kap pénzt, ha szörnyet gyilkol.'
|
||||||
@ -445,6 +458,7 @@ command:
|
|||||||
args: '[playername] [jobname]'
|
args: '[playername] [jobname]'
|
||||||
error:
|
error:
|
||||||
alreadyin: '&cA játékos már dolgozik %jobname% munkánál.'
|
alreadyin: '&cA játékos már dolgozik %jobname% munkánál.'
|
||||||
|
fullslots: '&cNem tudsz csatlakozni a(z) %jobname%&c munkához, mert nincsenek rendelkezésre álló helyek.'
|
||||||
output:
|
output:
|
||||||
target: '&aMost már a(z) %jobname%&a munkánál dolgozik.'
|
target: '&aMost már a(z) %jobname%&a munkánál dolgozik.'
|
||||||
top:
|
top:
|
||||||
@ -587,16 +601,6 @@ command:
|
|||||||
points: '&6[points] pontot,'
|
points: '&6[points] pontot,'
|
||||||
'on': '&aEngedélyezve: &aIgen'
|
'on': '&aEngedélyezve: &aIgen'
|
||||||
'off': '&aEngedélyezve: &4Nem'
|
'off': '&aEngedélyezve: &4Nem'
|
||||||
itembonus:
|
|
||||||
help:
|
|
||||||
info: 'Ellenőrzi a bónuszt.'
|
|
||||||
args: ''
|
|
||||||
output:
|
|
||||||
list: '&e[jobname]: %money% %points% %exp%'
|
|
||||||
edititembonus:
|
|
||||||
help:
|
|
||||||
info: 'Tárgybónusz szerkesztése.'
|
|
||||||
args: 'list/add/remove [jobname] [itemBoostName]'
|
|
||||||
message:
|
message:
|
||||||
skillup:
|
skillup:
|
||||||
broadcast: '%playername% játékost előléptették a %titlename% %jobname% munkában.'
|
broadcast: '%playername% játékost előléptették a %titlename% %jobname% munkában.'
|
||||||
|
Loading…
Reference in New Issue
Block a user