mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-26 18:39:17 +00:00
3.0.3
This commit is contained in:
@@ -196,6 +196,10 @@ public class PlatformManager extends Function {
|
||||
|
||||
void onInteractSomething(Player player, Location location, String id, @Nullable BlockFace blockFace, Cancellable event) {
|
||||
|
||||
if (!plugin.getWorldDataManager().isWorldAllowed(location.getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack item_in_hand = player.getInventory().getItemInMainHand();
|
||||
String item_in_hand_id = plugin.getPlatformInterface().getItemStackID(item_in_hand);
|
||||
|
||||
|
||||
@@ -33,8 +33,7 @@ public enum CCSeason {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,10 @@ public class SeasonManager extends Function {
|
||||
}
|
||||
|
||||
public CCSeason getSeason(String world) {
|
||||
if (ConfigManager.syncSeason) world = ConfigManager.referenceWorld;
|
||||
SeasonData seasonData = seasonMap.get(world);
|
||||
if (seasonData == null) return CCSeason.UNKNOWN;
|
||||
SeasonData seasonData = seasonMap.get(ConfigManager.syncSeason ? ConfigManager.referenceWorld : world);
|
||||
if (seasonData == null) {
|
||||
return CCSeason.UNKNOWN;
|
||||
}
|
||||
return seasonData.getSeason();
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ public class SeasonManager extends Function {
|
||||
}
|
||||
|
||||
public int getDate(String world) {
|
||||
SeasonData seasonData = seasonMap.get(world);
|
||||
SeasonData seasonData = seasonMap.get(ConfigManager.syncSeason ? ConfigManager.referenceWorld : world);
|
||||
if (seasonData == null) return -1;
|
||||
return seasonData.getDate();
|
||||
}
|
||||
|
||||
@@ -116,8 +116,13 @@ public class CCWorld extends Function {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
YamlConfiguration dataFile = ConfigUtils.readData(new File(CustomCrops.getInstance().getDataFolder().getParentFile().getParentFile(), ConfigManager.worldFolderPath + worldName + File.separator + "customcrops" + File.separator + "data.yml"));
|
||||
if (ConfigManager.enableSeason && !ConfigManager.rsHook) {
|
||||
YamlConfiguration dataFile;
|
||||
if (ConfigManager.worldFolderPath.equals("")) {
|
||||
dataFile = ConfigUtils.readData(new File(CustomCrops.getInstance().getDataFolder().getParentFile().getParentFile(), worldName + File.separator + "customcrops" + File.separator + "data.yml"));
|
||||
} else {
|
||||
dataFile = ConfigUtils.readData(new File(ConfigManager.worldFolderPath + worldName + File.separator + "customcrops" + File.separator + "data.yml"));
|
||||
}
|
||||
if (ConfigManager.enableSeason) {
|
||||
SeasonData seasonData;
|
||||
if (dataFile.contains("season") && dataFile.contains("date")) {
|
||||
seasonData = new SeasonData(worldName, CCSeason.valueOf(dataFile.getString("season")), dataFile.getInt("date"));
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SetSeasonCommand extends AbstractSubCommand {
|
||||
}
|
||||
seasonData.changeSeason(ccSeason);
|
||||
CustomCrops.getInstance().getSeasonManager().loadSeasonData(seasonData);
|
||||
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.setSeason.replace("{world}", args.get(0)).replace("{season}", ccSeason.toString()));
|
||||
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.setSeason.replace("{world}", args.get(0)).replace("{season}", ccSeason.getDisplay()));
|
||||
return true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.seasonNotExist.replace("{season}", args.get(1)));
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SeasonPapi extends PlaceholderExpansion {
|
||||
case "season" -> {
|
||||
Player online_player = player.getPlayer();
|
||||
if (online_player == null) return null;
|
||||
return plugin.getIntegrationManager().getSeasonInterface().getSeason(player.getPlayer().getWorld().getName()).toString();
|
||||
return plugin.getIntegrationManager().getSeasonInterface().getSeason(player.getPlayer().getWorld().getName()).getDisplay();
|
||||
}
|
||||
case "date" -> {
|
||||
Player online_player = player.getPlayer();
|
||||
@@ -73,7 +73,7 @@ public class SeasonPapi extends PlaceholderExpansion {
|
||||
case 2 -> {
|
||||
switch (split[0]) {
|
||||
case "season" -> {
|
||||
return plugin.getIntegrationManager().getSeasonInterface().getSeason(split[1]).toString();
|
||||
return plugin.getIntegrationManager().getSeasonInterface().getSeason(split[1]).getDisplay();
|
||||
}
|
||||
case "date" -> {
|
||||
return String.valueOf(plugin.getIntegrationManager().getSeasonInterface().getDate(split[1]));
|
||||
|
||||
Reference in New Issue
Block a user