SHARE
TWEET

Untitled

a guest Jul 16th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package net.maschinenmc.citybuild.commands;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandExecutor;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import net.maschinenmc.citybuild.main.Main;
  9.  
  10. public class MessageCommand implements CommandExecutor {
  11.  
  12.     Main plugin;
  13.    
  14.     public MessageCommand(Main textWarp) {
  15.         plugin = textWarp;
  16.     }
  17.    
  18.     @SuppressWarnings("deprecation")
  19.     @Override
  20.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  21.         if(sender instanceof Player && args.length > 0){
  22.             if(Bukkit.getOfflinePlayer(args[0]).getPlayer() != null){
  23.                 Player messager = (Player) sender;
  24.                 Player reciever = Bukkit.getOfflinePlayer(args[0]).getPlayer();
  25.                 plugin.mM.setReplyTarget(messager, reciever);
  26.                 args[0] = "";
  27.                 String message = "";
  28.                 for(int i = 0; i < args.length; i++){
  29.                     message += " " + args[i];
  30.                 }
  31.                 messager.sendMessage(Main.prefix + " Du zu " + reciever.getName() + ":" + message);
  32.                 reciever.sendMessage(Main.prefix + " " + messager.getName() + " zu dir:" + message);
  33.                 return true;
  34.             } else {
  35.                 sender.sendMessage(Main.prefix + " Dieser Spieler existiert nicht oder ist nicht online!");
  36.                 return true;
  37.             }
  38.            
  39.         }
  40.         return false;
  41.     }
  42.  
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top