From 1053249962d93ddb4edf475d30796f82e0856cf8 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Thu, 25 Aug 2016 03:47:18 -0400 Subject: [PATCH] Fixed bullshit. Made an error with the type of listener --- src/alisolarflare/AliPresents.java | 18 +++++++++--- .../flairdoors/FlairDoorsSubPlug.java | 10 +++---- .../flairdoors/PortalListener.java | 29 ++++++++++++++++--- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/src/alisolarflare/AliPresents.java b/src/alisolarflare/AliPresents.java index e8764f5..b9b2484 100644 --- a/src/alisolarflare/AliPresents.java +++ b/src/alisolarflare/AliPresents.java @@ -3,7 +3,10 @@ package alisolarflare; import java.util.logging.Logger; import org.bukkit.plugin.PluginDescriptionFile; -import alisolarflare.links.AliLinkSubPlug; + +import alisolarflare.flairdoors.PortalListener; +import alisolarflare.flairdoors.SetFlairDoorColour; +//import alisolarflare.links.AliLinkSubPlug; import org.bukkit.plugin.java.JavaPlugin; import alisolarflare.shulker.AliShulker; @@ -15,18 +18,25 @@ public class AliPresents extends JavaPlugin{ logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ")."); - registerSubPlugins(); + //registerSubPlugins(); registerCommands(); + registerEvents(); logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ")."); + } + private void registerEvents() { + getServer().getPluginManager().registerEvents(new PortalListener(this), this); + } public void registerSubPlugins(){ - AliLinkSubPlug alilinksubplugin = new AliLinkSubPlug(this); - alilinksubplugin.register(); + //AliLinkSubPlug alilinksubplugin = new AliLinkSubPlug(this); + //alilinksubplugin.register(); } public void registerCommands(){ getCommand("alishulker").setExecutor(new AliShulker()); + getCommand("SetFlairDoorColour").setExecutor(new SetFlairDoorColour()); + } } diff --git a/src/alisolarflare/flairdoors/FlairDoorsSubPlug.java b/src/alisolarflare/flairdoors/FlairDoorsSubPlug.java index 9e3bfce..e9d89a0 100644 --- a/src/alisolarflare/flairdoors/FlairDoorsSubPlug.java +++ b/src/alisolarflare/flairdoors/FlairDoorsSubPlug.java @@ -1,23 +1,21 @@ package alisolarflare.flairdoors; -import alisolarflare.AliPresents; +//import alisolarflare.AliPresents; public class FlairDoorsSubPlug{ - private AliPresents plugin; - public FlairDoorsSubPlug(AliPresents plugin){ - this.plugin = plugin; + //private AliPresents plugin; + public FlairDoorsSubPlug(/*AliPresents plugin*/){ + //this.plugin = plugin; } public void register(){ registerCommands(); registerEvents(); } private void registerCommands() { - plugin.getCommand("SetFlairDoorColour").setExecutor(new SetFlairDoorColour()); } private void registerEvents() { // TODO Auto-generated method stub - plugin.getServer().getPluginManager().registerEvents(new PortalListener(plugin), plugin); } } diff --git a/src/alisolarflare/flairdoors/PortalListener.java b/src/alisolarflare/flairdoors/PortalListener.java index 1b51c9e..ed7da82 100644 --- a/src/alisolarflare/flairdoors/PortalListener.java +++ b/src/alisolarflare/flairdoors/PortalListener.java @@ -4,11 +4,11 @@ import java.util.AbstractMap; import java.util.HashMap; import org.bukkit.Location; -import org.bukkit.block.BlockState; -import org.bukkit.entity.Player; +import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityCreatePortalEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.world.PortalCreateEvent; import alisolarflare.AliPresents; @@ -22,7 +22,28 @@ public class PortalListener implements Listener{ public PortalListener(AliPresents plugin) { this.plugin = plugin; } - + @EventHandler + public void onAliRightClick(PlayerInteractEvent event){ + if (event.getPlayer().getName() != "alisolarflare"){ + return; + } + if (event.getClickedBlock().getType() != Material.OBSIDIAN){ + return; + } + if(event.getItem().getType() != Material.FLINT_AND_STEEL && event.getItem().getType() != Material.FIREBALL){ + return; + } + plugin.getServer().broadcastMessage("RIIIIGHTCLICK"); + } + + @EventHandler + public void onPortalLight(PortalCreateEvent event){ + plugin.getServer().broadcastMessage("PORTAL LIIIIIT"); + } + /* + * NOTE: WRONG ENTITY EVENT ALLTOGETHER. + * ENTITY CREATE PORTAL EVENT ONLY TRIGGERS WHEN AN ENDERDRAGON DIES + * @EventHandler public void onPortalLight(EntityCreatePortalEvent event){ plugin.getServer().broadcastMessage("PORTAL LIT WHOOP WHOOP");