Finally finished flairdoors

This commit is contained in:
alisolarflare 2016-11-05 08:37:27 -04:00
parent 0a01494c4a
commit 405fb19111
3 changed files with 97 additions and 79 deletions

View file

@ -50,6 +50,10 @@
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>ess-repo</id>
<url>http://repo.ess3.net</url>
</repository>
</repositories>
<dependencies>
@ -69,5 +73,10 @@
<artifactId>ButtonCore</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.ess3</groupId>
<artifactId>Essentials</artifactId>
<version>2.13.1</version>
</dependency>
</dependencies>
</project>

View file

@ -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<String> playersToBeFlaired = new ArrayList<String>();
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());
}
}

View file

@ -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:");