1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 14:05:25 +01:00

updated translatable names / some changes in sqlite

This commit is contained in:
Zrips 2016-04-10 14:02:28 +03:00
parent fc6f17a12c
commit 0d39b83495
14 changed files with 82 additions and 54 deletions

View File

@ -5,7 +5,7 @@
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/Vault1.5.3.jar"/>
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/mcMMO#127.jar"/>
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/CoreProtect_2.12.0.jar"/>
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/spigot-1.9.jar"/>
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/spigot-1.9.2.jar"/>
<classpathentry kind="lib" path="C:/Users/Arte/Desktop/Jobs/lib/MythicMobs-2.1.8.jar"/>
<classpathentry kind="output" path=""/>
</classpath>

View File

@ -776,12 +776,11 @@ public class Jobs {
Double income = jobinfo.getIncome(level, numjobs);
Double points = jobinfo.getPoints(level, numjobs);
if (income == 0D && points == 0D)
continue;
Double exp = jobinfo.getExperience(level, numjobs);
if (income == 0D && points == 0D && exp == 0D)
continue;
if (Jobs.getGCManager().addXpPlayer()) {
Player player = Bukkit.getServer().getPlayer(jPlayer.getPlayerUUID());
if (player != null) {
@ -873,12 +872,12 @@ public class Jobs {
expAmount = 0D;
}
if ((amount == 0D || pointAmount == 0D) && expAmount == 0D)
if (amount == 0D && pointAmount == 0D && expAmount == 0D)
continue;
if (Jobs.getGCManager().BossBarEnabled && Jobs.getGCManager().BossBarShowOnEachAction)
if (Jobs.getGCManager().BossBarEnabled && Jobs.getGCManager().BossBarShowOnEachAction){
Jobs.getBBManager().ShowJobProgression(jPlayer, prog);
else if (Jobs.getGCManager().BossBarEnabled && !Jobs.getGCManager().BossBarShowOnEachAction)
}else if (Jobs.getGCManager().BossBarEnabled && !Jobs.getGCManager().BossBarShowOnEachAction)
jPlayer.getUpdateBossBarFor().add(prog.getJob().getName());
Jobs.getEconomy().pay(jPlayer, amount, pointAmount, expAmount);

View File

@ -460,6 +460,9 @@ public class JobsCommands implements CommandExecutor {
points = points + (points * finalBoost.getPointsBoost() / 100);
String pointsColor = xp >= 0 ? "" : ChatColor.RED.toString();
if (income == 0D && points == 0D && xp == 0D)
continue;
message.append(" ");
message.append(Jobs.getLanguage().getMessage("command.info.help.material", "%material%", materialName));

View File

@ -44,3 +44,4 @@
/bonus.class
/editpoints.class
/blockinfo.class
/test.class

View File

@ -551,13 +551,7 @@ public class ConfigManager {
Jobs.getGCManager().setTntFinder(true);
double income = section.getDouble("income", 0.0);
if (income == 0)
incomeEquation = new Parser("0");
double points = section.getDouble("points", 0.0);
if (points == 0)
pointsEquation = new Parser("0");
double experience = section.getDouble("experience", 0.0);
int fromlevel = 1;

View File

@ -62,6 +62,9 @@ public class GeneralConfigManager {
public boolean LocalOfflinePlayersData;
public boolean MythicMobsEnabled;
public boolean LoggingUse;
public boolean PaymentMethodsMoney;
public boolean PaymentMethodsPoints;
public boolean PaymentMethodsExp;
// Money limit
public boolean MoneyLimitUse;
@ -480,6 +483,13 @@ public class GeneralConfigManager {
c.getW().addComment("economy-async", "Enable async economy calls.", "Disable this if you have issues with payments or your plugin is not thread safe.");
economyAsync = c.get("economy-async", true);
c.getW().addComment("Economy.PaymentMethods",
"By disabling one of thies, players no longer will get particular payment.",
"Usefull for removing particular payment method without editing whole jobConfig file");
PaymentMethodsMoney = c.get("Economy.PaymentMethods.Money", true);
PaymentMethodsPoints = c.get("Economy.PaymentMethods.Points", true);
PaymentMethodsExp = c.get("Economy.PaymentMethods.Exp", true);
c.getW().addComment("Economy.MinimumOveralPayment.use",
"Determines minimum payment. In example if player uses McMMO treefeller and earns only 20%, but at same time he gets 25% penalty from dynamic payment. He can 'get' negative amount of money",
"This will limit it to particular percentage", "Works only when original payment is above 0");

View File

@ -886,9 +886,9 @@ public class NameTranslatorManager {
c.get("ItemList.179.MCName", "red_sandstone");
c.get("ItemList.179.Name", "Red Sandstone");
c.get("ItemList.179:1.MCName", "red_sandstone");
c.get("ItemList.179:1.Name", "Smooth Red Sandstone");
c.get("ItemList.179:1.Name", "Chiseled Red Sandstone");
c.get("ItemList.179:2.MCName", "red_sandstone");
c.get("ItemList.179:2.Name", "Chiseled Red Sandstone");
c.get("ItemList.179:2.Name", "Smooth Red Sandstone");
c.get("ItemList.180.MCName", "red_sandstone_stairs");
c.get("ItemList.180.Name", "Red Sandstone Stairs");
c.get("ItemList.181.MCName", "stone_slab2");
@ -943,6 +943,8 @@ public class NameTranslatorManager {
c.get("ItemList.205.Name", "Purpur Slab");
c.get("ItemList.206.MCName", "end_bricks");
c.get("ItemList.206.Name", "End Stone Bricks");
c.get("ItemList.207.MCName", "beetroots");
c.get("ItemList.207.Name", "Beetroot Block");
c.get("ItemList.208.MCName", "grass_path");
c.get("ItemList.208.Name", "Grass Path");
c.get("ItemList.209.MCName", "end_gateway");
@ -1453,6 +1455,8 @@ public class NameTranslatorManager {
c.get("ItemList.2267.Name", "Wait Disc");
// Entity list
c.get("EntityList.-1.MCName", "Player");
c.get("EntityList.-1.Name", "Player");
c.get("EntityList.50.MCName", "Creeper");
c.get("EntityList.50.Name", "Creeper");
c.get("EntityList.51.MCName", "Skeleton");
@ -1497,8 +1501,8 @@ public class NameTranslatorManager {
c.get("EntityList.68.Name", "Guardian");
c.get("EntityList.68:1.MCName", "Guardian");
c.get("EntityList.68:1.Name", "Elder Guardian");
c.get("EntityList.68.MCName", "Shulker");
c.get("EntityList.68.Name", "Shulker");
c.get("EntityList.69.MCName", "Shulker");
c.get("EntityList.69.Name", "Shulker");
c.get("EntityList.90.MCName", "Pig");
c.get("EntityList.90.Name", "Pig");
c.get("EntityList.91.MCName", "Sheep");
@ -1525,6 +1529,8 @@ public class NameTranslatorManager {
c.get("EntityList.101.Name", "Rabbit");
c.get("EntityList.120.MCName", "Villager");
c.get("EntityList.120.Name", "Villager");
c.get("EntityList.200.MCName", "EnderCrystal");
c.get("EntityList.200.Name", "Ender Crystal");
// Enchant list
c.get("EnchantList.0.MCName", "PROTECTION_ENVIRONMENTAL");

View File

@ -18,6 +18,7 @@
package com.gamingmesh.jobs.container;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.resources.jfep.Parser;
public class JobInfo {
@ -88,6 +89,8 @@ public class JobInfo {
}
public double getIncome(double level, double numjobs) {
if (baseIncome == 0 || !Jobs.getGCManager().PaymentMethodsMoney)
return 0;
moneyEquation.setVariable("joblevel", level);
moneyEquation.setVariable("numjobs", numjobs);
moneyEquation.setVariable("baseincome", baseIncome);
@ -95,6 +98,8 @@ public class JobInfo {
}
public double getExperience(double level, double numjobs) {
if (baseXp == 0 || !Jobs.getGCManager().PaymentMethodsExp)
return 0;
xpEquation.setVariable("joblevel", level);
xpEquation.setVariable("numjobs", numjobs);
xpEquation.setVariable("baseexperience", baseXp);
@ -102,6 +107,8 @@ public class JobInfo {
}
public double getPoints(double level, double numjobs) {
if (basePoints == 0 || !Jobs.getGCManager().PaymentMethodsPoints)
return 0;
pointsEquation.setVariable("joblevel", level);
pointsEquation.setVariable("numjobs", numjobs);
pointsEquation.setVariable("basepoints", basePoints);

View File

@ -31,7 +31,6 @@ import com.gamingmesh.jobs.dao.JobsDAO;
import com.gamingmesh.jobs.dao.JobsDAOData;
import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.Perm;
public class JobsPlayer {
@ -595,7 +594,6 @@ public class JobsPlayer {
*/
public void save(JobsDAO dao) {
// synchronized (saveLock) {
Debug.D("saved: " + isSaved);
if (!isSaved()) {
dao.save(this);
dao.saveLog(this);
@ -642,7 +640,6 @@ public class JobsPlayer {
}
public void setSaved(boolean value) {
Debug.D("setting saved " + value);
isSaved = value;
}
}

View File

@ -43,7 +43,6 @@ import com.gamingmesh.jobs.container.LogAmounts;
import com.gamingmesh.jobs.container.PlayerInfo;
import com.gamingmesh.jobs.container.PlayerPoints;
import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.Loging;
import com.gamingmesh.jobs.stuff.TimeManage;
@ -643,7 +642,6 @@ public abstract class JobsDAO {
if (conn == null)
return;
try {
Debug.D("saving points");
PlayerPoints pointInfo = Jobs.getPlayerManager().getPointsData().getPlayerPointsInfo(player.getPlayerUUID());
String req = "UPDATE `" + prefix + "points` SET `totalpoints` = ?, `currentpoints` = ? WHERE `userid` = ?;";

View File

@ -506,8 +506,8 @@ public class JobsDAOSQLite extends JobsDAO {
}
}
executeSQL("CREATE TABLE `" + getPrefix() + "users` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `player_uuid` varchar(36) NOT NULL, `username` varchar(20));");
try {
executeSQL("CREATE TABLE `" + getPrefix() + "users` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `player_uuid` varchar(36) NOT NULL, `username` varchar(20));");
prest = conn.prepareStatement("INSERT INTO `" + getPrefix() + "users` (`player_uuid`, `username`) VALUES (?, ?);");
conn.setAutoCommit(false);
for (Entry<String, String> users : tempMap.entrySet()) {
@ -545,8 +545,8 @@ public class JobsDAOSQLite extends JobsDAO {
}
// Modifying jobs main table
executeSQL("ALTER TABLE `" + getPrefix() + "jobs` ADD COLUMN `userid` int;");
try {
executeSQL("ALTER TABLE `" + getPrefix() + "jobs` ADD COLUMN `userid` int;");
prest = conn.prepareStatement("UPDATE `" + getPrefix() + "jobs` SET `userid` = ? WHERE `player_uuid` = ?;");
conn.setAutoCommit(false);
for (Entry<String, PlayerInfo> users : tempPlayerMap.entrySet()) {
@ -567,8 +567,11 @@ public class JobsDAOSQLite extends JobsDAO {
}
// dropping 2 columns
try {
executeSQL("CREATE TABLE `" + getPrefix()
+ "jobs_temp` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `userid` int, `job` varchar(20), `experience` int, `level` int);");
} catch (Exception e) {
}
PreparedStatement pst111 = conn.prepareStatement("SELECT * FROM `" + getPrefix() + "jobs`;");
ResultSet rs11 = pst111.executeQuery();
@ -589,13 +592,15 @@ public class JobsDAOSQLite extends JobsDAO {
rs11.close();
if (insert11 != null)
insert11.close();
try {
executeSQL("DROP TABLE IF EXISTS `" + getPrefix() + "jobs`;");
executeSQL("ALTER TABLE `" + getPrefix() + "jobs_temp` RENAME TO `" + getPrefix() + "jobs`;");
} catch (Exception e) {
}
// Modifying jobs archive table
executeSQL("ALTER TABLE `" + getPrefix() + "archive` ADD COLUMN `userid` int;");
try {
executeSQL("ALTER TABLE `" + getPrefix() + "archive` ADD COLUMN `userid` int;");
prest = conn.prepareStatement("UPDATE `" + getPrefix() + "archive` SET `userid` = ? WHERE `player_uuid` = ?;");
conn.setAutoCommit(false);
for (Entry<String, PlayerInfo> users : tempPlayerMap.entrySet()) {
@ -616,8 +621,11 @@ public class JobsDAOSQLite extends JobsDAO {
}
// dropping 2 columns
try {
executeSQL("CREATE TABLE `" + getPrefix()
+ "archive_temp` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `userid` int, `job` varchar(20), `experience` int, `level` int);");
} catch (Exception e) {
}
PreparedStatement pst = conn.prepareStatement("SELECT * FROM `" + getPrefix() + "archive`;");
ResultSet rs = pst.executeQuery();
@ -633,13 +641,14 @@ public class JobsDAOSQLite extends JobsDAO {
insert.execute();
}
}
try {
executeSQL("DROP TABLE IF EXISTS `" + getPrefix() + "archive`;");
executeSQL("ALTER TABLE `" + getPrefix() + "archive_temp` RENAME TO `" + getPrefix() + "archive`;");
} catch (Exception e) {
}
// Modifying jobs log table
executeSQL("ALTER TABLE `" + getPrefix() + "log` ADD COLUMN `userid` int;");
try {
executeSQL("ALTER TABLE `" + getPrefix() + "log` ADD COLUMN `userid` int;");
prest = conn.prepareStatement("UPDATE `" + getPrefix() + "log` SET `userid` = ? WHERE `player_uuid` = ?;");
conn.setAutoCommit(false);
for (Entry<String, PlayerInfo> users : tempPlayerMap.entrySet()) {
@ -660,8 +669,11 @@ public class JobsDAOSQLite extends JobsDAO {
}
// dropping 2 columns
try {
executeSQL("CREATE TABLE `" + getPrefix()
+ "log_temp` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `userid` int, `time` bigint, `action` varchar(20), `itemname` varchar(60), `count` int, `money` double, `exp` double);");
} catch (Exception e) {
}
pst = conn.prepareStatement("SELECT * FROM `" + getPrefix() + "log`;");
rs = pst.executeQuery();
@ -685,11 +697,14 @@ public class JobsDAOSQLite extends JobsDAO {
if (insert != null)
insert.close();
try {
executeSQL("DROP TABLE IF EXISTS `" + getPrefix() + "log`;");
executeSQL("ALTER TABLE `" + getPrefix() + "log_temp` RENAME TO `" + getPrefix() + "log`;");
// Create new points table
executeSQL("CREATE TABLE `" + getPrefix()
+ "points` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `userid` int, `totalpoints` double, `currentpoints` double);");
} catch (Exception e) {
}
}
}

View File

@ -82,7 +82,6 @@ import com.gamingmesh.jobs.container.ExploreRespond;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.Perm;
import com.google.common.base.Objects;
@ -887,8 +886,6 @@ public class JobsPaymentListener implements Listener {
// Calulating multiplaier
double multiplier = NearSpawnerMultiplier + PetPayMultiplier;
Debug.D(multiplier + " " + NearSpawnerMultiplier + " " + PetPayMultiplier);
if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) {
Player VPlayer = (Player) lVictim;
if (jDamager.getUserName().equalsIgnoreCase(VPlayer.getName()))

View File

@ -1,9 +1,10 @@
name: Jobs
description: Jobs Plugin for the BukkitAPI
main: com.gamingmesh.jobs.JobsPlugin
version: 3.2.0
version: 3.3.0
author: phrstbrn
softdepend: [Vault, CoreProtect, MythicMobs, McMMO]
depend: [Vault]
softdepend: [CoreProtect, MythicMobs, McMMO]
commands:
jobs:
description: Jobs