mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 18:55:28 +01:00
First v1.1 commit. Minecraft 1.3 and craftbukkit 431 fixes. Cant drop blocks and cant pickup more than one precious block. Also move to not use BLOCK_DAMAGED. Using BLOCK_BREAK instead: Grum says it's more reliable.
This commit is contained in:
parent
01b86036dd
commit
b775997046
@ -6,6 +6,5 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/bukkit"/>
|
||||
<classpathentry kind="lib" path="C:/dev/war/war/lib/Permissions.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/craftbukkit"/>
|
||||
<classpathentry kind="lib" path="C:/dev/war/war/lib/minecraft_server.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -15,9 +15,15 @@
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>net.sourceforge.metrics.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>net.sourceforge.metrics.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
@ -125,7 +125,7 @@ public class War extends JavaPlugin {
|
||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this);
|
||||
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Priority.Normal, this);
|
||||
|
||||
//pm.registerEvent(Event.Type.CHUNK_UNLOADED, blockListener, Priority.Normal, this);
|
||||
|
||||
|
@ -99,22 +99,22 @@ public class WarBlockListener extends BlockListener {
|
||||
}
|
||||
}
|
||||
|
||||
// public void onBlockBreak(BlockBreakEvent event) {
|
||||
// Player player = event.getPlayer();
|
||||
// Block block = event.getBlock();
|
||||
// if(player != null && block != null) {
|
||||
// handleBreakOrDamage(player, block, event);
|
||||
// }
|
||||
// }
|
||||
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getBlock();
|
||||
if(player != null && block != null && event.getDamageLevel() == BlockDamageLevel.BROKEN) {
|
||||
handleBreakOrDamage(player,block, event);
|
||||
|
||||
if(player != null && block != null) {
|
||||
handleBreakOrDamage(player, block, event);
|
||||
}
|
||||
}
|
||||
|
||||
// public void onBlockDamage(BlockDamageEvent event) {
|
||||
// Player player = event.getPlayer();
|
||||
// Block block = event.getBlock();
|
||||
// if(player != null && block != null && event.getDamageLevel() == BlockDamageLevel.BROKEN) {
|
||||
// handleBreakOrDamage(player,block, event);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
private void handleBreakOrDamage(Player player, Block block, Cancellable event) {
|
||||
Warzone warzone = war.warzone(player.getLocation());
|
||||
@ -142,7 +142,7 @@ public class WarBlockListener extends BlockListener {
|
||||
}else if(warzone != null && warzone.isImportantBlock(block)) {
|
||||
if(team != null && team.getSpawnVolume().contains(block)) {
|
||||
if(player.getInventory().contains(team.getMaterial())) {
|
||||
war.badMsg(player, "You already have a " + team.getName() + " block.");
|
||||
//war.badMsg(player, "You already have a " + team.getName() + " block.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else {
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.entity.CraftItem;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.ItemDrop;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
@ -107,13 +106,15 @@ public class WarPlayerListener extends PlayerListener {
|
||||
event.setCancelled(true);
|
||||
|
||||
} else {
|
||||
ItemDrop item = event.getItemDrop();
|
||||
ItemStack itemStack = item.getItemStack();
|
||||
if(itemStack != null && itemStack.getType().getId() == team.getMaterial().getId()) {
|
||||
// Can't drop a precious block
|
||||
war.badMsg(player, "Can't drop " + team.getName() + " block blocks.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
Item item = event.getItemDrop();
|
||||
if(item instanceof CraftItem) {
|
||||
ItemStack itemStack = ((CraftItem)item).getItemStack();
|
||||
if(itemStack != null && itemStack.getType().getId() == team.getMaterial().getId()) {
|
||||
// Can't drop a precious block
|
||||
war.badMsg(player, "Can't drop " + team.getName() + " block blocks.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,22 +129,21 @@ public class WarPlayerListener extends PlayerListener {
|
||||
if(zone.isFlagThief(player.getName())) {
|
||||
// a flag thief can't pick up anything
|
||||
event.setCancelled(true);
|
||||
} else {
|
||||
Item item = event.getItem();
|
||||
if(item instanceof CraftItem) {
|
||||
CraftItem cItem = (CraftItem)item;
|
||||
ItemStack itemStack = cItem.getItemStack();
|
||||
if(itemStack != null && itemStack.getType().getId() == team.getMaterial().getId()
|
||||
&& player.getInventory().contains(team.getMaterial())) {
|
||||
// Can't pick up a second precious block
|
||||
war.badMsg(player, "You already have a " + team.getName() + " block.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// } else {
|
||||
// Item item = event.getItem();
|
||||
// if(item instanceof CraftItem) {
|
||||
// CraftItem cItem = (CraftItem)item;
|
||||
// ItemStack itemStack = cItem.getItemStack();
|
||||
// if(itemStack != null && itemStack.getType().getId() == team.getMaterial().getId()
|
||||
// && player.getInventory().contains(team.getMaterial())) {
|
||||
// // Can't pick up a second precious block
|
||||
// war.badMsg(player, "You already have a " + team.getName() + " block.");
|
||||
// event.setCancelled(true);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: War
|
||||
version: 1.0 (Eisenhower)
|
||||
version: 1.1 (Guderian)
|
||||
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
|
||||
author: tommytony
|
||||
website: war.tommytony.com
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: War
|
||||
version: 1.0 (Eisenhower)
|
||||
version: 1.1 (Guderian)
|
||||
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
|
||||
author: tommytony
|
||||
website: war.tommytony.com
|
||||
|
Loading…
Reference in New Issue
Block a user