mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
Jobs placeholders list now modifiable the page row
- Fixed issue when used the jobs top clear scoreboard then not removed the scoreboard - Jobs top help info message now executed when the job is specified - Now if the MySQL settings (account) is incorrect then not send "creating table..."
This commit is contained in:
parent
9d46a689e2
commit
34dcb3d41a
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
@ -28,7 +29,7 @@ public class gtop implements Cmd {
|
||||
Player player = (Player) sender;
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("clear")) {
|
||||
//player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
|
||||
player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
|
||||
plugin.getCMIScoreboardManager().removeScoreBoard(player);
|
||||
return true;
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ public class placeholders implements Cmd {
|
||||
return true;
|
||||
}
|
||||
|
||||
PageInfo pi = new PageInfo(sender instanceof Player ? 10 : JobsPlaceHolders.values().length, JobsPlaceHolders.values().length, page);
|
||||
PageInfo pi = new PageInfo(sender instanceof Player ? Jobs.getGCManager().PlaceholdersPage
|
||||
: JobsPlaceHolders.values().length, JobsPlaceHolders.values().length, page);
|
||||
|
||||
for (JobsPlaceHolders one : JobsPlaceHolders.values()) {
|
||||
if (one.isHidden())
|
||||
|
@ -19,12 +19,6 @@ public class top implements Cmd {
|
||||
@Override
|
||||
@JobCommand(500)
|
||||
public boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
|
||||
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.top.help.info", "%amount%", Jobs.getGCManager().JobsTopAmount));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.ingame"));
|
||||
return false;
|
||||
@ -32,8 +26,14 @@ public class top implements Cmd {
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (args.length != 1 && args.length != 2) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.error.nojob"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("clear")) {
|
||||
player.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
|
||||
plugin.getCMIScoreboardManager().removeScoreBoard(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -68,6 +68,8 @@ public class top implements Cmd {
|
||||
return true;
|
||||
}
|
||||
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.help.info", "%amount%", Jobs.getGCManager().JobsTopAmount));
|
||||
|
||||
if (!Jobs.getGCManager().ShowToplistInScoreboard) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.top.output.topline", "%jobname%", job.getName(), "%amount%", pi.getPerPageCount()));
|
||||
int i = pi.getStart();
|
||||
|
@ -119,7 +119,7 @@ public class GeneralConfigManager {
|
||||
public ItemStack guiBackButton;
|
||||
public ItemStack guiFiller;
|
||||
|
||||
public int JobsTopAmount;
|
||||
public int JobsTopAmount, PlaceholdersPage;
|
||||
|
||||
public Integer levelLossPercentageFromMax, levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume,
|
||||
SoundTitleChangePitch, ToplistInScoreboardInterval;
|
||||
@ -966,8 +966,10 @@ public class GeneralConfigManager {
|
||||
c.addComment("JobsGUI.SkipAmount", "Defines by how many slots we need to skip after group");
|
||||
JobsGUISkipAmount = c.get("JobsGUI.SkipAmount", 2);
|
||||
|
||||
c.addComment("JobsTop.AmountToShow", "Defines amount of players to be shown in one page for /jobs top & /jobs gtop");
|
||||
JobsTopAmount = c.get("JobsTop.AmountToShow", 15);
|
||||
c.addComment("PageRow.JobsTop.AmountToShow", "Defines amount of players to be shown in one page for /jobs top & /jobs gtop");
|
||||
JobsTopAmount = c.get("PageRow.JobsTop.AmountToShow", 15);
|
||||
c.addComment("PageRow.Placeholders.AmountToShow", "Defines amount of placeholders to be shown in one page for /jobs placeholders");
|
||||
PlaceholdersPage = c.get("PageRow.Placeholders.AmountToShow", 10);
|
||||
|
||||
CMIMaterial tmat = null;
|
||||
tmat = CMIMaterial.get(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN"));
|
||||
|
@ -33,6 +33,7 @@ public class ScheduleManager {
|
||||
public void start() {
|
||||
if (Jobs.getGCManager().BoostSchedule.isEmpty())
|
||||
return;
|
||||
cancel();
|
||||
autoTimerBukkitId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, autoTimer, 20, 30 * 20L);
|
||||
}
|
||||
|
||||
|
@ -374,6 +374,9 @@ public abstract class JobsDAO {
|
||||
public final synchronized void setUp() throws SQLException {
|
||||
setupConfig();
|
||||
|
||||
if (getConnection() == null)
|
||||
return;
|
||||
|
||||
try {
|
||||
for (DBTables one : DBTables.values()) {
|
||||
createDefaultTable(one);
|
||||
@ -403,7 +406,7 @@ public abstract class JobsDAO {
|
||||
|
||||
public boolean isConnected() {
|
||||
try {
|
||||
return pool.getConnection() != null;
|
||||
return pool != null && pool.getConnection() != null && !pool.getConnection().isClosed();
|
||||
} catch (SQLException e) {
|
||||
return false;
|
||||
}
|
||||
@ -2047,7 +2050,7 @@ public abstract class JobsDAO {
|
||||
*/
|
||||
protected JobsConnection getConnection() {
|
||||
try {
|
||||
return pool.getConnection();
|
||||
return isConnected() ? pool.getConnection() : null;
|
||||
} catch (SQLException e) {
|
||||
Jobs.getPluginLogger().severe("Unable to connect to the database: " + e.getMessage());
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user