minor tweaks
This commit is contained in:
Binary file not shown.
@@ -33,6 +33,7 @@ public class ArenaManager
|
|||||||
protected static Location spectatorLoc = null;
|
protected static Location spectatorLoc = null;
|
||||||
protected static boolean isRunning = false;
|
protected static boolean isRunning = false;
|
||||||
protected static boolean isSetup = false;
|
protected static boolean isSetup = false;
|
||||||
|
protected static boolean isProtected = true;
|
||||||
|
|
||||||
// Location variables for the arena region.
|
// Location variables for the arena region.
|
||||||
protected static Location p1 = null;
|
protected static Location p1 = null;
|
||||||
@@ -145,7 +146,7 @@ public class ArenaManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
MASpawnThread thread = new MASpawnThread();
|
MASpawnThread thread = new MASpawnThread();
|
||||||
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin,thread,100,400);
|
server.getScheduler().scheduleSyncRepeatingTask(plugin,thread,100,400);
|
||||||
|
|
||||||
tellAll("Let the slaughter begin!");
|
tellAll("Let the slaughter begin!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,10 @@ public class MABlockListener extends BlockListener
|
|||||||
|
|
||||||
public void onBlockDamage(BlockDamageEvent event)
|
public void onBlockDamage(BlockDamageEvent event)
|
||||||
{
|
{
|
||||||
if (!ArenaManager.isSetup)
|
if (!ArenaManager.isSetup || !ArenaManager.isProtected)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ArenaManager.blockSet.contains(event.getBlock()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (MAUtils.inRegion(event.getBlock().getLocation()))
|
if (MAUtils.inRegion(event.getBlock().getLocation()))
|
||||||
@@ -32,7 +35,10 @@ public class MABlockListener extends BlockListener
|
|||||||
|
|
||||||
public void onBlockBreak(BlockBreakEvent event)
|
public void onBlockBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (!ArenaManager.isSetup)
|
if (!ArenaManager.isSetup || !ArenaManager.isProtected)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ArenaManager.blockSet.contains(event.getBlock()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (MAUtils.inRegion(event.getBlock().getLocation()))
|
if (MAUtils.inRegion(event.getBlock().getLocation()))
|
||||||
@@ -41,7 +47,7 @@ public class MABlockListener extends BlockListener
|
|||||||
|
|
||||||
public void onBlockPlace(BlockPlaceEvent event)
|
public void onBlockPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (!ArenaManager.isSetup)
|
if (!ArenaManager.isSetup || !ArenaManager.isProtected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (MAUtils.inRegion(event.getBlock().getLocation()))
|
if (MAUtils.inRegion(event.getBlock().getLocation()))
|
||||||
|
|||||||
@@ -170,6 +170,19 @@ public class MACommands implements CommandExecutor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ma protect true/false
|
||||||
|
if (cmd.equals("protect"))
|
||||||
|
{
|
||||||
|
if (!arg.equals("true") && !arg.equals("false"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Set the boolean
|
||||||
|
ArenaManager.isProtected = Boolean.valueOf(arg);
|
||||||
|
|
||||||
|
ArenaManager.tellPlayer(p, "Region protection: " + arg);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import java.util.Random;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Slime;
|
import org.bukkit.entity.Slime;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Creature;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.CreatureType;
|
import org.bukkit.entity.CreatureType;
|
||||||
|
|
||||||
@@ -25,11 +26,16 @@ public class MASpawnThread implements Runnable
|
|||||||
private int wave, noOfSpawnPoints, noOfPlayers;
|
private int wave, noOfSpawnPoints, noOfPlayers;
|
||||||
private int dZombies, dSkeletons, dSpiders, dCreepers;
|
private int dZombies, dSkeletons, dSpiders, dCreepers;
|
||||||
private Random random;
|
private Random random;
|
||||||
|
private Player target;
|
||||||
|
private Object[] playerArray;
|
||||||
|
private String reward, currentRewards;
|
||||||
|
|
||||||
public MASpawnThread()
|
public MASpawnThread()
|
||||||
{
|
{
|
||||||
|
// Turn the set into an array for lookup with random numbers.
|
||||||
|
playerArray = ArenaManager.playerSet.toArray();
|
||||||
|
noOfPlayers = playerArray.length;
|
||||||
noOfSpawnPoints = ArenaManager.spawnpoints.size();
|
noOfSpawnPoints = ArenaManager.spawnpoints.size();
|
||||||
noOfPlayers = ArenaManager.playerSet.size();
|
|
||||||
wave = 1;
|
wave = 1;
|
||||||
random = new Random();
|
random = new Random();
|
||||||
|
|
||||||
@@ -41,10 +47,7 @@ public class MASpawnThread implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
String reward;
|
|
||||||
String currentRewards;
|
|
||||||
|
|
||||||
// Check if we need to grant more rewards with the recurrent waves.
|
// Check if we need to grant more rewards with the recurrent waves.
|
||||||
for (Integer i : ArenaManager.everyWaveMap.keySet())
|
for (Integer i : ArenaManager.everyWaveMap.keySet())
|
||||||
{
|
{
|
||||||
@@ -98,9 +101,9 @@ public class MASpawnThread implements Runnable
|
|||||||
Location loc;
|
Location loc;
|
||||||
int ran;
|
int ran;
|
||||||
|
|
||||||
for (int i = 0; i < wave+noOfPlayers; i++)
|
for (int i = 0; i < wave + noOfPlayers; i++)
|
||||||
{
|
{
|
||||||
loc = ArenaManager.spawnpoints.get(random.nextInt(noOfSpawnPoints));
|
loc = ArenaManager.spawnpoints.get(i % noOfSpawnPoints);
|
||||||
ran = random.nextInt(dCreepers);
|
ran = random.nextInt(dCreepers);
|
||||||
CreatureType mob;
|
CreatureType mob;
|
||||||
|
|
||||||
@@ -117,6 +120,11 @@ public class MASpawnThread implements Runnable
|
|||||||
|
|
||||||
LivingEntity e = ArenaManager.world.spawnCreature(loc,mob);
|
LivingEntity e = ArenaManager.world.spawnCreature(loc,mob);
|
||||||
ArenaManager.monsterSet.add(e);
|
ArenaManager.monsterSet.add(e);
|
||||||
|
|
||||||
|
// Grab a random target.
|
||||||
|
ran = random.nextInt(noOfPlayers);
|
||||||
|
Creature c = (Creature) e;
|
||||||
|
c.setTarget((Player)playerArray[ran]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +136,7 @@ public class MASpawnThread implements Runnable
|
|||||||
Location loc;
|
Location loc;
|
||||||
CreatureType mob;
|
CreatureType mob;
|
||||||
|
|
||||||
int count;
|
int ran, count;
|
||||||
boolean lightning = false;
|
boolean lightning = false;
|
||||||
boolean slime = false;
|
boolean slime = false;
|
||||||
|
|
||||||
@@ -164,18 +172,27 @@ public class MASpawnThread implements Runnable
|
|||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
loc = ArenaManager.spawnpoints.get(random.nextInt(noOfSpawnPoints));
|
loc = ArenaManager.spawnpoints.get(i % noOfSpawnPoints);
|
||||||
|
|
||||||
LivingEntity e = ArenaManager.world.spawnCreature(loc,mob);
|
LivingEntity e = ArenaManager.world.spawnCreature(loc,mob);
|
||||||
if (lightning)
|
|
||||||
{
|
|
||||||
ArenaManager.world.strikeLightningEffect(loc);
|
|
||||||
e.setFireTicks(0);
|
|
||||||
e.setHealth(20);
|
|
||||||
}
|
|
||||||
if (slime) ((Slime)e).setSize(2);
|
|
||||||
|
|
||||||
ArenaManager.monsterSet.add(e);
|
ArenaManager.monsterSet.add(e);
|
||||||
|
|
||||||
|
if (slime) ((Slime)e).setSize(2);
|
||||||
|
|
||||||
|
// Slimes can't have targets, apparently.
|
||||||
|
if (!(e instanceof Creature))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Grab a random target.
|
||||||
|
ran = random.nextInt(noOfPlayers);
|
||||||
|
Creature c = (Creature) e;
|
||||||
|
c.setTarget((Player)playerArray[ran]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lightning, just for effect ;)
|
||||||
|
for (Location l : ArenaManager.spawnpoints)
|
||||||
|
{
|
||||||
|
ArenaManager.world.strikeLightningEffect(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ public class MAUtils
|
|||||||
c.setProperty("classes.Knight.armor", "306,307,308,309");
|
c.setProperty("classes.Knight.armor", "306,307,308,309");
|
||||||
c.setProperty("classes.Tank.items", "iron_sword, grilled_pork:2");
|
c.setProperty("classes.Tank.items", "iron_sword, grilled_pork:2");
|
||||||
c.setProperty("classes.Tank.armor", "310,311,312,313");
|
c.setProperty("classes.Tank.armor", "310,311,312,313");
|
||||||
c.setProperty("classes.Oddjob.items", "stone_sword, flint_and_steal, netherrack:2, wood_door, fishing_rod, apple, grilled_pork:3");
|
c.setProperty("classes.Oddjob.items", "stone_sword, flint_and_steel, netherrack:2, wood_pickaxe, wood_door, fishing_rod, apple, grilled_pork:3");
|
||||||
c.setProperty("classes.Oddjob.armor", "298,299,300,301");
|
c.setProperty("classes.Oddjob.armor", "298,299,300,301");
|
||||||
c.setProperty("classes.Chef.items", "stone_sword, bread:6, grilled_pork:4, mushroom_soup, cake:3, cookie:12");
|
c.setProperty("classes.Chef.items", "stone_sword, bread:6, grilled_pork:4, mushroom_soup, cake:3, cookie:12");
|
||||||
c.setProperty("classes.Chef.armor", "314,315,316,317");
|
c.setProperty("classes.Chef.armor", "314,315,316,317");
|
||||||
|
|||||||
Reference in New Issue
Block a user