Vinetos

Créer un plugin Bukkit | #49 - Formattage de la Date

Sep 19th, 2015
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import org.bukkit.command.Command;
  2. import org.bukkit.command.CommandSender;
  3. import org.bukkit.plugin.java.JavaPlugin;
  4.  
  5. import java.text.SimpleDateFormat;
  6. import java.util.Date;
  7.  
  8. /**
  9. * @author VINETOS on 19/09/2015.
  10. */
  11. public class Main extends JavaPlugin {
  12.  
  13. @Override
  14. public void onEnable() {
  15.  
  16. }
  17. private int seconds = 72;
  18.  
  19. @Override
  20. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  21. if(command.getName().equalsIgnoreCase("date")){
  22. //19/09/2015 15:42
  23. String date = new SimpleDateFormat("dd/MM/yy HH:mm").format(new Date(System.currentTimeMillis()));
  24. String date2 = new SimpleDateFormat("mm:ss").format(new Date(seconds * 1000));
  25. sender.sendMessage("§cDate générale: "+date+ " §aDate compte à rebourd: " + date2);
  26. }
  27. return true;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment