Laundry list of changes for 1.2.0 release:

/f map now has a nifty faction name key  (LexManos)
There are now War Zones; these work similar to Safe Zones, except PvP is enabled and monsters are not blocked  (Brettflan)
Players now only regenerate power while actually online  (Brettflan)
New command available to prevent power loss in specific worlds  (Brettflan)
New command available to prevent faction land claims in specific worlds (doesn't affect safezone and warzone claims)  (Brettflan)
New command to unclaim all safezone areas  (Brettflan)
Players are now prevented from using /f home if an enemy is nearby, and the players isn't in a safezone or their own faction territory  (Brettflan)
New option to make membership default to closed for newly created factions  (Brettflan)
When an admin has bypass mode enabled (/f bypass), they can now unclaim any faction land they're standing on  (Brettflan)
This commit is contained in:
Brettflan
2011-05-29 16:28:29 -05:00
parent 72c3220d4a
commit b490c5f196
19 changed files with 423 additions and 51 deletions

View File

@ -39,6 +39,20 @@ public class FCommandClaim extends FBaseCommand {
}
if (Conf.worldsNoClaiming.contains(flocation.getWorldName())) {
sendMessage("Sorry, this world has land claiming disabled.");
return;
}
if (otherFaction.isSafeZone()) {
sendMessage("You can not claim a Safe Zone.");
return;
}
else if (otherFaction.isWarZone()) {
sendMessage("You can not claim a War Zone.");
return;
}
if (myFaction.getLandRounded() >= myFaction.getPowerRounded()) {
sendMessage("You can't claim more land! You need more power!");
return;
@ -49,11 +63,6 @@ public class FCommandClaim extends FBaseCommand {
return;
}
if (otherFaction.isSafeZone()) {
sendMessage("You can not claim a SafeZone.");
return;
}
if (otherFaction.isNone()) {
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" claimed some new land :D");
} else { //if (otherFaction.isNormal()) {

View File

@ -127,8 +127,20 @@ public class FCommandHelp extends FBaseCommand {
pageLines.add("Finally some commands for the server admins:");
pageLines.add( new FCommandVersion().getUseageTemplate() );
pageLines.add( new FCommandSafeclaim().getUseageTemplate() );
pageLines.add( new FCommandSafeunclaimall().getUseageTemplate() );
pageLines.add( new FCommandWarclaim().getUseageTemplate() );
pageLines.add( new FCommandWarunclaimall().getUseageTemplate() );
pageLines.add( new FCommandWorldNoClaim().getUseageTemplate() );
pageLines.add( new FCommandWorldNoPowerLoss().getUseageTemplate() );
pageLines.add( new FCommandBypass().getUseageTemplate() );
helpPages.add(pageLines);
pageLines = new ArrayList<String>();
pageLines.add("More commands for server admins:");
pageLines.add( new FCommandLock().getUseageTemplate() );
pageLines.add( new FCommandReload().getUseageTemplate() );
pageLines.add( new FCommandSaveAll().getUseageTemplate() );
helpPages.add(pageLines);
}
}

View File

@ -1,7 +1,14 @@
package org.mcteam.factions.commands;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.mcteam.factions.Board;
import org.mcteam.factions.Conf;
import org.mcteam.factions.Faction;
import org.mcteam.factions.FLocation;
import org.mcteam.factions.FPlayer;
import org.mcteam.factions.struct.Relation;
import org.mcteam.factions.struct.Role;
public class FCommandHome extends FBaseCommand {
@ -30,6 +37,38 @@ public class FCommandHome extends FBaseCommand {
return;
}
Faction faction = Board.getFactionAt(new FLocation(player.getLocation()));
// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby
if (Conf.homesTeleportAllowedEnemyDistance > 0 && ! faction.isSafeZone() && ! me.isInOwnTerritory()) {
Location loc = player.getLocation();
World w = loc.getWorld();
int x = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
for (Player p : player.getServer().getOnlinePlayers())
{
if (p == null || !p.isOnline() || p.isDead() || p == player || p.getWorld() != w)
continue;
FPlayer fp = FPlayer.get(p);
if (me.getRelation(fp) != Relation.ENEMY)
continue;
Location l = p.getLocation();
int dx = Math.abs(x - l.getBlockX());
int dy = Math.abs(y - l.getBlockY());
int dz = Math.abs(z - l.getBlockZ());
int delta = dx + dy + dz;
if (delta > Conf.homesTeleportAllowedEnemyDistance)
continue;
me.sendMessage("You cannot teleport to your faction home while an enemy is within " + Conf.homesTeleportAllowedEnemyDistance + " blocks of you.");
return;
}
}
player.teleport(myFaction.getHome());
}

View File

@ -30,6 +30,7 @@ public class FCommandList extends FBaseCommand {
ArrayList<Faction> FactionList = new ArrayList<Faction>(Faction.getAll());
FactionList.remove(Faction.getNone());
FactionList.remove(Faction.getSafeZone());
FactionList.remove(Faction.getWarZone());
int page = 1;
if (parameters.size() > 0) {

View File

@ -0,0 +1,34 @@
package org.mcteam.factions.commands;
import org.bukkit.command.CommandSender;
import org.mcteam.factions.Board;
import org.mcteam.factions.Faction;
import org.mcteam.factions.Factions;
public class FCommandSafeunclaimall extends FBaseCommand {
public FCommandSafeunclaimall() {
aliases.add("safeunclaimall");
aliases.add("safedeclaimall");
helpDescription = "Unclaim all safezone land";
}
@Override
public boolean hasPermission(CommandSender sender) {
return Factions.hasPermManageSafeZone(sender);
}
@Override
public void perform() {
if( isLocked() ) {
sendLockMessage();
return;
}
Board.unclaimAll(Faction.getSafeZone().getId());
sendMessage("You unclaimed ALL safe zone land.");
}
}

View File

@ -35,6 +35,23 @@ public class FCommandUnclaim extends FBaseCommand {
}
return;
}
else if (otherFaction.isWarZone()) {
if (Factions.hasPermManageWarZone(sender)) {
Board.removeAt(flocation);
sendMessage("War zone was unclaimed.");
} else {
sendMessage("This is a war zone. You lack permissions to unclaim.");
}
return;
}
if (Conf.adminBypassPlayers.contains(player.getName())) {
Board.removeAt(flocation);
otherFaction.sendMessage(me.getNameAndRelevant(otherFaction)+Conf.colorSystem+" unclaimed some of your land.");
sendMessage("You unclaimed this land.");
return;
}
if ( ! assertHasFaction()) {
return;

View File

@ -0,0 +1,54 @@
package org.mcteam.factions.commands;
import org.bukkit.command.CommandSender;
import org.mcteam.factions.Board;
import org.mcteam.factions.FLocation;
import org.mcteam.factions.Faction;
import org.mcteam.factions.Factions;
public class FCommandWarclaim extends FBaseCommand {
public FCommandWarclaim() {
aliases.add("warclaim");
aliases.add("war");
optionalParameters.add("radius");
helpDescription = "Claim land for the warzone";
}
@Override
public boolean hasPermission(CommandSender sender) {
return Factions.hasPermManageWarZone(sender);
}
public void perform() {
if( isLocked() ) {
sendLockMessage();
return;
}
// The current location of the player
FLocation playerFlocation = new FLocation(me);
// Was a radius set?
if (parameters.size() > 0) {
int radius = Integer.parseInt(parameters.get(0));
FLocation from = playerFlocation.getRelative(radius, radius);
FLocation to = playerFlocation.getRelative(-radius, -radius);
for (FLocation locToClaim : FLocation.getArea(from, to)) {
Board.setFactionAt(Faction.getWarZone(), locToClaim);
}
sendMessage("You claimed "+(1+radius*2)*(1+radius*2)+" chunks for the war zone.");
} else {
Board.setFactionAt(Faction.getWarZone(), playerFlocation);
sendMessage("This land is now a war zone");
}
}
}

View File

@ -0,0 +1,34 @@
package org.mcteam.factions.commands;
import org.bukkit.command.CommandSender;
import org.mcteam.factions.Board;
import org.mcteam.factions.Faction;
import org.mcteam.factions.Factions;
public class FCommandWarunclaimall extends FBaseCommand {
public FCommandWarunclaimall() {
aliases.add("warunclaimall");
aliases.add("wardeclaimall");
helpDescription = "Unclaim all warzone land";
}
@Override
public boolean hasPermission(CommandSender sender) {
return Factions.hasPermManageWarZone(sender);
}
@Override
public void perform() {
if( isLocked() ) {
sendLockMessage();
return;
}
Board.unclaimAll(Faction.getWarZone().getId());
sendMessage("You unclaimed ALL war zone land.");
}
}

View File

@ -0,0 +1,39 @@
package org.mcteam.factions.commands;
import org.bukkit.command.CommandSender;
import org.mcteam.factions.Conf;
import org.mcteam.factions.Factions;
public class FCommandWorldNoClaim extends FBaseCommand {
public FCommandWorldNoClaim() {
aliases.add("worldnoclaim");
helpDescription = "Disable claims in this world";
}
@Override
public boolean hasPermission(CommandSender sender) {
return Factions.hasPermWorlds(sender);
}
@Override
public void perform() {
if( isLocked() ) {
sendLockMessage();
return;
}
String worldName = me.getPlayer().getWorld().getName();
if ( ! Conf.worldsNoClaiming.contains(worldName)) {
Conf.worldsNoClaiming.add(worldName);
me.sendMessage("Faction land claiming is now DISALLOWED in this world (\"" + worldName + "\").");
} else {
Conf.worldsNoClaiming.remove(worldName);
me.sendMessage("Faction land claiming is now ALLOWED in this world (\"" + worldName + "\").");
}
}
}

View File

@ -0,0 +1,39 @@
package org.mcteam.factions.commands;
import org.bukkit.command.CommandSender;
import org.mcteam.factions.Conf;
import org.mcteam.factions.Factions;
public class FCommandWorldNoPowerLoss extends FBaseCommand {
public FCommandWorldNoPowerLoss() {
aliases.add("worldnopowerloss");
helpDescription = "Disable power loss in this world";
}
@Override
public boolean hasPermission(CommandSender sender) {
return Factions.hasPermWorlds(sender);
}
@Override
public void perform() {
if( isLocked() ) {
sendLockMessage();
return;
}
String worldName = me.getPlayer().getWorld().getName();
if ( ! Conf.worldsNoPowerLoss.contains(worldName)) {
Conf.worldsNoPowerLoss.add(worldName);
me.sendMessage("Power loss from death is now DISABLED in this world (\"" + worldName + "\").");
} else {
Conf.worldsNoPowerLoss.remove(worldName);
me.sendMessage("Power loss from death is now ENABLED in this world (\"" + worldName + "\").");
}
}
}