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

155
pom.xml
View file

@ -1,73 +1,82 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.github.tbmcplugins</groupId> <groupId>com.github.tbmcplugins</groupId>
<artifactId>AliPresents</artifactId> <artifactId>AliPresents</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>AliPresents</name> <name>AliPresents</name>
<description>A bucket of aaall the stuff Ali makes. It's a bit smelly.</description> <description>A bucket of aaall the stuff Ali makes. It's a bit smelly.</description>
<build> <build>
<sourceDirectory>src</sourceDirectory> <sourceDirectory>src</sourceDirectory>
<resources> <resources>
<resource> <resource>
<directory>src</directory> <directory>src</directory>
<excludes> <excludes>
<exclude>**/*.java</exclude> <exclude>**/*.java</exclude>
</excludes> </excludes>
</resource> </resource>
<resource> <resource>
<directory>.</directory> <directory>.</directory>
<includes> <includes>
<include>*.yml</include> <include>*.yml</include>
</includes> </includes>
</resource> </resource>
</resources> </resources>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version> <version>3.3</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository> </repository>
<repository> <!-- This repo fixes issues with transitive dependencies --> <repository> <!-- This repo fixes issues with transitive dependencies -->
<id>jcenter</id> <id>jcenter</id>
<url>http://jcenter.bintray.com</url> <url>http://jcenter.bintray.com</url>
</repository> </repository>
<repository> <repository>
<id>jitpack.io</id> <id>jitpack.io</id>
<url>https://jitpack.io</url> <url>https://jitpack.io</url>
</repository> </repository>
</repositories> <repository>
<id>ess-repo</id>
<dependencies> <url>http://repo.ess3.net</url>
<dependency> </repository>
<groupId>org.spigotmc</groupId> </repositories>
<artifactId>spigot-api</artifactId>
<version>1.9.2-R0.1-SNAPSHOT</version> <dependencies>
</dependency> <dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --> <groupId>org.spigotmc</groupId>
<dependency> <artifactId>spigot-api</artifactId>
<groupId>org.apache.commons</groupId> <version>1.9.2-R0.1-SNAPSHOT</version>
<artifactId>commons-lang3</artifactId> </dependency>
<version>3.4</version> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
</dependency> <dependency>
<dependency> <groupId>org.apache.commons</groupId>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId> <artifactId>commons-lang3</artifactId>
<artifactId>ButtonCore</artifactId> <version>3.4</version>
<version>master-SNAPSHOT</version> </dependency>
</dependency> <dependency>
</dependencies> <groupId>com.github.TBMCPlugins.ButtonCore</groupId>
</project> <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.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -14,13 +15,18 @@ import org.bukkit.material.MaterialData;
import org.bukkit.material.Wool; import org.bukkit.material.Wool;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
public class PortalListener implements Listener{ public class PortalListener implements Listener{
public static List<String> playersToBeFlaired = new ArrayList<String>(); public static List<String> playersToBeFlaired = new ArrayList<String>();
public JavaPlugin plugin; public JavaPlugin plugin;
Essentials essentials;
public PortalListener(JavaPlugin plugin) { public PortalListener(JavaPlugin plugin) {
this.plugin = plugin; this.plugin = plugin;
this.essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"));
} }
@EventHandler @EventHandler
public void onPortalEnter(PlayerPortalEvent event){ public void onPortalEnter(PlayerPortalEvent event){
@ -86,8 +92,10 @@ public class PortalListener implements Listener{
} }
public void recolourPlayer(Player player, DyeColor dyecolour){ public void recolourPlayer(Player player, DyeColor dyecolour){
User user = essentials.getUser(player);
player.sendMessage("Recolouring Player as..." + dyecolour.toString()); player.sendMessage("Recolouring Player as..." + dyecolour.toString());
String name = player.getName(); String name = user.getNickname();
player.sendMessage("name:" + name); player.sendMessage("name:" + name);
String tempName = ""; String tempName = "";
for(int i = 0; i < name.length(); i++){ 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"); player.sendMessage("ERROR, PORTAL HAS INVALID UNDER-BLOCK");
break; break;
} }
player.setCustomName(name); user.setNickname(name);
player.sendMessage("Your name is now: " + player.getCustomName() +"! Removing you from playersToBeFlaired..."); player.sendMessage("Your name is now: " + user.getNickname() +"! Removing you from playersToBeFlaired...");
playersToBeFlaired.remove(player.getName()); playersToBeFlaired.remove(player.getName());
} }
} }

View file

@ -3,8 +3,6 @@ package alisolarflare.components.gpowers.commands;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.mysql.fabric.xmlrpc.base.Data;
import alisolarflare.components.gpowers.GPowerMemory; import alisolarflare.components.gpowers.GPowerMemory;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
@ -19,6 +17,9 @@ public class GPower extends TBMCCommandBase {
@Override @Override
public boolean OnCommand(CommandSender sender, String label, String[] args) { public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.sendMessage("G power activate!"); 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; Player player = (Player) sender;
if (args.length < 2) { if (args.length < 2) {
player.sendMessage("Proper Usage to test G-Powers:"); player.sendMessage("Proper Usage to test G-Powers:");