Esempio n. 1
0
  @Subscribe
  public void onJoin(PlayerJoinEvent event) {
    final Player player = event.getUser();
    SpongeUtil.removePlayer(player.getName());
    final PlotPlayer pp = SpongeUtil.getPlayer(player);
    final String username = pp.getName();
    final StringWrapper name = new StringWrapper(username);
    final UUID uuid = pp.getUUID();
    UUIDHandler.add(name, uuid);
    ExpireManager.dates.put(uuid, System.currentTimeMillis());

    // TODO worldedit bypass

    if (PS.get().update != null && pp.hasPermission("plots.admin")) {
      TaskManager.runTaskLater(
          new Runnable() {
            @Override
            public void run() {
              MainUtil.sendMessage(pp, "&6An update for PlotSquared is available: &7/plot update");
            }
          },
          20);
    }
    final Location loc = SpongeUtil.getLocation(player);
    final Plot plot = MainUtil.getPlot(loc);
    if (plot == null) {
      return;
    }
    if (Settings.TELEPORT_ON_LOGIN) {
      MainUtil.teleportPlayer(pp, pp.getLocation(), plot);
      MainUtil.sendMessage(pp, C.TELEPORTED_TO_ROAD);
    }
    PlotListener.plotEntry(pp, plot);
  }
Esempio n. 2
0
 @Override
 public final ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
   WorldEvents.lastWorld = world;
   if (!PS.get().setupPlotWorld(world, id)) {
     return null;
   }
   HybridGen result = new HybridGen(world);
   TaskManager.runTaskLater(
       new Runnable() {
         @Override
         public void run() {
           if (WorldEvents.lastWorld != null && WorldEvents.lastWorld.equals(world)) {
             WorldEvents.lastWorld = null;
           }
         }
       },
       20);
   return result;
 }