Added FirstSeen Module
This commit is contained in:
parent
2e308f2c7b
commit
a900dc18d4
@ -17,6 +17,7 @@ import com.redstoner.modules.clear.Clear;
|
||||
import com.redstoner.modules.clearonjoin.ClearOnJoin;
|
||||
import com.redstoner.modules.cycle.Cycle;
|
||||
import com.redstoner.modules.damnspam.DamnSpam;
|
||||
import com.redstoner.modules.firstseen.FirstSeen;
|
||||
import com.redstoner.modules.illumination.Illumination;
|
||||
import com.redstoner.modules.imout.Imout;
|
||||
import com.redstoner.modules.lagchunks.LagChunks;
|
||||
@ -39,7 +40,7 @@ import com.redstoner.modules.webtoken.WebToken;
|
||||
/** Main class. Duh.
|
||||
*
|
||||
* @author Pepich */
|
||||
@Version(major = 1, minor = 4, revision = 2, compatible = -1)
|
||||
@Version(major = 1, minor = 5, revision = 0, compatible = -1)
|
||||
public class Main extends JavaPlugin
|
||||
{
|
||||
public static JavaPlugin plugin;
|
||||
@ -64,6 +65,7 @@ public class Main extends JavaPlugin
|
||||
ModuleLoader.addModule(Chatgroups.class);
|
||||
ModuleLoader.addModule(Check.class);
|
||||
ModuleLoader.addModule(DamnSpam.class);
|
||||
ModuleLoader.addModule(FirstSeen.class);
|
||||
// TODO: ModuleLoader.addModule(Friends.class);
|
||||
ModuleLoader.addModule(Illumination.class);
|
||||
// TODO: ModuleLoader.addModule(Imbusy.class);
|
||||
|
62
src/com/redstoner/modules/firstseen/FirstSeen.java
Normal file
62
src/com/redstoner/modules/firstseen/FirstSeen.java
Normal file
@ -0,0 +1,62 @@
|
||||
package com.redstoner.modules.firstseen;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.nemez.cmdmgr.Command;
|
||||
import com.redstoner.annotations.Version;
|
||||
import com.redstoner.misc.Utils;
|
||||
import com.redstoner.modules.Module;
|
||||
|
||||
@Version(major = 2, minor = 0, revision = 0, compatible = 2)
|
||||
public class FirstSeen implements Module{
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Command(hook = "firstseenP")
|
||||
public void firstseen(CommandSender sender, String person)
|
||||
{
|
||||
Player player = (Player) sender;
|
||||
Utils.sendMessage(sender, "", "&7Please note that the data may not be fully accurate!", '&');
|
||||
OfflinePlayer oPlayer = Bukkit.getPlayer(person);
|
||||
if (oPlayer == null)
|
||||
oPlayer = Bukkit.getServer().getOfflinePlayer(person);
|
||||
Long firstJoin = oPlayer.getFirstPlayed();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
String disDate = format.format( new Date(firstJoin) );
|
||||
if( disDate.equals("1969-12-31 19:00") ) {
|
||||
Utils.sendMessage(player, null, "&3" + oPlayer.getName() + "&c has never joined.", '&');
|
||||
}
|
||||
else {
|
||||
Utils.sendMessage(player, null, "&3" + oPlayer.getName() + " &efirst joined&a " + disDate + "&e.", '&');
|
||||
}
|
||||
}
|
||||
@Command(hook = "firstseen")
|
||||
public void firstseen(CommandSender sender)
|
||||
{
|
||||
firstseen(sender, sender.getName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getCommandString() {
|
||||
return "command firstseen {\n" +
|
||||
" [empty] {\n" +
|
||||
" run firstseen;\n" +
|
||||
" type player;\n" +
|
||||
" help Gives the date and time they first joined;\n" +
|
||||
" perm utils.firstseen;\n" +
|
||||
" }\n" +
|
||||
" [string:person] {\n" +
|
||||
" run firstseenP person;\n" +
|
||||
" type player;\n" +
|
||||
" help Gives the date and time when a player first joined;\n" +
|
||||
" perm utils.firstseen.other;\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user