mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-10-03 23:34:15 +00:00
224c18348a
Many commands have been cleaned. File changes: - all user data has been moved from users.yml to userdata folder - all files in userdata folder are lower case Both changes should be done automatically. Class changes: - Moved all user data functions to UserData class - Moved all user teleport functions to Teleport class - Moved the user list to Essentials class - Less static functions for better testing - EssentialsCommand now has ess Property (Essentials class) - New NotEnoughArgumentsException, that will show command description and syntax New commands: - /seen, shows the last login or logout - /tempban, temporarily ban someone - /tjail and mute, temporarily option added Other changes: - ban reason is saved - don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission - time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
56 lines
1.1 KiB
Java
56 lines
1.1 KiB
Java
package com.earth2me.essentials.commands;
|
|
|
|
import org.bukkit.Server;
|
|
import com.earth2me.essentials.User;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
public class Commandtpall extends EssentialsCommand
|
|
{
|
|
public Commandtpall()
|
|
{
|
|
super("tpall");
|
|
}
|
|
|
|
@Override
|
|
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
|
{
|
|
if (args.length < 1)
|
|
{
|
|
if (sender instanceof Player)
|
|
{
|
|
charge(sender);
|
|
teleportAllPlayers(server, sender, ess.getUser(sender));
|
|
return;
|
|
}
|
|
throw new NotEnoughArgumentsException();
|
|
}
|
|
|
|
User p = getPlayer(server, args, 0);
|
|
charge(sender);
|
|
teleportAllPlayers(server, sender, p);
|
|
}
|
|
|
|
private void teleportAllPlayers(Server server, CommandSender sender, User p)
|
|
{
|
|
sender.sendMessage("§7Teleporting all players...");
|
|
for (Player player : server.getOnlinePlayers())
|
|
{
|
|
User u = ess.getUser(player);
|
|
if (p == u)
|
|
{
|
|
continue;
|
|
}
|
|
try
|
|
{
|
|
u.getTeleport().now(p);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sender.sendMessage("Error: "+ex.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|