Readied Powers for Testing

Also added a *shit* ton of comments
This commit is contained in:
alisolarflare 2016-10-21 21:50:31 -04:00
parent ede758e2b5
commit 488bee5801
6 changed files with 24 additions and 17 deletions

View file

@ -13,3 +13,5 @@ commands:
description: Sets the flair door colour mode, when lighting portals
flairme:
description: Activates the Flair Me Command. Ask Ali, she was fucking tired when writing this description
gpowercommand:
description: Testing command for ghostie powers

View file

@ -7,7 +7,8 @@ import org.bukkit.plugin.PluginDescriptionFile;
import alisolarflare.flairdoors.FlairMe;
import alisolarflare.flairdoors.PortalListener;
import alisolarflare.flairdoors.SetFlairDoorColour;
import alisolarflare.links.AliLinkSubPlug;
import alisolarflare.gpowers.gPowerCommand;
import alisolarflare.gpowers.listeners.gPowerListener;
//import alisolarflare.links.AliLinkSubPlug;
import org.bukkit.plugin.java.JavaPlugin;
@ -31,13 +32,14 @@ public class AliPresents extends JavaPlugin{
}
private void registerEvents() {
getServer().getPluginManager().registerEvents(new PortalListener(this), this);
getServer().getPluginManager().registerEvents(new gPowerListener(this), this);
}
public void registerSubPlugins(){
//AliLinkSubPlug alilinksubplugin = new AliLinkSubPlug(this);
//alilinksubplugin.register();
}
public void registerCommands(){
getCommand("gPowerCommand").setExecutor(new gPowerCommand());
getCommand("flairme").setExecutor(new FlairMe());
getCommand("alishulker").setExecutor(new AliShulker());
getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour());

View file

@ -9,6 +9,7 @@ public class gPowerCommand implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
sender.sendMessage("G power activate!");
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
@ -20,6 +21,7 @@ public class gPowerCommand implements CommandExecutor{
return false;
}
String colour;
player.sendMessage("Checking terms...");
if(args[0].startsWith("r") ||
args[0].startsWith("o")||
args[0].startsWith("y")||
@ -28,7 +30,7 @@ public class gPowerCommand implements CommandExecutor{
args[0].startsWith("p")){
colour = args[0];
}else{
player.sendMessage("Proper Usage to test G-Powers:");
player.sendMessage("Term Fail: COLOUR. Proper Usage to test G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
return false;
}
@ -38,10 +40,11 @@ public class gPowerCommand implements CommandExecutor{
}else if (args[1].startsWith("f")){
isActive = false;
}else{
player.sendMessage("Proper Usage to test G-Powers:");
player.sendMessage("Term Fail: ACTIVE. Proper Usage to test G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
return false;
}
player.sendMessage("Terms Vaild!");
if(isActive){
gPowerMemory.PowerUpPlayer(player, colour);
}else{

View file

@ -9,16 +9,17 @@ import org.bukkit.entity.Player;
import alisolarflare.AliPresents;
public class gPowerMemory {
private AliPresents plugin;
private boolean debugMode = true;
private static AliPresents plugin;
private static boolean debugMode = true;
public gPowerMemory(AliPresents plugin){
this.plugin = plugin;
gPowerMemory.plugin = plugin;
}
//SHORT TERM MEMORY STORAGE
public static Map<UUID, poweredPlayer> PlayerMap = new HashMap<UUID, poweredPlayer>();
//POWER ACTIVATION
public static void PowerUpPlayer(Player player, String colour){
debug("POWERRRED UP");
if (PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).playerPowersActivated = true;
}else{
@ -28,6 +29,7 @@ public class gPowerMemory {
//POWER DEACTIVATION
public static void PowerDownPlayer(Player player){
debug("POWERRRED DOWN");
if (PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).playerPowersActivated = false;
}else{
@ -36,6 +38,7 @@ public class gPowerMemory {
}
public static void PowerDownPlayer(UUID UniqueID){
debug("POWEERRED DOWN");
if (PlayerMap.containsKey(UniqueID)){
PlayerMap.get(UniqueID).playerPowersActivated = false;
}else{
@ -43,6 +46,7 @@ public class gPowerMemory {
}
}
public static boolean isPlayerPowered(UUID UniqueID){
debug("IS PLAYER POWERED?");
if (PlayerMap.containsKey(UniqueID)){
return PlayerMap.get(UniqueID).playerPowersActivated;
}else{
@ -50,6 +54,7 @@ public class gPowerMemory {
}
}
public static boolean isPlayerPowered(Player player){
debug("IS PLAYER POWERED?");
if (PlayerMap.containsKey(player.getUniqueId())){
return PlayerMap.get(player.getUniqueId()).playerPowersActivated;
}else{
@ -74,7 +79,7 @@ public class gPowerMemory {
//DEBUG
@SuppressWarnings({ "deprecation" })
public void debug(String debugString){
public static void debug(String debugString){
if (plugin.getServer().getPlayer("alisolarflare").isOnline() && debugMode == true){
plugin.getServer().getPlayer("alisolarflare").sendMessage("[gPowerTest]:"+debugString);
}

View file

@ -1,5 +0,0 @@
package alisolarflare.gpowers;
public class gPowers {
}

View file

@ -7,12 +7,12 @@ import alisolarflare.AliPresents;
public class gPowerListener implements Listener{
private AliPresents plugin;
public gPowerApplyingTask powerRepeatingTask;
public gPowerApplyingTask powerApplyingTask;
public BukkitTask bukkitTask;
public gPowerListener(AliPresents plugin){
this.plugin = plugin;
this.powerRepeatingTask = new gPowerApplyingTask(this.plugin);
bukkitTask = powerRepeatingTask.runTaskTimer(plugin, 5, 5);
this.powerApplyingTask = new gPowerApplyingTask(this.plugin);
bukkitTask = powerApplyingTask.runTaskTimer(plugin, 5, 5);
}
}