mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
1.8 1.7 server fix
This commit is contained in:
parent
746c4313cb
commit
d9ef365b65
@ -96,6 +96,7 @@ import com.gamingmesh.jobs.i18n.Language;
|
|||||||
import com.gamingmesh.jobs.listeners.JobsListener;
|
import com.gamingmesh.jobs.listeners.JobsListener;
|
||||||
import com.gamingmesh.jobs.listeners.JobsPayment1_14Listener;
|
import com.gamingmesh.jobs.listeners.JobsPayment1_14Listener;
|
||||||
import com.gamingmesh.jobs.listeners.JobsPayment1_16Listener;
|
import com.gamingmesh.jobs.listeners.JobsPayment1_16Listener;
|
||||||
|
import com.gamingmesh.jobs.listeners.JobsPayment1_9Listener;
|
||||||
import com.gamingmesh.jobs.listeners.JobsPaymentListener;
|
import com.gamingmesh.jobs.listeners.JobsPaymentListener;
|
||||||
import com.gamingmesh.jobs.listeners.PistonProtectionListener;
|
import com.gamingmesh.jobs.listeners.PistonProtectionListener;
|
||||||
import com.gamingmesh.jobs.listeners.PlayerSignEdit1_20Listeners;
|
import com.gamingmesh.jobs.listeners.PlayerSignEdit1_20Listeners;
|
||||||
@ -797,26 +798,24 @@ public final class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
private static void registerListeners() {
|
private static void registerListeners() {
|
||||||
|
|
||||||
org.bukkit.plugin.PluginManager pm = getInstance().getServer().getPluginManager();
|
CMIMessages.consoleMessage("&eRegistering listeners...");
|
||||||
|
|
||||||
if (Version.isCurrentEqualOrHigher(Version.v1_9_R1)) {
|
org.bukkit.plugin.PluginManager pm = getInstance().getServer().getPluginManager();
|
||||||
pm.registerEvents(new com.gamingmesh.jobs.listeners.Listener1_9(), getInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
pm.registerEvents(new JobsListener(getInstance()), getInstance());
|
pm.registerEvents(new JobsListener(getInstance()), getInstance());
|
||||||
pm.registerEvents(new JobsPaymentListener(getInstance()), getInstance());
|
pm.registerEvents(new JobsPaymentListener(getInstance()), getInstance());
|
||||||
|
|
||||||
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) {
|
if (Version.isCurrentEqualOrHigher(Version.v1_9_R1))
|
||||||
|
pm.registerEvents(new JobsPayment1_9Listener(), getInstance());
|
||||||
|
|
||||||
|
if (Version.isCurrentEqualOrHigher(Version.v1_14_R1))
|
||||||
pm.registerEvents(new JobsPayment1_14Listener(), getInstance());
|
pm.registerEvents(new JobsPayment1_14Listener(), getInstance());
|
||||||
}
|
|
||||||
|
|
||||||
if (Version.isCurrentEqualOrHigher(Version.v1_16_R3)) {
|
if (Version.isCurrentEqualOrHigher(Version.v1_16_R3))
|
||||||
pm.registerEvents(new JobsPayment1_16Listener(), getInstance());
|
pm.registerEvents(new JobsPayment1_16Listener(), getInstance());
|
||||||
}
|
|
||||||
|
|
||||||
if (Version.isCurrentEqualOrHigher(Version.v1_20_R1)) {
|
if (Version.isCurrentEqualOrHigher(Version.v1_20_R1))
|
||||||
pm.registerEvents(new PlayerSignEdit1_20Listeners(), getInstance());
|
pm.registerEvents(new PlayerSignEdit1_20Listeners(), getInstance());
|
||||||
}
|
|
||||||
|
|
||||||
if (getGCManager().useBlockProtection) {
|
if (getGCManager().useBlockProtection) {
|
||||||
pm.registerEvents(new PistonProtectionListener(), getInstance());
|
pm.registerEvents(new PistonProtectionListener(), getInstance());
|
||||||
@ -830,6 +829,7 @@ public final class Jobs extends JavaPlugin {
|
|||||||
if (HookManager.checkMythicMobs()) {
|
if (HookManager.checkMythicMobs()) {
|
||||||
HookManager.getMythicManager().registerListener();
|
HookManager.getMythicManager().registerListener();
|
||||||
}
|
}
|
||||||
|
CMIMessages.consoleMessage("&eListeners registered successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reload() {
|
public static void reload() {
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.gamingmesh.jobs.listeners;
|
||||||
|
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.inventory.PrepareAnvilEvent;
|
||||||
|
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||||
|
|
||||||
|
import com.gamingmesh.jobs.ItemBoostManager;
|
||||||
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
|
||||||
|
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||||
|
|
||||||
|
public final class JobsPayment1_9Listener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
public void PrepareAnvilEvent(final PrepareAnvilEvent event) {
|
||||||
|
if (!Jobs.getGCManager().preventShopItemEnchanting)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!ItemBoostManager.containsItemBoostByNBT(event.getInventory().getContents()[0]))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!CMIMaterial.get(event.getInventory().getContents()[1]).equals(CMIMaterial.ENCHANTED_BOOK))
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.setResult(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerHandSwap(PlayerSwapHandItemsEvent event) {
|
||||||
|
Jobs.getPlayerManager().resetItemBonusCache(event.getPlayer().getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
@ -71,7 +71,6 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
|||||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||||
import org.bukkit.event.inventory.PrepareAnvilEvent;
|
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
@ -418,13 +417,20 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
public void breakTest(BlockBreakEvent event) {
|
||||||
|
|
||||||
|
CMIMessages.consoleMessage("break" + 1);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
|
CMIMessages.consoleMessage("" + 1);
|
||||||
final Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
|
|
||||||
if (!Jobs.getGCManager().canPerformActionInWorld(block.getWorld()))
|
if (!Jobs.getGCManager().canPerformActionInWorld(block.getWorld()))
|
||||||
return;
|
return;
|
||||||
|
CMIMessages.consoleMessage("" + 2);
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
@ -434,14 +440,17 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
// check if player is riding
|
// check if player is riding
|
||||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||||
return;
|
return;
|
||||||
|
CMIMessages.consoleMessage("" + 3);
|
||||||
|
|
||||||
// check if in creative
|
// check if in creative
|
||||||
if (!payIfCreative(player))
|
if (!payIfCreative(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CMIMessages.consoleMessage("" + 4);
|
||||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CMIMessages.consoleMessage("" + 5);
|
||||||
BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK);
|
BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK);
|
||||||
|
|
||||||
FastPayment fp = Jobs.FASTPAYMENT.get(player.getUniqueId());
|
FastPayment fp = Jobs.FASTPAYMENT.get(player.getUniqueId());
|
||||||
@ -454,9 +463,11 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
Jobs.FASTPAYMENT.remove(player.getUniqueId());
|
Jobs.FASTPAYMENT.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
CMIMessages.consoleMessage("" + 6);
|
||||||
if (!payForItemDurabilityLoss(player))
|
if (!payForItemDurabilityLoss(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CMIMessages.consoleMessage("" + 7);
|
||||||
// Protection for block break with silktouch
|
// Protection for block break with silktouch
|
||||||
if (Jobs.getGCManager().useSilkTouchProtection) {
|
if (Jobs.getGCManager().useSilkTouchProtection) {
|
||||||
ItemStack item = CMIItemStack.getItemInMainHand(player);
|
ItemStack item = CMIItemStack.getItemInMainHand(player);
|
||||||
@ -469,6 +480,7 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CMIMessages.consoleMessage("" + 8);
|
||||||
|
|
||||||
// Better implementation?
|
// Better implementation?
|
||||||
// Prevent money duplication when breaking plant blocks
|
// Prevent money duplication when breaking plant blocks
|
||||||
@ -1079,19 +1091,6 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.ENCHANT));
|
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.ENCHANT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
|
||||||
public void PrepareAnvilEvent(final PrepareAnvilEvent event) {
|
|
||||||
if (!Jobs.getGCManager().preventShopItemEnchanting)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!ItemBoostManager.containsItemBoostByNBT(event.getInventory().getContents()[0]))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!CMIMaterial.get(event.getInventory().getContents()[1]).equals(CMIMaterial.ENCHANTED_BOOK))
|
|
||||||
return;
|
|
||||||
|
|
||||||
event.setResult(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onInventoryMoveItemEventToFurnace(InventoryMoveItemEvent event) {
|
public void onInventoryMoveItemEventToFurnace(InventoryMoveItemEvent event) {
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
package com.gamingmesh.jobs.listeners;
|
|
||||||
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
|
||||||
|
|
||||||
public class Listener1_9 implements Listener {
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerHandSwap(PlayerSwapHandItemsEvent event) {
|
|
||||||
Jobs.getPlayerManager().resetItemBonusCache(event.getPlayer().getUniqueId());
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user