Unify common faction artwork across lobby and gameplay without losing Guild materials
This commit is contained in:
parent
30a18c26f8
commit
a5dd4cd3c7
2 changed files with 35 additions and 15 deletions
|
|
@ -52,7 +52,7 @@ public final class DuneGUI extends JavaPlugin implements Listener,CommandExecuto
|
|||
boolean inLobby=lobby(player);
|
||||
var file=new java.io.File(getDataFolder(),"gui-pack.yml");if(!file.isFile())return NetworkArtworkPolicy.select(inLobby,null,null);
|
||||
var data=org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(file);
|
||||
String prefix=inLobby?"lobby.":"world.";
|
||||
String prefix="world.";
|
||||
return NetworkArtworkPolicy.select(inLobby,data.getString(prefix+"url"),data.getString(prefix+"sha1"));
|
||||
}
|
||||
private long lastDepartureNotice=-1;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ import java.util.UUID;
|
|||
final class NetworkArtworkPolicy {
|
||||
static final UUID PACK_ID=UUID.fromString("a7b5ab7d-d8d8-5b51-b016-71a5f4c00008");
|
||||
static final Pack WORLD=new Pack("https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-v6.zip","f86189d72abc0690a08e01b7707998fabd961b8d");
|
||||
static final Pack LOBBY=new Pack("https://www.dunerealms.com/downloads/DuneRealms-Network-Artwork-Lobby-v6.zip","dfa8b458f306f61ecae490d5503924a63cea9a75");
|
||||
static final Pack LOBBY=WORLD;
|
||||
record Pack(String url,String hash){}
|
||||
private NetworkArtworkPolicy(){}
|
||||
static Pack select(boolean lobby,String url,String hash){
|
||||
Pack fallback=lobby?LOBBY:WORLD;
|
||||
// Old lobby-only pins are not valid global artwork. Only accept a new,
|
||||
// explicit scope-specific immutable release override.
|
||||
String pattern="https://www\\.dunerealms\\.com/downloads/DuneRealms-Network-Artwork"+(lobby?"-Lobby":"")+"-v(?:[5-9]|[1-9][0-9]+)\\.zip";
|
||||
Pack fallback=WORLD;
|
||||
// Old lobby-only pins are not valid global artwork. Only accept a
|
||||
// common immutable release override.
|
||||
String pattern="https://www\\.dunerealms\\.com/downloads/DuneRealms-Network-Artwork"+"-v(?:[6-9]|[1-9][0-9]+)\\.zip";
|
||||
if(url!=null&&hash!=null&&url.matches(pattern)&&hash.matches("[0-9a-f]{40}"))return new Pack(url,hash);
|
||||
return fallback;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff