9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-21 16:09:21 +00:00

3.0.3-hotfix3

This commit is contained in:
Xiao-MoMi
2023-04-21 14:55:05 +08:00
parent 06f003e213
commit a324df1576
6 changed files with 24 additions and 14 deletions

View File

@@ -374,18 +374,22 @@ public class PlatformManager extends Function {
}
Sprinkler sprinkler = plugin.getWorldDataManager().getSprinklerData(SimpleLocation.getByBukkitLocation(location));
if (sprinkler != null) {
WaterAmountHologram waterAmountHologram = sprinklerConfig.getSprinklerHologram();
if (waterAmountHologram != null) {
String content = waterAmountHologram.getContent(sprinkler.getWater(), sprinklerConfig.getStorage());
plugin.getHologramManager().showHologram(player,
location.clone().add(0.5, waterAmountHologram.getOffset(),0.5),
AdventureUtils.getComponentFromMiniMessage(content),
waterAmountHologram.getDuration() * 1000,
waterAmountHologram.getMode(),
waterAmountHologram.getTextDisplayMeta()
);
WaterAmountHologram waterAmountHologram = sprinklerConfig.getSprinklerHologram();
if (waterAmountHologram != null) {
String content;
if (sprinkler != null) {
content = waterAmountHologram.getContent(sprinkler.getWater(), sprinklerConfig.getStorage());
} else {
content = waterAmountHologram.getContent(0, sprinklerConfig.getStorage());
}
plugin.getHologramManager().showHologram(player,
location.clone().add(0.5, waterAmountHologram.getOffset(),0.5),
AdventureUtils.getComponentFromMiniMessage(content),
waterAmountHologram.getDuration() * 1000,
waterAmountHologram.getMode(),
waterAmountHologram.getTextDisplayMeta()
);
}
return true;
}

View File

@@ -49,6 +49,8 @@ public class MessageManager extends Function {
public static String setDate;
public static String worldNotExist;
public static String seasonNotExist;
public static String forceWork;
public static String forceConsume;
public MessageManager(CustomCrops plugin) {
this.plugin =plugin;
@@ -81,5 +83,7 @@ public class MessageManager extends Function {
setDate = config.getString("messages.set-date", "<white>Successfully set {world}'s date to {date}.");
worldNotExist = config.getString("messages.world-not-exist", "<white>World {world} does not exist.");
seasonNotExist = config.getString("messages.season-not-exist", "<white>Season {season} does not exist.");
forceWork = config.getString("messages.force-sprinkler-work", "<white>Forced {world}'s sprinklers to work.");
forceConsume = config.getString("messages.force-consume", "<white>Forced {world}'s pots to reduce water amount and the remaining use of fertilizers.");
}
}

View File

@@ -195,7 +195,7 @@ public class CCWorld extends Function {
scheduleConsumeTask();
}
}
else if (time > 1970 && time < 2030 && lastWorkDay != day) {
else if (time > 970 && time < 1030 && lastWorkDay != day) {
lastWorkDay = day;
if (ConfigManager.enableScheduleSystem) {
scheduleSprinklerWork();

View File

@@ -46,6 +46,7 @@ public class ConsumeTaskCommand extends AbstractSubCommand {
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.worldNotExist.replace("{world}", args.get(0)));
return true;
}
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.forceConsume.replace("{world}", args.get(0)));
CustomCrops.getInstance().getScheduler().runTaskAsync(() -> {
CCWorld ccworld = CustomCrops.getInstance().getWorldDataManager().getWorld(args.get(0));
if (ccworld != null) {

View File

@@ -46,6 +46,7 @@ public class SprinklerWorkCommand extends AbstractSubCommand {
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.worldNotExist.replace("{world}", args.get(0)));
return true;
}
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.forceWork.replace("{world}", args.get(0)));
CustomCrops.getInstance().getScheduler().runTaskAsync(() -> {
CCWorld ccworld = CustomCrops.getInstance().getWorldDataManager().getWorld(args.get(0));
if (ccworld != null) {

View File

@@ -20,5 +20,5 @@ messages:
set-date: "<white>Successfully set {world}'s date to {date}."
world-not-exist: '<white>World {world} does not exist.'
season-not-exist: '<white>Season {season} does not exist.'
force-sprinkler-work: "<white>Forced {world}'s sprinklers to work"
force-consume: "<white>Forced {world}'s pots to reduce water amount and the remaining use of fertilizers"
force-sprinkler-work: "<white>Forced {world}'s sprinklers to start working."
force-consume: "<white>Forced {world}'s pots to reduce water amount and the remaining use of fertilizers."