Change some stuff.

This commit is contained in:
YoshiGenius 2012-07-17 14:47:12 +10:00
parent f2d2d634a3
commit 7649fc4682
61 changed files with 206 additions and 16 deletions

@ -4,7 +4,7 @@
<groupId>me.Travja.HungerArena</groupId>
<artifactId>HungerArena</artifactId>
<version>0.5</version>
<version>1.3alpha</version>
<packaging>jar</packaging>
<name>HungerArena</name>

@ -30,6 +30,7 @@ public class DeathListener implements Listener{
}
}
@EventHandler
@SuppressWarnings("SizeReplaceableByIsEmpty")
public void onPlayerDeath(PlayerDeathEvent event){
Player p = event.getEntity();
Server s = p.getServer();
@ -110,7 +111,7 @@ public class DeathListener implements Listener{
winner.getInventory().addItem(plugin.Reward);
plugin.Playing.clear();
//Show spectators
if(!plugin.Watching.isEmpty()){
if(plugin.Watching.size() != 0){
String s1 = plugin.Watching.get(i++);
Player spectator = plugin.getServer().getPlayerExact(s1);
spectator.setAllowFlight(false);

@ -0,0 +1,32 @@
package me.travja.hungerarena;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
/**
*
* @author YoshiGenius
*/
public class DmgListener implements Listener {
public Main plugin;
public DmgListener(Main m) {
this.plugin = m;
}
@EventHandler
public void onDmg(EntityDamageEvent evt) {
Entity e = evt.getEntity();
if (e instanceof Player) {
Player p = (Player) e;
String pn = p.getName();
if (plugin.Frozen.contains(pn)) {
evt.setCancelled(true);
}
}
}
}

@ -1,9 +1,11 @@
package me.travja.hungerarena;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class FreezeListener implements Listener {
public Main plugin;
@ -15,7 +17,8 @@ public class FreezeListener implements Listener {
Player p = event.getPlayer();
String pname = p.getName();
if(plugin.Frozen.contains(pname) && plugin.config.getString("Frozen_Teleport").equalsIgnoreCase("True")){
event.setCancelled(true);
Location from = event.getFrom();
p.teleport(from, TeleportCause.ENDER_PEARL);
}
}
}

@ -13,9 +13,19 @@ import org.bukkit.event.player.PlayerQuitEvent;
public class JoinAndQuitListener implements Listener {
public Main plugin;
public JoinAndQuitListener(Main m) {
this.plugin = m;
this.plugin = m;
}
int i = 0;
@EventHandler
public void onJoin(PlayerJoinEvent evt) {
Player p = evt.getPlayer();
for (String s : plugin.Watching) {
Player spectator = Bukkit.getServer().getPlayerExact(s);
p.hidePlayer(spectator);
}
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event){
final Player p = event.getPlayer();
@ -50,6 +60,24 @@ public class JoinAndQuitListener implements Listener {
}, 40L);
}
}
@EventHandler
public void onQuit(PlayerQuitEvent evt) {
Player p = evt.getPlayer();
String pname = p.getName();
if (plugin.Frozen.contains(pname)) {
plugin.Frozen.remove(pname);
String[] Spawncoords = plugin.config.getString("Spawn_coords").split(",");
String w = Spawncoords[3];
World spawnw = plugin.getServer().getWorld(w);
double spawnx = Double.parseDouble(Spawncoords[0]);
double spawny = Double.parseDouble(Spawncoords[1]);
double spawnz = Double.parseDouble(Spawncoords[2]);
Location Spawn = new Location(spawnw, spawnx, spawny, spawnz);
p.teleport(Spawn);
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event){
final Player p = event.getPlayer();
@ -102,7 +130,6 @@ public class JoinAndQuitListener implements Listener {
}
}else{
plugin.Quit.add(pname);
plugin.Out.remove(pname);
}
}
}, 1200L);

@ -31,6 +31,8 @@ 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 Damage = new DmgListener(this);
public Listener Teleport = new TeleportListener(this);
public Listener Signs = new Signs(this);
public Listener BlockStorage = new BlockStorage(this);
public Listener WinGames = new WinGamesListener(this);
@ -60,6 +62,7 @@ public class Main extends JavaPlugin{
getServer().getPluginManager().registerEvents(Signs, this);
getServer().getPluginManager().registerEvents(BlockStorage, this);
getServer().getPluginManager().registerEvents(WinGames, this);
getServer().getPluginManager().registerEvents(Damage, this);
getCommand("Ha").setExecutor(HaCommands);
getCommand("Sponsor").setExecutor(SponsorCommands);
getCommand("Startpoint").setExecutor(SpawnsCommand);

@ -19,28 +19,33 @@ public class Signs implements Listener {
public void Sign(PlayerInteractEvent event){
Player p = event.getPlayer();
Block b = event.getClickedBlock();
if (b == null) {
return;
}
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(ChatColor.BLUE + "[HungerArena]")){
if(lines[1].isEmpty()){
String line1 = sign.getLine(0);
String line2 = sign.getLine(1);
String line3 = sign.getLine(2);
String line4 = sign.getLine(3);
if(line1.equalsIgnoreCase(ChatColor.BLUE + "[HungerArena]") || line1.equalsIgnoreCase(ChatColor.BLUE + "[HA]")){
if(line2.equals("")){
p.performCommand("ha");
}else{
p.performCommand("ha " + lines[1]);
p.performCommand("ha " + line2);
}
}
if(lines[0].equalsIgnoreCase(ChatColor.BLUE + "[Sponsor]")){
p.performCommand("sponsor " + lines[1] + " " + lines[2] + " " + lines[3]);
if(line1.equalsIgnoreCase(ChatColor.BLUE + "[Sponsor]")){
p.performCommand("sponsor " + line2 + " " + line3 + " " + line4);
}
}
}
}
@EventHandler
public void Create(SignChangeEvent event){
String[] lines = event.getLines();
String top = lines[0];
if(top.equalsIgnoreCase("[HungerArena]") || top.equalsIgnoreCase("[Sponsor]")){
String top = event.getLine(0);
if(top.equalsIgnoreCase("[HungerArena]") || top.equalsIgnoreCase("[HA]") || top.equalsIgnoreCase("[Sponsor]")){
event.setLine(0, ChatColor.BLUE + top);
}
}

@ -118,8 +118,8 @@ public class SpectatorListener implements Listener {
@EventHandler
public void MobNerf(EntityTargetEvent event){
Entity target = event.getTarget();
Entity le = event.getEntity();
if (le instanceof Player) {
Entity e = event.getEntity();
if (e instanceof Player) {
return;
}
if(target instanceof Player){

@ -0,0 +1,36 @@
package me.travja.hungerarena;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
/**
*
* @author YoshiGenius
*/
public class TeleportListener implements Listener {
public Main plugin;
public TeleportListener(Main m) {
this.plugin = m;
}
@EventHandler
public void onTP(PlayerTeleportEvent evt) {
Player p = evt.getPlayer();
TeleportCause tc = evt.getCause();
if (tc == TeleportCause.ENDER_PEARL) {
return;
}
if (tc == TeleportCause.END_PORTAL) {
return;
}
if (tc == TeleportCause.NETHER_PORTAL) {
return;
}
evt.setCancelled(true);
}
}

BIN
target/HungerArena-0.5.jar Normal file

Binary file not shown.

Binary file not shown.

66
target/classes/config.yml Normal file

@ -0,0 +1,66 @@
# default config.yml
#config version for us devs. DONT CHANGE THIS, or it will screw up some things PRETTY badly.
config:
version: 1.3
# Message to display when the games start
Start_Message: '&bLet The Games Begin!'
# If the games should automatically restart at the end
Auto_Restart: 'false'
# If it should automatically start the countdown on warping
Auto_Start: 'false'
# If tributes need to type /ha confirm to join
Need_Confirm: 'true'
# What the reward for winning is
Reward:
ID: 264
Amount: 10
# What sponsors have to pay to sponsor tributes
Sponsor_Cost:
ID: 264
Amount: 1
# Whether or not the countdown will start upon warping.
Countdown: 'true'
Spawn_coords: 100,100,100,world
# If players will only talk to close players of the whole server
ChatClose: 'false'
# How close the players have to be to talk to them
ChatClose_Radius: 10
# Whether or not players can break blocks while playing
Protected_Arena: 'true'
# Whether or not players will be frozen when they are teleported to their positions
Frozen_Teleport: 'true'
# Whether or not thunder will sound upon a players death
Cannon_Death: 'true'
Tribute_one_spawn: 100,100,100
Tribute_two_spawn: 100,100,100
Tribute_three_spawn: 100,100,100
Tribute_four_spawn: 100,100,100
Tribute_five_spawn: 100,100,100
Tribute_six_spawn: 100,100,100
Tribute_seven_spawn: 100,100,100
Tribute_eight_spawn: 100,100,100
Tribute_nine_spawn: 100,100,100
Tribute_ten_spawn: 100,100,100
Tribute_eleven_spawn: 100,100,100
Tribute_twelve_spawn: 100,100,100
Tribute_thirteen_spawn: 100,100,100
Tribute_fourteen_spawn: 100,100,100
Tribute_fifteen_spawn: 100,100,100
Tribute_sixteen_spawn: 100,100,100
Tribute_seventeen_spawn: 100,100,100
Tribute_eighteen_spawn: 100,100,100
Tribute_nineteen_spawn: 100,100,100
Tribute_twenty_spawn: 100,100,100
Tribute_twentyone_spawn: 100,100,100
Tribute_twentytwo_spawn: 100,100,100
Tribute_twentythree_spawn: 100,100,100
Tribute_twentyfour_spawn: 100,100,100
# If /ha setspawn has been run
Spawn_set: 'false'
# True means give money to winner, false means don't.
eco:
enabled: false
reward: 100
# How much money to give the winner.
# Leave this. :)
Blocks_Destroyed:

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

12
target/classes/plugin.yml Normal file

@ -0,0 +1,12 @@
name: HungerArena
main: me.travja.hungerarena.Main
version: 1.3alpha
description: A lightweight and powerful plugin to help with playing The Hunger Games!
softdepend: [Vault]
commands:
Ha:
description: Base command for HungerArena!
StartPoint:
description: Set the starting points for tributes.
Sponsor:
description: Sponsor a tribute.

@ -0,0 +1,5 @@
#Generated by Maven
#Sun Jul 15 20:25:06 EST 2012
version=1.3alpha
groupId=me.Travja.HungerArena
artifactId=HungerArena