mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-23 00:49:33 +00:00
Merge branch 'main' into dev
This commit is contained in:
@@ -25,8 +25,9 @@ dependencies {
|
||||
|
||||
compileOnly("net.Indyuce:MMOCore-API:1.12-SNAPSHOT")
|
||||
compileOnly("com.github.Archy-X:AureliumSkills:Beta1.3.23")
|
||||
|
||||
compileOnly("com.github.Zrips:Jobs:v4.17.2")
|
||||
compileOnly("dev.aurelium:auraskills-api-bukkit:2.0.0-SNAPSHOT")
|
||||
compileOnly("dev.aurelium:auraskills-api-bukkit:2.1.2")
|
||||
|
||||
// Items
|
||||
compileOnly("com.github.LoneDev6:api-itemsadder:3.6.2-beta-r3-b")
|
||||
@@ -52,12 +53,12 @@ dependencies {
|
||||
implementation(project(":oraxen-j21"))
|
||||
implementation(project(":legacy-api"))
|
||||
|
||||
implementation(files("libs/Sparrow-Heart-0.17.jar"))
|
||||
implementation(files("libs/Sparrow-Heart-0.19.jar"))
|
||||
implementation("net.kyori:adventure-api:4.17.0")
|
||||
implementation("net.kyori:adventure-platform-bukkit:4.3.3")
|
||||
implementation("net.kyori:adventure-text-minimessage:4.17.0")
|
||||
implementation("net.kyori:adventure-text-serializer-legacy:4.17.0")
|
||||
implementation("com.github.Xiao-MoMi:AntiGriefLib:0.11")
|
||||
implementation("com.github.Xiao-MoMi:AntiGriefLib:0.12")
|
||||
// implementation("com.github.Xiao-MoMi:Sparrow-Heart:0.16")
|
||||
implementation("com.flowpowered:flow-nbt:2.0.2")
|
||||
implementation("com.saicone.rtag:rtag:1.5.4")
|
||||
|
||||
Binary file not shown.
BIN
plugin/libs/Sparrow-Heart-0.19.jar
Normal file
BIN
plugin/libs/Sparrow-Heart-0.19.jar
Normal file
Binary file not shown.
@@ -30,6 +30,7 @@ import net.momirealms.customcrops.api.manager.MessageManager;
|
||||
import net.momirealms.customcrops.api.mechanic.item.ItemType;
|
||||
import net.momirealms.customcrops.api.mechanic.world.ChunkPos;
|
||||
import net.momirealms.customcrops.api.mechanic.world.CustomCropsBlock;
|
||||
import net.momirealms.customcrops.api.mechanic.world.SimpleLocation;
|
||||
import net.momirealms.customcrops.api.mechanic.world.level.CustomCropsChunk;
|
||||
import net.momirealms.customcrops.api.mechanic.world.level.CustomCropsSection;
|
||||
import net.momirealms.customcrops.api.mechanic.world.level.CustomCropsWorld;
|
||||
@@ -37,6 +38,7 @@ import net.momirealms.customcrops.api.mechanic.world.season.Season;
|
||||
import net.momirealms.customcrops.compatibility.season.InBuiltSeason;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.generator.WorldInfo;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -88,7 +90,7 @@ public class CommandManager implements Initable {
|
||||
return new CommandAPICommand("unsafe")
|
||||
.withSubcommands(
|
||||
new CommandAPICommand("delete-chunk-data").executesPlayer((player, args) -> {
|
||||
CustomCropsPlugin.get().getWorldManager().getCustomCropsWorld(player.getWorld()).ifPresent(customCropsWorld -> {
|
||||
plugin.getWorldManager().getCustomCropsWorld(player.getWorld()).ifPresent(customCropsWorld -> {
|
||||
var optionalChunk = customCropsWorld.getLoadedChunkAt(ChunkPos.getByBukkitChunk(player.getChunk()));
|
||||
if (optionalChunk.isEmpty()) {
|
||||
AdventureManager.getInstance().sendMessageWithPrefix(player, "<white>This chunk doesn't have any data.");
|
||||
@@ -97,6 +99,17 @@ public class CommandManager implements Initable {
|
||||
customCropsWorld.deleteChunk(ChunkPos.getByBukkitChunk(player.getChunk()));
|
||||
AdventureManager.getInstance().sendMessageWithPrefix(player, "<white>Done.");
|
||||
});
|
||||
}),
|
||||
new CommandAPICommand("check-data").executesPlayer((player, args) -> {
|
||||
Block block = player.getTargetBlockExact(10);
|
||||
if (block != null) {
|
||||
Optional<CustomCropsBlock> customCropsBlock = plugin.getWorldManager().getBlockAt(SimpleLocation.of(block.getLocation()));
|
||||
if (customCropsBlock.isPresent()) {
|
||||
AdventureManager.getInstance().sendMessageWithPrefix(player, customCropsBlock.get().getType() + ":" + customCropsBlock.get().getCompoundMap());
|
||||
return;
|
||||
}
|
||||
}
|
||||
AdventureManager.getInstance().sendMessageWithPrefix(player, "Data not found");
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ import net.momirealms.customcrops.api.util.LogUtils;
|
||||
import net.momirealms.customcrops.compatibility.VaultHook;
|
||||
import net.momirealms.customcrops.manager.AdventureManagerImpl;
|
||||
import net.momirealms.customcrops.manager.HologramManager;
|
||||
import net.momirealms.customcrops.manager.PacketManager;
|
||||
import net.momirealms.customcrops.mechanic.item.impl.VariationCrop;
|
||||
import net.momirealms.customcrops.mechanic.misc.TempFakeItem;
|
||||
import net.momirealms.customcrops.mechanic.world.block.MemoryCrop;
|
||||
@@ -61,7 +60,7 @@ import net.momirealms.customcrops.util.ClassUtils;
|
||||
import net.momirealms.customcrops.util.ConfigUtils;
|
||||
import net.momirealms.customcrops.util.ItemUtils;
|
||||
import net.momirealms.sparrow.heart.SparrowHeart;
|
||||
import net.momirealms.sparrow.heart.argument.HandSlot;
|
||||
import net.momirealms.sparrow.heart.feature.inventory.HandSlot;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@@ -828,7 +827,8 @@ public class ActionManagerImpl implements ActionManager {
|
||||
return state -> {
|
||||
if (Math.random() > chance) return;
|
||||
ItemStack itemStack = state.getItemInHand();
|
||||
|
||||
if (itemStack.getItemMeta() == null)
|
||||
return;
|
||||
if (amount > 0) {
|
||||
ItemUtils.increaseDurability(itemStack, amount);
|
||||
} else {
|
||||
|
||||
@@ -97,6 +97,7 @@ public class ConditionManagerImpl implements ConditionManager {
|
||||
this.registerPotCondition();
|
||||
this.registerLightCondition();
|
||||
this.registerPointCondition();
|
||||
this.registerWorldRequirement();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,6 +200,17 @@ public class ConditionManagerImpl implements ConditionManager {
|
||||
}));
|
||||
}
|
||||
|
||||
private void registerWorldRequirement() {
|
||||
registerCondition("world", (args) -> {
|
||||
HashSet<String> worlds = new HashSet<>(ConfigUtils.stringListArgs(args));
|
||||
return (block, offline) -> worlds.contains(block.getLocation().getWorldName());
|
||||
});
|
||||
registerCondition("!world", (args) -> {
|
||||
HashSet<String> worlds = new HashSet<>(ConfigUtils.stringListArgs(args));
|
||||
return (block, offline) -> !worlds.contains(block.getLocation().getWorldName());
|
||||
});
|
||||
}
|
||||
|
||||
private void registerBiomeRequirement() {
|
||||
registerCondition("biome", (args) -> {
|
||||
HashSet<String> biomes = new HashSet<>(ConfigUtils.stringListArgs(args));
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ItemManagerImpl implements ItemManager {
|
||||
oraxenListenerConstructor.setAccessible(true);
|
||||
this.listener = (AbstractCustomListener) oraxenListenerConstructor.newInstance(this);
|
||||
Class<?> oraxenProviderClass = Class.forName("net.momirealms.customcrops.mechanic.item.custom.oraxen.OraxenProvider");
|
||||
Constructor<?> oraxenProviderConstructor = oraxenProviderClass.getDeclaredConstructor(ItemManager.class);
|
||||
Constructor<?> oraxenProviderConstructor = oraxenProviderClass.getDeclaredConstructor();
|
||||
oraxenProviderConstructor.setAccessible(true);
|
||||
this.customProvider = (CustomProvider) oraxenProviderConstructor.newInstance();
|
||||
} catch (ReflectiveOperationException e) {
|
||||
@@ -2660,6 +2660,9 @@ public class ItemManagerImpl implements ItemManager {
|
||||
Pot currentPot = getPotByBlock(block);
|
||||
if (currentPot != pot) {
|
||||
plugin.getWorldManager().removePotAt(SimpleLocation.of(location));
|
||||
if (currentPot != null) {
|
||||
plugin.getWorldManager().addPotAt(new MemoryPot(SimpleLocation.of(location), currentPot.getKey()), SimpleLocation.of(location));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pot.isVanillaBlock()) {
|
||||
|
||||
@@ -106,6 +106,10 @@ public class ItemsAdderProvider implements CustomProvider {
|
||||
|
||||
@Override
|
||||
public boolean isFurniture(Entity entity) {
|
||||
return CustomFurniture.byAlreadySpawned(entity) != null;
|
||||
try {
|
||||
return CustomFurniture.byAlreadySpawned(entity) != null;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ItemUtils {
|
||||
public static void increaseDurability(ItemStack itemStack, int amount) {
|
||||
if (itemStack == null || itemStack.getType() == Material.AIR)
|
||||
return;
|
||||
Item<ItemStack> item = BukkitItemFactory.getInstance().wrap(itemStack);
|
||||
Item<ItemStack> item = BukkitItemFactory.getInstance().wrap(itemStack.clone());
|
||||
int damage = Math.max(item.damage().orElse(0) - amount, 0);
|
||||
item.damage(damage);
|
||||
itemStack.setItemMeta(item.load().getItemMeta());
|
||||
@@ -104,7 +104,7 @@ public class ItemUtils {
|
||||
if (Math.random() > (double) 1 / (unBreakingLevel + 1)) {
|
||||
return;
|
||||
}
|
||||
Item<ItemStack> item = BukkitItemFactory.getInstance().wrap(itemStack);
|
||||
Item<ItemStack> item = BukkitItemFactory.getInstance().wrap(itemStack.clone());
|
||||
int damage = item.damage().orElse(0) + amount;
|
||||
if (damage > item.maxDamage().orElse((int) itemStack.getType().getMaxDurability())) {
|
||||
itemStack.setAmount(0);
|
||||
|
||||
Reference in New Issue
Block a user