Merge branch 'development'

This commit is contained in:
Fernando Pettinelli 2021-01-25 15:26:37 -03:00
commit 0fd19f4758
6 changed files with 17 additions and 3 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>EpicHoppers</artifactId> <artifactId>EpicHoppers</artifactId>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>4.6.16b</version> <version>4.6.17</version>
<build> <build>
<defaultGoal>clean install</defaultGoal> <defaultGoal>clean install</defaultGoal>
<finalName>EpicHoppers-${project.version}</finalName> <finalName>EpicHoppers-${project.version}</finalName>

View File

@ -10,6 +10,7 @@ import com.songoda.core.database.DatabaseConnector;
import com.songoda.core.database.SQLiteConnector; import com.songoda.core.database.SQLiteConnector;
import com.songoda.core.gui.GuiManager; import com.songoda.core.gui.GuiManager;
import com.songoda.core.hooks.EconomyManager; import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.ProtectionManager;
import com.songoda.core.locale.Locale; import com.songoda.core.locale.Locale;
import com.songoda.core.nms.NmsManager; import com.songoda.core.nms.NmsManager;
import com.songoda.core.nms.nbt.NBTItem; import com.songoda.core.nms.nbt.NBTItem;
@ -99,6 +100,9 @@ public class EpicHoppers extends SongodaPlugin {
// Load Economy // Load Economy
EconomyManager.load(); EconomyManager.load();
// Load protection hook
ProtectionManager.load(this);
// Setup Config // Setup Config
Settings.setupConfig(); Settings.setupConfig();
this.setLocale(Settings.LANGUGE_MODE.getString(), false); this.setLocale(Settings.LANGUGE_MODE.getString(), false);

View File

@ -66,10 +66,10 @@ public class HopperListeners implements Listener {
// Special cases when a hopper is picking up items // Special cases when a hopper is picking up items
if (destination.getHolder() instanceof org.bukkit.block.Hopper) { if (destination.getHolder() instanceof org.bukkit.block.Hopper) {
if (destinationLocation != null && Settings.ALLOW_NORMAL_HOPPERS.getBoolean() && !instance.getHopperManager().isHopper(destinationLocation)) Hopper toHopper = instance.getHopperManager().getHopper(destinationLocation);
if (destinationLocation != null && Settings.ALLOW_NORMAL_HOPPERS.getBoolean() && toHopper == null)
return; return;
// minecraft 1.8 doesn't have a method to get the hopper's location from the inventory, so we use the holder instead // minecraft 1.8 doesn't have a method to get the hopper's location from the inventory, so we use the holder instead
Hopper toHopper = instance.getHopperManager().getHopper(destinationLocation);
final ItemStack toMove = event.getItem(); final ItemStack toMove = event.getItem();
// Don't fill the last inventory slot on crafting hoppers (fixes crafters getting stuck) // Don't fill the last inventory slot on crafting hoppers (fixes crafters getting stuck)

View File

@ -1,5 +1,6 @@
package com.songoda.epichoppers.listeners; package com.songoda.epichoppers.listeners;
import com.songoda.core.hooks.ProtectionManager;
import com.songoda.core.hooks.WorldGuardHook; import com.songoda.core.hooks.WorldGuardHook;
import com.songoda.epichoppers.EpicHoppers; import com.songoda.epichoppers.EpicHoppers;
import com.songoda.epichoppers.hopper.Hopper; import com.songoda.epichoppers.hopper.Hopper;
@ -64,6 +65,11 @@ public class InteractListeners implements Listener {
if (WorldGuardHook.isInteractAllowed(event.getClickedBlock().getLocation())) if (WorldGuardHook.isInteractAllowed(event.getClickedBlock().getLocation()))
return; return;
if (Settings.USE_PROTECTION_PLUGINS.getBoolean() && !ProtectionManager.canInteract(player, event.getClickedBlock().getLocation())) {
player.sendMessage(instance.getLocale().getMessage("event.general.protected").getPrefixedMessage());
return;
}
if (Bukkit.getPluginManager().isPluginEnabled("FabledSkyBlock")) { if (Bukkit.getPluginManager().isPluginEnabled("FabledSkyBlock")) {
SkyBlock skyBlock = SkyBlock.getInstance(); SkyBlock skyBlock = SkyBlock.getInstance();

View File

@ -54,6 +54,9 @@ public class Settings {
public static final ConfigSetting MAX_CHUNK = new ConfigSetting(config, "Main.Max Hoppers Per Chunk", -1, public static final ConfigSetting MAX_CHUNK = new ConfigSetting(config, "Main.Max Hoppers Per Chunk", -1,
"The maximum amount of hoppers per chunk."); "The maximum amount of hoppers per chunk.");
public static final ConfigSetting USE_PROTECTION_PLUGINS = new ConfigSetting(config, "Main.Use Protection Plugins", true,
"Should we use protection plugins?");
public static final ConfigSetting BLOCKBREAK_PARTICLE = new ConfigSetting(config, "Main.BlockBreak Particle Type", "LAVA", public static final ConfigSetting BLOCKBREAK_PARTICLE = new ConfigSetting(config, "Main.BlockBreak Particle Type", "LAVA",
"The particle shown when the block break module performs a block break."); "The particle shown when the block break module performs a block break.");

View File

@ -79,6 +79,7 @@ command:
event: event:
general: general:
nopermission: '&cYou do not have permission to do that.' nopermission: '&cYou do not have permission to do that.'
protected: '&cThis hopper is protected and you cannot access it.'
upgrade: upgrade:
cannotafford: '&cYou cannot afford this upgrade.' cannotafford: '&cYou cannot afford this upgrade.'
success: '&7You successfully upgraded this hopper to &6level %level%&7!' success: '&7You successfully upgraded this hopper to &6level %level%&7!'