QUOTE: Be someone’s rainbow today.

Added creative world - poppy - A feature-rich Minecraft plugin which enhances gaming experience

poppy

A feature-rich Minecraft plugin which enhances gaming experience
git clone git://192.168.2.2/poppy
Log | Files | Refs | README

commit a2904be26cbb91a692ae7a3140e1033d400d1dd9
parent f77bc2325f70d37ee22e342012219d9389368953
Author: typable <typable.dev@gmail.com>
Date:   Sun,  4 Jul 2021 16:34:12 +0200

Added creative world

Diffstat:
M.vscode/settings.json | 3++-
Mbuild.gradle | 2+-
Mres/plugin.yml | 6++++--
Msrc/de/typable/minecrafthub/Main.java | 32++++++++++++++++++++++++++++++++
Msrc/de/typable/minecrafthub/constant/DefaultConstants.java | 1+
5 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/.vscode/settings.json b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "java.configuration.updateBuildConfiguration": "automatic" + "java.configuration.updateBuildConfiguration": "automatic", + "editor.insertSpaces": false } \ No newline at end of file diff --git a/build.gradle b/build.gradle @@ -50,5 +50,5 @@ task deploy { task local (dependsOn: 'jar', type: Copy) { from project.file('build/libs') - into 'E:/run/spigot-16.5/plugins' + into 'E:/run/spigot-17/plugins' } \ No newline at end of file diff --git a/res/plugin.yml b/res/plugin.yml @@ -10,4 +10,6 @@ commands: usage: /skull <player> standby: usage: /standby <true, false> - kit: -\ No newline at end of file + kit: + world: + usage: /world <name> +\ No newline at end of file diff --git a/src/de/typable/minecrafthub/Main.java b/src/de/typable/minecrafthub/Main.java @@ -10,6 +10,9 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.WorldType; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -113,6 +116,11 @@ public class Main extends JavaPlugin } } }); + + new WorldCreator("creative") + .type(WorldType.FLAT) + .generateStructures(false) + .createWorld(); } @Override @@ -233,6 +241,30 @@ public class Main extends JavaPlugin player.sendMessage(ChatColor.GRAY + "Standby mode is now " + (enabled ? "enabled" : "disabled")); } + + if(label.equals("world")) + { + if(!player.isOp()) + { + player.sendMessage(DefaultConstants.Messages.NOT_ENOUGH_PERMISSION); + return true; + } + + if(args.length != 1) + { + return false; + } + + World world = Bukkit.getWorld(args[0]); + + if(world == null) + { + player.sendMessage(DefaultConstants.Messages.WORLD_NOT_EXIST); + return true; + } + + player.teleport(world.getSpawnLocation()); + } } return true; diff --git a/src/de/typable/minecrafthub/constant/DefaultConstants.java b/src/de/typable/minecrafthub/constant/DefaultConstants.java @@ -12,5 +12,6 @@ public class DefaultConstants public static final String NOT_ENOUGH_PERMISSION = ChatColor.RED + "You don't have enough Permission to perform this command!"; public static final String ALREADY_INGAME = ChatColor.RED + "You're already ingame!"; public static final String NOT_INGAME = ChatColor.RED + "You're not ingame!"; + public static final String WORLD_NOT_EXIST = ChatColor.RED + "This world does not exist!"; } }