[#1027] Patch broken 'plan_aac_hack_table's

This commit is contained in:
Rsl1122 2019-05-05 17:02:27 +03:00
parent eb78468f01
commit 2a2e0e57a9
3 changed files with 42 additions and 0 deletions

View File

@ -64,6 +64,7 @@ public class AdvancedAntiCheatHook extends Hook {
execute(HackerTable.createTableSQL(database.getType()));
}
});
database.executeTransaction(new HackerTableMissingDateColumnPatch());
plugin.registerListener(new PlayerHackKickListener(database));
hookHandler.addPluginDataSource(new AdvancedAntiCheatData(database, formatters.yearLong()));

View File

@ -51,6 +51,7 @@ public class HackerTable {
return CreateTableParser.create(TABLE_NAME, dbType)
.column(COL_ID, Sql.INT).primaryKey()
.column(COL_UUID, Sql.varchar(36)).notNull()
.column(COL_DATE, Sql.LONG).notNull()
.column(COL_HACK_TYPE, Sql.varchar(100)).notNull()
.column(COL_VIOLATION_LEVEL, Sql.INT).notNull()
.build();

View File

@ -0,0 +1,40 @@
/*
* This file is part of Player Analytics (Plan).
*
* Plan is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License v3 as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Plan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
*/
package com.djrapitops.pluginbridge.plan.aac;
import com.djrapitops.plan.db.patches.Patch;
/**
* Patch to fix a bug
* https://github.com/plan-player-analytics/Plan/issues/1027
* introduced in commit 530c4a2
* https://github.com/plan-player-analytics/Plan/commit/530c4a2ea6fd56fd9a7aa3382f7571f31971dc1a#commitcomment-33415938
*
* @author Rsl1122
*/
public class HackerTableMissingDateColumnPatch extends Patch {
@Override
public boolean hasBeenApplied() {
return hasColumn(HackerTable.TABLE_NAME, HackerTable.COL_DATE);
}
@Override
protected void applyPatch() {
addColumn(HackerTable.TABLE_NAME, HackerTable.COL_DATE + " bigint NOT NULL DEFAULT 0");
}
}