mirror of
https://github.com/taoneill/war.git
synced 2025-03-11 06:00:48 +01:00
v0.7 Manstein release.
This commit is contained in:
parent
b4d0e89ec8
commit
816067f76d
@ -66,6 +66,8 @@ public class War extends JavaPlugin {
|
||||
private boolean defaultAutoAssignOnly = false;
|
||||
private int defaultTeamCap = 7;
|
||||
private int defaultScoreCap = 10;
|
||||
private boolean defaultBlockHeads = false;
|
||||
private boolean defaultDropLootOnDeath = false;
|
||||
private boolean pvpInZonesOnly = false;
|
||||
private WarHub warHub;
|
||||
|
||||
@ -99,10 +101,10 @@ public class War extends JavaPlugin {
|
||||
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Normal, this);
|
||||
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_ENTITY, entityListener, Priority.High, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_PROJECTILE, entityListener, Priority.High, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_ENTITY, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DAMAGEDBY_PROJECTILE, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.High, this);
|
||||
pm.registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
|
||||
|
||||
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
|
||||
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
|
||||
@ -121,7 +123,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||
if(sender.isPlayer()) {
|
||||
if(sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
String command = cmd.getName();
|
||||
String[] arguments = null;
|
||||
@ -589,6 +591,7 @@ public class War extends JavaPlugin {
|
||||
p.teleportTo(warzone.getTeleport());
|
||||
player.sendMessage(this.str("You have left the warzone. Your inventory has (hopefully) been restored."));
|
||||
}
|
||||
team.setPoints(0);
|
||||
team.getPlayers().clear();
|
||||
}
|
||||
|
||||
@ -977,7 +980,15 @@ public class War extends JavaPlugin {
|
||||
if(namedParams.containsKey("outline")){
|
||||
String onOff = namedParams.get("outline");
|
||||
warzone.setDrawZoneOutline(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
}
|
||||
if(namedParams.containsKey("blockHeads")){
|
||||
String onOff = namedParams.get("blockHeads");
|
||||
warzone.setBlockHeads(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
// if(namedParams.containsKey("dropLootOnDeath")){
|
||||
// String onOff = namedParams.get("dropLootOnDeath");
|
||||
// warzone.setDropLootOnDeath(onOff.equals("on") || onOff.equals("true"));
|
||||
// }
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
@ -1018,6 +1029,14 @@ public class War extends JavaPlugin {
|
||||
String onOff = namedParams.get("pvpinzonesonly");
|
||||
setPvpInZonesOnly(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
if(namedParams.containsKey("blockHeads")){
|
||||
String onOff = namedParams.get("blockHeads");
|
||||
setDefaultBlockHeads(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
// if(namedParams.containsKey("dropLootOnDeath")){
|
||||
// String onOff = namedParams.get("dropLootOnDeath");
|
||||
// setDefaultDropLootOnDeath(onOff.equals("on") || onOff.equals("true"));
|
||||
// }
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
@ -1264,5 +1283,21 @@ public class War extends JavaPlugin {
|
||||
Block again = world.getBlockAt(block.getX(), block.getY(), block.getZ());
|
||||
return again.getState();
|
||||
}
|
||||
|
||||
public void setDefaultBlockHeads(boolean defaultBlockHeads) {
|
||||
this.defaultBlockHeads = defaultBlockHeads;
|
||||
}
|
||||
|
||||
public boolean isDefaultBlockHeads() {
|
||||
return defaultBlockHeads;
|
||||
}
|
||||
|
||||
public void setDefaultDropLootOnDeath(boolean defaultDropLootOnDeath) {
|
||||
this.defaultDropLootOnDeath = defaultDropLootOnDeath;
|
||||
}
|
||||
|
||||
public boolean isDefaultDropLootOnDeath() {
|
||||
return defaultDropLootOnDeath;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ public class WarEntityListener extends EntityListener {
|
||||
|
||||
public WarEntityListener(War war) {
|
||||
this.war = war;
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
@ -36,8 +35,11 @@ public class WarEntityListener extends EntityListener {
|
||||
Player player = (Player)e;
|
||||
Team team = war.getPlayerTeam(player.getName());
|
||||
if(team != null) {
|
||||
handleDeath(player, war.getPlayerTeamWarzone(player.getName()), team);
|
||||
event.getDrops().clear(); // no loot
|
||||
Warzone zone = war.getPlayerTeamWarzone(player.getName());
|
||||
handleDeath(player, zone, team);
|
||||
if(!zone.isDropLootOnDeath()) {
|
||||
event.getDrops().clear(); // no loot
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -81,34 +83,37 @@ public class WarEntityListener extends EntityListener {
|
||||
&& attackerTeam != defenderTeam
|
||||
&& attackerWarzone == defenderWarzone) {
|
||||
// Make sure one of the players isn't in the spawn
|
||||
if(!defenderTeam.getSpawnVolume().contains(d.getLocation())){
|
||||
// A real attack: handle death scenario. ==> now handled in entity damage as well
|
||||
//synchronized(d) {
|
||||
// if(d.getHealth() <= 0) {
|
||||
//// // Player died, loot him!
|
||||
//// PlayerInventory attackerInv = a.getInventory();
|
||||
//// PlayerInventory defenderInv = d.getInventory();
|
||||
//// HashMap<Integer, ItemStack> noMorePlace = new HashMap<Integer, ItemStack>();
|
||||
//// for(ItemStack stack : defenderInv.getContents()) {
|
||||
//// HashMap<Integer, ItemStack> newNoMorePlace = attackerInv.addItem(stack);
|
||||
//// noMorePlace.putAll(newNoMorePlace);
|
||||
//// }
|
||||
// if(!){
|
||||
// // A real attack: handle death scenario. ==> now handled in entity damage as well
|
||||
// //synchronized(d) {
|
||||
//// if(d.getHealth() <= 0) {
|
||||
////// // Player died, loot him!
|
||||
////// PlayerInventory attackerInv = a.getInventory();
|
||||
////// PlayerInventory defenderInv = d.getInventory();
|
||||
////// HashMap<Integer, ItemStack> noMorePlace = new HashMap<Integer, ItemStack>();
|
||||
////// for(ItemStack stack : defenderInv.getContents()) {
|
||||
////// HashMap<Integer, ItemStack> newNoMorePlace = attackerInv.addItem(stack);
|
||||
////// noMorePlace.putAll(newNoMorePlace);
|
||||
////// }
|
||||
//////
|
||||
////// // attacker inventory is full, drop the rest.
|
||||
////// if(!noMorePlace.isEmpty()) {
|
||||
////// for(Integer key : noMorePlace.keySet()) {
|
||||
////// ItemStack toDrop = noMorePlace.get(key);
|
||||
////// defender.getWorld().dropItem(defender.getLocation(), toDrop);
|
||||
////// }
|
||||
////// }
|
||||
////
|
||||
//// // attacker inventory is full, drop the rest.
|
||||
//// if(!noMorePlace.isEmpty()) {
|
||||
//// for(Integer key : noMorePlace.keySet()) {
|
||||
//// ItemStack toDrop = noMorePlace.get(key);
|
||||
//// defender.getWorld().dropItem(defender.getLocation(), toDrop);
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
// handleDeath(d, defenderWarzone, defenderTeam);
|
||||
// event.setCancelled(true);
|
||||
//}
|
||||
}
|
||||
else { // attacking person in spawn
|
||||
//// handleDeath(d, defenderWarzone, defenderTeam);
|
||||
//// event.setCancelled(true);
|
||||
// //}
|
||||
// }
|
||||
if(defenderTeam.getSpawnVolume().contains(d.getLocation())) { // attacking person in spawn
|
||||
a.sendMessage(war.str("Can't attack a player that's inside his team's spawn."));
|
||||
event.setCancelled(true);
|
||||
} else if(attackerTeam.getSpawnVolume().contains(a.getLocation())) {
|
||||
a.sendMessage(war.str("Can't attack a player from inside your spawn."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
//}
|
||||
} else if (attackerTeam != null && defenderTeam != null
|
||||
|
@ -48,6 +48,8 @@ public class Warzone {
|
||||
private War war;
|
||||
private ZoneLobby lobby;
|
||||
private boolean autoAssignOnly;
|
||||
private boolean blockHeads;
|
||||
private boolean dropLootOnDeath;
|
||||
|
||||
|
||||
public Warzone(War war, World world, String name) {
|
||||
@ -61,6 +63,8 @@ public class Warzone {
|
||||
this.setAutoAssignOnly(war.getDefaultAutoAssignOnly());
|
||||
this.teamCap = war.getDefaultTeamCap();
|
||||
this.scoreCap = war.getDefaultScoreCap();
|
||||
this.setBlockHeads(war.isDefaultBlockHeads());
|
||||
this.setDropLootOnDeath(war.isDefaultDropLootOnDeath());
|
||||
this.volume = new VerticalVolume(name, war, this.getWorld());
|
||||
}
|
||||
|
||||
@ -376,13 +380,16 @@ public class Warzone {
|
||||
playerInv.setItem(slot, loadout.get(slot));
|
||||
//}
|
||||
}
|
||||
|
||||
if(team.getMaterial() == Material.GOLD_BLOCK) {
|
||||
playerInv.setHelmet(new ItemStack(Material.GOLD_HELMET));
|
||||
} else if (team.getMaterial() == Material.DIAMOND_BLOCK) {
|
||||
playerInv.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
|
||||
} else if (team.getMaterial() == Material.IRON_BLOCK) {
|
||||
playerInv.setHelmet(new ItemStack(Material.IRON_HELMET));
|
||||
if(isBlockHeads()) {
|
||||
playerInv.setHelmet(new ItemStack(team.getMaterial()));
|
||||
} else {
|
||||
if(team.getMaterial() == Material.GOLD_BLOCK) {
|
||||
playerInv.setHelmet(new ItemStack(Material.GOLD_HELMET));
|
||||
} else if (team.getMaterial() == Material.DIAMOND_BLOCK) {
|
||||
playerInv.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
|
||||
} else if (team.getMaterial() == Material.IRON_BLOCK) {
|
||||
playerInv.setHelmet(new ItemStack(Material.IRON_HELMET));
|
||||
}
|
||||
}
|
||||
player.setHealth(20);
|
||||
}
|
||||
@ -903,4 +910,20 @@ public class Warzone {
|
||||
war.getWarHub().resetZoneSign(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBlockHeads(boolean blockHeads) {
|
||||
this.blockHeads = blockHeads;
|
||||
}
|
||||
|
||||
public boolean isBlockHeads() {
|
||||
return blockHeads;
|
||||
}
|
||||
|
||||
public void setDropLootOnDeath(boolean dropLootOnDeath) {
|
||||
this.dropLootOnDeath = dropLootOnDeath;
|
||||
}
|
||||
|
||||
public boolean isDropLootOnDeath() {
|
||||
return dropLootOnDeath;
|
||||
}
|
||||
}
|
||||
|
@ -104,9 +104,15 @@ public class WarMapper {
|
||||
// defaultScoreCap
|
||||
war.setDefaultScoreCap(warConfig.getInt("defaultScoreCap"));
|
||||
|
||||
// defaultScoreCap
|
||||
// pvpInZonesOnly
|
||||
war.setPvpInZonesOnly(warConfig.getBoolean("pvpInZonesOnly"));
|
||||
|
||||
// defaultBlockHeads
|
||||
war.setDefaultBlockHeads(warConfig.getBoolean("defaultBlockHeads"));
|
||||
|
||||
// defaultDropLootOnDeath
|
||||
//war.setDefaultDropLootOnDeath(warConfig.getBoolean("defaultDropLootOnDeath"));
|
||||
|
||||
// warhub
|
||||
String hubStr = warConfig.getString("warhub");
|
||||
if(hubStr != null && !hubStr.equals("")) {
|
||||
@ -179,11 +185,16 @@ public class WarMapper {
|
||||
warConfig.setInt("defaultTeamCap", war.getDefaultTeamCap());
|
||||
|
||||
// defaultScoreCap
|
||||
warConfig.getInt("defaultScoreCap", war.getDefaultScoreCap());
|
||||
warConfig.setInt("defaultScoreCap", war.getDefaultScoreCap());
|
||||
|
||||
// defaultScoreCap
|
||||
// pvpInZonesOnly
|
||||
warConfig.setBoolean("pvpInZonesOnly", war.isPvpInZonesOnly());
|
||||
war.setPvpInZonesOnly(warConfig.getBoolean("pvpInZonesOnly"));
|
||||
|
||||
// defaultBlockHeads
|
||||
warConfig.setBoolean("defaultBlockHeads", war.isDefaultBlockHeads());
|
||||
|
||||
// defaultDropLootOnDeath
|
||||
//warConfig.setBoolean("defaultDropLootOnDeath", war.isDefaultDropLootOnDeath());
|
||||
|
||||
// warhub
|
||||
String hubStr = "";
|
||||
|
@ -168,7 +168,12 @@ public class WarzoneMapper {
|
||||
// score cap
|
||||
warzone.setScoreCap(warzoneConfig.getInt("scoreCap"));
|
||||
|
||||
|
||||
// blockHeads
|
||||
warzone.setBlockHeads(warzoneConfig.getBoolean("blockHeads"));
|
||||
|
||||
// dropLootOnDeath
|
||||
//warzone.setDropLootOnDeath(warzoneConfig.getBoolean("dropLootOnDeath"));
|
||||
|
||||
// monuments
|
||||
String monumentsStr = warzoneConfig.getString("monuments");
|
||||
if(monumentsStr != null && !monumentsStr.equals("")) {
|
||||
@ -326,6 +331,12 @@ public class WarzoneMapper {
|
||||
// score cap
|
||||
warzoneConfig.setInt("scoreCap", warzone.getScoreCap());
|
||||
|
||||
// blockHeads
|
||||
warzoneConfig.setBoolean("blockHeads", warzone.isBlockHeads());
|
||||
|
||||
// defaultDropLootOnDeath
|
||||
//warzoneConfig.setBoolean("dropLootOnDeath", warzone.isDropLootOnDeath());
|
||||
|
||||
// monuments
|
||||
String monumentsStr = "";
|
||||
List<Monument> monuments = warzone.getMonuments();
|
||||
|
Loading…
Reference in New Issue
Block a user