Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sqlite #140

Open
wants to merge 31 commits into
base: 2.6.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2ad700c
Refactor DataStorage to make room for SQLite (and other future) data …
SparklingComet Jul 4, 2022
8f66118
Merge branch 'sqlite' of https://github.com/Tradeshop/TradeShop into …
SparklingComet Jul 4, 2022
557210d
Write SQL for SQLitePlayerConfiguration
SparklingComet Jul 4, 2022
bb50ff7
Implement SQLiteLinkageConfiguration
SparklingComet Jul 5, 2022
2cedc32
trivial optimization/refactoring of JsonShopConfiguration
SparklingComet Jul 5, 2022
cf6f6b3
Bug Fixes
KillerOfPie Jul 4, 2022
52b00d8
Bug Fixes & POM Updates
KillerOfPie Jul 4, 2022
1707c65
Bug Fixes & POM Updates
KillerOfPie Jul 4, 2022
acd5356
Additional Debug
KillerOfPie Jul 4, 2022
842f279
Bug Fix & Command Improvement
KillerOfPie Jul 4, 2022
30a51ba
Bug Fix
KillerOfPie Jul 5, 2022
4beb147
Storage Improvement
KillerOfPie Jul 5, 2022
eb5ebf4
Fixes
KillerOfPie Jul 5, 2022
0ae5ab9
Implement SQLiteShopConfiguration
SparklingComet Jul 5, 2022
58b5d9a
Fix SQL logic in SQLitePlayerConfiguration
SparklingComet Jul 5, 2022
9312565
Fixes
KillerOfPie Jul 5, 2022
e3265e3
Add missing !
SparklingComet Jul 5, 2022
1c16382
Merge branch 'sqlite' of https://github.com/Tradeshop/TradeShop into …
SparklingComet Jul 5, 2022
aa12e93
Add options to Connection#prepareStatement()
SparklingComet Jul 6, 2022
6e19bb2
fix path
SparklingComet Jul 6, 2022
4da59e2
SQL Connection stability fixes and dealing with ResultSet type
SparklingComet Jul 6, 2022
7d051bc
Minor Changes
KillerOfPie Jul 7, 2022
d78467b
Removal of un-needed legacy data fixes
KillerOfPie Jul 7, 2022
95cddd4
Fix trivial mistake with column name
SparklingComet Jul 8, 2022
2ec677a
Merge branch 'sqlite' of https://github.com/Tradeshop/TradeShop into …
SparklingComet Jul 8, 2022
3cb6dba
Fixes for Shop/ShopItemStack errors during creation
KillerOfPie Jul 8, 2022
3fa0cc2
Merge branch 'sqlite' of https://github.com/Tradeshop/TradeShop into …
SparklingComet Jul 8, 2022
fd78cd7
Add missing save() calls to LinkageConfiguration, fix SQL query
SparklingComet Jul 11, 2022
7c29d32
Factor in try-with-resources for SQLite classes in order to increase …
SparklingComet Jul 11, 2022
0166855
Add PreparedStatement#close() calls everywhere
SparklingComet Aug 11, 2022
16ea97b
Rollback connectionPool change
SparklingComet Aug 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 54 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,45 +73,68 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>yyyy-MM-dd'T'HH.mm.ss</maven.build.timestamp.format>
<timestamp>${maven.build.timestamp}</timestamp>
<builddate/> <!-- default value for non-DEV build -->
<pluginDir>org/shanerx/tradeshop</pluginDir>
<resourceDir>src/main/resources</resourceDir>

<!-- Profile variables -->
<expirationFile/> <!-- default value for non-DEV build -->
<doClean/> <!-- default value for clean build -->
<skipDocs/> <!-- default value for clean build -->

<!-- Changeable variables -->
<outputDir>target/output-files
</outputDir> <!-- Set to relative directory output of PreShade and JavaDoc files -->

</properties>

<profiles>
<profile>
<id>expiration</id> <!-- additional profile for DEV build -->
<properties>
<builddate>builddate.yml</builddate>
<expirationFile>builddate.yml</expirationFile>
</properties>
</profile>
<profile>
<id>clean</id> <!-- additional profile for a Clean build -->
<properties>
<doClean>clean</doClean>
</properties>
</profile>
<profile>
<id>skipDocs</id> <!-- additional profile for a Clean build -->
<properties>
<skipDocs>true</skipDocs>
</properties>
</profile>
</profiles>

<build>
<defaultGoal>install</defaultGoal>
<finalName>${project.artifactId}-${project.version}-${maven.build.timestamp}</finalName>
<defaultGoal>${doClean} install</defaultGoal>
<finalName>${project.name}-${project.version}-${maven.build.timestamp}</finalName>

<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources/</directory>
<directory>${basedir}/${resourceDir}</directory>
<includes>
<include>plugin.yml</include>
<include>${builddate}</include>
<include>${expirationFile}</include>
</includes>
</resource>
<resource>
<targetPath>./Lang</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources/Lang</directory>
<directory>${basedir}/${resourceDir}/Lang</directory>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand All @@ -120,25 +143,34 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<version>3.3.0</version>
<configuration>
<outputDirectory>${outputDir}/PreShade</outputDirectory>
<createDependencyReducedPom>false</createDependencyReducedPom>
<artifactSet>
<includes>
<include>org.bstats:*</include>
<pattern>de.themoep:*</pattern>
<include>de.themoep:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>org.shanerx.tradeshop</shadedPattern>
<shadedPattern>${project.groupId}.${project.artifactId}.bstats</shadedPattern>
</relocation>
<relocation>
<pattern>de.themoep</pattern>
<shadedPattern>io.github.apfelcreme.Pipes.libs</shadedPattern>
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/maven/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
Expand All @@ -152,17 +184,18 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<version>3.4.0</version>
<configuration>
<failOnError>false</failOnError>
<jarOutputDirectory>${outputDir}/JavaDocs</jarOutputDirectory>
<!--suppress UnresolvedMavenProperty -->
<skip>${skip_docs}</skip>
<skip>${skipDocs}</skip>
<sourceFileExcludes>
<exclude>org/shanerx/tradeshop/TradeShop.java</exclude>
<exclude>org/shanerx/tradeshop/commands/**</exclude>
<exclude>org/shanerx/tradeshop/listeners/**</exclude>
<exclude>org/shanerx/tradeshop/utils/Updater.java</exclude>
<exclude>org/shanerx/tradeshop/utils/BukkitVersion.java</exclude>
<exclude>${pluginDir}/TradeShop.java</exclude>
<exclude>${pluginDir}/commands/**</exclude>
<exclude>${pluginDir}/shop/listeners/**</exclude>
<exclude>${pluginDir}/utils/versionmanagement/**</exclude>
<exclude>${pluginDir}/player/JoinEventListener.java</exclude>
</sourceFileExcludes>
</configuration>
<executions>
Expand Down Expand Up @@ -212,15 +245,14 @@
<dependency>
<groupId>de.themoep</groupId>
<artifactId>inventorygui</artifactId>
<!--The following version may not be the latest. Check it before using.-->
<version>1.4.2-SNAPSHOT</version>
<version>1.5-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<version>3.4.0</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.bukkit.entity.Player;
import org.shanerx.tradeshop.TradeShop;
import org.shanerx.tradeshop.data.config.Setting;
import org.shanerx.tradeshop.player.ShopRole;
import org.shanerx.tradeshop.shop.Shop;
import org.shanerx.tradeshop.shop.ShopType;
import org.shanerx.tradeshop.utils.Utils;
Expand Down Expand Up @@ -99,7 +100,7 @@ public List<String> fillShopPlayer() {
}
Shop shop = Shop.loadShop(s);

return shop.getUserNames();
return shop.getUserNames(ShopRole.MANAGER, ShopRole.MEMBER);
}

return Collections.EMPTY_LIST;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/shanerx/tradeshop/commands/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public enum Commands {
ADD_COST(Lists.newArrayList("addCost"), Permissions.NONE, 1, 3, true, "Add cost to shop", "/tradeshop $cmd$ [Amount] [Material]"),
SET_PRODUCT(Lists.newArrayList("setProduct"), Permissions.NONE, 1, 3, true, "Set product of shop ", "/tradeshop $cmd$ [Amount] [Material]"),
SET_COST(Lists.newArrayList("setCost"), Permissions.NONE, 1, 3, true, "Set cost of shop", "/tradeshop $cmd$ [Amount] [Material]"),
REMOVE_PRODUCT(Lists.newArrayList("removeProduct", "delProduct"), Permissions.NONE, 2, 2, true, "Removes a product from the shop", "/tradeshop $cmd$ <List #>"),
REMOVE_COST(Lists.newArrayList("removeCost", "delCost"), Permissions.NONE, 2, 2, true, "Removes a product from the shop", "/tradeshop $cmd$ <List #>"),
REMOVE_PRODUCT(Lists.newArrayList("removeProduct", "delProduct"), Permissions.NONE, 1, 2, true, "Removes a product from the shop", "/tradeshop $cmd$ <List #>"),
REMOVE_COST(Lists.newArrayList("removeCost", "delCost"), Permissions.NONE, 1, 2, true, "Removes a product from the shop", "/tradeshop $cmd$ <List #>"),
LIST_PRODUCT(Lists.newArrayList("listProduct"), Permissions.NONE, 1, 1, true, "Lists the products in the shop", "/tradeshop $cmd$"),
LIST_COST(Lists.newArrayList("listCost"), Permissions.NONE, 1, 1, true, "Lists the costs in a shop", "/tradeshop $cmd$"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void reload() {
return;
}

command.sendMessage(Setting.MESSAGE_PREFIX.getString() + "&6The configuration files have been reloaded!");
command.sendMessage(Setting.MESSAGE_PREFIX.getString().trim() + "&6The configuration files have been reloaded!");
Bukkit.getPluginManager().callEvent(new TradeShopReloadEvent(plugin, command.getSender()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ public void removeSide() {
if (shop == null)
return;

int index = 0;
int index;

if (isInt(command.getArgAt(1))) {
index = Integer.parseInt(command.getArgAt(1)) - 1;
} else if (shop.getSideList(side).size() == 1) {
index = 0;
} else {
Message.INVALID_ARGUMENTS.sendMessage(pSender);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public String toString() {
}

public String getPrefixed() {
return PLUGIN.getMessageManager().colour(Setting.MESSAGE_PREFIX.getString() + " " + this);
return PLUGIN.getMessageManager().colour(Setting.MESSAGE_PREFIX.getString().trim() + " " + this);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public enum Setting {
UNLIMITED_ADMIN(SettingSection.SYSTEM_OPTIONS, "unlimited-admin", false),

// Language Options
MESSAGE_PREFIX(SettingSection.LANGUAGE_OPTIONS, "message-prefix", "&a[&eTradeShop&a] "),
MESSAGE_PREFIX(SettingSection.LANGUAGE_OPTIONS, "message-prefix", "&a[&eTradeShop&a]"),

SHOP_GOOD_COLOUR(SettingSection.LANGUAGE_OPTIONS, "shop-good-colour", "&2"),
SHOP_INCOMPLETE_COLOUR(SettingSection.LANGUAGE_OPTIONS, "shop-incomplete-colour", "&7"),
Expand Down
Loading