otterlib 0.2 changes

This commit is contained in:
Oth3r 2025-06-16 15:07:37 -05:00
commit c9cc006245
5 changed files with 9 additions and 16 deletions

View file

@ -99,8 +99,8 @@ public class LangReader {
Reader defaultReader = new InputStreamReader(getInputStream(true), StandardCharsets.UTF_8); Reader defaultReader = new InputStreamReader(getInputStream(true), StandardCharsets.UTF_8);
defaultLangMap.putAll(new Gson().fromJson(defaultReader, tToken)); defaultLangMap.putAll(new Gson().fromJson(defaultReader, tToken));
} catch (Exception e) { } catch (Exception e) {
Data.LOGGER.info("ERROR WITH LANGUAGE FILE - PLEASE REPORT WITH THE ERROR LOG"); Data.LOGGER.error("ERROR WITH LANGUAGE FILE - PLEASE REPORT WITH THE ERROR LOG");
Data.LOGGER.info(e.getMessage()); Data.LOGGER.error(e.getMessage());
} }
} }

View file

@ -1,7 +1,6 @@
package one.oth3r.sit.file; package one.oth3r.sit.file;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
@ -264,13 +263,8 @@ public class ServerConfig implements CustomFile<ServerConfig> {
this.interactionBlocks = newFile.interactionBlocks.stream().map(CustomBlock::new).collect(Collectors.toCollection(ArrayList::new)); this.interactionBlocks = newFile.interactionBlocks.stream().map(CustomBlock::new).collect(Collectors.toCollection(ArrayList::new));
} }
/**
* updates the file based on the version number of the current instance
*
* @param json
*/
@Override @Override
public void update(JsonElement json) { public void updateInstance() {
/// update to 2.1, just a new list, nothing to change /// update to 2.1, just a new list, nothing to change
/// update to 2.2, new settings, no changes /// update to 2.2, new settings, no changes
if (version >= 2.0 && version <= 2.1) { if (version >= 2.0 && version <= 2.1) {
@ -341,7 +335,7 @@ public class ServerConfig implements CustomFile<ServerConfig> {
loadVersion(properties,Double.parseDouble(ver)); loadVersion(properties,Double.parseDouble(ver));
} catch (Exception e) { } catch (Exception e) {
Data.LOGGER.error("Error loading legacy config file: {}", e.getMessage()); Data.LOGGER.error("Error loading legacy config file: %s", e.getMessage());
} }
// delete the old file // delete the old file
@ -503,7 +497,7 @@ public class ServerConfig implements CustomFile<ServerConfig> {
serverConfig.save(); serverConfig.save();
sittingConfig.save(); sittingConfig.save();
} catch (Exception e) { } catch (Exception e) {
Data.LOGGER.error("Error loading legacy config: {}", e.getMessage()); Data.LOGGER.error("Error loading legacy config: %s", e.getMessage());
} }
} }
} }

View file

@ -101,7 +101,7 @@ public class SittingConfig implements CustomFile<SittingConfig> {
} }
@Override @Override
public void update(JsonElement jsonElement) { public void updateInstance() {
} }

View file

@ -4,14 +4,13 @@ import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.entity.decoration.DisplayEntity; import net.minecraft.entity.decoration.DisplayEntity;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import org.slf4j.Logger; import one.oth3r.otterlib.base.OtterLogger;
import org.slf4j.LoggerFactory;
import java.util.HashMap; import java.util.HashMap;
public class Data { public class Data {
public static final String MOD_ID = "sit-oth3r"; public static final String MOD_ID = "sit-oth3r";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); public static final OtterLogger LOGGER = new OtterLogger(MOD_ID);
public static final String CONFIG_DIR = FabricLoader.getInstance().getConfigDir().toFile()+"/sit!/"; public static final String CONFIG_DIR = FabricLoader.getInstance().getConfigDir().toFile()+"/sit!/";

View file

@ -192,7 +192,7 @@ public class Events {
ParseResults<ServerCommandSource> parse = dispatcher.parse("sit", player.getCommandSource()); ParseResults<ServerCommandSource> parse = dispatcher.parse("sit", player.getCommandSource());
dispatcher.execute(parse); dispatcher.execute(parse);
} catch (CommandSyntaxException e) { } catch (CommandSyntaxException e) {
Data.LOGGER.error("Error executing sit command for player {}", player.getName().getString()); Data.LOGGER.error("Error executing sit command for player %s", player.getName().getString());
} }
} }