From 405fb19111a33886ea529d13837fed38e63a9db8 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 5 Nov 2016 08:37:27 -0400 Subject: [PATCH] Finally finished flairdoors --- pom.xml | 155 +++++++++--------- .../flairdoor/listeners/PortalListener.java | 16 +- .../components/gpowers/commands/GPower.java | 5 +- 3 files changed, 97 insertions(+), 79 deletions(-) diff --git a/pom.xml b/pom.xml index 81da534..ee690c6 100644 --- a/pom.xml +++ b/pom.xml @@ -1,73 +1,82 @@ - - 4.0.0 - com.github.tbmcplugins - AliPresents - 0.0.1-SNAPSHOT - AliPresents - A bucket of aaall the stuff Ali makes. It's a bit smelly. - - src - - - src - - **/*.java - - - - . - - *.yml - - - - - - maven-compiler-plugin - 3.3 - - 1.8 - 1.8 - - - - - - UTF-8 - - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - jcenter - http://jcenter.bintray.com - - - jitpack.io - https://jitpack.io - - - - - - org.spigotmc - spigot-api - 1.9.2-R0.1-SNAPSHOT - - - - org.apache.commons - commons-lang3 - 3.4 - - - com.github.TBMCPlugins.ButtonCore - ButtonCore - master-SNAPSHOT - - - + + 4.0.0 + com.github.tbmcplugins + AliPresents + 0.0.1-SNAPSHOT + AliPresents + A bucket of aaall the stuff Ali makes. It's a bit smelly. + + src + + + src + + **/*.java + + + + . + + *.yml + + + + + + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + + + + + UTF-8 + + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + jcenter + http://jcenter.bintray.com + + + jitpack.io + https://jitpack.io + + + ess-repo + http://repo.ess3.net + + + + + + org.spigotmc + spigot-api + 1.9.2-R0.1-SNAPSHOT + + + + org.apache.commons + commons-lang3 + 3.4 + + + com.github.TBMCPlugins.ButtonCore + ButtonCore + master-SNAPSHOT + + + net.ess3 + Essentials + 2.13.1 + + + diff --git a/src/alisolarflare/components/flairdoor/listeners/PortalListener.java b/src/alisolarflare/components/flairdoor/listeners/PortalListener.java index a905dbd..9058bd7 100644 --- a/src/alisolarflare/components/flairdoor/listeners/PortalListener.java +++ b/src/alisolarflare/components/flairdoor/listeners/PortalListener.java @@ -3,6 +3,7 @@ package alisolarflare.components.flairdoor.listeners; import java.util.ArrayList; import java.util.List; +import org.bukkit.Bukkit; import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.block.Block; @@ -14,13 +15,18 @@ import org.bukkit.material.MaterialData; import org.bukkit.material.Wool; import org.bukkit.plugin.java.JavaPlugin; +import com.earth2me.essentials.Essentials; +import com.earth2me.essentials.User; + public class PortalListener implements Listener{ public static List playersToBeFlaired = new ArrayList(); public JavaPlugin plugin; - + + Essentials essentials; public PortalListener(JavaPlugin plugin) { this.plugin = plugin; + this.essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials")); } @EventHandler public void onPortalEnter(PlayerPortalEvent event){ @@ -86,8 +92,10 @@ public class PortalListener implements Listener{ } public void recolourPlayer(Player player, DyeColor dyecolour){ + User user = essentials.getUser(player); + player.sendMessage("Recolouring Player as..." + dyecolour.toString()); - String name = player.getName(); + String name = user.getNickname(); player.sendMessage("name:" + name); String tempName = ""; for(int i = 0; i < name.length(); i++){ @@ -136,8 +144,8 @@ public class PortalListener implements Listener{ player.sendMessage("ERROR, PORTAL HAS INVALID UNDER-BLOCK"); break; } - player.setCustomName(name); - player.sendMessage("Your name is now: " + player.getCustomName() +"! Removing you from playersToBeFlaired..."); + user.setNickname(name); + player.sendMessage("Your name is now: " + user.getNickname() +"! Removing you from playersToBeFlaired..."); playersToBeFlaired.remove(player.getName()); } } diff --git a/src/alisolarflare/components/gpowers/commands/GPower.java b/src/alisolarflare/components/gpowers/commands/GPower.java index 4b68ff0..4a90d21 100644 --- a/src/alisolarflare/components/gpowers/commands/GPower.java +++ b/src/alisolarflare/components/gpowers/commands/GPower.java @@ -3,8 +3,6 @@ package alisolarflare.components.gpowers.commands; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import com.mysql.fabric.xmlrpc.base.Data; - import alisolarflare.components.gpowers.GPowerMemory; import buttondevteam.lib.chat.TBMCCommandBase; @@ -19,6 +17,9 @@ public class GPower extends TBMCCommandBase { @Override public boolean OnCommand(CommandSender sender, String label, String[] args) { sender.sendMessage("G power activate!"); + if (!(sender instanceof Player)){ + sender.sendMessage("You must be a player to use this command! Talk to a dev/ali if you think this is wrong"); + } Player player = (Player) sender; if (args.length < 2) { player.sendMessage("Proper Usage to test G-Powers:");