Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String worldname = destination.getWorld();
- WorldManager manager = Canary.getServer().getWorldManager();
- //if (manager.worldExists(worldname)) {
- World world = null;
- //Canary.getServer().broadcastMessage(manager.worldExists(worldname) + ", " + manager.worldIsLoaded(worldname, DimensionType.NORMAL));
- if (manager.worldIsLoaded(worldname, DimensionType.NORMAL)) {
- world = manager.getWorld(worldname, false);
- } else {
- player.message(Colors.GRAY + "Loading world, please wait...");
- world = manager.loadWorld(worldname, DimensionType.NORMAL);
- }
- if (world != null) { // Basically it shouldn't be null, but who knows. Just making sure.
- if (Potioneffects) {
- player.addPotionEffect(PotionEffectType.CONFUSION, 140, 1);
- }
- player.teleportTo(destination.getX()+toaddx, destination.getY(), destination.getZ()+toaddz, 0, dir, world); // destination.getWorld() will actually teleport the player to the world
- if (Soundeffects) {
- SoundEffect effect = new SoundEffect(Type.ENDERMAN_PORTAL, player.getX(), player.getY(), player.getZ(), 1.0f, 0.6f);
- player.getWorld().playSound(effect);
- }
- } else {
- player.notice("There was an error. (world '" + worldname + "' is null)");
- travelPortals.LogException(player.getName() + " tried using a portal that is null ('" + worldname + "')!!!");
- }
- /*} else {
- player.notice("This portal is pointing to a world(called '" + worldname + "') that does not exist!");
- new TravelPortals().LogException(player.getName() + " tried using a portal leading to a nonexistent world called " + worldname + "!");
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment