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

Fix MariaDB not working #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 19 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.4</version>
<version>2.0.3</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -37,9 +37,9 @@
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.20.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<srgIn>org.spigotmc:minecraft-server:1.20.6-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedDependencies>org.spigotmc:spigot:1.20.6-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
Expand All @@ -52,8 +52,8 @@
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.20.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
<srgIn>org.spigotmc:minecraft-server:1.20.6-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.20.6-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
Expand All @@ -64,15 +64,15 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
<source>21</source>
<target>21</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<version>3.6.0</version>

<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml
Expand Down Expand Up @@ -118,7 +118,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand All @@ -132,7 +132,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<version>1.20.6-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
Expand All @@ -154,7 +154,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<version>1.18.32</version>
</dependency>

<dependency>
Expand All @@ -177,7 +177,7 @@
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.4.1</version>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>co.aikar</groupId>
Expand Down Expand Up @@ -210,7 +210,7 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.3</version>
<version>2.11.6</version>
<scope>provided</scope>
</dependency>

Expand All @@ -220,6 +220,12 @@
<version>1.7.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.1.2</version>
</dependency>
</dependencies>

<repositories>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/me/makkuusen/timing/system/ApiUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.sk89q.worldedit.regions.Region;
import me.makkuusen.timing.system.api.TimingSystemAPI;
import me.makkuusen.timing.system.api.events.BoatSpawnEvent;
import me.makkuusen.timing.system.boat.v1_20_R1.BoatSpawner;
import me.makkuusen.timing.system.boat.v1_20_R4.BoatSpawner;
import me.makkuusen.timing.system.boatutils.BoatUtilsManager;
import me.makkuusen.timing.system.boatutils.BoatUtilsMode;
import me.makkuusen.timing.system.database.TSDatabase;
Expand Down Expand Up @@ -414,14 +414,14 @@ public static Boat spawnBoat(Location location, Boat.Type type, boolean isChestB
Boat boat;

if (isChestBoat) {
if (isServerVersion1_20_1()) { // TODO add option to turn off boat lag prevention
if (isServerVersion1_20_6()) { // TODO add option to turn off boat lag prevention
boat = BoatSpawner.spawnChestBoat(location);
} else {
boat = (Boat) location.getWorld().spawnEntity(location, EntityType.CHEST_BOAT);

}
} else {
if (isServerVersion1_20_1()) { // TODO add option to turn off boat lag prevention
if (isServerVersion1_20_6()) { // TODO add option to turn off boat lag prevention
boat = BoatSpawner.spawnBoat(location);
} else {
boat = (Boat) location.getWorld().spawnEntity(location, EntityType.BOAT);
Expand All @@ -436,8 +436,8 @@ public static Boat spawnBoat(Location location, Boat.Type type, boolean isChestB
return boat;
}

private static boolean isServerVersion1_20_1() {
return Bukkit.getVersion().contains("1.20.1");
private static boolean isServerVersion1_20_6() {
return Bukkit.getVersion().contains("1.20.6");
}

public static Optional<Region> getSelection(Player player) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/me/makkuusen/timing/system/Tasks.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void startParticleSpawner(TimingSystem plugin) {
track.getTrackLocations().getLocations(TrackLocation.Type.GRID).forEach(location -> setParticles(player, location.getLocation(), Particle.WAX_OFF));
track.getTrackLocations().getLocations(TrackLocation.Type.QUALYGRID).forEach(location -> setParticles(player, location.getLocation(), Particle.WAX_ON));
track.getTrackLocations().getLocations(TrackLocation.Type.FINISH_TP).forEach(location -> setParticles(player, location.getLocation(), Particle.HEART));
track.getTrackLocations().getLocations(TrackLocation.Type.FINISH_TP_ALL).forEach(location -> setParticles(player, location.getLocation(), Particle.VILLAGER_ANGRY));
track.getTrackLocations().getLocations(TrackLocation.Type.FINISH_TP_ALL).forEach(location -> setParticles(player, location.getLocation(), Particle.ANGRY_VILLAGER));
}
}, 0, 10);
}
Expand Down Expand Up @@ -215,13 +215,13 @@ private void setParticles(Player player, TrackRegion region) {
} else if (region.getRegionType().equals(TrackRegion.RegionType.RESET)) {
particle = Particle.WAX_ON;
} else if (region.getRegionType().equals(TrackRegion.RegionType.START)) {
particle = Particle.VILLAGER_HAPPY;
particle = Particle.HAPPY_VILLAGER;
} else if (region.getRegionType().equals(TrackRegion.RegionType.END)) {
particle = Particle.VILLAGER_ANGRY;
particle = Particle.ANGRY_VILLAGER;
} else if (region.getRegionType().equals(TrackRegion.RegionType.PIT)) {
particle = Particle.HEART;
} else if (region.getRegionType().equals(TrackRegion.RegionType.INPIT)) {
particle = Particle.SPELL_WITCH;
particle = Particle.WITCH;
} else {
particle = Particle.WAX_OFF;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package me.makkuusen.timing.system.boat.v1_20_R1;
package me.makkuusen.timing.system.boat.v1_20_R4;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_20_R1.CraftServer;
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftBoat;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftChestBoat;
import org.bukkit.craftbukkit.v1_20_R4.CraftServer;
import org.bukkit.craftbukkit.v1_20_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R4.entity.CraftBoat;
import org.bukkit.craftbukkit.v1_20_R4.entity.CraftChestBoat;
import org.bukkit.event.entity.CreatureSpawnEvent;

import net.minecraft.server.level.ServerLevel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.makkuusen.timing.system.boat.v1_20_R1;
package me.makkuusen.timing.system.boat.v1_20_R4;

import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.vehicle.Boat;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package me.makkuusen.timing.system.boat.v1_20_R1;
package me.makkuusen.timing.system.boat.v1_20_R4;

import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ public boolean initialize() {
String hostAndPort = config.getSqlHost() + ":" + config.getSqlPort();

PooledDatabaseOptions options = BukkitDB.getRecommendedOptions(TimingSystem.getPlugin(), config.getSqlUsername(), config.getSqlPassword(), config.getSqlDatabase(), hostAndPort);

//Fix invalid MariaDB Options
options.getOptions().setDsn("mariadb://" + hostAndPort + "/" + config.getSqlDatabase());
options.setDataSourceProperties(new HashMap<>() {{
put("useSSL", false);
}});
//End Fix

options.setMinIdleConnections(5);
options.setMaxConnections(5);
co.aikar.idb.Database db = new HikariPooledDatabase(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public boolean hasValidTags() {
public ItemStack getItem(TPlayer tPlayer){
var item = new ItemBuilder(Material.HOPPER).setName(Text.get(tPlayer, Gui.FILTER_BY)).build();
ItemMeta im = getItemMeta(tPlayer, item);
im.addEnchant(Enchantment.LUCK, 1, true);
im.addEnchant(Enchantment.LUCK_OF_THE_SEA, 1, true);
im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
im.addItemFlags(ItemFlag.HIDE_ARMOR_TRIM);
im.addItemFlags(ItemFlag.HIDE_DYE);
Expand Down