/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/HomeCommand.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/HomeCommand.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1665 by torben, Thu Oct 20 17:06:20 2011 UTC revision 1666 by torben, Wed Dec 21 16:42:43 2011 UTC
# Line 41  public class HomeCommand implements Comm Line 41  public class HomeCommand implements Comm
41                  if (!(sender instanceof Player)) {                  if (!(sender instanceof Player)) {
42                          return false;                          return false;
43                  }                  }
44                  Player p = (Player) sender;                  final Player p = (Player) sender;
45    
46                  String name = p.getName();                  String name = p.getName();
47    
# Line 56  public class HomeCommand implements Comm Line 56  public class HomeCommand implements Comm
56                                  double z = config.getDouble( name + ".z", 0.0);                                  double z = config.getDouble( name + ".z", 0.0);
57    
58                                  World world = p.getServer().getWorld(worldName);                                  World world = p.getServer().getWorld(worldName);
59                                    int blockX = (int) Math.floor(x);
60                                    int blockZ = (int) Math.floor(z);
61                                    world.loadChunk(blockX, blockZ);        
62    
63                                    final Location loc = new Location( world, x, y, z, (float)yaw, (float)pitch);
64    
65                                    Runnable r = new Runnable() {
66                                            public void run() {
67                                                    p.teleport(loc);
68                                            }
69                                    };
70                                    int tickCount = 2; // 2 ticks = 100ms
71    
72                                  Location loc = new Location( world, x, y, z, (float)yaw, (float)pitch);                                  p.getServer().getScheduler().scheduleSyncDelayedTask(plugin, r, tickCount);
73    
                                 p.teleport(loc);  
74                          } else {                          } else {
75                                  p.sendMessage(ChatColor.YELLOW + "You haven't set a home yet!");                                  p.sendMessage(ChatColor.YELLOW + "You haven't set a home yet!");
76                          }                          }

Legend:
Removed from v.1665  
changed lines
  Added in v.1666

  ViewVC Help
Powered by ViewVC 1.1.20