1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-08 09:17:48 +01:00

Added some 1.13 blocks

- Some command permission fixes
- Now used UTF-8 in the MySQL, #147
- Fix last commit when a player level up or skill up and broadcast
This commit is contained in:
montlikadani 2019-01-04 20:46:32 +01:00
parent 18d49a8553
commit 33c1bb961d
16 changed files with 57 additions and 52 deletions

View File

@ -623,6 +623,7 @@ public class ItemManager {
ACACIA_STAIRS(163, 0, 17453, "Acacia Stairs"), ACACIA_STAIRS(163, 0, 17453, "Acacia Stairs"),
ACACIA_TRAPDOOR(-1, -1, 18343, "Acacia Trapdoor"), ACACIA_TRAPDOOR(-1, -1, 18343, "Acacia Trapdoor"),
ACACIA_WOOD(-1, -1, 21861, "Acacia Wood"), ACACIA_WOOD(-1, -1, 21861, "Acacia Wood"),
ACACIA_WOOD_BARK(-1, -1, 156, "Acacia Wood With Bark"),
ACTIVATOR_RAIL(157, 0, 5834, "Activator Rail"), ACTIVATOR_RAIL(157, 0, 5834, "Activator Rail"),
AIR(0, 0, 9648, "Air"), AIR(0, 0, 9648, "Air"),
ALLIUM(38, 2, 6871, "Allium", "RED_ROSE"), ALLIUM(38, 2, 6871, "Allium", "RED_ROSE"),
@ -658,6 +659,7 @@ public class ItemManager {
BIRCH_STAIRS(135, 0, 7657, "Birch Wood Stairs", "Birch Stairs"), BIRCH_STAIRS(135, 0, 7657, "Birch Wood Stairs", "Birch Stairs"),
BIRCH_TRAPDOOR(-1, -1, 32585, "Birch Trapdoor"), BIRCH_TRAPDOOR(-1, -1, 32585, "Birch Trapdoor"),
BIRCH_WOOD(-1, -1, 20913, "Birch Wood"), BIRCH_WOOD(-1, -1, 20913, "Birch Wood"),
BIRCH_WOOD_BARK(-1, -1, 18354, "Birch Wood With Bark"),
BLACK_BANNER(425, 0, 9365, "Banner", "Black Banner"), BLACK_BANNER(425, 0, 9365, "Banner", "Black Banner"),
BLACK_BED(355, 15, 20490, "Black Bed"), BLACK_BED(355, 15, 20490, "Black Bed"),
BLACK_CARPET(171, 15, 6056, "Black Carpet"), BLACK_CARPET(171, 15, 6056, "Black Carpet"),
@ -823,6 +825,7 @@ public class ItemManager {
DARK_OAK_STAIRS(164, 0, 22921, "Dark Oak Stairs"), DARK_OAK_STAIRS(164, 0, 22921, "Dark Oak Stairs"),
DARK_OAK_TRAPDOOR(-1, -1, 10355, "Dark Oak Trapdoor"), DARK_OAK_TRAPDOOR(-1, -1, 10355, "Dark Oak Trapdoor"),
DARK_OAK_WOOD(-1, -1, 16995, "Dark Oak Wood"), DARK_OAK_WOOD(-1, -1, 16995, "Dark Oak Wood"),
DARK_OAK_WOOD_BARK(-1, -1, 7354, "Dark Oak Wood With Bark"),
DARK_PRISMARINE(168, 2, 19940, "Dark Prismarine"), DARK_PRISMARINE(168, 2, 19940, "Dark Prismarine"),
DARK_PRISMARINE_SLAB(-1, -1, 7577, "Dark Prismarine Slab"), DARK_PRISMARINE_SLAB(-1, -1, 7577, "Dark Prismarine Slab"),
DARK_PRISMARINE_STAIRS(-1, -1, 26511, "Dark Prismarine Stairs"), DARK_PRISMARINE_STAIRS(-1, -1, 26511, "Dark Prismarine Stairs"),
@ -1029,6 +1032,7 @@ public class ItemManager {
JUNGLE_STAIRS(136, 0, 20636, "Jungle Wood Stairs", "Jungle Stairs"), JUNGLE_STAIRS(136, 0, 20636, "Jungle Wood Stairs", "Jungle Stairs"),
JUNGLE_TRAPDOOR(-1, -1, 8626, "Jungle Trapdoor"), JUNGLE_TRAPDOOR(-1, -1, 8626, "Jungle Trapdoor"),
JUNGLE_WOOD(-1, -1, 10341, "Jungle Wood"), JUNGLE_WOOD(-1, -1, 10341, "Jungle Wood"),
JUNGLE_WOOD_BARK(-1, -1, 458, "Jungle Wood With Bark"),
KELP(-1, -1, 21916, "Kelp"), KELP(-1, -1, 21916, "Kelp"),
KELP_PLANT(-1, -1, 29697, "Kelp Plant"), KELP_PLANT(-1, -1, 29697, "Kelp Plant"),
KNOWLEDGE_BOOK(453, 0, 12646, "Knowledge Book"), KNOWLEDGE_BOOK(453, 0, 12646, "Knowledge Book"),
@ -1163,6 +1167,7 @@ public class ItemManager {
OAK_STAIRS(53, 0, 5449, "Oak Stairs", "WOOD_STAIRS"), OAK_STAIRS(53, 0, 5449, "Oak Stairs", "WOOD_STAIRS"),
OAK_TRAPDOOR(96, 0, 16927, "Oak Trapdoor", "Trapdoor"), OAK_TRAPDOOR(96, 0, 16927, "Oak Trapdoor", "Trapdoor"),
OAK_WOOD(-1, -1, 7378, "Oak Wood"), OAK_WOOD(-1, -1, 7378, "Oak Wood"),
OAK_WOOD_BARK(-1, -1, 2894, "Oak Wood With Bark"),
OBSERVER(218, 0, 10726, "Observer"), OBSERVER(218, 0, 10726, "Observer"),
OBSIDIAN(49, 0, 32723, "Obsidian"), OBSIDIAN(49, 0, 32723, "Obsidian"),
OCELOT_SPAWN_EGG(383, 98, 30080, "Spawn Ocelot", "Ocelot Spawn Egg"), OCELOT_SPAWN_EGG(383, 98, 30080, "Spawn Ocelot", "Ocelot Spawn Egg"),
@ -1418,6 +1423,7 @@ public class ItemManager {
SPRUCE_STAIRS(134, 0, 11192, "Spruce Wood Stairs", "Spruce Stairs"), SPRUCE_STAIRS(134, 0, 11192, "Spruce Wood Stairs", "Spruce Stairs"),
SPRUCE_TRAPDOOR(-1, -1, 10289, "Spruce Trapdoor"), SPRUCE_TRAPDOOR(-1, -1, 10289, "Spruce Trapdoor"),
SPRUCE_WOOD(-1, -1, 32328, "Spruce Wood"), SPRUCE_WOOD(-1, -1, 32328, "Spruce Wood"),
SPRUCE_WOOD_BARK(-1, -1, 22156, "Spruce Wood With Bark"),
SQUID_SPAWN_EGG(383, 94, 10682, "Spawn Squid", "Squid Spawn Egg"), SQUID_SPAWN_EGG(383, 94, 10682, "Spawn Squid", "Squid Spawn Egg"),
STICK(280, 0, 9773, "Stick"), STICK(280, 0, 9773, "Stick"),
STICKY_PISTON(29, 0, 18127, "Sticky Piston", "PISTON_STICKY_BASE"), STICKY_PISTON(29, 0, 18127, "Sticky Piston", "PISTON_STICKY_BASE"),
@ -2085,6 +2091,9 @@ public class ItemManager {
public boolean isPotion() { public boolean isPotion() {
switch (this) { switch (this) {
case LINGERING_POTION:
case SPLASH_POTION:
case POTION: case POTION:
case POTION_AWKWARD: case POTION_AWKWARD:
case POTION_FIRE_RESISTANCE_1: case POTION_FIRE_RESISTANCE_1:

View File

@ -984,9 +984,8 @@ public class Jobs extends JavaPlugin {
float factor = GconfigManager.maxPaymentCurveFactor; float factor = GconfigManager.maxPaymentCurveFactor;
double percentLoss = 100 / ((1 / factor * percentOver * percentOver) + 1); double percentLoss = 100 / ((1 / factor * percentOver * percentOver) + 1);
income = income - (income * percentLoss / 100); income = income - (income * percentLoss / 100);
}else { } else
income = 0D; income = 0D;
}
if (GconfigManager.getLimit(CurrencyType.MONEY).getStopWith().contains(CurrencyType.POINTS)) if (GconfigManager.getLimit(CurrencyType.MONEY).getStopWith().contains(CurrencyType.POINTS))
pointAmount = 0D; pointAmount = 0D;
} }

View File

@ -568,7 +568,7 @@ public class PlayerManager {
for (String line : message.split("\n")) { for (String line : message.split("\n")) {
if (Jobs.getGCManager().isBroadcastingLevelups()) { if (Jobs.getGCManager().isBroadcastingLevelups()) {
if (Jobs.getGCManager().BroadcastingLevelUpLevels.contains(oldLevel + 1) || Jobs.getGCManager().BroadcastingLevelUpLevels.contains(0)) if (Jobs.getGCManager().BroadcastingLevelUpLevels.contains(oldLevel + 1) || Jobs.getGCManager().BroadcastingLevelUpLevels.contains(0))
Jobs.consoleMsg(line); Bukkit.getServer().broadcastMessage(line);
} else if (player != null) { } else if (player != null) {
if (Jobs.getGCManager().LevelChangeActionBar) if (Jobs.getGCManager().LevelChangeActionBar)
Jobs.getActionBar().send(player, line); Jobs.getActionBar().send(player, line);
@ -607,7 +607,7 @@ public class PlayerManager {
message = message.replace("%jobname%", job.getChatColor() + job.getName()); message = message.replace("%jobname%", job.getChatColor() + job.getName());
for (String line : message.split("\n")) { for (String line : message.split("\n")) {
if (Jobs.getGCManager().isBroadcastingSkillups()) if (Jobs.getGCManager().isBroadcastingSkillups())
Jobs.consoleMsg(line); Bukkit.getServer().broadcastMessage(line);
else if (player != null) { else if (player != null) {
if (Jobs.getGCManager().TitleChangeActionBar) if (Jobs.getGCManager().TitleChangeActionBar)
Jobs.getActionBar().send(player, line); Jobs.getActionBar().send(player, line);

View File

@ -299,10 +299,6 @@ public class JobsCommands implements CommandExecutor {
/** /**
* Check Job joining permission * Check Job joining permission
*/ */
public boolean hasJobPermission(Player sender, Job job) {
return hasJobPermission((CommandSender) sender, job);
}
public boolean hasJobPermission(CommandSender sender, Job job) { public boolean hasJobPermission(CommandSender sender, Job job) {
if (!sender.hasPermission("jobs.use")) { if (!sender.hasPermission("jobs.use")) {
return false; return false;

View File

@ -28,6 +28,9 @@ public class itembonus implements Cmd {
return false; return false;
} }
if (!Jobs.hasPermission(sender, "jobs.commands.itembonus", true))
return true;
Player player = (Player) sender; Player player = (Player) sender;
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);

View File

@ -27,6 +27,9 @@ public class log implements Cmd {
return false; return false;
} }
if (!Jobs.hasPermission(sender, "jobs.commands.log", true))
return true;
if (args.length != 1 && args.length != 0) { if (args.length != 1 && args.length != 0) {
Jobs.getCommandManager().sendUsage(sender, "log"); Jobs.getCommandManager().sendUsage(sender, "log");
return true; return true;
@ -35,9 +38,9 @@ public class log implements Cmd {
if (args.length == 0) if (args.length == 0)
JPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); JPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
else if (args.length == 1) { else if (args.length == 1) {
if (!Jobs.hasPermission(sender, "jobs.commands.log.others", true)) { if (!Jobs.hasPermission(sender, "jobs.commands.log.others", true))
return true; return true;
}
JPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); JPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
} }

View File

@ -20,6 +20,9 @@ public class quests implements Cmd {
@Override @Override
@JobCommand(400) @JobCommand(400)
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
if (!Jobs.hasPermission(sender, "jobs.commands.quests", true))
return true;
JobsPlayer jPlayer = null; JobsPlayer jPlayer = null;
if (args.length >= 1 && args[0].equals("next")) { if (args.length >= 1 && args[0].equals("next")) {

View File

@ -17,6 +17,9 @@ public class shop implements Cmd {
return true; return true;
} }
if (!Jobs.hasPermission(sender, "jobs.commands.shop", true))
return true;
if (args.length != 0 && args.length != 1) { if (args.length != 0 && args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "shop"); Jobs.getCommandManager().sendUsage(sender, "shop");
return true; return true;

View File

@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import com.gamingmesh.jobs.economy.Economy;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;

View File

@ -240,7 +240,7 @@ public class LanguageManager {
c.get("command.limit.output.pointsLimit", "&ePoint limit: &2%current%&e/&2%total%"); c.get("command.limit.output.pointsLimit", "&ePoint limit: &2%current%&e/&2%total%");
c.get("command.limit.output.reachedmoneylimit", "&4You have reached money limit in given time!"); c.get("command.limit.output.reachedmoneylimit", "&4You have reached money limit in given time!");
c.get("command.limit.output.reachedmoneylimit2", "&eYou can check your limit with &2/jobs limit &ecommand"); c.get("command.limit.output.reachedmoneylimit2", "&eYou can check your limit with &2/jobs limit &ecommand");
c.get("command.limit.output.reachedmoneylimit3", "&eMoney earned is now reduced exponentially...but you still earn a little!!"); c.get("command.limit.output.reachedmoneylimit3", "&eMoney earned is now reduced exponentially... But you still earn a little!!");
c.get("command.limit.output.reachedexplimit", "&4You have reached exp limit in given time!"); c.get("command.limit.output.reachedexplimit", "&4You have reached exp limit in given time!");
c.get("command.limit.output.reachedexplimit2", "&eYou can check your limit with &2/jobs limit &ecommand"); c.get("command.limit.output.reachedexplimit2", "&eYou can check your limit with &2/jobs limit &ecommand");
c.get("command.limit.output.reachedpointslimit", "&4You have reached exp limit in given time!"); c.get("command.limit.output.reachedpointslimit", "&4You have reached exp limit in given time!");
@ -304,7 +304,6 @@ public class LanguageManager {
c.get("command.iteminfo.output.data", " &eItem data: &6%itemdata%"); c.get("command.iteminfo.output.data", " &eItem data: &6%itemdata%");
c.get("command.iteminfo.output.usage", " &eUsage: &6%first% &eor &6%second%"); c.get("command.iteminfo.output.usage", " &eUsage: &6%first% &eor &6%second%");
c.get("command.placeholders.help.info", "List out all placeholders"); c.get("command.placeholders.help.info", "List out all placeholders");
c.get("command.placeholders.help.args", "(parse) (placeholder)"); c.get("command.placeholders.help.args", "(parse) (placeholder)");
c.get("command.placeholders.output.list", "&e[place]. &7[placeholder]"); c.get("command.placeholders.output.list", "&e[place]. &7[placeholder]");

View File

@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import com.gamingmesh.jobs.commands.list.info;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -147,8 +146,9 @@ public class JobsPlayer {
data.AddAmount(type, amount); data.AddAmount(type, amount);
return true; return true;
} }
public double percentOverLimit(CurrencyType type) { public double percentOverLimit(CurrencyType type) {
Integer value = this.limits.get(type); Integer value = limits.get(type);
PaymentData data = getPaymentLimit(); PaymentData data = getPaymentLimit();
return data.percentOverLimit(type, value == null ? 0 : value); return data.percentOverLimit(type, value == null ? 0 : value);
} }
@ -170,7 +170,7 @@ public class JobsPlayer {
} }
public synchronized void hideBossBars() { public synchronized void hideBossBars() {
for (BossBarInfo one : this.barMap) { for (BossBarInfo one : barMap) {
one.getBar().setVisible(false); one.getBar().setVisible(false);
} }
} }

View File

@ -14,7 +14,7 @@ public class JobsMySQL extends JobsDAO {
private Jobs plugin; private Jobs plugin;
JobsMySQL(Jobs plugin, String hostname, String database, String username, String password, String prefix, boolean certificate, boolean ssl) { JobsMySQL(Jobs plugin, String hostname, String database, String username, String password, String prefix, boolean certificate, boolean ssl) {
super(plugin, "com.mysql.jdbc.Driver", "jdbc:mysql://" + hostname + "/" + database + "?autoReconnect=true&useSSL=" + ssl + "&verifyServerCertificate=" + certificate, username, password, prefix); super(plugin, "com.mysql.jdbc.Driver", "jdbc:mysql://" + hostname + "/" + database + "?useUnicode=true&characterEncoding=UTF-8&autoReConnect=true&useSSL=" + ssl + "&verifyServerCertificate=" + certificate, username, password, prefix);
this.plugin = plugin; this.plugin = plugin;
this.database = database; this.database = database;
this.setDbType(DataBaseType.MySQL); this.setDbType(DataBaseType.MySQL);

View File

@ -107,6 +107,7 @@ public class PaymentData {
return false; return false;
return true; return true;
} }
public double percentOverLimit(CurrencyType type, int limit) { public double percentOverLimit(CurrencyType type, int limit) {
return ((this.payments.get(type) / limit) - 1) * 100; return ((this.payments.get(type) / limit) - 1) * 100;
} }

View File

@ -221,19 +221,4 @@ public class CMIScoreboardManager {
Object con = conField.get(nmsPlayer); Object con = conField.get(nmsPlayer);
return con; return con;
} }
private String getMaxLengthofDName(String s) {
return s.length() > 16 ? s.substring(0, 16) : s;
}
private String getSecondMaxLengthofList(String s) {
if (s.length() > 32) {
s = s.substring(0, 32);
}
return s.length() > 16 ? s.substring(16, s.length()) : "";
}
private String getSlotColor(int slot) {
return ChatColor.values()[slot].toString();
}
} }

View File

@ -118,6 +118,7 @@ command:
pointsLimit: '&ePont limit: &2%current%&e/&2%total%' pointsLimit: '&ePont limit: &2%current%&e/&2%total%'
reachedmoneylimit: '&4Elérted a pénzkorlátot az adott időben!' reachedmoneylimit: '&4Elérted a pénzkorlátot az adott időben!'
reachedmoneylimit2: '&eA korlátot ellenőrizheted a &2/jobs limit &eparanccsal.' reachedmoneylimit2: '&eA korlátot ellenőrizheted a &2/jobs limit &eparanccsal.'
reachedmoneylimit3: '&eA szerzett pénz most már exponenciálisan csökkentve... De még mindig egy kicsit keres!!'
reachedexplimit: '&4Elérted a határidőt a meghatározott időben!' reachedexplimit: '&4Elérted a határidőt a meghatározott időben!'
reachedexplimit2: '&eA korlátot ellenőrizheted a &2/jobs limit &eparanccsal.' reachedexplimit2: '&eA korlátot ellenőrizheted a &2/jobs limit &eparanccsal.'
reachedpointslimit: '&4Elérted a határidőt a meghatározott időben!' reachedpointslimit: '&4Elérted a határidőt a meghatározott időben!'

View File

@ -41,6 +41,7 @@ permissions:
jobs.command.join: true jobs.command.join: true
jobs.command.leave: true jobs.command.leave: true
jobs.command.leaveall: true jobs.command.leaveall: true
jobs.command.log: true
jobs.command.info: true jobs.command.info: true
jobs.command.playerinfo: true jobs.command.playerinfo: true
jobs.command.fire: true jobs.command.fire: true
@ -50,6 +51,7 @@ permissions:
jobs.command.edititembonus: true jobs.command.edititembonus: true
jobs.command.promote: true jobs.command.promote: true
jobs.command.points: true jobs.command.points: true
jobs.command.quests: true
jobs.command.demote: true jobs.command.demote: true
jobs.command.grantxp: true jobs.command.grantxp: true
jobs.command.removexp: true jobs.command.removexp: true
@ -62,6 +64,7 @@ permissions:
jobs.command.limit: true jobs.command.limit: true
jobs.command.give: true jobs.command.give: true
jobs.command.signs: true jobs.command.signs: true
jobs.command.shop: true
jobs.command.stats: true jobs.command.stats: true
jobs.command.fixnames: true jobs.command.fixnames: true
jobs.command.signupdate: true jobs.command.signupdate: true
@ -71,6 +74,7 @@ permissions:
jobs.command.clearownership: true jobs.command.clearownership: true
jobs.command.expboost: true jobs.command.expboost: true
jobs.command.iteminfo: true jobs.command.iteminfo: true
jobs.command.itembonus: true
jobs.command.blockinfo: true jobs.command.blockinfo: true
jobs.command.browse: jobs.command.browse:
description: Grants access to the browse command description: Grants access to the browse command