mirror of
https://github.com/songoda/EpicFarming.git
synced 2024-11-15 07:05:17 +01:00
Merge branch 'development'
This commit is contained in:
commit
fc9804b2a2
6
pom.xml
6
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>EpicFarming</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<version>3.2.2</version>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
@ -54,7 +54,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.3.0-SNAPSHOT</version>
|
||||
<version>3.3.0</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
@ -124,7 +124,7 @@
|
||||
<dependency>
|
||||
<groupId>com.songoda</groupId>
|
||||
<artifactId>SongodaCore</artifactId>
|
||||
<version>2.6.12</version>
|
||||
<version>2.6.13</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -4,6 +4,7 @@ import com.songoda.core.SongodaCore;
|
||||
import com.songoda.core.SongodaPlugin;
|
||||
import com.songoda.core.commands.CommandManager;
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.configuration.Config;
|
||||
import com.songoda.core.database.DataMigrationManager;
|
||||
import com.songoda.core.database.DatabaseConnector;
|
||||
@ -31,11 +32,7 @@ import com.songoda.epicfarming.farming.levels.modules.Module;
|
||||
import com.songoda.epicfarming.farming.levels.modules.ModuleAutoBreeding;
|
||||
import com.songoda.epicfarming.farming.levels.modules.ModuleAutoButcher;
|
||||
import com.songoda.epicfarming.farming.levels.modules.ModuleAutoCollect;
|
||||
import com.songoda.epicfarming.listeners.BlockListeners;
|
||||
import com.songoda.epicfarming.listeners.EntityListeners;
|
||||
import com.songoda.epicfarming.listeners.InteractListeners;
|
||||
import com.songoda.epicfarming.listeners.InventoryListeners;
|
||||
import com.songoda.epicfarming.listeners.UnloadListeners;
|
||||
import com.songoda.epicfarming.listeners.*;
|
||||
import com.songoda.epicfarming.settings.Settings;
|
||||
import com.songoda.epicfarming.storage.Storage;
|
||||
import com.songoda.epicfarming.storage.StorageRow;
|
||||
@ -160,6 +157,9 @@ public class EpicFarming extends SongodaPlugin {
|
||||
pluginManager.registerEvents(new InteractListeners(this), this);
|
||||
pluginManager.registerEvents(new UnloadListeners(this), this);
|
||||
pluginManager.registerEvents(new InventoryListeners(), this);
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) {
|
||||
pluginManager.registerEvents(new MoistureListeners(this), this);
|
||||
}
|
||||
|
||||
if (pluginManager.isPluginEnabled("FabledSkyBlock")) {
|
||||
try {
|
||||
|
@ -18,13 +18,7 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
public class Farm {
|
||||
|
||||
@ -155,15 +149,7 @@ public class Farm {
|
||||
Block b2 = block.getWorld().getBlockAt(bx + fx, by + fy, bz + fz);
|
||||
|
||||
// ToDo: enum for all flowers.
|
||||
if (b2.getType() == CompatibleMaterial.TALL_GRASS.getMaterial()
|
||||
|| b2.getType() == CompatibleMaterial.GRASS.getMaterial()
|
||||
|| b2.getType().name().contains("TULIP")
|
||||
|| b2.getType().name().contains("ORCHID")
|
||||
|| b2.getType() == CompatibleMaterial.AZURE_BLUET.getMaterial()
|
||||
|| b2.getType() == CompatibleMaterial.ALLIUM.getMaterial()
|
||||
|| b2.getType() == CompatibleMaterial.POPPY.getMaterial()
|
||||
|| b2.getType() == CompatibleMaterial.DANDELION.getMaterial()
|
||||
|| b2.getType() == CompatibleMaterial.SNOW.getMaterial()) {
|
||||
if (Settings.BREAKABLE_BLOCKS.getStringList().contains(CompatibleMaterial.getMaterial(b2.getType()).name())) {
|
||||
Bukkit.getScheduler().runTaskLater(EpicFarming.getInstance(), () -> {
|
||||
b2.getRelative(BlockFace.DOWN).setType(CompatibleMaterial.FARMLAND.getMaterial());
|
||||
b2.breakNaturally();
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.songoda.epicfarming.listeners;
|
||||
|
||||
import com.songoda.epicfarming.EpicFarming;
|
||||
import com.songoda.epicfarming.farming.Farm;
|
||||
import org.bukkit.block.data.type.Farmland;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.MoistureChangeEvent;
|
||||
|
||||
public class MoistureListeners implements Listener {
|
||||
|
||||
private final EpicFarming plugin;
|
||||
public MoistureListeners(EpicFarming plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMoistureChange(MoistureChangeEvent event) {
|
||||
if (event.getNewState().getBlockData() instanceof Farmland) {
|
||||
return;
|
||||
}
|
||||
|
||||
Farm farm = plugin.getFarmManager().checkForFarm(event.getBlock().getLocation());
|
||||
if (farm != null) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import com.songoda.core.configuration.ConfigSetting;
|
||||
import com.songoda.core.hooks.EconomyManager;
|
||||
import com.songoda.epicfarming.EpicFarming;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Settings {
|
||||
@ -43,6 +44,15 @@ public class Settings {
|
||||
public static final ConfigSetting USE_PROTECTION_PLUGINS = new ConfigSetting(config, "Main.Use Protection Plugins", true,
|
||||
"Should we use protection plugins?");
|
||||
|
||||
public static final ConfigSetting BREAKABLE_BLOCKS = new ConfigSetting(config, "Main.Breakable Blocks", Arrays.asList(
|
||||
"TALL_GRASS", "GRASS", "BLUE_ORCHID", "AZURE_BLUET",
|
||||
"ALLIUM", "POPPY", "DANDELION", "SNOW",
|
||||
"CORNFLOWER", "FERN", "LARGE_FERN", "SUNFLOWER",
|
||||
"ROSE_BUSH", "OXEYE_DAISY", "LILY_OF_THE_VALLEY", "PEONY",
|
||||
"LILAC", "WITHER_ROSE", "PINK_TULIP", "RED_TULIP",
|
||||
"WHITE_TULIP", "ORANGE_TULIP", "NETHER_SPROUTS", "GLOW_LICHEN"),
|
||||
"Which blocks should farms be allowed to break when they til the land?");
|
||||
|
||||
public static final ConfigSetting ECONOMY_PLUGIN = new ConfigSetting(config, "Main.Economy", EconomyManager.getEconomy() == null ? "Vault" : EconomyManager.getEconomy().getName(),
|
||||
"Which economy plugin should be used?",
|
||||
"Supported plugins you have installed: \"" + EconomyManager.getManager().getRegisteredPlugins().stream().collect(Collectors.joining("\", \"")) + "\".");
|
||||
|
Loading…
Reference in New Issue
Block a user