Moved AliArrows into AliPresents

This commit is contained in:
alisolarflare 2016-10-22 17:47:10 -04:00
parent 5b4e0a28e7
commit 895e9d9611
6 changed files with 119 additions and 5 deletions

View file

@ -15,6 +15,7 @@ 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;
import alisolarflare.shulker.AliShulker; import alisolarflare.shulker.AliShulker;
import alisolarflare.aliarrow.AliArrowSubPlugin;
public class AliPresents extends JavaPlugin{ public class AliPresents extends JavaPlugin{
public void onEnable(){ public void onEnable(){
@ -37,6 +38,8 @@ public class AliPresents extends JavaPlugin{
getServer().getPluginManager().registerEvents(new gPowerListener(this), this); getServer().getPluginManager().registerEvents(new gPowerListener(this), this);
} }
public void registerSubPlugins(){ public void registerSubPlugins(){
AliArrowSubPlugin aliArrowSubPlugin = new AliArrowSubPlugin(this);
aliArrowSubPlugin.register();
//AliLinkSubPlug alilinksubplugin = new AliLinkSubPlug(this); //AliLinkSubPlug alilinksubplugin = new AliLinkSubPlug(this);
//alilinksubplugin.register(); //alilinksubplugin.register();
} }

View file

@ -0,0 +1,45 @@
package alisolarflare.aliarrow;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import alisolarflare.AliPresents;
public class AliArrowListener implements Listener {
private final AliPresents plugin;
public AliArrowListener(AliPresents plugin){
this.plugin = plugin;
}
@EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent event){
try{
if(!(event.getEntity().getType() == EntityType.ARROW)){
return;
}
Projectile projectile = event.getEntity();
Arrow arrow = (Arrow) projectile;
if (!(arrow.isCritical())){
return;
}
if (projectile.getShooter().equals(plugin.getServer().getPlayer("alisolarflare"))){
AliArrowTask aliArrowTask = new AliArrowTask(plugin,arrow,"alisolarflare");
aliArrowTask.runTaskTimer(plugin, 2, 1);
return;
}else if (projectile.getShooter().equals(plugin.getServer().getPlayer("Zanthr"))){
AliArrowTask aliArrowTask = new AliArrowTask(plugin,arrow,"zanthr");
aliArrowTask.runTaskTimer(plugin, 2, 1);
return;
}
return;
}catch(Exception e){
return;
}
}
}

View file

@ -0,0 +1,25 @@
package alisolarflare.aliarrow;
import java.util.logging.Level;
import alisolarflare.AliPresents;
public class AliArrowSubPlugin {
private AliPresents plugin;
public AliArrowSubPlugin(AliPresents plugin){
this.plugin = plugin;
}
public void register(){
registerEvents();
registerCommands();
plugin.getLogger().log(Level.INFO, "Discord Sub Plugin Registered!");
}
private void registerEvents(){
plugin.getServer().getPluginManager().registerEvents(new AliArrowListener(plugin), plugin);
}
private void registerCommands(){
}
}

View file

@ -0,0 +1,40 @@
package alisolarflare.aliarrow;
import org.bukkit.Particle;
import org.bukkit.entity.Arrow;
import org.bukkit.scheduler.BukkitRunnable;
import alisolarflare.AliPresents;
public class AliArrowTask extends BukkitRunnable{
AliPresents plugin;
String name;
Arrow arrow;
public AliArrowTask(AliPresents plugin, Arrow arrow, String name){
this.name = name;
this.plugin = plugin;
this.arrow = arrow;
}
@Override
public void run() {
if (arrow.isOnGround() || arrow.isDead()){
this.cancel();
}
if (name.equalsIgnoreCase("alisolarflare")){
arrow.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, arrow.getLocation(), 1);
}
if (name.equalsIgnoreCase("Zanthr")){
arrow.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, arrow.getLocation(), 1);
arrow.getWorld().spawnParticle(Particle.FLAME, arrow.getLocation(), 1);
}
}
}

View file

@ -3,8 +3,8 @@ package alisolarflare.gpowers.commands;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.gpowers.gPowerMemory;
public class PowerUp implements CommandExecutor{ public class PowerUp implements CommandExecutor{
@ -13,7 +13,7 @@ public class PowerUp implements CommandExecutor{
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!");
} }
gPowerMemory.PowerUpPlayer(player, colour); //gPowerMemory.PowerUpPlayer(player, colour);
return false; return false;
} }

View file

@ -75,6 +75,7 @@ public class gPowerMemory{
public String colour; public String colour;
public Boolean isPowersActive; public Boolean isPowersActive;
@SuppressWarnings("static-access")
public poweredPlayer(UUID uuid, String colour, Boolean activated){ public poweredPlayer(UUID uuid, String colour, Boolean activated){
this.uuid = (uuid); this.uuid = (uuid);
this.colour = (colour); this.colour = (colour);
@ -87,11 +88,11 @@ public class gPowerMemory{
public void saveMemoryState(){ public void saveMemoryState(){
Map<UUID, poweredPlayer> PlayerMap = new HashMap<UUID, poweredPlayer>(); Map<UUID, poweredPlayer> PlayerMap = new HashMap<UUID, poweredPlayer>();
for (UUID uuidKey:PlayerMap.keySet()){ //for (UUID uuidKey:PlayerMap.keySet()){
UUID uuidToSave = poweredPlayer.uuid; //UUID uuidToSave = poweredPlayer.uuid;
} //}
} }
public void loadMemoryState(){ public void loadMemoryState(){