mirror of
https://bitbucket.org/HeshamTB/greet.git
synced 2024-11-05 14:52:15 +01:00
Update and fixed bed leave ev.
This commit is contained in:
parent
19d7b7624b
commit
daa9efa89f
Binary file not shown.
BIN
builds/greet.jar
BIN
builds/greet.jar
Binary file not shown.
@ -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();
|
||||||
|
@ -5,43 +5,57 @@ 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()) {
|
||||||
p.sendMessage(ChatColor.RED + "" + i + "- " + player.getName());
|
p.sendMessage(ChatColor.RED + "" + i + "- " + player.getName());
|
||||||
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
|
|
||||||
public void Quit(PlayerQuitEvent e ) {
|
|
||||||
Player p = e.getPlayer();
|
|
||||||
e.setQuitMessage(prefix +ChatColor.GRAY + p.getName().toLowerCase() + ChatColor.DARK_RED + " left the server");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void player(PlayerBedEnterEvent e) { //Changed TRY!
|
@EventHandler
|
||||||
Player p = e.getPlayer();
|
public void Quit(PlayerQuitEvent e ) {
|
||||||
Bukkit.getWorld("world").setFullTime(1);
|
|
||||||
p.sendMessage(prefix+" Good Morning!");
|
|
||||||
|
|
||||||
|
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!");}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user