Demo entry 6636478

Java

   

Submitted by anonymous on Aug 25, 2017 at 04:48
Language: Java. Code size: 4.3 kB.

package com.kitesystems.main;

import org.bukkit.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.command.Command;

import java.util.Calendar;
import java.util.logging.Logger;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
	public final Logger logger;
	public static Command plugin;

	public Main() {
		this.logger = Logger.getLogger("Minecraft");
	}

	
	public void onDisable() {
		final PluginDescriptionFile pdFile = this.getDescription();
		System.out.println(String.valueOf(pdFile.getName()) + pdFile.getVersion() + "이(가) 비활성화 되었습니다.");
	}

	public void onEnable() {
		final PluginDescriptionFile pdFile = this.getDescription();
		System.out.println(String.valueOf(pdFile.getName()) + pdFile.getVersion() + "이(가) 활성화 되었습니다.");
	}

	public boolean onCommand(final CommandSender sender, final Command command, final String commandLabel,
			final String[] args) {
		if (!(sender instanceof Player)) {
			if (commandLabel.equalsIgnoreCase("동시접속자수") | commandLabel.equalsIgnoreCase("동접")) {
				System.out.println("[카이트시스템] 접속자수: " + Bukkit.getOnlinePlayers().size() + " 명");
			}else{
				if(commandLabel.equalsIgnoreCase("시각") || commandLabel.equalsIgnoreCase("현재시각")){
					Calendar now = Calendar.getInstance();
					
					
					int week = now.get(Calendar.DAY_OF_WEEK);
					String strWeek = null;
					
					switch (week) {
					case Calendar.MONDAY:
						strWeek = "월";		
						break;
					case Calendar. TUESDAY:
						strWeek = "화";		
						break;
					case Calendar.WEDNESDAY:
						strWeek = "수";		
						break;
					case Calendar.THURSDAY:
						strWeek = "목";		
						break;
					case Calendar.FRIDAY:
						strWeek = "금";		
						break;
					case Calendar.SATURDAY:
						strWeek = "토";		
						break;

					default:
						strWeek = "일";
						break;
					}
					
					int amPm = now.get(Calendar.AM_PM);
					String strAmPm = null;
					if(amPm == Calendar.AM){
						strAmPm = "오전";
					}else{
						strAmPm = "오후";
					}
					System.out.println("[ Kite 서버  ] 현재 시각: " +(now.get(Calendar.YEAR) + "년 " + (now.get(Calendar.MONTH)+ 1)
					+"월 " +  now.get(Calendar.DAY_OF_MONTH) + "일 " + strWeek + "요일 "  +strAmPm + " " + now.get(Calendar.HOUR) +
					"시 " + now.get(Calendar.MINUTE)+ "분 " + now.get(Calendar.SECOND)+"초"));


				}
			}
		} else {
			final Player player = (Player) sender;
			if (commandLabel.equalsIgnoreCase("동시접속자수") | commandLabel.equalsIgnoreCase("동접")) {
				player.sendMessage(ChatColor.GRAY + "[" + ChatColor.AQUA + "카이트시스템" + ChatColor.GRAY + "]"
						+ ChatColor.GOLD + " 접속자수: " + ChatColor.GREEN + Bukkit.getOnlinePlayers().size()
						+ ChatColor.GOLD + " 명");
			}else{
				if(commandLabel.equalsIgnoreCase("시각") || commandLabel.equalsIgnoreCase("현재시각")){
					Calendar now = Calendar.getInstance();
					
					
					int week = now.get(Calendar.DAY_OF_WEEK);
					String strWeek = null;
					
					switch (week) {
					case Calendar.MONDAY:
						strWeek = "월";		
						break;
					case Calendar. TUESDAY:
						strWeek = "화";		
						break;
					case Calendar.WEDNESDAY:
						strWeek = "수";		
						break;
					case Calendar.THURSDAY:
						strWeek = "목";		
						break;
					case Calendar.FRIDAY:
						strWeek = "금";		
						break;
					case Calendar.SATURDAY:
						strWeek = "토";		
						break;

					default:
						strWeek = "일";
						break;
					}
					
					int amPm = now.get(Calendar.AM_PM);
					String strAmPm = null;
					if(amPm == Calendar.AM){
						strAmPm = "오전";
					}else{
						strAmPm = "오후";
					}
					
					sender.sendMessage(ChatColor.GRAY +"[ " + ChatColor.AQUA + "Kite " + ChatColor.GOLD + "서버" +
					ChatColor.GRAY + " ] " + ChatColor.GOLD + "현재시각: " + ChatColor.GREEN +
							(now.get(Calendar.YEAR) + "년 " + (now.get(Calendar.MONTH)+ 1)
					+"월 " +  now.get(Calendar.DAY_OF_MONTH) + "일 " + strWeek + "요일 " + "" +strAmPm + " " + now.get(Calendar.HOUR) +
					"시 " + now.get(Calendar.MINUTE)+ "분 " + now.get(Calendar.SECOND)+"초"));

				}

			}
		}
		return false;
	}
	
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).