Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. public void onPluginMessageReceived(final String channel, final Player player, final byte[] bytes) {
  2. if (!channel.equals("ngguard")) {
  3. return;
  4. }
  5. try {
  6. final ByteArrayDataInput input = ByteStreams.newDataInput(bytes);
  7. // final String[] data = input.readUTF().split(";");
  8. int bytesCount = input.readInt();
  9. System.out.println(bytesCount + "-----------bytesCount----------");
  10. byte[] dataa = new byte[bytesCount];
  11. System.out.println(dataa + "---------------dataa---------------");
  12. for (int i = 0; i < bytesCount; i++) {
  13. dataa[i] = input.readByte();
  14. }
  15. final String[] data = new String(dataa).split(";");
  16. // int e = input.readableBytes();
  17. final Player sender = Bukkit.getPlayer(data[0]);
  18. if (data[0].equals("srvAuth")) {
  19. this.logger.addLog(player.getName(), "no", data[1]);
  20. }
  21. else {
  22. int count = Integer.parseInt(data[2]);
  23. if(count >= 1){
  24. if (sender == null) {
  25. Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "[NightGuard_Console]" + ChatColor.WHITE + " Screenshot["+count+"] from " + ChatColor.GOLD + player.getName() + ": " + ChatColor.WHITE + data[1]);
  26. this.logger.addLog(player.getName(), "Console[" + count + "]", data[1]);
  27. }
  28. else {
  29.  
  30. sender.sendMessage(ChatColor.GOLD + "[NightGuard]" + ChatColor.WHITE + " Screenshot["+count+"] from " + player.getName() + ": " + data[1]);
  31. Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "[NightGuard_Console]" + ChatColor.WHITE + " Screenshot from["+count+"] " + ChatColor.GOLD + player.getName() + ": " + ChatColor.WHITE + data[1] + "." +" Customer: " + ChatColor.RED + data[0]);
  32. this.logger.addLog(player.getName(), data[0]+"["+count+"]", data[1]);
  33. }
  34.  
  35. }
  36. if (sender == null) {
  37. Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "[NightGuard_Console]" + ChatColor.WHITE + " Screenshot from " + ChatColor.GOLD + player.getName() + ": " + ChatColor.WHITE + data[1]);
  38. this.logger.addLog(player.getName(), "Console", data[1]);
  39. }
  40. else {
  41.  
  42. sender.sendMessage(ChatColor.GOLD + "[NightGuard]" + ChatColor.WHITE + " Screenshot from " + player.getName() + ": " + data[1]);
  43. Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "[NightGuard_Console]" + ChatColor.WHITE + " Screenshot from" + ChatColor.GOLD + player.getName() + ": " + ChatColor.WHITE + data[1] + "." +" Customer: " + ChatColor.RED + data[0]);
  44. this.logger.addLog(player.getName(), data[0], data[1]);
  45. }
  46. }
  47. }
  48. catch (Exception e) {
  49. e.printStackTrace();
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement