svdragster

Untitled

Jun 14th, 2014
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. String worldname = destination.getWorld();
  2.                             WorldManager manager = Canary.getServer().getWorldManager();
  3.                             //if (manager.worldExists(worldname)) {
  4.                                 World world = null;
  5.                                 //Canary.getServer().broadcastMessage(manager.worldExists(worldname) + ", " + manager.worldIsLoaded(worldname, DimensionType.NORMAL));
  6.                                 if (manager.worldIsLoaded(worldname, DimensionType.NORMAL)) {
  7.                                     world = manager.getWorld(worldname, false);
  8.                                 } else {
  9.                                     player.message(Colors.GRAY + "Loading world, please wait...");
  10.                                     world = manager.loadWorld(worldname, DimensionType.NORMAL);
  11.                                 }
  12.                                 if (world != null) { // Basically it shouldn't be null, but who knows. Just making sure.
  13.                                     if (Potioneffects) {
  14.                                         player.addPotionEffect(PotionEffectType.CONFUSION, 140, 1);
  15.                                     }
  16.                                     player.teleportTo(destination.getX()+toaddx, destination.getY(), destination.getZ()+toaddz, 0, dir, world); // destination.getWorld() will actually teleport the player to the world
  17.                                     if (Soundeffects) {
  18.                                         SoundEffect effect = new SoundEffect(Type.ENDERMAN_PORTAL, player.getX(), player.getY(), player.getZ(), 1.0f, 0.6f);
  19.                                         player.getWorld().playSound(effect);
  20.                                     }
  21.                                 } else {
  22.                                     player.notice("There was an error. (world '" + worldname + "' is null)");
  23.                                     travelPortals.LogException(player.getName() + " tried using a portal that is null ('" + worldname + "')!!!");
  24.                                 }
  25.                             /*} else {
  26.                                 player.notice("This portal is pointing to a world(called '" + worldname + "') that does not exist!");
  27.                                 new TravelPortals().LogException(player.getName() + " tried using a portal leading to a nonexistent world called " + worldname + "!");
  28.                             }*/
  29.                            
  30.                         }
Advertisement
Add Comment
Please, Sign In to add comment