mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-26 06:05:25 +01:00
auction admin logs migration
This commit is contained in:
parent
594d037109
commit
5663d7f8eb
@ -0,0 +1,37 @@
|
|||||||
|
package ca.tweetzy.auctionhouse.api.events;
|
||||||
|
|
||||||
|
import ca.tweetzy.auctionhouse.auction.AuctionAdminLog;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current file has been created by Kiran Hart
|
||||||
|
* Date Created: January 17 2022
|
||||||
|
* Time Created: 1:38 p.m.
|
||||||
|
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public final class AuctionAdminEvent extends Event implements Cancellable {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
private final AuctionAdminLog auctionAdminLog;
|
||||||
|
|
||||||
|
public AuctionAdminEvent(AuctionAdminLog auctionAdminLog) {
|
||||||
|
this.auctionAdminLog = auctionAdminLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package ca.tweetzy.auctionhouse.auction;
|
||||||
|
|
||||||
|
import ca.tweetzy.auctionhouse.auction.enums.AdminAction;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current file has been created by Kiran Hart
|
||||||
|
* Date Created: January 17 2022
|
||||||
|
* Time Created: 1:35 p.m.
|
||||||
|
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public final class AuctionAdminLog {
|
||||||
|
|
||||||
|
private final int id;
|
||||||
|
private final UUID admin;
|
||||||
|
private final String adminName;
|
||||||
|
private final UUID target;
|
||||||
|
private final String targetName;
|
||||||
|
private final String itemName;
|
||||||
|
private final UUID itemId;
|
||||||
|
private final AdminAction adminAction;
|
||||||
|
private final long time;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package ca.tweetzy.auctionhouse.auction.enums;
|
||||||
|
|
||||||
|
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current file has been created by Kiran Hart
|
||||||
|
* Date Created: January 17 2022
|
||||||
|
* Time Created: 1:29 p.m.
|
||||||
|
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum AdminAction {
|
||||||
|
|
||||||
|
RETURN_ITEM(AuctionHouse.getInstance().getLocale().getMessage("admin action.return").getMessage()),
|
||||||
|
CLAIM_ITEM(AuctionHouse.getInstance().getLocale().getMessage("admin action.claim").getMessage()),
|
||||||
|
DELETE_ITEM(AuctionHouse.getInstance().getLocale().getMessage("admin action.delete").getMessage()),
|
||||||
|
COPY_ITEM(AuctionHouse.getInstance().getLocale().getMessage("admin action.copy").getMessage());
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final String translation;
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package ca.tweetzy.auctionhouse.database.migrations;
|
||||||
|
|
||||||
|
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||||
|
import ca.tweetzy.core.database.DataMigration;
|
||||||
|
import ca.tweetzy.core.database.MySQLConnector;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current file has been created by Kiran Hart
|
||||||
|
* Date Created: August 24 2021
|
||||||
|
* Time Created: 4:04 p.m.
|
||||||
|
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
|
||||||
|
*/
|
||||||
|
public final class _11_AdminLogMigration extends DataMigration {
|
||||||
|
|
||||||
|
public _11_AdminLogMigration() {
|
||||||
|
super(11);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void migrate(Connection connection, String tablePrefix) throws SQLException {
|
||||||
|
try (Statement statement = connection.createStatement()) {
|
||||||
|
String autoIncrement = AuctionHouse.getInstance().getDatabaseConnector() instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
|
||||||
|
|
||||||
|
|
||||||
|
statement.execute("CREATE TABLE " + tablePrefix + "admin_logs (" +
|
||||||
|
"id INTEGER PRIMARY KEY" + autoIncrement + ", " +
|
||||||
|
"admin VARCHAR(36) NOT NULL, " +
|
||||||
|
"admin_name VARCHAR(16) NOT NULL, " +
|
||||||
|
"target VARCHAR(36) NOT NULL, " +
|
||||||
|
"target_name VARCHAR(16) NOT NULL, " +
|
||||||
|
"item_name TEXT NOT NULL, " +
|
||||||
|
"item_id VARCHAR(36) NOT NULL, " +
|
||||||
|
"action VARCHAR(36) NOT NULL, " +
|
||||||
|
"time BigInt NOT NULL" +
|
||||||
|
|
||||||
|
" )");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user