mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +00:00
Merge remote-tracking branch 'origin/TFM-1.14' into TFM-1.14
This commit is contained in:
commit
6dcccac2b0
@ -145,7 +145,7 @@ public class ChatManager extends FreedomService
|
|||||||
public void adminChat(CommandSender sender, String message)
|
public void adminChat(CommandSender sender, String message)
|
||||||
{
|
{
|
||||||
Displayable display = plugin.rm.getDisplay(sender);
|
Displayable display = plugin.rm.getDisplay(sender);
|
||||||
FLog.info("[ADMIN] " + sender.getName() + " " + display.getTag() + ": " + message);
|
FLog.info("[ADMIN] " + sender.getName() + " " + display.getTag() + ": " + message, true);
|
||||||
|
|
||||||
for (Player player : server.getOnlinePlayers())
|
for (Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package me.totalfreedom.totalfreedommod.httpd.module;
|
package me.totalfreedom.totalfreedommod.httpd.module;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -195,6 +199,11 @@ public class Module_schematic extends HTTPDModule
|
|||||||
throw new SchematicTransferException("Schematic is too big (1mb max).");
|
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())
|
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.");
|
throw new SchematicTransferException("File name must be alphanumeric, between 1 and 30 characters long (inclusive), and have a \".schematic\" extension.");
|
||||||
@ -206,10 +215,28 @@ public class Module_schematic extends HTTPDModule
|
|||||||
throw new SchematicTransferException("Schematic already exists on the server.");
|
throw new SchematicTransferException("Schematic already exists on the server.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileUtils.copyFile(tempFile, targetFile);
|
FileUtils.copyFile(tempFile, targetFile);
|
||||||
|
ClipboardFormat format = ClipboardFormats.findByFile(targetFile);
|
||||||
|
if (format == null)
|
||||||
|
{
|
||||||
|
FileUtils.deleteQuietly(targetFile);
|
||||||
|
throw new SchematicTransferException("Schematic is not a valid schematic.");
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ClipboardReader reader = format.getReader(new FileInputStream(targetFile));
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
FileUtils.deleteQuietly(targetFile);
|
||||||
|
throw new SchematicTransferException("Schematic is not a valid schematic.");
|
||||||
|
}
|
||||||
|
|
||||||
FLog.info(remoteAddress + " uploaded schematic: " + targetFile.getName());
|
FLog.info(remoteAddress + " uploaded schematic: " + targetFile.getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user