mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-23 08:59:28 +00:00
fix bugs
This commit is contained in:
@@ -25,7 +25,7 @@ public record WaterBar(String left, String empty, String full, String right) {
|
|||||||
|
|
||||||
public String getWaterBar(int current, int max) {
|
public String getWaterBar(int current, int max) {
|
||||||
return left +
|
return left +
|
||||||
String.valueOf(full).repeat(current) +
|
String.valueOf(full).repeat(Math.min(current, max)) +
|
||||||
String.valueOf(empty).repeat(Math.max(max - current, 0)) +
|
String.valueOf(empty).repeat(Math.max(max - current, 0)) +
|
||||||
right;
|
right;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class State {
|
|||||||
setArg("{x}", String.valueOf(location.getBlockX()));
|
setArg("{x}", String.valueOf(location.getBlockX()));
|
||||||
setArg("{y}", String.valueOf(location.getBlockY()));
|
setArg("{y}", String.valueOf(location.getBlockY()));
|
||||||
setArg("{z}", String.valueOf(location.getBlockZ()));
|
setArg("{z}", String.valueOf(location.getBlockZ()));
|
||||||
|
setArg("{world}", location.getWorld().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ plugins {
|
|||||||
allprojects {
|
allprojects {
|
||||||
|
|
||||||
project.group = "net.momirealms"
|
project.group = "net.momirealms"
|
||||||
project.version = "3.4.0.0"
|
project.version = "3.4.0.1"
|
||||||
|
|
||||||
apply<JavaPlugin>()
|
apply<JavaPlugin>()
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public interface CustomProvider {
|
|||||||
|
|
||||||
default void removeAnythingAt(Location location) {
|
default void removeAnythingAt(Location location) {
|
||||||
if (!removeBlock(location)) {
|
if (!removeBlock(location)) {
|
||||||
Collection<Entity> entities = location.getWorld().getNearbyEntities(location.toCenterLocation(), 0.5,0.5,0.5);
|
Collection<Entity> entities = location.getWorld().getNearbyEntities(location.toCenterLocation(), 0.5,0.51,0.5);
|
||||||
entities.removeIf(entity -> {
|
entities.removeIf(entity -> {
|
||||||
EntityType type = entity.getType();
|
EntityType type = entity.getType();
|
||||||
return type != EntityType.ITEM_FRAME
|
return type != EntityType.ITEM_FRAME
|
||||||
|
|||||||
@@ -2009,11 +2009,11 @@ public class ItemManagerImpl implements ItemManager {
|
|||||||
SimpleLocation simpleLocation = SimpleLocation.of(location);
|
SimpleLocation simpleLocation = SimpleLocation.of(location);
|
||||||
Optional<WorldPot> optionalPot = plugin.getWorldManager().getPotAt(simpleLocation);
|
Optional<WorldPot> optionalPot = plugin.getWorldManager().getPotAt(simpleLocation);
|
||||||
if (optionalPot.isEmpty()) {
|
if (optionalPot.isEmpty()) {
|
||||||
LogUtils.warn("Found a pot without data broken by " + state.getPlayer().getName() + " at " + simpleLocation);
|
plugin.debug("Found a pot without data broken by " + state.getPlayer().getName() + " at " + simpleLocation);
|
||||||
return FunctionResult.RETURN;
|
return FunctionResult.RETURN;
|
||||||
}
|
}
|
||||||
if (!optionalPot.get().getKey().equals(pot.getKey())) {
|
if (!optionalPot.get().getKey().equals(pot.getKey())) {
|
||||||
LogUtils.warn("Found a pot having inconsistent data broken by " + state.getPlayer().getName() + " at " + simpleLocation + ".");
|
plugin.debug("Found a pot having inconsistent data broken by " + state.getPlayer().getName() + " at " + simpleLocation + ".");
|
||||||
plugin.getWorldManager().removePotAt(simpleLocation);
|
plugin.getWorldManager().removePotAt(simpleLocation);
|
||||||
return FunctionResult.RETURN;
|
return FunctionResult.RETURN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import org.bukkit.entity.Item;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
@@ -79,7 +80,7 @@ public abstract class AbstractCustomListener implements Listener {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (ignoreCancelled = true)
|
@EventHandler (ignoreCancelled = true, priority = EventPriority.LOW)
|
||||||
public void onBreakBlock(BlockBreakEvent event) {
|
public void onBreakBlock(BlockBreakEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
this.itemManager.handlePlayerBreakBlock(
|
this.itemManager.handlePlayerBreakBlock(
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class OraxenListener extends AbstractCustomListener {
|
|||||||
public void onBreakFurniture(OraxenFurnitureBreakEvent event) {
|
public void onBreakFurniture(OraxenFurnitureBreakEvent event) {
|
||||||
super.onBreakFurniture(
|
super.onBreakFurniture(
|
||||||
event.getPlayer(),
|
event.getPlayer(),
|
||||||
event.getBlock().getLocation(),
|
event.getBaseEntity().getLocation().toBlockLocation(),
|
||||||
event.getMechanic().getItemID(),
|
event.getMechanic().getItemID(),
|
||||||
event
|
event
|
||||||
);
|
);
|
||||||
@@ -76,7 +76,7 @@ public class OraxenListener extends AbstractCustomListener {
|
|||||||
public void onInteractFurniture(OraxenFurnitureInteractEvent event) {
|
public void onInteractFurniture(OraxenFurnitureInteractEvent event) {
|
||||||
super.onInteractFurniture(
|
super.onInteractFurniture(
|
||||||
event.getPlayer(),
|
event.getPlayer(),
|
||||||
event.getBlock().getLocation(),
|
event.getBaseEntity().getLocation().toBlockLocation(),
|
||||||
event.getMechanic().getItemID(),
|
event.getMechanic().getItemID(),
|
||||||
event.getBaseEntity(),
|
event.getBaseEntity(),
|
||||||
event
|
event
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ import io.th0rgal.oraxen.api.OraxenBlocks;
|
|||||||
import io.th0rgal.oraxen.api.OraxenFurniture;
|
import io.th0rgal.oraxen.api.OraxenFurniture;
|
||||||
import io.th0rgal.oraxen.api.OraxenItems;
|
import io.th0rgal.oraxen.api.OraxenItems;
|
||||||
import io.th0rgal.oraxen.items.ItemBuilder;
|
import io.th0rgal.oraxen.items.ItemBuilder;
|
||||||
|
import io.th0rgal.oraxen.mechanics.Mechanic;
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic;
|
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic;
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.noteblock.NoteBlockMechanic;
|
import io.th0rgal.oraxen.mechanics.provided.gameplay.noteblock.NoteBlockMechanic;
|
||||||
|
import io.th0rgal.oraxen.mechanics.provided.gameplay.stringblock.StringBlockMechanic;
|
||||||
import net.momirealms.customcrops.mechanic.item.CustomProvider;
|
import net.momirealms.customcrops.mechanic.item.CustomProvider;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -65,7 +67,7 @@ public class OraxenProvider implements CustomProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockID(Block block) {
|
public String getBlockID(Block block) {
|
||||||
NoteBlockMechanic mechanic = OraxenBlocks.getNoteBlockMechanic(block);
|
Mechanic mechanic = OraxenBlocks.getOraxenBlock(block.getLocation());
|
||||||
if (mechanic == null) {
|
if (mechanic == null) {
|
||||||
return block.getType().name();
|
return block.getType().name();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,11 @@ public class MemoryCrop extends AbstractCustomCropsBlock implements WorldCrop {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPoint(int point) {
|
public void setPoint(int point) {
|
||||||
|
if (point < 0) return;
|
||||||
|
int max = getConfig().getMaxPoints();
|
||||||
|
if (point > max) {
|
||||||
|
point = max;
|
||||||
|
}
|
||||||
setData("point", new IntTag("point", point));
|
setData("point", new IntTag("point", point));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ public class MemoryPot extends AbstractCustomCropsBlock implements WorldPot {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWater(int water) {
|
public void setWater(int water) {
|
||||||
|
if (water < 0) return;
|
||||||
|
int max = getConfig().getStorage();
|
||||||
|
if (water > max) {
|
||||||
|
water = max;
|
||||||
|
}
|
||||||
setData("water", new IntTag("water", water));
|
setData("water", new IntTag("water", water));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ public class MemorySprinkler extends AbstractCustomCropsBlock implements WorldSp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWater(int water) {
|
public void setWater(int water) {
|
||||||
|
if (water < 0) return;
|
||||||
|
int max = getConfig().getStorage();
|
||||||
|
if (water > max) {
|
||||||
|
water = max;
|
||||||
|
}
|
||||||
setData("water", new IntTag("water", water));
|
setData("water", new IntTag("water", water));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ tomato:
|
|||||||
- Spring
|
- Spring
|
||||||
- Autumn
|
- Autumn
|
||||||
not-met-actions:
|
not-met-actions:
|
||||||
message_action:
|
actionbar_action:
|
||||||
type: message
|
type: message
|
||||||
value: "It's not a good season to plant tomato"
|
value: '<red><bold>[X] It''s not a good season to plant tomato'
|
||||||
# Event settings
|
# Event settings
|
||||||
events:
|
events:
|
||||||
plant:
|
plant:
|
||||||
|
|||||||
@@ -22,5 +22,4 @@ softdepend:
|
|||||||
- EcoSkills
|
- EcoSkills
|
||||||
- Jobs
|
- Jobs
|
||||||
- RealisticSeasons
|
- RealisticSeasons
|
||||||
- AdvancedSeasons
|
- AdvancedSeasons
|
||||||
- SlimeWorldManager
|
|
||||||
Reference in New Issue
Block a user