-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
742827e
commit e208b6e
Showing
6 changed files
with
114 additions
and
22 deletions.
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
47 changes: 47 additions & 0 deletions
47
src/main/java/io/gitlab/kyleafmine/worldeditor/MainCommand.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,47 @@ | ||
package io.gitlab.kyleafmine.worldeditor; | ||
|
||
import com.grinderwolf.swm.api.SlimePlugin; | ||
import com.grinderwolf.swm.api.exceptions.WorldAlreadyExistsException; | ||
import com.grinderwolf.swm.api.loaders.SlimeLoader; | ||
import com.grinderwolf.swm.api.world.SlimeWorld; | ||
import com.grinderwolf.swm.api.world.properties.SlimeProperties; | ||
import com.grinderwolf.swm.api.world.properties.SlimePropertyMap; | ||
import de.themoep.minedown.MineDown; | ||
import io.gitlab.kyleafmine.worldeditor.menus.WorldListMenu; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.io.IOException; | ||
|
||
public class MainCommand implements CommandExecutor { | ||
|
||
|
||
@Override | ||
public boolean onCommand(@NotNull CommandSender player, @NotNull Command command, @NotNull String label, @NotNull String[] args) { | ||
if (args.length == 2 && args[0].equalsIgnoreCase("create")) { | ||
SlimePropertyMap slp = new SlimePropertyMap(); | ||
slp.setInt(SlimeProperties.SPAWN_Y, 64); | ||
slp.setInt(SlimeProperties.SPAWN_X, 0); | ||
slp.setInt(SlimeProperties.SPAWN_Z, 0); | ||
slp.setBoolean(SlimeProperties.ALLOW_ANIMALS, false); | ||
slp.setBoolean(SlimeProperties.ALLOW_MONSTERS, false); | ||
SlimePlugin s = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager"); | ||
SlimeLoader sl = s.getLoader("mongodb"); | ||
try { | ||
SlimeWorld sw = s.createEmptyWorld(sl, args[1], false, slp); | ||
s.generateWorld(sw); | ||
player.spigot().sendMessage(MineDown.parse("&aCreated empty world &d" + args[1])); | ||
} catch (WorldAlreadyExistsException | IOException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
} else { | ||
new WorldListMenu((Player) player); | ||
} | ||
return true; | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
src/main/java/io/gitlab/kyleafmine/worldeditor/WorldEditorProfile.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 |
---|---|---|
@@ -1,13 +1,23 @@ | ||
package io.gitlab.kyleafmine.worldeditor; | ||
|
||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
public class WorldEditorProfile extends JavaPlugin { | ||
public static WorldEditorProfile instance; | ||
|
||
@Override | ||
public void onLoad() { | ||
super.onLoad(); | ||
} | ||
|
||
@Override | ||
public void onEnable() { | ||
instance = this; | ||
|
||
getLogger().info("So this is a bad idea i don't know if hotloading is great"); | ||
getCommand("worlds").setExecutor(new MainCommand()); | ||
Bukkit.getPluginManager().registerEvents(new ReadOnlyWorldListener(), this); | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
name: WorldEditorPlugin | ||
main: io.gitlab.kyleafmine.worldeditor.WorldEditorProfile | ||
version: 1.0.0 | ||
version: 1.0.2 | ||
api-version: "1.16" | ||
depend: | ||
- SlimeWorldManager | ||
commands: | ||
worlds: | ||
description: Worlds Menu | ||
usage: /worlds |