Added chargefreedestination option
Added freegatesgreen option Thanks @jtojnar
This commit is contained in:
parent
858a40e0cf
commit
d22a4b0871
6
README
6
README
@ -118,6 +118,8 @@ useiconomy - Whether or not to use iConomy
|
|||||||
createcost - The cost to create a stargate
|
createcost - The cost to create a stargate
|
||||||
destroycost - The cost to destroy a stargate (Can be negative for a "refund"
|
destroycost - The cost to destroy a stargate (Can be negative for a "refund"
|
||||||
usecost - The cost to use a stargate
|
usecost - The cost to use a stargate
|
||||||
|
chargefreedestination - Enable to allow free travel from any gate to a free gate
|
||||||
|
freegatesgreen - Enable to make gates that won't cost the player money show up as green
|
||||||
not-enough-money-message - The message displayed if a player lacks money to do something
|
not-enough-money-message - The message displayed if a player lacks money to do something
|
||||||
networkfilter - Whether or not to disallow users access to a network if they don't have the 'stargate.network.{networkname}' permission.
|
networkfilter - Whether or not to disallow users access to a network if they don't have the 'stargate.network.{networkname}' permission.
|
||||||
worldfilter - Whether or not to disallow users access to a network if they don't have the 'stargate.world.{worldname}' permission.
|
worldfilter - Whether or not to disallow users access to a network if they don't have the 'stargate.world.{worldname}' permission.
|
||||||
@ -127,9 +129,13 @@ debug - Whether to show massive debug output for gate creation
|
|||||||
=============
|
=============
|
||||||
Changes
|
Changes
|
||||||
=============
|
=============
|
||||||
|
[Version 0.4.8]
|
||||||
|
- Added chargefreedestination option
|
||||||
|
- Added freegatesgreen option
|
||||||
[Version 0.4.7]
|
[Version 0.4.7]
|
||||||
- Added debug option
|
- Added debug option
|
||||||
- Fixed gates will now show in the list of gates they link to.
|
- Fixed gates will now show in the list of gates they link to.
|
||||||
|
- iConomy no longer touched if not enabled in config
|
||||||
[Version 0.4.6]
|
[Version 0.4.6]
|
||||||
- Fixed a bug in iConomy handling.
|
- Fixed a bug in iConomy handling.
|
||||||
[Version 0.4.5]
|
[Version 0.4.5]
|
||||||
|
@ -123,6 +123,13 @@ public class Portal {
|
|||||||
return free;
|
return free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFree(Player player, Portal dest) {
|
||||||
|
// This gate is free, the player gets all gates free, or we don't charge for free dest and dest is free
|
||||||
|
boolean isFree = isFree() || Stargate.hasPerm(player, "stargate.free.use", player.isOp()) ||
|
||||||
|
(!iConomyHandler.chargeFreeDestination && dest.isFree());
|
||||||
|
return isFree;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean open(boolean force) {
|
public boolean open(boolean force) {
|
||||||
return open(null, force);
|
return open(null, force);
|
||||||
}
|
}
|
||||||
@ -424,19 +431,49 @@ public class Portal {
|
|||||||
int index = destinations.indexOf(destination);
|
int index = destinations.indexOf(destination);
|
||||||
|
|
||||||
if ((index == max) && (max > 1) && (++done <= 3)) {
|
if ((index == max) && (max > 1) && (++done <= 3)) {
|
||||||
id.setText(done, destinations.get(index - 2));
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
|
Portal dest = Portal.getByName(destinations.get(index - 2), network);
|
||||||
|
boolean green = isFree(activePlayer, dest);
|
||||||
|
id.setText(done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index - 2));
|
||||||
|
} else {
|
||||||
|
id.setText(done, destinations.get(index - 2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((index > 0) && (++done <= 3)) {
|
if ((index > 0) && (++done <= 3)) {
|
||||||
id.setText(done, destinations.get(index - 1));
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
|
Portal dest = Portal.getByName(destinations.get(index - 1), network);
|
||||||
|
boolean green = isFree(activePlayer, dest);
|
||||||
|
id.setText(done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index - 1));
|
||||||
|
} else {
|
||||||
|
id.setText(done, destinations.get(index - 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (++done <= 3) {
|
if (++done <= 3) {
|
||||||
id.setText(done, " >" + destination + "< ");
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
|
Portal dest = Portal.getByName(destination, network);
|
||||||
|
boolean green = isFree(activePlayer, dest);
|
||||||
|
id.setText(done, (green ? ChatColor.DARK_GREEN : "") + " >" + destination + "< ");
|
||||||
|
} else {
|
||||||
|
id.setText(done, " >" + destination + "< ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((max >= index + 1) && (++done <= 3)) {
|
if ((max >= index + 1) && (++done <= 3)) {
|
||||||
id.setText(done, destinations.get(index + 1));
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
|
Portal dest = Portal.getByName(destinations.get(index + 1), network);
|
||||||
|
boolean green = isFree(activePlayer, dest);
|
||||||
|
id.setText(done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index + 1));
|
||||||
|
} else {
|
||||||
|
id.setText(done, destinations.get(index + 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((max >= index + 2) && (++done <= 3)) {
|
if ((max >= index + 2) && (++done <= 3)) {
|
||||||
id.setText(done, destinations.get(index + 2));
|
if (iConomyHandler.useiConomy() && iConomyHandler.freeGatesGreen) {
|
||||||
|
Portal dest = Portal.getByName(destinations.get(index + 2), network);
|
||||||
|
boolean green = isFree(activePlayer, dest);
|
||||||
|
id.setText(done, (green ? ChatColor.DARK_GREEN : "") + destinations.get(index + 2));
|
||||||
|
} else {
|
||||||
|
id.setText(done, destinations.get(index + 2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,8 @@ public class Stargate extends JavaPlugin {
|
|||||||
iConomyHandler.useCost = config.getInt("usecost", iConomyHandler.useCost);
|
iConomyHandler.useCost = config.getInt("usecost", iConomyHandler.useCost);
|
||||||
iConomyHandler.inFundMsg = config.getString("not-enough-money-message", iConomyHandler.inFundMsg);
|
iConomyHandler.inFundMsg = config.getString("not-enough-money-message", iConomyHandler.inFundMsg);
|
||||||
iConomyHandler.toOwner = config.getBoolean("toowner", iConomyHandler.toOwner);
|
iConomyHandler.toOwner = config.getBoolean("toowner", iConomyHandler.toOwner);
|
||||||
|
iConomyHandler.chargeFreeDestination = config.getBoolean("chargefreedestination", iConomyHandler.chargeFreeDestination);
|
||||||
|
iConomyHandler.freeGatesGreen = config.getBoolean("freegatesgreen", iConomyHandler.freeGatesGreen);
|
||||||
|
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
@ -188,6 +190,8 @@ public class Stargate extends JavaPlugin {
|
|||||||
config.setProperty("usecost", iConomyHandler.useCost);
|
config.setProperty("usecost", iConomyHandler.useCost);
|
||||||
config.setProperty("not-enough-money-message", iConomyHandler.inFundMsg);
|
config.setProperty("not-enough-money-message", iConomyHandler.inFundMsg);
|
||||||
config.setProperty("toowner", iConomyHandler.toOwner);
|
config.setProperty("toowner", iConomyHandler.toOwner);
|
||||||
|
config.setProperty("chargefreedestination", iConomyHandler.chargeFreeDestination);
|
||||||
|
config.setProperty("freegatesgreen", iConomyHandler.freeGatesGreen);
|
||||||
|
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
@ -253,10 +257,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
Portal destination = gate.getDestination();
|
Portal destination = gate.getDestination();
|
||||||
|
|
||||||
if (!gate.isOpen()) {
|
if (!gate.isOpen()) {
|
||||||
if (!gate.isFree() && !hasPerm(player, "stargate.free.use", player.isOp()) &&
|
if ((!gate.isFixed()) && gate.isActive() && (gate.getActivePlayer() != player)) {
|
||||||
iConomyHandler.useiConomy() && iConomyHandler.getBalance(player.getName()) < gate.getGate().getUseCost()) {
|
|
||||||
player.sendMessage(ChatColor.RED + iConomyHandler.inFundMsg);
|
|
||||||
} else if ((!gate.isFixed()) && gate.isActive() && (gate.getActivePlayer() != player)) {
|
|
||||||
gate.deactivate();
|
gate.deactivate();
|
||||||
if (!denyMsg.isEmpty()) {
|
if (!denyMsg.isEmpty()) {
|
||||||
player.sendMessage(ChatColor.RED + denyMsg);
|
player.sendMessage(ChatColor.RED + denyMsg);
|
||||||
@ -327,6 +328,9 @@ public class Stargate extends JavaPlugin {
|
|||||||
if (dest == null) return;
|
if (dest == null) return;
|
||||||
|
|
||||||
boolean iConCharge = (iConomyHandler.useiConomy() && !portal.isFree() && !hasPerm(player, "stargate.free.use", player.isOp()));
|
boolean iConCharge = (iConomyHandler.useiConomy() && !portal.isFree() && !hasPerm(player, "stargate.free.use", player.isOp()));
|
||||||
|
if (!iConomyHandler.chargeFreeDestination)
|
||||||
|
iConCharge = iConCharge && !dest.isFree();
|
||||||
|
|
||||||
String target = (portal.getGate().getToOwner() ? portal.getOwner() : null);
|
String target = (portal.getGate().getToOwner() ? portal.getOwner() : null);
|
||||||
if (target != null)
|
if (target != null)
|
||||||
iConCharge = iConCharge && !target.equals(player.getName());
|
iConCharge = iConCharge && !target.equals(player.getName());
|
||||||
@ -388,6 +392,9 @@ public class Stargate extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean iConCharge = (iConomyHandler.useiConomy() && !portal.isFree() && !hasPerm(player, "stargate.free.use", player.isOp()));
|
boolean iConCharge = (iConomyHandler.useiConomy() && !portal.isFree() && !hasPerm(player, "stargate.free.use", player.isOp()));
|
||||||
|
if (!iConomyHandler.chargeFreeDestination)
|
||||||
|
iConCharge = iConCharge && !destination.isFree();
|
||||||
|
|
||||||
String target = (portal.getGate().getToOwner() ? portal.getOwner() : null);
|
String target = (portal.getGate().getToOwner() ? portal.getOwner() : null);
|
||||||
if (target != null)
|
if (target != null)
|
||||||
iConCharge = iConCharge && !target.equals(player.getName());
|
iConCharge = iConCharge && !target.equals(player.getName());
|
||||||
|
@ -14,6 +14,8 @@ public class iConomyHandler {
|
|||||||
public static int destroyCost = 0;
|
public static int destroyCost = 0;
|
||||||
public static String inFundMsg = "Insufficient Funds.";
|
public static String inFundMsg = "Insufficient Funds.";
|
||||||
public static boolean toOwner = false;
|
public static boolean toOwner = false;
|
||||||
|
public static boolean chargeFreeDestination = true;
|
||||||
|
public static boolean freeGatesGreen = false;
|
||||||
|
|
||||||
public static double getBalance(String player) {
|
public static double getBalance(String player) {
|
||||||
if (useiConomy && iconomy != null) {
|
if (useiConomy && iconomy != null) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: Stargate
|
name: Stargate
|
||||||
main: net.TheDgtl.Stargate.Stargate
|
main: net.TheDgtl.Stargate.Stargate
|
||||||
version: 0.4.7
|
version: 0.4.8
|
||||||
description: Stargate mod for Bukkit
|
description: Stargate mod for Bukkit
|
||||||
author: Drakia
|
author: Drakia
|
||||||
website: http://www.thedgtl.net
|
website: http://www.thedgtl.net
|
||||||
|
Loading…
Reference in New Issue
Block a user