Created Working Behaviour

This commit is contained in:
alisolarflare 2016-10-21 22:26:57 -04:00
parent 5962a486cb
commit 09526c3820
4 changed files with 17 additions and 11 deletions

View file

@ -39,7 +39,7 @@ public class AliPresents extends JavaPlugin{
//alilinksubplugin.register();
}
public void registerCommands(){
getCommand("gPowerCommand").setExecutor(new gPowerCommand());
getCommand("gpowercommand").setExecutor(new gPowerCommand());
getCommand("flairme").setExecutor(new FlairMe());
getCommand("alishulker").setExecutor(new AliShulker());
getCommand("setflairdoorcolour").setExecutor(new SetFlairDoorColour());

View file

@ -9,7 +9,9 @@ import org.bukkit.entity.Player;
import alisolarflare.AliPresents;
public class gPowerMemory{
@SuppressWarnings("unused")
private static AliPresents plugin;
@SuppressWarnings("unused")
private static boolean debugMode = true;
public gPowerMemory(AliPresents plugin){
gPowerMemory.plugin = plugin;
@ -19,7 +21,8 @@ public class gPowerMemory {
//POWER ACTIVATION
public static void PowerUpPlayer(Player player, String colour){
debug("POWERRRED UP");
//debug("POWERRRED UP");
player.sendMessage("POWERRED UP!");
if (PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).playerPowersActivated = true;
}else{
@ -29,7 +32,7 @@ public class gPowerMemory {
//POWER DEACTIVATION
public static void PowerDownPlayer(Player player){
debug("POWERRRED DOWN");
//debug("POWERRRED DOWN");
if (PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).playerPowersActivated = false;
}else{
@ -38,7 +41,7 @@ public class gPowerMemory {
}
public static void PowerDownPlayer(UUID UniqueID){
debug("POWEERRED DOWN");
//debug("POWEERRED DOWN");
if (PlayerMap.containsKey(UniqueID)){
PlayerMap.get(UniqueID).playerPowersActivated = false;
}else{
@ -46,7 +49,7 @@ public class gPowerMemory {
}
}
public static boolean isPlayerPowered(UUID UniqueID){
debug("IS PLAYER POWERED?");
//debug("IS PLAYER POWERED?");
if (PlayerMap.containsKey(UniqueID)){
return PlayerMap.get(UniqueID).playerPowersActivated;
}else{
@ -54,7 +57,7 @@ public class gPowerMemory {
}
}
public static boolean isPlayerPowered(Player player){
debug("IS PLAYER POWERED?");
//debug("IS PLAYER POWERED?");
if (PlayerMap.containsKey(player.getUniqueId())){
return PlayerMap.get(player.getUniqueId()).playerPowersActivated;
}else{
@ -77,12 +80,12 @@ public class gPowerMemory {
}
}
//DEBUG
/*DEBUG
@SuppressWarnings({ "deprecation" })
public static void debug(String debugString){
if (plugin.getServer().getPlayer("alisolarflare").isOnline() && debugMode == true){
plugin.getServer().getPlayer("alisolarflare").sendMessage("[gPowerTest]:"+debugString);
}
}
}*/
}

View file

@ -21,6 +21,8 @@ public class gPowerApplyingTask extends BukkitRunnable{
@Override
public void run() {
for (Player player : plugin.getServer().getOnlinePlayers()){
player.sendMessage(player.getUniqueId().toString());
player.sendMessage(gPowerMemory.PlayerMap.toString());
if(gPowerMemory.PlayerMap.containsKey(player.getUniqueId())){
activatePower(player, gPowerMemory.PlayerMap.get(player.getUniqueId()).colour);
}
@ -46,6 +48,7 @@ public class gPowerApplyingTask extends BukkitRunnable{
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 100, 1, true, false, Color.GRAY));
}else if (colour.startsWith("p")){
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 100, 1, true, false, Color.GRAY));
}else{
}
}

View file

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