9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-25 18:09:28 +00:00
This commit is contained in:
XiaoMoMi
2024-06-20 00:15:19 +08:00
parent f7f2b37c54
commit 7e7ce62138
7 changed files with 16 additions and 10 deletions

View File

@@ -47,8 +47,8 @@ public enum DependencyRepository {
@Override
protected URLConnection openConnection(Dependency dependency) throws IOException {
URLConnection connection = super.openConnection(dependency);
connection.setConnectTimeout((int) TimeUnit.SECONDS.toMillis(5));
connection.setReadTimeout((int) TimeUnit.SECONDS.toMillis(5));
connection.setConnectTimeout(5000);
connection.setReadTimeout(5000);
return connection;
}
},

View File

@@ -60,6 +60,8 @@ import net.momirealms.customcrops.mechanic.world.block.MemoryCrop;
import net.momirealms.customcrops.util.ClassUtils;
import net.momirealms.customcrops.util.ConfigUtils;
import net.momirealms.customcrops.util.ItemUtils;
import net.momirealms.sparrow.heart.SparrowHeart;
import net.momirealms.sparrow.heart.argument.HandSlot;
import org.bukkit.*;
import org.bukkit.block.BlockFace;
import org.bukkit.configuration.ConfigurationSection;
@@ -434,10 +436,7 @@ public class ActionManagerImpl implements ActionManager {
return state -> {
if (Math.random() > chance) return;
if (state.getPlayer() == null) return;
PacketContainer animationPacket = new PacketContainer(PacketType.Play.Server.ANIMATION);
animationPacket.getIntegers().write(0, state.getPlayer().getEntityId());
animationPacket.getIntegers().write(1, arg ? 0 : 3);
PacketManager.getInstance().send(state.getPlayer(), animationPacket);
SparrowHeart.getInstance().swingHand(state.getPlayer(), arg ? HandSlot.MAIN : HandSlot.OFF);
};
});
}

View File

@@ -243,6 +243,10 @@ public class BukkitWorldAdaptor extends AbstractWorldAdaptor {
@Override
public void saveChunkToCachedRegion(CustomCropsChunk customCropsChunk) {
CustomCropsRegion customCropsRegion = customCropsChunk.getCustomCropsRegion();
if (customCropsRegion == null) {
LogUtils.severe(customCropsChunk.getChunkPos().toString() + " unloaded before chunk saving");
return;
}
SerializableChunk serializableChunk = toSerializableChunk((CChunk) customCropsChunk);
if (serializableChunk.canPrune()) {
customCropsRegion.removeChunk(customCropsChunk.getChunkPos());