mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-27 09:43:22 +01:00
Fixed signs updating
- Level, exp adding and taking amounts now correctly calculating.
This commit is contained in:
parent
d62349badc
commit
f19138db4d
@ -83,7 +83,7 @@ public class VersionChecker {
|
|||||||
Version() {
|
Version() {
|
||||||
try {
|
try {
|
||||||
this.value = Integer.valueOf(this.name().replaceAll("[^\\d.]", ""));
|
this.value = Integer.valueOf(this.name().replaceAll("[^\\d.]", ""));
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
shortVersion = this.name().substring(0, this.name().length() - 3);
|
shortVersion = this.name().substring(0, this.name().length() - 3);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -843,29 +842,25 @@ public class Jobs extends JavaPlugin {
|
|||||||
// itemManager = new ItemManager(this);
|
// itemManager = new ItemManager(this);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class<?> nmsClass;
|
Class<?> nmsClass = Class.forName("com.gamingmesh.jobs.nmsUtil." + version);
|
||||||
nmsClass = Class.forName("com.gamingmesh.jobs.nmsUtil." + version);
|
|
||||||
if (NMS.class.isAssignableFrom(nmsClass)) {
|
if (NMS.class.isAssignableFrom(nmsClass)) {
|
||||||
setNms((NMS) nmsClass.getConstructor().newInstance());
|
setNms((NMS) nmsClass.getConstructor().newInstance());
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Something went wrong, please note down version and contact author, version: " + version);
|
System.out.println("Something went wrong, please note down version and contact author, version: " + version);
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
|
} catch (Exception e) {
|
||||||
| SecurityException e) {
|
|
||||||
System.out.println("Your server version is not compatible with this plugins version! Plugin will be disabled: " + version);
|
System.out.println("Your server version is not compatible with this plugins version! Plugin will be disabled: " + version);
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
if (setupPlaceHolderAPI()) {
|
if (setupPlaceHolderAPI()) {
|
||||||
consoleMsg("&ePlaceholderAPI was found - Enabling capabilities.");
|
consoleMsg("&ePlaceholderAPI was found - Enabling capabilities.");
|
||||||
PlaceholderAPIEnabled = true;
|
PlaceholderAPIEnabled = true;
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class Placeholder {
|
|||||||
try {
|
try {
|
||||||
int id = Integer.parseInt(matcher.group(1).substring(1));
|
int id = Integer.parseInt(matcher.group(1).substring(1));
|
||||||
groups.add(id);
|
groups.add(id);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ public class Placeholder {
|
|||||||
for (Integer oneG : groups) {
|
for (Integer oneG : groups) {
|
||||||
lsInLs.add(matcher.group(oneG + 1));
|
lsInLs.add(matcher.group(oneG + 1));
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -264,12 +264,9 @@ public class Placeholder {
|
|||||||
return JobsPlaceholderType.Jobs;
|
return JobsPlaceholderType.Jobs;
|
||||||
}
|
}
|
||||||
if (plugin.isPlaceholderAPIEnabled()) {
|
if (plugin.isPlaceholderAPIEnabled()) {
|
||||||
try {
|
if (placeholder.contains("%")) {
|
||||||
if (placeholder.contains("%"))
|
|
||||||
if (!placeholder.equals(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, placeholder)))
|
if (!placeholder.equals(me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, placeholder)))
|
||||||
return JobsPlaceholderType.PAPI;
|
return JobsPlaceholderType.PAPI;
|
||||||
} catch (Throwable e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// For MVdWPlaceholderAPI
|
// For MVdWPlaceholderAPI
|
||||||
@ -282,18 +279,13 @@ public class Placeholder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String updatePlaceHolders(Player player, String message) {
|
public String updatePlaceHolders(Player player, String message) {
|
||||||
|
|
||||||
if (message == null)
|
if (message == null)
|
||||||
return null;
|
return null;
|
||||||
if (message.contains("%"))
|
if (message.contains("%"))
|
||||||
message = translateOwnPlaceHolder(player, message);
|
message = translateOwnPlaceHolder(player, message);
|
||||||
if (plugin.isPlaceholderAPIEnabled()) {
|
if (plugin.isPlaceholderAPIEnabled()) {
|
||||||
try {
|
|
||||||
if (message.contains("%"))
|
if (message.contains("%"))
|
||||||
message = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, message);
|
message = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, message);
|
||||||
} catch (Throwable e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// For MVdWPlaceholderAPI
|
// For MVdWPlaceholderAPI
|
||||||
// if (plugin.isMVdWPlaceholderAPIEnabled()) {
|
// if (plugin.isMVdWPlaceholderAPIEnabled()) {
|
||||||
@ -325,8 +317,7 @@ public class Placeholder {
|
|||||||
if (with.startsWith("$"))
|
if (with.startsWith("$"))
|
||||||
with = "\\" + with;
|
with = "\\" + with;
|
||||||
message = message.replaceFirst(group, with);
|
message = message.replaceFirst(group, with);
|
||||||
|
} catch (Exception e) {
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,7 +339,7 @@ public class Placeholder {
|
|||||||
int id = Integer.parseInt(value);
|
int id = Integer.parseInt(value);
|
||||||
if (id > 0)
|
if (id > 0)
|
||||||
j = user.getJobProgression().get(id - 1);
|
j = user.getJobProgression().get(id - 1);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
Job job = Jobs.getJob(value);
|
Job job = Jobs.getJob(value);
|
||||||
if (job != null)
|
if (job != null)
|
||||||
j = user.getJobProgression(job);
|
j = user.getJobProgression(job);
|
||||||
@ -362,7 +353,7 @@ public class Placeholder {
|
|||||||
int id = Integer.parseInt(value);
|
int id = Integer.parseInt(value);
|
||||||
if (id > 0)
|
if (id > 0)
|
||||||
j = Jobs.getJobs().get(id - 1);
|
j = Jobs.getJobs().get(id - 1);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
j = Jobs.getJob(value);
|
j = Jobs.getJob(value);
|
||||||
}
|
}
|
||||||
return j;
|
return j;
|
||||||
@ -376,7 +367,7 @@ public class Placeholder {
|
|||||||
if (placeHolder == null)
|
if (placeHolder == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
JobsPlayer user = Jobs.getPlayerManager().getJobsPlayer(uuid);
|
JobsPlayer user = uuid == null ? null : Jobs.getPlayerManager().getJobsPlayer(uuid);
|
||||||
// Placeholders by JobsPlayer object
|
// Placeholders by JobsPlayer object
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
switch (placeHolder) {
|
switch (placeHolder) {
|
||||||
|
@ -29,22 +29,22 @@ public class Reflections {
|
|||||||
private void initialize() {
|
private void initialize() {
|
||||||
try {
|
try {
|
||||||
CraftServerClass = getBukkitClass("CraftServer");
|
CraftServerClass = getBukkitClass("CraftServer");
|
||||||
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
CraftServer = CraftServerClass.cast(Bukkit.getServer());
|
CraftServer = CraftServerClass.cast(Bukkit.getServer());
|
||||||
} catch (SecurityException | IllegalArgumentException e) {
|
} catch (ClassCastException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
NBTTagCompound = getMinecraftClass("NBTTagCompound");
|
NBTTagCompound = getMinecraftClass("NBTTagCompound");
|
||||||
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
NBTBase = getMinecraftClass("NBTBase");
|
NBTBase = getMinecraftClass("NBTBase");
|
||||||
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
/*try {
|
/*try {
|
||||||
@ -55,7 +55,7 @@ public class Reflections {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
CraftItemStack = getBukkitClass("inventory.CraftItemStack");
|
CraftItemStack = getBukkitClass("inventory.CraftItemStack");
|
||||||
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
/*try {
|
/*try {
|
||||||
@ -65,7 +65,7 @@ public class Reflections {
|
|||||||
}*/
|
}*/
|
||||||
try {
|
try {
|
||||||
IStack = getMinecraftClass("ItemStack");
|
IStack = getMinecraftClass("ItemStack");
|
||||||
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,8 +126,12 @@ public class SignUtil {
|
|||||||
old.put(loc, newTemp);
|
old.put(loc, newTemp);
|
||||||
SignsByLocation.put(loc, newTemp);
|
SignsByLocation.put(loc, newTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!SignsByLocation.isEmpty()) {
|
||||||
Jobs.consoleMsg("&e[Jobs] Loaded " + SignsByLocation.size() + " top list signs");
|
Jobs.consoleMsg("&e[Jobs] Loaded " + SignsByLocation.size() + " top list signs");
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
signUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signs save file
|
// Signs save file
|
||||||
@ -163,6 +167,21 @@ public class SignUtil {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int update = -1;
|
||||||
|
|
||||||
|
public void signUpdate() {
|
||||||
|
if (update == -1) {
|
||||||
|
update = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (Entry<String, HashMap<String, jobsSign>> one : SignsByType.entrySet()) {
|
||||||
|
SignUpdate(Jobs.getJob(one.getKey()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 60 * 20L, Jobs.getGCManager().InfoUpdateInterval * 20L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean SignUpdate(Job job) {
|
public boolean SignUpdate(Job job) {
|
||||||
return SignUpdate(job, SignTopType.toplist);
|
return SignUpdate(job, SignTopType.toplist);
|
||||||
}
|
}
|
||||||
@ -171,34 +190,28 @@ public class SignUtil {
|
|||||||
return SignUpdate(null, type);
|
return SignUpdate(null, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer questSignUpdateShed = null;
|
|
||||||
|
|
||||||
public boolean SignUpdate(Job job, SignTopType type) {
|
public boolean SignUpdate(Job job, SignTopType type) {
|
||||||
if (!Jobs.getGCManager().SignsEnabled)
|
if (!Jobs.getGCManager().SignsEnabled)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int timelapse = 1;
|
if (update == -1) {
|
||||||
|
signUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
List<TopList> PlayerList = new ArrayList<>();
|
if (job == null)
|
||||||
|
|
||||||
if (type == null && job == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (type == null && job != null)
|
|
||||||
type = SignTopType.toplist;
|
|
||||||
|
|
||||||
if (type == null)
|
if (type == null)
|
||||||
type = SignTopType.toplist;
|
type = SignTopType.toplist;
|
||||||
|
|
||||||
HashMap<String, List<TopList>> temp = new HashMap<>();
|
|
||||||
|
|
||||||
String JobNameOrType = jobsSign.getIdentifier(job, type);
|
String JobNameOrType = jobsSign.getIdentifier(job, type);
|
||||||
|
|
||||||
HashMap<String, jobsSign> signs = this.SignsByType.get(JobNameOrType.toLowerCase());
|
HashMap<String, jobsSign> signs = this.SignsByType.get(JobNameOrType.toLowerCase());
|
||||||
|
|
||||||
if (signs == null)
|
if (signs == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
List<TopList> PlayerList = new ArrayList<>();
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case toplist:
|
case toplist:
|
||||||
break;
|
break;
|
||||||
@ -212,6 +225,8 @@ public class SignUtil {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashMap<String, List<TopList>> temp = new HashMap<>();
|
||||||
|
|
||||||
boolean save = false;
|
boolean save = false;
|
||||||
for (Entry<String, jobsSign> one : (new HashMap<String, jobsSign>(signs)).entrySet()) {
|
for (Entry<String, jobsSign> one : (new HashMap<String, jobsSign>(signs)).entrySet()) {
|
||||||
jobsSign jSign = one.getValue();
|
jobsSign jSign = one.getValue();
|
||||||
@ -280,8 +295,7 @@ public class SignUtil {
|
|||||||
sign.setLine(i, line);
|
sign.setLine(i, line);
|
||||||
}
|
}
|
||||||
sign.update();
|
sign.update();
|
||||||
if (!UpdateHead(sign, PlayerList.get(0).getPlayerName(), timelapse))
|
UpdateHead(sign, PlayerList.get(0).getPlayerName());
|
||||||
timelapse--;
|
|
||||||
} else {
|
} else {
|
||||||
if (jSign.getNumber() > PlayerList.size())
|
if (jSign.getNumber() > PlayerList.size())
|
||||||
return true;
|
return true;
|
||||||
@ -315,12 +329,9 @@ public class SignUtil {
|
|||||||
sign.setLine(3, translateSignLine("signs.SpecialList.bottom", no, PlayerName, pl.getLevel(), SignJobName));
|
sign.setLine(3, translateSignLine("signs.SpecialList.bottom", no, PlayerName, pl.getLevel(), SignJobName));
|
||||||
sign.update();
|
sign.update();
|
||||||
|
|
||||||
if (!UpdateHead(sign, pl.getPlayerName(), timelapse))
|
UpdateHead(sign, pl.getPlayerName());
|
||||||
timelapse--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
timelapse++;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (save)
|
if (save)
|
||||||
saveSigns();
|
saveSigns();
|
||||||
@ -337,9 +348,8 @@ public class SignUtil {
|
|||||||
"[job]", jobname);
|
"[job]", jobname);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean UpdateHead(final org.bukkit.block.Sign sign, final String Playername, int timelapse) {
|
public boolean UpdateHead(final org.bukkit.block.Sign sign, final String Playername) {
|
||||||
try {
|
try {
|
||||||
timelapse = timelapse < 1 ? 1 : timelapse;
|
|
||||||
BlockFace directionFacing = null;
|
BlockFace directionFacing = null;
|
||||||
if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) {
|
if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) {
|
||||||
org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) sign.getData();
|
org.bukkit.material.Sign signMat = (org.bukkit.material.Sign) sign.getData();
|
||||||
@ -378,22 +388,8 @@ public class SignUtil {
|
|||||||
if (skull.getOwner() != null && skull.getOwner().equalsIgnoreCase(Playername))
|
if (skull.getOwner() != null && skull.getOwner().equalsIgnoreCase(Playername))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Block b = loc.getBlock();
|
|
||||||
if (!(b.getState() instanceof Skull))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Skull skull = (Skull) b.getState();
|
|
||||||
if (skull == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
skull.setOwner(Playername);
|
skull.setOwner(Playername);
|
||||||
skull.update();
|
skull.update();
|
||||||
return;
|
|
||||||
}
|
|
||||||
}, timelapse * Jobs.getGCManager().InfoUpdateInterval * 20L);
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
package com.gamingmesh.jobs.actions;
|
|
||||||
|
|
||||||
import com.gamingmesh.jobs.container.ActionInfo;
|
|
||||||
import com.gamingmesh.jobs.container.ActionType;
|
|
||||||
import com.gamingmesh.jobs.container.BaseActionInfo;
|
|
||||||
|
|
||||||
public class PotionDrinkInfo extends BaseActionInfo implements ActionInfo {
|
|
||||||
private String potion;
|
|
||||||
|
|
||||||
public PotionDrinkInfo(String potion, ActionType type) {
|
|
||||||
super(type);
|
|
||||||
this.potion = potion;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return potion;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getNameWithSub() {
|
|
||||||
return getName();
|
|
||||||
}
|
|
||||||
}
|
|
@ -47,11 +47,12 @@ public class area implements Cmd {
|
|||||||
if (args[0].equalsIgnoreCase("add")) {
|
if (args[0].equalsIgnoreCase("add")) {
|
||||||
if (!Jobs.hasPermission(player, "jobs.area.add", true))
|
if (!Jobs.hasPermission(player, "jobs.area.add", true))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
String name = args[1];
|
String name = args[1];
|
||||||
double bonus = 0D;
|
double bonus = 0D;
|
||||||
try {
|
try {
|
||||||
bonus = Double.parseDouble(args[2]);
|
bonus = Double.parseDouble(args[2]);
|
||||||
} catch (Throwable e) {
|
} catch (NumberFormatException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean wg = false;
|
boolean wg = false;
|
||||||
|
@ -64,14 +64,18 @@ public class exp implements Cmd {
|
|||||||
// check if player already has the job
|
// check if player already has the job
|
||||||
if (jPlayer.isInJob(job)) {
|
if (jPlayer.isInJob(job)) {
|
||||||
JobProgression prog = jPlayer.getJobProgression(job);
|
JobProgression prog = jPlayer.getJobProgression(job);
|
||||||
|
double total = 0d;
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case Add:
|
case Add:
|
||||||
|
total = (prog.getExperience() + amount);
|
||||||
prog.addExperience(amount);
|
prog.addExperience(amount);
|
||||||
break;
|
break;
|
||||||
case Set:
|
case Set:
|
||||||
prog.setExperience(amount);
|
prog.setExperience(amount);
|
||||||
break;
|
break;
|
||||||
case Take:
|
case Take:
|
||||||
|
total = (prog.getExperience() - amount);
|
||||||
prog.takeExperience(amount);
|
prog.takeExperience(amount);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -75,14 +75,18 @@ public class level implements Cmd {
|
|||||||
// check if player already has the job
|
// check if player already has the job
|
||||||
if (jPlayer.isInJob(job)) {
|
if (jPlayer.isInJob(job)) {
|
||||||
JobProgression prog = jPlayer.getJobProgression(job);
|
JobProgression prog = jPlayer.getJobProgression(job);
|
||||||
|
int total = 0;
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case Set:
|
case Set:
|
||||||
prog.setLevel(amount);
|
prog.setLevel(amount);
|
||||||
break;
|
break;
|
||||||
case Add:
|
case Add:
|
||||||
prog.setLevel(amount);
|
total = (prog.getLevel() + amount);
|
||||||
|
prog.setLevel(total);
|
||||||
break;
|
break;
|
||||||
case Take:
|
case Take:
|
||||||
|
total = (prog.getLevel() - amount);
|
||||||
prog.setLevel(amount);
|
prog.setLevel(amount);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -30,7 +30,6 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.Signs.SignTopType;
|
import com.gamingmesh.jobs.Signs.SignTopType;
|
||||||
import com.gamingmesh.jobs.Signs.SignUtil;
|
|
||||||
import com.gamingmesh.jobs.dao.JobsDAO;
|
import com.gamingmesh.jobs.dao.JobsDAO;
|
||||||
import com.gamingmesh.jobs.economy.PaymentData;
|
import com.gamingmesh.jobs.economy.PaymentData;
|
||||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||||
@ -1061,16 +1060,18 @@ public class JobsPlayer {
|
|||||||
this.doneQuests = doneQuests;
|
this.doneQuests = doneQuests;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Integer questSignUpdateShed = null;
|
||||||
|
|
||||||
public void addDoneQuest() {
|
public void addDoneQuest() {
|
||||||
this.doneQuests++;
|
this.doneQuests++;
|
||||||
this.setSaved(false);
|
this.setSaved(false);
|
||||||
|
|
||||||
if (SignUtil.questSignUpdateShed == null) {
|
if (questSignUpdateShed == null) {
|
||||||
SignUtil.questSignUpdateShed = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Jobs.getInstance(), new Runnable() {
|
questSignUpdateShed = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Jobs.getInstance(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Jobs.getSignUtil().SignUpdate(SignTopType.questtoplist);
|
Jobs.getSignUtil().SignUpdate(SignTopType.questtoplist);
|
||||||
SignUtil.questSignUpdateShed = null;
|
questSignUpdateShed = null;
|
||||||
}
|
}
|
||||||
}, Jobs.getGCManager().getSavePeriod() * 60 * 20L);
|
}, Jobs.getGCManager().getSavePeriod() * 60 * 20L);
|
||||||
}
|
}
|
||||||
|
@ -195,13 +195,18 @@ public class FurnaceBrewingHandling {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (uuid == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
List<blockLoc> ls = furnaceMap.get(uuid);
|
List<blockLoc> ls = furnaceMap.get(uuid);
|
||||||
if (ls == null)
|
if (ls == null)
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
for (blockLoc one : ls) {
|
for (blockLoc one : ls) {
|
||||||
if (!one.getLocation().equals(block.getLocation()))
|
if (!one.getLocation().equals(block.getLocation()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
block.removeMetadata(JobsPaymentListener.furnaceOwnerMetadata, Jobs.getInstance());
|
block.removeMetadata(JobsPaymentListener.furnaceOwnerMetadata, Jobs.getInstance());
|
||||||
ls.remove(one);
|
ls.remove(one);
|
||||||
return true;
|
return true;
|
||||||
@ -221,13 +226,18 @@ public class FurnaceBrewingHandling {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (uuid == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
List<blockLoc> ls = brewingMap.get(uuid);
|
List<blockLoc> ls = brewingMap.get(uuid);
|
||||||
if (ls == null)
|
if (ls == null)
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
for (blockLoc one : ls) {
|
for (blockLoc one : ls) {
|
||||||
if (!one.getLocation().equals(block.getLocation()))
|
if (!one.getLocation().equals(block.getLocation()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
block.removeMetadata(JobsPaymentListener.brewingOwnerMetadata, Jobs.getInstance());
|
block.removeMetadata(JobsPaymentListener.brewingOwnerMetadata, Jobs.getInstance());
|
||||||
ls.remove(one);
|
ls.remove(one);
|
||||||
return true;
|
return true;
|
||||||
|
@ -34,7 +34,7 @@ public class GiveItem {
|
|||||||
if (itemStack.getType() == CMIMaterial.ENCHANTED_BOOK.getMaterial()) {
|
if (itemStack.getType() == CMIMaterial.ENCHANTED_BOOK.getMaterial()) {
|
||||||
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) ItemMeta;
|
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) ItemMeta;
|
||||||
for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) {
|
for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) {
|
||||||
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), false);
|
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Entry<Enchantment, Integer> OneEnchant : enchants.entrySet()) {
|
for (Entry<Enchantment, Integer> OneEnchant : enchants.entrySet()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user