mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
EntityDeath issue
try to add seen collumn every time create blocks table if not exist sound optimization
This commit is contained in:
parent
d5113847f0
commit
3a46bfb491
@ -403,20 +403,13 @@ public class PlayerManager {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Sound getSound(String soundName) {
|
|
||||||
for (Sound one : Sound.values()) {
|
|
||||||
if (one.name().equalsIgnoreCase(soundName))
|
|
||||||
return one;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasts level up about a player
|
* Broadcasts level up about a player
|
||||||
* @param jPlayer
|
* @param jPlayer
|
||||||
* @param job
|
* @param job
|
||||||
* @param oldLevel
|
* @param oldLevel
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void performLevelUp(JobsPlayer jPlayer, Job job, int oldLevel) {
|
public void performLevelUp(JobsPlayer jPlayer, Job job, int oldLevel) {
|
||||||
|
|
||||||
Player player = jPlayer.getPlayer();
|
Player player = jPlayer.getPlayer();
|
||||||
@ -435,8 +428,8 @@ public class PlayerManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (Jobs.getGCManager().SoundLevelupUse) {
|
if (Jobs.getGCManager().SoundLevelupUse) {
|
||||||
Sound sound = getSound(levelUpEvent.getSoundName());
|
Sound sound = levelUpEvent.getSound();
|
||||||
if (sound != null)
|
if (sound != null && player != null && player.getLocation() != null)
|
||||||
player.getWorld().playSound(player.getLocation(), sound, levelUpEvent.getSoundVolume(), levelUpEvent.getSoundPitch());
|
player.getWorld().playSound(player.getLocation(), sound, levelUpEvent.getSoundVolume(), levelUpEvent.getSoundPitch());
|
||||||
else
|
else
|
||||||
Bukkit.getConsoleSender().sendMessage("[Jobs] Cant find sound by name: " + levelUpEvent.getTitleChangeSoundName() + ". Please update it");
|
Bukkit.getConsoleSender().sendMessage("[Jobs] Cant find sound by name: " + levelUpEvent.getTitleChangeSoundName() + ". Please update it");
|
||||||
@ -475,7 +468,7 @@ public class PlayerManager {
|
|||||||
if (levelUpEvent.getNewTitle() != null && !levelUpEvent.getNewTitle().equals(levelUpEvent.getOldTitle())) {
|
if (levelUpEvent.getNewTitle() != null && !levelUpEvent.getNewTitle().equals(levelUpEvent.getOldTitle())) {
|
||||||
|
|
||||||
if (Jobs.getGCManager().SoundTitleChangeUse) {
|
if (Jobs.getGCManager().SoundTitleChangeUse) {
|
||||||
Sound sound = getSound(levelUpEvent.getTitleChangeSoundName());
|
Sound sound = levelUpEvent.getTitleChangeSound();
|
||||||
if (sound != null && player != null)
|
if (sound != null && player != null)
|
||||||
player.getWorld().playSound(player.getLocation(), sound, levelUpEvent.getTitleChangeVolume(),
|
player.getWorld().playSound(player.getLocation(), sound, levelUpEvent.getTitleChangeVolume(),
|
||||||
levelUpEvent.getTitleChangePitch());
|
levelUpEvent.getTitleChangePitch());
|
||||||
|
@ -1,149 +1,169 @@
|
|||||||
package com.gamingmesh.jobs.api;
|
package com.gamingmesh.jobs.api;
|
||||||
|
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
|
||||||
import com.gamingmesh.jobs.container.Title;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
import com.gamingmesh.jobs.container.Title;
|
||||||
public final class JobsLevelUpEvent extends Event implements Cancellable {
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
public final class JobsLevelUpEvent extends Event implements Cancellable {
|
||||||
private JobsPlayer player;
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private String JobName;
|
private JobsPlayer player;
|
||||||
private Title OldTitle;
|
private String JobName;
|
||||||
private Title NewTitle;
|
private Title OldTitle;
|
||||||
private int level;
|
private Title NewTitle;
|
||||||
private String soundLevelupSound;
|
private int level;
|
||||||
private int soundLevelupVolume;
|
private Sound soundLevelupSound;
|
||||||
private int soundLevelupPitch;
|
private int soundLevelupVolume = 1;
|
||||||
private String soundTitleChangeSound;
|
private int soundLevelupPitch = 3;
|
||||||
private int soundTitleChangeVolume;
|
private Sound soundTitleChangeSound;
|
||||||
private int soundTitleChangePitch;
|
private int soundTitleChangeVolume;
|
||||||
private boolean cancelled;
|
private int soundTitleChangePitch;
|
||||||
|
private boolean cancelled;
|
||||||
public JobsLevelUpEvent(JobsPlayer jPlayer, String JobName, int level, Title OldTitle, Title NewTitle, String soundLevelupSound, Integer soundLevelupVolume, Integer soundLevelupPitch, String soundTitleChangeSound, Integer soundTitleChangeVolume, Integer soundTitleChangePitch) {
|
|
||||||
this.player = jPlayer;
|
public JobsLevelUpEvent(JobsPlayer jPlayer, String JobName, int level, Title OldTitle, Title NewTitle, String soundLevelupSound, Integer soundLevelupVolume,
|
||||||
this.JobName = JobName;
|
Integer soundLevelupPitch, String soundTitleChangeSound, Integer soundTitleChangeVolume, Integer soundTitleChangePitch) {
|
||||||
this.OldTitle = OldTitle;
|
this.player = jPlayer;
|
||||||
this.NewTitle = NewTitle;
|
this.JobName = JobName;
|
||||||
this.level = level;
|
this.OldTitle = OldTitle;
|
||||||
this.soundLevelupSound = soundLevelupSound;
|
this.NewTitle = NewTitle;
|
||||||
this.soundLevelupVolume = soundLevelupVolume;
|
this.level = level;
|
||||||
this.soundLevelupPitch = soundLevelupPitch;
|
this.soundLevelupSound = getSound(soundLevelupSound);
|
||||||
this.soundTitleChangeSound = soundTitleChangeSound;
|
this.soundLevelupVolume = soundLevelupVolume;
|
||||||
this.soundTitleChangeVolume = soundTitleChangeVolume;
|
this.soundLevelupPitch = soundLevelupPitch;
|
||||||
this.soundTitleChangePitch = soundTitleChangePitch;
|
this.soundTitleChangeSound = getSound(soundTitleChangeSound);
|
||||||
}
|
this.soundTitleChangeVolume = soundTitleChangeVolume;
|
||||||
|
this.soundTitleChangePitch = soundTitleChangePitch;
|
||||||
public JobsPlayer getPlayer() {
|
}
|
||||||
return this.player;
|
|
||||||
}
|
private static Sound getSound(String soundName) {
|
||||||
|
for (Sound one : Sound.values()) {
|
||||||
public String getJobName() {
|
if (one.name().equalsIgnoreCase(soundName))
|
||||||
return this.JobName;
|
return one;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
public Title getOldTitle() {
|
}
|
||||||
return this.OldTitle;
|
|
||||||
}
|
public JobsPlayer getPlayer() {
|
||||||
|
return this.player;
|
||||||
public String getOldTitleName() {
|
}
|
||||||
return this.OldTitle.getName();
|
|
||||||
}
|
public String getJobName() {
|
||||||
|
return this.JobName;
|
||||||
public String getOldTitleShort() {
|
}
|
||||||
return this.OldTitle.getShortName();
|
|
||||||
}
|
public Title getOldTitle() {
|
||||||
|
return this.OldTitle;
|
||||||
public String getOldTitleColor() {
|
}
|
||||||
return this.OldTitle.getChatColor().toString();
|
|
||||||
}
|
public String getOldTitleName() {
|
||||||
|
return this.OldTitle.getName();
|
||||||
public Title getNewTitle() {
|
}
|
||||||
return this.NewTitle;
|
|
||||||
}
|
public String getOldTitleShort() {
|
||||||
|
return this.OldTitle.getShortName();
|
||||||
public String getNewTitleName() {
|
}
|
||||||
return this.NewTitle.getName();
|
|
||||||
}
|
public String getOldTitleColor() {
|
||||||
|
return this.OldTitle.getChatColor().toString();
|
||||||
public String getNewTitleShort() {
|
}
|
||||||
return this.NewTitle.getShortName();
|
|
||||||
}
|
public Title getNewTitle() {
|
||||||
|
return this.NewTitle;
|
||||||
public String getNewTitleColor() {
|
}
|
||||||
return this.NewTitle.getChatColor().toString();
|
|
||||||
}
|
public String getNewTitleName() {
|
||||||
|
return this.NewTitle.getName();
|
||||||
public String getSoundName() {
|
}
|
||||||
return this.soundLevelupSound;
|
|
||||||
}
|
public String getNewTitleShort() {
|
||||||
|
return this.NewTitle.getShortName();
|
||||||
public void setSoundName(String sound) {
|
}
|
||||||
this.soundLevelupSound = sound;
|
|
||||||
}
|
public String getNewTitleColor() {
|
||||||
|
return this.NewTitle.getChatColor().toString();
|
||||||
public int getSoundVolume() {
|
}
|
||||||
return this.soundLevelupVolume;
|
|
||||||
}
|
@Deprecated
|
||||||
|
public String getSoundName() {
|
||||||
public void setSoundVolume(int volume) {
|
return this.soundLevelupSound.name();
|
||||||
this.soundLevelupVolume = volume;
|
}
|
||||||
}
|
|
||||||
|
public Sound getSound() {
|
||||||
public int getSoundPitch() {
|
return this.soundLevelupSound;
|
||||||
return this.soundLevelupPitch;
|
}
|
||||||
}
|
|
||||||
|
public void setSound(Sound sound) {
|
||||||
public void setSoundPitch(int pitch) {
|
this.soundLevelupSound = sound;
|
||||||
this.soundLevelupPitch = pitch;
|
}
|
||||||
}
|
|
||||||
|
public int getSoundVolume() {
|
||||||
public String getTitleChangeSoundName() {
|
return this.soundLevelupVolume;
|
||||||
return this.soundTitleChangeSound;
|
}
|
||||||
}
|
|
||||||
|
public void setSoundVolume(int volume) {
|
||||||
public void setTitleChangeSoundName(String sound) {
|
this.soundLevelupVolume = volume;
|
||||||
this.soundTitleChangeSound = sound;
|
}
|
||||||
}
|
|
||||||
|
public int getSoundPitch() {
|
||||||
public int getTitleChangeVolume() {
|
return this.soundLevelupPitch;
|
||||||
return this.soundTitleChangeVolume;
|
}
|
||||||
}
|
|
||||||
|
public void setSoundPitch(int pitch) {
|
||||||
public void setTitleChangeVolume(int volume) {
|
this.soundLevelupPitch = pitch;
|
||||||
this.soundTitleChangeVolume = volume;
|
}
|
||||||
}
|
|
||||||
|
@Deprecated
|
||||||
public int getTitleChangePitch() {
|
public String getTitleChangeSoundName() {
|
||||||
return this.soundTitleChangePitch;
|
return this.soundTitleChangeSound.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitleChangePitch(int pitch) {
|
public Sound getTitleChangeSound() {
|
||||||
this.soundTitleChangePitch = pitch;
|
return this.soundTitleChangeSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLevel() {
|
public void setTitleChangeSound(Sound sound) {
|
||||||
return this.level;
|
this.soundTitleChangeSound = sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public int getTitleChangeVolume() {
|
||||||
public boolean isCancelled() {
|
return this.soundTitleChangeVolume;
|
||||||
return cancelled;
|
}
|
||||||
}
|
|
||||||
|
public void setTitleChangeVolume(int volume) {
|
||||||
@Override
|
this.soundTitleChangeVolume = volume;
|
||||||
public void setCancelled(boolean cancel) {
|
}
|
||||||
cancelled = cancel;
|
|
||||||
}
|
public int getTitleChangePitch() {
|
||||||
|
return this.soundTitleChangePitch;
|
||||||
@Override
|
}
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
public void setTitleChangePitch(int pitch) {
|
||||||
}
|
this.soundTitleChangePitch = pitch;
|
||||||
|
}
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
public int getLevel() {
|
||||||
}
|
return this.level;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
cancelled = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
}
|
}
|
@ -429,13 +429,16 @@ public class GeneralConfigManager {
|
|||||||
if (MultiServerCompatability)
|
if (MultiServerCompatability)
|
||||||
saveOnDisconnect = true;
|
saveOnDisconnect = true;
|
||||||
|
|
||||||
c.getW().addComment("Optimizations.DBCleaning.Jobs.Use", "When set to true, jobs data base will be cleaned on each startup to avoid having not used jobs",
|
c.getW().addComment("Optimizations.DBCleaning.Jobs.Use",
|
||||||
|
"Warning!!! before enabling this feature, please make data base backup, just in case there will be some issues with data base cleaning",
|
||||||
|
"When set to true, jobs data base will be cleaned on each startup to avoid having not used jobs",
|
||||||
"keep in mind that this will only clean actual jobs, but not recorded players");
|
"keep in mind that this will only clean actual jobs, but not recorded players");
|
||||||
DBCleaningJobsUse = c.get("Optimizations.DBCleaning.Jobs.Use", false);
|
DBCleaningJobsUse = c.get("Optimizations.DBCleaning.Jobs.Use", false);
|
||||||
c.getW().addComment("Optimizations.DBCleaning.Jobs.Level", "Any one who has jobs level equal or less then set, hies job will be removed from data base");
|
c.getW().addComment("Optimizations.DBCleaning.Jobs.Level", "Any one who has jobs level equal or less then set, hies job will be removed from data base");
|
||||||
DBCleaningJobsLvl = c.get("Optimizations.DBCleaning.Jobs.Level", 1);
|
DBCleaningJobsLvl = c.get("Optimizations.DBCleaning.Jobs.Level", 1);
|
||||||
|
|
||||||
c.getW().addComment("Optimizations.DBCleaning.Users.Use",
|
c.getW().addComment("Optimizations.DBCleaning.Users.Use",
|
||||||
|
"Warning!!! before enabling this feature, please make data base backup, just in case there will be some issues with data base cleaning",
|
||||||
"When set to true, data base will be cleaned on each startup from user data to avoid having old player data");
|
"When set to true, data base will be cleaned on each startup from user data to avoid having old player data");
|
||||||
DBCleaningUsersUse = c.get("Optimizations.DBCleaning.Users.Use", false);
|
DBCleaningUsersUse = c.get("Optimizations.DBCleaning.Users.Use", false);
|
||||||
c.getW().addComment("Optimizations.DBCleaning.Users.Days", "Any one who not playied for defined amount of days, will be removed from data base");
|
c.getW().addComment("Optimizations.DBCleaning.Users.Days", "Any one who not playied for defined amount of days, will be removed from data base");
|
||||||
|
@ -100,8 +100,8 @@ public abstract class JobsDAO {
|
|||||||
checkUpdate9();
|
checkUpdate9();
|
||||||
// creating block protection database
|
// creating block protection database
|
||||||
checkUpdate10();
|
checkUpdate10();
|
||||||
if (version <= 10)
|
// adding seen field into users table
|
||||||
checkUpdate11();
|
checkUpdate11();
|
||||||
}
|
}
|
||||||
|
|
||||||
version = 11;
|
version = 11;
|
||||||
@ -1196,7 +1196,7 @@ public abstract class JobsDAO {
|
|||||||
ii++;
|
ii++;
|
||||||
|
|
||||||
if (ii >= 100000) {
|
if (ii >= 100000) {
|
||||||
String message = ChatColor.translateAlternateColorCodes('&', "&6[Jobs] Loading (" + i +") BP");
|
String message = ChatColor.translateAlternateColorCodes('&', "&6[Jobs] Loading (" + i + ") BP");
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(message);
|
Bukkit.getServer().getConsoleSender().sendMessage(message);
|
||||||
ii = 0;
|
ii = 0;
|
||||||
}
|
}
|
||||||
|
@ -713,32 +713,7 @@ public class JobsDAOMySQL extends JobsDAO {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected synchronized void checkUpdate10() {
|
protected synchronized void checkUpdate10() {
|
||||||
JobsConnection conn = getConnection();
|
createDefaultBlockProtection();
|
||||||
if (conn == null) {
|
|
||||||
Jobs.getPluginLogger().severe("Could not run database updates! Could not connect to MySQL!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PreparedStatement prest = null;
|
|
||||||
ResultSet res = null;
|
|
||||||
int rows = 0;
|
|
||||||
try {
|
|
||||||
// Check for jobs table
|
|
||||||
prest = conn.prepareStatement("SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = ? AND table_name = ?;");
|
|
||||||
prest.setString(1, database);
|
|
||||||
prest.setString(2, getPrefix() + "blocks");
|
|
||||||
res = prest.executeQuery();
|
|
||||||
if (res.next()) {
|
|
||||||
rows = res.getInt(1);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
close(res);
|
|
||||||
close(prest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rows == 0)
|
|
||||||
createDefaultBlockProtection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -751,12 +726,11 @@ public class JobsDAOMySQL extends JobsDAO {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
executeSQL("ALTER TABLE `" + getPrefix() + "users` ADD COLUMN `seen` bigint;");
|
executeSQL("ALTER TABLE `" + getPrefix() + "users` ADD COLUMN `seen` bigint;");
|
||||||
} catch (SQLException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedStatement prest = null;
|
PreparedStatement prest = null;
|
||||||
try {
|
try {
|
||||||
prest = conn.prepareStatement("UPDATE `" + getPrefix() + "users` SET `seen` = ?;");
|
prest = conn.prepareStatement("UPDATE `" + getPrefix() + "users` SET `seen` = ?;");
|
||||||
@ -833,7 +807,7 @@ public class JobsDAOMySQL extends JobsDAO {
|
|||||||
|
|
||||||
private boolean createDefaultBlockProtection() {
|
private boolean createDefaultBlockProtection() {
|
||||||
try {
|
try {
|
||||||
executeSQL("CREATE TABLE `" + getPrefix()
|
executeSQL("CREATE TABLE IF NOT EXISTS `" + getPrefix()
|
||||||
+ "blocks` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `world` varchar(36) NOT NULL, `x` int, `y` int, `z` int, `recorded` bigint, `resets` bigint);");
|
+ "blocks` (`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, `world` varchar(36) NOT NULL, `x` int, `y` int, `z` int, `recorded` bigint, `resets` bigint);");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -778,45 +778,20 @@ public class JobsDAOSQLite extends JobsDAO {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected synchronized void checkUpdate10() {
|
protected synchronized void checkUpdate10() {
|
||||||
JobsConnection conn = getConnection();
|
createDefaultBlockProtection();
|
||||||
if (conn == null) {
|
|
||||||
Jobs.getPluginLogger().severe("Could not run database updates! Could not connect to MySQL!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PreparedStatement prest = null;
|
|
||||||
ResultSet res = null;
|
|
||||||
int rows = 0;
|
|
||||||
try {
|
|
||||||
// Check for jobs table
|
|
||||||
prest = conn.prepareStatement("SELECT COUNT(*) FROM sqlite_master WHERE name = ?;");
|
|
||||||
prest.setString(1, getPrefix() + "blocks");
|
|
||||||
res = prest.executeQuery();
|
|
||||||
if (res.next()) {
|
|
||||||
rows = res.getInt(1);
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
close(res);
|
|
||||||
close(prest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rows == 0)
|
|
||||||
createDefaultBlockProtection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected synchronized void checkUpdate11() {
|
protected synchronized void checkUpdate11() {
|
||||||
JobsConnection conn = getConnection();
|
JobsConnection conn = getConnection();
|
||||||
if (conn == null) {
|
if (conn == null) {
|
||||||
Jobs.getPluginLogger().severe("Could not run database updates! Could not connect to MySQL!");
|
Jobs.getPluginLogger().severe("Could not run database updates! Could not connect to SQLITE!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
executeSQL("ALTER TABLE `" + getPrefix() + "users` ADD COLUMN `seen` bigint;");
|
executeSQL("ALTER TABLE `" + getPrefix() + "users` ADD COLUMN `seen` bigint;");
|
||||||
} catch (SQLException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
}
|
}
|
||||||
@ -832,41 +807,6 @@ public class JobsDAOSQLite extends JobsDAO {
|
|||||||
close(prest);
|
close(prest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// HashMap<UUID, Long> map = new HashMap<UUID, Long>();
|
|
||||||
// Jobs.getPluginLogger().info("Updating player last seen value");
|
|
||||||
// for (OfflinePlayer one : Bukkit.getOfflinePlayers()) {
|
|
||||||
// map.put(one.getUniqueId(), one.getLastPlayed());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// PreparedStatement prestJobsT = null;
|
|
||||||
// try {
|
|
||||||
// prestJobsT = conn.prepareStatement("UPDATE `" + getPrefix() + "users` SET `seen` = ? WHERE `player_uuid` = ?;");
|
|
||||||
// conn.setAutoCommit(false);
|
|
||||||
//
|
|
||||||
// int i = 0;
|
|
||||||
// int y = 0;
|
|
||||||
// for (Entry<UUID, Long> users : map.entrySet()) {
|
|
||||||
// prestJobsT.setLong(1, users.getValue());
|
|
||||||
// prestJobsT.setString(2, users.getKey().toString());
|
|
||||||
// prestJobsT.addBatch();
|
|
||||||
//
|
|
||||||
// i++;
|
|
||||||
// y++;
|
|
||||||
// if (i >= 1000) {
|
|
||||||
// Jobs.getPluginLogger().info("Updated " + y + "/" + map.size());
|
|
||||||
// i = 0;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// prestJobsT.executeBatch();
|
|
||||||
// conn.commit();
|
|
||||||
// conn.setAutoCommit(true);
|
|
||||||
// Jobs.getPluginLogger().info("Finished");
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// } finally {
|
|
||||||
// close(prestJobsT);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean createDefaultExploreBase() {
|
private boolean createDefaultExploreBase() {
|
||||||
@ -933,7 +873,7 @@ public class JobsDAOSQLite extends JobsDAO {
|
|||||||
|
|
||||||
private boolean createDefaultBlockProtection() {
|
private boolean createDefaultBlockProtection() {
|
||||||
try {
|
try {
|
||||||
executeSQL("CREATE TABLE `" + getPrefix()
|
executeSQL("CREATE TABLE IF NOT EXISTS `" + getPrefix()
|
||||||
+ "blocks` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `world` varchar(36) NOT NULL, `x` int, `y` int, `z` int, `recorded` bigint, `resets` bigint);");
|
+ "blocks` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `world` varchar(36) NOT NULL, `x` int, `y` int, `z` int, `recorded` bigint, `resets` bigint);");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -852,11 +852,16 @@ public class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
// Payment for killing player with particular job, except NPC's
|
// Payment for killing player with particular job, except NPC's
|
||||||
if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) {
|
if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) {
|
||||||
List<JobProgression> jobs = Jobs.getPlayerManager().getJobsPlayer((Player) lVictim).getJobProgression();
|
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) lVictim);
|
||||||
if (jobs != null)
|
if (jPlayer == null)
|
||||||
for (JobProgression job : jobs) {
|
return;
|
||||||
Jobs.action(jDamager, new CustomKillInfo(job.getJob().getName(), ActionType.CUSTOMKILL), multiplier);
|
|
||||||
}
|
List<JobProgression> jobs = jPlayer.getJobProgression();
|
||||||
|
if (jobs == null)
|
||||||
|
return;
|
||||||
|
for (JobProgression job : jobs) {
|
||||||
|
Jobs.action(jDamager, new CustomKillInfo(job.getJob().getName(), ActionType.CUSTOMKILL), multiplier);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
name: Jobs
|
name: Jobs
|
||||||
description: Jobs Plugin for the BukkitAPI
|
description: Jobs Plugin for the BukkitAPI
|
||||||
main: com.gamingmesh.jobs.Jobs
|
main: com.gamingmesh.jobs.Jobs
|
||||||
version: 3.6.0
|
version: 3.6.1
|
||||||
author: phrstbrn
|
author: phrstbrn
|
||||||
depend: [Vault]
|
depend: [Vault]
|
||||||
softdepend: [CoreProtect, MythicMobs, McMMO]
|
softdepend: [MythicMobs, McMMO]
|
||||||
commands:
|
commands:
|
||||||
jobs:
|
jobs:
|
||||||
description: Jobs
|
description: Jobs
|
||||||
|
Loading…
Reference in New Issue
Block a user