Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onPluginMessageReceived(final String channel, final Player player, final byte[] bytes) {
- if (!channel.equals("ngguard")) {
- return;
- }
- try {
- final ByteArrayDataInput input = ByteStreams.newDataInput(bytes);
- // final String[] data = input.readUTF().split(";");
- int bytesCount = input.readInt();
- System.out.println(bytesCount + "-----------bytesCount----------");
- byte[] dataa = new byte[bytesCount];
- System.out.println(dataa + "---------------dataa---------------");
- for (int i = 0; i < bytesCount; i++) {
- dataa[i] = input.readByte();
- }
- final String[] data = new String(dataa).split(";");
- // int e = input.readableBytes();
- final Player sender = Bukkit.getPlayer(data[0]);
- if (data[0].equals("srvAuth")) {
- this.logger.addLog(player.getName(), "no", data[1]);
- }
- else {
- int count = Integer.parseInt(data[2]);
- if(count >= 1){
- if (sender == null) {
- Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "[NightGuard_Console]" + ChatColor.WHITE + " Screenshot["+count+"] from " + ChatColor.GOLD + player.getName() + ": " + ChatColor.WHITE + data[1]);
- this.logger.addLog(player.getName(), "Console[" + count + "]", data[1]);
- }
- else {
- sender.sendMessage(ChatColor.GOLD + "[NightGuard]" + ChatColor.WHITE + " Screenshot["+count+"] from " + player.getName() + ": " + data[1]);
- 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]);
- this.logger.addLog(player.getName(), data[0]+"["+count+"]", data[1]);
- }
- }
- if (sender == null) {
- Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "[NightGuard_Console]" + ChatColor.WHITE + " Screenshot from " + ChatColor.GOLD + player.getName() + ": " + ChatColor.WHITE + data[1]);
- this.logger.addLog(player.getName(), "Console", data[1]);
- }
- else {
- sender.sendMessage(ChatColor.GOLD + "[NightGuard]" + ChatColor.WHITE + " Screenshot from " + player.getName() + ": " + data[1]);
- Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "[NightGuard_Console]" + ChatColor.WHITE + " Screenshot from" + ChatColor.GOLD + player.getName() + ": " + ChatColor.WHITE + data[1] + "." +" Customer: " + ChatColor.RED + data[0]);
- this.logger.addLog(player.getName(), data[0], data[1]);
- }
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement