1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

Added option to turn off MythicMob support, as it will brake if you

using old version of it.
Optimized Jobs long shutdown caused by Explorer feature recording to
data base taking to much time. Now its more or less instantaneous.
Fixed (fingers crossed) issue with limited items, now its should work
properly.
Changed item name in itemList.yml for flint
Changed default jobConfig.yml file, now there will be job with name of
exampleJob witch one will be ignored even if left in config file.Put
proper Woodcutter job beneath it to serve as correct woodcutter job.
This commit is contained in:
Zrips 2016-01-30 14:45:13 +02:00
parent 345810ef83
commit afa7d00939
10 changed files with 829 additions and 737 deletions

View File

@ -445,7 +445,7 @@ ItemList:
- '315 - Golden Chestplate = golden_chestplate'
- '316 - Golden Leggings = golden_leggings'
- '317 - Golden Boots = golden_boots'
- '318 - Flint = flint_and_steel'
- '318 - Flint = flint'
- '319 - Raw Porkchop = porkchop'
- '320 - Cooked Porkchop = cooked_porkchop'
- '321 - Painting = painting'

View File

@ -135,7 +135,7 @@ public class JobsPlugin extends JavaPlugin {
if (McMMOlistener.CheckmcMMO())
getServer().getPluginManager().registerEvents(new McMMOlistener(this), this);
if (MythicMobsListener.Check())
if (MythicMobsListener.Check() && ConfigManager.getJobsConfiguration().MythicMobsEnabled)
getServer().getPluginManager().registerEvents(new MythicMobsListener(this), this);
if (ConfigManager.getJobsConfiguration().useBlockProtection)

View File

@ -105,6 +105,11 @@ public class JobConfig {
// jobsSection = conf.createSection("Jobs");
//}
for (String jobKey : jobsSection.getKeys(false)) {
// Ignoring example job
if (jobKey.equalsIgnoreCase("exampleJob"))
continue;
ConfigurationSection jobSection = jobsSection.getConfigurationSection(jobKey);
String jobName = jobSection.getString("fullname");

View File

@ -74,6 +74,7 @@ public class JobsConfiguration {
protected int economyBatchDelay;
protected boolean saveOnDisconnect;
public boolean LocalOfflinePlayersData;
public boolean MythicMobsEnabled;
public boolean LoggingUse;
public boolean EconomyLimitUse, EconomyExpLimitUse, PayForRenaming, PayForEachCraft, SignsEnabled,
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useCoreProtect, BlockPlaceUse,
@ -655,6 +656,9 @@ public class JobsConfiguration {
"0.2 means 20% of original price");
superBreakerMultiplier = getDouble("ExploitProtections.McMMO.superBreakerMultiplier", 0.2, config, writer);
writer.addComment("ExploitProtections.MythicMobs", "MythicMobs plugin support","Disable if you having issues with it or using old version");
MythicMobsEnabled = getBoolean("ExploitProtections.MythicMobs.enabled", true, config, writer);
writer.addComment("ExploitProtections.Spawner.PreventSlimeSplit", "Prevent slime spliting when they are from spawner",
"Protects agains exploiting as new splited slimes is treated as naturaly spawned and not from spawner");
PreventSlimeSplit = getBoolean("ExploitProtections.Spawner.PreventSlimeSplit", true, config, writer);

View File

@ -46,6 +46,7 @@ import com.gamingmesh.jobs.container.Log;
import com.gamingmesh.jobs.container.LogAmounts;
import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.Loging;
import com.gamingmesh.jobs.stuff.OfflinePlayerList;
import com.gamingmesh.jobs.stuff.TimeManage;
@ -643,7 +644,8 @@ public abstract class JobsDAO {
if (conn == null)
return;
try {
PreparedStatement prest = conn.prepareStatement("UPDATE `" + prefix + "jobs` SET `level` = ?, `experience` = ?, `username` = ? WHERE `player_uuid` = ? AND `job` = ?;");
PreparedStatement prest = conn.prepareStatement("UPDATE `" + prefix
+ "jobs` SET `level` = ?, `experience` = ?, `username` = ? WHERE `player_uuid` = ? AND `job` = ?;");
for (JobProgression progression : player.getJobProgression()) {
prest.setInt(1, progression.getLevel());
prest.setInt(2, (int) progression.getExperience());
@ -748,6 +750,8 @@ public abstract class JobsDAO {
if (!Jobs.getExplore().isExploreEnabled())
return;
Debug.D("Starting explorer save");
JobsConnection conn = getConnection();
if (conn == null)
return;
@ -763,6 +767,7 @@ public abstract class JobsDAO {
prest.close();
PreparedStatement prest2 = conn.prepareStatement("INSERT INTO `" + prefix + "explore` (`worldname`, `chunkX`, `chunkZ`, `playerName`) VALUES (?, ?, ?, ?);");
conn.setAutoCommit(false);
for (Entry<String, ExploreRegion> worlds : Jobs.getExplore().getWorlds().entrySet()) {
for (ExploreChunk oneChunk : worlds.getValue().getChunks()) {
for (String oneuser : oneChunk.getPlayers()) {
@ -770,14 +775,18 @@ public abstract class JobsDAO {
prest2.setInt(2, oneChunk.getX());
prest2.setInt(3, oneChunk.getZ());
prest2.setString(4, oneuser);
prest2.execute();
prest2.addBatch();
}
}
}
prest2.executeBatch();
conn.commit();
conn.setAutoCommit(true);
prest2.close();
} catch (SQLException e) {
e.printStackTrace();
}
Debug.D("Explorer saved");
}
/**

View File

@ -521,33 +521,12 @@ public class JobsListener implements Listener {
String meinOk = null;
mein: for (JobProgression one : prog) {
second: for (JobLimitedItems oneItem : one.getJob().getLimitedItems()) {
if (oneItem.getId() != iih.getTypeId())
for (JobLimitedItems oneItem : one.getJob().getLimitedItems()) {
if (one.getLevel() >= oneItem.getLevel())
continue;
if (!isThisItem(oneItem, iih.getTypeId(), name, lore, enchants))
continue;
meinOk = one.getJob().getName();
if (oneItem.getName() != null && name != null)
if (!org.bukkit.ChatColor.translateAlternateColorCodes('&', oneItem.getName()).equalsIgnoreCase(name))
continue;
if (one.getLevel() < oneItem.getLevel())
continue;
for (Entry<Enchantment, Integer> oneE : enchants.entrySet()) {
if (oneItem.getenchants().containsKey(oneE.getKey())) {
if (oneItem.getenchants().get(oneE.getKey()) < oneE.getValue()) {
continue second;
}
} else
continue second;
}
for (String onelore : oneItem.getLore()) {
if (!lore.contains(onelore))
continue second;
}
meinOk = null;
break mein;
}
}
@ -558,6 +537,43 @@ public class JobsListener implements Listener {
}
}
private boolean isThisItem(JobLimitedItems oneItem, int id, String name, List<String> lore, Map<Enchantment, Integer> enchants) {
if (oneItem.getId() != id)
return false;
if (oneItem.getName() != null && name != null) {
if (!org.bukkit.ChatColor.translateAlternateColorCodes('&', oneItem.getName()).equalsIgnoreCase(name)) {
return false;
}
}
for (String onelore : oneItem.getLore()) {
if (!lore.contains(onelore)) {
return false;
}
}
boolean foundEnc = false;
for (Entry<Enchantment, Integer> oneE : enchants.entrySet()) {
if (oneItem.getenchants().containsKey(oneE.getKey())) {
if (oneItem.getenchants().get(oneE.getKey()) <= oneE.getValue()) {
foundEnc = true;
break;
} else {
continue;
}
} else {
continue;
}
}
if (!foundEnc)
return false;
return true;
}
@EventHandler
public void onChunkChangeMove(PlayerMoveEvent event) {

View File

@ -870,7 +870,7 @@ public class JobsPaymentListener implements Listener {
if (lVictim.getKiller().hasMetadata("NPC"))
return;
if (MythicMobsListener.Present) {
if (ConfigManager.getJobsConfiguration().MythicMobsEnabled && MythicMobsListener.Present) {
if (JobsPlugin.MMAPI.getMobAPI().isMythicMob(lVictim))
return;
}

View File

@ -9,7 +9,7 @@ public class Debug {
Player player = Bukkit.getPlayer("Zrips");
if (player == null)
return;
player.sendMessage(ChatColor.DARK_GRAY + "[Debug] " + ChatColor.DARK_AQUA + ChatColor.translateAlternateColorCodes('&', message));
player.sendMessage(ChatColor.DARK_GRAY + "[Jobs Debug] " + ChatColor.DARK_AQUA + ChatColor.translateAlternateColorCodes('&', message));
return;
}
}

View File

@ -11,8 +11,8 @@
# they will get 15 income and job1 will gain 10 experience and job2 will gain 5 experience.
Jobs:
# must be one word
Woodcutter:
# must be one word. This job will be ignored as this is just example of all posible actions
exampleJob:
# full name of the job (displayed when browsing a job, used when joining and leaving)
# also can be used as a prefix for the user's name if the option is enabled.
# Shown as a prefix only when the user has 1 job.
@ -29,13 +29,13 @@ Jobs:
# options are: full, title, job, shortfull, shorttitle, shortjob and none
chat-display: full
# [OPTIONAL] - the maximum level of this class
#max-level: 10
max-level: 10
# [OPTIONAL] - the maximum level of this class with specific permission
# use jobs.[jobsname].vipmaxlevel
#vip-max-level: 20
vip-max-level: 20
# [OPTIONAL] - the maximum number of users on the server that can have this job at
# any one time (includes offline players).
#slots: 1
slots: 1
# Equation used for calculating how much experience is needed to go to the next level.
# Available parameters:
# numjobs - the number of jobs the player has
@ -427,6 +427,64 @@ Jobs:
cmd-on-leave:
- 'msg [name] You have left this awesome [jobname] job'
- 'msg [name] See you soon!'
# from this point you can edit jobs by your liking, rename, remove or add new ones
Woodcutter:
fullname: Woodcutter
shortname: W
description: Earns money felling and planting trees
ChatColour: GREEN
chat-display: full
leveling-progression-equation: 100*((1.13+(0.01*(numjobs-1)))^(joblevel-1))
income-progression-equation: baseincome*((1.05)^(joblevel-1))
experience-progression-equation: baseexperience*((1.05)^(joblevel-1))
Gui:
Id: 17
Data: 2
Break:
17-0:
income: 2.5
experience: 2.5
17-1:
income: 2.0
experience: 2.0
17-2:
income: 2.5
experience: 2.5
17-3:
income: 2.5
experience: 2.5
18-0:
income: 0.5
experience: 0.5
18-1:
income: 0.5
experience: 0.5
18-2:
income: 0.5
experience: 0.5
18-3:
income: 0.5
experience: 0.5
161-0:
income: 0.5
experience: 0.5
161-1:
income: 0.5
experience: 0.5
162-0:
income: 2.5
experience: 2.5
162-1:
income: 2.5
experience: 2.5
Kill:
Player:
income: 7.5
experience: 7.5
custom-kill:
Woodcutter:
income: 10.0
experience: 10.0
Miner:
fullname: Miner
shortname: M

View File

@ -1,7 +1,7 @@
name: Jobs
description: Jobs Plugin for the BukkitAPI
main: com.gamingmesh.jobs.JobsPlugin
version: 2.61.0
version: 2.62.0
author: phrstbrn
softdepend: [Vault, CoreProtect, MythicMobs, McMMO]
commands: