Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-08 04:20:06 +01:00
Fixes NPE when attempting to list schematics in an invalid directory.
Dieser Commit ist enthalten in:
Ursprung
3f1a2bfc39
Commit
fcaafe009c
@ -18,12 +18,16 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.commands;
|
package com.sk89q.worldedit.commands;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import com.sk89q.minecraft.util.commands.Command;
|
import com.sk89q.minecraft.util.commands.Command;
|
||||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||||
import com.sk89q.minecraft.util.commands.CommandException;
|
import com.sk89q.minecraft.util.commands.CommandException;
|
||||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||||
import com.sk89q.minecraft.util.commands.Console;
|
import com.sk89q.minecraft.util.commands.Console;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.FilenameResolutionException;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
import com.sk89q.worldedit.LocalPlayer;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
@ -32,9 +36,6 @@ import com.sk89q.worldedit.WorldEditException;
|
|||||||
import com.sk89q.worldedit.data.DataException;
|
import com.sk89q.worldedit.data.DataException;
|
||||||
import com.sk89q.worldedit.schematic.SchematicFormat;
|
import com.sk89q.worldedit.schematic.SchematicFormat;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commands related to schematics
|
* Commands related to schematics
|
||||||
*
|
*
|
||||||
@ -213,9 +214,14 @@ public class SchematicCommands {
|
|||||||
public void list(CommandContext args, LocalSession session, LocalPlayer player,
|
public void list(CommandContext args, LocalSession session, LocalPlayer player,
|
||||||
EditSession editSession) throws WorldEditException {
|
EditSession editSession) throws WorldEditException {
|
||||||
File dir = we.getWorkingDirectoryFile(we.getConfiguration().saveDir);
|
File dir = we.getWorkingDirectoryFile(we.getConfiguration().saveDir);
|
||||||
|
File[] files = dir.listFiles();
|
||||||
|
if (files == null) {
|
||||||
|
throw new FilenameResolutionException(dir.getPath(), "Schematics directory invalid or not found.");
|
||||||
|
}
|
||||||
StringBuilder build = new StringBuilder("Available schematics (Filename (Format)): ");
|
StringBuilder build = new StringBuilder("Available schematics (Filename (Format)): ");
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (File file : dir.listFiles()) {
|
|
||||||
|
for (File file : files) {
|
||||||
if (!file.isFile()) {
|
if (!file.isFile()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren