Beispiel #1
0
  public static void main(String[] args) {
    Stopwatch watch = new Stopwatch();
    watch.start();

    GlydarBootstrap bootstrap = new GlydarBootstrap(args);
    server = new GServer(bootstrap);
    ParaGlydar.setServer(server);
    serverThread = new Thread(server);

    serverBootstrap = new ServerBootstrap();
    serverBootstrap
        .childHandler(new ProtocolInitializer())
        .option(ChannelOption.TCP_NODELAY, true)
        .option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, 32 * 1024)
        .option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, 64 * 1024)
        .group(new NioEventLoopGroup())
        .channelFactory(
            new ChannelFactory<ServerChannel>() {
              @Override
              public ServerChannel newChannel() {
                return new NioServerSocketChannel();
              }
            })
        .bind(new InetSocketAddress(server.getConfig().getPort()));

    server.setUpWorlds();

    try {
      server.getPluginLoader().loadPlugins();
    } catch (Exception exc) {
      server.getLogger().warning(exc, "Error while loading plugins");
    }

    server.getLogger().info("Server ready on port {0}", server.getConfig().getPort());
    server
        .getLogger()
        .info("This server is running {0} version {1}", server.getName(), server.getVersion());

    watch.stop();
    server.getLogger().info("Server started in {0}ms", watch.elapsed(TimeUnit.MILLISECONDS));

    server.getCommandReader().start();
    serverThread.start();
  }
Beispiel #2
0
public class CWVitals extends Plugin implements ICWVitals {

  public Logger log = ParaGlydar.getServer().getLogger();
  private UserManagement userM;

  @Override
  public void onEnable() {
    log.log(Level.INFO, getName() + getVersion() + " plugin has been enabled.");

    userM = new UserManagement(this);
  }

  @Override
  public void onDisable() {
    log.log(Level.INFO, getName() + getVersion() + " plugin has been disabled.");
  }

  @Override
  public String getAuthor() {
    return "Burnett";
  }

  @Override
  public String getName() {
    return "CW-Vitals";
  }

  @Override
  public String getVersion() {
    return "Version 0.0.1 DEV BUILD: 1";
  }

  public CWUser getUser(Object user) {
    // TODO
    if (user instanceof Player) {
      return getUser(user);
    }

    if (user instanceof String) {}

    return null;
  }

  public CWUser getUser(Player player) {
    // TODO
    if (player == null) {
      return null;
    }

    if (player instanceof CWUser) {
      return (CWUser) player;
    }
    return null;
  }

  public static CWUser getOfflineUser(Player player) {
    // TODO
    return null;
  }

  public void broadcastMessage(String message) {
    // TOD
  }

  public void broadcastMessage(String permission, String message) {
    // TODO
  }

  public void broadcastMessage(ICWUser sender, String message) {
    // TODO
  }

  public void broadcastMessage(ICWUser sender, String Permission, String message) {
    // TODO
  }
}