mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2026-01-03 22:26:22 +00:00
custom placeholder register
This commit is contained in:
@@ -4,7 +4,10 @@ import net.momirealms.customcrops.api.CustomCropsPlugin;
|
|||||||
import net.momirealms.customcrops.api.manager.PlaceholderManager;
|
import net.momirealms.customcrops.api.manager.PlaceholderManager;
|
||||||
import net.momirealms.customcrops.compatibility.papi.CCPapi;
|
import net.momirealms.customcrops.compatibility.papi.CCPapi;
|
||||||
import net.momirealms.customcrops.compatibility.papi.ParseUtils;
|
import net.momirealms.customcrops.compatibility.papi.ParseUtils;
|
||||||
|
import net.momirealms.customcrops.utils.ConfigUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -36,6 +39,7 @@ public class PlaceholderManagerImpl extends PlaceholderManager {
|
|||||||
if (ccPapi != null) {
|
if (ccPapi != null) {
|
||||||
ccPapi.register();
|
ccPapi.register();
|
||||||
}
|
}
|
||||||
|
this.loadCustomPlaceholders();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -43,6 +47,17 @@ public class PlaceholderManagerImpl extends PlaceholderManager {
|
|||||||
if (ccPapi != null) {
|
if (ccPapi != null) {
|
||||||
ccPapi.unregister();
|
ccPapi.unregister();
|
||||||
}
|
}
|
||||||
|
this.customPlaceholderMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadCustomPlaceholders() {
|
||||||
|
YamlConfiguration config = ConfigUtils.getConfig("config.yml");
|
||||||
|
ConfigurationSection section = config.getConfigurationSection("other-settings.placeholder-register");
|
||||||
|
if (section != null) {
|
||||||
|
for (Map.Entry<String, Object> entry : section.getValues(false).entrySet()) {
|
||||||
|
this.customPlaceholderMap.put(entry.getKey(), (String) entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -311,6 +311,12 @@ public class ItemManagerImpl implements ItemManager {
|
|||||||
LogUtils.warn("Item " + sprinkler.get3DItemID() + " has more than one sprinkler config.");
|
LogUtils.warn("Item " + sprinkler.get3DItemID() + " has more than one sprinkler config.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (sprinkler.get3DItemWithWater() != null) {
|
||||||
|
if (this.threeDItem2SprinklerMap.put(sprinkler.get3DItemWithWater(), sprinkler) != null) {
|
||||||
|
LogUtils.warn("Item " + sprinkler.get3DItemWithWater() + " has more than one sprinkler config.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ other-settings:
|
|||||||
# Disable this would improve performance
|
# Disable this would improve performance
|
||||||
legacy-color-code-support: true
|
legacy-color-code-support: true
|
||||||
|
|
||||||
|
# Requires PlaceholderAPI to work
|
||||||
|
placeholder-register:
|
||||||
|
'{skill-level}': '%levelplugin_farming%'
|
||||||
|
|
||||||
# Thread pool settings
|
# Thread pool settings
|
||||||
thread-pool-settings:
|
thread-pool-settings:
|
||||||
corePoolSize: 10
|
corePoolSize: 10
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ tomato:
|
|||||||
# But you can set some special crops' loots here
|
# But you can set some special crops' loots here
|
||||||
99:
|
99:
|
||||||
model: {0}tomato_stage_golden
|
model: {0}tomato_stage_golden
|
||||||
|
# You can set interact/break requirements for each stage
|
||||||
requirements:
|
requirements:
|
||||||
break:
|
break:
|
||||||
requirement_1:
|
requirement_1:
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ sprinkler_1:
|
|||||||
# The amount of water to add
|
# The amount of water to add
|
||||||
amount: 3
|
amount: 3
|
||||||
method_2:
|
method_2:
|
||||||
item: WATER
|
item: POTION
|
||||||
return: GLASS_BOTTLE
|
return: GLASS_BOTTLE
|
||||||
amount: 1
|
amount: 1
|
||||||
# Water bar image settings
|
# Water bar image settings
|
||||||
@@ -119,7 +119,7 @@ sprinkler_2:
|
|||||||
return: BUCKET
|
return: BUCKET
|
||||||
amount: 3
|
amount: 3
|
||||||
method_2:
|
method_2:
|
||||||
item: WATER
|
item: POTION
|
||||||
return: GLASS_BOTTLE
|
return: GLASS_BOTTLE
|
||||||
amount: 1
|
amount: 1
|
||||||
water-bar:
|
water-bar:
|
||||||
@@ -207,7 +207,7 @@ sprinkler_3:
|
|||||||
return: BUCKET
|
return: BUCKET
|
||||||
amount: 3
|
amount: 3
|
||||||
method_2:
|
method_2:
|
||||||
item: WATER
|
item: POTION
|
||||||
return: GLASS_BOTTLE
|
return: GLASS_BOTTLE
|
||||||
amount: 1
|
amount: 1
|
||||||
water-bar:
|
water-bar:
|
||||||
|
|||||||
Reference in New Issue
Block a user