@@ -40,17 +40,18 @@ import java.text.SimpleDateFormat
40
40
import java.util.*
41
41
42
42
internal object DebugCommand : VanillaCommandBase() {
43
- private val field_225390_a = LogManager .getLogger()
43
+ private val LOGGER = LogManager .getLogger()
44
+ private val JAR_FILESYSTEM_PROVIDER =
45
+ FileSystemProvider .installedProviders().stream().filter { p_225386_0_: FileSystemProvider ->
46
+ p_225386_0_.scheme.equals(" jar" , ignoreCase = true )
47
+ }.findFirst().orElse(null as FileSystemProvider ? )
48
+
44
49
private val NOT_RUNNING_EXCEPTION = SimpleCommandExceptionType (
45
50
TranslationTextComponent (" commands.debug.notRunning" )
46
51
)
47
52
private val ALREADY_RUNNING_EXCEPTION = SimpleCommandExceptionType (
48
53
TranslationTextComponent (" commands.debug.alreadyRunning" )
49
54
)
50
- private val field_225391_d =
51
- FileSystemProvider .installedProviders().stream().filter { p_225386_0_ ->
52
- p_225386_0_.scheme.equals(" jar" , ignoreCase = true )
53
- }.findFirst().orElse(null as FileSystemProvider ? )
54
55
55
56
private var aliases =
56
57
configuration.take().aliases.debug + " debug"
@@ -75,7 +76,7 @@ internal object DebugCommand : VanillaCommandBase() {
75
76
}
76
77
).then(
77
78
Commands .literal(" report" ).executes { p_225388_0_ ->
78
- func_225389_c (p_225388_0_.source)
79
+ writeDebugReport (p_225388_0_.source)
79
80
}
80
81
)
81
82
)
@@ -110,10 +111,9 @@ internal object DebugCommand : VanillaCommandBase() {
110
111
@Throws(CommandSyntaxException ::class )
111
112
private fun startDebug (source : CommandSource ): Int {
112
113
checkPermissions(source)
113
-
114
114
val minecraftserver = source.server
115
115
val debugprofiler = minecraftserver.profiler
116
- return if (debugprofiler.func_219899_d() .isEnabled) {
116
+ return if (debugprofiler.fixedProfiler .isEnabled) {
117
117
throw ALREADY_RUNNING_EXCEPTION .create()
118
118
} else {
119
119
minecraftserver.enableProfiling()
@@ -133,10 +133,10 @@ internal object DebugCommand : VanillaCommandBase() {
133
133
134
134
val minecraftserver = source.server
135
135
val debugprofiler = minecraftserver.profiler
136
- return if (! debugprofiler.func_219899_d() .isEnabled) {
136
+ return if (! debugprofiler.fixedProfiler .isEnabled) {
137
137
throw NOT_RUNNING_EXCEPTION .create()
138
138
} else {
139
- val iprofileresult = debugprofiler.func_219899_d().func_219938_b ()
139
+ val iprofileresult = debugprofiler.fixedProfiler.disable ()
140
140
val file1 = File (
141
141
minecraftserver.getFile(" debug" ),
142
142
" profile-results-" + SimpleDateFormat (" yyyy-MM-dd_HH.mm.ss" ).format(Date ()) + " .txt"
@@ -146,45 +146,46 @@ internal object DebugCommand : VanillaCommandBase() {
146
146
val f1 = iprofileresult.ticksSpend().toFloat() / f
147
147
source.sendFeedback(
148
148
TranslationTextComponent (
149
- " commands.debug.stopped" , String .format(
150
- Locale .ROOT , " %.2f" , f
151
- ), iprofileresult.ticksSpend(), String .format(" %.2f" , f1)
149
+ " commands.debug.stopped" ,
150
+ String .format(Locale .ROOT , " %.2f" , f),
151
+ iprofileresult.ticksSpend(),
152
+ String .format(" %.2f" , f1)
152
153
), true
153
154
)
154
155
MathHelper .floor(f1)
155
156
}
156
157
}
157
158
158
- private fun func_225389_c (p_225389_0_ : CommandSource ): Int {
159
+ private fun writeDebugReport (p_225389_0_ : CommandSource ): Int {
159
160
checkPermissions(p_225389_0_)
160
161
161
162
val minecraftserver = p_225389_0_.server
162
- val s = " debug-report-" + SimpleDateFormat (" yyyy-MM-dd_HH.mm.ss" ).format(Date ())
163
+ val s =
164
+ " debug-report-" + SimpleDateFormat (" yyyy-MM-dd_HH.mm.ss" ).format(Date ())
163
165
return try {
164
166
val path1 = minecraftserver.getFile(" debug" ).toPath()
165
167
Files .createDirectories(path1)
166
- if (! SharedConstants .developmentMode && field_225391_d != null ) {
168
+ if (! SharedConstants .developmentMode && JAR_FILESYSTEM_PROVIDER != null ) {
167
169
val path2 = path1.resolve(" $s .zip" )
168
- field_225391_d .newFileSystem(
170
+ JAR_FILESYSTEM_PROVIDER .newFileSystem(
169
171
path2,
170
- ImmutableMap .of<String , String ?>(" create" , " true" )
171
- ).use { filesystem ->
172
- minecraftserver.func_223711_a(filesystem.getPath(" /" ))
173
- }
172
+ ImmutableMap .of(" create" , " true" )
173
+ ).use { filesystem -> minecraftserver.dumpDebugInfo(filesystem.getPath(" /" )) }
174
174
} else {
175
175
val path = path1.resolve(s)
176
- minecraftserver.func_223711_a (path)
176
+ minecraftserver.dumpDebugInfo (path)
177
177
}
178
178
p_225389_0_.sendFeedback(
179
179
TranslationTextComponent (" commands.debug.reportSaved" , s),
180
180
false
181
181
)
182
182
1
183
183
} catch (ioexception: IOException ) {
184
- field_225390_a .error(" Failed to save debug dump " , ioexception as Throwable )
185
- p_225389_0_.sendErrorMessage(
186
- TranslationTextComponent ( " commands.debug.reportFailed " )
184
+ LOGGER .error(
185
+ " Failed to save debug dump " ,
186
+ ioexception as Throwable
187
187
)
188
+ p_225389_0_.sendErrorMessage(TranslationTextComponent (" commands.debug.reportFailed" ))
188
189
0
189
190
}
190
191
}
0 commit comments