mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-23 17:09:21 +00:00
add languages and farmland support
This commit is contained in:
@@ -54,4 +54,6 @@ public interface Pot extends KeyItem {
|
|||||||
boolean isNearbyWaterAccepted();
|
boolean isNearbyWaterAccepted();
|
||||||
|
|
||||||
String getBlockState(boolean water, FertilizerType type);
|
String getBlockState(boolean water, FertilizerType type);
|
||||||
|
|
||||||
|
boolean isVanillaBlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
package net.momirealms.customcrops.manager;
|
||||||
|
|
||||||
import net.momirealms.customcrops.api.CustomCropsPlugin;
|
import net.momirealms.customcrops.api.CustomCropsPlugin;
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ import net.momirealms.customcrops.utils.ItemUtils;
|
|||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.Waterlogged;
|
import org.bukkit.block.data.Waterlogged;
|
||||||
|
import org.bukkit.block.data.type.Farmland;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@@ -2268,6 +2270,14 @@ public class ItemManagerImpl implements ItemManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePotState(Location location, Pot pot, boolean hasWater, Fertilizer fertilizer) {
|
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(
|
this.customProvider.placeBlock(
|
||||||
location,
|
location,
|
||||||
pot.getBlockState(
|
pot.getBlockState(
|
||||||
|
|||||||
@@ -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;
|
package net.momirealms.customcrops.mechanic.item.function;
|
||||||
|
|
||||||
public enum FunctionTrigger {
|
public enum FunctionTrigger {
|
||||||
|
|||||||
@@ -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.misc.image.WaterBar;
|
||||||
import net.momirealms.customcrops.api.mechanic.requirement.Requirement;
|
import net.momirealms.customcrops.api.mechanic.requirement.Requirement;
|
||||||
import net.momirealms.customcrops.mechanic.item.AbstractEventItem;
|
import net.momirealms.customcrops.mechanic.item.AbstractEventItem;
|
||||||
|
import net.momirealms.customcrops.utils.ConfigUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -45,6 +46,7 @@ public class PotConfig extends AbstractEventItem implements Pot {
|
|||||||
private final Requirement[] useRequirements;
|
private final Requirement[] useRequirements;
|
||||||
private final boolean acceptRainDrop;
|
private final boolean acceptRainDrop;
|
||||||
private final boolean acceptNearbyWater;
|
private final boolean acceptNearbyWater;
|
||||||
|
private boolean isVanillaBlock;
|
||||||
|
|
||||||
public PotConfig(
|
public PotConfig(
|
||||||
String key,
|
String key,
|
||||||
@@ -76,6 +78,7 @@ public class PotConfig extends AbstractEventItem implements Pot {
|
|||||||
this.placeRequirements = placeRequirements;
|
this.placeRequirements = placeRequirements;
|
||||||
this.breakRequirements = breakRequirements;
|
this.breakRequirements = breakRequirements;
|
||||||
this.useRequirements = useRequirements;
|
this.useRequirements = useRequirements;
|
||||||
|
this.isVanillaBlock = ConfigUtils.isVanillaItem(dryModel) && ConfigUtils.isVanillaItem(wetModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -153,4 +156,9 @@ public class PotConfig extends AbstractEventItem implements Pot {
|
|||||||
return water ? wetModel : dryModel;
|
return water ? wetModel : dryModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVanillaBlock() {
|
||||||
|
return isVanillaBlock;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,11 +39,14 @@ public class SlimeWorldAdaptor extends AbstractWorldAdaptor {
|
|||||||
|
|
||||||
@EventHandler (ignoreCancelled = true)
|
@EventHandler (ignoreCancelled = true)
|
||||||
public void onSlimeWorldLoad(LoadSlimeWorldEvent event) {
|
public void onSlimeWorldLoad(LoadSlimeWorldEvent event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onWorldLoad(WorldLoadEvent event) {
|
public void onWorldLoad(WorldLoadEvent event) {
|
||||||
|
if (worldManager.isMechanicEnabled(event.getWorld())) {
|
||||||
|
worldManager.loadWorld(event.getWorld());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (ignoreCancelled = true)
|
@EventHandler (ignoreCancelled = true)
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ worlds:
|
|||||||
mode: blacklist
|
mode: blacklist
|
||||||
list:
|
list:
|
||||||
- blacklist_world
|
- blacklist_world
|
||||||
- world_nether
|
|
||||||
- world_the_end
|
|
||||||
settings:
|
settings:
|
||||||
_DEFAULT_:
|
_DEFAULT_:
|
||||||
# Whether to enable the plugin's pre-made system
|
# 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
|
# as it may cause chunks that have been unloaded for a long time
|
||||||
# to consume too much server performance during loading
|
# to consume too much server performance during loading
|
||||||
max-offline-seconds: 1200
|
max-offline-seconds: 1200
|
||||||
|
# You can override the default settings for worlds here
|
||||||
_WORLDS_:
|
_WORLDS_:
|
||||||
world_nether:
|
world_nether:
|
||||||
enable: false
|
enable: false
|
||||||
|
|||||||
8
plugin/src/main/resources/messages/chinese.yml
Normal file
8
plugin/src/main/resources/messages/chinese.yml
Normal 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: '未启用季节'
|
||||||
8
plugin/src/main/resources/messages/french.yml
Normal file
8
plugin/src/main/resources/messages/french.yml
Normal 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'
|
||||||
8
plugin/src/main/resources/messages/russian.yml
Normal file
8
plugin/src/main/resources/messages/russian.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
messages:
|
||||||
|
prefix: '<gradient:#ff206c:#fdee55>[CustomCrops]</gradient> '
|
||||||
|
reload: '<white>Перезагружено! Заняло <green>{time}мс.'
|
||||||
|
spring: 'Весна'
|
||||||
|
summer: 'Лето'
|
||||||
|
autumn: 'Осень'
|
||||||
|
winter: 'Зима'
|
||||||
|
no-season: 'СЕЗОНЫ ОТКЛЮЧЕНЫ В ЭТОМ МИРЕ'
|
||||||
8
plugin/src/main/resources/messages/spanish.yml
Normal file
8
plugin/src/main/resources/messages/spanish.yml
Normal 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'
|
||||||
@@ -23,3 +23,4 @@ softdepend:
|
|||||||
- Jobs
|
- Jobs
|
||||||
- RealisticSeasons
|
- RealisticSeasons
|
||||||
- AdvancedSeasons
|
- AdvancedSeasons
|
||||||
|
- SlimeWorldManager
|
||||||
Reference in New Issue
Block a user