Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
- final Player p = (Player) sender;
- if (!sender.hasPermission("spawn.spawn")) {
- sender.sendMessage(ChatColor.RED + "You are not permitted to do this!");
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("spawn")) {
- if (getConfig().getConfigurationSection("spawn") == null) {
- p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("No-Spawn-Message")));
- return true;
- }
- World w = Bukkit.getServer().getWorld(getConfig().getString("spawn.world"));
- double x = getConfig().getDouble("spawn.x");
- double y = getConfig().getDouble("spawn.y");
- double z = getConfig().getDouble("spawn.z");
- float yaw = (float) getConfig().getDouble("spawn.yaw");
- float pitch = (float) getConfig().getDouble("spawn.pitch");
- final Location loc = new Location(w, x, y, z, yaw, pitch);
- if (getConfig().getBoolean("Cancel-On-Move")) {
- if (!tasks.containsKey(p)) {
- tasks.put(p, new BukkitRunnable() {
- @Override
- public void run() {
- p.teleport(loc);
- p.sendMessage(ChatColor.translateAlternateColorCodes('&',
- SS.this.getConfig().getString("Spawn-Message")));
- if (SS.this.getConfig().getBoolean("Spawn-Effect")) {
- p.getWorld().playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 0);
- p.getWorld().playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 0);
- p.getWorld().playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 0);
- p.getWorld().playEffect(p.getLocation(), Effect.ENDER_SIGNAL, 0);
- }
- tasks.remove(p);
- }
- }.runTaskLater(this, 20L * getConfig().getInt("Cooldown")));
- return true;
- }
- }
- //Couple more commands after this//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement