mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-16 05:01:34 +01:00
parent
f8e581ee2a
commit
5cd8550ba9
@ -7,19 +7,19 @@ Jobs Plugin for the BukkitAPI
|
||||
***
|
||||
|
||||
# Jobs
|
||||
![Image of Jobs](https://proxy.spigotmc.org/da30c0fefd44c6de51f2a8af16b15071184a4b3b?url=http%3A%2F%2Fltcraft.lt%2Fwp-content%2Fuploads%2F2016%2F06%2Fnewlogo5.jpg)
|
||||
![Image of Jobs](https://www.spigotmc.org/data/resource_icons/4/4216.jpg?1424463769)
|
||||
|
||||
_Original author and manager of this was phrstbrn until [v2.12.0](https://dev.bukkit.org/projects/jobs/files/808311) version._
|
||||
|
||||
A fully configurable plugin that allows you to get paid for breaking, placing, killing, fishing, and crafting, and more. Class based professions, gain experience as you perform your job.
|
||||
|
||||
Main pages:
|
||||
Links
|
||||
- Bukkit: https://dev.bukkit.org/projects/jobs-reborn
|
||||
- Spigot: https://www.spigotmc.org/resources/4216/
|
||||
|
||||
# Jobs API
|
||||
You can manually add the jar file to your build path or you can use jitpack if you use maven or gradle:
|
||||
## Maven:
|
||||
## Maven
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
@ -37,7 +37,7 @@ You can manually add the jar file to your build path or you can use jitpack if y
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
## Gradle:
|
||||
## Gradle
|
||||
```gradle
|
||||
repositories {
|
||||
maven {
|
||||
|
@ -571,6 +571,8 @@ public class Job {
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
Jobs.getJobsIds().remove(this.id);
|
||||
|
||||
this.id = id;
|
||||
if (id != 0)
|
||||
Jobs.getJobsIds().put(id, this);
|
||||
|
@ -1191,13 +1191,43 @@ public abstract class JobsDAO {
|
||||
|
||||
conn.commit();
|
||||
} catch (SQLException e) {
|
||||
// e.printStackTrace();
|
||||
} finally {
|
||||
close(prestt);
|
||||
close(res2);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateJobId(Job job) {
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
return;
|
||||
|
||||
PreparedStatement prestt = null;
|
||||
ResultSet res = null;
|
||||
try {
|
||||
// Retrieve last id from table instead of generating new one
|
||||
int jobId = 0;
|
||||
prestt = conn.prepareStatement("SELECT * FROM `" + DBTables.JobNameTable.getTableName() + "`;");
|
||||
res = prestt.executeQuery();
|
||||
while (res.next()) {
|
||||
jobId = res.getInt("id");
|
||||
}
|
||||
close(prestt);
|
||||
close(res);
|
||||
|
||||
job.setId(jobId + 1);
|
||||
|
||||
prestt = conn.prepareStatement("UPDATE `" + getJobsTableName() + "` SET `" + JobsTableFields.jobid.getCollumn() + "` = ? WHERE `" + JobsTableFields.job.getCollumn() + "` = ?;");
|
||||
prestt.setString(1, job.getName());
|
||||
prestt.setInt(2, job.getId());
|
||||
prestt.execute();
|
||||
} catch (SQLException e) {
|
||||
} finally {
|
||||
close(prestt);
|
||||
close(res);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void loadAllJobsNames() {
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
@ -1225,7 +1255,7 @@ public abstract class JobsDAO {
|
||||
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
if (one.getId() == 0)
|
||||
recordNewJobName(one);
|
||||
updateJobId(one);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user