Package net.minecraft.server.network
Class ServerTextFilter
java.lang.Object
net.minecraft.server.network.ServerTextFilter
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
LegacyTextFilter,PlayerSafetyServiceTextFilter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceprotected static interfaceprotected classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ServerTextFilter.MessageEncoderprivate final URL(package private) final ServerTextFilter.IgnoreStrategyprotected static final org.slf4j.Loggerprivate static final ThreadFactoryprivate static final AtomicInteger(package private) final ExecutorService -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedServerTextFilter(URL chatEndpoint, ServerTextFilter.MessageEncoder chatEncoder, ServerTextFilter.IgnoreStrategy chatIgnoreStrategy, ExecutorService workerPool) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected intcreateContext(com.mojang.authlib.GameProfile profile) static @Nullable ServerTextFilterprotected static ExecutorServicecreateWorkerPool(int size) protected voiddrainStream(InputStream stream) protected abstract FilteredTextfilterText(String text, ServerTextFilter.IgnoreStrategy ignoreStrategy, JsonObject response) protected static URLgetEndpoint(URI apiServer, @Nullable JsonObject json, String key, String fallback) protected static StringgetEndpointFromConfig(@Nullable JsonObject json, String key, String fallback) protected HttpURLConnectiongetURLConnection(URL url) protected HttpURLConnectionmakeRequest(JsonObject request, URL endpoint) protected FilterMaskparseMask(String text, JsonArray hashes, ServerTextFilter.IgnoreStrategy ignoreStrategy) private JsonObjectprocessRequestResponse(JsonObject request, URL endpoint) protected CompletableFuture<FilteredText> requestMessageProcessing(com.mojang.authlib.GameProfile profile, String filter, ServerTextFilter.IgnoreStrategy chatIgnoreStrategy, Executor streamExecutor) protected abstract voidsetAuthorizationProperty(HttpURLConnection connection)
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
WORKER_COUNT
-
THREAD_FACTORY
-
chatEndpoint
-
chatEncoder
-
chatIgnoreStrategy
-
workerPool
-
-
Constructor Details
-
ServerTextFilter
protected ServerTextFilter(URL chatEndpoint, ServerTextFilter.MessageEncoder chatEncoder, ServerTextFilter.IgnoreStrategy chatIgnoreStrategy, ExecutorService workerPool)
-
-
Method Details
-
createWorkerPool
-
getEndpoint
protected static URL getEndpoint(URI apiServer, @Nullable JsonObject json, String key, String fallback) throws MalformedURLException - Throws:
MalformedURLException
-
getEndpointFromConfig
protected static String getEndpointFromConfig(@Nullable JsonObject json, String key, String fallback) -
createFromConfig
-
requestMessageProcessing
protected CompletableFuture<FilteredText> requestMessageProcessing(com.mojang.authlib.GameProfile profile, String filter, ServerTextFilter.IgnoreStrategy chatIgnoreStrategy, Executor streamExecutor) -
filterText
protected abstract FilteredText filterText(String text, ServerTextFilter.IgnoreStrategy ignoreStrategy, JsonObject response) -
parseMask
protected FilterMask parseMask(String text, JsonArray hashes, ServerTextFilter.IgnoreStrategy ignoreStrategy) -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
drainStream
- Throws:
IOException
-
processRequestResponse
- Throws:
IOException
-
makeRequest
- Throws:
IOException
-
setAuthorizationProperty
-
connectionReadTimeout
protected int connectionReadTimeout() -
getURLConnection
- Throws:
IOException
-
createContext
-