Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ public CreateCommand(MultiverseCore plugin) {
this.addCommandExample("/mv create " + ChatColor.GOLD + "moonworld" + ChatColor.GREEN + " normal" + ChatColor.DARK_AQUA + " -g BukkitFullOfMoon");
this.worldManager = this.plugin.getMVWorldManager();
}


private String trimWorldName(String userInput) {
// Removes relative paths.
return userInput.replaceAll("^[./\\\\]+", "");
}
Comment thread
nicegamer7 marked this conversation as resolved.

@Override
public void runCommand(CommandSender sender, List<String> args) {
String worldName = args.get(0);
String worldName = trimWorldName(args.get(0));
File worldFile = new File(this.plugin.getServer().getWorldContainer(), worldName);
String env = args.get(1);
String seed = CommandHandler.getFlag("-s", args);
Expand All @@ -66,7 +71,13 @@ public void runCommand(CommandSender sender, List<String> args) {
useSpawnAdjust = false;
}
}


// Make sure the world name doesn't contain the words 'plugins' and '.dat'
if(worldName.contains("plugins")||worldName.contains(".dat")){
sender.sendMessage(ChatColor.RED + "Multiverse cannot create a world that contains 'plugins' or '.dat'");
return;
}
Comment thread
benwoo1110 marked this conversation as resolved.

if (this.worldManager.isMVWorld(worldName)) {
sender.sendMessage(ChatColor.RED + "Multiverse cannot create " + ChatColor.GOLD + ChatColor.UNDERLINE
+ "another" + ChatColor.RESET + ChatColor.RED + " world named " + worldName);
Expand Down Expand Up @@ -117,4 +128,4 @@ public void runCommand(CommandSender sender, List<String> args) {
Command.broadcastCommandMessage(sender, "FAILED.");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ public void runCommand(CommandSender sender, List<String> args) {
this.showHelp(sender);
return;
}

// Make sure the world name doesn't contain the words 'plugins' and '.dat'
if(worldName.contains("plugins")||worldName.contains(".dat")){
sender.sendMessage(ChatColor.RED + "Multiverse cannot create a world that contains 'plugins' or '.dat'");
return;
}
Comment thread
benwoo1110 marked this conversation as resolved.

// Make sure we don't already know about this world.
if (this.worldManager.isMVWorld(worldName)) {
Expand Down Expand Up @@ -168,4 +174,4 @@ public void runCommand(CommandSender sender, List<String> args) {
Command.broadcastCommandMessage(sender, ChatColor.RED + "Failed!");
}
}
}
}
Comment thread
benwoo1110 marked this conversation as resolved.