mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Add /client cleardenied to clear list of denied texture pack URLs.
Since multiple times run into issues where someone accidentally denied a texture pack, and it's not obvious how to undo that, especially when you're using the web client.
This commit is contained in:
parent
ca72cf66a3
commit
a14ff7cda2
14
src/Chat.c
14
src/Chat.c
@ -429,6 +429,19 @@ static struct ChatCommand ModelCommand = {
|
||||
}
|
||||
};
|
||||
|
||||
static void ClearDeniedCommand_Execute(const String* args, int argsCount) {
|
||||
int count = TextureCache_ClearDenied();
|
||||
Chat_Add1("Removed &e%i &fdenied texture pack URLs.", &count);
|
||||
}
|
||||
|
||||
static struct ChatCommand ClearDeniedCommand = {
|
||||
"ClearDenied", ClearDeniedCommand_Execute, false,
|
||||
{
|
||||
"&a/client cleardenied",
|
||||
"&eClears the list of texture pack URLs you have denied",
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------CuboidCommand-----------------------------------------------------*
|
||||
@ -589,6 +602,7 @@ static void Chat_Init(void) {
|
||||
Commands_Register(&ModelCommand);
|
||||
Commands_Register(&CuboidCommand);
|
||||
Commands_Register(&TeleportCommand);
|
||||
Commands_Register(&ClearDeniedCommand);
|
||||
|
||||
Chat_Logging = Options_GetBool(OPT_CHAT_LOGGING, true);
|
||||
}
|
||||
|
@ -527,15 +527,22 @@ void TextureCache_Init(void) {
|
||||
cc_bool TextureCache_HasAccepted(const String* url) { return EntryList_Find(&acceptedList, url) >= 0; }
|
||||
cc_bool TextureCache_HasDenied(const String* url) { return EntryList_Find(&deniedList, url) >= 0; }
|
||||
|
||||
void TextureCache_Accept(const String* url) {
|
||||
void TextureCache_Accept(const String* url) {
|
||||
EntryList_Set(&acceptedList, url, &String_Empty);
|
||||
EntryList_Save(&acceptedList);
|
||||
}
|
||||
void TextureCache_Deny(const String* url) {
|
||||
void TextureCache_Deny(const String* url) {
|
||||
EntryList_Set(&deniedList, url, &String_Empty);
|
||||
EntryList_Save(&deniedList);
|
||||
}
|
||||
|
||||
int TextureCache_ClearDenied(void) {
|
||||
int count = deniedList.entries.count;
|
||||
StringsBuffer_Clear(&deniedList.entries);
|
||||
EntryList_Save(&deniedList);
|
||||
return count;
|
||||
}
|
||||
|
||||
CC_INLINE static void TextureCache_HashUrl(String* key, const String* url) {
|
||||
String_AppendUInt32(key, Utils_CRC32((const cc_uint8*)url->buffer, url->length));
|
||||
}
|
||||
|
@ -82,6 +82,8 @@ void TextureCache_Accept(const String* url);
|
||||
/* Adds the given URL to list of denied URLs, then saves it. */
|
||||
/* Denied URLs are never loaded. */
|
||||
void TextureCache_Deny(const String* url);
|
||||
/* Clears the list of denied URLs, returning number removed. */
|
||||
int TextureCache_ClearDenied(void);
|
||||
|
||||
/* Returns whether the given URL has been cached. */
|
||||
cc_bool TextureCache_Has(const String* url);
|
||||
|
Loading…
x
Reference in New Issue
Block a user