Started work on FlairDoors

This commit is contained in:
alisolarflare 2016-08-21 21:11:02 -04:00
parent 79a18d02dd
commit 828a57a21f
7 changed files with 129 additions and 2 deletions

View file

@ -9,3 +9,5 @@ commands:
description: Presses an Ali Link pressalilink frequency
setalilink:
description: Creates an Ali Link setalilink frequency
setFlairDoorColour:
description: Sets the flair door colour mode, when lighting portals

View file

@ -0,0 +1,25 @@
package alisolarflare.flairdoors;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.AliPresents;
public class FlairDoorsSubPlug{
private AliPresents plugin;
public FlairDoorsSubPlug(AliPresents plugin){
this.plugin = plugin;
}
public void register(){
registerCommands();
registerEvents();
}
private void registerCommands() {
plugin.getCommand("SetFlairDoorColour").setExecutor(new SetFlairDoorColour());
}
private void registerEvents() {
// TODO Auto-generated method stub
plugin.getServer().getPluginManager().registerEvents(new PortalLightListener(), plugin);
}
}

View file

@ -0,0 +1,44 @@
package alisolarflare.flairdoors;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityCreatePortalEvent;
import org.bukkit.event.entity.EntityPortalEvent;
public class PortalLightListener implements Listener{
//TODO: CREATE - LIST OF PORTALS (only x-z values)
@EventHandler
public void onPortalLight(EntityCreatePortalEvent event){
//SANITATION - entity > player
if(!(event.getEntity() instanceof Player)){return;}
Player player = (Player) event.getEntity();
//SANITIATION - player > alisolarflare
if(!(player.getName() == "alisolarflare")){return;}
//TODO: MARK PORTAL
if (SetFlairDoorColour.FlairDoorColorMode == "null"){
player.sendMessage("Your Colour mode is set to Null, use /SetFlairDoorColour [Color] to specify a colour for this portal");
return;
}
//TODO: SAVE PORTAL
}
@EventHandler
public void onPortalEnter(EntityPortalEvent event){
event.setCancelled(false);
//TODO: IF PLAYER LOCATION IS INSIDE A COLOUR PORTAL
//TODO: IF PLAYER NOT FLAIRED
//TODO: IF PLAYERSTATE IS TRUE
//TODO: CHANGE CUSTOM DISPLAY NAME
//TODO: TELEPORT TO SPAWN
//TODO: MARK PLAYER AS COLOURED
}
}

View file

@ -0,0 +1,44 @@
package alisolarflare.flairdoors;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class SetFlairDoorColour implements CommandExecutor {
public static String FlairDoorColorMode = "null";
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length > 1){
sender.sendMessage("You must specify and argument, Red-Purple or Null.");
}
String firstCommand = args[0];
firstCommand = firstCommand.toLowerCase();
if(firstCommand.startsWith("e")|| firstCommand.startsWith("gra")|| firstCommand.startsWith("grey")){
sender.sendMessage("Flair Door Colour Mode set to grey");
FlairDoorColorMode = "gray";
}else if(firstCommand.startsWith("r")){
sender.sendMessage("Flair Door Colour Mode set to Red");
FlairDoorColorMode = "red";
}else if(firstCommand.startsWith("o")){
sender.sendMessage("Flair Door Colour Mode set to Orange");
FlairDoorColorMode = "orange";
}else if(firstCommand.startsWith("y")){
sender.sendMessage("Flair Door Colour Mode set to Yellow");
FlairDoorColorMode = "yellow";
}else if(firstCommand.startsWith("g")){
sender.sendMessage("Flair Door Colour Mode set to Green (use E for grey)");
FlairDoorColorMode = "green";
}else if(firstCommand.startsWith("b") || firstCommand.startsWith("i")){
sender.sendMessage("Flair Door Colour Mode set to Blue");
FlairDoorColorMode = "blue";
}else if(firstCommand.startsWith("v") || firstCommand.startsWith("p")){
sender.sendMessage("Flair Door Colour Mode set to Purple");
FlairDoorColorMode = "purple";
}else if(firstCommand.startsWith("n")){
sender.sendMessage("Flair Door Colour Mode set to Null");
FlairDoorColorMode = "null";
}
return false;
}
}

View file

@ -32,5 +32,12 @@ public class AliLinkSubPlug{
plugin.getCommand("setalilink").setExecutor(new SetAliLink(this));
}
public void saveLinkList(){
plugin.getConfig().set("aliLinkList", linkList);
}
@SuppressWarnings("unchecked")
public List<Link> loadLinkList(){
return (List<Link>) plugin.getConfig().getList("aliLinkList");
}
}

View file

@ -12,7 +12,12 @@ public class Link implements Serializable{
private static final long serialVersionUID = 1L;
AliLinkSubPlug subplugin;
String frequency;
String world;
Location location;
int x;
int y;
int z;
public Link(AliLinkSubPlug plugin, String frequency, Location location){
this.frequency = frequency;