mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-29 15:49:21 +02:00
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
57 lines
1.5 KiB
Java
57 lines
1.5 KiB
Java
package com.earth2me.essentials.spawn;
|
|
|
|
import java.util.logging.*;
|
|
import com.earth2me.essentials.*;
|
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
|
import org.bukkit.command.*;
|
|
|
|
|
|
public class EssentialsSpawnWorker
|
|
{
|
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
|
|
|
@SuppressWarnings(
|
|
{
|
|
"LoggerStringConcat", "CallToThreadDumpStack"
|
|
})
|
|
public static boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args)
|
|
{
|
|
User user = Essentials.getStatic().getUser(sender);
|
|
|
|
IEssentialsCommand cmd;
|
|
try
|
|
{
|
|
cmd = (IEssentialsCommand)EssentialsSpawn.class.getClassLoader().loadClass("com.earth2me.essentials.spawn.Command" + command.getName()).newInstance();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sender.sendMessage("§cThat command is improperly loaded.");
|
|
ex.printStackTrace();
|
|
return true;
|
|
}
|
|
|
|
// Check authorization
|
|
if (user != null && !user.isAuthorized(cmd))
|
|
{
|
|
logger.warning(user.getName() + " was denied access to command.");
|
|
user.sendMessage("§cYou do not have access to that command.");
|
|
return true;
|
|
}
|
|
|
|
// Run the command
|
|
try
|
|
{
|
|
if (user == null)
|
|
cmd.run(Essentials.getStatic().getServer(), sender, commandLabel, command, args);
|
|
else
|
|
cmd.run(Essentials.getStatic().getServer(), user, commandLabel, command, args);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sender.sendMessage((user == null ? "" : "§c") + "Error: " + ex.getMessage());
|
|
return true;
|
|
}
|
|
}
|
|
}
|