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

Fix for sqlite truncate

This commit is contained in:
Zrips 2016-01-11 11:19:09 +02:00
parent d8e1896b6b
commit 11e374c0f3
4 changed files with 27 additions and 17 deletions

View File

@ -746,12 +746,18 @@ public abstract class JobsDAO {
public synchronized void saveExplore() { public synchronized void saveExplore() {
if (!Jobs.getExplore().isExploreEnabled()) if (!Jobs.getExplore().isExploreEnabled())
return; return;
JobsConnection conn = getConnection(); JobsConnection conn = getConnection();
if (conn == null) if (conn == null)
return; return;
try { try {
PreparedStatement prest = conn.prepareStatement("TRUNCATE TABLE `" + prefix + "explore`;");
PreparedStatement prest = null;
if (ConfigManager.getJobsConfiguration().storageMethod.equalsIgnoreCase("sqlite")) {
prest = conn.prepareStatement("DELETE from `" + prefix + "explore`;");
} else
prest = conn.prepareStatement("TRUNCATE TABLE `" + prefix + "explore`;");
prest.execute(); prest.execute();
prest.close(); prest.close();
@ -780,7 +786,7 @@ public abstract class JobsDAO {
public synchronized void loadExplore() { public synchronized void loadExplore() {
if (!Jobs.getExplore().isExploreEnabled()) if (!Jobs.getExplore().isExploreEnabled())
return; return;
JobsConnection conn = getConnection(); JobsConnection conn = getConnection();
if (conn == null) if (conn == null)
return; return;

View File

@ -1098,7 +1098,7 @@ public class JobsPaymentListener implements Listener {
if (event.getEntityType() != EntityType.PRIMED_TNT && event.getEntityType() != EntityType.MINECART_TNT) if (event.getEntityType() != EntityType.PRIMED_TNT && event.getEntityType() != EntityType.MINECART_TNT)
return; return;
double closest = 30.0; double closest = 60.0;
Player player = null; Player player = null;
Location loc = event.getEntity().getLocation(); Location loc = event.getEntity().getLocation();
for (Player i : Bukkit.getOnlinePlayers()) { for (Player i : Bukkit.getOnlinePlayers()) {
@ -1113,7 +1113,7 @@ public class JobsPaymentListener implements Listener {
} }
} }
if (player == null || closest == 30.0) if (player == null || closest == 60.0)
return; return;
if (!player.isOnline()) if (!player.isOnline())

View File

@ -77,17 +77,21 @@ public class ActionBar {
if (!Jobs.actionbartoggle.containsKey(playername) && ConfigManager.getJobsConfiguration().JobsToggleEnabled) if (!Jobs.actionbartoggle.containsKey(playername) && ConfigManager.getJobsConfiguration().JobsToggleEnabled)
Jobs.actionbartoggle.put(playername, true); Jobs.actionbartoggle.put(playername, true);
if (playername != null && Jobs.actionbartoggle.size() > 0) if (playername == null)
if (Jobs.actionbartoggle.containsKey(playername)) { return;
Boolean show = Jobs.actionbartoggle.get(playername);
Player abp = (Player) payment.getOfflinePlayer(); if (!Jobs.actionbartoggle.containsKey(playername))
if (abp != null && show) { return;
String Message = Language.getMessage("command.toggle.output.paid");
Message = Message.replace("[amount]", String.format("%.2f", payment.getAmount())); Boolean show = Jobs.actionbartoggle.get(playername);
Message = Message.replace("[exp]", String.format("%.2f", payment.getExp())); Player abp = (Player) payment.getOfflinePlayer();
ActionBar.send(abp, ChatColor.GREEN + Message); if (abp != null && show) {
} String Message = Language.getMessage("command.toggle.output.paid");
} Message = Message.replace("[amount]", String.format("%.2f", payment.getAmount()));
Message = Message.replace("[exp]", String.format("%.2f", payment.getExp()));
ActionBar.send(abp, ChatColor.GREEN + Message);
}
} }
public static void send(Player receivingPacket, String msg) { public static void send(Player receivingPacket, String msg) {

View File

@ -1,7 +1,7 @@
name: Jobs name: Jobs
description: Jobs Plugin for the BukkitAPI description: Jobs Plugin for the BukkitAPI
main: com.gamingmesh.jobs.JobsPlugin main: com.gamingmesh.jobs.JobsPlugin
version: 2.59.0 version: 2.59.1
author: phrstbrn author: phrstbrn
softdepend: [Vault, CoreProtect, MythicMobs, McMMO] softdepend: [Vault, CoreProtect, MythicMobs, McMMO]
commands: commands: