File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import trplugins.menu.module.internal.script.Bindings
28
28
import trplugins.menu.module.internal.script.evalScript
29
29
import trplugins.menu.module.internal.service.RegisterCommands
30
30
import trplugins.menu.module.internal.service.Shortcuts
31
+ import trplugins.menu.util.bukkit.Heads
31
32
32
33
/* *
33
34
* @author Arasple
@@ -97,6 +98,8 @@ object TrMenu : Plugin() {
97
98
NMS .javaStaticInventory = SETTINGS .getBoolean(" Options.Static-Inventory.Java" , false )
98
99
NMS .bedrockStaticInventory = SETTINGS .getBoolean(" Options.Static-Inventory.Bedrock" , false )
99
100
NMS .createIdPacketInventory = SETTINGS .getBoolean(" Options.Packet-Inventory.Create-Id" , false )
101
+ Heads .headConnectTimeout = SETTINGS .getInt(" Menu.Icon.Item.Head-Connect-Timeout" , 500 )
102
+ Heads .headReadTimeout = SETTINGS .getInt(" Menu.Icon.Item.Head-Read-Timeout" , 2500 )
100
103
}
101
104
102
105
}
Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ object Heads {
29
29
private const val USER_API = " https://api.mojang.com/users/profiles/minecraft/"
30
30
private const val SESSION_API = " https://sessionserver.mojang.com/session/minecraft/profile/"
31
31
32
+ var headConnectTimeout: Int = 500
33
+ var headReadTimeout: Int = 2500
34
+
32
35
private val JSON_PARSER = JsonParser ()
33
36
private val DEFAULT_HEAD = XMaterial .PLAYER_HEAD .parseItem()!! .apply {
34
37
if (runCatching { Material .PLAYER_HEAD }.isFailure) {
@@ -150,8 +153,8 @@ object Heads {
150
153
try {
151
154
val con = URL (url).openConnection()
152
155
// Java 8 require user agent
153
- con.connectTimeout = 500
154
- con.readTimeout = 2500
156
+ con.connectTimeout = headConnectTimeout
157
+ con.readTimeout = headReadTimeout
155
158
con.addRequestProperty(" User-Agent" , " Mozilla/5.0" )
156
159
con.getInputStream().use { `in ` ->
157
160
BufferedReader (InputStreamReader (`in `)).use { reader ->
Original file line number Diff line number Diff line change 80
80
Default-Name-Color : " &7"
81
81
Default-Lore-Color : " &7"
82
82
Pre-Color : false
83
+ Head-Connect-Timeout : 500
84
+ Head-Read-Timeout : 2500
83
85
84
86
Action :
85
87
Using-Component : true
You can’t perform that action at this time.
0 commit comments