1
0
mirror of https://bitbucket.org/HeshamTB/greet.git synced 2024-11-22 05:52:16 +01:00

Update and fixed bed leave ev.

This commit is contained in:
HeshamTB 2018-05-05 01:17:01 +03:00
parent 19d7b7624b
commit daa9efa89f
4 changed files with 31 additions and 17 deletions

Binary file not shown.

Binary file not shown.

View File

@ -23,10 +23,10 @@ public class commands extends JavaPlugin {
public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) {
String greetprefix = ChatColor.AQUA + "[" + ChatColor.BLUE + "greet" + ChatColor.AQUA + "] "; //[ greet ] String greetprefix = ChatColor.AQUA + "[" + ChatColor.BLUE + "greet" + ChatColor.AQUA + "] "; //[ greet ]
Player p = (Player) sender; Player p = (Player) sender;
//use sender class
if(cmd.getName().equalsIgnoreCase("opcheck")) { if(cmd.getName().equalsIgnoreCase("opcheck")) {
String pName = p.getDisplayName(); String pName = p.getDisplayName();

View File

@ -5,22 +5,28 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerBedEnterEvent; 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.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
public class events implements Listener { 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 @EventHandler
public void player(PlayerJoinEvent e) { public void player(PlayerJoinEvent e) {
Player p = e.getPlayer(); p = e.getPlayer();
String pName = p.getDisplayName(); String pName = p.getDisplayName();
e.setJoinMessage(prefix + ChatColor.GRAY + p.getName().toLowerCase() + ChatColor.AQUA + " joined 5radl Server!"); e.setJoinMessage(PREFIX + gray + p.getName().toLowerCase() + aqua + " joined 5radl Server!");
p.sendMessage(ChatColor.AQUA +"Hello " + pName + ", Welcome to 5radl Server"); p.sendMessage(aqua +"Hello " + pName + ", Welcome to 5radl Server");
p.sendMessage(ChatColor.GRAY + "Online Players :"); p.sendMessage(gray + "Online Players :");
int i = 1; int i = 1;
for(Player player : Bukkit.getOnlinePlayers()) { for(Player player : Bukkit.getOnlinePlayers()) {
@ -28,20 +34,28 @@ public class events implements Listener {
i++; i++;
} }
p.sendMessage(ChatColor.AQUA +"Type"+ ChatColor.GREEN +" (/help greet) "+ ChatColor.AQUA+ "for list of new commands"); //p.sendMessage(aqua +"Type"+ ChatColor.GREEN +" (/help greet) "+ aqua+ "for list of new commands");
} }
@EventHandler @EventHandler
public void Quit(PlayerQuitEvent e ) { public void Quit(PlayerQuitEvent e ) {
Player p = e.getPlayer();
e.setQuitMessage(prefix +ChatColor.GRAY + p.getName().toLowerCase() + ChatColor.DARK_RED + " left the server"); p = e.getPlayer();
e.setQuitMessage(PREFIX + gray + p.getName().toLowerCase() + ChatColor.DARK_RED + " left the server");
} }
public void player(PlayerBedEnterEvent e) { //Changed TRY! @EventHandler
Player p = e.getPlayer(); public void player(PlayerBedLeaveEvent e) {
p = e.getPlayer();
Bukkit.getWorld("world").setFullTime(1); Bukkit.getWorld("world").setFullTime(1);
p.sendMessage(prefix+" Good Morning!"); p.sendMessage(PREFIX+" Good Morning!");
} }
@EventHandler
public void player(PlayerItemConsumeEvent e) {e.getPlayer().sendMessage(ChatColor.BOLD+"nom nom nom!");}
} }