mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-27 02:21:38 +01:00
Removed more string concatenation
This commit is contained in:
parent
1742aa6f8a
commit
c1b584da1b
@ -110,12 +110,12 @@ public class MinestomRootClassLoader extends HierarchyClassLoader {
|
||||
try {
|
||||
// we do not load system classes by ourselves
|
||||
Class<?> systemClass = ClassLoader.getPlatformClassLoader().loadClass(name);
|
||||
LOGGER.trace("System class: " + systemClass);
|
||||
LOGGER.trace("System class: {}", systemClass);
|
||||
return systemClass;
|
||||
} catch (ClassNotFoundException e) {
|
||||
try {
|
||||
if (isProtected(name)) {
|
||||
LOGGER.trace("Protected: " + name);
|
||||
LOGGER.trace("Protected: {}", name);
|
||||
return super.loadClass(name, resolve);
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ public class MinestomRootClassLoader extends HierarchyClassLoader {
|
||||
try {
|
||||
byte[] bytes = loadBytes(name, true);
|
||||
Class<?> defined = defineClass(name, bytes, 0, bytes.length);
|
||||
LOGGER.trace("Loaded with code modifiers: " + name);
|
||||
LOGGER.trace("Loaded with code modifiers: {}", name);
|
||||
if (resolve) {
|
||||
resolveClass(defined);
|
||||
}
|
||||
@ -152,7 +152,7 @@ public class MinestomRootClassLoader extends HierarchyClassLoader {
|
||||
} catch (ClassNotFoundException e) {
|
||||
// could not load inside this classloader, attempt with children
|
||||
Class<?> defined = null;
|
||||
for(MinestomExtensionClassLoader subloader : children) {
|
||||
for (MinestomExtensionClassLoader subloader : children) {
|
||||
try {
|
||||
defined = subloader.loadClassAsChild(name, resolve);
|
||||
LOGGER.trace("Loaded from child {}: {}", subloader, name);
|
||||
@ -179,11 +179,11 @@ public class MinestomRootClassLoader extends HierarchyClassLoader {
|
||||
throw new ClassNotFoundException();
|
||||
String path = name.replace(".", "/") + ".class";
|
||||
InputStream input = getResourceAsStream(path);
|
||||
if(input == null) {
|
||||
throw new ClassNotFoundException("Could not find resource "+path);
|
||||
if (input == null) {
|
||||
throw new ClassNotFoundException("Could not find resource " + path);
|
||||
}
|
||||
byte[] originalBytes = input.readAllBytes();
|
||||
if(transform) {
|
||||
if (transform) {
|
||||
return transformBytes(originalBytes, name);
|
||||
}
|
||||
return originalBytes;
|
||||
@ -194,11 +194,11 @@ public class MinestomRootClassLoader extends HierarchyClassLoader {
|
||||
throw new ClassNotFoundException();
|
||||
String path = name.replace(".", "/") + ".class";
|
||||
InputStream input = getResourceAsStreamWithChildren(path);
|
||||
if(input == null) {
|
||||
throw new ClassNotFoundException("Could not find resource "+path);
|
||||
if (input == null) {
|
||||
throw new ClassNotFoundException("Could not find resource " + path);
|
||||
}
|
||||
byte[] originalBytes = input.readAllBytes();
|
||||
if(transform) {
|
||||
if (transform) {
|
||||
return transformBytes(originalBytes, name);
|
||||
}
|
||||
return originalBytes;
|
||||
@ -227,7 +227,7 @@ public class MinestomRootClassLoader extends HierarchyClassLoader {
|
||||
};
|
||||
node.accept(writer);
|
||||
classBytecode = writer.toByteArray();
|
||||
LOGGER.trace("Modified " + name);
|
||||
LOGGER.trace("Modified {}", name);
|
||||
}
|
||||
}
|
||||
return classBytecode;
|
||||
@ -255,7 +255,7 @@ public class MinestomRootClassLoader extends HierarchyClassLoader {
|
||||
if (CodeModifier.class.isAssignableFrom(modifierClass)) {
|
||||
CodeModifier modifier = (CodeModifier) modifierClass.getDeclaredConstructor().newInstance();
|
||||
synchronized (modifiers) {
|
||||
LOGGER.warn("Added Code modifier: " + modifier);
|
||||
LOGGER.warn("Added Code modifier: {}", modifier);
|
||||
addCodeModifier(modifier);
|
||||
}
|
||||
}
|
||||
|
@ -14,16 +14,16 @@ public class MixinAuditTrailMinestom implements IMixinAuditTrail {
|
||||
|
||||
@Override
|
||||
public void onApply(String className, String mixinName) {
|
||||
LOGGER.trace("Applied mixin " + mixinName + " to class " + className);
|
||||
LOGGER.trace("Applied mixin {} to class {}", mixinName, className);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostProcess(String className) {
|
||||
LOGGER.trace("Post processing " + className);
|
||||
LOGGER.trace("Post processing {}", className);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGenerate(String className, String generatorName) {
|
||||
LOGGER.trace("Generating class " + className + " via generator " + generatorName);
|
||||
LOGGER.trace("Generating class {} via generator {}", className, generatorName);
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,9 @@ public final class PacketProcessor {
|
||||
} catch (Exception e) {
|
||||
final Player player = connection.getPlayer();
|
||||
final String username = player != null ? player.getUsername() : "null";
|
||||
LOGGER.warn("Connection " + connection.getRemoteAddress() + " (" + username + ") sent an unexpected packet.");
|
||||
LOGGER.warn("Connection {} ({}) sent an unexpected packet.",
|
||||
connection.getRemoteAddress(),
|
||||
username);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -51,9 +51,10 @@ public class PacketFramer extends ByteToMessageCodec<ByteBuf> {
|
||||
final PlayerConnection playerConnection = packetProcessor.getPlayerConnection(ctx);
|
||||
if (playerConnection != null) {
|
||||
final String identifier = playerConnection.getIdentifier();
|
||||
LOGGER.warn("An user (" + identifier + ") sent a packet over the maximum size (" + packetSize + ")");
|
||||
LOGGER.warn("An user ({}) sent a packet over the maximum size ({})",
|
||||
identifier, packetSize);
|
||||
} else {
|
||||
LOGGER.warn("An unregistered user sent a packet over the maximum size (" + packetSize + ")");
|
||||
LOGGER.warn("An unregistered user sent a packet over the maximum size ({})", packetSize);
|
||||
}
|
||||
ctx.close();
|
||||
}
|
||||
|
@ -32,13 +32,13 @@ public class ResourceGatherer {
|
||||
if (DATA_FOLDER.exists()) {
|
||||
return;
|
||||
}
|
||||
LOGGER.info(DATA_FOLDER + " folder does not exist. Minestom will now generate the necessary files.");
|
||||
LOGGER.info("{} folder does not exist. Minestom will now generate the necessary files.", DATA_FOLDER);
|
||||
|
||||
if (!TMP_FOLDER.exists() && !TMP_FOLDER.mkdirs()) {
|
||||
throw new IOException("Failed to create tmp folder.");
|
||||
}
|
||||
|
||||
LOGGER.info("Starting download of Minecraft server jar for version " + version + " from Mojang servers...");
|
||||
LOGGER.info("Starting download of Minecraft server jar for version {} from Mojang servers...", version);
|
||||
File serverJar = downloadServerJar(version);
|
||||
LOGGER.info("Download complete.");
|
||||
|
||||
@ -54,7 +54,7 @@ public class ResourceGatherer {
|
||||
Path generatedFolder = tmpFolderPath.resolve("generated");
|
||||
LOGGER.info("Data generator successful, removing server jar");
|
||||
Files.delete(tmpFolderPath.resolve("server_" + version + ".jar"));
|
||||
LOGGER.info("Removal successful, now moving data to " + DATA_FOLDER);
|
||||
LOGGER.info("Removal successful, now moving data to {}", DATA_FOLDER);
|
||||
Files.walkFileTree(tmpFolderPath, new SimpleFileVisitor<>() {
|
||||
|
||||
@Override
|
||||
@ -62,7 +62,7 @@ public class ResourceGatherer {
|
||||
Path relativePath = generatedFolder.relativize(dir);
|
||||
if (dir.startsWith(generatedFolder)) { // don't copy logs
|
||||
Path resolvedPath = dataFolderPath.resolve(relativePath);
|
||||
LOGGER.info("> Creating sub-folder " + relativePath);
|
||||
LOGGER.info("> Creating sub-folder {}", resolvedPath);
|
||||
Files.createDirectories(resolvedPath);
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
@ -70,7 +70,7 @@ public class ResourceGatherer {
|
||||
|
||||
@Override
|
||||
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
|
||||
LOGGER.info("> Deleting folder " + dir);
|
||||
LOGGER.info("> Deleting folder {}", dir);
|
||||
Files.delete(dir);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
@ -80,10 +80,10 @@ public class ResourceGatherer {
|
||||
Path relativePath = generatedFolder.relativize(file);
|
||||
if (file.startsWith(generatedFolder)) { // don't copy logs
|
||||
Path resolvedPath = dataFolderPath.resolve(relativePath);
|
||||
LOGGER.info("> Moving " + relativePath);
|
||||
LOGGER.info("> Moving {}", relativePath);
|
||||
Files.move(file, resolvedPath);
|
||||
} else {
|
||||
LOGGER.info("> Deleting " + relativePath);
|
||||
LOGGER.info("> Deleting {}", relativePath);
|
||||
Files.delete(file);
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
@ -95,7 +95,7 @@ public class ResourceGatherer {
|
||||
ProcessBuilder dataGenerator = new ProcessBuilder("java", "-cp", serverJar.getName(), "net.minecraft.data.Main", "--all", "--server", "--dev");
|
||||
dataGenerator.directory(TMP_FOLDER);
|
||||
LOGGER.info("Now running data generator with options '--dev', '--server', '--all'");
|
||||
LOGGER.info("Executing: " + String.join(" ", dataGenerator.command()));
|
||||
LOGGER.info("Executing: {}", String.join(" ", dataGenerator.command()));
|
||||
LOGGER.info("Minestom will now wait for it to finish, here's its output:");
|
||||
LOGGER.info("");
|
||||
Process dataGeneratorProcess = dataGenerator.start();
|
||||
@ -156,8 +156,8 @@ public class ResourceGatherer {
|
||||
// Server
|
||||
{
|
||||
JsonObject serverJson = downloadsJson.getAsJsonObject("server");
|
||||
String jarURL = serverJson.get("url").getAsString();
|
||||
String sha1 = serverJson.get("sha1").getAsString();
|
||||
final String jarURL = serverJson.get("url").getAsString();
|
||||
final String sha1 = serverJson.get("sha1").getAsString();
|
||||
|
||||
LOGGER.debug("Found all information required to download the server JAR file.");
|
||||
LOGGER.debug("Attempting download.");
|
||||
|
@ -211,7 +211,7 @@ public final class NBTUtils {
|
||||
if (enchant != null) {
|
||||
setter.applyEnchantment(enchant, level);
|
||||
} else {
|
||||
LOGGER.warn("Unknown enchantment type: " + id);
|
||||
LOGGER.warn("Unknown enchantment type: {}", id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user