mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-22 16:39:36 +00:00
2.0-r8
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'net.momirealms'
|
group = 'net.momirealms'
|
||||||
version = '2.0-r7'
|
version = '2.0-r8-hotfix'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -106,6 +106,11 @@ public class MainConfig {
|
|||||||
public static String[] summerMsg;
|
public static String[] summerMsg;
|
||||||
public static String[] autumnMsg;
|
public static String[] autumnMsg;
|
||||||
public static String[] winterMsg;
|
public static String[] winterMsg;
|
||||||
|
public static boolean enableSeasonChangeCmd;
|
||||||
|
public static String[] winterCmd;
|
||||||
|
public static String[] springCmd;
|
||||||
|
public static String[] summerCmd;
|
||||||
|
public static String[] autumnCmd;
|
||||||
public static String worldFolder;
|
public static String worldFolder;
|
||||||
public static boolean rightHarvestVanilla;
|
public static boolean rightHarvestVanilla;
|
||||||
public static boolean preventPlantVanilla;
|
public static boolean preventPlantVanilla;
|
||||||
@@ -174,6 +179,11 @@ public class MainConfig {
|
|||||||
summerMsg = config.getStringList("season-broadcast.summer").toArray(new String[0]);
|
summerMsg = config.getStringList("season-broadcast.summer").toArray(new String[0]);
|
||||||
autumnMsg = config.getStringList("season-broadcast.autumn").toArray(new String[0]);
|
autumnMsg = config.getStringList("season-broadcast.autumn").toArray(new String[0]);
|
||||||
winterMsg = config.getStringList("season-broadcast.winter").toArray(new String[0]);
|
winterMsg = config.getStringList("season-broadcast.winter").toArray(new String[0]);
|
||||||
|
enableSeasonChangeCmd = config.getBoolean("season-change-command.enable", false);
|
||||||
|
springCmd = config.getStringList("season-change-command.spring").toArray(new String[0]);
|
||||||
|
summerCmd = config.getStringList("season-change-command.summer").toArray(new String[0]);
|
||||||
|
autumnCmd = config.getStringList("season-change-command.autumn").toArray(new String[0]);
|
||||||
|
winterCmd = config.getStringList("season-change-command.winter").toArray(new String[0]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boneMealSuccess = Particle.valueOf(config.getString("mechanics.bone-meal.success-particle", "VILLAGER_HAPPY"));
|
boneMealSuccess = Particle.valueOf(config.getString("mechanics.bone-meal.success-particle", "VILLAGER_HAPPY"));
|
||||||
@@ -314,7 +324,7 @@ public class MainConfig {
|
|||||||
else {skillXP = new EcoSkillsHook();}
|
else {skillXP = new EcoSkillsHook();}
|
||||||
}
|
}
|
||||||
if (config.getBoolean("integration.JobsReborn")) {
|
if (config.getBoolean("integration.JobsReborn")) {
|
||||||
if (Bukkit.getPluginManager().getPlugin("JobsReborn") == null) Log.warn("Failed to initialize JobsReborn!");
|
if (Bukkit.getPluginManager().getPlugin("Jobs") == null) Log.warn("Failed to initialize JobsReborn!");
|
||||||
else {skillXP = new JobsRebornHook();}
|
else {skillXP = new JobsRebornHook();}
|
||||||
}
|
}
|
||||||
realisticSeasonHook = false;
|
realisticSeasonHook = false;
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ public class ItemsAdderWireHandler extends ItemsAdderHandler {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
CustomBlock.place(namespacedId, location);
|
CustomBlock.place(namespacedId, location);
|
||||||
if (player.getGameMode() != GameMode.CREATIVE)
|
if (player.getGameMode() != GameMode.CREATIVE)
|
||||||
CustomBlock.byAlreadyPlaced(location.getBlock()).getLoot().forEach(itemStack -> location.getWorld().dropItem(location.clone().add(0.5,0.2,0.5), itemStack));
|
CustomBlock.byAlreadyPlaced(location.getBlock()).getLoot().forEach(itemStack -> location.getWorld().dropItemNaturally(location, itemStack));
|
||||||
CustomBlock.remove(location);
|
CustomBlock.remove(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,35 +96,57 @@ public class InternalSeason extends Function implements SeasonInterface {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CCSeason oldSeason = seasonHashMap.put(world, season);
|
CCSeason oldSeason = seasonHashMap.put(world, season);
|
||||||
if (!MainConfig.enableSeasonBroadcast) return;
|
if (!MainConfig.enableSeasonBroadcast && !MainConfig.enableSeasonChangeCmd) return;
|
||||||
if (oldSeason == null) return;
|
if (oldSeason == null) return;
|
||||||
// season changed
|
// season changed
|
||||||
if (oldSeason != season) {
|
if (oldSeason != season) {
|
||||||
Collection<? extends Player> players;
|
if (MainConfig.enableSeasonBroadcast) {
|
||||||
if (MainConfig.syncSeason) players = Bukkit.getOnlinePlayers();
|
Collection<? extends Player> players;
|
||||||
else players = world.getPlayers();
|
if (MainConfig.syncSeason) players = Bukkit.getOnlinePlayers();
|
||||||
|
else players = world.getPlayers();
|
||||||
|
|
||||||
switch (season) {
|
switch (season) {
|
||||||
case SPRING -> players.forEach(player -> {
|
case SPRING -> players.forEach(player -> {
|
||||||
for (String msg : MainConfig.springMsg) {
|
for (String msg : MainConfig.springMsg) {
|
||||||
AdventureUtil.playerMessage(player, msg);
|
AdventureUtil.playerMessage(player, msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
case SUMMER -> players.forEach(player -> {
|
||||||
|
for (String msg : MainConfig.summerMsg) {
|
||||||
|
AdventureUtil.playerMessage(player, msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
case AUTUMN -> players.forEach(player -> {
|
||||||
|
for (String msg : MainConfig.autumnMsg) {
|
||||||
|
AdventureUtil.playerMessage(player, msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
case WINTER -> players.forEach(player -> {
|
||||||
|
for (String msg : MainConfig.winterMsg) {
|
||||||
|
AdventureUtil.playerMessage(player, msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MainConfig.enableSeasonChangeCmd) {
|
||||||
|
switch (season) {
|
||||||
|
case SPRING -> {
|
||||||
|
for (String cmd : MainConfig.springCmd)
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||||
}
|
}
|
||||||
});
|
case SUMMER -> {
|
||||||
case SUMMER -> players.forEach(player -> {
|
for (String cmd : MainConfig.summerCmd)
|
||||||
for (String msg : MainConfig.summerMsg) {
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||||
AdventureUtil.playerMessage(player, msg);
|
|
||||||
}
|
}
|
||||||
});
|
case AUTUMN -> {
|
||||||
case AUTUMN -> players.forEach(player -> {
|
for (String cmd : MainConfig.autumnCmd)
|
||||||
for (String msg : MainConfig.autumnMsg) {
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||||
AdventureUtil.playerMessage(player, msg);
|
|
||||||
}
|
}
|
||||||
});
|
case WINTER -> {
|
||||||
case WINTER -> players.forEach(player -> {
|
for (String cmd : MainConfig.winterCmd)
|
||||||
for (String msg : MainConfig.winterMsg) {
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||||
AdventureUtil.playerMessage(player, msg);
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ public class CropManager extends Function {
|
|||||||
this.worldListener = new WorldListener(this);
|
this.worldListener = new WorldListener(this);
|
||||||
this.armorStandUtil = new ArmorStandUtil(this);
|
this.armorStandUtil = new ArmorStandUtil(this);
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().registerEvents(itemSpawnListener, CustomCrops.plugin);
|
||||||
|
Bukkit.getPluginManager().registerEvents(worldListener, CustomCrops.plugin);
|
||||||
|
|
||||||
loadMode();
|
loadMode();
|
||||||
loadSeason();
|
loadSeason();
|
||||||
loadPacket();
|
loadPacket();
|
||||||
@@ -408,7 +411,9 @@ public class CropManager extends Function {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
private ItemStack getLoot(String id) {
|
private ItemStack getLoot(String id) {
|
||||||
|
if (id == null) return null;
|
||||||
if (MiscUtils.isVanillaItem(id)) return new ItemStack(Material.valueOf(id));
|
if (MiscUtils.isVanillaItem(id)) return new ItemStack(Material.valueOf(id));
|
||||||
else return customInterface.getItemStack(id);
|
else return customInterface.getItemStack(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.bukkit.event.world.WorldUnloadEvent;
|
|||||||
public record WorldListener(CropManager cropManager) implements Listener {
|
public record WorldListener(CropManager cropManager) implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onWorldUnload(WorldLoadEvent event) {
|
public void onWorldLoad(WorldLoadEvent event) {
|
||||||
cropManager.onWorldLoad(event.getWorld());
|
cropManager.onWorldLoad(event.getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#Don't change
|
#Don't change
|
||||||
config-version: '13'
|
config-version: '14'
|
||||||
|
|
||||||
# lang: english / spanish / chinese
|
# lang: english / spanish / chinese
|
||||||
lang: english
|
lang: english
|
||||||
@@ -99,7 +99,7 @@ mechanics:
|
|||||||
# Season would not affect ripe crops(for better performance and friendly player's experience)
|
# Season would not affect ripe crops(for better performance and friendly player's experience)
|
||||||
season:
|
season:
|
||||||
enable: true
|
enable: true
|
||||||
# If you want all the worlds share the same season
|
# If you want all the worlds to share the same season
|
||||||
sync-seasons:
|
sync-seasons:
|
||||||
enable: false
|
enable: false
|
||||||
world: world
|
world: world
|
||||||
@@ -192,7 +192,7 @@ sounds:
|
|||||||
|
|
||||||
# Hologram information
|
# Hologram information
|
||||||
hologram:
|
hologram:
|
||||||
# Pot infomation
|
# Fertilizer infomation
|
||||||
fertilizer-info:
|
fertilizer-info:
|
||||||
enable: true
|
enable: true
|
||||||
y-offset: 0.8
|
y-offset: 0.8
|
||||||
@@ -233,6 +233,10 @@ season-broadcast:
|
|||||||
winter:
|
winter:
|
||||||
- '<#87CEFA>Winter is coming!'
|
- '<#87CEFA>Winter is coming!'
|
||||||
|
|
||||||
|
season-change-command:
|
||||||
|
enable: false
|
||||||
|
spring:
|
||||||
|
- 'say spring is coming!'
|
||||||
|
|
||||||
|
|
||||||
watering-can-lore:
|
watering-can-lore:
|
||||||
|
|||||||
Reference in New Issue
Block a user