001/* 002 * PlotSquared, a land and world management plugin for Minecraft. 003 * Copyright (C) IntellectualSites <https://intellectualsites.com> 004 * Copyright (C) IntellectualSites team and contributors 005 * 006 * This program is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <https://www.gnu.org/licenses/>. 018 */ 019package com.plotsquared.bukkit.managers; 020 021import com.google.inject.Singleton; 022import org.bukkit.Bukkit; 023import org.bukkit.World; 024import org.checkerframework.checker.nullness.qual.NonNull; 025import org.checkerframework.checker.nullness.qual.Nullable; 026 027/** 028 * Multiverse specific manager that informs Multiverse of 029 * world creation by executing a console command 030 * 031 * @deprecated Deprecated and scheduled for removal without replacement 032 * in favor of the build in setup wizard. 033 * However, this class will be kept around for a while, given it's not a maintenance burden. 034 */ 035@Deprecated 036@Singleton 037public class MultiverseWorldManager extends BukkitWorldManager { 038 039 @Override 040 public @Nullable World handleWorldCreation(final @NonNull String worldName, final @Nullable String generator) { 041 // First let Bukkit register the world 042 this.setGenerator(worldName, generator); 043 // Then we send the console command 044 final StringBuilder commandBuilder = new StringBuilder("mv create ") 045 .append(worldName).append(" normal"); 046 if (generator != null) { 047 commandBuilder.append(" -g ").append(generator); 048 } 049 Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), commandBuilder.toString()); 050 return Bukkit.getWorld(worldName); 051 } 052 053 @Override 054 public String getName() { 055 return "bukkit-multiverse"; 056 } 057 058}