Skip to content

Commit

Permalink
Merge branch 'develop' into 'main'
Browse files Browse the repository at this point in the history
Develop

See merge request Griefed/ServerPackCreator!630
  • Loading branch information
Griefed committed Jan 9, 2025
2 parents f45fd91 + 9673eff commit 263a8fc
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ class ApiProperties(propertiesFile: File = File("serverpackcreator.properties"))
"combat_music-", //https://www.curseforge.com/minecraft/mc-mods/combat-music
"connectedness-", //https://www.curseforge.com/minecraft/mc-mods/connectedness
"controllable-", //https://www.curseforge.com/minecraft/mc-mods/controllable
"crash_assistant-", //https://www.curseforge.com/minecraft/mc-mods/crash-assistant
"cullleaves-", //https://www.curseforge.com/minecraft/mc-mods/cull-leaves
"cullparticles-", //https://www.curseforge.com/minecraft/mc-mods/cull-particles
"custom-crosshair-mod-", //https://www.curseforge.com/minecraft/mc-mods/custom-crosshair-mod
Expand Down Expand Up @@ -630,8 +631,7 @@ class ApiProperties(propertiesFile: File = File("serverpackcreator.properties"))
@Suppress("MemberVisibilityCanBePrivate")
val trueFalseRegex = "^(true|false)$".toRegex()

@Suppress("MemberVisibilityCanBePrivate")
val alphaBetaRegex = "^(.*alpha.*|.*beta.*)$".toRegex()
val preReleaseRegex = ".*(alpha|beta|dev).*".toRegex()

@Suppress("MemberVisibilityCanBePrivate")
val serverPacksRegex = "^(?:\\./)?server-packs$".toRegex()
Expand Down Expand Up @@ -760,7 +760,7 @@ class ApiProperties(propertiesFile: File = File("serverpackcreator.properties"))

val preRelease: Boolean
get() {
return apiVersion.matches(alphaBetaRegex)
return apiVersion.matches(preReleaseRegex)
}

val configVersion: String = if (preRelease || devBuild) {
Expand All @@ -769,14 +769,6 @@ class ApiProperties(propertiesFile: File = File("serverpackcreator.properties"))
"4"
}

/**
* Only the first call to this property will return true if this is the first time ServerPackCreator is being run
* on a given host. Any subsequent call will return false. Handle with care!
*
* @author Griefed
*/
val firstRun: Boolean

var logLevel = "INFO"
get() {
field = acquireProperty(pLogLevel, "INFO").uppercase()
Expand Down Expand Up @@ -934,8 +926,8 @@ class ApiProperties(propertiesFile: File = File("serverpackcreator.properties"))
}
}

fun getPreference(pref: String) : Optional<String> {
return Optional.ofNullable(spcPreferences.get(pref, null))
fun getPreference(pref: String, def: String? = null) : Optional<String> {
return Optional.ofNullable(spcPreferences.get(pref, def))
}

fun storePreference(pref: String, value: String) {
Expand Down Expand Up @@ -2613,7 +2605,7 @@ class ApiProperties(propertiesFile: File = File("serverpackcreator.properties"))
}
}
if (fallbackUpdated) {
saveProperties(File(homeDirectory, serverPackCreatorProperties).absoluteFile)
saveProperties(serverPackCreatorPropertiesFile)
}
return fallbackUpdated
}
Expand Down Expand Up @@ -2770,8 +2762,6 @@ class ApiProperties(propertiesFile: File = File("serverpackcreator.properties"))
setLoggingLevel(logLevel)
}

firstRun = getBoolProperty("de.griefed.serverpackcreator.firstrun", true)
setBoolProperty("de.griefed.serverpackcreator.firstrun", false)
logsDirectory.create(createFileOrDir = true, asDirectory = true)
serverFilesDirectory.create(createFileOrDir = true, asDirectory = true)
propertiesDirectory.create(createFileOrDir = true, asDirectory = true)
Expand All @@ -2787,7 +2777,7 @@ class ApiProperties(propertiesFile: File = File("serverpackcreator.properties"))
minecraftServerManifestsDirectory.create(createFileOrDir = true, asDirectory = true)
installerCacheDirectory.create(createFileOrDir = true, asDirectory = true)
printSettings()
saveProperties(File(homeDirectory, serverPackCreatorProperties).absoluteFile)
saveProperties(serverPackCreatorPropertiesFile)
}

private fun setLoggingLevel(level: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class ApiWrapper private constructor(
val properties: File = File("serverpackcreator.properties"),
runSetup: Boolean = true
) {
val versionsRegex = ".*(alpha|beta|dev).*".toRegex()
val xmlJsonRegex = ".*\\.(xml|json)".toRegex()
var setupWasRun: Boolean = false

private val log by lazy { cachedLoggerOf(this.javaClass) }

/**
Expand All @@ -64,6 +64,18 @@ class ApiWrapper private constructor(
ApiProperties(properties)
}

/**
* Will return true if this is the first time ServerPackCreator is being run
* on a given host.
*/
@Volatile
var firstRun: Boolean = apiProperties.getPreference("de.griefed.serverpackcreator.firstrun","true").get().toBoolean()
get() {
apiProperties.storePreference("de.griefed.serverpackcreator.firstrun", "false")
return field
}
private set

/**
* This instances JSON-ObjectMapper used across ServerPackCreator with which this instance was
* initialized. By default, the ObjectMapper used across ServerPackCreator has the following
Expand Down Expand Up @@ -459,7 +471,7 @@ class ApiWrapper private constructor(

// Print system information to console and logs.
log.debug("Gathering system information to include in log to make debugging easier.")
if (apiProperties.apiVersion.matches(versionsRegex)) {
if (apiProperties.devBuild || apiProperties.preRelease) {
log.debug("Warning user about possible data loss.")
log.warn("################################################################")
log.warn("#.............ALPHA | BETA | DEV VERSION DETECTED..............#")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class ServerPackHandler(
} else {
File(getServerPackDestination(packConfig))
}
val existingManifest: File
val existingManifest: File = File(serverPack.absolutePath, "manifest.json")
val oldManifest: ServerPackManifest
var oldFile: File
val generationStopWatch = SimpleStopWatch().start()
Expand All @@ -318,19 +318,15 @@ class ServerPackHandler(
} catch (ignored: IOException) {
}

if (apiProperties.isUpdatingServerPacksEnabled) {
existingManifest = File(serverPack.absolutePath, "manifest.json")
if (existingManifest.isFile) {
oldManifest = utilities.jsonUtilities.objectMapper.readValue(existingManifest, ServerPackManifest::class.java)
for (entry in oldManifest.files) {
oldFile = File(serverPack.absolutePath, entry)
if (oldFile.isFile && !oldFile.isDirectory) {
log.debug("Deleting old file: ${oldFile.absolutePath}")
oldFile.deleteQuietly()
}
if (apiProperties.isUpdatingServerPacksEnabled && existingManifest.isFile) {
oldManifest = utilities.jsonUtilities.objectMapper.readValue(existingManifest, ServerPackManifest::class.java)
for (entry in oldManifest.files) {
oldFile = File(serverPack.absolutePath, entry)
//I know, .isFile is only true if it's really just a file...checking for !dir is still safer.
if (oldFile.isFile && !oldFile.isDirectory) {
log.debug("Deleting old file: ${oldFile.absolutePath}")
oldFile.deleteQuietly()
}
} else {
log.warn("Updating server packs enabled, but no manifest was found. Is this a new server pack?")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
de.griefed.serverpackcreator.versioncheck.prerelease=false
de.griefed.serverpackcreator.language=en_GB
de.griefed.serverpackcreator.configuration.fallback.updateurl=https://raw.githubusercontent.com/Griefed/ServerPackCreator/main/serverpackcreator-api/src/main/resources/serverpackcreator.properties
de.griefed.serverpackcreator.configuration.fallbackmodslist=3dskinlayers-,Absolutely-Not-A-Zoom-Mod-,AdvancedChat-,AdvancedChatCore-,AdvancedChatHUD-,AdvancedCompas-,Ambience,AmbientEnvironment-,AmbientSounds_,AnimaticaReforged-,AreYouBlind-,Armor Status HUD-,ArmorSoundTweak-,BH-Menu-,Batty's Coordinates PLUS Mod,BetterAdvancements-,BetterAnimationsCollection-,BetterModsButton-,BetterDarkMode-,BetterF3-,BetterFog-,BetterFoliage-,BetterPingDisplay-,BetterPlacement-,BetterTaskbar-,BetterThirdPerson,BetterTitleScreen-,Blur-,BorderlessWindow-,CTM-,Chat Ping ,ChunkAnimator-,Clear-Water-,ClientTweaks_,CompletionistsIndex-,Controller Support-,Controlling-,CraftPresence-,CullLessLeaves-,CustomCursorMod-,CustomMainMenu-,DefaultOptions_,DefaultSettings-,DeleteWorldsToTrash-,DetailArmorBar-,Ding-,DistantHorizons-,DripSounds-,Durability101-,DurabilityNotifier-,DynamicSurroundings-,DynamicSurroundingsHuds-,EasyLAN-,EffectsLeft-,EiraMoticons_,EnchantmentDescriptions-,EnhancedVisuals_,EquipmentCompare-,EuphoriaPatcher-,FPS-Monitor-,FabricCustomCursorMod-,FadingNightVision-,Fallingleaves-,FancySpawnEggs,FancyVideo-API-,farsight-,FirstPersonMod,FogTweaker-,ForgeCustomCursorMod-,FpsReducer-,FpsReducer2-,FullscreenWindowed-,GameMenuModOption-,HealthOverlay-,HeldItemTooltips-,HorseStatsMod-,ImmediatelyFast-,ImmediatelyFastReforged-,InventoryEssentials_,InventoryHud_,InventorySpam-,InventoryTweaks-,ItemBorders-,ItemLocks-,ItemPhysicLite_,ItemStitchingFix-,JBRA-Client-,JustEnoughCalculation-,JustEnoughEffects-,JustEnoughProfessions-,LeaveMyBarsAlone-,LLOverlayReloaded-,LOTRDRP-,LegendaryTooltips,LegendaryTooltips-,LightOverlay-,MinecraftCapes,MineMenu-,MoBends,ModernUI-,MouseTweaks-,MyServerIsCompatible-,Neat,Neat-,NekosEnchantedBooks-,NoAutoJump-,NoFog-,Notes-,NotifMod-,OldJavaWarning-,OptiFine,OptiFine_,OptiForge,OptiForge-,OverflowingBars-,PackMenu-,PackModeMenu-,PickUpNotifier-,Ping-,PingHUD-,PresenceFootsteps-,RPG-HUD-,ReAuth-,Reforgium-,ResourceLoader-,ResourcePackOrganizer,Ryoamiclights-,RyoamicLights-,ShoulderSurfing-,ShulkerTooltip-,SimpleDiscordRichPresence-,SimpleWorldTimer-,SoundFilters-,SpawnerFix-,StylishEffects-,TextruesRubidiumOptions-,TRansliterationLib-,TipTheScales-,Tips-,Toast Control-,Toast-Control-,ToastControl-,TravelersTitles-,VoidFog-,VR-Combat_,WindowedFullscreen-,WorldNameRandomizer-,YeetusExperimentus-,YungsMenuTweaks-,[1.12.2]DamageIndicatorsMod-,[1.12.2]bspkrscore-,antighost-,anviltooltipmod-,armorchroma-,armorpointspp-,auditory-,authme-,auto-reconnect-,autojoin-,autoreconnect-,axolotl-item-fix-,backtools-,bannerunlimited-,beenfo-,better-clouds-,better-recipe-book-,betterbiomeblend-,bhmenu-,blur-,borderless-mining-,cat_jam-,catalogue-,cfwinfo-,charmonium-,chat_heads-,cherishedworlds-,cirback-1.0-,classicbar-,clickadv-,clienttweaks-,combat_music-,connectedness-,controllable-,cullleaves-,cullparticles-,custom-crosshair-mod-,customdiscordrpc-,darkness-,dashloader-,defaultoptions-,desiredservers-,discordrpc-,drippyloadingscreen-,drippyloadingscreen_,durabilitytooltip-,dynamic-fps-,dynamic-music-,dynamiclights-,dynamiclightsreforged-,dynmus-,e4mc-,effective-,eggtab-,eguilib-,eiramoticons-,embeddium-,enchantment-lore-,entity-texture-features-,entityculling-,essential_,exhaustedstamina-,extremesoundmuffler-,fabricemotes-,fancymenu_,fancymenu_video_extension,fast-ip-ping-,firstperson-,flickerfix-,fm_audio_extension_,fabricmod_VoxelMap-,forgemod_VoxelMap-,freecam-,freelook-,galacticraft-rpc-,gamestagesviewer-,gpumemleakfix-,grid-,helium-,hiddenrecipebook_,hiddenrecipebook-,infinitemusic-,inventoryhud.,inventoryprofiles,invtweaks-,itemzoom,itlt-,jeed-,jehc-,jeiintegration_,jumpoverfences-,just-enough-harvestcraft-,justenoughbeacons-,justenoughdrags-,justzoom_,keymap-,keywizard-,lazurite-,lazydfu-,lib39-,light-overlay-,lightfallclient-,lightspeed-,loadmyresources_,lock_minecart_view-,lootbeams-,lwl-,macos-input-fixes-,magnesium_extras-,maptooltip-,massunbind,mcbindtype-,mcwifipnp-,medievalmusic-,memoryusagescreen-,mightyarchitect-,mindful-eating-,minetogether-,mobplusplus-,modcredits-,modernworldcreation_,modnametooltip-,modnametooltip_,moreoverlays-,mousewheelie-,movement-vision-,multihotbar-,music-duration-reducer-,musicdr-,neiRecipeHandlers-,ngrok-lan-expose-mod-,no_nv_flash-,nopotionshift_,notenoughanimations-,oculus-,ornaments-,overloadedarmorbar-,panorama-,paperdoll-,physics-mod-,phosphor-,preciseblockplacing-,radon-,realm-of-lost-souls-,rebind_narrator-,rebind-narrator-,rebindnarrator-,rebrand-,reforgium-,replanter-,rrls-,rubidium-,rubidium_extras-,screenshot-to-clipboard-,servercountryflags-,shutupexperimentalsettings-,shutupmodelloader-,signtools-,simple-rpc-,simpleautorun-,smartcursor-,smarthud-,smoothboot-,smoothfocus-,sodium-fabric-,sodiumoptionsapi-,sodiumdynamiclights-,sodiumoptionsmodcompat-,sounddeviceoptions-,soundreloader-,spoticraft-,skinlayers3d-forge,textrues_embeddium_options-,tconplanner-,timestamps-,tooltipscroller-,torchoptimizer-,torohealth-,totaldarkness,toughnessbar-,watermedia-,whats-that-slot-forge-,wisla-,xenon-,xlifeheartcolors-,yisthereautojump-
de.griefed.serverpackcreator.configuration.fallbackmodslist=3dskinlayers-,Absolutely-Not-A-Zoom-Mod-,AdvancedChat-,AdvancedChatCore-,AdvancedChatHUD-,AdvancedCompas-,Ambience,AmbientEnvironment-,AmbientSounds_,AnimaticaReforged-,AreYouBlind-,Armor Status HUD-,ArmorSoundTweak-,BH-Menu-,Batty's Coordinates PLUS Mod,BetterAdvancements-,BetterAnimationsCollection-,BetterModsButton-,BetterDarkMode-,BetterF3-,BetterFog-,BetterFoliage-,BetterPingDisplay-,BetterPlacement-,BetterTaskbar-,BetterThirdPerson,BetterTitleScreen-,Blur-,BorderlessWindow-,CTM-,Chat Ping ,ChunkAnimator-,Clear-Water-,ClientTweaks_,CompletionistsIndex-,Controller Support-,Controlling-,CraftPresence-,CullLessLeaves-,CustomCursorMod-,CustomMainMenu-,DefaultOptions_,DefaultSettings-,DeleteWorldsToTrash-,DetailArmorBar-,Ding-,DistantHorizons-,DripSounds-,Durability101-,DurabilityNotifier-,DynamicSurroundings-,DynamicSurroundingsHuds-,EasyLAN-,EffectsLeft-,EiraMoticons_,EnchantmentDescriptions-,EnhancedVisuals_,EquipmentCompare-,EuphoriaPatcher-,FPS-Monitor-,FabricCustomCursorMod-,FadingNightVision-,Fallingleaves-,FancySpawnEggs,FancyVideo-API-,farsight-,FirstPersonMod,FogTweaker-,ForgeCustomCursorMod-,FpsReducer-,FpsReducer2-,FullscreenWindowed-,GameMenuModOption-,HealthOverlay-,HeldItemTooltips-,HorseStatsMod-,ImmediatelyFast-,ImmediatelyFastReforged-,InventoryEssentials_,InventoryHud_,InventorySpam-,InventoryTweaks-,ItemBorders-,ItemLocks-,ItemPhysicLite_,ItemStitchingFix-,JBRA-Client-,JustEnoughCalculation-,JustEnoughEffects-,JustEnoughProfessions-,LeaveMyBarsAlone-,LLOverlayReloaded-,LOTRDRP-,LegendaryTooltips,LegendaryTooltips-,LightOverlay-,MinecraftCapes,MineMenu-,MoBends,ModernUI-,MouseTweaks-,MyServerIsCompatible-,Neat,Neat-,NekosEnchantedBooks-,NoAutoJump-,NoFog-,Notes-,NotifMod-,OldJavaWarning-,OptiFine,OptiFine_,OptiForge,OptiForge-,OverflowingBars-,PackMenu-,PackModeMenu-,PickUpNotifier-,Ping-,PingHUD-,PresenceFootsteps-,RPG-HUD-,ReAuth-,Reforgium-,ResourceLoader-,ResourcePackOrganizer,Ryoamiclights-,RyoamicLights-,ShoulderSurfing-,ShulkerTooltip-,SimpleDiscordRichPresence-,SimpleWorldTimer-,SoundFilters-,SpawnerFix-,StylishEffects-,TextruesRubidiumOptions-,TRansliterationLib-,TipTheScales-,Tips-,Toast Control-,Toast-Control-,ToastControl-,TravelersTitles-,VoidFog-,VR-Combat_,WindowedFullscreen-,WorldNameRandomizer-,YeetusExperimentus-,YungsMenuTweaks-,[1.12.2]DamageIndicatorsMod-,[1.12.2]bspkrscore-,antighost-,anviltooltipmod-,armorchroma-,armorpointspp-,auditory-,authme-,auto-reconnect-,autojoin-,autoreconnect-,axolotl-item-fix-,backtools-,bannerunlimited-,beenfo-,better-clouds-,better-recipe-book-,betterbiomeblend-,bhmenu-,blur-,borderless-mining-,cat_jam-,catalogue-,cfwinfo-,charmonium-,chat_heads-,cherishedworlds-,cirback-1.0-,classicbar-,clickadv-,clienttweaks-,combat_music-,connectedness-,controllable-,crash_assistant-,cullleaves-,cullparticles-,custom-crosshair-mod-,customdiscordrpc-,darkness-,dashloader-,defaultoptions-,desiredservers-,discordrpc-,drippyloadingscreen-,drippyloadingscreen_,durabilitytooltip-,dynamic-fps-,dynamic-music-,dynamiclights-,dynamiclightsreforged-,dynmus-,e4mc-,effective-,eggtab-,eguilib-,eiramoticons-,embeddium-,enchantment-lore-,entity-texture-features-,entityculling-,essential_,exhaustedstamina-,extremesoundmuffler-,fabricemotes-,fancymenu_,fancymenu_video_extension,fast-ip-ping-,firstperson-,flickerfix-,fm_audio_extension_,fabricmod_VoxelMap-,forgemod_VoxelMap-,freecam-,freelook-,galacticraft-rpc-,gamestagesviewer-,gpumemleakfix-,grid-,helium-,hiddenrecipebook_,hiddenrecipebook-,infinitemusic-,inventoryhud.,inventoryprofiles,invtweaks-,itemzoom,itlt-,jeed-,jehc-,jeiintegration_,jumpoverfences-,just-enough-harvestcraft-,justenoughbeacons-,justenoughdrags-,justzoom_,keymap-,keywizard-,lazurite-,lazydfu-,lib39-,light-overlay-,lightfallclient-,lightspeed-,loadmyresources_,lock_minecart_view-,lootbeams-,lwl-,macos-input-fixes-,magnesium_extras-,maptooltip-,massunbind,mcbindtype-,mcwifipnp-,medievalmusic-,memoryusagescreen-,mightyarchitect-,mindful-eating-,minetogether-,mobplusplus-,modcredits-,modernworldcreation_,modnametooltip-,modnametooltip_,moreoverlays-,mousewheelie-,movement-vision-,multihotbar-,music-duration-reducer-,musicdr-,neiRecipeHandlers-,ngrok-lan-expose-mod-,no_nv_flash-,nopotionshift_,notenoughanimations-,oculus-,ornaments-,overloadedarmorbar-,panorama-,paperdoll-,physics-mod-,phosphor-,preciseblockplacing-,radon-,realm-of-lost-souls-,rebind_narrator-,rebind-narrator-,rebindnarrator-,rebrand-,reforgium-,replanter-,rrls-,rubidium-,rubidium_extras-,screenshot-to-clipboard-,servercountryflags-,shutupexperimentalsettings-,shutupmodelloader-,signtools-,simple-rpc-,simpleautorun-,smartcursor-,smarthud-,smoothboot-,smoothfocus-,sodium-fabric-,sodiumoptionsapi-,sodiumdynamiclights-,sodiumoptionsmodcompat-,sounddeviceoptions-,soundreloader-,spoticraft-,skinlayers3d-forge,textrues_embeddium_options-,tconplanner-,timestamps-,tooltipscroller-,torchoptimizer-,torohealth-,totaldarkness,toughnessbar-,watermedia-,whats-that-slot-forge-,wisla-,xenon-,xlifeheartcolors-,yisthereautojump-
de.griefed.serverpackcreator.configuration.modswhitelist=Ping-Wheel-
de.griefed.serverpackcreator.configuration.hastebinserver=https://haste.zneix.eu/documents
de.griefed.serverpackcreator.configuration.aikar=-Xms4G -Xmx4G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class MainWindow(
} else {
main.show()
}
if (apiWrapper.apiProperties.firstRun && migrationManager.migrationMessages.isEmpty()) {
if (apiWrapper.firstRun) {
GlobalScope.launch(Dispatchers.Swing, CoroutineStart.UNDISPATCHED) {
if (JOptionPane.showConfirmDialog(
main.frame,
Expand All @@ -103,7 +103,7 @@ class MainWindow(
}
}
} else {
if (apiWrapper.apiProperties.preRelease || migrationManager.migrationMessages.isNotEmpty()) {
if (migrationManager.migrationMessages.isNotEmpty()) {
main.displayMigrationMessages()
}
if (apiWrapper.apiProperties.fallbackUpdated) {
Expand Down

0 comments on commit 263a8fc

Please sign in to comment.