コード例 #1
0
 @Override
 public void a(Packet14BlockDig packet) {
   SpoutCraftPlayer player = (SpoutCraftPlayer) SpoutCraftPlayer.getPlayer(getPlayer());
   boolean inAir = false;
   if (player.canFly() && !player.getHandle().onGround) {
     inAir = true;
     player.getHandle().onGround = true;
   }
   super.a(packet);
   if (inAir) {
     player.getHandle().onGround = false;
   }
 }
コード例 #2
0
 @Override
 public void a(Packet18ArmAnimation packet) {
   if (packet.a == -42) {
     SpoutCraftPlayer player = (SpoutCraftPlayer) SpoutCraftPlayer.getPlayer(getPlayer());
     player.setBuildVersion(1); // Don't know yet, just set above zero
     try {
       Spout.getInstance().playerListener.manager.onSpoutcraftEnable((SpoutPlayer) getPlayer());
     } catch (Exception e) {
       e.printStackTrace();
     }
   } else {
     super.a(packet);
   }
 }
コード例 #3
0
 @Override
 public void a(Packet3Chat packet) {
   String chat = packet.message;
   if (chat.trim().isEmpty()) {
     return;
   }
   if (!allowReload && chat.equalsIgnoreCase("/reload")) {
     allowReload = true;
     SpoutCraftPlayer player = (SpoutCraftPlayer) SpoutCraftPlayer.getPlayer(getPlayer());
     if (!player.isSpoutCraftEnabled()) {
       player.sendMessage(ChatColor.RED + "Spout does not support the /reload command.");
       player.sendMessage(ChatColor.RED + "Unexpected behavior may occur.");
       player.sendMessage(ChatColor.RED + "We recommend using /stop and restarting.");
       player.sendMessage(ChatColor.RED + "Or you can use /spout reload to reload the config.");
       player.sendMessage(
           ChatColor.RED + "If you want to use /reload anyway, use the command again.");
     } else {
       Label warning =
           new DecayingLabel(
               200,
               ChatColor.RED
                   + "Spout does not support the /reload command."
                   + "\n"
                   + ChatColor.RED
                   + "Unexpected behavior may occur."
                   + "\n"
                   + ChatColor.RED
                   + "We recommend using /stop and restarting."
                   + " \n"
                   + ChatColor.RED
                   + "Or you can use /spout reload to reload the config."
                   + "\n"
                   + ChatColor.RED
                   + "If you want to use /reload anyway, use the command again.");
       warning.setX(100).setY(100).setPriority(RenderPriority.Lowest);
       player.getMainScreen().attachWidget(Spout.getInstance(), warning);
     }
     return;
   }
   super.a(packet);
 }