Added Signs and did some more touchups

This commit is contained in:
Travis Eggett 2012-05-28 20:54:55 -06:00
parent 47cb43efc2
commit d8ae176cd8
17 changed files with 42 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -107,6 +107,8 @@ public class HaCommands implements CommandExecutor {
p.sendMessage(ChatColor.RED + "The game is in progress!"); p.sendMessage(ChatColor.RED + "The game is in progress!");
}else if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){ }else if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){
p.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!"); p.sendMessage(ChatColor.RED + "/ha setspawn hasn't been run!");
}else if(plugin.NeedConfirm.contains(p)){
p.sendMessage(ChatColor.RED + "You need to do /ha confirm");
}else{ }else{
plugin.NeedConfirm.add(p); plugin.NeedConfirm.add(p);
p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede"); p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede");

View File

@ -57,6 +57,7 @@ public class Main extends JavaPlugin{
public Listener PvP = new PvP(this); public Listener PvP = new PvP(this);
public Listener Blocks = new Blocks(this); public Listener Blocks = new Blocks(this);
public Listener CommandBlock = new CommandBlock(this); public Listener CommandBlock = new CommandBlock(this);
public Listener Signs = new Signs(this);
public CommandExecutor HaCommands = new HaCommands(this); public CommandExecutor HaCommands = new HaCommands(this);
public CommandExecutor SponsorCommands = new SponsorCommands(this); public CommandExecutor SponsorCommands = new SponsorCommands(this);
public CommandExecutor SpawnsCommand = new SpawnsCommand(this); public CommandExecutor SpawnsCommand = new SpawnsCommand(this);
@ -80,6 +81,7 @@ public class Main extends JavaPlugin{
getServer().getPluginManager().registerEvents(PvP, this); getServer().getPluginManager().registerEvents(PvP, this);
getServer().getPluginManager().registerEvents(Blocks, this); getServer().getPluginManager().registerEvents(Blocks, this);
getServer().getPluginManager().registerEvents(CommandBlock, this); getServer().getPluginManager().registerEvents(CommandBlock, this);
getServer().getPluginManager().registerEvents(Signs, this);
getCommand("Ha").setExecutor(HaCommands); getCommand("Ha").setExecutor(HaCommands);
getCommand("Sponsor").setExecutor(SponsorCommands); getCommand("Sponsor").setExecutor(SponsorCommands);
getCommand("Startpoint").setExecutor(SpawnsCommand); getCommand("Startpoint").setExecutor(SpawnsCommand);

View File

@ -0,0 +1,38 @@
package me.Travja.HungerArena;
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.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
public class Signs implements Listener {
public Main plugin;
public Signs(Main m) {
this.plugin = m;
}
@EventHandler
public void Sign(PlayerInteractEvent event){
Player p = event.getPlayer();
Block b = event.getClickedBlock();
if(event.getAction()== Action.RIGHT_CLICK_BLOCK){
if(b.getType()== Material.SIGN || b.getType()==Material.SIGN_POST || b.getType()==Material.WALL_SIGN){
org.bukkit.block.Sign sign = (org.bukkit.block.Sign) b.getState();
String[] lines = sign.getLines();
if(lines[0].equalsIgnoreCase("[HungerArena]")){
if(lines[1].equalsIgnoreCase("Join")){
p.performCommand("ha join");
}
if(lines[1].equalsIgnoreCase("Confirm")){
p.performCommand("ha confirm");
}
if(lines[1].equalsIgnoreCase("Leave")){
p.performCommand("ha leave");
}
}
}
}
}
}