mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-04 23:37:49 +01:00
Back to Vault 1.6.7
- Clean up code
This commit is contained in:
parent
7240f6cb39
commit
bb8a32a6f0
BIN
libs/Vault-1.6.7.jar
Normal file
BIN
libs/Vault-1.6.7.jar
Normal file
Binary file not shown.
Binary file not shown.
2
pom.xml
2
pom.xml
@ -64,7 +64,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<artifactId>Vault</artifactId>
|
<artifactId>Vault</artifactId>
|
||||||
<version>1.7.1</version>
|
<version>1.6.7</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
@ -30,7 +30,7 @@ public class ItemManager {
|
|||||||
static HashMap<String, CMIItemStack> byBukkitName = new HashMap<>();
|
static HashMap<String, CMIItemStack> byBukkitName = new HashMap<>();
|
||||||
static HashMap<String, CMIItemStack> byMojangName = new HashMap<>();
|
static HashMap<String, CMIItemStack> byMojangName = new HashMap<>();
|
||||||
static HashMap<CMIMaterial, CMIItemStack> byMaterial = new HashMap<>();
|
static HashMap<CMIMaterial, CMIItemStack> byMaterial = new HashMap<>();
|
||||||
static final Version version = Jobs.getVersionCheckManager().getVersion();
|
private final static Version version = Jobs.getVersionCheckManager().getVersion();
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void load() {
|
public static void load() {
|
||||||
@ -1560,7 +1560,7 @@ public class ItemManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_13_R1)) {
|
if (version.isEqualOrHigher(Version.v1_13_R1)) {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
return getLegacyId();
|
return getLegacyId();
|
||||||
@ -1616,7 +1616,7 @@ public class ItemManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_13_R1)) {
|
if (version.isEqualOrHigher(Version.v1_13_R1)) {
|
||||||
return new ItemStack(mat == null ? Material.STONE : mat);
|
return new ItemStack(mat == null ? Material.STONE : mat);
|
||||||
}
|
}
|
||||||
return new ItemStack(mat == null ? Material.STONE : mat, 1, (short) this.getLegacyData());
|
return new ItemStack(mat == null ? Material.STONE : mat, 1, (short) this.getLegacyData());
|
||||||
@ -1625,7 +1625,7 @@ public class ItemManager {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public short getData() {
|
public short getData() {
|
||||||
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_13_R1)) {
|
if (version.isEqualOrHigher(Version.v1_13_R1)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (short) legacyData;
|
return (short) legacyData;
|
||||||
|
@ -34,7 +34,6 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -148,9 +147,9 @@ public class Jobs extends JavaPlugin {
|
|||||||
public static WeakHashMap<String, Boolean> actionbartoggle = new WeakHashMap<>();
|
public static WeakHashMap<String, Boolean> actionbartoggle = new WeakHashMap<>();
|
||||||
public static WeakHashMap<String, Boolean> BossBartoggle = new WeakHashMap<>();
|
public static WeakHashMap<String, Boolean> BossBartoggle = new WeakHashMap<>();
|
||||||
// public static WeakHashMap<String, Double> GlobalBoost = new WeakHashMap<String, Double>();
|
// public static WeakHashMap<String, Double> GlobalBoost = new WeakHashMap<String, Double>();
|
||||||
private static BufferedEconomy economy;
|
private static BufferedEconomy economy = null;
|
||||||
private static PermissionHandler permissionHandler;
|
private static PermissionHandler permissionHandler = null;
|
||||||
private static PermissionManager permissionManager;
|
private static PermissionManager permissionManager = null;
|
||||||
|
|
||||||
// private static ItemManager itemManager;
|
// private static ItemManager itemManager;
|
||||||
|
|
||||||
@ -243,7 +242,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
public static Reflections getReflections() {
|
public static Reflections getReflections() {
|
||||||
if (reflections == null)
|
if (reflections == null)
|
||||||
reflections = new Reflections(instance);
|
reflections = new Reflections();
|
||||||
return reflections;
|
return reflections;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,14 +542,14 @@ public class Jobs extends JavaPlugin {
|
|||||||
loadAllPlayersData();
|
loadAllPlayersData();
|
||||||
// add all online players
|
// add all online players
|
||||||
for (Player online : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player online : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
Jobs.getPlayerManager().playerJoin(online);
|
pManager.playerJoin(online);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadAllPlayersData() {
|
public static void loadAllPlayersData() {
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
// Cloning to avoid issues
|
// Cloning to avoid issues
|
||||||
HashMap<UUID, PlayerInfo> temp = new HashMap<>(Jobs.getPlayerManager().getPlayersInfoUUIDMap());
|
HashMap<UUID, PlayerInfo> temp = new HashMap<>(pManager.getPlayersInfoUUIDMap());
|
||||||
HashMap<Integer, List<JobsDAOData>> playersJobs = dao.getAllJobs();
|
HashMap<Integer, List<JobsDAOData>> playersJobs = dao.getAllJobs();
|
||||||
HashMap<Integer, PlayerPoints> playersPoints = dao.getAllPoints();
|
HashMap<Integer, PlayerPoints> playersPoints = dao.getAllPoints();
|
||||||
HashMap<Integer, HashMap<String, Log>> playersLogs = dao.getAllLogs();
|
HashMap<Integer, HashMap<String, Log>> playersLogs = dao.getAllLogs();
|
||||||
@ -561,7 +560,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
Entry<UUID, PlayerInfo> one = it.next();
|
Entry<UUID, PlayerInfo> one = it.next();
|
||||||
try {
|
try {
|
||||||
int id = one.getValue().getID();
|
int id = one.getValue().getID();
|
||||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayerOffline(
|
JobsPlayer jPlayer = pManager.getJobsPlayerOffline(
|
||||||
one.getValue(),
|
one.getValue(),
|
||||||
playersJobs.get(id),
|
playersJobs.get(id),
|
||||||
playersPoints.get(id),
|
playersPoints.get(id),
|
||||||
@ -570,15 +569,15 @@ public class Jobs extends JavaPlugin {
|
|||||||
playersLimits.get(id));
|
playersLimits.get(id));
|
||||||
if (jPlayer == null)
|
if (jPlayer == null)
|
||||||
continue;
|
continue;
|
||||||
Jobs.getPlayerManager().addPlayerToCache(jPlayer);
|
pManager.addPlayerToCache(jPlayer);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dao.getMap().clear();
|
dao.getMap().clear();
|
||||||
if (Jobs.getPlayerManager().getPlayersCache().size() != 0)
|
if (pManager.getPlayersCache().size() != 0)
|
||||||
consoleMsg("&e[Jobs] Preloaded " + Jobs.getPlayerManager().getPlayersCache().size() + " players data in " + ((int) (((System.currentTimeMillis() - time)
|
consoleMsg("&e[Jobs] Preloaded " + pManager.getPlayersCache().size() + " players data in " + ((int) (((System.currentTimeMillis() - time)
|
||||||
/ 1000d) * 100) / 100D));
|
/ 1000d) * 100) / 100D));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,7 +603,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
GconfigManager.reload();
|
GconfigManager.reload();
|
||||||
lManager.reload();
|
lManager.reload();
|
||||||
Jobs.getConfigManager().reload();
|
configManager.reload();
|
||||||
usedSlots.clear();
|
usedSlots.clear();
|
||||||
for (Job job : jobs) {
|
for (Job job : jobs) {
|
||||||
usedSlots.put(job, getJobsDAO().getSlotsTaken(job));
|
usedSlots.put(job, getJobsDAO().getSlotsTaken(job));
|
||||||
@ -625,8 +624,8 @@ public class Jobs extends JavaPlugin {
|
|||||||
dao.loadPlayerData();
|
dao.loadPlayerData();
|
||||||
|
|
||||||
// Schedule
|
// Schedule
|
||||||
Jobs.getScheduleManager().load();
|
scheduleManager.load();
|
||||||
Jobs.getScheduleManager().start();
|
scheduleManager.start();
|
||||||
|
|
||||||
permissionManager = new PermissionManager();
|
permissionManager = new PermissionManager();
|
||||||
}
|
}
|
||||||
@ -652,7 +651,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
* Executes close connections
|
* Executes close connections
|
||||||
*/
|
*/
|
||||||
public static void ChangeDatabase() {
|
public static void ChangeDatabase() {
|
||||||
getDBManager().switchDataBase();
|
DBManager.switchDataBase();
|
||||||
pManager.reload();
|
pManager.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,8 +700,8 @@ public class Jobs extends JavaPlugin {
|
|||||||
* Sets the permission handler
|
* Sets the permission handler
|
||||||
* @param h - the permission handler
|
* @param h - the permission handler
|
||||||
*/
|
*/
|
||||||
public void setPermissionHandler(PermissionHandler h) {
|
public void setPermissionHandler(PermissionHandler permissionHandler) {
|
||||||
permissionHandler = h;
|
Jobs.permissionHandler = permissionHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -839,7 +838,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
// all loaded properly.
|
// all loaded properly.
|
||||||
|
|
||||||
dao.loadBlockProtection();
|
dao.loadBlockProtection();
|
||||||
getExplore().load();
|
exploreManager.load();
|
||||||
|
|
||||||
FurnaceBrewingHandling.load();
|
FurnaceBrewingHandling.load();
|
||||||
|
|
||||||
@ -866,7 +865,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
FurnaceBrewingHandling.save();
|
FurnaceBrewingHandling.save();
|
||||||
|
|
||||||
Jobs.shutdown();
|
shutdown();
|
||||||
consoleMsg("&e[Jobs] &2Plugin has been disabled succesfully.");
|
consoleMsg("&e[Jobs] &2Plugin has been disabled succesfully.");
|
||||||
running = false;
|
running = false;
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
@ -982,12 +981,12 @@ public class Jobs extends JavaPlugin {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (info.getType() == ActionType.BREAK && block != null)
|
if (info.getType() == ActionType.BREAK && block != null)
|
||||||
Jobs.getBpManager().remove(block);
|
BpManager.remove(block);
|
||||||
|
|
||||||
if (pointAmount != 0D)
|
if (pointAmount != 0D)
|
||||||
jPlayer.setSaved(false);
|
jPlayer.setSaved(false);
|
||||||
|
|
||||||
Jobs.getEconomy().pay(jPlayer, income, pointAmount, 0.0);
|
economy.pay(jPlayer, income, pointAmount, 0.0);
|
||||||
|
|
||||||
if (GconfigManager.LoggingUse) {
|
if (GconfigManager.LoggingUse) {
|
||||||
HashMap<CurrencyType, Double> amounts = new HashMap<>();
|
HashMap<CurrencyType, Double> amounts = new HashMap<>();
|
||||||
@ -1039,7 +1038,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
player.giveExp(expInt);
|
player.giveExp(expInt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, prog.getJob(), ent, victim);
|
Boost boost = pManager.getFinalBonus(jPlayer, prog.getJob(), ent, victim);
|
||||||
|
|
||||||
// Calculate income
|
// Calculate income
|
||||||
if (income != 0D) {
|
if (income != 0D) {
|
||||||
@ -1100,11 +1099,11 @@ public class Jobs extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
if (expAmount != 0D && GconfigManager.BossBarEnabled)
|
if (expAmount != 0D && GconfigManager.BossBarEnabled)
|
||||||
if (GconfigManager.BossBarShowOnEachAction)
|
if (GconfigManager.BossBarShowOnEachAction)
|
||||||
Jobs.getBBManager().ShowJobProgression(jPlayer, prog);
|
BBManager.ShowJobProgression(jPlayer, prog);
|
||||||
else
|
else
|
||||||
jPlayer.getUpdateBossBarFor().add(prog.getJob().getName());
|
jPlayer.getUpdateBossBarFor().add(prog.getJob().getName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Bukkit.getConsoleSender().sendMessage("[Jobs] Some issues with boss bar feature accured, try disabling it to avoid it.");
|
consoleMsg("[Jobs] Some issues with boss bar feature accured, try disabling it to avoid it.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// JobsPayment event
|
// JobsPayment event
|
||||||
@ -1153,17 +1152,17 @@ public class Jobs extends JavaPlugin {
|
|||||||
//player.sendMessage("This block is protected using Rukes' system!");
|
//player.sendMessage("This block is protected using Rukes' system!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BlockProtection bp = getBpManager().getBp(block.getLocation());
|
BlockProtection bp = BpManager.getBp(block.getLocation());
|
||||||
if (bp != null) {
|
if (bp != null) {
|
||||||
Long time = bp.getTime();
|
Long time = bp.getTime();
|
||||||
Integer cd = getBpManager().getBlockDelayTime(block);
|
Integer cd = BpManager.getBlockDelayTime(block);
|
||||||
|
|
||||||
if (time == -1L) {
|
if (time == -1L) {
|
||||||
getBpManager().add(block, cd);
|
BpManager.add(block, cd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((time < System.currentTimeMillis()) && (bp.getAction() != DBAction.DELETE)) {
|
if ((time < System.currentTimeMillis()) && (bp.getAction() != DBAction.DELETE)) {
|
||||||
getBpManager().remove(block);
|
BpManager.remove(block);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (time > System.currentTimeMillis() || bp.isPaid() && bp.getAction() != DBAction.DELETE) {
|
if (time > System.currentTimeMillis() || bp.isPaid() && bp.getAction() != DBAction.DELETE) {
|
||||||
@ -1174,22 +1173,22 @@ public class Jobs extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
getBpManager().add(block, cd);
|
BpManager.add(block, cd);
|
||||||
if ((cd == null || cd == 0) && getGCManager().useGlobalTimer) {
|
if ((cd == null || cd == 0) && getGCManager().useGlobalTimer) {
|
||||||
getBpManager().add(block, getGCManager().globalblocktimer);
|
BpManager.add(block, getGCManager().globalblocktimer);
|
||||||
}
|
}
|
||||||
} else if (getGCManager().useGlobalTimer) {
|
} else if (getGCManager().useGlobalTimer) {
|
||||||
getBpManager().add(block, getGCManager().globalblocktimer);
|
BpManager.add(block, getGCManager().globalblocktimer);
|
||||||
}
|
}
|
||||||
} else if (info.getType() == ActionType.PLACE) {
|
} else if (info.getType() == ActionType.PLACE) {
|
||||||
BlockProtection bp = getBpManager().getBp(block.getLocation());
|
BlockProtection bp = BpManager.getBp(block.getLocation());
|
||||||
if (bp != null) {
|
if (bp != null) {
|
||||||
Long time = bp.getTime();
|
Long time = bp.getTime();
|
||||||
Integer cd = getBpManager().getBlockDelayTime(block);
|
Integer cd = BpManager.getBlockDelayTime(block);
|
||||||
|
|
||||||
if (time != -1L) {
|
if (time != -1L) {
|
||||||
if (time < System.currentTimeMillis() && bp.getAction() != DBAction.DELETE) {
|
if (time < System.currentTimeMillis() && bp.getAction() != DBAction.DELETE) {
|
||||||
getBpManager().add(block, cd);
|
BpManager.add(block, cd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (time > System.currentTimeMillis() || bp.isPaid() && bp.getAction() != DBAction.DELETE) {
|
if (time > System.currentTimeMillis() || bp.isPaid() && bp.getAction() != DBAction.DELETE) {
|
||||||
@ -1198,16 +1197,16 @@ public class Jobs extends JavaPlugin {
|
|||||||
if (player.canGetPaid(info))
|
if (player.canGetPaid(info))
|
||||||
getActionBar().send(player.getPlayer(), getLanguage().getMessage("message.blocktimer", "[time]", sec));
|
getActionBar().send(player.getPlayer(), getLanguage().getMessage("message.blocktimer", "[time]", sec));
|
||||||
}
|
}
|
||||||
getBpManager().add(block, cd);
|
BpManager.add(block, cd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (bp.isPaid().booleanValue() && bp.getTime() == -1L && cd != null && cd == -1) {
|
} else if (bp.isPaid().booleanValue() && bp.getTime() == -1L && cd != null && cd == -1) {
|
||||||
getBpManager().add(block, cd);
|
BpManager.add(block, cd);
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else
|
||||||
getBpManager().add(block, cd);
|
BpManager.add(block, cd);
|
||||||
} else
|
} else
|
||||||
getBpManager().add(block, getBpManager().getBlockDelayTime(block));
|
BpManager.add(block, BpManager.getBlockDelayTime(block));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1304,8 +1303,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
RawMessage rm = new RawMessage();
|
RawMessage rm = new RawMessage();
|
||||||
rm.add(Jobs.getLanguage().getMessage("general.error.permission"), "&2" + perm);
|
rm.add(Jobs.getLanguage().getMessage("general.error.permission"), "&2" + perm);
|
||||||
rm.show((Player) sender);
|
rm.show((Player) sender);
|
||||||
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
sendMessage(Bukkit.getServer().getConsoleSender(), Jobs.getLanguage().getMessage("general.error.permission"));
|
||||||
Jobs.sendMessage(console, Jobs.getLanguage().getMessage("general.error.permission"));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,11 +20,8 @@ public class Reflections {
|
|||||||
private Class<?> CraftItemStack;
|
private Class<?> CraftItemStack;
|
||||||
private Class<?> Item;
|
private Class<?> Item;
|
||||||
private Class<?> IStack;
|
private Class<?> IStack;
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private Jobs plugin;
|
|
||||||
|
|
||||||
public Reflections(Jobs plugin) {
|
public Reflections() {
|
||||||
this.plugin = plugin;
|
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
@ -43,7 +42,7 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
private static final String label = "jobs";
|
private static final String label = "jobs";
|
||||||
private static final String packagePath = "com.gamingmesh.jobs.commands.list";
|
private static final String packagePath = "com.gamingmesh.jobs.commands.list";
|
||||||
private static final List<String> hidenCommands = new ArrayList<>();
|
private static final List<String> hidenCommands = new ArrayList<>();
|
||||||
Map<String, Integer> CommandList = new HashMap<>();
|
private Map<String, Integer> CommandList = new HashMap<>();
|
||||||
|
|
||||||
protected Jobs plugin;
|
protected Jobs plugin;
|
||||||
|
|
||||||
@ -94,8 +93,7 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
RawMessage rm = new RawMessage();
|
RawMessage rm = new RawMessage();
|
||||||
rm.add(Jobs.getLanguage().getMessage("general.error.permission"), "&2" + label + ".command." + cmd);
|
rm.add(Jobs.getLanguage().getMessage("general.error.permission"), "&2" + label + ".command." + cmd);
|
||||||
rm.show(sender);
|
rm.show(sender);
|
||||||
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
Jobs.sendMessage(Bukkit.getServer().getConsoleSender(), Jobs.getLanguage().getMessage("general.error.permission"));
|
||||||
Jobs.sendMessage(console, Jobs.getLanguage().getMessage("general.error.permission"));
|
|
||||||
} else
|
} else
|
||||||
Jobs.sendMessage(sender, Jobs.getLanguage().getMessage("general.error.permission"));
|
Jobs.sendMessage(sender, Jobs.getLanguage().getMessage("general.error.permission"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -21,7 +21,7 @@ public class ExploreManager {
|
|||||||
private int playerAmount = 1;
|
private int playerAmount = 1;
|
||||||
|
|
||||||
public int getPlayerAmount() {
|
public int getPlayerAmount() {
|
||||||
return this.playerAmount;
|
return playerAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayerAmount(int amount) {
|
public void setPlayerAmount(int amount) {
|
||||||
@ -30,12 +30,12 @@ public class ExploreManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExploreEnabled() {
|
public boolean isExploreEnabled() {
|
||||||
return this.exploreEnabled;
|
return exploreEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExploreEnabled() {
|
public void setExploreEnabled() {
|
||||||
if (!exploreEnabled) {
|
if (!exploreEnabled) {
|
||||||
this.exploreEnabled = true;
|
exploreEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class RestrictedArea {
|
|||||||
private CuboidArea area;
|
private CuboidArea area;
|
||||||
private double multiplier;
|
private double multiplier;
|
||||||
private String name;
|
private String name;
|
||||||
private String wgName;
|
private String wgName;
|
||||||
|
|
||||||
public RestrictedArea(String name, CuboidArea area, double multiplier) {
|
public RestrictedArea(String name, CuboidArea area, double multiplier) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -11,11 +11,9 @@ import java.util.Map.Entry;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
@ -1601,7 +1599,6 @@ public abstract class JobsDAO {
|
|||||||
int deleted = 0;
|
int deleted = 0;
|
||||||
Long current = System.currentTimeMillis();
|
Long current = System.currentTimeMillis();
|
||||||
Long mark = System.currentTimeMillis() - (Jobs.getGCManager().BlockProtectionDays * 24L * 60L * 60L * 1000L);
|
Long mark = System.currentTimeMillis() - (Jobs.getGCManager().BlockProtectionDays * 24L * 60L * 60L * 1000L);
|
||||||
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
|
||||||
|
|
||||||
for (Entry<World, HashMap<String, HashMap<String, HashMap<String, BlockProtection>>>> worlds : Jobs.getBpManager().getMap().entrySet()) {
|
for (Entry<World, HashMap<String, HashMap<String, HashMap<String, BlockProtection>>>> worlds : Jobs.getBpManager().getMap().entrySet()) {
|
||||||
for (Entry<String, HashMap<String, HashMap<String, BlockProtection>>> regions : worlds.getValue().entrySet()) {
|
for (Entry<String, HashMap<String, HashMap<String, BlockProtection>>> regions : worlds.getValue().entrySet()) {
|
||||||
@ -1617,8 +1614,7 @@ public abstract class JobsDAO {
|
|||||||
deleted++;
|
deleted++;
|
||||||
if (deleted % 10000 == 0) {
|
if (deleted % 10000 == 0) {
|
||||||
delete.executeBatch();
|
delete.executeBatch();
|
||||||
String message = ChatColor.translateAlternateColorCodes('&', "&6[Jobs] Removed " + deleted + " old block protection entries.");
|
Jobs.consoleMsg("&6[Jobs] Removed " + deleted + " old block protection entries.");
|
||||||
console.sendMessage(message);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case INSERT:
|
case INSERT:
|
||||||
@ -1635,8 +1631,7 @@ public abstract class JobsDAO {
|
|||||||
inserted++;
|
inserted++;
|
||||||
if (inserted % 10000 == 0) {
|
if (inserted % 10000 == 0) {
|
||||||
insert.executeBatch();
|
insert.executeBatch();
|
||||||
String message = ChatColor.translateAlternateColorCodes('&', "&6[Jobs] Added " + inserted + " new block protection entries.");
|
Jobs.consoleMsg("&6[Jobs] Added " + inserted + " new block protection entries.");
|
||||||
console.sendMessage(message);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
@ -1650,8 +1645,7 @@ public abstract class JobsDAO {
|
|||||||
updated++;
|
updated++;
|
||||||
if (updated % 10000 == 0) {
|
if (updated % 10000 == 0) {
|
||||||
update.executeBatch();
|
update.executeBatch();
|
||||||
String message = ChatColor.translateAlternateColorCodes('&', "&6[Jobs] Upadated " + updated + " old block protection entries.");
|
Jobs.consoleMsg("&6[Jobs] Upadated " + updated + " old block protection entries.");
|
||||||
console.sendMessage(message);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NONE:
|
case NONE:
|
||||||
@ -1683,16 +1677,13 @@ public abstract class JobsDAO {
|
|||||||
conn.commit();
|
conn.commit();
|
||||||
conn.setAutoCommit(true);
|
conn.setAutoCommit(true);
|
||||||
if (inserted > 0) {
|
if (inserted > 0) {
|
||||||
String message = ChatColor.translateAlternateColorCodes('&', "&6[Jobs] Added " + inserted + " new block protection entries.");
|
Jobs.consoleMsg("&6[Jobs] Added " + inserted + " new block protection entries.");
|
||||||
console.sendMessage(message);
|
|
||||||
}
|
}
|
||||||
if (updated > 0) {
|
if (updated > 0) {
|
||||||
String message = ChatColor.translateAlternateColorCodes('&', "&6[Jobs] Updated " + updated + " with new block protection entries.");
|
Jobs.consoleMsg("&6[Jobs] Updated " + updated + " with new block protection entries.");
|
||||||
console.sendMessage(message);
|
|
||||||
}
|
}
|
||||||
if (deleted > 0) {
|
if (deleted > 0) {
|
||||||
String message = ChatColor.translateAlternateColorCodes('&', "&6[Jobs] Deleted " + deleted + " old block protection entries.");
|
Jobs.consoleMsg("&6[Jobs] Deleted " + deleted + " old block protection entries.");
|
||||||
console.sendMessage(message);
|
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1747,15 +1738,13 @@ public abstract class JobsDAO {
|
|||||||
ii++;
|
ii++;
|
||||||
|
|
||||||
if (ii >= 100000) {
|
if (ii >= 100000) {
|
||||||
String message = ChatColor.translateAlternateColorCodes('&', "&6[Jobs] Loading (" + i + ") BP");
|
Jobs.consoleMsg("&6[Jobs] Loading (" + i + ") BP");
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(message);
|
|
||||||
ii = 0;
|
ii = 0;
|
||||||
}
|
}
|
||||||
Jobs.getBpManager().timer += System.currentTimeMillis() - t;
|
Jobs.getBpManager().timer += System.currentTimeMillis() - t;
|
||||||
}
|
}
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Loaded " + i + " block protection entries. " + Jobs.getBpManager().timer);
|
Jobs.consoleMsg("&e[Jobs] Loaded " + i + " block protection entries. " + Jobs.getBpManager().timer);
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(message);
|
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1808,7 +1797,7 @@ public abstract class JobsDAO {
|
|||||||
conn.setAutoCommit(true);
|
conn.setAutoCommit(true);
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Saved " + i + " new explorer entries."));
|
Jobs.consoleMsg("&e[Jobs] Saved " + i + " new explorer entries.");
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1855,7 +1844,7 @@ public abstract class JobsDAO {
|
|||||||
conn.setAutoCommit(true);
|
conn.setAutoCommit(true);
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Updated " + i + " explorer entries."));
|
Jobs.consoleMsg("&e[Jobs] Updated " + i + " explorer entries.");
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -1532,6 +1532,8 @@ public class JobsPaymentListener implements Listener {
|
|||||||
//disabling plugin in world
|
//disabling plugin in world
|
||||||
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
if (event.isCancelled())
|
||||||
|
return;
|
||||||
if (!Jobs.getExplore().isExploreEnabled())
|
if (!Jobs.getExplore().isExploreEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1540,7 +1542,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (!Jobs.getGCManager().payExploringWhenFlying() && player.isFlying())
|
if (!Jobs.getGCManager().payExploringWhenFlying() && player.isFlying())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ExploreRespond respond = Jobs.getExplore().ChunkRespond(event.getPlayer(), event.getNewChunk());
|
ExploreRespond respond = Jobs.getExplore().ChunkRespond(player, event.getNewChunk());
|
||||||
|
|
||||||
if (!respond.isNewChunk())
|
if (!respond.isNewChunk())
|
||||||
return;
|
return;
|
||||||
@ -1553,7 +1555,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// check if in creative
|
// check if in creative
|
||||||
if (event.getPlayer().getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||||
|
Loading…
Reference in New Issue
Block a user