mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
Code clean up
- Updated MythicMobs to the latest version - Fix player double checking when interacts in world
This commit is contained in:
parent
0592c6da62
commit
dfbf7963da
Binary file not shown.
BIN
libs/MythicMobs-4.5.0.jar
Normal file
BIN
libs/MythicMobs-4.5.0.jar
Normal file
Binary file not shown.
@ -36,13 +36,12 @@ public class HookEconomyTask implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (setVault())
|
||||
return;
|
||||
|
||||
// no Economy found
|
||||
Jobs.setEconomy(this.plugin, new BlackholeEconomy());
|
||||
Bukkit.getServer().getLogger().severe("==================== " + this.plugin.getDescription().getName() + " ====================");
|
||||
Jobs.setEconomy(plugin, new BlackholeEconomy());
|
||||
Bukkit.getServer().getLogger().severe("==================== " + plugin.getDescription().getName() + " ====================");
|
||||
Bukkit.getServer().getLogger().severe("Vault is required by this plugin for economy support!");
|
||||
Bukkit.getServer().getLogger().severe("Please install them first!");
|
||||
Bukkit.getServer().getLogger().severe("You can find the latest versions here:");
|
||||
@ -63,8 +62,8 @@ public class HookEconomyTask implements Runnable {
|
||||
if (economy == null)
|
||||
return false;
|
||||
|
||||
Jobs.setEconomy(this.plugin, new VaultEconomy(economy));
|
||||
Jobs.consoleMsg("&e[" + this.plugin.getDescription().getName() + "] Successfully linked with Vault.");
|
||||
Jobs.setEconomy(plugin, new VaultEconomy(economy));
|
||||
Jobs.consoleMsg("&e[" + plugin.getDescription().getName() + "] Successfully linked with Vault.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -735,7 +735,7 @@ public class Jobs extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
|
||||
instance = this;
|
||||
this.setEnabled(true);
|
||||
setEnabled(true);
|
||||
|
||||
versionCheckManager = new VersionChecker(this);
|
||||
|
||||
@ -752,12 +752,12 @@ public class Jobs extends JavaPlugin {
|
||||
setNms((NMS) nmsClass.getConstructor().newInstance());
|
||||
} else {
|
||||
System.out.println("Something went wrong, please note down version and contact author, version: " + version);
|
||||
this.setEnabled(false);
|
||||
setEnabled(false);
|
||||
}
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException
|
||||
| SecurityException e) {
|
||||
System.out.println("Your server version is not compatible with this plugins version! Plugin will be disabled: " + version);
|
||||
this.setEnabled(false);
|
||||
setEnabled(false);
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
@ -835,7 +835,7 @@ public class Jobs extends JavaPlugin {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("There was some issues when starting plugin. Please contact dev about this. Plugin will be disabled.");
|
||||
this.setEnabled(false);
|
||||
setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,6 @@ public class PermissionHandler {
|
||||
}
|
||||
|
||||
public void recalculatePermissions(JobsPlayer jPlayer) {
|
||||
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
@ -56,9 +55,9 @@ public class PermissionHandler {
|
||||
|
||||
// remove old permissions
|
||||
String permName = "jobs.players." + player.getName();
|
||||
Permission permission = this.plugin.getServer().getPluginManager().getPermission(permName);
|
||||
Permission permission = plugin.getServer().getPluginManager().getPermission(permName);
|
||||
if (permission != null) {
|
||||
this.plugin.getServer().getPluginManager().removePermission(permission);
|
||||
plugin.getServer().getPluginManager().removePermission(permission);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@ -73,16 +72,15 @@ public class PermissionHandler {
|
||||
if (job != null) {
|
||||
for (JobPermission perm : job.getPermissions()) {
|
||||
if (perm.getLevelRequirement() <= 0) {
|
||||
if (perm.isValue()) {
|
||||
if (perm.isValue())
|
||||
permissions.put(perm.getNode(), true);
|
||||
} else {
|
||||
else {
|
||||
/*
|
||||
* If the key exists, don't put a false node in
|
||||
* This is in case we already have a true node there
|
||||
*/
|
||||
if (!permissions.containsKey(perm.getNode())) {
|
||||
if (!permissions.containsKey(perm.getNode()))
|
||||
permissions.put(perm.getNode(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,16 +115,15 @@ public class PermissionHandler {
|
||||
for (Entry<String, Boolean> one : Condition.getPerformPerm().entrySet()) {
|
||||
String perm = one.getKey();
|
||||
boolean node = one.getValue();
|
||||
if (node) {
|
||||
if (node)
|
||||
permissions.put(perm, true);
|
||||
} else {
|
||||
else {
|
||||
/*
|
||||
* If the key exists, don't put a false node in
|
||||
* This is in case we already have a true node there
|
||||
*/
|
||||
if (!permissions.containsKey(perm)) {
|
||||
if (!permissions.containsKey(perm))
|
||||
permissions.put(perm, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,12 +138,11 @@ public class PermissionHandler {
|
||||
* If the key exists, don't put a false node in
|
||||
* This is in case we already have a true node there
|
||||
*/
|
||||
if (perm.isValue()) {
|
||||
if (perm.isValue())
|
||||
permissions.put(perm.getNode(), true);
|
||||
} else {
|
||||
if (!permissions.containsKey(perm.getNode())) {
|
||||
else {
|
||||
if (!permissions.containsKey(perm.getNode()))
|
||||
permissions.put(perm.getNode(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -180,16 +176,15 @@ public class PermissionHandler {
|
||||
for (Entry<String, Boolean> one : Condition.getPerformPerm().entrySet()) {
|
||||
String perm = one.getKey();
|
||||
boolean node = one.getValue();
|
||||
if (node) {
|
||||
if (node)
|
||||
permissions.put(perm, true);
|
||||
} else {
|
||||
else {
|
||||
/*
|
||||
* If the key exists, don't put a false node in
|
||||
* This is in case we already have a true node there
|
||||
*/
|
||||
if (!permissions.containsKey(perm)) {
|
||||
if (!permissions.containsKey(perm))
|
||||
permissions.put(perm, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -198,7 +193,7 @@ public class PermissionHandler {
|
||||
|
||||
// add new permissions (if applicable)
|
||||
if (permissions.size() > 0) {
|
||||
this.plugin.getServer().getPluginManager().addPermission(new Permission(permName, PermissionDefault.FALSE, permissions));
|
||||
plugin.getServer().getPluginManager().addPermission(new Permission(permName, PermissionDefault.FALSE, permissions));
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@ -210,14 +205,13 @@ public class PermissionHandler {
|
||||
// find old attachment
|
||||
PermissionAttachment attachment = null;
|
||||
for (PermissionAttachmentInfo pai : player.getEffectivePermissions()) {
|
||||
if (pai.getAttachment() != null && pai.getAttachment().getPlugin() instanceof Jobs) {
|
||||
if (pai.getAttachment() != null && pai.getAttachment().getPlugin() instanceof Jobs)
|
||||
attachment = pai.getAttachment();
|
||||
}
|
||||
}
|
||||
|
||||
// create if attachment doesn't exist
|
||||
if (attachment == null) {
|
||||
attachment = player.addAttachment(this.plugin);
|
||||
attachment = player.addAttachment(plugin);
|
||||
attachment.setPermission(permName, true);
|
||||
}
|
||||
|
||||
@ -226,8 +220,8 @@ public class PermissionHandler {
|
||||
}
|
||||
|
||||
public void registerPermissions() {
|
||||
PluginManager pm = this.plugin.getServer().getPluginManager();
|
||||
for (World world : this.plugin.getServer().getWorlds()) {
|
||||
PluginManager pm = plugin.getServer().getPluginManager();
|
||||
for (World world : plugin.getServer().getWorlds()) {
|
||||
if (pm.getPermission("jobs.world." + world.getName().toLowerCase()) == null)
|
||||
pm.addPermission(new Permission("jobs.world." + world.getName().toLowerCase(), PermissionDefault.TRUE));
|
||||
}
|
||||
@ -245,22 +239,23 @@ public class PermissionHandler {
|
||||
}
|
||||
|
||||
public boolean hasWorldPermission(Player player, String world) {
|
||||
if (!player.hasPermission("jobs.use")) {
|
||||
if (!player.hasPermission("jobs.use"))
|
||||
return false;
|
||||
}
|
||||
|
||||
return player.hasPermission("jobs.world." + world.toLowerCase());
|
||||
}
|
||||
|
||||
public boolean hasWorldPermission(JobsPlayer player) {
|
||||
if (player.getPlayer() == null)
|
||||
return false;
|
||||
|
||||
return hasWorldPermission(player, player.getPlayer().getWorld().getName());
|
||||
}
|
||||
|
||||
public boolean hasWorldPermission(JobsPlayer player, String world) {
|
||||
if (!Jobs.getPermissionManager().hasPermission(player, "jobs.use")) {
|
||||
if (!Jobs.getPermissionManager().hasPermission(player, "jobs.use"))
|
||||
return false;
|
||||
}
|
||||
|
||||
return Jobs.getPermissionManager().hasPermission(player, "jobs.world." + world.toLowerCase());
|
||||
}
|
||||
|
||||
|
@ -99,31 +99,31 @@ public class PlayerManager {
|
||||
}
|
||||
|
||||
public void addPlayerToMap(PlayerInfo info) {
|
||||
this.PlayerUUIDMap.put(info.getUuid(), info);
|
||||
this.PlayerIDMap.put(info.getID(), info);
|
||||
PlayerUUIDMap.put(info.getUuid(), info);
|
||||
PlayerIDMap.put(info.getID(), info);
|
||||
if (info.getName() != null)
|
||||
this.PlayerNameMap.put(info.getName().toLowerCase(), info);
|
||||
PlayerNameMap.put(info.getName().toLowerCase(), info);
|
||||
}
|
||||
|
||||
public void addPlayerToCache(JobsPlayer jPlayer) {
|
||||
if (jPlayer.getUserName() != null)
|
||||
this.playersCache.put(jPlayer.getUserName().toLowerCase(), jPlayer);
|
||||
playersCache.put(jPlayer.getUserName().toLowerCase(), jPlayer);
|
||||
if (jPlayer.getPlayerUUID() != null)
|
||||
this.playersUUIDCache.put(jPlayer.getPlayerUUID(), jPlayer);
|
||||
playersUUIDCache.put(jPlayer.getPlayerUUID(), jPlayer);
|
||||
}
|
||||
|
||||
public void addPlayer(JobsPlayer jPlayer) {
|
||||
if (jPlayer.getUserName() != null)
|
||||
this.players.put(jPlayer.getUserName().toLowerCase(), jPlayer);
|
||||
players.put(jPlayer.getUserName().toLowerCase(), jPlayer);
|
||||
if (jPlayer.getPlayerUUID() != null)
|
||||
this.playersUUID.put(jPlayer.getPlayerUUID(), jPlayer);
|
||||
playersUUID.put(jPlayer.getPlayerUUID(), jPlayer);
|
||||
}
|
||||
|
||||
public JobsPlayer removePlayer(Player player) {
|
||||
if (player == null)
|
||||
return null;
|
||||
this.players.remove(player.getName().toLowerCase());
|
||||
JobsPlayer jPlayer = this.playersUUID.remove(player.getUniqueId());
|
||||
players.remove(player.getName().toLowerCase());
|
||||
JobsPlayer jPlayer = playersUUID.remove(player.getUniqueId());
|
||||
return jPlayer;
|
||||
}
|
||||
|
||||
@ -167,14 +167,14 @@ public class PlayerManager {
|
||||
*/
|
||||
public void playerJoin(Player player) {
|
||||
|
||||
JobsPlayer jPlayer = this.playersUUIDCache.get(player.getUniqueId());
|
||||
JobsPlayer jPlayer = playersUUIDCache.get(player.getUniqueId());
|
||||
|
||||
if (jPlayer == null || Jobs.getGCManager().MultiServerCompatability()) {
|
||||
jPlayer = Jobs.getJobsDAO().loadFromDao(player);
|
||||
jPlayer.loadLogFromDao();
|
||||
}
|
||||
|
||||
this.addPlayer(jPlayer);
|
||||
addPlayer(jPlayer);
|
||||
AutoJoinJobs(player);
|
||||
jPlayer.onConnect();
|
||||
jPlayer.reloadHonorific();
|
||||
@ -188,7 +188,7 @@ public class PlayerManager {
|
||||
* @param playername
|
||||
*/
|
||||
public void playerQuit(Player player) {
|
||||
JobsPlayer jPlayer = this.getJobsPlayer(player);
|
||||
JobsPlayer jPlayer = getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
if (Jobs.getGCManager().saveOnDisconnect()) {
|
||||
@ -209,12 +209,12 @@ public class PlayerManager {
|
||||
* 2) Perform save on all players on copied list.
|
||||
* 3) Garbage collect the real list to remove any offline players with saved data
|
||||
*/
|
||||
ArrayList<JobsPlayer> list = new ArrayList<>(this.players.values());
|
||||
ArrayList<JobsPlayer> list = new ArrayList<>(players.values());
|
||||
|
||||
for (JobsPlayer jPlayer : list)
|
||||
jPlayer.save();
|
||||
|
||||
Iterator<JobsPlayer> iter = this.players.values().iterator();
|
||||
Iterator<JobsPlayer> iter = players.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
JobsPlayer jPlayer = iter.next();
|
||||
if (!jPlayer.isOnline() && jPlayer.isSaved())
|
||||
@ -261,10 +261,10 @@ public class PlayerManager {
|
||||
}
|
||||
|
||||
public JobsPlayer getJobsPlayer(UUID uuid) {
|
||||
JobsPlayer jPlayer = this.playersUUID.get(uuid);
|
||||
JobsPlayer jPlayer = playersUUID.get(uuid);
|
||||
if (jPlayer != null)
|
||||
return jPlayer;
|
||||
return this.playersUUIDCache.get(uuid);
|
||||
return playersUUIDCache.get(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -273,10 +273,10 @@ public class PlayerManager {
|
||||
* @return the player job info of the player
|
||||
*/
|
||||
public JobsPlayer getJobsPlayer(String playerName) {
|
||||
JobsPlayer jPlayer = this.players.get(playerName.toLowerCase());
|
||||
JobsPlayer jPlayer = players.get(playerName.toLowerCase());
|
||||
if (jPlayer != null)
|
||||
return jPlayer;
|
||||
return this.playersCache.get(playerName.toLowerCase());
|
||||
return playersCache.get(playerName.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -376,10 +376,9 @@ public class PlayerManager {
|
||||
if (!jPlayer.isInJob(job))
|
||||
return false;
|
||||
|
||||
// JobsJoin event
|
||||
JobsLeaveEvent jobsleaveevent = new JobsLeaveEvent(jPlayer, job);
|
||||
Bukkit.getServer().getPluginManager().callEvent(jobsleaveevent);
|
||||
// If event is canceled, dont do anything
|
||||
// If event is canceled, don't do anything
|
||||
if (jobsleaveevent.isCancelled())
|
||||
return false;
|
||||
|
||||
@ -704,7 +703,7 @@ public class PlayerManager {
|
||||
* Perform reload
|
||||
*/
|
||||
public void reload() {
|
||||
for (JobsPlayer jPlayer : this.players.values()) {
|
||||
for (JobsPlayer jPlayer : players.values()) {
|
||||
for (JobProgression progression : jPlayer.getJobProgression()) {
|
||||
String jobName = progression.getJob().getName();
|
||||
Job job = Jobs.getJob(jobName);
|
||||
@ -793,7 +792,7 @@ public class PlayerManager {
|
||||
continue;
|
||||
|
||||
for (String onelore : oneItem.getLore()) {
|
||||
if (lore.size() == 0 || !lore.contains(onelore))
|
||||
if (lore.size() < 0 || !lore.contains(onelore))
|
||||
continue main;
|
||||
}
|
||||
|
||||
@ -930,7 +929,7 @@ public class PlayerManager {
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(amount));
|
||||
}
|
||||
|
||||
if (victim != null && victim.hasMetadata(this.getMobSpawnerMetadata())) {
|
||||
if (victim != null && victim.hasMetadata(getMobSpawnerMetadata())) {
|
||||
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner");
|
||||
if (amount != null)
|
||||
boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(amount));
|
||||
|
@ -139,8 +139,6 @@ public class JobsListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onSelection(PlayerInteractEvent event) {
|
||||
if (event.getPlayer() == null)
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
||||
return;
|
||||
@ -210,9 +208,8 @@ public class JobsListener implements Listener {
|
||||
public void onShopGuiClose(InventoryCloseEvent event) {
|
||||
if (Jobs.getShopManager().GuiList.isEmpty())
|
||||
return;
|
||||
if (Jobs.getShopManager().GuiList.containsKey(event.getPlayer().getName())) {
|
||||
if (Jobs.getShopManager().GuiList.containsKey(event.getPlayer().getName()))
|
||||
Jobs.getShopManager().GuiList.remove(event.getPlayer().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@ -284,9 +281,9 @@ public class JobsListener implements Listener {
|
||||
// make sure plugin is enabled
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
if (!Jobs.getGCManager().MultiServerCompatability()) {
|
||||
if (!Jobs.getGCManager().MultiServerCompatability())
|
||||
Jobs.getPlayerManager().playerJoin(event.getPlayer());
|
||||
} else {
|
||||
else {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -118,7 +118,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void villagerTradeInventoryClick(InventoryClickEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getWhoClicked() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getWhoClicked().getWorld()))
|
||||
@ -204,7 +204,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onCowMilking(PlayerInteractEntityEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
||||
@ -260,13 +260,13 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
Long Timer = System.currentTimeMillis();
|
||||
|
||||
cow.setMetadata(CowMetadata, new FixedMetadataValue(this.plugin, Timer));
|
||||
cow.setMetadata(CowMetadata, new FixedMetadataValue(plugin, Timer));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityShear(PlayerShearEntityEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
||||
@ -278,7 +278,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
// mob spawner, no payment or experience
|
||||
if (sheep.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata())) {
|
||||
sheep.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), this.plugin);
|
||||
sheep.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), plugin);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBrewEvent(BrewEvent event) {
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getBlock() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld()))
|
||||
@ -348,7 +348,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getBlock() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld()))
|
||||
@ -412,7 +412,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
Block block = event.getBlock();
|
||||
|
||||
@ -448,7 +448,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerFish(PlayerFishEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
||||
@ -475,7 +475,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onAnimalTame(EntityTameEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
@ -486,7 +486,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
// mob spawner, no payment or experience
|
||||
if (animal.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata())) {
|
||||
animal.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), this.plugin);
|
||||
animal.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), plugin);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -513,7 +513,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryCraft(CraftItemEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getWhoClicked() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getWhoClicked().getWorld()))
|
||||
@ -665,7 +665,7 @@ public class JobsPaymentListener implements Listener {
|
||||
for (int i = 0; i < preInv.length; i++) {
|
||||
preInv[i] = preInv[i] != null ? preInv[i].clone() : null;
|
||||
}
|
||||
return Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
|
||||
return Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final ItemStack[] postInv = player.getInventory().getContents();
|
||||
@ -715,7 +715,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryRepair(InventoryClickEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getWhoClicked() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getWhoClicked().getWorld()))
|
||||
@ -791,7 +791,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEnchantItem(EnchantItemEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getEnchanter() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEnchanter().getWorld()))
|
||||
@ -847,7 +847,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryMoveItemEventToFurnace(InventoryMoveItemEvent event) {
|
||||
try {
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
if (event.getDestination().getType() != InventoryType.FURNACE)
|
||||
return;
|
||||
@ -871,7 +871,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryMoveItemEventToBrewingStand(InventoryMoveItemEvent event) {
|
||||
try {
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
if (event.getDestination().getType() != InventoryType.BREWING)
|
||||
return;
|
||||
@ -894,7 +894,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onFurnaceSmelt(FurnaceSmeltEvent event) {
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getBlock() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld()))
|
||||
@ -961,7 +961,7 @@ public class JobsPaymentListener implements Listener {
|
||||
damage = s;
|
||||
if (ent.hasMetadata(entityDamageByPlayer))
|
||||
damage += ent.getMetadata(entityDamageByPlayer).get(0).asDouble();
|
||||
ent.setMetadata(entityDamageByPlayer, new FixedMetadataValue(this.plugin, damage));
|
||||
ent.setMetadata(entityDamageByPlayer, new FixedMetadataValue(plugin, damage));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
@ -987,7 +987,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (shooter instanceof Player) {
|
||||
if (ent.hasMetadata(entityDamageByPlayer))
|
||||
damage += ent.getMetadata(entityDamageByPlayer).get(0).asDouble();
|
||||
ent.setMetadata(entityDamageByPlayer, new FixedMetadataValue(this.plugin, damage));
|
||||
ent.setMetadata(entityDamageByPlayer, new FixedMetadataValue(plugin, damage));
|
||||
}
|
||||
|
||||
}
|
||||
@ -995,7 +995,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
@ -1106,14 +1106,14 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
if (event.getSpawnReason().equals(SpawnReason.SPAWNER) || event.getSpawnReason().equals(SpawnReason.SPAWNER_EGG)) {
|
||||
LivingEntity creature = event.getEntity();
|
||||
creature.setMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), new FixedMetadataValue(this.plugin, true));
|
||||
creature.setMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), new FixedMetadataValue(plugin, true));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onHangingPlaceEvent(HangingPlaceEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
@ -1140,7 +1140,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onHangingBreakEvent(HangingBreakByEntityEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
@ -1266,7 +1266,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onCreatureBreed(CreatureSpawnEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
@ -1314,7 +1314,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerEat(FoodLevelChangeEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
@ -1354,7 +1354,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onTntExplode(EntityExplodeEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity()))
|
||||
@ -1419,7 +1419,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
||||
@ -1487,7 +1487,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerItemConsume(PlayerItemConsumeEvent event) {
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
||||
@ -1520,7 +1520,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler
|
||||
public void onExplore(JobsChunkChangeEvent event) {
|
||||
// make sure plugin is enabled
|
||||
if (!this.plugin.isEnabled())
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
//disabling plugin in world
|
||||
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
||||
|
Loading…
Reference in New Issue
Block a user