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

@ -12,4 +12,6 @@ commands:
setflairdoorcolour: setflairdoorcolour:
description: Sets the flair door colour mode, when lighting portals description: Sets the flair door colour mode, when lighting portals
flairme: flairme:
description: Activates the Flair Me Command. Ask Ali, she was fucking tired when writing this description 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.FlairMe;
import alisolarflare.flairdoors.PortalListener; import alisolarflare.flairdoors.PortalListener;
import alisolarflare.flairdoors.SetFlairDoorColour; import alisolarflare.flairdoors.SetFlairDoorColour;
import alisolarflare.links.AliLinkSubPlug; import alisolarflare.gpowers.gPowerCommand;
import alisolarflare.gpowers.listeners.gPowerListener;
//import alisolarflare.links.AliLinkSubPlug; //import alisolarflare.links.AliLinkSubPlug;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -31,13 +32,14 @@ public class AliPresents extends JavaPlugin{
} }
private void registerEvents() { private void registerEvents() {
getServer().getPluginManager().registerEvents(new PortalListener(this), this); getServer().getPluginManager().registerEvents(new PortalListener(this), this);
getServer().getPluginManager().registerEvents(new gPowerListener(this), this);
} }
public void registerSubPlugins(){ public void registerSubPlugins(){
//AliLinkSubPlug alilinksubplugin = new AliLinkSubPlug(this); //AliLinkSubPlug alilinksubplugin = new AliLinkSubPlug(this);
//alilinksubplugin.register(); //alilinksubplugin.register();
} }
public void registerCommands(){ public void registerCommands(){
getCommand("gPowerCommand").setExecutor(new gPowerCommand());
getCommand("flairme").setExecutor(new FlairMe()); getCommand("flairme").setExecutor(new FlairMe());
getCommand("alishulker").setExecutor(new AliShulker()); getCommand("alishulker").setExecutor(new AliShulker());
getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour()); getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour());

View file

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

View file

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