Added Signs and did some more touchups
This commit is contained in:
@@ -107,6 +107,8 @@ public class HaCommands implements CommandExecutor {
|
||||
p.sendMessage(ChatColor.RED + "The game is in progress!");
|
||||
}else if(plugin.config.getString("Spawns_set").equalsIgnoreCase("false")){
|
||||
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{
|
||||
plugin.NeedConfirm.add(p);
|
||||
p.sendMessage(ChatColor.GOLD + "You're inventory will be cleared! Type /ha confirm to procede");
|
||||
|
@@ -57,6 +57,7 @@ public class Main extends JavaPlugin{
|
||||
public Listener PvP = new PvP(this);
|
||||
public Listener Blocks = new Blocks(this);
|
||||
public Listener CommandBlock = new CommandBlock(this);
|
||||
public Listener Signs = new Signs(this);
|
||||
public CommandExecutor HaCommands = new HaCommands(this);
|
||||
public CommandExecutor SponsorCommands = new SponsorCommands(this);
|
||||
public CommandExecutor SpawnsCommand = new SpawnsCommand(this);
|
||||
@@ -80,6 +81,7 @@ public class Main extends JavaPlugin{
|
||||
getServer().getPluginManager().registerEvents(PvP, this);
|
||||
getServer().getPluginManager().registerEvents(Blocks, this);
|
||||
getServer().getPluginManager().registerEvents(CommandBlock, this);
|
||||
getServer().getPluginManager().registerEvents(Signs, this);
|
||||
getCommand("Ha").setExecutor(HaCommands);
|
||||
getCommand("Sponsor").setExecutor(SponsorCommands);
|
||||
getCommand("Startpoint").setExecutor(SpawnsCommand);
|
||||
|
38
src/me/Travja/HungerArena/Signs.java
Normal file
38
src/me/Travja/HungerArena/Signs.java
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user