mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-03 18:43:43 +01:00 
			
		
		
		
	Handle corrupt chunklets by making a new one and not throw stacktrace
This commit is contained in:
		@@ -7,6 +7,7 @@ import java.io.FileOutputStream;
 | 
				
			|||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.io.ObjectInputStream;
 | 
					import java.io.ObjectInputStream;
 | 
				
			||||||
import java.io.ObjectOutputStream;
 | 
					import java.io.ObjectOutputStream;
 | 
				
			||||||
 | 
					import java.io.StreamCorruptedException;
 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.Bukkit;
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
@@ -231,6 +232,10 @@ public class HashChunkletManager implements ChunkletManager {
 | 
				
			|||||||
                // EOF should only happen on Chunklets that somehow have been corrupted.
 | 
					                // EOF should only happen on Chunklets that somehow have been corrupted.
 | 
				
			||||||
                mcMMO.p.getLogger().severe("Chunklet data at " + location.toString() + " could not be read, data in this area will be lost.");
 | 
					                mcMMO.p.getLogger().severe("Chunklet data at " + location.toString() + " could not be read, data in this area will be lost.");
 | 
				
			||||||
                return ChunkletStoreFactory.getChunkletStore();
 | 
					                return ChunkletStoreFactory.getChunkletStore();
 | 
				
			||||||
 | 
					            } else if (ex instanceof StreamCorruptedException) {
 | 
				
			||||||
 | 
					                // StreamCorrupted happens when the chunklet is no good.
 | 
				
			||||||
 | 
					                mcMMO.p.getLogger().severe("Chunklet data at " + location.toString() + " is corrupted, data in this area will be lost.");
 | 
				
			||||||
 | 
					                return ChunkletStoreFactory.getChunkletStore();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            ex.printStackTrace();
 | 
					            ex.printStackTrace();
 | 
				
			||||||
        } catch (ClassNotFoundException ex) {
 | 
					        } catch (ClassNotFoundException ex) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user