mirror of
https://github.com/AppleDash/SaneEconomy.git
synced 2025-02-16 11:41:21 +01:00
Make work properly
This commit is contained in:
parent
c77d595497
commit
030911af20
@ -118,7 +118,7 @@
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>votuvo</id>
|
||||
<url>https://nexus.votuvo.com/repository/maven-snapshots/</url>
|
||||
<url>https://nexus.sw4t.net/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
@ -45,13 +45,15 @@ public class EconomyStorageBackendMySQL extends EconomyStorageBackendCaching {
|
||||
|
||||
if (schemaVersion == -1) {
|
||||
conn.prepareStatement(String.format("CREATE TABLE IF NOT EXISTS `%s` (`key` VARCHAR(32) PRIMARY KEY, `val` TEXT)", dbConn.getTable("saneeconomy_schema"))).executeUpdate();
|
||||
conn.prepareStatement(String.format("REPLACE INTO %s (`key`, `val`) VALUES ('schema_version', 2)", dbConn.getTable("saneeconomy_schema"))).executeUpdate();
|
||||
conn.prepareStatement(String.format("REPLACE INTO %s (`key`, `val`) VALUES ('schema_version', 3)", dbConn.getTable("saneeconomy_schema"))).executeUpdate();
|
||||
conn.prepareStatement(String.format("CREATE TABLE `%s` (unique_identifier VARCHAR(128) PRIMARY KEY, last_name VARCHAR(16), balance DECIMAL(18, 2))", dbConn.getTable("saneeconomy_balances"))).executeUpdate();
|
||||
schemaVersion = 3;
|
||||
}
|
||||
|
||||
if (schemaVersion == 2) {
|
||||
conn.prepareStatement("ALTER TABLE `%s` ADD `last_name` VARCHAR(16)").executeUpdate();
|
||||
conn.prepareStatement(String.format("ALTER TABLE `%s` ADD `last_name` VARCHAR(16)", dbConn.getTable("saneeconomy_balances"))).executeUpdate();
|
||||
conn.prepareStatement(String.format("REPLACE INTO %s (`key`, `val`) VALUES ('schema_version', 3)", dbConn.getTable("saneeconomy_schema"))).executeUpdate();
|
||||
|
||||
schemaVersion = 3;
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,8 @@ package org.appledash.saneeconomy.test.mock;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.advancement.Advancement;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarFlag;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.boss.*;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
@ -16,6 +14,7 @@ import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.help.HelpMap;
|
||||
import org.bukkit.inventory.*;
|
||||
import org.bukkit.loot.LootTable;
|
||||
import org.bukkit.map.MapView;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
@ -28,6 +27,7 @@ import org.bukkit.util.CachedServerIcon;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -94,16 +94,6 @@ public class MockServer implements Server {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWorldType() {
|
||||
return null;
|
||||
@ -240,12 +230,23 @@ public class MockServer implements Server {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapView getMap(short i) {
|
||||
public MapView getMap(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MapView createMap(World world) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapView createMap(World world) {
|
||||
public ItemStack createExplorerMap(World world, Location location, StructureType structureType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack createExplorerMap(World world, Location location, StructureType structureType, int radius, boolean findUnexplored) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -529,6 +530,26 @@ public class MockServer implements Server {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyedBossBar createBossBar(NamespacedKey key, String title, BarColor color, BarStyle style, BarFlag... flags) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<KeyedBossBar> getBossBars() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyedBossBar getBossBar(NamespacedKey key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeBossBar(NamespacedKey key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getEntity(UUID uuid) {
|
||||
return null;
|
||||
@ -544,6 +565,46 @@ public class MockServer implements Server {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData createBlockData(Material material) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData createBlockData(Material material, Consumer<BlockData> consumer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData createBlockData(String data) throws IllegalArgumentException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData createBlockData(Material material, String data) throws IllegalArgumentException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Keyed> Tag<T> getTag(String registry, NamespacedKey tag, Class<T> clazz) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Keyed> Iterable<Tag<T>> getTags(String registry, Class<T> clazz) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LootTable getLootTable(NamespacedKey key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> selectEntities(CommandSender sender, String selector) throws IllegalArgumentException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnsafeValues getUnsafe() {
|
||||
return null;
|
||||
|
@ -10,7 +10,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>SaneEconomySignShop</artifactId>
|
||||
<version>0.1.7-SNAPSHOT</version>
|
||||
<version>0.1.8-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -1,11 +1,11 @@
|
||||
package org.appledash.saneeconomysignshop.listeners;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.appledash.saneeconomysignshop.SaneEconomySignShop;
|
||||
import org.appledash.saneeconomysignshop.signshop.SignShop;
|
||||
import org.appledash.saneeconomysignshop.util.ItemDatabase;
|
||||
import org.appledash.saneeconomysignshop.util.ItemDatabase.InvalidItemException;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -41,11 +41,14 @@ public class ItemDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
public static Optional<Pair<Integer, Short>> getIDAndDamageForName(String name) {
|
||||
public static Optional<Pair<Material, Short>> getIDAndDamageForName(String name) {
|
||||
if (Material.getMaterial(name) != null) {
|
||||
return Optional.of(Pair.of(Material.getMaterial(name).getId(), (short) 0));
|
||||
return Optional.of(Pair.of(Material.getMaterial(name), (short) 0));
|
||||
}
|
||||
return Optional.ofNullable(itemMap.get(name.toLowerCase()));
|
||||
|
||||
return Optional.empty();
|
||||
// TODO
|
||||
//return Optional.ofNullable(itemMap.get(name.toLowerCase()));
|
||||
}
|
||||
|
||||
public static ItemStack parseGive(String rawItemName) throws InvalidItemException {
|
||||
@ -72,7 +75,7 @@ public class ItemDatabase {
|
||||
Optional<Material> materialOptional = parseMaterialFromName(itemName);
|
||||
|
||||
if (!materialOptional.isPresent()) {
|
||||
Optional<Pair<Integer, Short>> parsedItem = getIDAndDamageForName(normalizeItemName(itemName));
|
||||
Optional<Pair<Material, Short>> parsedItem = getIDAndDamageForName(normalizeItemName(itemName));
|
||||
if (!parsedItem.isPresent()) {
|
||||
throw new InvalidItemException("Item by that name does not exist.");
|
||||
}
|
||||
@ -89,11 +92,6 @@ public class ItemDatabase {
|
||||
}
|
||||
|
||||
private static Optional<Material> parseMaterialFromName(String materialName) {
|
||||
// Try to parse an integral item ID first, for legacy reasons.
|
||||
try {
|
||||
return Optional.ofNullable(Material.getMaterial(Integer.valueOf(materialName)));
|
||||
} catch (NumberFormatException ignored) { }
|
||||
|
||||
for (Material mat : Material.values()) {
|
||||
if (normalizeItemName(mat.name()).equals(normalizeItemName(materialName))) {
|
||||
return Optional.of(mat);
|
||||
|
Loading…
Reference in New Issue
Block a user