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