Revert "Started work on refactoring Gpowers"
This reverts commit c517296a0a
.
This commit is contained in:
parent
c517296a0a
commit
50f5ccf9c1
5 changed files with 22 additions and 87 deletions
|
@ -1,55 +0,0 @@
|
|||
package buttondevteam.alipresents.components.gpower;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||
import buttondevteam.alipresents.components.gpower.api.GPowerAPI;
|
||||
|
||||
public class ApplyPowerUp extends ModCommand {
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||
if (args.length > 1) //No one's online
|
||||
return false;
|
||||
|
||||
String playerArgument = args[0];
|
||||
|
||||
Player argPlayer = player.getServer().getPlayer(playerArgument);
|
||||
|
||||
if (argPlayer == null)
|
||||
{
|
||||
|
||||
// Attempted player is not online
|
||||
player.sendMessage(playerArgument + " is not online right now. Players online are: ");
|
||||
player.sendMessage(player.getServer().getOnlinePlayers().toString());
|
||||
|
||||
if (args.length < 2){
|
||||
player.sendMessage("You may apply the effect " + args[1] + "to them");
|
||||
}
|
||||
|
||||
}
|
||||
if (args.length < 2){
|
||||
//recolour no colour
|
||||
GPowerAPI.PowerUpPlayer(player);
|
||||
return true;
|
||||
}else{
|
||||
GPowerAPI.PowerUpPlayer(player);
|
||||
//recolour with colour
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public String[] GetHelpText(String string){
|
||||
return new String[]{
|
||||
"Usage: /"+GetCommandPath()+"<player> <colour>",
|
||||
"Use this command to apply a gpower colour to players",
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public String GetCommandPath(){
|
||||
return "gpower applypowerup";
|
||||
}
|
||||
|
||||
}
|
|
@ -15,9 +15,7 @@ public class GPowerComponent extends Component {
|
|||
registerCommand(plugin, new Test());
|
||||
registerCommand(plugin, new PowerUp());
|
||||
registerCommand(plugin, new PowerDown());
|
||||
|
||||
registerCommand(plugin, new ApplyPowerUp());
|
||||
registerCommand(plugin, new ApplyPowerDown());
|
||||
|
||||
registerListener(plugin, new EnchantingLoop(plugin));
|
||||
|
||||
}
|
||||
|
|
|
@ -18,9 +18,6 @@ public class GPowerAPI{
|
|||
public static void addPlayer(Player player, String colour, boolean powerIsActive){
|
||||
poweredPlayerList.put(player.getUniqueId(), new PoweredPlayer(player.getUniqueId(), colour, true));
|
||||
}
|
||||
public static void PowerUpPlayer(Player player, String colour){
|
||||
PowerUpPlayer(player);
|
||||
}
|
||||
public static void PowerUpPlayer(Player player){
|
||||
player.sendMessage("Powering up!");
|
||||
if(poweredPlayerList.containsKey(player.getUniqueId())){
|
||||
|
@ -36,15 +33,14 @@ public class GPowerAPI{
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean PowerDownPlayer(Player player){
|
||||
public static void PowerDownPlayer(Player player){
|
||||
player.sendMessage("Powering down!");
|
||||
if (poweredPlayerList.containsKey(player.getUniqueId())){
|
||||
player.sendMessage("Powered down!");
|
||||
poweredPlayerList.get(player.getUniqueId()).isPowersActive = false;
|
||||
return true;
|
||||
}else{
|
||||
player.sendMessage("P down!");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,19 +7,17 @@ import buttondevteam.alipresents.components.magic.tricks.AliArrowListener;
|
|||
import buttondevteam.alipresents.components.magic.tricks.BoomBowDeathListener;
|
||||
import buttondevteam.alipresents.components.magic.tricks.BoomBowListener;
|
||||
import buttondevteam.alipresents.components.magic.tricks.CannonBowListener;
|
||||
import buttondevteam.alipresents.components.magic.tricks.CannonBowSettings;
|
||||
|
||||
public class MagicComponent extends Component{
|
||||
|
||||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
//registerCommand(plugin, new CannonBowSettings());
|
||||
registerCommand(plugin, new CannonBowSettings());
|
||||
|
||||
registerListener(plugin, new AliArrowListener(plugin));
|
||||
registerListener(plugin, new BoomBowDeathListener());
|
||||
registerListener(plugin, new BoomBowListener(plugin));
|
||||
|
||||
CannonBowListener cbl = new CannonBowListener(plugin);
|
||||
//cbl.loadSettings(plugin.getConfig());
|
||||
registerListener(plugin, cbl);
|
||||
registerListener(plugin, new CannonBowListener(plugin));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,23 @@ public class CannonBowListener implements Listener {
|
|||
static FileConfiguration config;
|
||||
public CannonBowListener(JavaPlugin plugin){
|
||||
config = plugin.getConfig();
|
||||
|
||||
if (config.isDouble(speedMultiplierPath))
|
||||
setSpeedMultiplier(config.getDouble(speedMultiplierPath));
|
||||
|
||||
if (config.isDouble(minForcePath))
|
||||
setMinforce(config.getDouble(minForcePath));
|
||||
|
||||
if (config.isInt(fuseTicksPath))
|
||||
setFuseticks(config.getInt(fuseTicksPath));
|
||||
|
||||
if (config.isDouble(recoilPath))
|
||||
setRecoil(config.getDouble(recoilPath));
|
||||
|
||||
if (config.isBoolean(isDestructivePath))
|
||||
setIsDestructive(config.getBoolean(isDestructivePath));
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onProjectileLaunch(EntityShootBowEvent event){
|
||||
//Entity Sanitation
|
||||
|
@ -232,21 +247,4 @@ public class CannonBowListener implements Listener {
|
|||
CannonBowListener.isDestructive = isDestructive;
|
||||
config.set(speedMultiplierPath, isDestructive);
|
||||
}
|
||||
|
||||
public void loadSettings(FileConfiguration config){
|
||||
if (config.isDouble(speedMultiplierPath))
|
||||
setSpeedMultiplier(config.getDouble(speedMultiplierPath));
|
||||
|
||||
if (config.isDouble(minForcePath))
|
||||
setMinforce(config.getDouble(minForcePath));
|
||||
|
||||
if (config.isInt(fuseTicksPath))
|
||||
setFuseticks(config.getInt(fuseTicksPath));
|
||||
|
||||
if (config.isDouble(recoilPath))
|
||||
setRecoil(config.getDouble(recoilPath));
|
||||
|
||||
if (config.isBoolean(isDestructivePath))
|
||||
setIsDestructive(config.getBoolean(isDestructivePath));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue