mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-30 13:27:37 +00:00
:okretard: marco
This commit is contained in:
parent
521825024e
commit
a97a3f3177
@ -1,5 +1,7 @@
|
||||
package me.totalfreedom.totalfreedommod.httpd.module;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -190,11 +192,16 @@ public class Module_schematic extends HTTPDModule
|
||||
throw new SchematicTransferException("Can't resolve original file name.");
|
||||
}
|
||||
|
||||
if (tempFile.length() > FileUtils.ONE_MB )
|
||||
if (tempFile.length() > FileUtils.ONE_MB)
|
||||
{
|
||||
throw new SchematicTransferException("Schematic is too big (1mb max).");
|
||||
}
|
||||
|
||||
if (plugin.web.getWorldEditPlugin() == null)
|
||||
{
|
||||
throw new SchematicTransferException("WorldEdit is not on the server.");
|
||||
}
|
||||
|
||||
if (!SCHEMATIC_FILENAME_LC.matcher(origFileName.toLowerCase()).find())
|
||||
{
|
||||
throw new SchematicTransferException("File name must be alphanumeric, between 1 and 30 characters long (inclusive), and have a \".schematic\" extension.");
|
||||
@ -206,10 +213,18 @@ public class Module_schematic extends HTTPDModule
|
||||
throw new SchematicTransferException("Schematic already exists on the server.");
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
FileUtils.copyFile(tempFile, targetFile);
|
||||
ClipboardFormat format = ClipboardFormats.findByFile(targetFile);
|
||||
if (format == null)
|
||||
{
|
||||
FileUtils.deleteQuietly(targetFile);
|
||||
throw new SchematicTransferException("Schematic is not a valid schematic.");
|
||||
}
|
||||
FLog.info(remoteAddress + " uploaded schematic: " + targetFile.getName());
|
||||
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user