SHARE
TWEET

Untitled

a guest Jul 21st, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package TicTacToe;
  2.  
  3. import java.util.HashMap;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandExecutor;
  8. import org.bukkit.command.CommandSender;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.inventory.Inventory;
  11. import org.bukkit.plugin.java.JavaPlugin;
  12.  
  13.  
  14. public class main extends JavaPlugin implements CommandExecutor {
  15.     public void onEnable() {
  16.        
  17.     }
  18.     HashMap<Player,Player> requestTTT = new HashMap<Player,Player>();
  19.     @Override
  20.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  21.         Player p = (Player) sender;
  22.        
  23.         if(cmd.getName().equalsIgnoreCase("tictactoe")) {
  24.             if(args.length == 2) {
  25.             if(args[0].equalsIgnoreCase("request")) {
  26.                
  27.                 Player p2 = Bukkit.getPlayer(args[1]);
  28.                 if(Bukkit.getOnlinePlayers().contains(p2)) {
  29.                     p.sendMessage("§l§3Du hast eine TicTacToe-Anfrage geschickt an " + args[1]);
  30.                     requestTTT.put(p2, p);
  31.                     p2.sendMessage("§l§3Du hast eine TicTacToe-Anfrage erhalten von" + p.getName());
  32.                 }else {
  33.                     p.sendMessage("§l§3Der Spieler konnte nicht eingeladen werden");
  34.                 }
  35.                
  36.             }else if(args[0].equalsIgnoreCase("accept")) {
  37.                 if(requestTTT.containsKey(p)) {
  38.                    
  39.                     Player p2 = requestTTT.get(p);
  40.                     if(p2 != null) {
  41.                         Inventory Tictactoe = Bukkit.createInventory(null, 27, "§3§lTicTacToe");
  42.                         p.openInventory(Tictactoe);
  43.                         p2.openInventory(Tictactoe);
  44.                         requestTTT.remove(p);
  45.                     }else {
  46.                         p.sendMessage("§3§lDer Spieler ist nicht da!");
  47.                         requestTTT.remove(p);
  48.                     }
  49.                    
  50.                 }else {
  51.                     p.sendMessage("§3§lKeiner will mit dir spielen, du *****!(Spaß LuL)");
  52.                 }
  53.             }
  54.         }else {
  55.             p.sendMessage("Fail!");
  56.         }
  57.         }
  58.         return false;
  59.     }
  60.  
  61. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top