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

View file

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

View file

@ -1,52 +1,52 @@
package alisolarflare.components.gpowers; package alisolarflare.components.gpowers;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class Memory_GPower{ public class GPowerMemory{
public Map<UUID, poweredPlayer> poweredPlayerList = new HashMap<UUID, poweredPlayer>(); public Map<UUID, poweredPlayer> poweredPlayerList = new HashMap<UUID, poweredPlayer>();
public void configurePlayer(Player player, String colour, boolean powerIsActive){ public void configurePlayer(Player player, String colour, boolean powerIsActive){
poweredPlayerList.put(player.getUniqueId(), new poweredPlayer(player.getUniqueId(), colour, true)); poweredPlayerList.put(player.getUniqueId(), new poweredPlayer(player.getUniqueId(), colour, true));
} }
public void PowerUpPlayer(Player player){ public void PowerUpPlayer(Player player){
player.sendMessage("Powering up!"); player.sendMessage("Powering up!");
if(poweredPlayerList.containsKey(player.getUniqueId())){ if(poweredPlayerList.containsKey(player.getUniqueId())){
poweredPlayerList.get(player.getUniqueId()).isPowersActive = true; poweredPlayerList.get(player.getUniqueId()).isPowersActive = true;
player.sendMessage("Powered up!"); player.sendMessage("Powered up!");
}else{ }else{
player.sendMessage("You must instantiate your power settings using /GPower"); player.sendMessage("You must instantiate your power settings using /GPower");
} }
} }
public void PowerDownPlayer(Player player){ public void PowerDownPlayer(Player player){
player.sendMessage("Powering down!"); player.sendMessage("Powering down!");
if (poweredPlayerList.containsKey(player.getUniqueId())){ if (poweredPlayerList.containsKey(player.getUniqueId())){
player.sendMessage("Powered down!"); player.sendMessage("Powered down!");
poweredPlayerList.get(player.getUniqueId()).isPowersActive = false; poweredPlayerList.get(player.getUniqueId()).isPowersActive = false;
}else{ }else{
player.sendMessage("P down!"); player.sendMessage("P down!");
return; return;
} }
} }
public class poweredPlayer{ public class poweredPlayer{
public UUID uuid; public UUID uuid;
public String colour; public String colour;
public Boolean isPowersActive; public Boolean isPowersActive;
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);
this.isPowersActive = (activated); this.isPowersActive = (activated);
} }
public String toString(){ public String toString(){
return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+isPowersActive + "]"; 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; package alisolarflare.components.gpowers.commands;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.TBMCCommandBase; import alisolarflare.components.gpowers.GPowerMemory;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_GPower extends TBMCCommandBase {
public class GPower extends TBMCCommandBase {
private Memory_GPower gPowerMemory;
private GPowerMemory gPowerMemory;
public Command_GPower(Memory_GPower gPowerMemory) {
this.gPowerMemory = gPowerMemory; public GPower(GPowerMemory gPowerMemory) {
} this.gPowerMemory = gPowerMemory;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) { @Override
sender.sendMessage("G power activate!"); public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (!(sender instanceof Player)){ sender.sendMessage("G power activate!");
sender.sendMessage("You must be a player to use this command! Talk to a dev/ali if you think this is wrong"); 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 player = (Player) sender;
player.sendMessage("Proper Usage to test G-Powers:"); if (args.length < 2) {
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]"); player.sendMessage("Proper Usage to test G-Powers:");
return false; 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") String colour;
|| args[0].startsWith("b") || args[0].startsWith("p")) { if (args[0].startsWith("r") || args[0].startsWith("o") || args[0].startsWith("y") || args[0].startsWith("g")
colour = args[0]; || args[0].startsWith("b") || args[0].startsWith("p")) {
} else { colour = args[0];
player.sendMessage("error: colour. Proper Usage to configure G-Powers:"); } else {
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]"); player.sendMessage("error: colour. Proper Usage to configure G-Powers:");
return false; player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]");
} return false;
boolean isActive; }
if (args[1].startsWith("t")) { boolean isActive;
isActive = true; if (args[1].startsWith("t")) {
} else if (args[1].startsWith("f")) { isActive = true;
isActive = false; } else if (args[1].startsWith("f")) {
} else { isActive = false;
player.sendMessage("error: active. Proper Usage to configure G-Powers:"); } else {
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]"); player.sendMessage("error: active. Proper Usage to configure G-Powers:");
return false; 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); player.sendMessage("Terms Vaild!");
gPowerMemory.configurePlayer(player, colour, isActive); player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive);
gPowerMemory.configurePlayer(player, colour, isActive);
return false;
} return false;
}
@Override
public String[] GetHelpText(String alias) { @Override
// TODO Auto-generated method stub public String[] GetHelpText(String alias) {
return new String[] { "" }; // TODO Auto-generated method stub
} return new String[] { "" };
}
@Override
public String GetCommandPath() { @Override
return "gpower"; public String GetCommandPath() {
} return "gpower";
}
@Override
public boolean GetPlayerOnly() { @Override
return true; public boolean GetPlayerOnly() {
} return true;
}
@Override
public boolean GetModOnly() { @Override
return false; public boolean GetModOnly() {
} return false;
}
}
}

View file

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

View file

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

View file

@ -1,66 +1,66 @@
package alisolarflare.components.gpowers; package alisolarflare.components.gpowers.listeners;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import alisolarflare.components.gpowers.Memory_GPower.poweredPlayer; import alisolarflare.components.gpowers.GPowerMemory.poweredPlayer;
public class Task_PowerApplier extends BukkitRunnable{ public class gPowerApplyingTask extends BukkitRunnable{
private Server server; private Server server;
private Map<UUID, poweredPlayer> poweredPlayerList; private Map<UUID, poweredPlayer> poweredPlayerList;
public Task_PowerApplier(Server server, Map<UUID, poweredPlayer> poweredPlayerList) { public gPowerApplyingTask(Server server, Map<UUID, poweredPlayer> poweredPlayerList) {
this.server = server; this.server = server;
this.poweredPlayerList = poweredPlayerList; this.poweredPlayerList = poweredPlayerList;
} }
//REPEATS EVERY 5 SECONDS //REPEATS EVERY 5 SECONDS
@Override @Override
public void run() { public void run() {
for (Player player : server.getOnlinePlayers()){ for (Player player : server.getOnlinePlayers()){
if(poweredPlayerList.containsKey(player.getUniqueId())){ if(poweredPlayerList.containsKey(player.getUniqueId())){
activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour); activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour);
} }
} }
} }
private void activatePower(Player player, String colour) { private void activatePower(Player player, String colour) {
//GREY //GREY
if ((colour.startsWith("grey") || colour.startsWith("gra")) && (player.getWorld().getTime() > 12575 && player.getWorld().getTime() < 22925)){ 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.REGENERATION, 200, 0, true, false, Color.GRAY));
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 300, 0, true, false, Color.GRAY)); player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 300, 0, true, false, Color.GRAY));
//RED //RED
}else if (colour.startsWith("r")){ }else if (colour.startsWith("r")){
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 0, true, false, Color.RED)); player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 0, true, false, Color.RED));
//ORANGE //ORANGE
}else if (colour.startsWith("o")){ }else if (colour.startsWith("o")){
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200, 0, true, false, Color.ORANGE)); 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)); player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 0, true, false, Color.ORANGE));
//YELLOW //YELLOW
}else if (colour.startsWith("y") && player.getLocation().getBlock().getLightFromSky() == 15 && player.getLocation().getBlock().getLightFromBlocks() == 15){ }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)); player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 200, 0, true, false, Color.YELLOW));
//GREEN //GREEN
}else if (colour.startsWith("g") && !colour.startsWith("gra") && !colour.startsWith("grey")){ }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.LUCK, 200, 1, true, false, Color.GREEN));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 200, 0, true, false, Color.GREEN)); player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 200, 0, true, false, Color.GREEN));
//BLUE //BLUE
}else if (colour.startsWith("b")){ }else if (colour.startsWith("b")){
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1, true, false, Color.BLUE)); 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)); player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 200, 0, true, false, Color.BLUE));
//PURPLE //PURPLE
}else if (colour.startsWith("p")){ }else if (colour.startsWith("p")){
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 200, 0, true, false, Color.PURPLE)); player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 200, 0, true, false, Color.PURPLE));
//NULL //NULL
}else{ }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; package alisolarflare.components.links.commands;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.lib.chat.TBMCCommandBase; import alisolarflare.components.links.entities.Link;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_PressAliLink extends TBMCCommandBase {
private JavaPlugin plugin; public class PressAliLink extends TBMCCommandBase {
private Command_SetAliLink setAliLink; private JavaPlugin plugin;
private SetAliLink setAliLink;
public Command_PressAliLink(JavaPlugin plugin, Command_SetAliLink setAliLink) {
this.plugin = plugin; public PressAliLink(JavaPlugin plugin, SetAliLink setAliLink) {
this.setAliLink = setAliLink; this.plugin = plugin;
} this.setAliLink = setAliLink;
}
@Override
public boolean OnCommand(CommandSender sender, String label, String[] args) { @Override
public boolean OnCommand(CommandSender sender, String label, String[] args) {
sender.getServer().broadcastMessage(setAliLink.linkList.toString() + "over.");
sender.getServer().broadcastMessage(setAliLink.linkList.toString() + "over.");
if (args.length < 1) {
sender.sendMessage("You must specify a link frequency"); if (args.length < 1) {
sender.sendMessage("/pressalilink [frequency]"); sender.sendMessage("You must specify a link frequency");
} sender.sendMessage("/pressalilink [frequency]");
for (Memory_Link link : setAliLink.linkList) { }
for (String inputlink : args) { for (Link link : setAliLink.linkList) {
if (inputlink.equals(link.frequency)) { for (String inputlink : args) {
link.press(plugin); if (inputlink.equals(link.frequency)) {
} link.press(plugin);
} }
} }
return false; }
} return false;
}
@Override
public String[] GetHelpText(String alias) { @Override
// TODO Auto-generated method stub public String[] GetHelpText(String alias) {
return null; // TODO Auto-generated method stub
} return null;
}
@Override
public String GetCommandPath() { @Override
return "pressalilink"; public String GetCommandPath() {
} return "pressalilink";
}
@Override
public boolean GetPlayerOnly() { @Override
// TODO Auto-generated method stub public boolean GetPlayerOnly() {
return false; // TODO Auto-generated method stub
} return false;
}
@Override
public boolean GetModOnly() { @Override
// TODO Auto-generated method stub public boolean GetModOnly() {
return false; // TODO Auto-generated method stub
} return false;
}
}
}

View file

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

View file

@ -1,39 +1,41 @@
package alisolarflare.components.links; package alisolarflare.components.links.entities;
import java.io.Serializable; import java.io.Serializable;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class Memory_Link implements Serializable{ import alisolarflare.components.links.tasks.UnpressTask;
/**
* public class Link implements Serializable{
*/ /**
private static final long serialVersionUID = 1L; *
public String frequency; */
public String world; private static final long serialVersionUID = 1L;
public String x; public String frequency;
public String y; public String world;
public String z; public String x;
public String y;
public String z;
public Memory_Link(String frequency, Location location){
this.frequency = frequency;
this.world = location.getWorld().getName(); public Link(String frequency, Location location){
this.x = "" + location.getBlockX(); this.frequency = frequency;
this.y = "" + location.getBlockY(); this.world = location.getWorld().getName();
this.z = "" + location.getBlockZ(); this.x = "" + location.getBlockX();
//plugin.plugin.getConfig().set("frequency", 10); this.y = "" + location.getBlockY();
} this.z = "" + location.getBlockZ();
/** //plugin.plugin.getConfig().set("frequency", 10);
* Activates the Ali-Link }
* @param plugin /**
*/ * Activates the Ali-Link
public void press(JavaPlugin plugin) { * @param plugin
Location location = new Location(plugin.getServer().getWorld(world), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z)); */
location.getBlock().setType(Material.REDSTONE_BLOCK); public void press(JavaPlugin plugin) {
Task_UnpressTask unPressTask = new Task_UnpressTask(location); Location location = new Location(plugin.getServer().getWorld(world), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z));
unPressTask.runTaskTimer(plugin, 2, 1); 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; package alisolarflare.components.links.tasks;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
public class Task_UnpressTask extends BukkitRunnable { public class UnpressTask extends BukkitRunnable {
private Location location; private Location location;
public Task_UnpressTask(Location location){ public UnpressTask(Location location){
this.location = location; this.location = location;
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public void run() { public void run() {
location.getBlock().setType(Material.STAINED_CLAY); location.getBlock().setType(Material.STAINED_CLAY);
location.getBlock().setData((byte) 14); location.getBlock().setData((byte) 14);
this.cancel(); 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; package alisolarflare.creativeboundaries.commands;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import buttondevteam.lib.chat.TBMCCommandBase; import alisolarflare.creativeboundaries.CreativeBoundariesModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_Cbgm0 extends TBMCCommandBase{
public class Cbgm0 extends TBMCCommandBase{
private Module_CreativeBoundaries module;
private CreativeBoundariesModule module;
public Command_Cbgm0(Module_CreativeBoundaries module) {
this.module = module; public Cbgm0(CreativeBoundariesModule module) {
} this.module = module;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) { @Override
if (!(sender instanceof Player)){ public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
sender.sendMessage("You must be a player to use this command!"); if (!(sender instanceof Player)){
return false; sender.sendMessage("You must be a player to use this command!");
} return false;
}
Player player = (Player) sender;
player.setGameMode(GameMode.SURVIVAL); Player player = (Player) sender;
module.cbCreatives.remove(player); player.setGameMode(GameMode.SURVIVAL);
return false; module.cbCreatives.remove(player);
} return false;
}
@Override
public String[] GetHelpText(String alias) { @Override
// TODO Auto-generated method stub public String[] GetHelpText(String alias) {
return null; // TODO Auto-generated method stub
} return null;
}
@Override
public boolean GetPlayerOnly() { @Override
// TODO Auto-generated method stub public boolean GetPlayerOnly() {
return false; // TODO Auto-generated method stub
} return false;
}
@Override
public boolean GetModOnly() { @Override
// TODO Auto-generated method stub public boolean GetModOnly() {
return false; // TODO Auto-generated method stub
} return false;
}
}
}

View file

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

View file

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

View file

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

View file

@ -1,67 +1,69 @@
package alisolarflare.creativeboundaries; package alisolarflare.creativeboundaries.listeners;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent; import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town; import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock; import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownyUniverse; import com.palmergames.bukkit.towny.object.TownyUniverse;
public class Listener_PlotChange implements Listener{ import alisolarflare.creativeboundaries.CreativeBoundariesModule;
public Module_CreativeBoundaries module;
public Listener_PlotChange(Module_CreativeBoundaries module){ public class PlotChangeListener implements Listener{
this.module = module; public CreativeBoundariesModule module;
} public PlotChangeListener(CreativeBoundariesModule module){
@EventHandler this.module = module;
public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){ }
Player player = plotEvent.getPlayer(); @EventHandler
if (module.dickmode == false){ public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){
return; Player player = plotEvent.getPlayer();
} if (module.dickmode == false){
if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){ return;
return; }
} if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){
if (!(module.cbCreatives.contains(plotEvent.getPlayer()))){ return;
return; }
} if (!(module.cbCreatives.contains(plotEvent.getPlayer()))){
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation()); return;
if (tb == null) { }
player.setGameMode(GameMode.SURVIVAL); TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
player.sendMessage("You have left your town boundaries!"); if (tb == null) {
module.cbCreatives.remove(player); player.setGameMode(GameMode.SURVIVAL);
return; player.sendMessage("You have left your town boundaries!");
} module.cbCreatives.remove(player);
Town town; return;
try { }
town = tb.getTown(); Town town;
} catch (NotRegisteredException e) { try {
player.setGameMode(GameMode.SURVIVAL); town = tb.getTown();
player.sendMessage("You have left your town boundaries!!"); } catch (NotRegisteredException e) {
module.cbCreatives.remove(player); player.setGameMode(GameMode.SURVIVAL);
return; 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!!!"); if (town == null) {
module.cbCreatives.remove(player); player.setGameMode(GameMode.SURVIVAL);
return; player.sendMessage("You have left your town boundaries!!!");
} module.cbCreatives.remove(player);
boolean townHasRes = false; return;
for(Resident res : town.getResidents()){ }
if (res.getName().toString().equals(player.getName().toString())){ boolean townHasRes = false;
townHasRes = true; 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!!!!"); if (!townHasRes){
module.cbCreatives.remove(player); 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 org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_ActivatePowers extends TBMCCommandBase{ public class ActivatePowers extends TBMCCommandBase{
@Override @Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) { 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 org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_SetupWorldBorders extends TBMCCommandBase { public class SetupWorldBorders extends TBMCCommandBase {
@Override @Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) { 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 org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_ShrinkWorldBorders extends TBMCCommandBase { public class ShrinkWorldBorders extends TBMCCommandBase {
@Override @Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) { 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 org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_SpreadPlayers extends TBMCCommandBase{ public class SpreadPlayers extends TBMCCommandBase{
@Override @Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) { 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 org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_StartTimer extends TBMCCommandBase{ public class StartTimer extends TBMCCommandBase{
@Override @Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) { 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 org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_StartUHC extends TBMCCommandBase{ public class StartUHC extends TBMCCommandBase{
@Override @Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) { 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 org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
public class Command_TeleportToUHC extends TBMCCommandBase{ public class TeleportToUHC extends TBMCCommandBase{
@Override @Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) { 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 org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module; import alisolarflare.Module;
import alisolarflare.magic.tricks.AliArrowListener;
import alisolarflare.magic.tricks.BoomBowDeathListener;
import alisolarflare.magic.tricks.BoomBowListener;
public class MagicModule extends Module{ public class MagicModule extends Module{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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