mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Update POM and potential fix for swap
This commit is contained in:
parent
28bf44cc92
commit
1a2b680359
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>2.7.1</version>
|
<version>2.7.2</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
@ -45,6 +45,10 @@
|
|||||||
<id>bukkit-repo</id>
|
<id>bukkit-repo</id>
|
||||||
<url>http://repo.bukkit.org/content/groups/public/</url>
|
<url>http://repo.bukkit.org/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>empcraft-repo</id>
|
||||||
|
<url>http://empcraft.com/maven2</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
@ -74,6 +78,11 @@
|
|||||||
<version>1.8-R0.1-SNAPSHOT</version>
|
<version>1.8-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>com.gmail.filoghost.holographicdisplays</groupId>
|
||||||
|
<artifactId>HolographicDisplays</artifactId>
|
||||||
|
<version>2.1.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<artifactId>Vault</artifactId>
|
<artifactId>Vault</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.2</version>
|
||||||
|
@ -21,18 +21,35 @@
|
|||||||
|
|
||||||
package com.intellectualcrafters.plot.database;
|
package com.intellectualcrafters.plot.database;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotMain;
|
import java.sql.Connection;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import java.sql.DatabaseMetaData;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import java.sql.PreparedStatement;
|
||||||
import com.intellectualcrafters.plot.object.*;
|
import java.sql.ResultSet;
|
||||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
import java.sql.SQLException;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import java.sql.Statement;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
import java.sql.*;
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
import java.util.*;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
|
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotClusterId;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotComment;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -741,54 +758,26 @@ public class SQLManager implements AbstractDB {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
/*
|
/*
|
||||||
update ticket
|
* We don't need to actually swap all the rows
|
||||||
set ticket_index = case when ticket_index = :x then :y else :x end
|
* - Just switch the plot_id_x and plot_id_z
|
||||||
where ticket_index in (:x, :y);
|
* - The other tables reference the `id` so it will cascade
|
||||||
|
|
||||||
FROM
|
|
||||||
http://stackoverflow.com/questions/6018374/swap-two-rows-using-sql-query
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
PreparedStatement stmt = SQLManager.this.connection.prepareStatement(
|
String world = p1.world;
|
||||||
"UPDATE `" + SQLManager.this.prefix + "plot_settings` SET `plot_plot_id` = CASE WHEN `plot_plot_id` = ? then ? else ? END WHERE `plot_plot_id` IN (?, ?)"
|
int id1 = getId(world, p1.id);
|
||||||
);
|
int id2 = getId(world, p2.id);
|
||||||
int id1 = getId(p1.getWorld().getName(), p1.id), id2 = getId(p2.getWorld().getName(), p2.id);
|
PlotId pos1 = p1.getId();
|
||||||
stmt.setInt(1, id1);
|
PlotId pos2 = p2.getId();
|
||||||
stmt.setInt(2, id2);
|
PreparedStatement stmt = SQLManager.this.connection.prepareStatement("UPDATE `" + SQLManager.this.prefix + "plot` SET `plot_id_x` = ?, `plot_id_z` = ? WHERE `id` = ?");
|
||||||
|
stmt.setInt(1, pos2.x);
|
||||||
|
stmt.setInt(2, pos2.y);
|
||||||
stmt.setInt(3, id1);
|
stmt.setInt(3, id1);
|
||||||
stmt.setInt(4, id1);
|
|
||||||
stmt.setInt(5, id2);
|
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
stmt = SQLManager.this.connection.prepareStatement(
|
stmt = SQLManager.this.connection.prepareStatement("UPDATE `" + SQLManager.this.prefix + "plot` SET `plot_id_x` = ?, `plot_id_z` = ? WHERE `id` = ?");
|
||||||
"UPDATE `" + SQLManager.this.prefix + "plot_helpers` SET `plot_plot_id` = CASE WHEN `plot_plot_id` = ? then ? else ? END WHERE `plot_plot_id` IN (?, ?)"
|
stmt.setInt(1, pos1.x);
|
||||||
);
|
stmt.setInt(2, pos1.y);
|
||||||
stmt.setInt(1, id1);
|
stmt.setInt(3, id2);
|
||||||
stmt.setInt(2, id2);
|
|
||||||
stmt.setInt(3, id1);
|
|
||||||
stmt.setInt(4, id1);
|
|
||||||
stmt.setInt(5, id2);
|
|
||||||
stmt.executeUpdate();
|
|
||||||
stmt.close();
|
|
||||||
stmt = SQLManager.this.connection.prepareStatement(
|
|
||||||
"UPDATE `" + SQLManager.this.prefix + "plot_denied` SET `plot_plot_id` = CASE WHEN `plot_plot_id` = ? then ? else ? END WHERE `plot_plot_id` IN (?, ?)"
|
|
||||||
);
|
|
||||||
stmt.setInt(1, id1);
|
|
||||||
stmt.setInt(2, id2);
|
|
||||||
stmt.setInt(3, id1);
|
|
||||||
stmt.setInt(4, id1);
|
|
||||||
stmt.setInt(5, id2);
|
|
||||||
stmt.executeUpdate();
|
|
||||||
stmt.close();
|
|
||||||
stmt = SQLManager.this.connection.prepareStatement(
|
|
||||||
"UPDATE `" + SQLManager.this.prefix + "plot_trusted` SET `plot_plot_id` = CASE WHEN `plot_plot_id` = ? then ? else ? END WHERE `plot_plot_id` IN (?, ?)"
|
|
||||||
);
|
|
||||||
stmt.setInt(1, id1);
|
|
||||||
stmt.setInt(2, id2);
|
|
||||||
stmt.setInt(3, id1);
|
|
||||||
stmt.setInt(4, id1);
|
|
||||||
stmt.setInt(5, id2);
|
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user