mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Improve logging and errors
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
This commit is contained in:
parent
f64904e777
commit
b141cd3d99
6 changed files with 49 additions and 17 deletions
|
@ -1,11 +1,20 @@
|
|||
--- a/net/minecraft/advancements/AdvancementTree.java
|
||||
+++ b/net/minecraft/advancements/AdvancementTree.java
|
||||
@@ -35,7 +35,7 @@
|
||||
this.remove(advancementnode1);
|
||||
}
|
||||
|
||||
- AdvancementTree.LOGGER.info("Forgot about advancement {}", advancement.holder());
|
||||
+ AdvancementTree.LOGGER.debug("Forgot about advancement {}", advancement.holder()); // Paper - Improve logging and errors
|
||||
this.nodes.remove(advancement.holder().id());
|
||||
if (advancement.parent() == null) {
|
||||
this.roots.remove(advancement);
|
||||
@@ -77,7 +77,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size());
|
||||
+ // AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); // CraftBukkit - moved to AdvancementDataWorld#reload
|
||||
+ // AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); // CraftBukkit - moved to AdvancementDataWorld#reload // Paper - Improve logging and errors; you say it was moved... but it wasn't :) it should be moved however, since this is called when the API creates an advancement
|
||||
}
|
||||
|
||||
private boolean tryInsert(AdvancementHolder advancement) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
private AdvancementTree tree = new AdvancementTree();
|
||||
private final HolderLookup.Provider registries;
|
||||
|
||||
@@ -37,10 +41,15 @@
|
||||
@@ -37,13 +41,19 @@
|
||||
Builder<ResourceLocation, AdvancementHolder> builder = ImmutableMap.builder();
|
||||
|
||||
prepared.forEach((minecraftkey, advancement) -> {
|
||||
|
@ -33,3 +33,7 @@
|
|||
AdvancementTree advancementtree = new AdvancementTree();
|
||||
|
||||
advancementtree.addAll(this.advancements.values());
|
||||
+ LOGGER.info("Loaded {} advancements", advancementtree.nodes().size()); // Paper - Improve logging and errors; moved from AdvancementTree#addAll
|
||||
Iterator iterator = advancementtree.roots().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
InetAddress inetaddress = null;
|
||||
|
||||
if (!this.getLocalIp().isEmpty()) {
|
||||
@@ -143,12 +266,15 @@
|
||||
@@ -143,34 +266,55 @@
|
||||
if (this.getPort() < 0) {
|
||||
this.setPort(dedicatedserverproperties.serverPort);
|
||||
}
|
||||
|
@ -232,7 +232,8 @@
|
|||
} catch (IOException ioexception) {
|
||||
DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
|
||||
DedicatedServer.LOGGER.warn("The exception was: {}", ioexception.toString());
|
||||
@@ -156,21 +282,38 @@
|
||||
DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?");
|
||||
+ if (true) throw new IllegalStateException("Failed to bind to port", ioexception); // Paper - Propagate failed to bind to port error
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -276,7 +277,7 @@
|
|||
this.debugSampleSubscriptionTracker = new DebugSampleSubscriptionTracker(this.getPlayerList());
|
||||
this.tickTimeLogger = new RemoteSampleLogger(TpsDebugDimensions.values().length, this.debugSampleSubscriptionTracker, RemoteDebugSampleType.TICK_TIME);
|
||||
long i = Util.getNanos();
|
||||
@@ -178,13 +321,13 @@
|
||||
@@ -178,13 +322,13 @@
|
||||
SkullBlockEntity.setup(this.services, this);
|
||||
GameProfileCache.setUsesAuthentication(this.usesAuthentication());
|
||||
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getLevelIdName());
|
||||
|
@ -292,7 +293,7 @@
|
|||
}
|
||||
|
||||
if (dedicatedserverproperties.enableQuery) {
|
||||
@@ -197,7 +340,7 @@
|
||||
@@ -197,7 +341,7 @@
|
||||
this.rconThread = RconThread.create(this);
|
||||
}
|
||||
|
||||
|
@ -301,7 +302,7 @@
|
|||
Thread thread1 = new Thread(new ServerWatchdog(this));
|
||||
|
||||
thread1.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandlerWithName(DedicatedServer.LOGGER));
|
||||
@@ -215,6 +358,12 @@
|
||||
@@ -215,6 +359,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,7 +315,7 @@
|
|||
@Override
|
||||
public boolean isSpawningMonsters() {
|
||||
return this.settings.getProperties().spawnMonsters && super.isSpawningMonsters();
|
||||
@@ -227,7 +376,7 @@
|
||||
@@ -227,7 +377,7 @@
|
||||
|
||||
@Override
|
||||
public void forceDifficulty() {
|
||||
|
@ -323,7 +324,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -286,13 +435,14 @@
|
||||
@@ -286,13 +436,14 @@
|
||||
}
|
||||
|
||||
if (this.rconThread != null) {
|
||||
|
@ -340,7 +341,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -302,19 +452,29 @@
|
||||
@@ -302,19 +453,29 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -376,7 +377,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -383,7 +543,7 @@
|
||||
@@ -383,7 +544,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isUnderSpawnProtection(ServerLevel world, BlockPos pos, Player player) {
|
||||
|
@ -385,7 +386,7 @@
|
|||
return false;
|
||||
} else if (this.getPlayerList().getOps().isEmpty()) {
|
||||
return false;
|
||||
@@ -453,7 +613,11 @@
|
||||
@@ -453,7 +614,11 @@
|
||||
public boolean enforceSecureProfile() {
|
||||
DedicatedServerProperties dedicatedserverproperties = this.getProperties();
|
||||
|
||||
|
@ -398,7 +399,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -541,16 +705,52 @@
|
||||
@@ -541,16 +706,52 @@
|
||||
|
||||
@Override
|
||||
public String getPluginNames() {
|
||||
|
@ -455,7 +456,7 @@
|
|||
}
|
||||
|
||||
public void storeUsingWhiteList(boolean useWhitelist) {
|
||||
@@ -660,4 +860,15 @@
|
||||
@@ -660,4 +861,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2436,11 +2436,13 @@
|
|||
} else {
|
||||
try {
|
||||
SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
|
||||
@@ -2046,7 +3503,7 @@
|
||||
@@ -2045,8 +3502,8 @@
|
||||
|
||||
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
|
||||
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
|
||||
- ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
|
||||
- this.disconnect(profilepublickey_b.getComponent());
|
||||
+ // ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); // Paper - Improve logging and errors
|
||||
+ this.disconnect(profilepublickey_b.getComponent(), profilepublickey_b.kickCause); // Paper - kick event causes
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
--- a/net/minecraft/server/packs/PathPackResources.java
|
||||
+++ b/net/minecraft/server/packs/PathPackResources.java
|
||||
@@ -103,6 +103,12 @@
|
||||
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) {
|
||||
for (Path path2 : directoryStream) {
|
||||
String string = path2.getFileName().toString();
|
||||
+ // Paper start - Improve logging and errors
|
||||
+ if (!Files.isDirectory(path2)) {
|
||||
+ LOGGER.error("Invalid directory entry: {} in {}.", string, this.root, new java.nio.file.NotDirectoryException(string));
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper end - Improve logging and errors
|
||||
if (ResourceLocation.isValidNamespace(string)) {
|
||||
set.add(string);
|
||||
} else {
|
|
@ -44,6 +44,7 @@ import org.bukkit.material.MaterialData;
|
|||
*/
|
||||
@Deprecated
|
||||
public final class CraftLegacy {
|
||||
private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper - Improve logging and errors
|
||||
|
||||
private static final Map<Byte, Material> SPAWN_EGGS = new HashMap<>();
|
||||
private static final Set<String> whitelistedStates = new HashSet<>(Arrays.asList("explode", "check_decay", "decayable", "facing"));
|
||||
|
@ -264,7 +265,7 @@ public final class CraftLegacy {
|
|||
}
|
||||
|
||||
static {
|
||||
System.err.println("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!");
|
||||
LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - Improve logging and errors; doesn't need to be an error
|
||||
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) {
|
||||
new Exception().printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue