increment version like normal, a few bug fixes, food level should now reset properly when leaving from/dying in the arena

This commit is contained in:
Brian 2012-05-23 21:35:00 -04:00
parent 76dc0c1df3
commit fc28597b95
3 changed files with 179 additions and 8 deletions

146
plugin.yml Normal file
View File

@ -0,0 +1,146 @@
name: MobArena
author: garbagemule
main: com.garbagemule.MobArena.MobArena
version: 0.94.4.67
softdepend: [Spout,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells,Vault]
commands:
ma:
description: Base command for MobArena
usage: |
YOU HAVE AN ERROR!
Find the error in your server log, copy it into
http://pastebin.com, and then paste the link
in the IRC or on the forums.
mobarena:
description: Base command for MobArena
usage: |
YOU HAVE AN ERROR!
Find the error in your server log, copy it into
http://pastebin.com, and then paste the link
in the IRC or on the forums.
permissions:
mobarena.use.join:
description: Join command
default: true
mobarena.use.spec:
description: Spec command
default: true
mobarena.use.leave:
description: Leave command
default: true
mobarena.use.arenalist:
description: Arena list command
default: true
mobarena.use.playerlist:
description: Arena list command
default: true
mobarena.admin:
description: Gives access to all admin commands
default: op
children:
mobarena.admin.enable: true
mobarena.admin.kick: true
mobarena.admin.restore: true
mobarena.admin.force: true
mobarena.admin.teleport: true
mobarena.admin.enable:
description: Enable and disable MobArena and/or arenas.
default: false
mobarena.admin.kick:
description: Kick a player from an arena.
default: false
mobarena.admin.restore:
description: Restore a player's inventory.
default: false
mobarena.admin.force:
description: Force start or end an arena.
default: false
mobarena.admin.teleport:
description: Immune to teleport blocking rules.
default: false
mobarena.setup:
description: Gives access to all setup commands
default: op
children:
mobarena.setup.arena: true
mobarena.setup.setarena: true
mobarena.setup.addarena: true
mobarena.setup.removearena: true
mobarena.setup.protect: true
mobarena.setup.editarena: true
mobarena.setup.setregion: true
mobarena.setup.expandregion: true
mobarena.setup.showregion: true
mobarena.setup.setlobbyregion: true
mobarena.setup.expandlobbyregion: true
mobarena.setup.setwarp: true
mobarena.setup.spawnpoints: true
mobarena.setup.containers: true
mobarena.setup.leaderboards: true
mobarena.setup.checkdata: true
mobarena.setup.classes: true
mobarena.setup.config: true
mobarena.setup.autogenerate: true
mobarena.setup.autodegenerate: true
mobarena.setup.arena:
description: Check which arena is the currently selected arena.
default: false
mobarena.setup.setarena:
description: Select a new arena.
default: false
mobarena.setup.addarena:
description: Add a new arena node.
default: false
mobarena.setup.removearena:
description: Remove an arena.
default: false
mobarena.setup.protect:
description: Turn arena protection on/off.
default: false
mobarena.setup.editarena:
description: Turn editmode on/off.
default: false
mobarena.setup.setregion:
description: Set region points p1/p2.
default: false
mobarena.setup.expandregion:
description: Expand arena region.
default: false
mobarena.setup.showregion:
description: Show arena region.
default: false
mobarena.setup.setlobbyregion:
description: Set lobby region points l1/l2.
default: false
mobarena.setup.expandlobbyregion:
description: Expand lobby region.
default: false
mobarena.setup.setwarp:
description: Set warp points arena/lobby/spectator.
default: false
mobarena.setup.spawnpoints:
description: List all spawnpoints.
default: false
mobarena.setup.containers:
description: List all containers.
default: false
mobarena.setup.leaderboards:
description: Set up leaderboards.
default: false
mobarena.setup.checkdata:
description: Check which points need to be set up.
default: false
mobarena.setup.classes:
description: Allows setting up classes from in-game
default: false
mobarena.setup.config:
description: Save or reload the config-file
default: false
mobarena.setup.autogenerate:
description: Auto-generate an arena.
default: false
mobarena.setup.autodegenerate:
description: Auto-degenerate an arena.
default: false

View File

@ -602,11 +602,13 @@ public class ArenaImpl implements Arena
if (ap != null && running)
log.playerDeath(ap);
arenaPlayers.remove(p);
restoreInvAndExp(p);
if (inLobby(p) || inArena(p))
if (inLobby(p) || inArena(p)) {
restoreInvAndExp(p);
refund(p);
}
else if (inSpec(p)) {
inventoryManager.restoreInventory(p);
}
movePlayerToEntry(p);
discardPlayer(p);
@ -720,7 +722,7 @@ public class ArenaImpl implements Arena
private void removePotionEffects(Player p) {
for (PotionEffect effect : p.getActivePotionEffects()) {
p.addPotionEffect(new PotionEffect(effect.getType(), 0, 0), true);
p.removePotionEffect(effect.getType());
}
}
@ -892,6 +894,9 @@ public class ArenaImpl implements Arena
if (!settings.getBoolean("keep-exp", false)) {
playerData.get(p).restoreData();
}
else {
p.setFoodLevel(playerData.get(p).food());
}
}
@Override

View File

@ -474,7 +474,7 @@ public class ArenaListener
else if (damagee instanceof Player) {
onPlayerDamage(event, (Player) damagee, damager);
}
// Snowman
// Snowmen melting
else if (damagee instanceof Snowman && event.getCause() == DamageCause.MELTING) {
event.setCancelled(true);
}
@ -486,6 +486,10 @@ public class ArenaListener
else if (monsters.getMonsters().contains(damagee)) {
onMonsterDamage(event, damagee, damager);
}
// Player made golems
else if (monsters.getGolems().contains(damagee)) {
onGolemDamage(event, damagee, damager);
}
}
private void onPlayerDamage(EntityDamageEvent event, Player player, Entity damager) {
@ -533,6 +537,21 @@ public class ArenaListener
event.setCancelled(true);
}
}
private void onGolemDamage(EntityDamageEvent event, Entity golem, Entity damager) {
if (damager instanceof Player) {
Player p = (Player) damager;
if (!arena.inArena(p)) {
event.setCancelled(true);
return;
}
if (!pvpEnabled) {
event.setCancelled(true);
return;
}
}
}
private void onBossDamage(EntityDamageEvent event, LivingEntity monster, Entity damager) {
// Health the boss back up.
@ -786,8 +805,9 @@ public class ArenaListener
public void onPlayerQuit(PlayerQuitEvent event) {
Player p = event.getPlayer();
if (!arena.isEnabled() || (!arena.inArena(p) && !arena.inLobby(p)))
if (!arena.isEnabled() || (!arena.inArena(p) && !arena.inLobby(p) && !arena.inSpec(p))) {
return;
}
arena.playerLeave(p);
banned.add(p);
@ -796,7 +816,7 @@ public class ArenaListener
public void onPlayerKick(PlayerKickEvent event) {
Player p = event.getPlayer();
if (!arena.isEnabled() || (!arena.inArena(p) && !arena.inLobby(p))) {
if (!arena.isEnabled() || (!arena.inArena(p) && !arena.inLobby(p) && !arena.inSpec(p))) {
return;
}