Support UUIDs for owners, with a fallback to player names
This commit is contained in:
parent
4c7c284411
commit
a594b6daeb
@ -2,10 +2,14 @@ package net.TheDgtl.Stargate;
|
|||||||
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stargate - A portal plugin for Bukkit
|
* Stargate - A portal plugin for Bukkit
|
||||||
* Copyright (C) 2011, 2012 Steven "Drakia" Scott <Contact@TheDgtl.net>
|
* Copyright (C) 2011, 2012 Steven "Drakia" Scott <Contact@TheDgtl.net>
|
||||||
@ -36,18 +40,38 @@ public class EconomyHandler {
|
|||||||
public static boolean chargeFreeDestination = true;
|
public static boolean chargeFreeDestination = true;
|
||||||
public static boolean freeGatesGreen = false;
|
public static boolean freeGatesGreen = false;
|
||||||
|
|
||||||
public static double getBalance(String player) {
|
public static double getBalance(Player player) {
|
||||||
if (!economyEnabled) return 0;
|
if (!economyEnabled) return 0;
|
||||||
return economy.getBalance(player);
|
return economy.getBalance(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean chargePlayer(String player, String target, double amount) {
|
public static boolean chargePlayer(Player player, String target, double amount) {
|
||||||
|
if (!economyEnabled) return true;
|
||||||
|
if(player.getName().equals(target)) return true;
|
||||||
|
if(economy != null) {
|
||||||
|
if(!economy.has(player, amount)) return false;
|
||||||
|
economy.withdrawPlayer(player, amount);
|
||||||
|
economy.depositPlayer(target, amount);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean chargePlayer(Player player, UUID target, double amount) {
|
||||||
|
if (!economyEnabled) return true;
|
||||||
|
if(player.getUniqueId().compareTo(target) == 0) return true;
|
||||||
|
if(economy != null) {
|
||||||
|
if(!economy.has(player, amount)) return false;
|
||||||
|
economy.withdrawPlayer(player, amount);
|
||||||
|
economy.depositPlayer(Bukkit.getOfflinePlayer(target), amount);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean chargePlayer(Player player, double amount) {
|
||||||
if (!economyEnabled) return true;
|
if (!economyEnabled) return true;
|
||||||
if(player.equals(target)) return true;
|
|
||||||
if(economy != null) {
|
if(economy != null) {
|
||||||
if(!economy.has(player, amount)) return false;
|
if(!economy.has(player, amount)) return false;
|
||||||
economy.withdrawPlayer(player, amount);
|
economy.withdrawPlayer(player, amount);
|
||||||
if(target != null) economy.depositPlayer(target, amount);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,11 @@ import net.TheDgtl.Stargate.event.StargateOpenEvent;
|
|||||||
import net.TheDgtl.Stargate.event.StargatePortalEvent;
|
import net.TheDgtl.Stargate.event.StargatePortalEvent;
|
||||||
|
|
||||||
import org.bukkit.Axis;
|
import org.bukkit.Axis;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -86,7 +88,8 @@ public class Portal {
|
|||||||
private String lastDest = "";
|
private String lastDest = "";
|
||||||
private String network;
|
private String network;
|
||||||
private Gate gate;
|
private Gate gate;
|
||||||
private String owner = "";
|
private String ownerName = "";
|
||||||
|
private UUID ownerUUID = null;
|
||||||
private World world;
|
private World world;
|
||||||
private boolean verified;
|
private boolean verified;
|
||||||
private boolean fixed;
|
private boolean fixed;
|
||||||
@ -112,7 +115,7 @@ public class Portal {
|
|||||||
private Portal(Blox topLeft, int modX, int modZ,
|
private Portal(Blox topLeft, int modX, int modZ,
|
||||||
float rotX, Blox id, Blox button,
|
float rotX, Blox id, Blox button,
|
||||||
String dest, String name,
|
String dest, String name,
|
||||||
boolean verified, String network, Gate gate, String owner,
|
boolean verified, String network, Gate gate, UUID ownerUUID, String ownerName,
|
||||||
boolean hidden, boolean alwaysOn, boolean priv, boolean free, boolean backwards, boolean show, boolean noNetwork, boolean random, boolean bungee) {
|
boolean hidden, boolean alwaysOn, boolean priv, boolean free, boolean backwards, boolean show, boolean noNetwork, boolean random, boolean bungee) {
|
||||||
this.topLeft = topLeft;
|
this.topLeft = topLeft;
|
||||||
this.modX = modX;
|
this.modX = modX;
|
||||||
@ -126,7 +129,8 @@ public class Portal {
|
|||||||
this.network = network;
|
this.network = network;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.gate = gate;
|
this.gate = gate;
|
||||||
this.owner = owner;
|
this.ownerUUID = ownerUUID;
|
||||||
|
this.ownerName = ownerName;
|
||||||
this.hidden = hidden;
|
this.hidden = hidden;
|
||||||
this.alwaysOn = alwaysOn;
|
this.alwaysOn = alwaysOn;
|
||||||
this.priv = priv;
|
this.priv = priv;
|
||||||
@ -300,12 +304,24 @@ public class Portal {
|
|||||||
return gate;
|
return gate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOwner() {
|
public String getOwnerName() {
|
||||||
return owner;
|
return ownerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOwner(String owner) {
|
public UUID getOwnerUUID() {
|
||||||
this.owner = owner;
|
return ownerUUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwner(UUID owner) {
|
||||||
|
this.ownerUUID = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOwner(Player player) {
|
||||||
|
if(this.ownerUUID != null) {
|
||||||
|
return player.getUniqueId().compareTo(this.ownerUUID) == 0;
|
||||||
|
} else {
|
||||||
|
return player.getName().equalsIgnoreCase(this.ownerName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Blox[] getEntrances() {
|
public Blox[] getEntrances() {
|
||||||
@ -1078,7 +1094,7 @@ public class Portal {
|
|||||||
|
|
||||||
Blox button = null;
|
Blox button = null;
|
||||||
Portal portal = null;
|
Portal portal = null;
|
||||||
portal = new Portal(topleft, modX, modZ, rotX, id, button, destName, name, false, network, gate, player.getName(), hidden, alwaysOn, priv, free, backwards, show, noNetwork, random, bungee);
|
portal = new Portal(topleft, modX, modZ, rotX, id, button, destName, name, false, network, gate, player.getUniqueId(), player.getName(), hidden, alwaysOn, priv, free, backwards, show, noNetwork, random, bungee);
|
||||||
|
|
||||||
int cost = Stargate.getCreateCost(player, gate);
|
int cost = Stargate.getCreateCost(player, gate);
|
||||||
|
|
||||||
@ -1125,7 +1141,7 @@ public class Portal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cost > 0) {
|
if (cost > 0) {
|
||||||
if (!Stargate.chargePlayer(player, null, cost)) {
|
if (!Stargate.chargePlayer(player, cost)) {
|
||||||
String inFundMsg = Stargate.getString("ecoInFunds");
|
String inFundMsg = Stargate.getString("ecoInFunds");
|
||||||
inFundMsg = Stargate.replaceVars(inFundMsg, new String[] {"%cost%", "%portal%"}, new String[] {EconomyHandler.format(cost), name});
|
inFundMsg = Stargate.replaceVars(inFundMsg, new String[] {"%cost%", "%portal%"}, new String[] {EconomyHandler.format(cost), name});
|
||||||
Stargate.sendMessage(player, inFundMsg);
|
Stargate.sendMessage(player, inFundMsg);
|
||||||
@ -1271,7 +1287,12 @@ public class Portal {
|
|||||||
builder.append(':');
|
builder.append(':');
|
||||||
builder.append(portal.getNetwork());
|
builder.append(portal.getNetwork());
|
||||||
builder.append(':');
|
builder.append(':');
|
||||||
builder.append(portal.getOwner());
|
UUID owner = portal.getOwnerUUID();
|
||||||
|
if(owner != null) {
|
||||||
|
builder.append(portal.getOwnerUUID().toString());
|
||||||
|
} else {
|
||||||
|
builder.append(portal.getOwnerName());
|
||||||
|
}
|
||||||
builder.append(':');
|
builder.append(':');
|
||||||
builder.append(portal.isHidden());
|
builder.append(portal.isHidden());
|
||||||
builder.append(':');
|
builder.append(':');
|
||||||
@ -1349,7 +1370,7 @@ public class Portal {
|
|||||||
String dest = (split.length > 8) ? split[8] : "";
|
String dest = (split.length > 8) ? split[8] : "";
|
||||||
String network = (split.length > 9) ? split[9] : Stargate.getDefaultNetwork();
|
String network = (split.length > 9) ? split[9] : Stargate.getDefaultNetwork();
|
||||||
if (network.isEmpty()) network = Stargate.getDefaultNetwork();
|
if (network.isEmpty()) network = Stargate.getDefaultNetwork();
|
||||||
String owner = (split.length > 10) ? split[10] : "";
|
String ownerString = (split.length > 10) ? split[10] : "";
|
||||||
boolean hidden = (split.length > 11) && split[11].equalsIgnoreCase("true");
|
boolean hidden = (split.length > 11) && split[11].equalsIgnoreCase("true");
|
||||||
boolean alwaysOn = (split.length > 12) && split[12].equalsIgnoreCase("true");
|
boolean alwaysOn = (split.length > 12) && split[12].equalsIgnoreCase("true");
|
||||||
boolean priv = (split.length > 13) && split[13].equalsIgnoreCase("true");
|
boolean priv = (split.length > 13) && split[13].equalsIgnoreCase("true");
|
||||||
@ -1360,7 +1381,24 @@ public class Portal {
|
|||||||
boolean random = (split.length > 19) && split[19].equalsIgnoreCase("true");
|
boolean random = (split.length > 19) && split[19].equalsIgnoreCase("true");
|
||||||
boolean bungee = (split.length > 20) && split[20].equalsIgnoreCase("true");
|
boolean bungee = (split.length > 20) && split[20].equalsIgnoreCase("true");
|
||||||
|
|
||||||
Portal portal = new Portal(topLeft, modX, modZ, rotX, sign, button, dest, name, false, network, gate, owner, hidden, alwaysOn, priv, free, backwards, show, noNetwork, random, bungee);
|
// Attempt to get owner as UUID
|
||||||
|
UUID ownerUUID = null;
|
||||||
|
String ownerName;
|
||||||
|
if(ownerString.length() > 16) {
|
||||||
|
try {
|
||||||
|
ownerUUID = UUID.fromString(ownerString);
|
||||||
|
OfflinePlayer offlineOwner = Bukkit.getServer().getOfflinePlayer(ownerUUID);
|
||||||
|
ownerName = offlineOwner.getName();
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
// neither name nor UUID, so keep it as-is
|
||||||
|
ownerName = ownerString;
|
||||||
|
Stargate.debug("loadAllGates", "Invalid Stargate owner string: " + ownerString);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ownerName = ownerString;
|
||||||
|
}
|
||||||
|
|
||||||
|
Portal portal = new Portal(topLeft, modX, modZ, rotX, sign, button, dest, name, false, network, gate, ownerUUID, ownerName, hidden, alwaysOn, priv, free, backwards, show, noNetwork, random, bungee);
|
||||||
portal.register();
|
portal.register();
|
||||||
portal.close(true);
|
portal.close(true);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import java.util.Iterator;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -446,7 +447,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
// The player is an admin with the ability to see hidden gates
|
// The player is an admin with the ability to see hidden gates
|
||||||
if (hasPerm(player, "stargate.admin") || hasPerm(player, "stargate.admin.hidden")) return true;
|
if (hasPerm(player, "stargate.admin") || hasPerm(player, "stargate.admin.hidden")) return true;
|
||||||
// The player is the owner of the gate
|
// The player is the owner of the gate
|
||||||
return portal.getOwner().equalsIgnoreCase(player.getName());
|
return portal.isOwner(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -454,7 +455,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
public static boolean canPrivate(Player player, Portal portal) {
|
public static boolean canPrivate(Player player, Portal portal) {
|
||||||
// Check if the player is the owner of the gate
|
// Check if the player is the owner of the gate
|
||||||
if (portal.getOwner().equalsIgnoreCase(player.getName())) return true;
|
if (portal.isOwner(player)) return true;
|
||||||
// The player is an admin with the ability to use private gates
|
// The player is an admin with the ability to use private gates
|
||||||
return hasPerm(player, "stargate.admin") || hasPerm(player, "stargate.admin.private");
|
return hasPerm(player, "stargate.admin") || hasPerm(player, "stargate.admin.private");
|
||||||
}
|
}
|
||||||
@ -525,7 +526,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
// Check for this specific network
|
// Check for this specific network
|
||||||
if (hasPerm(player, "stargate.destroy.network." + network)) return true;
|
if (hasPerm(player, "stargate.destroy.network." + network)) return true;
|
||||||
// Check for personal gate
|
// Check for personal gate
|
||||||
return player.getName().equalsIgnoreCase(portal.getOwner()) && hasPerm(player, "stargate.destroy.personal");
|
return portal.isOwner(player) && hasPerm(player, "stargate.destroy.personal");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -537,7 +538,31 @@ public class Stargate extends JavaPlugin {
|
|||||||
// Economy is disabled
|
// Economy is disabled
|
||||||
if (!EconomyHandler.useEconomy()) return true;
|
if (!EconomyHandler.useEconomy()) return true;
|
||||||
// Charge player
|
// Charge player
|
||||||
return EconomyHandler.chargePlayer(player.getName(), target, cost);
|
return EconomyHandler.chargePlayer(player, target, cost);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Charge player for {action} if required, true on success, false if can't afford
|
||||||
|
*/
|
||||||
|
public static boolean chargePlayer(Player player, UUID target, int cost) {
|
||||||
|
// If cost is 0
|
||||||
|
if (cost == 0) return true;
|
||||||
|
// Economy is disabled
|
||||||
|
if (!EconomyHandler.useEconomy()) return true;
|
||||||
|
// Charge player
|
||||||
|
return EconomyHandler.chargePlayer(player, target, cost);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Charge player for {action} if required, true on success, false if can't afford
|
||||||
|
*/
|
||||||
|
public static boolean chargePlayer(Player player, int cost) {
|
||||||
|
// If cost is 0
|
||||||
|
if (cost == 0) return true;
|
||||||
|
// Economy is disabled
|
||||||
|
if (!EconomyHandler.useEconomy()) return true;
|
||||||
|
// Charge player
|
||||||
|
return EconomyHandler.chargePlayer(player, cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -551,7 +576,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
// Not charging for free destinations
|
// Not charging for free destinations
|
||||||
if (dest != null && !EconomyHandler.chargeFreeDestination && dest.isFree()) return 0;
|
if (dest != null && !EconomyHandler.chargeFreeDestination && dest.isFree()) return 0;
|
||||||
// Cost is 0 if the player owns this gate and funds go to the owner
|
// Cost is 0 if the player owns this gate and funds go to the owner
|
||||||
if (src.getGate().getToOwner() && src.getOwner().equalsIgnoreCase(player.getName())) return 0;
|
if (src.getGate().getToOwner() && src.isOwner(player)) return 0;
|
||||||
// Player gets free gate use
|
// Player gets free gate use
|
||||||
if (hasPerm(player, "stargate.free") || hasPerm(player, "stargate.free.use")) return 0;
|
if (hasPerm(player, "stargate.free") || hasPerm(player, "stargate.free.use")) return 0;
|
||||||
|
|
||||||
@ -650,8 +675,17 @@ public class Stargate extends JavaPlugin {
|
|||||||
|
|
||||||
int cost = Stargate.getUseCost(player, portal, dest);
|
int cost = Stargate.getUseCost(player, portal, dest);
|
||||||
if (cost > 0) {
|
if (cost > 0) {
|
||||||
String target = portal.getGate().getToOwner() ? portal.getOwner() : null;
|
boolean success;
|
||||||
if (!Stargate.chargePlayer(player, target, cost)) {
|
if(portal.getGate().getToOwner()) {
|
||||||
|
if(portal.getOwnerUUID() == null) {
|
||||||
|
success = Stargate.chargePlayer(player, portal.getOwnerUUID(), cost);
|
||||||
|
} else {
|
||||||
|
success = Stargate.chargePlayer(player, portal.getOwnerName(), cost);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
success = Stargate.chargePlayer(player, cost);
|
||||||
|
}
|
||||||
|
if(!success) {
|
||||||
// Insufficient Funds
|
// Insufficient Funds
|
||||||
Stargate.sendMessage(player, Stargate.getString("inFunds"));
|
Stargate.sendMessage(player, Stargate.getString("inFunds"));
|
||||||
portal.close(false);
|
portal.close(false);
|
||||||
@ -660,8 +694,13 @@ public class Stargate extends JavaPlugin {
|
|||||||
String deductMsg = Stargate.getString("ecoDeduct");
|
String deductMsg = Stargate.getString("ecoDeduct");
|
||||||
deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%", "%portal%"}, new String[] {EconomyHandler.format(cost), portal.getName()});
|
deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%", "%portal%"}, new String[] {EconomyHandler.format(cost), portal.getName()});
|
||||||
sendMessage(player, deductMsg, false);
|
sendMessage(player, deductMsg, false);
|
||||||
if (target != null) {
|
if (portal.getGate().getToOwner()) {
|
||||||
Player p = server.getPlayer(target);
|
Player p;
|
||||||
|
if(portal.getOwnerUUID() != null) {
|
||||||
|
p = server.getPlayer(portal.getOwnerUUID());
|
||||||
|
} else {
|
||||||
|
p = server.getPlayer(portal.getOwnerName());
|
||||||
|
}
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
String obtainedMsg = Stargate.getString("ecoObtain");
|
String obtainedMsg = Stargate.getString("ecoObtain");
|
||||||
obtainedMsg = Stargate.replaceVars(obtainedMsg, new String[] {"%cost%", "%portal%"}, new String[] {EconomyHandler.format(cost), portal.getName()});
|
obtainedMsg = Stargate.replaceVars(obtainedMsg, new String[] {"%cost%", "%portal%"}, new String[] {EconomyHandler.format(cost), portal.getName()});
|
||||||
@ -761,18 +800,32 @@ public class Stargate extends JavaPlugin {
|
|||||||
|
|
||||||
int cost = Stargate.getUseCost(player, portal, destination);
|
int cost = Stargate.getUseCost(player, portal, destination);
|
||||||
if (cost > 0) {
|
if (cost > 0) {
|
||||||
String target = portal.getGate().getToOwner() ? portal.getOwner() : null;
|
boolean success;
|
||||||
if (!Stargate.chargePlayer(player, target, cost)) {
|
if(portal.getGate().getToOwner()) {
|
||||||
|
if(portal.getOwnerUUID() == null) {
|
||||||
|
success = Stargate.chargePlayer(player, portal.getOwnerUUID(), cost);
|
||||||
|
} else {
|
||||||
|
success = Stargate.chargePlayer(player, portal.getOwnerName(), cost);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
success = Stargate.chargePlayer(player, cost);
|
||||||
|
}
|
||||||
|
if(!success) {
|
||||||
// Insufficient Funds
|
// Insufficient Funds
|
||||||
Stargate.sendMessage(player, "Insufficient Funds");
|
Stargate.sendMessage(player, Stargate.getString("inFunds"));
|
||||||
portal.close(false);
|
portal.close(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String deductMsg = Stargate.getString("ecoDeduct");
|
String deductMsg = Stargate.getString("ecoDeduct");
|
||||||
deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%", "%portal%"}, new String[] {EconomyHandler.format(cost), portal.getName()});
|
deductMsg = Stargate.replaceVars(deductMsg, new String[] {"%cost%", "%portal%"}, new String[] {EconomyHandler.format(cost), portal.getName()});
|
||||||
sendMessage(player, deductMsg, false);
|
sendMessage(player, deductMsg, false);
|
||||||
if (target != null) {
|
if (portal.getGate().getToOwner() && portal.getOwnerUUID() != null) {
|
||||||
Player p = server.getPlayer(target);
|
Player p;
|
||||||
|
if(portal.getOwnerUUID() != null) {
|
||||||
|
p = server.getPlayer(portal.getOwnerUUID());
|
||||||
|
} else {
|
||||||
|
p = server.getPlayer(portal.getOwnerName());
|
||||||
|
}
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
String obtainedMsg = Stargate.getString("ecoObtain");
|
String obtainedMsg = Stargate.getString("ecoObtain");
|
||||||
obtainedMsg = Stargate.replaceVars(obtainedMsg, new String[] {"%cost%", "%portal%"}, new String[] {EconomyHandler.format(cost), portal.getName()});
|
obtainedMsg = Stargate.replaceVars(obtainedMsg, new String[] {"%cost%", "%portal%"}, new String[] {EconomyHandler.format(cost), portal.getName()});
|
||||||
@ -984,7 +1037,7 @@ public class Stargate extends JavaPlugin {
|
|||||||
cost = dEvent.getCost();
|
cost = dEvent.getCost();
|
||||||
|
|
||||||
if (cost != 0) {
|
if (cost != 0) {
|
||||||
if (!Stargate.chargePlayer(player, null, cost)) {
|
if (!Stargate.chargePlayer(player, cost)) {
|
||||||
Stargate.debug("onBlockBreak", "Insufficient Funds");
|
Stargate.debug("onBlockBreak", "Insufficient Funds");
|
||||||
Stargate.sendMessage(player, Stargate.getString("inFunds"));
|
Stargate.sendMessage(player, Stargate.getString("inFunds"));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user