mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-03 23:17:48 +01:00
Merge pull request #34 from Minestom/small-optimizations
Small optimizations.
This commit is contained in:
commit
ac809c4ea6
@ -294,8 +294,7 @@ public class Advancement {
|
||||
|
||||
final Advancement parent = getParent();
|
||||
if (parent != null) {
|
||||
final String parentIdentifier = parent.getIdentifier();
|
||||
adv.parentIdentifier = parentIdentifier;
|
||||
adv.parentIdentifier = parent.getIdentifier();
|
||||
}
|
||||
|
||||
adv.displayData = toDisplayData();
|
||||
|
@ -58,7 +58,7 @@ public class ChatParser {
|
||||
String colorString = textObject.get("color").getAsString();
|
||||
if (colorString.startsWith("#")) {
|
||||
// RGB format
|
||||
builder.append("{" + colorString + "}");
|
||||
builder.append("{").append(colorString).append("}");
|
||||
} else {
|
||||
// Color simple name
|
||||
ChatColor color = ChatColor.fromName(colorString);
|
||||
|
@ -203,9 +203,7 @@ public class CommandManager {
|
||||
|
||||
List<String> names = new ArrayList<>();
|
||||
names.add(command.getName());
|
||||
for (String alias : command.getAliases()) {
|
||||
names.add(alias);
|
||||
}
|
||||
names.addAll(Arrays.asList(command.getAliases()));
|
||||
for (String name : names) {
|
||||
createCommand(nodes, cmdChildren, name, syntaxes, rootChildren);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class AnvilInventory extends Inventory {
|
||||
* @param cost the new anvil repair cost
|
||||
*/
|
||||
public void setRepairCost(short cost) {
|
||||
this.repairCost = repairCost;
|
||||
this.repairCost = cost;
|
||||
sendProperty(InventoryProperty.ANVIL_REPAIR_COST, cost);
|
||||
}
|
||||
}
|
||||
|
@ -54,13 +54,11 @@ public class Task implements Runnable {
|
||||
try {
|
||||
this.runnable.run();
|
||||
} catch (Exception e) {
|
||||
System.err.println(
|
||||
String.format(
|
||||
"An exception in %s task %s is occurred! (%s)",
|
||||
this.shutdown ? "shutdown" : "",
|
||||
this.id,
|
||||
e.getMessage()
|
||||
)
|
||||
System.err.printf(
|
||||
"An exception in %s task %s is occurred! (%s)%n",
|
||||
this.shutdown ? "shutdown" : "",
|
||||
this.id,
|
||||
e.getMessage()
|
||||
);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
@ -124,7 +124,8 @@ public final class ChunkUtils {
|
||||
public static int[] indexToPosition(int index, int chunkX, int chunkZ) {
|
||||
int z = (byte) (index >> 12 & 0xF);
|
||||
final int y = (index >>> 4 & 0xFF);
|
||||
int x = (byte) (index >> 0 & 0xF);
|
||||
// index >> 0 = index
|
||||
int x = (byte) (index & 0xF);
|
||||
|
||||
x += 16 * chunkX;
|
||||
z += 16 * chunkZ;
|
||||
|
Loading…
Reference in New Issue
Block a user