forked from lokka30/PhantomWorlds
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start import command. Just have to add output messages.
- Loading branch information
1 parent
6ea8537
commit 08c7a20
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...in/java/me/lokka30/phantomworlds/commands/phantomworlds/parameters/sub/ImportCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package me.lokka30.phantomworlds.commands.phantomworlds.parameters.sub; | ||
/* | ||
* Phantom Worlds | ||
* Copyright (C) 2023 Daniel "creatorfromhell" Vidmar | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import me.lokka30.phantomworlds.PhantomWorlds; | ||
import me.lokka30.phantomworlds.world.PhantomWorld; | ||
import org.bukkit.GameMode; | ||
import org.bukkit.World; | ||
import revxrsal.commands.bukkit.BukkitCommandActor; | ||
|
||
/** | ||
* ImportCommand | ||
* | ||
* @author creatorfromhell | ||
* @since 2.0.5.0 | ||
*/ | ||
public class ImportCommand { | ||
|
||
public static void onCommand(final BukkitCommandActor actor, final World world) { | ||
|
||
if(world == null) { | ||
//TODO: send message world doesn't exist, can't import. | ||
return; | ||
} | ||
|
||
final String cfgPath = "worlds-to-load." + world.getName() + "."; | ||
if(PhantomWorlds.instance().data.getConfig().contains(cfgPath)) { | ||
//TODO: Already a PhantomWorlds managed world. | ||
return; | ||
} | ||
|
||
final PhantomWorld pworld = new PhantomWorld( | ||
world.getName(), world.getEnvironment(), world.canGenerateStructures(), null, | ||
null, world.isHardcore(), world.getSeed(), world.getWorldType(), world.getAllowMonsters(), | ||
world.getAllowAnimals(), world.getKeepSpawnInMemory(), world.getPVP(), world.getDifficulty(), GameMode.SURVIVAL | ||
); | ||
pworld.save(); | ||
//TODO: world imported and will be managed by phantomworlds | ||
} | ||
} |