mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-22 00:19:24 +00:00
1.7-7
This commit is contained in:
@@ -38,6 +38,7 @@ import net.momirealms.customcrops.integrations.season.RealisticSeasonsHook;
|
||||
import net.momirealms.customcrops.integrations.season.SeasonInterface;
|
||||
import net.momirealms.customcrops.managers.listener.ItemSpawnListener;
|
||||
import net.momirealms.customcrops.managers.listener.WorldListener;
|
||||
import net.momirealms.customcrops.managers.timer.CrowTask;
|
||||
import net.momirealms.customcrops.managers.timer.TimerTask;
|
||||
import net.momirealms.customcrops.objects.OtherLoot;
|
||||
import net.momirealms.customcrops.objects.QualityLoot;
|
||||
@@ -53,6 +54,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -194,6 +196,12 @@ public class CropManager extends Function {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasScarecrow(Location location) {
|
||||
CustomWorld customWorld = customWorlds.get(location.getWorld());
|
||||
if (customWorld == null) return true;
|
||||
return customWorld.hasScarecrow(location);
|
||||
}
|
||||
|
||||
public CustomInterface getCustomInterface() {
|
||||
return customInterface;
|
||||
}
|
||||
@@ -324,6 +332,36 @@ public class CropManager extends Function {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean crowJudge(Location location, ItemFrame itemFrame) {
|
||||
if (Math.random() < MainConfig.crowChance && !hasScarecrow(location)) {
|
||||
for (Player player : location.getNearbyPlayers(48)) {
|
||||
CrowTask crowTask = new CrowTask(player, location.clone().add(0.4,0,0.4), getArmorStandUtil());
|
||||
crowTask.runTaskTimerAsynchronously(CustomCrops.plugin, 1, 1);
|
||||
}
|
||||
Bukkit.getScheduler().runTaskLater(CustomCrops.plugin, () -> {
|
||||
customInterface.removeFurniture(itemFrame);
|
||||
}, 125);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean crowJudge(Location location) {
|
||||
if (Math.random() < MainConfig.crowChance && !hasScarecrow(location)) {
|
||||
Bukkit.getScheduler().runTask(CustomCrops.plugin, () -> {
|
||||
for (Player player : location.getNearbyPlayers(48)) {
|
||||
CrowTask crowTask = new CrowTask(player, location.clone().add(0.4,0,0.4), getArmorStandUtil());
|
||||
crowTask.runTaskTimerAsynchronously(CustomCrops.plugin, 1, 1);
|
||||
}
|
||||
});
|
||||
Bukkit.getScheduler().runTaskLater(CustomCrops.plugin, () -> {
|
||||
customInterface.removeBlock(location);
|
||||
}, 125);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ArmorStandUtil getArmorStandUtil() {
|
||||
return armorStandUtil;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user