mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +01:00
DB changes
This commit is contained in:
parent
ad22db3290
commit
cd170915d8
@ -77,21 +77,16 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
OfflinePlayer player = null;
|
|
||||||
if (plot.trusted.contains(uuid)) {
|
if (plot.trusted.contains(uuid)) {
|
||||||
plot.trusted.remove(uuid);
|
plot.trusted.remove(uuid);
|
||||||
player = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
||||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, player);
|
|
||||||
}
|
}
|
||||||
if (plot.helpers.contains(uuid)) {
|
if (plot.helpers.contains(uuid)) {
|
||||||
plot.helpers.remove(uuid);
|
plot.helpers.remove(uuid);
|
||||||
if (player == null) {
|
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
||||||
player = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
|
||||||
}
|
|
||||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, player);
|
|
||||||
}
|
}
|
||||||
plot.addDenied(uuid);
|
plot.addDenied(uuid);
|
||||||
DBFunc.setDenied(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
|
DBFunc.setDenied(plr.getWorld().getName(), plot, uuid);
|
||||||
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
|
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
} else {
|
} else {
|
||||||
@ -116,13 +111,13 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.removeDenied(uuid);
|
plot.removeDenied(uuid);
|
||||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
|
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
||||||
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
plot.removeDenied(uuid);
|
plot.removeDenied(uuid);
|
||||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
|
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
||||||
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
|
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
PlayerFunctions.sendMessage(plr, C.DENIED_REMOVED);
|
||||||
|
@ -76,21 +76,16 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
OfflinePlayer player = null;
|
|
||||||
if (plot.trusted.contains(uuid)) {
|
if (plot.trusted.contains(uuid)) {
|
||||||
plot.trusted.remove(uuid);
|
plot.trusted.remove(uuid);
|
||||||
player = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
||||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, player);
|
|
||||||
}
|
}
|
||||||
if (plot.denied.contains(uuid)) {
|
if (plot.denied.contains(uuid)) {
|
||||||
plot.denied.remove(uuid);
|
plot.denied.remove(uuid);
|
||||||
if (player == null) {
|
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
||||||
player = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
|
||||||
}
|
|
||||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, player);
|
|
||||||
}
|
}
|
||||||
plot.addHelper(uuid);
|
plot.addHelper(uuid);
|
||||||
DBFunc.setHelper(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
|
DBFunc.setHelper(plr.getWorld().getName(), plot, uuid);
|
||||||
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
|
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
} else {
|
} else {
|
||||||
@ -107,13 +102,13 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.removeHelper(uuid);
|
plot.removeHelper(uuid);
|
||||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
|
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
||||||
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
plot.removeHelper(uuid);
|
plot.removeHelper(uuid);
|
||||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
|
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
||||||
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
|
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
PlayerFunctions.sendMessage(plr, C.HELPER_REMOVED);
|
||||||
|
@ -77,21 +77,16 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
PlayerFunctions.sendMessage(plr, C.ALREADY_OWNER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
OfflinePlayer player = null;
|
|
||||||
if (plot.helpers.contains(uuid)) {
|
if (plot.helpers.contains(uuid)) {
|
||||||
plot.helpers.remove(uuid);
|
plot.helpers.remove(uuid);
|
||||||
player = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
||||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, player);
|
|
||||||
}
|
}
|
||||||
if (plot.denied.contains(uuid)) {
|
if (plot.denied.contains(uuid)) {
|
||||||
plot.denied.remove(uuid);
|
plot.denied.remove(uuid);
|
||||||
if (player == null) {
|
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
||||||
player = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
|
||||||
}
|
|
||||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, player);
|
|
||||||
}
|
}
|
||||||
plot.addTrusted(uuid);
|
plot.addTrusted(uuid);
|
||||||
DBFunc.setTrusted(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
|
DBFunc.setTrusted(plr.getWorld().getName(), plot, uuid);
|
||||||
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
|
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
} else {
|
} else {
|
||||||
@ -108,13 +103,13 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plot.removeTrusted(uuid);
|
plot.removeTrusted(uuid);
|
||||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
|
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
||||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||||
plot.removeTrusted(uuid);
|
plot.removeTrusted(uuid);
|
||||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, UUIDHandler.uuidWrapper.getOfflinePlayer(uuid));
|
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
||||||
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
|
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
PlayerFunctions.sendMessage(plr, C.TRUSTED_REMOVED);
|
||||||
|
@ -174,39 +174,39 @@ public interface AbstractDB {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param player Player that should be removed
|
* @param uuid Player that should be removed
|
||||||
*/
|
*/
|
||||||
public void removeHelper(final String world, final Plot plot, final OfflinePlayer player);
|
public void removeHelper(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param player Player that should be removed
|
* @param uuid Player that should be removed
|
||||||
*/
|
*/
|
||||||
public void removeTrusted(final String world, final Plot plot, final OfflinePlayer player);
|
public void removeTrusted(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param player Player that should be removed
|
* @param uuid Player that should be removed
|
||||||
*/
|
*/
|
||||||
public void setHelper(final String world, final Plot plot, final OfflinePlayer player);
|
public void setHelper(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param plot Plot Object
|
||||||
|
* @param uuid Player that should be added
|
||||||
|
*/
|
||||||
|
public void setTrusted(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param player Player that should be added
|
* @param player Player that should be added
|
||||||
*/
|
*/
|
||||||
public void setTrusted(final String world, final Plot plot, final OfflinePlayer player);
|
public void removeDenied(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @param player Player that should be added
|
* @param player Player that should be added
|
||||||
*/
|
*/
|
||||||
public void removeDenied(final String world, final Plot plot, final OfflinePlayer player);
|
public void setDenied(final String world, final Plot plot, final UUID uuid);
|
||||||
|
|
||||||
/**
|
|
||||||
* @param plot Plot Object
|
|
||||||
* @param player Player that should be added
|
|
||||||
*/
|
|
||||||
public void setDenied(final String world, final Plot plot, final OfflinePlayer player);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Plots ratings
|
* Get Plots ratings
|
||||||
|
@ -222,48 +222,48 @@ public class DBFunc {
|
|||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public static void removeHelper(final String world, final Plot plot, final OfflinePlayer player) {
|
public static void removeHelper(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.removeHelper(world, plot, player);
|
dbManager.removeHelper(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public static void removeTrusted(final String world, final Plot plot, final OfflinePlayer player) {
|
public static void removeTrusted(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.removeTrusted(world, plot, player);
|
dbManager.removeTrusted(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public static void setHelper(final String world, final Plot plot, final OfflinePlayer player) {
|
public static void setHelper(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.setHelper(world, plot, player);
|
dbManager.setHelper(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public static void setTrusted(final String world, final Plot plot, final OfflinePlayer player) {
|
public static void setTrusted(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.setTrusted(world, plot, player);
|
dbManager.setTrusted(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public static void removeDenied(final String world, final Plot plot, final OfflinePlayer player) {
|
public static void removeDenied(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.removeDenied(world, plot, player);
|
dbManager.removeDenied(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plot
|
* @param plot
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public static void setDenied(final String world, final Plot plot, final OfflinePlayer player) {
|
public static void setDenied(final String world, final Plot plot, final UUID uuid) {
|
||||||
dbManager.setDenied(world, plot, player);
|
dbManager.setDenied(world, plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getRatings(final Plot plot) {
|
public static double getRatings(final Plot plot) {
|
||||||
|
@ -1060,14 +1060,14 @@ public class SQLManager implements AbstractDB {
|
|||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeHelper(final String world, final Plot plot, final OfflinePlayer player) {
|
public void removeHelper(final String world, final Plot plot, final UUID uuid) {
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("DELETE FROM `" + SQLManager.this.prefix + "plot_helpers` WHERE `plot_plot_id` = ? AND `user_uuid` = ?");
|
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("DELETE FROM `" + SQLManager.this.prefix + "plot_helpers` WHERE `plot_plot_id` = ? AND `user_uuid` = ?");
|
||||||
statement.setInt(1, getId(world, plot.id));
|
statement.setInt(1, getId(world, plot.id));
|
||||||
statement.setString(2, UUIDHandler.getUUID(player).toString());
|
statement.setString(2, uuid.toString());
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
statement.close();
|
statement.close();
|
||||||
} catch (final SQLException e) {
|
} catch (final SQLException e) {
|
||||||
@ -1083,14 +1083,14 @@ public class SQLManager implements AbstractDB {
|
|||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeTrusted(final String world, final Plot plot, final OfflinePlayer player) {
|
public void removeTrusted(final String world, final Plot plot, final UUID uuid) {
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("DELETE FROM `" + SQLManager.this.prefix + "plot_trusted` WHERE `plot_plot_id` = ? AND `user_uuid` = ?");
|
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("DELETE FROM `" + SQLManager.this.prefix + "plot_trusted` WHERE `plot_plot_id` = ? AND `user_uuid` = ?");
|
||||||
statement.setInt(1, getId(world, plot.id));
|
statement.setInt(1, getId(world, plot.id));
|
||||||
statement.setString(2, UUIDHandler.getUUID(player).toString());
|
statement.setString(2, uuid.toString());
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
statement.close();
|
statement.close();
|
||||||
} catch (final SQLException e) {
|
} catch (final SQLException e) {
|
||||||
@ -1106,14 +1106,14 @@ public class SQLManager implements AbstractDB {
|
|||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setHelper(final String world, final Plot plot, final OfflinePlayer player) {
|
public void setHelper(final String world, final Plot plot, final UUID uuid) {
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("INSERT INTO `" + SQLManager.this.prefix + "plot_helpers` (`plot_plot_id`, `user_uuid`) VALUES(?,?)");
|
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("INSERT INTO `" + SQLManager.this.prefix + "plot_helpers` (`plot_plot_id`, `user_uuid`) VALUES(?,?)");
|
||||||
statement.setInt(1, getId(world, plot.id));
|
statement.setInt(1, getId(world, plot.id));
|
||||||
statement.setString(2, UUIDHandler.getUUID(player).toString());
|
statement.setString(2, uuid.toString());
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
statement.close();
|
statement.close();
|
||||||
} catch (final SQLException e) {
|
} catch (final SQLException e) {
|
||||||
@ -1147,14 +1147,14 @@ public class SQLManager implements AbstractDB {
|
|||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setTrusted(final String world, final Plot plot, final OfflinePlayer player) {
|
public void setTrusted(final String world, final Plot plot, final UUID uuid) {
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("INSERT INTO `" + SQLManager.this.prefix + "plot_trusted` (`plot_plot_id`, `user_uuid`) VALUES(?,?)");
|
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("INSERT INTO `" + SQLManager.this.prefix + "plot_trusted` (`plot_plot_id`, `user_uuid`) VALUES(?,?)");
|
||||||
statement.setInt(1, getId(world, plot.id));
|
statement.setInt(1, getId(world, plot.id));
|
||||||
statement.setString(2, UUIDHandler.getUUID(player).toString());
|
statement.setString(2, uuid.toString());
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
statement.close();
|
statement.close();
|
||||||
} catch (final SQLException e) {
|
} catch (final SQLException e) {
|
||||||
@ -1170,14 +1170,14 @@ public class SQLManager implements AbstractDB {
|
|||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeDenied(final String world, final Plot plot, final OfflinePlayer player) {
|
public void removeDenied(final String world, final Plot plot, final UUID uuid) {
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("DELETE FROM `" + SQLManager.this.prefix + "plot_denied` WHERE `plot_plot_id` = ? AND `user_uuid` = ?");
|
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("DELETE FROM `" + SQLManager.this.prefix + "plot_denied` WHERE `plot_plot_id` = ? AND `user_uuid` = ?");
|
||||||
statement.setInt(1, getId(world, plot.id));
|
statement.setInt(1, getId(world, plot.id));
|
||||||
statement.setString(2, UUIDHandler.getUUID(player).toString());
|
statement.setString(2, uuid.toString());
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
statement.close();
|
statement.close();
|
||||||
} catch (final SQLException e) {
|
} catch (final SQLException e) {
|
||||||
@ -1193,14 +1193,14 @@ public class SQLManager implements AbstractDB {
|
|||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setDenied(final String world, final Plot plot, final OfflinePlayer player) {
|
public void setDenied(final String world, final Plot plot, final UUID uuid) {
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("INSERT INTO `" + SQLManager.this.prefix + "plot_denied` (`plot_plot_id`, `user_uuid`) VALUES(?,?)");
|
final PreparedStatement statement = SQLManager.this.connection.prepareStatement("INSERT INTO `" + SQLManager.this.prefix + "plot_denied` (`plot_plot_id`, `user_uuid`) VALUES(?,?)");
|
||||||
statement.setInt(1, getId(world, plot.id));
|
statement.setInt(1, getId(world, plot.id));
|
||||||
statement.setString(2, UUIDHandler.getUUID(player).toString());
|
statement.setString(2, uuid.toString());
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
statement.close();
|
statement.close();
|
||||||
} catch (final SQLException e) {
|
} catch (final SQLException e) {
|
||||||
|
@ -146,7 +146,7 @@ public class ExpireManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
OfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
OfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
||||||
if (!op.hasPlayedBefore()) {
|
if (op==null || !op.hasPlayedBefore()) {
|
||||||
toRemove.add(plot);
|
toRemove.add(plot);
|
||||||
PlotMain.removePlot(plot.world, plot.id, true);
|
PlotMain.removePlot(plot.world, plot.id, true);
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user