diff --git a/.classpath b/.classpath index ecb63f0..67a3086 100644 --- a/.classpath +++ b/.classpath @@ -1,11 +1,21 @@ - - + - + - - + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/.project b/.project index c37f58f..5b11ebf 100644 --- a/.project +++ b/.project @@ -10,8 +10,14 @@ + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 3a21537..672496e 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -8,4 +8,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/libs/spigot-1.12.jar b/libs/spigot-1.12.jar deleted file mode 100644 index 01ad3e8..0000000 Binary files a/libs/spigot-1.12.jar and /dev/null differ diff --git a/plugin.yml b/plugin.yml index 8da7983..6c4b0ba 100644 --- a/plugin.yml +++ b/plugin.yml @@ -15,4 +15,7 @@ commands: description: Basic survival kit. setspwan: usage: / - description: sets your current location as bed spwan. \ No newline at end of file + description: sets your current location as bed spwan. + beds: + usage: / + description: enable or disable bed feature. \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..40ed4df --- /dev/null +++ b/pom.xml @@ -0,0 +1,42 @@ + + 4.0.0 + greet + greet + 0.0.1-SNAPSHOT + + src + + + maven-compiler-plugin + 3.7.0 + + 1.8 + 1.8 + + + + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + + + org.spigotmc + spigot-api + 1.12.2-R0.1-SNAPSHOT + provided + + + + org.bukkit + bukkit + 1.12.2-R0.1-SNAPSHOT + provided + + + + \ No newline at end of file diff --git a/src/i/hesh/greet/commands.java b/src/i/hesh/greet/commands.java index 9e0566b..5f3d19f 100644 --- a/src/i/hesh/greet/commands.java +++ b/src/i/hesh/greet/commands.java @@ -11,8 +11,10 @@ import org.bukkit.plugin.java.JavaPlugin; public class commands extends JavaPlugin { + 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); @@ -57,7 +59,34 @@ public class commands extends JavaPlugin { p.getInventory().addItem(new ItemStack(Material.STONE_SWORD)); 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"); diff --git a/src/i/hesh/greet/events.java b/src/i/hesh/greet/events.java index 7442cab..13ef65e 100644 --- a/src/i/hesh/greet/events.java +++ b/src/i/hesh/greet/events.java @@ -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!"); + p.sendMessage(PREFIX+" Good Morning!"); + } } @EventHandler