-
-
Save shawshark/a8c20aa8adb11be5618c to your computer and use it in GitHub Desktop.
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
public static String[] worlds; | |
//onenable. | |
if(config.getString("worlds") != null) { | |
worlds = config.getString("worlds").split(","); | |
for ( String worldName : worlds) { | |
getServer().createWorld(new WorldCreator(worldName)); | |
} | |
} | |
//ondisable | |
String worldNames = ""; | |
for ( World world : getServer().getWorlds()) { | |
if( | |
!world.getName().equalsIgnoreCase("world") || | |
!world.getName().equalsIgnoreCase("world_nether") || | |
!world.getName().equalsIgnoreCase("world_the_end") | |
) { | |
worldNames = worldNames + world.getName() + ","; | |
} | |
} | |
config.set("worlds", worldNames); | |
saveConfig(); | |
//create world command. | |
if(c.getName().equalsIgnoreCase("createworld")) { | |
if(!s.hasPermission("world.create")) { | |
s.sendMessage(ChatColor.RED + "You don't have permissions for this command!"); | |
return true; | |
} | |
if(!(args.length == 1)) { | |
s.sendMessage(ChatColor.GOLD + "Invaild! /createworld [worldname]"); | |
return true; | |
} | |
String worldName = args[0]; | |
for ( World worlds : Bukkit.getWorlds()) { | |
if(worlds.getName().equalsIgnoreCase(worldName)) { | |
s.sendMessage(ChatColor.RED + "World " + worldName + " exists!"); | |
return true; | |
} | |
} | |
//create world. | |
Main.plugin.getServer().createWorld(new WorldCreator(worldName)); | |
s.sendMessage(ChatColor.GOLD + "Created world '" + worldName + "'"); | |
return true; | |
} | |
// world tp command. | |
if(c.getName().equalsIgnoreCase("worldtp")) { | |
if(!s.hasPermission("world.tp")) { | |
s.sendMessage(ChatColor.RED + "You don't have permissions for this command!"); | |
return true; | |
} | |
if(!(args.length == 1)) { | |
s.sendMessage(ChatColor.GOLD + "Invaild! /worldtp [worldname]"); | |
return true; | |
} | |
String worldName = args[0]; | |
for ( World worlds : Bukkit.getWorlds()) { | |
if(worlds.getName().equalsIgnoreCase(worldName)) { | |
s.sendMessage(ChatColor.RED + "World " + worldName + " exists!"); | |
World world = Bukkit.getWorld(worldName); | |
player.teleport(new Location(world, 2, 100, 2)); | |
return true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment