Runtime.getRuntime().addShutdownHook(new Thread(() -> { logger.info("Caught shutdown signal, saving"); gameEngine.pauseAllShards(); gameEngine.commitToDisk(); logger.info("Saving complete"); }));
print('Does pasted code work?')
print('Does markdown codeblock work?')
for (Feature feature : features) { String id = feature.getUniqueId(); Set<Feature> featuresForId = featuresById.get(id); if (featuresForId == null) { Set<Feature> featureList = new HashSet<>(1); featureList.add(feature); featuresById.put(id, featureList); } else { featuresForId.add(feature); } }
Runtime.getRuntime().addShutdownHook(new Thread(() -> { logger.info("Caught shutdown signal, saving"); gameEngine.pauseAllShards(); gameEngine.commitToDisk(); logger.info("Saving complete"); }));
EDIT: it automatically added an indentation.print('Does pasted code work?')
EDIT: Markdown works perfectly!print('Does markdown codeblock work?')
for (Feature feature : features) { String id = feature.getUniqueId(); Set<Feature> featuresForId = featuresById.get(id); if (featuresForId == null) { Set<Feature> featureList = new HashSet<>(1); featureList.add(feature); featuresById.put(id, featureList); } else { featuresForId.add(feature); } }