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 pChatEndpoint, ServerTextFilter.MessageEncoder pChatEncoder, ServerTextFilter.IgnoreStrategy pChatIgnoreStrategy, ExecutorService pWorkerPool) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected intcreateContext(com.mojang.authlib.GameProfile pProfile) static @Nullable ServerTextFilterprotected static ExecutorServicecreateWorkerPool(int pSize) protected voiddrainStream(InputStream pStream) protected abstract FilteredTextfilterText(String pText, ServerTextFilter.IgnoreStrategy pIgnoreStrategy, JsonObject pResponse) protected static URLgetEndpoint(URI pApiServer, @Nullable JsonObject pJson, String pKey, String pFallback) protected static StringgetEndpointFromConfig(@Nullable JsonObject pJson, String pKey, String pFallback) protected HttpURLConnectiongetURLConnection(URL pUrl) protected HttpURLConnectionmakeRequest(JsonObject pRequest, URL pEndpoint) protected FilterMaskparseMask(String pText, JsonArray pHashes, ServerTextFilter.IgnoreStrategy pIgnoreStrategy) private JsonObjectprocessRequestResponse(JsonObject pRequest, URL pEndpoint) protected CompletableFuture<FilteredText> requestMessageProcessing(com.mojang.authlib.GameProfile pProfile, String pFilter, ServerTextFilter.IgnoreStrategy pChatIgnoreStrategy, Executor pStreamExecutor) protected abstract voidsetAuthorizationProperty(HttpURLConnection pConnection)
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
WORKER_COUNT
-
THREAD_FACTORY
-
chatEndpoint
-
chatEncoder
-
chatIgnoreStrategy
-
workerPool
-
-
Constructor Details
-
ServerTextFilter
protected ServerTextFilter(URL pChatEndpoint, ServerTextFilter.MessageEncoder pChatEncoder, ServerTextFilter.IgnoreStrategy pChatIgnoreStrategy, ExecutorService pWorkerPool)
-
-
Method Details
-
createWorkerPool
-
getEndpoint
protected static URL getEndpoint(URI pApiServer, @Nullable JsonObject pJson, String pKey, String pFallback) throws MalformedURLException - Throws:
MalformedURLException
-
getEndpointFromConfig
protected static String getEndpointFromConfig(@Nullable JsonObject pJson, String pKey, String pFallback) -
createFromConfig
-
requestMessageProcessing
protected CompletableFuture<FilteredText> requestMessageProcessing(com.mojang.authlib.GameProfile pProfile, String pFilter, ServerTextFilter.IgnoreStrategy pChatIgnoreStrategy, Executor pStreamExecutor) -
filterText
protected abstract FilteredText filterText(String pText, ServerTextFilter.IgnoreStrategy pIgnoreStrategy, JsonObject pResponse) -
parseMask
protected FilterMask parseMask(String pText, JsonArray pHashes, ServerTextFilter.IgnoreStrategy pIgnoreStrategy) -
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
-