mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 20:59:39 +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 combineaccessrules="false" kind="src" path="/bukkit"/>
|
||||||
<classpathentry kind="lib" path="C:/dev/war/war/lib/Permissions.jar"/>
|
<classpathentry kind="lib" path="C:/dev/war/war/lib/Permissions.jar"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/craftbukkit"/>
|
<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"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -15,9 +15,15 @@
|
|||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>net.sourceforge.metrics.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||||
|
<nature>net.sourceforge.metrics.nature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
@ -125,7 +125,7 @@ public class War extends JavaPlugin {
|
|||||||
pm.registerEvent(Event.Type.CREATURE_SPAWN, entityListener, Priority.Normal, this);
|
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_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);
|
//pm.registerEvent(Event.Type.CHUNK_UNLOADED, blockListener, Priority.Normal, this);
|
||||||
|
|
||||||
|
@ -99,22 +99,22 @@ public class WarBlockListener extends BlockListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void onBlockBreak(BlockBreakEvent event) {
|
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();
|
Player player = event.getPlayer();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if(player != null && block != null && event.getDamageLevel() == BlockDamageLevel.BROKEN) {
|
if(player != null && block != null) {
|
||||||
handleBreakOrDamage(player, block, event);
|
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) {
|
private void handleBreakOrDamage(Player player, Block block, Cancellable event) {
|
||||||
Warzone warzone = war.warzone(player.getLocation());
|
Warzone warzone = war.warzone(player.getLocation());
|
||||||
@ -142,7 +142,7 @@ public class WarBlockListener extends BlockListener {
|
|||||||
}else if(warzone != null && warzone.isImportantBlock(block)) {
|
}else if(warzone != null && warzone.isImportantBlock(block)) {
|
||||||
if(team != null && team.getSpawnVolume().contains(block)) {
|
if(team != null && team.getSpawnVolume().contains(block)) {
|
||||||
if(player.getInventory().contains(team.getMaterial())) {
|
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);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.entity.CraftItem;
|
import org.bukkit.craftbukkit.entity.CraftItem;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.ItemDrop;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
@ -107,8 +106,9 @@ public class WarPlayerListener extends PlayerListener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ItemDrop item = event.getItemDrop();
|
Item item = event.getItemDrop();
|
||||||
ItemStack itemStack = item.getItemStack();
|
if(item instanceof CraftItem) {
|
||||||
|
ItemStack itemStack = ((CraftItem)item).getItemStack();
|
||||||
if(itemStack != null && itemStack.getType().getId() == team.getMaterial().getId()) {
|
if(itemStack != null && itemStack.getType().getId() == team.getMaterial().getId()) {
|
||||||
// Can't drop a precious block
|
// Can't drop a precious block
|
||||||
war.badMsg(player, "Can't drop " + team.getName() + " block blocks.");
|
war.badMsg(player, "Can't drop " + team.getName() + " block blocks.");
|
||||||
@ -118,6 +118,7 @@ public class WarPlayerListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -128,22 +129,21 @@ public class WarPlayerListener extends PlayerListener {
|
|||||||
if(zone.isFlagThief(player.getName())) {
|
if(zone.isFlagThief(player.getName())) {
|
||||||
// a flag thief can't pick up anything
|
// a flag thief can't pick up anything
|
||||||
event.setCancelled(true);
|
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
|
name: War
|
||||||
version: 1.0 (Eisenhower)
|
version: 1.1 (Guderian)
|
||||||
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
|
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
|
||||||
author: tommytony
|
author: tommytony
|
||||||
website: war.tommytony.com
|
website: war.tommytony.com
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: War
|
name: War
|
||||||
version: 1.0 (Eisenhower)
|
version: 1.1 (Guderian)
|
||||||
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
|
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
|
||||||
author: tommytony
|
author: tommytony
|
||||||
website: war.tommytony.com
|
website: war.tommytony.com
|
||||||
|
Loading…
Reference in New Issue
Block a user