diff --git a/bin/i/hesh/greet/events.class b/bin/i/hesh/greet/events.class index c5a8c0d..1a148b9 100644 Binary files a/bin/i/hesh/greet/events.class and b/bin/i/hesh/greet/events.class differ diff --git a/builds/greet.jar b/builds/greet.jar index 633de72..6c17a36 100644 Binary files a/builds/greet.jar and b/builds/greet.jar differ diff --git a/src/i/hesh/greet/commands.java b/src/i/hesh/greet/commands.java index f45f2e9..9e0566b 100644 --- a/src/i/hesh/greet/commands.java +++ b/src/i/hesh/greet/commands.java @@ -23,10 +23,10 @@ public class commands extends JavaPlugin { public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) { + String greetprefix = ChatColor.AQUA + "[" + ChatColor.BLUE + "greet" + ChatColor.AQUA + "] "; //[ greet ] Player p = (Player) sender; - //use sender class if(cmd.getName().equalsIgnoreCase("opcheck")) { String pName = p.getDisplayName(); diff --git a/src/i/hesh/greet/events.java b/src/i/hesh/greet/events.java index 43cff28..7442cab 100644 --- a/src/i/hesh/greet/events.java +++ b/src/i/hesh/greet/events.java @@ -5,43 +5,57 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerBedEnterEvent; +import org.bukkit.event.player.PlayerBedLeaveEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; public class events implements Listener { - String prefix = ChatColor.AQUA + "[" + ChatColor.BLUE + "5radl" + ChatColor.AQUA + "] "; //[ 5radl ] + private final String PREFIX = ChatColor.AQUA + "[" + ChatColor.BLUE + "5radl" + ChatColor.AQUA + "] "; //[ 5radl ] + Player p; + ChatColor aqua = ChatColor.AQUA; + ChatColor gray = ChatColor.GRAY; @EventHandler public void player(PlayerJoinEvent e) { - Player p = e.getPlayer(); + p = e.getPlayer(); String pName = p.getDisplayName(); - e.setJoinMessage(prefix + ChatColor.GRAY + p.getName().toLowerCase() + ChatColor.AQUA + " joined 5radl Server!"); - p.sendMessage(ChatColor.AQUA +"Hello " + pName + ", Welcome to 5radl Server"); - p.sendMessage(ChatColor.GRAY + "Online Players :"); + e.setJoinMessage(PREFIX + gray + p.getName().toLowerCase() + aqua + " joined 5radl Server!"); + p.sendMessage(aqua +"Hello " + pName + ", Welcome to 5radl Server"); + p.sendMessage(gray + "Online Players :"); int i = 1; for(Player player : Bukkit.getOnlinePlayers()) { p.sendMessage(ChatColor.RED + "" + i + "- " + player.getName()); i++; } - - p.sendMessage(ChatColor.AQUA +"Type"+ ChatColor.GREEN +" (/help greet) "+ ChatColor.AQUA+ "for list of new commands"); - } - @EventHandler - public void Quit(PlayerQuitEvent e ) { - Player p = e.getPlayer(); - e.setQuitMessage(prefix +ChatColor.GRAY + p.getName().toLowerCase() + ChatColor.DARK_RED + " left the server"); + + //p.sendMessage(aqua +"Type"+ ChatColor.GREEN +" (/help greet) "+ aqua+ "for list of new commands"); } - public void player(PlayerBedEnterEvent e) { //Changed TRY! - Player p = e.getPlayer(); - Bukkit.getWorld("world").setFullTime(1); - p.sendMessage(prefix+" Good Morning!"); + @EventHandler + public void Quit(PlayerQuitEvent e ) { + p = e.getPlayer(); + e.setQuitMessage(PREFIX + gray + p.getName().toLowerCase() + ChatColor.DARK_RED + " left the server"); } + + @EventHandler + public void player(PlayerBedLeaveEvent e) { + + p = e.getPlayer(); + Bukkit.getWorld("world").setFullTime(1); + p.sendMessage(PREFIX+" Good Morning!"); + + } + @EventHandler + public void player(PlayerItemConsumeEvent e) {e.getPlayer().sendMessage(ChatColor.BOLD+"nom nom nom!");} + + }