More UUID changes

This commit is contained in:
Andrzej Pomirski 2014-04-12 13:38:11 +02:00
parent b508d08bba
commit 7321e6dc07
9 changed files with 25 additions and 11 deletions

View File

@ -1,5 +1,6 @@
package com.Acrobot.ChestShop.Events.Economy;
import com.Acrobot.ChestShop.UUIDs.UUIDSaver;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
@ -28,7 +29,7 @@ public class CurrencyAddEvent extends Event {
}
public CurrencyAddEvent(BigDecimal amount, Player target) {
this(amount, target.getName(), target.getWorld());
this(amount, UUIDSaver.getUsername(target.getUniqueId()), target.getWorld());
}
/**

View File

@ -1,5 +1,6 @@
package com.Acrobot.ChestShop.Events.Economy;
import com.Acrobot.ChestShop.UUIDs.UUIDSaver;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
@ -25,7 +26,7 @@ public class CurrencyAmountEvent extends Event {
}
public CurrencyAmountEvent(Player player) {
this(player.getName(), player.getWorld());
this(UUIDSaver.getUsername(player.getUniqueId()), player.getWorld());
}
/**

View File

@ -1,5 +1,6 @@
package com.Acrobot.ChestShop.Events.Economy;
import com.Acrobot.ChestShop.UUIDs.UUIDSaver;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
@ -28,7 +29,7 @@ public class CurrencyCheckEvent extends Event {
}
public CurrencyCheckEvent(BigDecimal amount, Player player) {
this(amount, player.getName(), player.getWorld());
this(amount, UUIDSaver.getUsername(player.getUniqueId()), player.getWorld());
}
/**

View File

@ -1,5 +1,6 @@
package com.Acrobot.ChestShop.Events.Economy;
import com.Acrobot.ChestShop.UUIDs.UUIDSaver;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
@ -28,7 +29,7 @@ public class CurrencyHoldEvent extends Event {
}
public CurrencyHoldEvent(BigDecimal amount, Player target) {
this(amount, target.getName(), target.getWorld());
this(amount, UUIDSaver.getUsername(target.getUniqueId()), target.getWorld());
}
/**

View File

@ -1,5 +1,6 @@
package com.Acrobot.ChestShop.Events.Economy;
import com.Acrobot.ChestShop.UUIDs.UUIDSaver;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
@ -28,7 +29,7 @@ public class CurrencySubtractEvent extends Event {
}
public CurrencySubtractEvent(BigDecimal amount, Player target) {
this(amount, target.getName(), target.getWorld());
this(amount, UUIDSaver.getUsername(target.getUniqueId()), target.getWorld());
}
/**

View File

@ -116,7 +116,7 @@ public class PlayerInteract implements Listener {
String material = sign.getLine(ITEM_LINE);
String ownerName = UUIDSaver.getFullUsername(name);
OfflinePlayer owner = Bukkit.getOfflinePlayer(ownerName);
OfflinePlayer owner = Bukkit.getOfflinePlayer(UUIDSaver.getUUID(ownerName));
Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
double price = (action == buy ? PriceUtil.getBuyPrice(prices) : PriceUtil.getSellPrice(prices));

View File

@ -4,6 +4,7 @@ import com.Acrobot.ChestShop.ChestShop;
import com.Acrobot.ChestShop.Events.Economy.CurrencyAddEvent;
import com.Acrobot.ChestShop.Events.Economy.CurrencySubtractEvent;
import com.Acrobot.ChestShop.Events.TransactionEvent;
import com.Acrobot.ChestShop.UUIDs.UUIDSaver;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -22,7 +23,9 @@ public class EconomicModule implements Listener {
return;
}
CurrencyAddEvent currencyAddEvent = new CurrencyAddEvent(BigDecimal.valueOf(event.getPrice()), event.getOwner().getName(), event.getSign().getWorld());
CurrencyAddEvent currencyAddEvent = new CurrencyAddEvent(BigDecimal.valueOf(event.getPrice()),
UUIDSaver.getUsername(event.getOwner().getUniqueId()),
event.getSign().getWorld());
ChestShop.callEvent(currencyAddEvent);
CurrencySubtractEvent currencySubtractEvent = new CurrencySubtractEvent(BigDecimal.valueOf(event.getPrice()), event.getClient());
@ -35,7 +38,9 @@ public class EconomicModule implements Listener {
return;
}
CurrencySubtractEvent currencySubtractEvent = new CurrencySubtractEvent(BigDecimal.valueOf(event.getPrice()), event.getOwner().getName(), event.getSign().getWorld());
CurrencySubtractEvent currencySubtractEvent = new CurrencySubtractEvent(BigDecimal.valueOf(event.getPrice()),
UUIDSaver.getUsername(event.getOwner().getUniqueId()),
event.getSign().getWorld());
ChestShop.callEvent(currencySubtractEvent);
CurrencyAddEvent currencyAddEvent = new CurrencyAddEvent(BigDecimal.valueOf(event.getPrice()), event.getClient());

View File

@ -4,6 +4,7 @@ import com.Acrobot.Breeze.Utils.InventoryUtil;
import com.Acrobot.ChestShop.ChestShop;
import com.Acrobot.ChestShop.Events.Economy.CurrencyCheckEvent;
import com.Acrobot.ChestShop.Events.PreTransactionEvent;
import com.Acrobot.ChestShop.UUIDs.UUIDSaver;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.Inventory;
@ -51,7 +52,9 @@ public class AmountAndPriceChecker implements Listener {
ItemStack[] stock = event.getStock();
Inventory clientInventory = event.getClientInventory();
CurrencyCheckEvent currencyCheckEvent = new CurrencyCheckEvent(BigDecimal.valueOf(event.getPrice()), event.getOwner().getName(), event.getSign().getWorld());
CurrencyCheckEvent currencyCheckEvent = new CurrencyCheckEvent(BigDecimal.valueOf(event.getPrice()),
UUIDSaver.getUsername(event.getOwner().getUniqueId()),
event.getSign().getWorld());
ChestShop.callEvent(currencyCheckEvent);
if (!currencyCheckEvent.hasEnough()) {

View File

@ -8,6 +8,7 @@ import com.Acrobot.ChestShop.Events.Economy.CurrencyAmountEvent;
import com.Acrobot.ChestShop.Events.Economy.CurrencyCheckEvent;
import com.Acrobot.ChestShop.Events.Economy.CurrencyHoldEvent;
import com.Acrobot.ChestShop.Events.PreTransactionEvent;
import com.Acrobot.ChestShop.UUIDs.UUIDSaver;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -60,7 +61,7 @@ public class PartialTransactionModule implements Listener {
event.setStock(getCountedItemStack(stock, amountAffordable));
}
String seller = event.getOwner().getName();
String seller = UUIDSaver.getUsername(event.getOwner().getUniqueId());
CurrencyHoldEvent currencyHoldEvent = new CurrencyHoldEvent(BigDecimal.valueOf(price), seller, client.getWorld());
ChestShop.callEvent(currencyHoldEvent);
@ -93,7 +94,7 @@ public class PartialTransactionModule implements Listener {
}
Player client = event.getClient();
String ownerName = event.getOwner().getName();
String ownerName = UUIDSaver.getUsername(event.getOwner().getUniqueId());
ItemStack[] stock = event.getStock();
double price = event.getPrice();