[Version 0.6.6]

- Added %cost% and %portal% to all eco* messages
 - Fixed an issue when creating a gate on a network you don't have
access to
 - I can't spell
This commit is contained in:
Steven Scott 2011-08-28 21:35:33 -07:00
parent 394421dff8
commit ab21354c7a
6 changed files with 37 additions and 31 deletions

13
README
View File

@ -159,10 +159,11 @@ As of 0.6.5 it is possible to customize all of the messages Stargate displays, i
If a string is removed, or left blank, it will not be shown when the user does the action associated with it. If a string is removed, or left blank, it will not be shown when the user does the action associated with it.
There are three special cases when it comes to messages, these are: There are three special cases when it comes to messages, these are:
ecoDeduct=Spent %cost% ecoDeduct=Spent %cost%
ecoRefund=Redunded %cost% ecoRefund=Refunded %cost%
ecoObtain=Obtained %cost$ from Stargate %portal% ecoObtain=Obtained %cost% from Stargate %portal%
As you can see, these three strings have %cost% and %portal% variables in them. These variables are fairly self-explanatory.
As you can see, these three strings have variables in them. These variables are fairly self-explanatory.
The full list of strings is as follows: The full list of strings is as follows:
prefix=[Stargate] prefix=[Stargate]
teleportMsg=Teleported teleportMsg=Teleported
@ -174,7 +175,7 @@ destEmpty=Destination List Empty
ecoDeduct=Deducted %cost% ecoDeduct=Deducted %cost%
ecoRefund=Redunded %cost% ecoRefund=Redunded %cost%
ecoObtain=Obtained %cost$ from Stargate %portal% ecoObtain=Obtained %cost% from Stargate %portal%
ecoInFunds=Insufficient Funds ecoInFunds=Insufficient Funds
createMsg=Gate Created createMsg=Gate Created
@ -186,10 +187,12 @@ createFull=This network is full
createWorldDeny=You do not have access to that world createWorldDeny=You do not have access to that world
createConflict=Gate conflicts with existing gate createConflict=Gate conflicts with existing gate
============= =============
Changes Changes
============= =============
[Version 0.6.6]
- Added %cost% and %portal% to all eco* messages
- Fixed an issue when creating a gate on a network you don't have access to
[Version 0.6.5] [Version 0.6.5]
- Moved printed message config to a seperate file - Moved printed message config to a seperate file
- Added permdebug option - Added permdebug option

View File

@ -779,19 +779,15 @@ public class Portal {
// Check if the player can create gates on this network // Check if the player can create gates on this network
if (!Stargate.canCreate(player, network)) { if (!Stargate.canCreate(player, network)) {
Stargate.debug("createPortal", "Player doesn't have create permissions on network. Trying personal"); Stargate.debug("createPortal", "Player doesn't have create permissions on network. Trying personal");
network = player.getName(); if (Stargate.canCreatePersonal(player)) {
if (network.length() > 11) { network = player.getName();
network = network.substring(0, 11); if (network.length() > 11) network = network.substring(0, 11);
} Stargate.debug("createPortal", "Creating personal portal");
Stargate.sendMessage(player, Stargate.getString("createPersonal"));
// Check if we can create a gate on our own network } else {
if (!Stargate.canCreate(player, network)) {
Stargate.debug("createPortal", "Player does not have access to network"); Stargate.debug("createPortal", "Player does not have access to network");
Stargate.sendMessage(player, Stargate.getString("createNetDeny")); Stargate.sendMessage(player, Stargate.getString("createNetDeny"));
return null; return null;
} else {
Stargate.debug("createPortal", "Creating personal portal");
Stargate.sendMessage(player, Stargate.getString("createPersonal"));
} }
} }
@ -849,12 +845,14 @@ public class Portal {
int cost = Stargate.getCreateCost(player, gate); int cost = Stargate.getCreateCost(player, gate);
if (cost > 0) { if (cost > 0) {
if (!Stargate.chargePlayer(player, null, gate.getCreateCost())) { if (!Stargate.chargePlayer(player, null, gate.getCreateCost())) {
Stargate.sendMessage(player, Stargate.getString("ecoInFunds")); String inFundMsg = Stargate.getString("ecoInFunds");
inFundMsg = Stargate.replaceVars(inFundMsg, new String[] {"%cost%", "%portal%"}, new String[] {iConomyHandler.format(cost), name});
Stargate.sendMessage(player, inFundMsg);
Stargate.debug("createPortal", "Insufficient Funds"); Stargate.debug("createPortal", "Insufficient Funds");
return null; return null;
} }
String deductMsg = Stargate.getString("ecoDeduct"); String deductMsg = Stargate.getString("ecoDeduct");
deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%"}, new String[] {iConomyHandler.format(cost)}); deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%", "%portal%"}, new String[] {iConomyHandler.format(cost), name});
Stargate.sendMessage(player, deductMsg, false); Stargate.sendMessage(player, deductMsg, false);
} }

View File

@ -185,7 +185,6 @@ public class Stargate extends JavaPlugin {
config.setProperty("createcost", iConomyHandler.createCost); config.setProperty("createcost", iConomyHandler.createCost);
config.setProperty("destroycost", iConomyHandler.destroyCost); config.setProperty("destroycost", iConomyHandler.destroyCost);
config.setProperty("usecost", iConomyHandler.useCost); config.setProperty("usecost", iConomyHandler.useCost);
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("chargefreedestination", iConomyHandler.chargeFreeDestination);
config.setProperty("freegatesgreen", iConomyHandler.freeGatesGreen); config.setProperty("freegatesgreen", iConomyHandler.freeGatesGreen);
@ -447,10 +446,17 @@ public class Stargate extends JavaPlugin {
// Check for this specific network // Check for this specific network
if (hasPerm(player, "stargate.create.network." + network)) return true; if (hasPerm(player, "stargate.create.network." + network)) return true;
// Check if this is a personal gate, and if the player has create.personal return false;
String pNet = player.getName(); }
if (pNet.length() > 11) pNet = pNet.substring(0, 11);
if (pNet.equalsIgnoreCase(network) && hasPerm(player, "stargate.create.personal")) return true; /*
* Check if the player can create a personal gate
*/
public static boolean canCreatePersonal(Player player) {
// Check for general create
if (hasPerm(player, "stargate.create")) return true;
// Check for personal
if (hasPerm(player, "stargate.create.personal")) return true;
return false; return false;
} }
@ -615,7 +621,7 @@ public class Stargate extends JavaPlugin {
return; return;
} }
String deductMsg = Stargate.getString("ecoDeduct"); String deductMsg = Stargate.getString("ecoDeduct");
deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%"}, new String[] {iConomyHandler.format(cost)}); deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%", "%portal%"}, new String[] {iConomyHandler.format(cost), portal.getName()});
sendMessage(player, deductMsg, false); sendMessage(player, deductMsg, false);
if (target != null) { if (target != null) {
Player p = server.getPlayer(target); Player p = server.getPlayer(target);
@ -707,7 +713,7 @@ public class Stargate extends JavaPlugin {
return; return;
} }
String deductMsg = Stargate.getString("ecoDeduct"); String deductMsg = Stargate.getString("ecoDeduct");
deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%"}, new String[] {iConomyHandler.format(cost)}); deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%", "%portal%"}, new String[] {iConomyHandler.format(cost), portal.getName()});
sendMessage(player, deductMsg, false); sendMessage(player, deductMsg, false);
if (target != null) { if (target != null) {
Player p = server.getPlayer(target); Player p = server.getPlayer(target);
@ -838,18 +844,18 @@ public class Stargate extends JavaPlugin {
if (cost != 0) { if (cost != 0) {
if (!Stargate.chargePlayer(player, null, cost)) { if (!Stargate.chargePlayer(player, null, cost)) {
Stargate.debug("onBlockBreak", "Insufficient Funds"); Stargate.debug("onBlockBreak", "Insufficient Funds");
Stargate.sendMessage(player, iConomyHandler.inFundMsg); Stargate.sendMessage(player, Stargate.getString("inFunds"));
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (cost > 0) { if (cost > 0) {
String deductMsg = Stargate.getString("ecoDeduct"); String deductMsg = Stargate.getString("ecoDeduct");
deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%"}, new String[] {iConomyHandler.format(cost)}); deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%", "%portal%"}, new String[] {iConomyHandler.format(cost), portal.getName()});
sendMessage(player, deductMsg, false); sendMessage(player, deductMsg, false);
} else if (cost < 0) { } else if (cost < 0) {
String refundMsg = Stargate.getString("ecoRefund"); String refundMsg = Stargate.getString("ecoRefund");
refundMsg = Stargate.replaceVars(refundMsg, new String[] {"%cost%"}, new String[] {iConomyHandler.format(-cost)}); refundMsg = Stargate.replaceVars(refundMsg, new String[] {"%cost%", "%portal%"}, new String[] {iConomyHandler.format(-cost), portal.getName()});
sendMessage(player, refundMsg, false); sendMessage(player, refundMsg, false);
} }
} }

View File

@ -17,7 +17,6 @@ public class iConomyHandler {
public static int useCost = 0; public static int useCost = 0;
public static int createCost = 0; public static int createCost = 0;
public static int destroyCost = 0; public static int destroyCost = 0;
public static String inFundMsg = "Insufficient Funds.";
public static boolean toOwner = false; public static boolean toOwner = false;
public static boolean chargeFreeDestination = true; public static boolean chargeFreeDestination = true;
public static boolean freeGatesGreen = false; public static boolean freeGatesGreen = false;

View File

@ -7,8 +7,8 @@ destEmpty=Destination List Empty
denyMsg=Access Denied denyMsg=Access Denied
ecoDeduct=Deducted %cost% ecoDeduct=Deducted %cost%
ecoRefund=Redunded %cost% ecoRefund=Refunded %cost%
ecoObtain=Obtained %cost$ from Stargate %portal% ecoObtain=Obtained %cost% from Stargate %portal%
ecoInFunds=Insufficient Funds ecoInFunds=Insufficient Funds
createMsg=Gate Created createMsg=Gate Created

View File

@ -1,6 +1,6 @@
name: Stargate name: Stargate
main: net.TheDgtl.Stargate.Stargate main: net.TheDgtl.Stargate.Stargate
version: 0.6.5 version: 0.6.6
description: Stargate mod for Bukkit description: Stargate mod for Bukkit
author: Drakia author: Drakia
website: http://www.thedgtl.net website: http://www.thedgtl.net