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

Bed Event Command

added a command to enable/disable bed leave event
This commit is contained in:
HeshamTB 2018-05-13 02:18:28 +03:00
parent ab43705ec0
commit 40bcb592a6
3 changed files with 38 additions and 4 deletions

View File

@ -16,3 +16,6 @@ commands:
setspwan:
usage: /<command>
description: sets your current location as bed spwan.
beds:
usage: /<command>
description: enable or disable bed feature.

View File

@ -11,8 +11,10 @@ import org.bukkit.plugin.java.JavaPlugin;
public class commands extends JavaPlugin {
public void onEnable() {
protected static boolean IsBedEvent;
public void onEnable() {
IsBedEvent = true;
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.AQUA + "greet plugin is Enabled");
Bukkit.getServer().getPluginManager().registerEvents(new events(), this);
@ -58,6 +60,33 @@ public class commands extends JavaPlugin {
p.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
p.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
}
if (cmd.getName().equalsIgnoreCase("beds")){
if (args[0].equalsIgnoreCase("disable")) {
if (!IsBedEvent) p.sendMessage(greetprefix + "Bed feature is already disabled!");
else {
IsBedEvent = false;
Bukkit.getServer().broadcastMessage(greetprefix + ChatColor.BOLD + ChatColor.DARK_RED + p.getDisplayName() + " has Disabled bed feature");
}
}
else if (args[0].equalsIgnoreCase("enable")) {
if (IsBedEvent) p.sendMessage(greetprefix + "Bed feature is already enabled!");
else {
IsBedEvent = true;
Bukkit.getServer().broadcastMessage(greetprefix + ChatColor.BOLD + ChatColor.DARK_RED + p.getDisplayName() + " has Enabled bed feature");
}
}
else p.sendMessage(greetprefix + "Unknown argument\n Try disable/enable");
}
/*if(cmd.getName().equalsIgnoreCase("setspwan")) { // TODO: give option of new arg to set cords &
p.setBedSpawnLocation(p.getLocation());
p.sendMessage(ChatColor.GREEN +"Your bed Spwan has been updated to currnet location");

View File

@ -47,9 +47,11 @@ public class events implements Listener {
@EventHandler
public void player(PlayerBedLeaveEvent e) {
if (commands.IsBedEvent) {
p = e.getPlayer();
Bukkit.getWorld("world").setFullTime(1);
p.sendMessage(PREFIX+" Good Morning!");
}
}
@EventHandler