Revert "Revert "Revert "Comit to Uncommit"""

This reverts commit 30122d23d8.
This commit is contained in:
alisolarflare 2016-11-06 18:53:38 -05:00
parent 30122d23d8
commit 76118a7687
44 changed files with 1558 additions and 1437 deletions

View file

@ -0,0 +1,15 @@
package alisolarflare.components.flairdoor;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.components.flairdoor.commands.FlairMe;
import alisolarflare.components.flairdoor.listeners.PortalListener;
public class FlairDoorModule extends Module {
@Override
public void register(JavaPlugin plugin) {
registerCommand(plugin, new FlairMe());
registerListener(plugin, new PortalListener(plugin));
}
}

View file

@ -1,13 +0,0 @@
package alisolarflare.components.flairdoor;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
public class Module_FlairDoor extends Module {
@Override
public void register(JavaPlugin plugin) {
registerCommand(plugin, new Command_FlairMe());
registerListener(plugin, new Listener_Portal(plugin));
}
}

View file

@ -1,38 +1,39 @@
package alisolarflare.components.flairdoor;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_FlairMe extends TBMCCommandBase {
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
Listener_Portal.playersToBeFlaired.add(sender.getName());
sender.sendMessage("Setup Successful! Walk through a portal to get your flair");
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return new String[] { "" };
}
@Override
public String GetCommandPath() {
return "flairme";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}
package alisolarflare.components.flairdoor.commands;
import org.bukkit.command.CommandSender;
import alisolarflare.components.flairdoor.listeners.PortalListener;
import buttondevteam.lib.chat.TBMCCommandBase;
public class FlairMe extends TBMCCommandBase {
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
PortalListener.playersToBeFlaired.add(sender.getName());
sender.sendMessage("Setup Successful! Walk through a portal to get your flair");
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return new String[] { "" };
}
@Override
public String GetCommandPath() {
return "flairme";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -1,138 +1,138 @@
package alisolarflare.components.flairdoor;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.material.MaterialData;
import org.bukkit.material.Wool;
import org.bukkit.plugin.java.JavaPlugin;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
public class Listener_Portal implements Listener{
public static List<String> playersToBeFlaired = new ArrayList<String>();
public JavaPlugin plugin;
Essentials essentials;
public Listener_Portal(JavaPlugin plugin) {
this.plugin = plugin;
this.essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"));
}
@EventHandler
public void onPortalEnter(PlayerPortalEvent event){
//SANITATION - Player
if(!(event.getPlayer() instanceof Player)){
return;
}
//INIT - Player
Player player = event.getPlayer();
//SANITATION - PlayersToBeFlaired
if(!(playersToBeFlaired.contains(player.getName()))){
return;
}
player.sendMessage("-MAY THE FLAIRING COMMENCE-");
event.setTo(player.getLocation());
//INIT - x,y,z
int x = player.getLocation().getBlockX();
int y = player.getLocation().getBlockY();
int z = player.getLocation().getBlockZ();
//INIT - Blocks Under Portal
Block HigherBlock = player.getWorld().getBlockAt(x,y-2,z);
Block MiddleBlock = player.getWorld().getBlockAt(x,y-3,z);
Block BottomBlock = player.getWorld().getBlockAt(x,y-4,z);
//RECOLOUR PLAYER
if(HigherBlock.getType() == Material.STONE){
recolourPlayer(player, DyeColor.GRAY);
//TOP BLOCK IS WOOL?
}else if(HigherBlock.getType() == Material.WOOL){
Wool wool = (Wool) HigherBlock.getState().getData();
recolourPlayer(player, wool.getColor());
//MIDDLE BLOCK IS WOOL?
}else if(MiddleBlock.getType() == Material.WOOL){
MaterialData mData = MiddleBlock.getState().getData();
Wool wool = (Wool) mData;
recolourPlayer(player, wool.getColor());
//BOTTOM BLOCK IS WOOL?
}else if (BottomBlock.getType() == Material.WOOL){
Wool wool = (Wool) BottomBlock.getState().getData();
recolourPlayer(player, wool.getColor());
}
}
public void recolourPlayer(Player player, DyeColor dyecolour){
User user = essentials.getUser(player);
String name = user._getNickname();
String tempName = "";
for(int i = 0; i < name.length(); i++){
if (name.charAt(i) != '§'){
tempName += name.charAt(i);
}else{
i++;
}
}
name = tempName;
switch(dyecolour){
case GRAY:
player.sendMessage("Adding §7GRAY!§f");
name = "§7" + name;
break;
case RED:
player.sendMessage("Adding §4RED!§f");
name = "§4" + name;
break;
case ORANGE:
player.sendMessage("Adding §6ORANGE!§f");
name = "§6" + name;
break;
case YELLOW:
player.sendMessage("Adding §eYELLOW!§f");
name = "§e" + name;
break;
case LIME:
case GREEN:
player.sendMessage("Adding §aGREEN!§f");
name = "§a" + name;
break;
case CYAN:
case LIGHT_BLUE:
case BLUE:
player.sendMessage("Adding §9BLUE!§f");
name = "§9" + name;
break;
case PURPLE:
player.sendMessage("Adding §5PURPLE!§f");
name = "§5" + name;
break;
case WHITE:
player.sendMessage("Adding §fWHITE!§f");
name = "§f" + name;
default:
player.sendMessage("ERROR, PORTAL HAS INVALID UNDER-BLOCK");
break;
}
user.setNickname(name);
player.sendMessage("Your name is now: " + user.getNickname() +"!");
playersToBeFlaired.remove(player.getName());
}
}
package alisolarflare.components.flairdoor.listeners;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.material.MaterialData;
import org.bukkit.material.Wool;
import org.bukkit.plugin.java.JavaPlugin;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
public class PortalListener implements Listener{
public static List<String> playersToBeFlaired = new ArrayList<String>();
public JavaPlugin plugin;
Essentials essentials;
public PortalListener(JavaPlugin plugin) {
this.plugin = plugin;
this.essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"));
}
@EventHandler
public void onPortalEnter(PlayerPortalEvent event){
//SANITATION - Player
if(!(event.getPlayer() instanceof Player)){
return;
}
//INIT - Player
Player player = event.getPlayer();
//SANITATION - PlayersToBeFlaired
if(!(playersToBeFlaired.contains(player.getName()))){
return;
}
player.sendMessage("-MAY THE FLAIRING COMMENCE-");
event.setTo(player.getLocation());
//INIT - x,y,z
int x = player.getLocation().getBlockX();
int y = player.getLocation().getBlockY();
int z = player.getLocation().getBlockZ();
//INIT - Blocks Under Portal
Block HigherBlock = player.getWorld().getBlockAt(x,y-2,z);
Block MiddleBlock = player.getWorld().getBlockAt(x,y-3,z);
Block BottomBlock = player.getWorld().getBlockAt(x,y-4,z);
//RECOLOUR PLAYER
if(HigherBlock.getType() == Material.STONE){
recolourPlayer(player, DyeColor.GRAY);
//TOP BLOCK IS WOOL?
}else if(HigherBlock.getType() == Material.WOOL){
Wool wool = (Wool) HigherBlock.getState().getData();
recolourPlayer(player, wool.getColor());
//MIDDLE BLOCK IS WOOL?
}else if(MiddleBlock.getType() == Material.WOOL){
MaterialData mData = MiddleBlock.getState().getData();
Wool wool = (Wool) mData;
recolourPlayer(player, wool.getColor());
//BOTTOM BLOCK IS WOOL?
}else if (BottomBlock.getType() == Material.WOOL){
Wool wool = (Wool) BottomBlock.getState().getData();
recolourPlayer(player, wool.getColor());
}
}
public void recolourPlayer(Player player, DyeColor dyecolour){
User user = essentials.getUser(player);
String name = user._getNickname();
String tempName = "";
for(int i = 0; i < name.length(); i++){
if (name.charAt(i) != '§'){
tempName += name.charAt(i);
}else{
i++;
}
}
name = tempName;
switch(dyecolour){
case GRAY:
player.sendMessage("Adding §7GRAY!§f");
name = "§7" + name;
break;
case RED:
player.sendMessage("Adding §4RED!§f");
name = "§4" + name;
break;
case ORANGE:
player.sendMessage("Adding §6ORANGE!§f");
name = "§6" + name;
break;
case YELLOW:
player.sendMessage("Adding §eYELLOW!§f");
name = "§e" + name;
break;
case LIME:
case GREEN:
player.sendMessage("Adding §aGREEN!§f");
name = "§a" + name;
break;
case CYAN:
case LIGHT_BLUE:
case BLUE:
player.sendMessage("Adding §9BLUE!§f");
name = "§9" + name;
break;
case PURPLE:
player.sendMessage("Adding §5PURPLE!§f");
name = "§5" + name;
break;
case WHITE:
player.sendMessage("Adding §fWHITE!§f");
name = "§f" + name;
default:
player.sendMessage("ERROR, PORTAL HAS INVALID UNDER-BLOCK");
break;
}
user.setNickname(name);
player.sendMessage("Your name is now: " + user.getNickname() +"!");
playersToBeFlaired.remove(player.getName());
}
}

View file

@ -1,52 +1,52 @@
package alisolarflare.components.gpowers;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.Player;
public class Memory_GPower{
public Map<UUID, poweredPlayer> poweredPlayerList = new HashMap<UUID, poweredPlayer>();
public void configurePlayer(Player player, String colour, boolean powerIsActive){
poweredPlayerList.put(player.getUniqueId(), new poweredPlayer(player.getUniqueId(), colour, true));
}
public void PowerUpPlayer(Player player){
player.sendMessage("Powering up!");
if(poweredPlayerList.containsKey(player.getUniqueId())){
poweredPlayerList.get(player.getUniqueId()).isPowersActive = true;
player.sendMessage("Powered up!");
}else{
player.sendMessage("You must instantiate your power settings using /GPower");
}
}
public void PowerDownPlayer(Player player){
player.sendMessage("Powering down!");
if (poweredPlayerList.containsKey(player.getUniqueId())){
player.sendMessage("Powered down!");
poweredPlayerList.get(player.getUniqueId()).isPowersActive = false;
}else{
player.sendMessage("P down!");
return;
}
}
public class poweredPlayer{
public UUID uuid;
public String colour;
public Boolean isPowersActive;
public poweredPlayer(UUID uuid, String colour, Boolean activated){
this.uuid = (uuid);
this.colour = (colour);
this.isPowersActive = (activated);
}
public String toString(){
return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+isPowersActive + "]";
}
}
}
package alisolarflare.components.gpowers;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.Player;
public class GPowerMemory{
public Map<UUID, poweredPlayer> poweredPlayerList = new HashMap<UUID, poweredPlayer>();
public void configurePlayer(Player player, String colour, boolean powerIsActive){
poweredPlayerList.put(player.getUniqueId(), new poweredPlayer(player.getUniqueId(), colour, true));
}
public void PowerUpPlayer(Player player){
player.sendMessage("Powering up!");
if(poweredPlayerList.containsKey(player.getUniqueId())){
poweredPlayerList.get(player.getUniqueId()).isPowersActive = true;
player.sendMessage("Powered up!");
}else{
player.sendMessage("You must instantiate your power settings using /GPower");
}
}
public void PowerDownPlayer(Player player){
player.sendMessage("Powering down!");
if (poweredPlayerList.containsKey(player.getUniqueId())){
player.sendMessage("Powered down!");
poweredPlayerList.get(player.getUniqueId()).isPowersActive = false;
}else{
player.sendMessage("P down!");
return;
}
}
public class poweredPlayer{
public UUID uuid;
public String colour;
public Boolean isPowersActive;
public poweredPlayer(UUID uuid, String colour, Boolean activated){
this.uuid = (uuid);
this.colour = (colour);
this.isPowersActive = (activated);
}
public String toString(){
return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+isPowersActive + "]";
}
}
}

View file

@ -0,0 +1,23 @@
package alisolarflare.components.gpowers;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.components.gpowers.commands.GPower;
import alisolarflare.components.gpowers.commands.PowerDown;
import alisolarflare.components.gpowers.commands.PowerUp;
import alisolarflare.components.gpowers.listeners.gPowerListener;
public class GPowerModule extends Module {
@Override
public void register(JavaPlugin plugin) {
GPowerMemory gPowerMemory = new GPowerMemory();
registerCommand(plugin, new GPower(gPowerMemory));
registerCommand(plugin, new PowerUp(gPowerMemory));
registerCommand(plugin, new PowerDown(gPowerMemory));
registerListener(plugin, new gPowerListener(plugin, gPowerMemory));
}
}

View file

@ -1,11 +0,0 @@
package alisolarflare.components.gpowers;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public class Listener_PowerLooper implements Listener{
public Listener_PowerLooper(JavaPlugin plugin, Memory_GPower gPowerMemory){
new Task_PowerApplier(plugin.getServer(), gPowerMemory.poweredPlayerList).runTaskTimer(plugin, 190, 190);
}
}

View file

@ -1,19 +0,0 @@
package alisolarflare.components.gpowers;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
public class Module_GPower extends Module {
@Override
public void register(JavaPlugin plugin) {
Memory_GPower gPowerMemory = new Memory_GPower();
registerCommand(plugin, new Command_GPower(gPowerMemory));
registerCommand(plugin, new Command_PowerUp(gPowerMemory));
registerCommand(plugin, new Command_PowerDown(gPowerMemory));
registerListener(plugin, new Listener_PowerLooper(plugin, gPowerMemory));
}
}

View file

@ -1,75 +1,76 @@
package alisolarflare.components.gpowers;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_GPower extends TBMCCommandBase {
private Memory_GPower gPowerMemory;
public Command_GPower(Memory_GPower gPowerMemory) {
this.gPowerMemory = gPowerMemory;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.sendMessage("G power activate!");
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command! Talk to a dev/ali if you think this is wrong");
}
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;
}
String colour;
if (args[0].startsWith("r") || args[0].startsWith("o") || args[0].startsWith("y") || args[0].startsWith("g")
|| args[0].startsWith("b") || args[0].startsWith("p")) {
colour = args[0];
} else {
player.sendMessage("error: colour. Proper Usage to configure G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]");
return false;
}
boolean isActive;
if (args[1].startsWith("t")) {
isActive = true;
} else if (args[1].startsWith("f")) {
isActive = false;
} else {
player.sendMessage("error: active. Proper Usage to configure G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
return false;
}
player.sendMessage("Terms Vaild!");
player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive);
gPowerMemory.configurePlayer(player, colour, isActive);
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return new String[] { "" };
}
@Override
public String GetCommandPath() {
return "gpower";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}
package alisolarflare.components.gpowers.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.components.gpowers.GPowerMemory;
import buttondevteam.lib.chat.TBMCCommandBase;
public class GPower extends TBMCCommandBase {
private GPowerMemory gPowerMemory;
public GPower(GPowerMemory gPowerMemory) {
this.gPowerMemory = gPowerMemory;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.sendMessage("G power activate!");
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command! Talk to a dev/ali if you think this is wrong");
}
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;
}
String colour;
if (args[0].startsWith("r") || args[0].startsWith("o") || args[0].startsWith("y") || args[0].startsWith("g")
|| args[0].startsWith("b") || args[0].startsWith("p")) {
colour = args[0];
} else {
player.sendMessage("error: colour. Proper Usage to configure G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]");
return false;
}
boolean isActive;
if (args[1].startsWith("t")) {
isActive = true;
} else if (args[1].startsWith("f")) {
isActive = false;
} else {
player.sendMessage("error: active. Proper Usage to configure G-Powers:");
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
return false;
}
player.sendMessage("Terms Vaild!");
player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive);
gPowerMemory.configurePlayer(player, colour, isActive);
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return new String[] { "" };
}
@Override
public String GetCommandPath() {
return "gpower";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
return false;
}
}

View file

@ -1,48 +1,49 @@
package alisolarflare.components.gpowers;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_PowerDown extends TBMCCommandBase {
private Memory_GPower gPowerMemory;
public Command_PowerDown(Memory_GPower gPowerMemory) {
this.gPowerMemory = gPowerMemory;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (!(sender instanceof Player))
sender.sendMessage("You must be a player to use this command! Contact dev/ali if you think this is wrong");
Player player = (Player) sender;
gPowerMemory.PowerDownPlayer(player);
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "powerdown";
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}
package alisolarflare.components.gpowers.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.components.gpowers.GPowerMemory;
import buttondevteam.lib.chat.TBMCCommandBase;
public class PowerDown extends TBMCCommandBase {
private GPowerMemory gPowerMemory;
public PowerDown(GPowerMemory gPowerMemory) {
this.gPowerMemory = gPowerMemory;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (!(sender instanceof Player))
sender.sendMessage("You must be a player to use this command! Contact dev/ali if you think this is wrong");
Player player = (Player) sender;
gPowerMemory.PowerDownPlayer(player);
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "powerdown";
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,48 +1,49 @@
package alisolarflare.components.gpowers;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_PowerUp extends TBMCCommandBase {
private Memory_GPower gPowerMemory;
public Command_PowerUp(Memory_GPower gPowerMemory) {
this.gPowerMemory = gPowerMemory;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (!(sender instanceof Player))
sender.sendMessage("You must be a player to use this command! Contact a dev/ali if you think this is wrong");
Player player = (Player) sender;
gPowerMemory.PowerUpPlayer(player);
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "powerup";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}
package alisolarflare.components.gpowers.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.components.gpowers.GPowerMemory;
import buttondevteam.lib.chat.TBMCCommandBase;
public class PowerUp extends TBMCCommandBase {
private GPowerMemory gPowerMemory;
public PowerUp(GPowerMemory gPowerMemory) {
this.gPowerMemory = gPowerMemory;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (!(sender instanceof Player))
sender.sendMessage("You must be a player to use this command! Contact a dev/ali if you think this is wrong");
Player player = (Player) sender;
gPowerMemory.PowerUpPlayer(player);
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "powerup";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,66 +1,66 @@
package alisolarflare.components.gpowers;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Color;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import alisolarflare.components.gpowers.Memory_GPower.poweredPlayer;
public class Task_PowerApplier extends BukkitRunnable{
private Server server;
private Map<UUID, poweredPlayer> poweredPlayerList;
public Task_PowerApplier(Server server, Map<UUID, poweredPlayer> poweredPlayerList) {
this.server = server;
this.poweredPlayerList = poweredPlayerList;
}
//REPEATS EVERY 5 SECONDS
@Override
public void run() {
for (Player player : server.getOnlinePlayers()){
if(poweredPlayerList.containsKey(player.getUniqueId())){
activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour);
}
}
}
private void activatePower(Player player, String colour) {
//GREY
if ((colour.startsWith("grey") || colour.startsWith("gra")) && (player.getWorld().getTime() > 12575 && player.getWorld().getTime() < 22925)){
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.GRAY));
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 300, 0, true, false, Color.GRAY));
//RED
}else if (colour.startsWith("r")){
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 0, true, false, Color.RED));
//ORANGE
}else if (colour.startsWith("o")){
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200, 0, true, false, Color.ORANGE));
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 0, true, false, Color.ORANGE));
//YELLOW
}else if (colour.startsWith("y") && player.getLocation().getBlock().getLightFromSky() == 15 && player.getLocation().getBlock().getLightFromBlocks() == 15){
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.YELLOW));
//GREEN
}else if (colour.startsWith("g") && !colour.startsWith("gra") && !colour.startsWith("grey")){
player.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, 200, 1, true, false, Color.GREEN));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 200, 0, true, false, Color.GREEN));
//BLUE
}else if (colour.startsWith("b")){
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1, true, false, Color.BLUE));
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 200, 0, true, false, Color.BLUE));
//PURPLE
}else if (colour.startsWith("p")){
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 200, 0, true, false, Color.PURPLE));
//NULL
}else{
}
}
}
package alisolarflare.components.gpowers.listeners;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Color;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import alisolarflare.components.gpowers.GPowerMemory.poweredPlayer;
public class gPowerApplyingTask extends BukkitRunnable{
private Server server;
private Map<UUID, poweredPlayer> poweredPlayerList;
public gPowerApplyingTask(Server server, Map<UUID, poweredPlayer> poweredPlayerList) {
this.server = server;
this.poweredPlayerList = poweredPlayerList;
}
//REPEATS EVERY 5 SECONDS
@Override
public void run() {
for (Player player : server.getOnlinePlayers()){
if(poweredPlayerList.containsKey(player.getUniqueId())){
activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour);
}
}
}
private void activatePower(Player player, String colour) {
//GREY
if ((colour.startsWith("grey") || colour.startsWith("gra")) && (player.getWorld().getTime() > 12575 && player.getWorld().getTime() < 22925)){
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.GRAY));
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 300, 0, true, false, Color.GRAY));
//RED
}else if (colour.startsWith("r")){
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 0, true, false, Color.RED));
//ORANGE
}else if (colour.startsWith("o")){
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200, 0, true, false, Color.ORANGE));
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 0, true, false, Color.ORANGE));
//YELLOW
}else if (colour.startsWith("y") && player.getLocation().getBlock().getLightFromSky() == 15 && player.getLocation().getBlock().getLightFromBlocks() == 15){
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.YELLOW));
//GREEN
}else if (colour.startsWith("g") && !colour.startsWith("gra") && !colour.startsWith("grey")){
player.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, 200, 1, true, false, Color.GREEN));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 200, 0, true, false, Color.GREEN));
//BLUE
}else if (colour.startsWith("b")){
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1, true, false, Color.BLUE));
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 200, 0, true, false, Color.BLUE));
//PURPLE
}else if (colour.startsWith("p")){
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 200, 0, true, false, Color.PURPLE));
//NULL
}else{
}
}
}

View file

@ -0,0 +1,13 @@
package alisolarflare.components.gpowers.listeners;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.components.gpowers.GPowerMemory;
public class gPowerListener implements Listener{
public gPowerListener(JavaPlugin plugin, GPowerMemory gPowerMemory){
new gPowerApplyingTask(plugin.getServer(), gPowerMemory.poweredPlayerList).runTaskTimer(plugin, 190, 190);
}
}

View file

@ -0,0 +1,33 @@
package alisolarflare.components.links;
import java.util.List;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.components.links.commands.PressAliLink;
import alisolarflare.components.links.commands.SetAliLink;
import alisolarflare.components.links.entities.Link;
public class AliLinkModule extends Module {
private SetAliLink setAliLink;
@Override
public void register(JavaPlugin plugin) {
setAliLink = new SetAliLink(plugin);
registerCommand(plugin, new PressAliLink(plugin, setAliLink));
registerCommand(plugin, setAliLink);
}
public void saveLinkList(JavaPlugin plugin) {
plugin.getConfig().set("aliLinkList", setAliLink.linkList);
}
@SuppressWarnings("unchecked")
public List<Link> loadLinkList(JavaPlugin plugin) {
return (List<Link>) plugin.getConfig().getList("aliLinkList");
}
}

View file

@ -1,30 +0,0 @@
package alisolarflare.components.links;
import java.util.List;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
public class Module_AliLink extends Module {
private Command_SetAliLink setAliLink;
@Override
public void register(JavaPlugin plugin) {
setAliLink = new Command_SetAliLink(plugin);
registerCommand(plugin, new Command_PressAliLink(plugin, setAliLink));
registerCommand(plugin, setAliLink);
}
public void saveLinkList(JavaPlugin plugin) {
plugin.getConfig().set("aliLinkList", setAliLink.linkList);
}
@SuppressWarnings("unchecked")
public List<Memory_Link> loadLinkList(JavaPlugin plugin) {
return (List<Memory_Link>) plugin.getConfig().getList("aliLinkList");
}
}

View file

@ -1,59 +1,60 @@
package alisolarflare.components.links;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_PressAliLink extends TBMCCommandBase {
private JavaPlugin plugin;
private Command_SetAliLink setAliLink;
public Command_PressAliLink(JavaPlugin plugin, Command_SetAliLink setAliLink) {
this.plugin = plugin;
this.setAliLink = setAliLink;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.getServer().broadcastMessage(setAliLink.linkList.toString() + "over.");
if (args.length < 1) {
sender.sendMessage("You must specify a link frequency");
sender.sendMessage("/pressalilink [frequency]");
}
for (Memory_Link link : setAliLink.linkList) {
for (String inputlink : args) {
if (inputlink.equals(link.frequency)) {
link.press(plugin);
}
}
}
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "pressalilink";
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}
package alisolarflare.components.links.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.components.links.entities.Link;
import buttondevteam.lib.chat.TBMCCommandBase;
public class PressAliLink extends TBMCCommandBase {
private JavaPlugin plugin;
private SetAliLink setAliLink;
public PressAliLink(JavaPlugin plugin, SetAliLink setAliLink) {
this.plugin = plugin;
this.setAliLink = setAliLink;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.getServer().broadcastMessage(setAliLink.linkList.toString() + "over.");
if (args.length < 1) {
sender.sendMessage("You must specify a link frequency");
sender.sendMessage("/pressalilink [frequency]");
}
for (Link link : setAliLink.linkList) {
for (String inputlink : args) {
if (inputlink.equals(link.frequency)) {
link.press(plugin);
}
}
}
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "pressalilink";
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,138 +1,140 @@
package alisolarflare.components.links;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.lib.chat.TBMCCommandBase;
/**
* This class manages the command /SetAliLink <frequency> [x] [y] [z]. This command creates an Ali-Link, a location in a world that when called on by {@link Command_PressAliLink}, creates a temporary redstone
* block, enabling wireless redstone
*
* @see Command_PressAliLink
* @author Alisolarflare
*
*/
public class Command_SetAliLink extends TBMCCommandBase {
public List<Memory_Link> linkList = new ArrayList<Memory_Link>();
Module_AliLink subplugin;
private JavaPlugin plugin;
/**
* Constructs the SetAliLink class
*
* @param plugin
* The plugin that contains the configuration file of SetAliLink
*/
public Command_SetAliLink(JavaPlugin plugin) {
this.plugin = plugin;
load();
}
/**
* This command creates an Ali-Link which, when activated by the command /PressAliLink, creates a temporary redstone block if and only if /PressAliLink [frequency] matches the frequency saved when
* /SetAliLink [frequency] is called.
*
* @see Class#PressAliLink
* @param sender
* Player who sent the command
* @param command
* Command Object created
* @param label
* Name of the command
* @param args
* Arguments: [frequency] [x-coordinate] [y-coordinate] [z-coordinate], where the coordinates point to the intended location of the Ali-Link
*/
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.sendMessage("you pressed shit");
if (args == null || args.length < 1) {
sender.sendMessage("You must specify a link frequency");
sender.sendMessage("/pressalilink [name]");
return false;
}
Player player = (Player) sender;
if (args.length < 4) {
player.sendMessage("short");
linkList.add(new Memory_Link(args[0], player.getLocation()));
save(player);
player.sendMessage("end");
return false;
}
if (StringUtils.isNumericSpace(args[1]) && StringUtils.isNumericSpace(args[2])
&& StringUtils.isNumericSpace(args[3])) {
player.sendMessage("CUUUSTOM");
linkList.add(new Memory_Link(args[0], new Location(player.getWorld(), Double.parseDouble(args[1]),
Double.parseDouble(args[2]), Double.parseDouble(args[3]))));
save(player);
player.sendMessage("FINISHED");
} else {
player.sendMessage("UNCUSTOOM");
linkList.add(new Memory_Link(args[0], player.getLocation()));
save(player);
player.sendMessage("UNFINISHED");
return false;
}
return false;
}
/**
* Tries to save the entire SetAliLink class into memory, which includes all of the current Ali-links saved and in use.
*
* @param player
*/
private void save(Player player) {
player.sendMessage("SAAAVING");
player.sendMessage("SAVE FAILED: TELL ALI TO FIX THE SAVE AND UN-COMMENT THE PARAGRAPH SHE COMMENTED");
player.sendMessage("Link will only last until next server restart");
return;
/*
* subplugin.plugin.getConfig().set("aliLinkList", subplugin.linkList); try { player.sendMessage("SAVIN"); subplugin.plugin.saveConfig(); player.sendMessage("GOOD SAVE"); } catch (Exception e)
* { player.sendMessage("YOU FUCKED STUFF UP"); // TODO Auto-generated catch block e.printStackTrace(); }
*/
}
/**
* Attempts to load the previous saved state of AliLinks, from the plugin configuration file
*/
@SuppressWarnings("unchecked")
private void load() {
try {
linkList = (List<Memory_Link>) plugin.getConfig().getList("aliLinkList");
if (linkList == null || linkList.isEmpty()) {
linkList = new ArrayList<Memory_Link>();
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "setalilink";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}
package alisolarflare.components.links.commands;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.components.links.AliLinkModule;
import alisolarflare.components.links.entities.Link;
import buttondevteam.lib.chat.TBMCCommandBase;
/**
* This class manages the command /SetAliLink <frequency> [x] [y] [z]. This command creates an Ali-Link, a location in a world that when called on by {@link PressAliLink}, creates a temporary redstone
* block, enabling wireless redstone
*
* @see PressAliLink
* @author Alisolarflare
*
*/
public class SetAliLink extends TBMCCommandBase {
public List<Link> linkList = new ArrayList<Link>();
AliLinkModule subplugin;
private JavaPlugin plugin;
/**
* Constructs the SetAliLink class
*
* @param plugin
* The plugin that contains the configuration file of SetAliLink
*/
public SetAliLink(JavaPlugin plugin) {
this.plugin = plugin;
load();
}
/**
* This command creates an Ali-Link which, when activated by the command /PressAliLink, creates a temporary redstone block if and only if /PressAliLink [frequency] matches the frequency saved when
* /SetAliLink [frequency] is called.
*
* @see Class#PressAliLink
* @param sender
* Player who sent the command
* @param command
* Command Object created
* @param label
* Name of the command
* @param args
* Arguments: [frequency] [x-coordinate] [y-coordinate] [z-coordinate], where the coordinates point to the intended location of the Ali-Link
*/
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.sendMessage("you pressed shit");
if (args == null || args.length < 1) {
sender.sendMessage("You must specify a link frequency");
sender.sendMessage("/pressalilink [name]");
return false;
}
Player player = (Player) sender;
if (args.length < 4) {
player.sendMessage("short");
linkList.add(new Link(args[0], player.getLocation()));
save(player);
player.sendMessage("end");
return false;
}
if (StringUtils.isNumericSpace(args[1]) && StringUtils.isNumericSpace(args[2])
&& StringUtils.isNumericSpace(args[3])) {
player.sendMessage("CUUUSTOM");
linkList.add(new Link(args[0], new Location(player.getWorld(), Double.parseDouble(args[1]),
Double.parseDouble(args[2]), Double.parseDouble(args[3]))));
save(player);
player.sendMessage("FINISHED");
} else {
player.sendMessage("UNCUSTOOM");
linkList.add(new Link(args[0], player.getLocation()));
save(player);
player.sendMessage("UNFINISHED");
return false;
}
return false;
}
/**
* Tries to save the entire SetAliLink class into memory, which includes all of the current Ali-links saved and in use.
*
* @param player
*/
private void save(Player player) {
player.sendMessage("SAAAVING");
player.sendMessage("SAVE FAILED: TELL ALI TO FIX THE SAVE AND UN-COMMENT THE PARAGRAPH SHE COMMENTED");
player.sendMessage("Link will only last until next server restart");
return;
/*
* subplugin.plugin.getConfig().set("aliLinkList", subplugin.linkList); try { player.sendMessage("SAVIN"); subplugin.plugin.saveConfig(); player.sendMessage("GOOD SAVE"); } catch (Exception e)
* { player.sendMessage("YOU FUCKED STUFF UP"); // TODO Auto-generated catch block e.printStackTrace(); }
*/
}
/**
* Attempts to load the previous saved state of AliLinks, from the plugin configuration file
*/
@SuppressWarnings("unchecked")
private void load() {
try {
linkList = (List<Link>) plugin.getConfig().getList("aliLinkList");
if (linkList == null || linkList.isEmpty()) {
linkList = new ArrayList<Link>();
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public String GetCommandPath() {
return "setalilink";
}
@Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,39 +1,41 @@
package alisolarflare.components.links;
import java.io.Serializable;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin;
public class Memory_Link implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
public String frequency;
public String world;
public String x;
public String y;
public String z;
public Memory_Link(String frequency, Location location){
this.frequency = frequency;
this.world = location.getWorld().getName();
this.x = "" + location.getBlockX();
this.y = "" + location.getBlockY();
this.z = "" + location.getBlockZ();
//plugin.plugin.getConfig().set("frequency", 10);
}
/**
* Activates the Ali-Link
* @param plugin
*/
public void press(JavaPlugin plugin) {
Location location = new Location(plugin.getServer().getWorld(world), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z));
location.getBlock().setType(Material.REDSTONE_BLOCK);
Task_UnpressTask unPressTask = new Task_UnpressTask(location);
unPressTask.runTaskTimer(plugin, 2, 1);
}
}
package alisolarflare.components.links.entities;
import java.io.Serializable;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.components.links.tasks.UnpressTask;
public class Link implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
public String frequency;
public String world;
public String x;
public String y;
public String z;
public Link(String frequency, Location location){
this.frequency = frequency;
this.world = location.getWorld().getName();
this.x = "" + location.getBlockX();
this.y = "" + location.getBlockY();
this.z = "" + location.getBlockZ();
//plugin.plugin.getConfig().set("frequency", 10);
}
/**
* Activates the Ali-Link
* @param plugin
*/
public void press(JavaPlugin plugin) {
Location location = new Location(plugin.getServer().getWorld(world), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z));
location.getBlock().setType(Material.REDSTONE_BLOCK);
UnpressTask unPressTask = new UnpressTask(location);
unPressTask.runTaskTimer(plugin, 2, 1);
}
}

View file

@ -0,0 +1,42 @@
package alisolarflare.components.links.serializer;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.List;
import alisolarflare.components.links.entities.Link;
/**
* @deprecated
* @author Alisolarflare
*
*/
public class Deserializer{
public static void main (String args[]) {
//Deserializer deserializer = new Deserializer();
//List<Link> aliLink = deserializer.loadLink(aliLink);
//System.out.println(aliLink);
}
/**@deprecated*/
@SuppressWarnings("unchecked")
public List<Link> loadLinkList(){
List<Link> aliLinkList;
try{
FileInputStream fin = new FileInputStream("AliLinkList.ser");
ObjectInputStream ois = new ObjectInputStream(fin);
aliLinkList = (List<Link>) ois.readObject();
ois.close();
return aliLinkList;
}catch(Exception ex){
ex.printStackTrace();
return null;
}
}
}

View file

@ -0,0 +1,38 @@
package alisolarflare.components.links.serializer;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.List;
import alisolarflare.components.links.entities.Link;
/**
* @deprecated
* @author Alisolarflare
*
*/
public class Serializer {
public static void main (String args[]) {
//Serializer serializer = new Serializer();
//serializer.saveLink(plugin, frequency, location)
}
/**@deprecated*/
public void saveLinkList(List<Link> aliLinkList){
//saves link
try{
FileOutputStream fout = new FileOutputStream("AliLinkList.ser");
ObjectOutputStream oos = new ObjectOutputStream(fout);
oos.writeObject(aliLinkList);
oos.close();
System.out.println("Done");
}catch(Exception ex){
ex.printStackTrace();
}
}
}

View file

@ -1,21 +1,21 @@
package alisolarflare.components.links;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.scheduler.BukkitRunnable;
public class Task_UnpressTask extends BukkitRunnable {
private Location location;
public Task_UnpressTask(Location location){
this.location = location;
}
@SuppressWarnings("deprecation")
@Override
public void run() {
location.getBlock().setType(Material.STAINED_CLAY);
location.getBlock().setData((byte) 14);
this.cancel();
}
}
package alisolarflare.components.links.tasks;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.scheduler.BukkitRunnable;
public class UnpressTask extends BukkitRunnable {
private Location location;
public UnpressTask(Location location){
this.location = location;
}
@SuppressWarnings("deprecation")
@Override
public void run() {
location.getBlock().setType(Material.STAINED_CLAY);
location.getBlock().setData((byte) 14);
this.cancel();
}
}

View file

@ -0,0 +1,30 @@
package alisolarflare.creativeboundaries;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.creativeboundaries.commands.Cbgm0;
import alisolarflare.creativeboundaries.commands.Cbgm1;
import alisolarflare.creativeboundaries.commands.SetDickmode;
import alisolarflare.creativeboundaries.listeners.ItemRestrictionListener;
import alisolarflare.creativeboundaries.listeners.PlotChangeListener;
public class CreativeBoundariesModule extends Module{
public boolean dickmode;
public List<Player> cbCreatives = new ArrayList<Player>();
@Override
public void register(JavaPlugin plugin) {
registerCommand(plugin, new Cbgm1(this));
registerCommand(plugin, new Cbgm0(this));
registerCommand(plugin, new SetDickmode(this));
registerListener(plugin, new PlotChangeListener(this));
//registerListener(plugin, new ItemRestrictionListener(this));
}
}

View file

@ -1,25 +0,0 @@
package alisolarflare.creativeboundaries;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
public class Module_CreativeBoundaries extends Module{
public boolean dickmode;
public List<Player> cbCreatives = new ArrayList<Player>();
@Override
public void register(JavaPlugin plugin) {
registerCommand(plugin, new Command_Cbgm1(this));
registerCommand(plugin, new Command_Cbgm0(this));
registerCommand(plugin, new Command_SetDickmode(this));
registerListener(plugin, new Listener_PlotChange(this));
//registerListener(plugin, new ItemRestrictionListener(this));
}
}

View file

@ -1,48 +1,49 @@
package alisolarflare.creativeboundaries;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_Cbgm0 extends TBMCCommandBase{
private Module_CreativeBoundaries module;
public Command_Cbgm0(Module_CreativeBoundaries module) {
this.module = module;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
player.setGameMode(GameMode.SURVIVAL);
module.cbCreatives.remove(player);
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}
package alisolarflare.creativeboundaries.commands;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.creativeboundaries.CreativeBoundariesModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Cbgm0 extends TBMCCommandBase{
private CreativeBoundariesModule module;
public Cbgm0(CreativeBoundariesModule module) {
this.module = module;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
player.setGameMode(GameMode.SURVIVAL);
module.cbCreatives.remove(player);
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,81 +1,82 @@
package alisolarflare.creativeboundaries;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_Cbgm1 extends TBMCCommandBase {
private Module_CreativeBoundaries module;
public Command_Cbgm1(Module_CreativeBoundaries module) {
this.module = module;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
if (tb == null) {
player.sendMessage("You aren't standing in a town or some other error occured.");
player.sendMessage("TownBlock is null.");
return false;
}
Town town;
try {
town = tb.getTown();
} catch (NotRegisteredException e) {
player.sendMessage("You aren't standing in a town or some other error occured.");
player.sendMessage("TownBlock's town is not registered.");
return false;
}
if (town == null) {
player.sendMessage("ERROR: The town you're standing in is Null.");
return false;
}
for(Resident res : town.getResidents()){
if (res.getName().toString().equals(player.getName().toString())){
player.setGameMode(GameMode.CREATIVE);
module.cbCreatives.add(player);
return true;
}
}
player.sendMessage("Sorry, you're not part of this town");
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}
package alisolarflare.creativeboundaries.commands;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse;
import alisolarflare.creativeboundaries.CreativeBoundariesModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Cbgm1 extends TBMCCommandBase {
private CreativeBoundariesModule module;
public Cbgm1(CreativeBoundariesModule module) {
this.module = module;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if (!(sender instanceof Player)) {
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
if (tb == null) {
player.sendMessage("You aren't standing in a town or some other error occured.");
player.sendMessage("TownBlock is null.");
return false;
}
Town town;
try {
town = tb.getTown();
} catch (NotRegisteredException e) {
player.sendMessage("You aren't standing in a town or some other error occured.");
player.sendMessage("TownBlock's town is not registered.");
return false;
}
if (town == null) {
player.sendMessage("ERROR: The town you're standing in is Null.");
return false;
}
for(Resident res : town.getResidents()){
if (res.getName().toString().equals(player.getName().toString())){
player.setGameMode(GameMode.CREATIVE);
module.cbCreatives.add(player);
return true;
}
}
player.sendMessage("Sorry, you're not part of this town");
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,53 +1,54 @@
package alisolarflare.creativeboundaries;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_SetDickmode extends TBMCCommandBase{
private Module_CreativeBoundaries module;
public Command_SetDickmode(Module_CreativeBoundaries module){
this.module = module;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (sender.getName().equals("Alisolarflare") || sender.getName().equals("iie")){
if(args[0] == null){
sender.sendMessage("You must use True, False, 1, or 0 as arguments!");
return false;
}
if(args[0].equalsIgnoreCase("TRUE") || args[0].equalsIgnoreCase("1")){
sender.sendMessage("Dickmode has been turned on!");
module.dickmode=(true);
return true;
}
if(args[0].equalsIgnoreCase("FALSE") || args[0].equalsIgnoreCase("0")){
sender.sendMessage("Dickmode has been turned off!");
module.dickmode=(false);
return true;
}
return false;
}
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}
package alisolarflare.creativeboundaries.commands;
import org.bukkit.command.CommandSender;
import alisolarflare.creativeboundaries.CreativeBoundariesModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class SetDickmode extends TBMCCommandBase{
private CreativeBoundariesModule module;
public SetDickmode(CreativeBoundariesModule module){
this.module = module;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (sender.getName().equals("Alisolarflare") || sender.getName().equals("iie")){
if(args[0] == null){
sender.sendMessage("You must use True, False, 1, or 0 as arguments!");
return false;
}
if(args[0].equalsIgnoreCase("TRUE") || args[0].equalsIgnoreCase("1")){
sender.sendMessage("Dickmode has been turned on!");
module.dickmode=(true);
return true;
}
if(args[0].equalsIgnoreCase("FALSE") || args[0].equalsIgnoreCase("0")){
sender.sendMessage("Dickmode has been turned off!");
module.dickmode=(false);
return true;
}
return false;
}
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,24 +1,26 @@
package alisolarflare.creativeboundaries;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCreativeEvent;
public class Listener_ItemRestriction implements Listener {
private Module_CreativeBoundaries module;
public Listener_ItemRestriction(Module_CreativeBoundaries module) {
this.module = module;
}
@EventHandler
public void onItemTake(InventoryCreativeEvent event){
List<Player> cbCreatives = module.cbCreatives;
}
}
package alisolarflare.creativeboundaries.listeners;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCreativeEvent;
import alisolarflare.creativeboundaries.CreativeBoundariesModule;
public class ItemRestrictionListener implements Listener {
private CreativeBoundariesModule module;
public ItemRestrictionListener(CreativeBoundariesModule module) {
this.module = module;
}
@EventHandler
public void onItemTake(InventoryCreativeEvent event){
List<Player> cbCreatives = module.cbCreatives;
}
}

View file

@ -1,67 +1,69 @@
package alisolarflare.creativeboundaries;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse;
public class Listener_PlotChange implements Listener{
public Module_CreativeBoundaries module;
public Listener_PlotChange(Module_CreativeBoundaries module){
this.module = module;
}
@EventHandler
public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){
Player player = plotEvent.getPlayer();
if (module.dickmode == false){
return;
}
if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){
return;
}
if (!(module.cbCreatives.contains(plotEvent.getPlayer()))){
return;
}
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
if (tb == null) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!");
module.cbCreatives.remove(player);
return;
}
Town town;
try {
town = tb.getTown();
} catch (NotRegisteredException e) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!");
module.cbCreatives.remove(player);
return;
}
if (town == null) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!!");
module.cbCreatives.remove(player);
return;
}
boolean townHasRes = false;
for(Resident res : town.getResidents()){
if (res.getName().toString().equals(player.getName().toString())){
townHasRes = true;
}
}
if (!townHasRes){
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!!!");
module.cbCreatives.remove(player);
}
}
}
package alisolarflare.creativeboundaries.listeners;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse;
import alisolarflare.creativeboundaries.CreativeBoundariesModule;
public class PlotChangeListener implements Listener{
public CreativeBoundariesModule module;
public PlotChangeListener(CreativeBoundariesModule module){
this.module = module;
}
@EventHandler
public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){
Player player = plotEvent.getPlayer();
if (module.dickmode == false){
return;
}
if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){
return;
}
if (!(module.cbCreatives.contains(plotEvent.getPlayer()))){
return;
}
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
if (tb == null) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!");
module.cbCreatives.remove(player);
return;
}
Town town;
try {
town = tb.getTown();
} catch (NotRegisteredException e) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!");
module.cbCreatives.remove(player);
return;
}
if (town == null) {
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!!");
module.cbCreatives.remove(player);
return;
}
boolean townHasRes = false;
for(Resident res : town.getResidents()){
if (res.getName().toString().equals(player.getName().toString())){
townHasRes = true;
}
}
if (!townHasRes){
player.setGameMode(GameMode.SURVIVAL);
player.sendMessage("You have left your town boundaries!!!!");
module.cbCreatives.remove(player);
}
}
}

View file

@ -0,0 +1,24 @@
package alisolarflare.easyuhc;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.easyuhc.commands.ActivatePowers;
import alisolarflare.easyuhc.commands.SetupWorldBorders;
import alisolarflare.easyuhc.commands.SpreadPlayers;
import alisolarflare.easyuhc.commands.StartTimer;
import alisolarflare.easyuhc.commands.StartUHC;
import alisolarflare.easyuhc.commands.TeleportToUHC;
public class EasyUHCModule extends Module{
@Override
public void register(JavaPlugin plugin) {
registerCommand(plugin, new ActivatePowers());
registerCommand(plugin, new SetupWorldBorders());
registerCommand(plugin, new SetupWorldBorders());
registerCommand(plugin, new SpreadPlayers());
registerCommand(plugin, new StartTimer());
registerCommand(plugin, new StartUHC());
registerCommand(plugin, new TeleportToUHC());
}
}

View file

@ -1,18 +0,0 @@
package alisolarflare.easyuhc;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
public class Module_EasyUHC extends Module{
@Override
public void register(JavaPlugin plugin) {
registerCommand(plugin, new Command_ActivatePowers());
registerCommand(plugin, new Command_SetupWorldBorders());
registerCommand(plugin, new Command_SetupWorldBorders());
registerCommand(plugin, new Command_SpreadPlayers());
registerCommand(plugin, new Command_StartTimer());
registerCommand(plugin, new Command_StartUHC());
registerCommand(plugin, new Command_TeleportToUHC());
}
}

View file

@ -1,10 +1,10 @@
package alisolarflare.easyuhc;
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_ActivatePowers extends TBMCCommandBase{
public class ActivatePowers extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {

View file

@ -1,10 +1,10 @@
package alisolarflare.easyuhc;
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_SetupWorldBorders extends TBMCCommandBase {
public class SetupWorldBorders extends TBMCCommandBase {
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {

View file

@ -1,10 +1,10 @@
package alisolarflare.easyuhc;
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_ShrinkWorldBorders extends TBMCCommandBase {
public class ShrinkWorldBorders extends TBMCCommandBase {
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {

View file

@ -1,10 +1,10 @@
package alisolarflare.easyuhc;
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_SpreadPlayers extends TBMCCommandBase{
public class SpreadPlayers extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {

View file

@ -1,10 +1,10 @@
package alisolarflare.easyuhc;
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_StartTimer extends TBMCCommandBase{
public class StartTimer extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {

View file

@ -1,10 +1,10 @@
package alisolarflare.easyuhc;
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_StartUHC extends TBMCCommandBase{
public class StartUHC extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {

View file

@ -1,10 +1,10 @@
package alisolarflare.easyuhc;
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_TeleportToUHC extends TBMCCommandBase{
public class TeleportToUHC extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {

View file

@ -3,6 +3,9 @@ package alisolarflare.magic;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.magic.tricks.AliArrowListener;
import alisolarflare.magic.tricks.BoomBowDeathListener;
import alisolarflare.magic.tricks.BoomBowListener;
public class MagicModule extends Module{

View file

@ -1,39 +1,39 @@
package alisolarflare.magic;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class AliArrowListener implements Listener {
private final JavaPlugin plugin;
public AliArrowListener(JavaPlugin plugin){
this.plugin = plugin;
}
@EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent event){
if(event.getEntity().getType() != EntityType.ARROW){
return;
}
Arrow arrow = (Arrow) event.getEntity();
if (!(arrow.isCritical()) || !(arrow.getShooter() instanceof Player)){
return;
}
String user = ((Player) arrow.getShooter()).getName();
for (String permittedUser : AliArrowTask.permittedUsers){
if(permittedUser.equalsIgnoreCase(user)){
new AliArrowTask(arrow,user).runTaskTimer(plugin, 2, 1);
break;
}
}
return;
}
package alisolarflare.magic.tricks;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class AliArrowListener implements Listener {
private final JavaPlugin plugin;
public AliArrowListener(JavaPlugin plugin){
this.plugin = plugin;
}
@EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent event){
if(event.getEntity().getType() != EntityType.ARROW){
return;
}
Arrow arrow = (Arrow) event.getEntity();
if (!(arrow.isCritical()) || !(arrow.getShooter() instanceof Player)){
return;
}
String user = ((Player) arrow.getShooter()).getName();
for (String permittedUser : AliArrowTask.permittedUsers){
if(permittedUser.equalsIgnoreCase(user)){
new AliArrowTask(arrow,user).runTaskTimer(plugin, 2, 1);
break;
}
}
return;
}
}

View file

@ -1,40 +1,40 @@
package alisolarflare.magic;
import org.bukkit.Particle;
import org.bukkit.entity.Arrow;
import org.bukkit.scheduler.BukkitRunnable;
public class AliArrowTask extends BukkitRunnable {
static String[] permittedUsers = {"alisolarflare", "Zanthr", "NorbiPeti"};
String name;
Arrow arrow;
public AliArrowTask(Arrow arrow, String name) {
this.name = name;
this.arrow = arrow;
}
@Override
public void run() {
if (arrow.isOnGround() || arrow.isDead()) {
this.cancel();
}
switch(name.toLowerCase()){
case "alisolarflare":
arrow.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, arrow.getLocation(), 1);
break;
case "zanthr":
arrow.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, arrow.getLocation(), 1);
arrow.getWorld().spawnParticle(Particle.FLAME, arrow.getLocation(), 1);
break;
case "norbipeti":
arrow.getWorld().spawnParticle(Particle.LAVA, arrow.getLocation(), 1);
break;
}
}
}
package alisolarflare.magic.tricks;
import org.bukkit.Particle;
import org.bukkit.entity.Arrow;
import org.bukkit.scheduler.BukkitRunnable;
public class AliArrowTask extends BukkitRunnable {
static String[] permittedUsers = {"alisolarflare", "Zanthr", "NorbiPeti"};
String name;
Arrow arrow;
public AliArrowTask(Arrow arrow, String name) {
this.name = name;
this.arrow = arrow;
}
@Override
public void run() {
if (arrow.isOnGround() || arrow.isDead()) {
this.cancel();
}
switch(name.toLowerCase()){
case "alisolarflare":
arrow.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, arrow.getLocation(), 1);
break;
case "zanthr":
arrow.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, arrow.getLocation(), 1);
arrow.getWorld().spawnParticle(Particle.FLAME, arrow.getLocation(), 1);
break;
case "norbipeti":
arrow.getWorld().spawnParticle(Particle.LAVA, arrow.getLocation(), 1);
break;
}
}
}

View file

@ -1,18 +1,18 @@
package alisolarflare.magic;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
public class BoomBowDeathListener implements Listener{
@EventHandler
public void onBoomBowDeath(PlayerDeathEvent event){
Player player = event.getEntity();
if (player.getLastDamage() > 7.42420 && player.getLastDamage() < 7.42429){
player.sendMessage("42!");
event.setDeathMessage(player.getName() + " got trigger happy with the [Boom Bow]");
}
}
}
package alisolarflare.magic.tricks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
public class BoomBowDeathListener implements Listener{
@EventHandler
public void onBoomBowDeath(PlayerDeathEvent event){
Player player = event.getEntity();
if (player.getLastDamage() > 7.42420 && player.getLastDamage() < 7.42429){
player.sendMessage("42!");
event.setDeathMessage(player.getName() + " got trigger happy with the [Boom Bow]");
}
}
}

View file

@ -1,107 +1,107 @@
package alisolarflare.magic;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class BoomBowListener implements Listener {
JavaPlugin plugin;
public BoomBowListener(JavaPlugin plugin){
this.plugin = plugin;
}
@EventHandler
public void ClickEvent(PlayerInteractEvent event){
FlyBowBoost(event);
}
public void FlyBowBoost(PlayerInteractEvent event){
//ACTION SANITATION
if(!(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)) return;
if(!(event.getPlayer().isGliding())) return;
if(!(event.getMaterial() == Material.BOW)) return;
//BOW SANITATION
ItemStack bow = event.getItem();
if(!(bow.containsEnchantment(Enchantment.ARROW_KNOCKBACK))) return;
if(!(bow.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK) == 3)) return;
if(!(bow.getItemMeta().getDisplayName().contains("BOOM BOW"))) return;
//PLAYER SANITATION
Player player = event.getPlayer();
if(player.getGameMode().equals(GameMode.CREATIVE))return;
if(bow.containsEnchantment(Enchantment.ARROW_INFINITE)){
//HAS INIFINITY
Activate(event);
}else if((player.getInventory().contains(Material.TNT))){
//HAS TNT
Activate(event);
//Reduce tnt by 1
int tntSlot = player.getInventory().first(Material.TNT);
ItemStack tntStack = player.getInventory().getItem(tntSlot);
if(tntStack.getAmount() > 3){
tntStack.setAmount(tntStack.getAmount()-3);
}else{
player.getInventory().remove(tntStack);
}
}else{
return;
}
}
public void Activate(PlayerInteractEvent event){
//INIT - Player variables
Player player = event.getPlayer();
Location playerLocation = player.getLocation();
ItemStack boomBow = player.getInventory().getItemInMainHand();
//TODO: NERF - boomDecay
//TODO: NERF - endCrystal
//TODO: NERF - healthReduction
//TODO: NERF - localized
if(BoomBowRule.boomDecay)
new BoomDecayTask(player).runTaskTimer(plugin, 1, 1);
if(BoomBowRule.endCrystal){
//BoomBowCyrstalSpawn
}
if(BoomBowRule.healthReduction){
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 400, -1));
}
if(BoomBowRule.localized);
//SET - Player Velocity
player.setVelocity(playerLocation.getDirection().normalize().multiply(3.0));
//CREATE - Explosion + damage
player.getWorld().playSound(playerLocation, Sound.ENTITY_GENERIC_EXPLODE, 10, -20);
player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, playerLocation, 2);
player.damage(7.42425, player);
player.sendMessage(player.getLastDamage() + "");
boomBow.setDurability((short) (boomBow.getDurability() + 3));
if(boomBow.getDurability() < 0){
player.getInventory().setItemInMainHand(null);
player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0);
}
}
}
package alisolarflare.magic.tricks;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class BoomBowListener implements Listener {
JavaPlugin plugin;
public BoomBowListener(JavaPlugin plugin){
this.plugin = plugin;
}
@EventHandler
public void ClickEvent(PlayerInteractEvent event){
FlyBowBoost(event);
}
public void FlyBowBoost(PlayerInteractEvent event){
//ACTION SANITATION
if(!(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)) return;
if(!(event.getPlayer().isGliding())) return;
if(!(event.getMaterial() == Material.BOW)) return;
//BOW SANITATION
ItemStack bow = event.getItem();
if(!(bow.containsEnchantment(Enchantment.ARROW_KNOCKBACK))) return;
if(!(bow.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK) == 3)) return;
if(!(bow.getItemMeta().getDisplayName().contains("BOOM BOW"))) return;
//PLAYER SANITATION
Player player = event.getPlayer();
if(player.getGameMode().equals(GameMode.CREATIVE))return;
if(bow.containsEnchantment(Enchantment.ARROW_INFINITE)){
//HAS INIFINITY
Activate(event);
}else if((player.getInventory().contains(Material.TNT))){
//HAS TNT
Activate(event);
//Reduce tnt by 1
int tntSlot = player.getInventory().first(Material.TNT);
ItemStack tntStack = player.getInventory().getItem(tntSlot);
if(tntStack.getAmount() > 3){
tntStack.setAmount(tntStack.getAmount()-3);
}else{
player.getInventory().remove(tntStack);
}
}else{
return;
}
}
public void Activate(PlayerInteractEvent event){
//INIT - Player variables
Player player = event.getPlayer();
Location playerLocation = player.getLocation();
ItemStack boomBow = player.getInventory().getItemInMainHand();
//TODO: NERF - boomDecay
//TODO: NERF - endCrystal
//TODO: NERF - healthReduction
//TODO: NERF - localized
if(BoomBowRule.boomDecay)
new BoomDecayTask(player).runTaskTimer(plugin, 1, 1);
if(BoomBowRule.endCrystal){
//BoomBowCyrstalSpawn
}
if(BoomBowRule.healthReduction){
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 400, -1));
}
if(BoomBowRule.localized);
//SET - Player Velocity
player.setVelocity(playerLocation.getDirection().normalize().multiply(3.0));
//CREATE - Explosion + damage
player.getWorld().playSound(playerLocation, Sound.ENTITY_GENERIC_EXPLODE, 10, -20);
player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, playerLocation, 2);
player.damage(7.42425, player);
player.sendMessage(player.getLastDamage() + "");
boomBow.setDurability((short) (boomBow.getDurability() + 3));
if(boomBow.getDurability() < 0){
player.getInventory().setItemInMainHand(null);
player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0);
}
}
}

View file

@ -1,84 +1,84 @@
package alisolarflare.magic;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.TBMCCommandBase;
//HEHEHHEHEH EAASSSTER EGGS
public class BoomBowRule extends TBMCCommandBase{
public static boolean boomDecay;
public static boolean healthReduction;
public static boolean endCrystal;
public static boolean localized;;
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (sender instanceof Player == false){
sender.sendMessage("You must be a player to use this command");
return false;
}
Player player = (Player) sender;
if (player.getName().equals("alisolarflare") == false){
player.sendMessage("You must be alisolarflare to use this command");
return false;
}
if (args.length < 2){
player.sendMessage("Usage: /boomBowRule [rulename] [true/false]");
player.sendMessage("Rules:");
player.sendMessage("boomDecay" + boomDecay);
player.sendMessage("healthReduction" + healthReduction);
player.sendMessage("endCrystal" + endCrystal);
player.sendMessage("localized" + localized);
return false;
}
if(!(args[1].startsWith("t")|| args[1].startsWith("f"))){
player.sendMessage("Usage: /boomBowRule [rulename] [true/false]");
return false;
}
boolean gameRule = false;
if(args[1].startsWith("t") || args[1].startsWith("T")){
gameRule = true;
}
switch(args[0]){
case "boomDecay":
boomDecay = gameRule;
break;
case "healthReduction":
healthReduction = gameRule;
break;
case "endCrystal":
endCrystal = gameRule;
break;
case "localized":
localized = gameRule;
break;
default:
player.sendMessage("Error: "+args[0]+" not defined as a rule");
player.sendMessage("Usage: /boomBowRule [rulename] [true/false]");
player.sendMessage("Rule settings: boomDecay, healthReduction, endCrystal, localized");
break;
}
return false;
}
@Override
public String GetCommandPath() {
// TODO Auto-generated method stub
return null;
}
@Override
public String[] GetHelpText(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
}
package alisolarflare.magic.tricks;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import buttondevteam.lib.chat.TBMCCommandBase;
//HEHEHHEHEH EAASSSTER EGGS
public class BoomBowRule extends TBMCCommandBase{
public static boolean boomDecay;
public static boolean healthReduction;
public static boolean endCrystal;
public static boolean localized;;
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (sender instanceof Player == false){
sender.sendMessage("You must be a player to use this command");
return false;
}
Player player = (Player) sender;
if (player.getName().equals("alisolarflare") == false){
player.sendMessage("You must be alisolarflare to use this command");
return false;
}
if (args.length < 2){
player.sendMessage("Usage: /boomBowRule [rulename] [true/false]");
player.sendMessage("Rules:");
player.sendMessage("boomDecay" + boomDecay);
player.sendMessage("healthReduction" + healthReduction);
player.sendMessage("endCrystal" + endCrystal);
player.sendMessage("localized" + localized);
return false;
}
if(!(args[1].startsWith("t")|| args[1].startsWith("f"))){
player.sendMessage("Usage: /boomBowRule [rulename] [true/false]");
return false;
}
boolean gameRule = false;
if(args[1].startsWith("t") || args[1].startsWith("T")){
gameRule = true;
}
switch(args[0]){
case "boomDecay":
boomDecay = gameRule;
break;
case "healthReduction":
healthReduction = gameRule;
break;
case "endCrystal":
endCrystal = gameRule;
break;
case "localized":
localized = gameRule;
break;
default:
player.sendMessage("Error: "+args[0]+" not defined as a rule");
player.sendMessage("Usage: /boomBowRule [rulename] [true/false]");
player.sendMessage("Rule settings: boomDecay, healthReduction, endCrystal, localized");
break;
}
return false;
}
@Override
public String GetCommandPath() {
// TODO Auto-generated method stub
return null;
}
@Override
public String[] GetHelpText(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,25 +1,25 @@
package alisolarflare.magic;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class BoomDecayTask extends BukkitRunnable{
Player player;
private int ticksSinceStart = 0;
private final int effectLength = 20;
public BoomDecayTask(Player player){
this.player = player;
}
//runs every tick
@Override
public void run() {
if (ticksSinceStart > effectLength){
this.cancel();
}
player.sendMessage(player.getVelocity().toString());
ticksSinceStart++;
}
}
package alisolarflare.magic.tricks;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class BoomDecayTask extends BukkitRunnable{
Player player;
private int ticksSinceStart = 0;
private final int effectLength = 20;
public BoomDecayTask(Player player){
this.player = player;
}
//runs every tick
@Override
public void run() {
if (ticksSinceStart > effectLength){
this.cancel();
}
player.sendMessage(player.getVelocity().toString());
ticksSinceStart++;
}
}