mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-27 12:38:40 +01:00
commit
5a39b6fd62
@ -1,6 +1,8 @@
|
||||
ChestShop
|
||||
================================
|
||||
|
||||
My fork of ChestShop. Downloads can be found here: [http://ci.dmulloy2.net/job/ChestShop](http://ci.dmulloy2.net/job/ChestShop)
|
||||
|
||||
ChestShop is an awesome plugin for managing your server's economy.
|
||||
By using chests and signs, you can effectively create your own market!
|
||||
|
||||
@ -28,6 +30,4 @@ To install external dependencies, place your .jar into the main folder and launc
|
||||
|
||||
Links
|
||||
--------------------------------
|
||||
* [Forum Thread](http://forums.bukkit.org/threads/4150/)
|
||||
* [BukkitDev site](http://dev.bukkit.org/server-mods/chestshop/)
|
||||
* [Bug Tracker](http://dev.bukkit.org/server-mods/chestshop/tickets/?status=+)
|
||||
* [Downloads](http://ci.dmulloy2.net/job/ChestShop)
|
||||
|
41
pom.xml
41
pom.xml
@ -10,9 +10,9 @@
|
||||
<description>Chest-and-sign shop plugin for Bukkit</description>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git://github.com/Acrobot/ChestShop-3</connection>
|
||||
<developerConnection>scm:git:ssh://git@github.com/Acrobot/ChestShop-3.git</developerConnection>
|
||||
<url>https://github.com/Acrobot/ChestShop-3</url>
|
||||
<connection>scm:git:git://github.com/dmulloy2/ChestShop-3</connection>
|
||||
<developerConnection>scm:git:ssh://git@github.com/dmulloy2/ChestShop-3.git</developerConnection>
|
||||
<url>https://github.com/dmulloy2/ChestShop-3</url>
|
||||
</scm>
|
||||
|
||||
<repositories>
|
||||
@ -30,11 +30,7 @@
|
||||
</repository>
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>heroes-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_snapshots/</url>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>authme-repo</id>
|
||||
@ -69,9 +65,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.11-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@ -95,7 +91,7 @@
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.5.2</version>
|
||||
<version>1.6.6</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@ -130,16 +126,12 @@
|
||||
<dependency>
|
||||
<groupId>com.herocraftonline.heroes</groupId>
|
||||
<artifactId>Heroes</artifactId>
|
||||
<version>1.5.5.6-SNAPSHOT</version>
|
||||
<version>1.5.5</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<groupId>*</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
@ -241,11 +233,10 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.t00thpick1</groupId>
|
||||
<artifactId>residence</artifactId>
|
||||
<version>3.0.0q-SNAPSHOT</version>
|
||||
<groupId>com.bekvon.bukkit.residence</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
<version>4.5.3.0</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@ -274,8 +265,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -1,14 +1,19 @@
|
||||
package com.Acrobot.Breeze.Configuration;
|
||||
|
||||
import com.Acrobot.Breeze.Configuration.Annotations.PrecededBySpace;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Scanner;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Scanner;
|
||||
import com.Acrobot.Breeze.Configuration.Annotations.PrecededBySpace;
|
||||
|
||||
/**
|
||||
* A class which can be used to make configs easier to load
|
||||
@ -71,18 +76,13 @@ public class Configuration {
|
||||
* @return If the file ends with space
|
||||
*/
|
||||
public static boolean endsWithSpace(File file) {
|
||||
try {
|
||||
Scanner scanner = new Scanner(file);
|
||||
try (Scanner scanner = new Scanner(file)) {
|
||||
String lastLine = "";
|
||||
|
||||
while (scanner.hasNextLine()) {
|
||||
lastLine = scanner.nextLine();
|
||||
}
|
||||
|
||||
if (scanner != null) {
|
||||
scanner.close();
|
||||
}
|
||||
|
||||
return lastLine.isEmpty();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.Acrobot.Breeze.Database;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* Database class, which can be used to connect to JDBC
|
||||
*
|
||||
@ -49,7 +50,7 @@ public class Database {
|
||||
return false;
|
||||
}
|
||||
|
||||
String tableName = ((javax.persistence.Table) clazz.getAnnotation(javax.persistence.Table.class)).name();
|
||||
String tableName = clazz.getAnnotation(javax.persistence.Table.class).name();
|
||||
Table table = getTable(tableName);
|
||||
|
||||
EntityParser parser = new EntityParser(clazz);
|
||||
|
@ -406,7 +406,7 @@ public class Base64 {
|
||||
|
||||
byte[] ALPHABET = getAlphabet(options);
|
||||
|
||||
// 1 2 3
|
||||
// 1 2 3
|
||||
// 01234567890123456789012345678901 Bit position
|
||||
// --------000000001111111122222222 Array position from threeBytes
|
||||
// --------| || || || | Six bit groups to index ALPHABET
|
||||
@ -1106,8 +1106,8 @@ public class Base64 {
|
||||
else {
|
||||
// There's a bad input character in the Base64 stream.
|
||||
throw new java.io.IOException(String.format(
|
||||
"Bad Base64 input character decimal %d in array position %d", ((int) source[i]) & 0xFF, i));
|
||||
} // end else:
|
||||
"Bad Base64 input character decimal %d in array position %d", (source[i]) & 0xFF, i));
|
||||
} // end else:
|
||||
} // each input character
|
||||
|
||||
byte[] out = new byte[outBuffPosn];
|
||||
@ -1164,7 +1164,7 @@ public class Base64 {
|
||||
boolean dontGunzip = (options & DONT_GUNZIP) != 0;
|
||||
if ((bytes != null) && (bytes.length >= 4) && (!dontGunzip)) {
|
||||
|
||||
int head = ((int) bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
|
||||
int head = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
|
||||
if (java.util.zip.GZIPInputStream.GZIP_MAGIC == head) {
|
||||
java.io.ByteArrayInputStream bais = null;
|
||||
java.util.zip.GZIPInputStream gzis = null;
|
||||
@ -1515,7 +1515,7 @@ public class Base64 {
|
||||
out.close();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
} // end finally
|
||||
} // end finally
|
||||
} // end encodeFileToFile
|
||||
|
||||
|
||||
@ -1545,7 +1545,7 @@ public class Base64 {
|
||||
out.close();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
} // end finally
|
||||
} // end finally
|
||||
} // end decodeFileToFile
|
||||
|
||||
|
||||
@ -1683,7 +1683,7 @@ public class Base64 {
|
||||
else {
|
||||
// Must have broken out from above.
|
||||
throw new java.io.IOException("Improperly padded Base64 input.");
|
||||
} // end
|
||||
} // end
|
||||
|
||||
} // end else: decode
|
||||
} // end else: get data
|
||||
|
@ -1,17 +1,32 @@
|
||||
package com.Acrobot.Breeze.Utils;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
*/
|
||||
public class InventoryUtil {
|
||||
private static Boolean legacyContents = null;
|
||||
|
||||
private static ItemStack[] getStorageContents(Inventory inventory) {
|
||||
if (legacyContents == null) {
|
||||
try {
|
||||
inventory.getStorageContents();
|
||||
legacyContents = false;
|
||||
} catch (NoSuchMethodError e) {
|
||||
legacyContents = true;
|
||||
}
|
||||
}
|
||||
|
||||
return legacyContents ? inventory.getContents() : inventory.getStorageContents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of the item inside the inventory
|
||||
*
|
||||
@ -49,7 +64,7 @@ public class InventoryUtil {
|
||||
* @return Is the inventory empty?
|
||||
*/
|
||||
public static boolean isEmpty(Inventory inventory) {
|
||||
for (ItemStack stack : inventory.getContents()) {
|
||||
for (ItemStack stack : getStorageContents(inventory)) {
|
||||
if (!MaterialUtil.isEmpty(stack)) {
|
||||
return false;
|
||||
}
|
||||
@ -89,7 +104,7 @@ public class InventoryUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (ItemStack iStack : inventory.getContents()) {
|
||||
for (ItemStack iStack : getStorageContents(inventory)) {
|
||||
if (left <= 0) {
|
||||
return true;
|
||||
}
|
||||
@ -125,7 +140,7 @@ public class InventoryUtil {
|
||||
|
||||
int amountLeft = item.getAmount();
|
||||
|
||||
for (int currentSlot = 0; currentSlot < inventory.getSize() && amountLeft > 0; currentSlot++) {
|
||||
for (int currentSlot = 0; currentSlot < effectiveSize(inventory) && amountLeft > 0; currentSlot++) {
|
||||
ItemStack currentItem = inventory.getItem(currentSlot);
|
||||
ItemStack duplicate = item.clone();
|
||||
|
||||
@ -152,6 +167,12 @@ public class InventoryUtil {
|
||||
return amountLeft;
|
||||
}
|
||||
|
||||
// Don't use the armor slots or extra slots
|
||||
private static int effectiveSize(Inventory inventory)
|
||||
{
|
||||
return getStorageContents(inventory).length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an item to the inventor
|
||||
*
|
||||
|
@ -38,11 +38,21 @@ import com.Acrobot.ChestShop.Signs.RestrictedSign;
|
||||
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
||||
import com.Acrobot.ChestShop.Updater.Updater;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.core.LogEvent;
|
||||
import org.apache.logging.log4j.core.LoggerContext;
|
||||
import org.apache.logging.log4j.core.config.LoggerConfig;
|
||||
import org.apache.logging.log4j.core.filter.AbstractFilter;
|
||||
import org.apache.logging.log4j.message.Message;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.mcstats.Metrics;
|
||||
@ -81,6 +91,7 @@ public class ChestShop extends JavaPlugin {
|
||||
Configuration.pairFileAndClass(loadFile("config.yml"), Properties.class);
|
||||
Configuration.pairFileAndClass(loadFile("local.yml"), Messages.class);
|
||||
|
||||
turnOffDatabaseLogging();
|
||||
handleMigrations();
|
||||
|
||||
itemDatabase = new ItemDatabase();
|
||||
@ -114,6 +125,46 @@ public class ChestShop extends JavaPlugin {
|
||||
startUpdater();
|
||||
}
|
||||
|
||||
private void turnOffDatabaseLogging() {
|
||||
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
|
||||
org.apache.logging.log4j.core.config.Configuration config = ctx.getConfiguration();
|
||||
LoggerConfig loggerConfig = config.getLoggerConfig("");
|
||||
|
||||
loggerConfig.addFilter(new AbstractFilter() {
|
||||
@Override
|
||||
public Result filter(org.apache.logging.log4j.core.Logger logger, Level level, Marker marker, String msg, Object... params) {
|
||||
return filter(logger.getName(), level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result filter(org.apache.logging.log4j.core.Logger logger, Level level, Marker marker, Object msg, Throwable t) {
|
||||
return filter(logger.getName(), level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result filter(org.apache.logging.log4j.core.Logger logger, Level level, Marker marker, Message msg, Throwable t) {
|
||||
return filter(logger.getName(), level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result filter(LogEvent event) {
|
||||
return filter(event.getLoggerName(), event.getLevel());
|
||||
}
|
||||
|
||||
private Result filter(String classname, Level level) {
|
||||
if (level.isAtLeastAsSpecificAs(Level.ERROR) && !classname.contains("SqliteDatabaseType")) {
|
||||
return Result.NEUTRAL;
|
||||
}
|
||||
|
||||
if (classname.contains("SqliteDatabaseType") || classname.contains("TableUtils")) {
|
||||
return Result.DENY;
|
||||
} else {
|
||||
return Result.NEUTRAL;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleMigrations() {
|
||||
File versionFile = loadFile("version");
|
||||
YamlConfiguration previousVersion = YamlConfiguration.loadConfiguration(versionFile);
|
||||
@ -212,8 +263,9 @@ public class ChestShop extends JavaPlugin {
|
||||
|
||||
registerEvent(new ItemInfoListener());
|
||||
registerEvent(new GarbageTextListener());
|
||||
|
||||
if (this.getServer().getPluginManager().getPlugin("AuthMe") != null && this.getServer().getPluginManager().getPlugin("AuthMe").isEnabled()){
|
||||
|
||||
Plugin authMe = getServer().getPluginManager().getPlugin("AuthMe");
|
||||
if (authMe != null && authMe.isEnabled()) {
|
||||
registerEvent(new AuthMeChestShopListener());
|
||||
}
|
||||
|
||||
|
@ -137,4 +137,4 @@ public class Properties {
|
||||
@PrecededBySpace
|
||||
@ConfigurationComment("How much Heroes exp should people get for creating a ChestShop?")
|
||||
public static double HEROES_EXP = 100;
|
||||
}
|
||||
}
|
@ -1,5 +1,11 @@
|
||||
package com.Acrobot.ChestShop.Containers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
@ -7,45 +13,49 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
*/
|
||||
public class AdminInventory implements Inventory {
|
||||
@Override
|
||||
public int getSize() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxStackSize(int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Admin inventory";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem(int i, ItemStack itemStack) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, ItemStack> addItem(ItemStack... itemStacks) {
|
||||
return new HashMap<Integer, ItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, ItemStack> removeItem(ItemStack... itemStacks) {
|
||||
return new HashMap<Integer, ItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getContents() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(Material.CHEST, 1),
|
||||
@ -53,37 +63,56 @@ public class AdminInventory implements Inventory {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContents(ItemStack[] itemStacks) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getStorageContents() {
|
||||
return new ItemStack[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStorageContents(ItemStack[] itemStacks) throws IllegalArgumentException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(int i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Material material) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(int i, int i1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Material material, int i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(ItemStack itemStack, int i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAtLeast(ItemStack itemStack, int i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, ? extends ItemStack> all(int i) {
|
||||
HashMap<Integer, ItemStack> items = new HashMap<Integer, ItemStack>();
|
||||
items.put(1, new ItemStack(i, Integer.MAX_VALUE));
|
||||
@ -91,6 +120,7 @@ public class AdminInventory implements Inventory {
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, ? extends ItemStack> all(Material material) {
|
||||
if (material.getMaxDurability() != 0) {
|
||||
HashMap<Integer, ItemStack> items = new HashMap<Integer, ItemStack>();
|
||||
@ -105,6 +135,7 @@ public class AdminInventory implements Inventory {
|
||||
return all(material.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Integer, ? extends ItemStack> all(ItemStack itemStack) {
|
||||
HashMap<Integer, ItemStack> items = new HashMap<Integer, ItemStack>();
|
||||
|
||||
@ -116,58 +147,78 @@ public class AdminInventory implements Inventory {
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int first(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int first(Material material) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int first(ItemStack itemStack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int firstEmpty() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Material material) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(ItemStack itemStack) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HumanEntity> getViewers() {
|
||||
return new ArrayList<HumanEntity>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "Admin inventory";
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryType getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryHolder getHolder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<ItemStack> iterator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<ItemStack> iterator(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -40,4 +40,4 @@ public class AuthMeChestShopListener implements Listener {
|
||||
|
||||
event.setCancelled(TransactionOutcome.CLIENT_DOES_NOT_HAVE_PERMISSION);
|
||||
}
|
||||
}
|
||||
}
|
@ -63,6 +63,9 @@ public class SignBreak implements Listener {
|
||||
public static void onSignBreak(BlockBreakEvent event) {
|
||||
if (!canBlockBeBroken(event.getBlock(), event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
if (isSign(event.getBlock())) {
|
||||
event.getBlock().getState().update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +121,6 @@ public class SignBreak implements Listener {
|
||||
boolean canBeBroken = true;
|
||||
|
||||
for (Sign sign : attachedSigns) {
|
||||
sign.update();
|
||||
|
||||
if (!canBeBroken || !ChestShopSign.isValid(sign)) {
|
||||
continue;
|
||||
|
@ -1,18 +1,28 @@
|
||||
package com.Acrobot.ChestShop.Listeners.Economy.Plugins;
|
||||
|
||||
import com.Acrobot.ChestShop.ChestShop;
|
||||
import com.Acrobot.ChestShop.Events.Economy.*;
|
||||
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.math.BigDecimal;
|
||||
import com.Acrobot.ChestShop.ChestShop;
|
||||
import com.Acrobot.ChestShop.Events.Economy.AccountCheckEvent;
|
||||
import com.Acrobot.ChestShop.Events.Economy.CurrencyAddEvent;
|
||||
import com.Acrobot.ChestShop.Events.Economy.CurrencyAmountEvent;
|
||||
import com.Acrobot.ChestShop.Events.Economy.CurrencyCheckEvent;
|
||||
import com.Acrobot.ChestShop.Events.Economy.CurrencyFormatEvent;
|
||||
import com.Acrobot.ChestShop.Events.Economy.CurrencyHoldEvent;
|
||||
import com.Acrobot.ChestShop.Events.Economy.CurrencySubtractEvent;
|
||||
import com.Acrobot.ChestShop.Events.Economy.CurrencyTransferEvent;
|
||||
|
||||
/**
|
||||
* Represents a Vault connector
|
||||
@ -20,11 +30,11 @@ import java.math.BigDecimal;
|
||||
* @author Acrobot
|
||||
*/
|
||||
public class VaultListener implements Listener {
|
||||
private final Economy provider;
|
||||
private static Economy provider;
|
||||
|
||||
private VaultListener(Economy provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
private VaultListener(Economy provider) { VaultListener.provider = provider; }
|
||||
|
||||
public static Economy getProvider() { return provider; }
|
||||
|
||||
public boolean transactionCanFail() {
|
||||
return provider.getName().equals("Gringotts") || provider.getName().equals("GoldIsMoney") || provider.getName().equals("MultiCurrency");
|
||||
@ -61,10 +71,16 @@ public class VaultListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
double balance = provider.getBalance(NameManager.getLastSeenName(event.getAccount()), event.getWorld().getName());
|
||||
double balance = 0;
|
||||
//String lastSeen = NameManager.getLastSeenName(event.getAccount());
|
||||
OfflinePlayer lastSeen = Bukkit.getOfflinePlayer(event.getAccount());
|
||||
|
||||
if (balance > Double.MAX_VALUE) {
|
||||
balance = Double.MAX_VALUE;
|
||||
if (lastSeen != null) {
|
||||
balance = provider.getBalance(lastSeen, event.getWorld().getName());
|
||||
|
||||
if (balance > Double.MAX_VALUE) {
|
||||
balance = Double.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
event.setAmount(balance);
|
||||
@ -77,9 +93,15 @@ public class VaultListener implements Listener {
|
||||
}
|
||||
|
||||
World world = event.getWorld();
|
||||
//String lastSeen = NameManager.getLastSeenName(event.getAccount());
|
||||
OfflinePlayer lastSeen = Bukkit.getOfflinePlayer(event.getAccount());
|
||||
|
||||
if (provider.has(NameManager.getLastSeenName(event.getAccount()), world.getName(), event.getDoubleAmount())) {
|
||||
event.hasEnough(true);
|
||||
if (lastSeen != null) {
|
||||
if (provider.has(lastSeen, world.getName(), event.getDoubleAmount())) {
|
||||
event.hasEnough(true);
|
||||
}
|
||||
} else {
|
||||
event.hasEnough(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,10 +112,10 @@ public class VaultListener implements Listener {
|
||||
}
|
||||
|
||||
World world = event.getWorld();
|
||||
//String lastSeen = NameManager.getLastSeenName(event.getAccount());
|
||||
OfflinePlayer lastSeen = Bukkit.getOfflinePlayer(event.getAccount());
|
||||
|
||||
if (!provider.hasAccount(NameManager.getLastSeenName(event.getAccount()), world.getName())) {
|
||||
event.hasAccount(false);
|
||||
}
|
||||
event.hasAccount(lastSeen != null && provider.hasAccount(lastSeen, world.getName()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -103,7 +125,6 @@ public class VaultListener implements Listener {
|
||||
}
|
||||
|
||||
String formatted = provider.format(event.getDoubleAmount());
|
||||
|
||||
event.setFormattedAmount(formatted);
|
||||
}
|
||||
|
||||
@ -114,8 +135,12 @@ public class VaultListener implements Listener {
|
||||
}
|
||||
|
||||
World world = event.getWorld();
|
||||
//String lastSeen = NameManager.getLastSeenName(event.getTarget());
|
||||
OfflinePlayer lastSeen = Bukkit.getOfflinePlayer(event.getTarget());
|
||||
|
||||
provider.depositPlayer(NameManager.getLastSeenName(event.getTarget()), world.getName(), event.getDoubleAmount());
|
||||
if (lastSeen != null) {
|
||||
provider.depositPlayer(lastSeen, world.getName(), event.getDoubleAmount());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -125,8 +150,12 @@ public class VaultListener implements Listener {
|
||||
}
|
||||
|
||||
World world = event.getWorld();
|
||||
//String lastSeen = NameManager.getLastSeenName(event.getTarget());
|
||||
OfflinePlayer lastSeen = Bukkit.getOfflinePlayer(event.getTarget());
|
||||
|
||||
provider.withdrawPlayer(NameManager.getLastSeenName(event.getTarget()), world.getName(), event.getDoubleAmount());
|
||||
if (lastSeen != null) {
|
||||
provider.withdrawPlayer(lastSeen, world.getName(), event.getDoubleAmount());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -152,18 +181,27 @@ public class VaultListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!provider.hasAccount(NameManager.getLastSeenName(event.getAccount()), event.getWorld().getName())) {
|
||||
//String lastSeen = NameManager.getLastSeenName(event.getAccount());
|
||||
OfflinePlayer lastSeen = Bukkit.getOfflinePlayer(event.getAccount());
|
||||
String world = event.getWorld().getName();
|
||||
|
||||
if (lastSeen == null) {
|
||||
event.canHold(false);
|
||||
return;
|
||||
}
|
||||
|
||||
EconomyResponse response = provider.depositPlayer(NameManager.getLastSeenName(event.getAccount()), event.getWorld().getName(), event.getDoubleAmount());
|
||||
if (!provider.hasAccount(lastSeen, world)) {
|
||||
event.canHold(false);
|
||||
return;
|
||||
}
|
||||
|
||||
EconomyResponse response = provider.depositPlayer(lastSeen, world, event.getDoubleAmount());
|
||||
|
||||
if (!response.transactionSuccess()) {
|
||||
event.canHold(false);
|
||||
return;
|
||||
}
|
||||
|
||||
provider.withdrawPlayer(NameManager.getLastSeenName(event.getAccount()), event.getWorld().getName(), event.getDoubleAmount());
|
||||
provider.withdrawPlayer(lastSeen, world, event.getDoubleAmount());
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,14 @@
|
||||
package com.Acrobot.ChestShop.Listeners.Player;
|
||||
|
||||
import com.Acrobot.Breeze.Utils.NameUtil;
|
||||
import com.Acrobot.ChestShop.ChestShop;
|
||||
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
||||
import com.Acrobot.ChestShop.UUIDs.PlayerDTO;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
import com.Acrobot.ChestShop.ChestShop;
|
||||
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
||||
import com.Acrobot.ChestShop.UUIDs.PlayerDTO;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
@ -24,20 +22,8 @@ public class PlayerConnect implements Listener {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(ChestShop.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String playerName = NameUtil.stripUsername(playerDTO.getName());
|
||||
UUID uuid = NameManager.getUUID(playerName);
|
||||
|
||||
if (uuid != null && !playerDTO.getUniqueId().equals(uuid)) {
|
||||
Bukkit.getScheduler().runTask(ChestShop.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getPlayer(playerDTO.getUniqueId()).kickPlayer("[ChestShop]" +
|
||||
"Unfortunately, this username was already used by " +
|
||||
"another player.");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
// String playerName = NameUtil.stripUsername(playerDTO.getName());
|
||||
// UUID uuid = NameManager.getUUID(playerName);
|
||||
|
||||
NameManager.storeUsername(playerDTO);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.Acrobot.ChestShop.Configuration.Properties;
|
||||
import com.Acrobot.ChestShop.Containers.AdminInventory;
|
||||
import com.Acrobot.ChestShop.Events.PreTransactionEvent;
|
||||
import com.Acrobot.ChestShop.Events.TransactionEvent;
|
||||
import com.Acrobot.ChestShop.Listeners.Economy.Plugins.VaultListener;
|
||||
import com.Acrobot.ChestShop.Permission;
|
||||
import com.Acrobot.ChestShop.Plugins.ChestShop;
|
||||
import com.Acrobot.ChestShop.Security;
|
||||
@ -45,12 +46,11 @@ import static org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK;
|
||||
public class PlayerInteract implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public static void onInteract(PlayerInteractEvent event) {
|
||||
public static void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
Block block = event.getClickedBlock();
|
||||
|
||||
if (block == null) {
|
||||
if (block == null)
|
||||
return;
|
||||
}
|
||||
|
||||
Action action = event.getAction();
|
||||
Player player = event.getPlayer();
|
||||
@ -68,12 +68,10 @@ public class PlayerInteract implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isSign(block) || player.getItemInHand().getType() == Material.SIGN) { // Blocking accidental sign edition
|
||||
if (!isSign(block) || player.getItemInHand().getType() == Material.SIGN) // Blocking accidental sign edition
|
||||
return;
|
||||
}
|
||||
|
||||
Sign sign = (Sign) block.getState();
|
||||
|
||||
if (!ChestShopSign.isValid(sign)) {
|
||||
return;
|
||||
}
|
||||
@ -95,17 +93,14 @@ public class PlayerInteract implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
//Bukkit.getLogger().info("ChestShop - DEBUG - "+block.getWorld().getName()+": "+block.getLocation().getBlockX()+", "+block.getLocation().getBlockY()+", "+block.getLocation().getBlockZ());
|
||||
PreTransactionEvent pEvent = preparePreTransactionEvent(sign, player, action);
|
||||
|
||||
if (pEvent == null) {
|
||||
if (pEvent == null)
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(pEvent);
|
||||
|
||||
if (pEvent.isCancelled()) {
|
||||
if (pEvent.isCancelled())
|
||||
return;
|
||||
}
|
||||
|
||||
TransactionEvent tEvent = new TransactionEvent(pEvent, sign);
|
||||
Bukkit.getPluginManager().callEvent(tEvent);
|
||||
@ -118,14 +113,19 @@ public class PlayerInteract implements Listener {
|
||||
String material = sign.getLine(ITEM_LINE);
|
||||
|
||||
String ownerName = NameManager.getFullUsername(name);
|
||||
UUID uuid = NameManager.getUUID(ownerName);
|
||||
|
||||
if (uuid == null) {
|
||||
if (ownerName == null || ownerName.isEmpty())
|
||||
return null;
|
||||
|
||||
UUID uuid = NameManager.getUUID(ownerName);
|
||||
if (uuid == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
OfflinePlayer owner = Bukkit.getOfflinePlayer(uuid);
|
||||
|
||||
// check if player exists in economy
|
||||
if(!ChestShopSign.isAdminShop(sign) && (owner == null || owner.getName() == null || !VaultListener.getProvider().hasAccount(owner)))
|
||||
return null;
|
||||
|
||||
Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
|
||||
double price = (action == buy ? PriceUtil.getBuyPrice(prices) : PriceUtil.getSellPrice(prices));
|
||||
|
||||
@ -133,7 +133,6 @@ public class PlayerInteract implements Listener {
|
||||
Inventory ownerInventory = (ChestShopSign.isAdminShop(sign) ? new AdminInventory() : chest != null ? chest.getInventory() : null);
|
||||
|
||||
ItemStack item = MaterialUtil.getItem(material);
|
||||
|
||||
if (item == null || !NumberUtil.isInteger(quantity)) {
|
||||
player.sendMessage(Messages.prefix(Messages.INVALID_SHOP_DETECTED));
|
||||
return null;
|
||||
|
@ -25,7 +25,7 @@ public class EconomicModule implements Listener {
|
||||
CurrencyAddEvent currencyAddEvent = new CurrencyAddEvent(BigDecimal.valueOf(event.getPrice()),
|
||||
event.getOwner().getUniqueId(),
|
||||
event.getSign().getWorld());
|
||||
ChestShop.callEvent(currencyAddEvent);
|
||||
ChestShop.callEvent(currencyAddEvent); // java.lang.StackOverflowError
|
||||
|
||||
CurrencySubtractEvent currencySubtractEvent = new CurrencySubtractEvent(BigDecimal.valueOf(event.getPrice()), event.getClient());
|
||||
ChestShop.callEvent(currencySubtractEvent);
|
||||
|
@ -32,6 +32,10 @@ public class ShopRefundListener implements Listener {
|
||||
}
|
||||
|
||||
String ownerName = NameManager.getFullUsername(event.getSign().getLine(NAME_LINE));
|
||||
if (ownerName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
UUID owner = NameManager.getUUID(ownerName);
|
||||
|
||||
CurrencyAddEvent currencyEvent = new CurrencyAddEvent(BigDecimal.valueOf(refundPrice), owner, event.getSign().getWorld());
|
||||
|
@ -76,7 +76,10 @@ public class ItemDatabase {
|
||||
* @param code Item code
|
||||
* @return ItemStack represented by this code
|
||||
*/
|
||||
public ItemStack getFromCode(String code) {
|
||||
public ItemStack getFromCode(String code)
|
||||
{
|
||||
// TODO java.lang.StackOverflowError - http://pastebin.com/eRD8wUFM - Corrupt item DB?
|
||||
|
||||
try {
|
||||
int id = Base62.decode(code);
|
||||
Item item = itemDao.queryBuilder().where().eq("id", id).queryForFirst();
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.Acrobot.ChestShop.Plugins;
|
||||
|
||||
import com.Acrobot.ChestShop.Events.Protection.ProtectionCheckEvent;
|
||||
import net.t00thpick1.residence.Residence;
|
||||
import net.t00thpick1.residence.api.ResidenceAPI;
|
||||
import net.t00thpick1.residence.api.areas.ResidenceArea;
|
||||
import net.t00thpick1.residence.api.flags.FlagManager;
|
||||
import com.bekvon.bukkit.residence.Residence;
|
||||
import com.bekvon.bukkit.residence.api.ResidenceApi;
|
||||
import com.bekvon.bukkit.residence.containers.Flags;
|
||||
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
@ -25,10 +25,10 @@ public class ResidenceChestProtection implements Listener {
|
||||
|
||||
Block block = event.getBlock();
|
||||
Player player = event.getPlayer();
|
||||
ResidenceArea area = ResidenceAPI.getResidenceManager().getByLocation(block.getLocation());
|
||||
ClaimedResidence residence = ResidenceApi.getResidenceManager().getByLoc(block.getLocation());
|
||||
|
||||
if (area != null) {
|
||||
if (!area.allowAction(player.getName(), FlagManager.CONTAINER) && !Residence.getInstance().isAdminMode(player)) {
|
||||
if (residence != null) {
|
||||
if (!residence.getPermissions().playerHas(player, Flags.container, true) && !Residence.isResAdminOn(player)) {
|
||||
//Doesn't have permissions to that chest.
|
||||
event.setResult(Event.Result.DENY);
|
||||
}
|
||||
|
@ -81,7 +81,10 @@ public class ChestShopSign {
|
||||
if (player == null) return false;
|
||||
if (sign == null) return true;
|
||||
|
||||
return NameManager.canUseName(player, sign.getLine(NAME_LINE));
|
||||
String name = sign.getLine(NAME_LINE);
|
||||
if (name == null || name.isEmpty()) return true;
|
||||
|
||||
return NameManager.canUseName(player, name);
|
||||
}
|
||||
|
||||
public static boolean isValidPreparedSign(String[] lines) {
|
||||
|
@ -9,20 +9,24 @@ import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Lets you save/cache username and UUID relations
|
||||
*
|
||||
* @author Andrzej Pomirski (Acrobot)
|
||||
*/
|
||||
@SuppressWarnings("UnusedAssignment") //I deliberately set the variables to null while initializing
|
||||
@SuppressWarnings("UnusedAssignment") // I deliberately set the variables to null while initializing
|
||||
public class NameManager {
|
||||
private static Dao<Account, String> accounts;
|
||||
|
||||
@ -35,9 +39,9 @@ public class NameManager {
|
||||
return lastSeenName.get(uuid);
|
||||
}
|
||||
|
||||
if (Bukkit.getOfflinePlayer(uuid).getName() != null) {
|
||||
String lastSeen = Bukkit.getOfflinePlayer(uuid).getName();
|
||||
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
|
||||
String lastSeen = player.getName();
|
||||
if (lastSeen != null) {
|
||||
lastSeenName.put(uuid, lastSeen);
|
||||
return lastSeen;
|
||||
}
|
||||
@ -46,25 +50,32 @@ public class NameManager {
|
||||
|
||||
try {
|
||||
account = accounts.queryBuilder().selectColumns("lastSeenName", "name").where().eq("uuid", uuid).queryForFirst();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} catch (SQLException ex) {
|
||||
Bukkit.getLogger().log(Level.WARNING, "[ChestShop] Failed to find last seen name for " + uuid + ":", ex);
|
||||
}
|
||||
|
||||
if (account == null) {
|
||||
return "";
|
||||
return null;
|
||||
}
|
||||
|
||||
if (account.getLastSeenName() != null) {
|
||||
lastSeenName.put(uuid, account.getLastSeenName());
|
||||
} else if (account.getName() != null) {
|
||||
lastSeenName.put(uuid, account.getName());
|
||||
lastSeen = account.getLastSeenName();
|
||||
if (lastSeen != null) {
|
||||
lastSeenName.put(uuid, lastSeen);
|
||||
return lastSeen;
|
||||
}
|
||||
|
||||
return account.getLastSeenName();
|
||||
lastSeen = account.getName();
|
||||
if (lastSeen != null) {
|
||||
lastSeenName.put(uuid, lastSeen);
|
||||
return lastSeen;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static UUID getUUID(String username) {
|
||||
Validate.notEmpty(username, "user cannot be null or empty!");
|
||||
|
||||
if (usernameToUUID.containsKey(username)) {
|
||||
return usernameToUUID.get(username);
|
||||
}
|
||||
@ -194,6 +205,7 @@ public class NameManager {
|
||||
account = new Account(player.getName(), player.getUniqueId());
|
||||
|
||||
if (!usernameToUUID.inverse().containsKey(uuid)) {
|
||||
usernameToUUID.remove(player.getName()); // https://github.com/dmulloy2/ChestShop-3/issues/11
|
||||
usernameToUUID.inverse().put(uuid, player.getName());
|
||||
}
|
||||
|
||||
@ -207,10 +219,17 @@ public class NameManager {
|
||||
}
|
||||
|
||||
public static void dropUsername(final Player player) {
|
||||
final UUID uuid = player.getUniqueId();
|
||||
if (player == null) return;
|
||||
|
||||
if (usernameToUUID.containsValue(uuid)) {
|
||||
usernameToUUID.inverse().remove(uuid);
|
||||
final UUID uuid = player.getUniqueId();
|
||||
if (uuid == null) return;
|
||||
|
||||
try {
|
||||
if (usernameToUUID.containsValue(uuid)) {
|
||||
usernameToUUID.inverse().remove(uuid);
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
// Sigh...
|
||||
}
|
||||
|
||||
String shortName = NameUtil.stripUsername(player.getName());
|
||||
@ -227,7 +246,7 @@ public class NameManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
return shortenedName.equals(name) || Permission.otherName(player, name) || player.getUniqueId().equals(getUUID(name));
|
||||
return shortenedName.equals(name) || Permission.otherName(player, name) || (!name.isEmpty() && player.getUniqueId().equals(getUUID(name)));
|
||||
}
|
||||
|
||||
public static boolean isAdminShop(UUID uuid) {
|
||||
|
@ -1,17 +1,8 @@
|
||||
name: ChestShop
|
||||
|
||||
main: com.Acrobot.ChestShop.ChestShop
|
||||
|
||||
version: ${project.version}
|
||||
|
||||
#for CButD
|
||||
dev-url: http://dev.bukkit.org/server-mods/chestshop/
|
||||
|
||||
|
||||
author: Acrobot
|
||||
description: >
|
||||
A chest shop for economy plugins.
|
||||
|
||||
author: [Acrobot, dmulloy2, L4BORG]
|
||||
description: A chest shop for economy plugins.
|
||||
depend: [Vault]
|
||||
softdepend: [LWC, Lockette, Deadbolt, OddItem, WorldGuard, Heroes, SimpleChestLock, Residence]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user