mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -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-----------------------------------------------------*
|
*-------------------------------------------------------CuboidCommand-----------------------------------------------------*
|
||||||
@ -589,6 +602,7 @@ static void Chat_Init(void) {
|
|||||||
Commands_Register(&ModelCommand);
|
Commands_Register(&ModelCommand);
|
||||||
Commands_Register(&CuboidCommand);
|
Commands_Register(&CuboidCommand);
|
||||||
Commands_Register(&TeleportCommand);
|
Commands_Register(&TeleportCommand);
|
||||||
|
Commands_Register(&ClearDeniedCommand);
|
||||||
|
|
||||||
Chat_Logging = Options_GetBool(OPT_CHAT_LOGGING, true);
|
Chat_Logging = Options_GetBool(OPT_CHAT_LOGGING, true);
|
||||||
}
|
}
|
||||||
|
@ -536,6 +536,13 @@ void TextureCache_Deny(const String* url) {
|
|||||||
EntryList_Save(&deniedList);
|
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) {
|
CC_INLINE static void TextureCache_HashUrl(String* key, const String* url) {
|
||||||
String_AppendUInt32(key, Utils_CRC32((const cc_uint8*)url->buffer, url->length));
|
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. */
|
/* Adds the given URL to list of denied URLs, then saves it. */
|
||||||
/* Denied URLs are never loaded. */
|
/* Denied URLs are never loaded. */
|
||||||
void TextureCache_Deny(const String* url);
|
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. */
|
/* Returns whether the given URL has been cached. */
|
||||||
cc_bool TextureCache_Has(const String* url);
|
cc_bool TextureCache_Has(const String* url);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user