From 606642e45efbbfabf93285435ad9b0be4135878a Mon Sep 17 00:00:00 2001 From: Trever Fischer Date: Sun, 1 Apr 2012 15:09:52 -0400 Subject: [PATCH] Implement free half door day --- src/main/java/us/camin/JoinListener.java | 1 + src/main/java/us/camin/Plugin.java | 9 +++++++++ src/main/resources/plugin.yml | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/src/main/java/us/camin/JoinListener.java b/src/main/java/us/camin/JoinListener.java index e819418..9b62e1d 100644 --- a/src/main/java/us/camin/JoinListener.java +++ b/src/main/java/us/camin/JoinListener.java @@ -65,5 +65,6 @@ public class JoinListener implements Listener { @EventHandler public void onPlayerJoin(PlayerJoinEvent event) { m_plugin.sendMOTD(event.getPlayer()); + m_plugin.checkFreeHalfDoorDay(event.getPlayer()); } } diff --git a/src/main/java/us/camin/Plugin.java b/src/main/java/us/camin/Plugin.java index 374f35d..4b072ab 100644 --- a/src/main/java/us/camin/Plugin.java +++ b/src/main/java/us/camin/Plugin.java @@ -24,6 +24,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.inventory.ItemStack; import java.util.HashMap; import java.util.logging.Logger; import java.io.IOException; @@ -62,6 +63,14 @@ public class Plugin extends JavaPlugin { log.info("[Caminus] Plugin enabled"); } + public void checkFreeHalfDoorDay(Player sender) { + if (sender.hasPermission("caminus.freedoorday")) { + ItemStack stack = new ItemStack(64); // Wooden door block + sender.getInventory().addItem(stack); + sender.sendMessage("Happy mandatory free half door day!"); + } + } + public void sendMOTD(CommandSender sender) { String[] motd = null; try { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 6827040..03949e3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -13,6 +13,10 @@ permissions: description: Allows use of all caminus permissions children: caminus.whitelisted: true + caminus.freedoorday: true + caminus.freedoorday: + default: false + description: Enables free half door day caminus.whitelisted: default: op description: Allows user to bypass caminus API whitelisting