mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-16 20:41:56 +01:00
v0.88 - Fixed players dropping items if they actually die, added wolves to default waves, added world-node to config-file
This commit is contained in:
parent
7ff9e1b251
commit
a48859be6b
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: MobArena
|
||||
main: com.garbagemule.MobArena.MobArena
|
||||
version: 0.87.3
|
||||
version: 0.88
|
||||
commands:
|
||||
mobarena:
|
||||
description: Base command for MobArena
|
||||
|
@ -44,7 +44,7 @@ public class ArenaManager
|
||||
|
||||
// Spawn locations list and monster distribution fields.
|
||||
protected static List<Location> spawnpoints = new ArrayList<Location>();
|
||||
protected static int dZombies, dSkeletons, dSpiders, dCreepers;
|
||||
protected static int dZombies, dSkeletons, dSpiders, dCreepers, dWolves;
|
||||
|
||||
// Set and Maps for storing players, their locations, items, armor, etc.
|
||||
protected static Set<Player> playerSet = new HashSet<Player>();
|
||||
@ -102,6 +102,7 @@ public class ArenaManager
|
||||
dSkeletons = MAUtils.getDistribution("skeletons");
|
||||
dSpiders = MAUtils.getDistribution("spiders");
|
||||
dCreepers = MAUtils.getDistribution("creepers");
|
||||
dWolves = MAUtils.getDistribution("wolves");
|
||||
}
|
||||
|
||||
// Convenience variables.
|
||||
|
@ -3,6 +3,7 @@ package com.garbagemule.MobArena;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
|
||||
/**
|
||||
* This listener acts as a type of death-listener.
|
||||
@ -42,4 +43,24 @@ public class MADamageListener extends EntityListener
|
||||
p.setFireTicks(0);
|
||||
ArenaManager.playerDeath(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all player drops on death.
|
||||
*/
|
||||
public void onEntityDeath(EntityDeathEvent event)
|
||||
{
|
||||
if (!ArenaManager.isRunning)
|
||||
return;
|
||||
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player p = (Player) event.getEntity();
|
||||
|
||||
if (!ArenaManager.playerSet.contains(p))
|
||||
return;
|
||||
|
||||
event.getDrops().clear();
|
||||
ArenaManager.playerDeath(p);
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
public class MASpawnThread implements Runnable
|
||||
{
|
||||
private int wave, noOfSpawnPoints, noOfPlayers;
|
||||
private int dZombies, dSkeletons, dSpiders, dCreepers;
|
||||
private int dZombies, dSkeletons, dSpiders, dCreepers, dWolves;
|
||||
private Random random;
|
||||
private String reward, currentRewards;
|
||||
|
||||
@ -44,6 +44,7 @@ public class MASpawnThread implements Runnable
|
||||
dSkeletons = dZombies + ArenaManager.dSkeletons;
|
||||
dSpiders = dSkeletons + ArenaManager.dSpiders;
|
||||
dCreepers = dSpiders + ArenaManager.dCreepers;
|
||||
dWolves = dCreepers + ArenaManager.dWolves;
|
||||
}
|
||||
|
||||
public void run()
|
||||
@ -104,7 +105,7 @@ public class MASpawnThread implements Runnable
|
||||
for (int i = 0; i < wave + noOfPlayers; i++)
|
||||
{
|
||||
loc = ArenaManager.spawnpoints.get(i % noOfSpawnPoints);
|
||||
ran = random.nextInt(dCreepers);
|
||||
ran = random.nextInt(dWolves);
|
||||
CreatureType mob;
|
||||
|
||||
/* Because of the nature of the if-elseif-else statement,
|
||||
@ -116,11 +117,15 @@ public class MASpawnThread implements Runnable
|
||||
else if (ran < dSkeletons) mob = CreatureType.SKELETON;
|
||||
else if (ran < dSpiders) mob = CreatureType.SPIDER;
|
||||
else if (ran < dCreepers) mob = CreatureType.CREEPER;
|
||||
else if (ran < dWolves) mob = CreatureType.WOLF;
|
||||
else continue;
|
||||
|
||||
LivingEntity e = ArenaManager.world.spawnCreature(loc,mob);
|
||||
ArenaManager.monsterSet.add(e);
|
||||
|
||||
//if (mob == CreatureType.WOLF)
|
||||
// ((Wolf)e).setAngry(true);
|
||||
|
||||
// Grab a random target.
|
||||
Creature c = (Creature) e;
|
||||
c.setTarget(getClosestPlayer(e));
|
||||
@ -161,7 +166,7 @@ public class MASpawnThread implements Runnable
|
||||
break;
|
||||
case 4:
|
||||
mob = CreatureType.WOLF;
|
||||
count = noOfPlayers * 2;
|
||||
count = noOfPlayers * 3;
|
||||
wolf = true;
|
||||
break;
|
||||
case 5:
|
||||
|
@ -210,6 +210,7 @@ public class MAUtils
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a Configuration object from the config.yml file.
|
||||
*/
|
||||
@ -243,11 +244,10 @@ public class MAUtils
|
||||
Configuration c = ArenaManager.config;
|
||||
c.load();
|
||||
|
||||
String world = c.getString("world");
|
||||
|
||||
if (world == null)
|
||||
return ArenaManager.server.getWorlds().get(0);
|
||||
String world = c.getString("world", ArenaManager.server.getWorlds().get(0).getName());
|
||||
c.setProperty("world", world);
|
||||
|
||||
c.save();
|
||||
return ArenaManager.server.getWorld(world);
|
||||
}
|
||||
|
||||
@ -410,6 +410,25 @@ public class MAUtils
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grabs coordinate information from the config-file.
|
||||
*/
|
||||
public static Location getCoords(String name)
|
||||
{
|
||||
Configuration c = ArenaManager.config;
|
||||
c.load();
|
||||
|
||||
// Return null if coords aren't in the config file.
|
||||
if (c.getKeys("coords." + name) == null)
|
||||
return null;
|
||||
|
||||
double x = c.getDouble("coords." + name + ".x", 0);
|
||||
double y = c.getDouble("coords." + name + ".y", 0);
|
||||
double z = c.getDouble("coords." + name + ".z", 0);
|
||||
|
||||
return new Location(ArenaManager.world, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes coordinate information to the config-file.
|
||||
*/
|
||||
@ -443,25 +462,6 @@ public class MAUtils
|
||||
ArenaManager.updateVariables();
|
||||
}
|
||||
|
||||
/**
|
||||
* Grabs coordinate information from the config-file.
|
||||
*/
|
||||
public static Location getCoords(String name)
|
||||
{
|
||||
Configuration c = ArenaManager.config;
|
||||
c.load();
|
||||
|
||||
// Return null if coords aren't in the config file.
|
||||
if (c.getKeys("coords." + name) == null)
|
||||
return null;
|
||||
|
||||
double x = c.getDouble("coords." + name + ".x", 0);
|
||||
double y = c.getDouble("coords." + name + ".y", 0);
|
||||
double z = c.getDouble("coords." + name + ".z", 0);
|
||||
|
||||
return new Location(ArenaManager.world, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Maintains the invariant that p1's coordinates are of lower
|
||||
* values than their respective counter-parts of p2. Makes the
|
||||
|
@ -63,6 +63,7 @@ public class MobArena extends JavaPlugin
|
||||
pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, damageListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DEATH, damageListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_EXPLODE, monsterListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_COMBUST, monsterListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_TARGET, monsterListener, Priority.Normal, this);
|
||||
|
Loading…
Reference in New Issue
Block a user