Guest User

Untitled

a guest
Jun 17th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.73 KB | None | 0 0
  1. package com.TooManyMobs.bay;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.Location;
  6. import org.bukkit.World;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.event.player.AsyncPlayerChatEvent;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10.  
  11. public class Main extends JavaPlugin {
  12.     public void onAsyncPlayerChat(AsyncPlayerChatEvent event) {
  13.         Player p = event.getPlayer();
  14.         {
  15.         if (event.getMessage().equalsIgnoreCase(".sethome")) {
  16.             int x = p.getLocation().getBlockX();
  17.             int y = p.getLocation().getBlockY();
  18.             int z = p.getLocation().getBlockZ();
  19.             String worldname = p.getWorld().getName();
  20.             getConfig().set("home." + p.getUniqueId() + ".x", x);
  21.             getConfig().set("home." + p.getUniqueId() + ".y", y);
  22.             getConfig().set("home." + p.getUniqueId() + ".z", z);
  23.             getConfig().set("home." + p.getUniqueId() + ".world", worldname);
  24.             p.sendMessage(ChatColor.YELLOW + "Your home has been set!");
  25.             saveConfig();
  26.         }
  27.         if (event.getMessage().equalsIgnoreCase(".home")) {
  28.             int x = getConfig().getInt("home." + p.getUniqueId() + ".x");
  29.             int y = getConfig().getInt("home." + p.getUniqueId() + ".y");
  30.             int z = getConfig().getInt("home." + p.getUniqueId() + ".z");
  31.             String worldname = getConfig().getString("home." + p.getUniqueId() + ".world");
  32.             World world = getServer().getWorld(worldname);
  33.             Location l = new Location (world,x,y,z);
  34.             p.teleport(l);
  35.             p.sendMessage(ChatColor.YELLOW + "You have been sent home!");          
  36.         }
  37.         if (event.getMessage().equalsIgnoreCase(".spawn")) {
  38.             Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "scoreboard players set " + p.getName() + " spawn 10");
  39.             p.sendMessage(ChatColor.YELLOW + "You have been sent to spawn!");
  40.             }
  41.         }
  42.     }
  43. }
Add Comment
Please, Sign In to add comment