Created the Framework for Ghostie Powers

This commit is contained in:
alisolarflare 2016-10-21 15:23:46 -04:00
parent 39ef99d4ee
commit dd77078ec0
6 changed files with 149 additions and 1 deletions

View file

@ -95,7 +95,7 @@ public class PortalListener implements Listener{
} }
public void recolourPlayer(Player player, DyeColor dyecolour){ public void recolourPlayer(Player player, DyeColor dyecolour){
player.sendMessage("Recolouring Player as..." + dyecolour.toString()); player.sendMessage("Recolouring Player as..." + dyecolour.toString());
String name = player.getCustomName(); String name = player.getName();
player.sendMessage("name:" + name); player.sendMessage("name:" + name);
for(int i = 0; i < name.length(); i++){ for(int i = 0; i < name.length(); i++){
if (name.charAt(i) == '&'){ if (name.charAt(i) == '&'){

View file

@ -0,0 +1,81 @@
package alisolarflare.gpowers;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.Player;
import alisolarflare.AliPresents;
public class gPowerMemory {
private AliPresents plugin;
private boolean debugMode = true;
public gPowerMemory(AliPresents plugin){
this.plugin = plugin;
}
//SHORT TERM MEMORY STORAGE
Map<UUID, poweredPlayer> PlayerMap = new HashMap<UUID, poweredPlayer>();
//POWER ACTIVATION
public void PowerUpPlayer(Player player, String colour){
if (PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).playerPowersActivated = true;
}else{
PlayerMap.put(player.getUniqueId(), new poweredPlayer(player.getUniqueId(), colour, true));
}
}
//POWER DEACTIVATION
public void PowerDownPlayer(Player player){
if (PlayerMap.containsKey(player.getUniqueId())){
PlayerMap.get(player.getUniqueId()).playerPowersActivated = false;
}else{
return;
}
}
public void PowerDownPlayer(UUID UniqueID){
if (PlayerMap.containsKey(UniqueID)){
PlayerMap.get(UniqueID).playerPowersActivated = false;
}else{
return;
}
}
public boolean isPlayerPowered(UUID UniqueID){
if (PlayerMap.containsKey(UniqueID)){
return PlayerMap.get(UniqueID).playerPowersActivated;
}else{
return false;
}
}
public boolean isPlayerPowered(Player player){
if (PlayerMap.containsKey(player.getUniqueId())){
return PlayerMap.get(player.getUniqueId()).playerPowersActivated;
}else{
return false;
}
}
//MEMORY UNIT
class poweredPlayer{
public UUID uuid;
public String colour;
public Boolean playerPowersActivated;
public poweredPlayer(UUID uuid, String colour, Boolean activated){
this.uuid = (uuid);
this.colour = (colour);
this.playerPowersActivated = (activated);
}
public String toString(){
return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+playerPowersActivated + "]";
}
}
@SuppressWarnings({ "deprecation" })
public void debug(String debugString){
if (plugin.getServer().getPlayer("alisolarflare").isOnline() && debugMode == true){
plugin.getServer().getPlayer("alisolarflare").sendMessage("[gPowerTest]:"+debugString);
}
}
}

View file

@ -0,0 +1,26 @@
package alisolarflare.gpowers;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class gPowerTest implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
if (!(args.length < 2)){
player.sendMessage("Proper Usage to test G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
return false;
}
return false;
}
}

View file

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

View file

@ -0,0 +1,30 @@
package alisolarflare.gpowers.listeners;
import org.bukkit.event.Listener;
import org.bukkit.scheduler.BukkitTask;
import alisolarflare.AliPresents;
public class gPowerListener implements Listener{
@SuppressWarnings("unused")
private AliPresents plugin;
public gPowerRepeatingTask powerRepeatingTask;
public BukkitTask bukkitTask;
public gPowerListener(AliPresents plugin){
this.plugin = plugin;
}
}
/*
* public class CyclicalDisplayListener implements Listener{
private final ButtonRebirthPlugin plugin;
public CyclicalDisplayTask cyclicalDisplayTask;
public BukkitTask bukkitTask;
public CyclicalDisplayListener (ButtonRebirthPlugin initPlugin){
plugin = initPlugin;
cyclicalDisplayTask = new CyclicalDisplayTask (this.plugin);
bukkitTask = cyclicalDisplayTask.runTaskTimer(this.plugin, 20, 20);
}
}
*/

View file

@ -0,0 +1,6 @@
package alisolarflare.gpowers.listeners;
public class gPowerRepeatingTask {
//REPEATS EVERY 5 SECONDS
}