mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-20 07:01:22 +01:00
Some changes in commands due to duplicate values
This commit is contained in:
parent
75d41356d1
commit
c5d967a2f1
@ -2163,12 +2163,10 @@ public class ItemManager {
|
|||||||
return one;
|
return one;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mat == null) {
|
if (id.contains(":")) {
|
||||||
if (id.contains(":")) {
|
ci = byBukkitName.get(id.split(":")[0]);
|
||||||
ci = byBukkitName.get(id.split(":")[0]);
|
if (ci != null)
|
||||||
if (ci != null)
|
return ci.getCMIType();
|
||||||
return ci.getCMIType();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return CMIMaterial.NONE;
|
return CMIMaterial.NONE;
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,9 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Skull;
|
import org.bukkit.block.Skull;
|
||||||
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;
|
||||||
|
|
||||||
@ -23,7 +21,6 @@ import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
|||||||
import com.gamingmesh.jobs.config.CommentedYamlConfiguration;
|
import com.gamingmesh.jobs.config.CommentedYamlConfiguration;
|
||||||
import com.gamingmesh.jobs.container.Job;
|
import com.gamingmesh.jobs.container.Job;
|
||||||
import com.gamingmesh.jobs.container.TopList;
|
import com.gamingmesh.jobs.container.TopList;
|
||||||
import com.gamingmesh.jobs.stuff.Debug;
|
|
||||||
|
|
||||||
public class SignUtil {
|
public class SignUtil {
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gamingmesh.jobs.commands;
|
package com.gamingmesh.jobs.commands;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
@ -41,7 +42,6 @@ import com.gamingmesh.jobs.stuff.PageInfo;
|
|||||||
public class JobsCommands implements CommandExecutor {
|
public class JobsCommands implements CommandExecutor {
|
||||||
private static final String label = "jobs";
|
private static final String label = "jobs";
|
||||||
private static final String packagePath = "com.gamingmesh.jobs.commands.list";
|
private static final String packagePath = "com.gamingmesh.jobs.commands.list";
|
||||||
private static final List<String> hidenCommands = new ArrayList<>();
|
|
||||||
private Map<String, Integer> CommandList = new HashMap<>();
|
private Map<String, Integer> CommandList = new HashMap<>();
|
||||||
|
|
||||||
protected Jobs plugin;
|
protected Jobs plugin;
|
||||||
@ -120,7 +120,7 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
return args.length <= 1 ? new String[0] : Arrays.copyOfRange(args, 1, args.length);
|
return args.length <= 1 ? new String[0] : Arrays.copyOfRange(args, 1, args.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hasCommandPermission(CommandSender sender, String cmd) {
|
private boolean hasCommandPermission(CommandSender sender, String cmd) {
|
||||||
return sender.hasPermission("jobs.command." + cmd);
|
return sender.hasPermission("jobs.command." + cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,13 +142,12 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean help(CommandSender sender, int page) {
|
protected boolean help(CommandSender sender, int page) {
|
||||||
|
|
||||||
Map<String, Integer> commands = GetCommands(sender);
|
Map<String, Integer> commands = GetCommands(sender);
|
||||||
|
|
||||||
if (commands.isEmpty()) {
|
if (commands.isEmpty()) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
commands = sort(commands);
|
commands = sort(commands);
|
||||||
|
|
||||||
PageInfo pi = new PageInfo(7, commands.size(), page);
|
PageInfo pi = new PageInfo(7, commands.size(), page);
|
||||||
@ -213,7 +212,7 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
if (jarFile != null)
|
if (jarFile != null)
|
||||||
try {
|
try {
|
||||||
jarFile.close();
|
jarFile.close();
|
||||||
} catch (Throwable e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return listOfCommands;
|
return listOfCommands;
|
||||||
@ -222,8 +221,9 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
public Map<String, Integer> GetCommands(CommandSender sender) {
|
public Map<String, Integer> GetCommands(CommandSender sender) {
|
||||||
Map<String, Integer> temp = new HashMap<>();
|
Map<String, Integer> temp = new HashMap<>();
|
||||||
for (Entry<String, Integer> cmd : CommandList.entrySet()) {
|
for (Entry<String, Integer> cmd : CommandList.entrySet()) {
|
||||||
if (!hasCommandPermission(sender, cmd.getKey()))
|
if (sender instanceof Player && !hasCommandPermission(sender, cmd.getKey()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
temp.put(cmd.getKey(), cmd.getValue());
|
temp.put(cmd.getKey(), cmd.getValue());
|
||||||
}
|
}
|
||||||
return temp;
|
return temp;
|
||||||
@ -248,9 +248,8 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
for (Method met : OneClass.getValue().getMethods()) {
|
for (Method met : OneClass.getValue().getMethods()) {
|
||||||
if (!met.isAnnotationPresent(JobCommand.class))
|
if (!met.isAnnotationPresent(JobCommand.class))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String cmd = OneClass.getKey();
|
String cmd = OneClass.getKey();
|
||||||
if (hidenCommands.contains(met.getName().toLowerCase()))
|
|
||||||
continue;
|
|
||||||
CommandList.put(cmd, met.getAnnotation(JobCommand.class).value());
|
CommandList.put(cmd, met.getAnnotation(JobCommand.class).value());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -261,7 +260,7 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
Class<?> nmsClass = null;
|
Class<?> nmsClass = null;
|
||||||
try {
|
try {
|
||||||
nmsClass = Class.forName(packagePath + "." + cmd.toLowerCase());
|
nmsClass = Class.forName(packagePath + "." + cmd.toLowerCase());
|
||||||
} catch (ClassNotFoundException | IllegalArgumentException | SecurityException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
}
|
}
|
||||||
return nmsClass;
|
return nmsClass;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
|||||||
public class archive implements Cmd {
|
public class archive implements Cmd {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobCommand(1400)
|
@JobCommand(1401)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
JobsPlayer jPlayer = null;
|
JobsPlayer jPlayer = null;
|
||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
|
@ -20,7 +20,7 @@ import com.gamingmesh.jobs.stuff.Debug;
|
|||||||
public class area implements Cmd {
|
public class area implements Cmd {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobCommand(300)
|
@JobCommand(308)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
||||||
|
@ -14,7 +14,7 @@ public class blockinfo implements Cmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@JobCommand(1450)
|
@JobCommand(1472)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
||||||
|
@ -30,7 +30,7 @@ public class edititembonus implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobCommand(300)
|
@JobCommand(743)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
||||||
|
@ -9,7 +9,7 @@ import com.gamingmesh.jobs.commands.JobCommand;
|
|||||||
public class entitylist implements Cmd {
|
public class entitylist implements Cmd {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobCommand(1450)
|
@JobCommand(1452)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
|
|
||||||
if (args.length != 0) {
|
if (args.length != 0) {
|
||||||
|
@ -12,7 +12,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
|||||||
public class info implements Cmd {
|
public class info implements Cmd {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobCommand(300)
|
@JobCommand(287)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
||||||
|
@ -23,7 +23,7 @@ import com.gamingmesh.jobs.CMILib.RawMessage;
|
|||||||
public class itembonus implements Cmd {
|
public class itembonus implements Cmd {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobCommand(300)
|
@JobCommand(125)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
||||||
|
@ -12,7 +12,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
|||||||
public class promote implements Cmd {
|
public class promote implements Cmd {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobCommand(1600)
|
@JobCommand(1603)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
if (args.length < 3) {
|
if (args.length < 3) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "promote");
|
Jobs.getCommandManager().sendUsage(sender, "promote");
|
||||||
|
@ -9,7 +9,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
|
|||||||
public class resetlimit implements Cmd {
|
public class resetlimit implements Cmd {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobCommand(700)
|
@JobCommand(707)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "resetlimit");
|
Jobs.getCommandManager().sendUsage(sender, "resetlimit");
|
||||||
|
@ -16,7 +16,7 @@ import com.gamingmesh.jobs.container.QuestProgression;
|
|||||||
public class resetquest implements Cmd {
|
public class resetquest implements Cmd {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JobCommand(700)
|
@JobCommand(709)
|
||||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||||
if (args.length != 0 && args.length != 1 && args.length != 2) {
|
if (args.length != 0 && args.length != 1 && args.length != 2) {
|
||||||
Jobs.getCommandManager().sendUsage(sender, "resetquest");
|
Jobs.getCommandManager().sendUsage(sender, "resetquest");
|
||||||
|
@ -3,7 +3,6 @@ package com.gamingmesh.jobs.config;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
@ -340,6 +340,8 @@ public abstract class JobsDAO {
|
|||||||
return this.mySQL.replace("[tableName]", prefix + this.tableName);
|
return this.mySQL.replace("[tableName]", prefix + this.tableName);
|
||||||
case SqLite:
|
case SqLite:
|
||||||
return this.sQlite.replace("[tableName]", this.tableName);
|
return this.sQlite.replace("[tableName]", this.tableName);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -1636,13 +1638,12 @@ public abstract class JobsDAO {
|
|||||||
PreparedStatement update = null;
|
PreparedStatement update = null;
|
||||||
PreparedStatement delete = null;
|
PreparedStatement delete = null;
|
||||||
try {
|
try {
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
|
||||||
insert = conn.prepareStatement("INSERT INTO `" + prefix + "blocks` (`world`, `x`, `y`, `z`, `recorded`, `resets`) VALUES (?, ?, ?, ?, ?, ?);");
|
insert = conn.prepareStatement("INSERT INTO `" + prefix + "blocks` (`world`, `x`, `y`, `z`, `recorded`, `resets`) VALUES (?, ?, ?, ?, ?, ?);");
|
||||||
update = conn.prepareStatement("UPDATE `" + prefix + "blocks` SET `recorded` = ?, `resets` = ? WHERE `id` = ?;");
|
update = conn.prepareStatement("UPDATE `" + prefix + "blocks` SET `recorded` = ?, `resets` = ? WHERE `id` = ?;");
|
||||||
delete = conn.prepareStatement("DELETE from `" + getPrefix() + "blocks` WHERE `id` = ?;");
|
delete = conn.prepareStatement("DELETE from `" + getPrefix() + "blocks` WHERE `id` = ?;");
|
||||||
|
|
||||||
conn.setAutoCommit(false);
|
|
||||||
|
|
||||||
Long current = System.currentTimeMillis();
|
Long current = System.currentTimeMillis();
|
||||||
Long mark = System.currentTimeMillis() - (Jobs.getGCManager().BlockProtectionDays * 24L * 60L * 60L * 1000L);
|
Long mark = System.currentTimeMillis() - (Jobs.getGCManager().BlockProtectionDays * 24L * 60L * 60L * 1000L);
|
||||||
|
|
||||||
|
@ -55,16 +55,20 @@ public class ToggleBarHandling {
|
|||||||
if (Jobs.getGCManager().BossBarEnabled) {
|
if (Jobs.getGCManager().BossBarEnabled) {
|
||||||
config.set("bossBar", null);
|
config.set("bossBar", null);
|
||||||
|
|
||||||
for (Entry<String, Boolean> one : bossBarToggle.entrySet()) {
|
if (!bossBarToggle.isEmpty()) {
|
||||||
config.set("bossBar." + one.getKey(), one.getValue());
|
for (Entry<String, Boolean> one : bossBarToggle.entrySet()) {
|
||||||
|
config.set("bossBar." + one.getKey(), one.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Jobs.getGCManager().ActionBarsMessageByDefault) {
|
if (Jobs.getGCManager().ActionBarsMessageByDefault) {
|
||||||
config.set("actionBar", null);
|
config.set("actionBar", null);
|
||||||
|
|
||||||
for (Entry<String, Boolean> one : actionBarToggle.entrySet()) {
|
if (!actionBarToggle.isEmpty()) {
|
||||||
config.set("actionBar." + one.getKey(), one.getValue());
|
for (Entry<String, Boolean> one : actionBarToggle.entrySet()) {
|
||||||
|
config.set("actionBar." + one.getKey(), one.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ permissions:
|
|||||||
jobs.command.removexp: true
|
jobs.command.removexp: true
|
||||||
jobs.command.transfer: true
|
jobs.command.transfer: true
|
||||||
jobs.command.reload: true
|
jobs.command.reload: true
|
||||||
jobs.command.help: true
|
|
||||||
jobs.command.top: true
|
jobs.command.top: true
|
||||||
jobs.command.gtop: true
|
jobs.command.gtop: true
|
||||||
jobs.command.toggle: true
|
jobs.command.toggle: true
|
||||||
@ -151,9 +150,6 @@ permissions:
|
|||||||
jobs.command.moneyboost:
|
jobs.command.moneyboost:
|
||||||
description: Grants access to the moneyboost command
|
description: Grants access to the moneyboost command
|
||||||
default: op
|
default: op
|
||||||
jobs.command.help:
|
|
||||||
description: Grants access to the help command
|
|
||||||
default: true
|
|
||||||
jobs.command.toggle:
|
jobs.command.toggle:
|
||||||
description: Grants access to the toggle command
|
description: Grants access to the toggle command
|
||||||
default: true
|
default: true
|
||||||
|
Loading…
Reference in New Issue
Block a user