9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-23 08:59:28 +00:00

add languages and farmland support

This commit is contained in:
XiaoMoMi
2024-03-09 08:23:54 +08:00
parent 8d37290cff
commit 19a0080aae
12 changed files with 93 additions and 4 deletions

View File

@@ -54,4 +54,6 @@ public interface Pot extends KeyItem {
boolean isNearbyWaterAccepted();
String getBlockState(boolean water, FertilizerType type);
boolean isVanillaBlock();
}

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.manager;
import net.momirealms.customcrops.api.CustomCropsPlugin;

View File

@@ -59,7 +59,9 @@ import net.momirealms.customcrops.utils.ItemUtils;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Farmland;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
@@ -2268,6 +2270,14 @@ public class ItemManagerImpl implements ItemManager {
@Override
public void updatePotState(Location location, Pot pot, boolean hasWater, Fertilizer fertilizer) {
if (pot.isVanillaBlock()) {
Block block = location.getBlock();
if (block.getBlockData() instanceof Farmland farmland) {
farmland.setMoisture(hasWater ? 7 : 0);
block.setBlockData(farmland);
return;
}
}
this.customProvider.placeBlock(
location,
pot.getBlockState(

View File

@@ -1,3 +1,20 @@
/*
* Copyright (C) <2022> <XiaoMoMi>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customcrops.mechanic.item.function;
public enum FunctionTrigger {

View File

@@ -26,6 +26,7 @@ import net.momirealms.customcrops.api.mechanic.item.water.PassiveFillMethod;
import net.momirealms.customcrops.api.mechanic.misc.image.WaterBar;
import net.momirealms.customcrops.api.mechanic.requirement.Requirement;
import net.momirealms.customcrops.mechanic.item.AbstractEventItem;
import net.momirealms.customcrops.utils.ConfigUtils;
import java.util.HashMap;
import java.util.HashSet;
@@ -45,6 +46,7 @@ public class PotConfig extends AbstractEventItem implements Pot {
private final Requirement[] useRequirements;
private final boolean acceptRainDrop;
private final boolean acceptNearbyWater;
private boolean isVanillaBlock;
public PotConfig(
String key,
@@ -76,6 +78,7 @@ public class PotConfig extends AbstractEventItem implements Pot {
this.placeRequirements = placeRequirements;
this.breakRequirements = breakRequirements;
this.useRequirements = useRequirements;
this.isVanillaBlock = ConfigUtils.isVanillaItem(dryModel) && ConfigUtils.isVanillaItem(wetModel);
}
@Override
@@ -153,4 +156,9 @@ public class PotConfig extends AbstractEventItem implements Pot {
return water ? wetModel : dryModel;
}
}
@Override
public boolean isVanillaBlock() {
return isVanillaBlock;
}
}

View File

@@ -39,11 +39,14 @@ public class SlimeWorldAdaptor extends AbstractWorldAdaptor {
@EventHandler (ignoreCancelled = true)
public void onSlimeWorldLoad(LoadSlimeWorldEvent event) {
}
@EventHandler(ignoreCancelled = true)
public void onWorldLoad(WorldLoadEvent event) {
if (worldManager.isMechanicEnabled(event.getWorld())) {
worldManager.loadWorld(event.getWorld());
}
}
@EventHandler (ignoreCancelled = true)

View File

@@ -25,8 +25,6 @@ worlds:
mode: blacklist
list:
- blacklist_world
- world_nether
- world_the_end
settings:
_DEFAULT_:
# Whether to enable the plugin's pre-made system
@@ -86,6 +84,7 @@ worlds:
# as it may cause chunks that have been unloaded for a long time
# to consume too much server performance during loading
max-offline-seconds: 1200
# You can override the default settings for worlds here
_WORLDS_:
world_nether:
enable: false

View File

@@ -0,0 +1,8 @@
messages:
prefix: '<gradient:#ff206c:#fdee55>[CustomCrops]</gradient> '
reload: '<white>重载完成! 耗时 <green>{time}ms.</green></white>'
spring: '春季'
summer: '夏季'
autumn: '秋季'
winter: '冬季'
no-season: '未启用季节'

View File

@@ -0,0 +1,8 @@
messages:
prefix: '<gradient:#ff206c:#fdee55>[CustomCrops]</gradient> '
reload: '<white>Rechargé ! A pris <green>{time}ms.'
spring: 'Printemps'
summer: 'Été'
autumn: 'Automne'
winter: 'Hiver'
no-season: 'SAISON DÉSACTIVÉE DANS CE MONDE'

View File

@@ -0,0 +1,8 @@
messages:
prefix: '<gradient:#ff206c:#fdee55>[CustomCrops]</gradient> '
reload: '<white>Перезагружено! Заняло <green>{time}мс.'
spring: 'Весна'
summer: 'Лето'
autumn: 'Осень'
winter: 'Зима'
no-season: 'СЕЗОНЫ ОТКЛЮЧЕНЫ В ЭТОМ МИРЕ'

View File

@@ -0,0 +1,8 @@
messages:
prefix: '<gradient:#ff206c:#fdee55>[CustomCrops]</gradient> '
reload: '<white>¡Recargado! Tomó <green>{time}ms.'
spring: 'Primavera'
summer: 'Verano'
autumn: 'Otoño'
winter: 'Invierno'
no-season: 'LAS TEMPORADAS ESTAN DESACTIVADAS EN ESTE MUNDO'

View File

@@ -23,3 +23,4 @@ softdepend:
- Jobs
- RealisticSeasons
- AdvancedSeasons
- SlimeWorldManager