From e0c1fee55fc5d1cbec071328f173f94da454dfda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=BB=E9=AD=82=E5=9C=A3=E4=BD=BF?= Date: Wed, 25 Dec 2024 21:59:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=A4=8D=E4=BB=87=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../Listener/PlayerEventListener.java | 115 +++++-- .../coordinateRecorder/data/Database.java | 18 + .../coordinateRecorder/data/PlayerData.java | 36 +- .../data/TombstoneData.java | 30 +- .../java/ling/database/DefaultSchema.java | 7 + src/main/java/ling/database/Indexes.java | 2 + src/main/java/ling/database/Keys.java | 3 + src/main/java/ling/database/Tables.java | 6 + src/main/java/ling/database/tables/PvpTB.java | 279 ++++++++++++++++ .../ling/database/tables/pojos/PvpBO.java | 316 ++++++++++++++++++ .../ling/database/tables/records/PvpPO.java | 223 ++++++++++++ 12 files changed, 993 insertions(+), 44 deletions(-) create mode 100644 src/main/java/ling/database/tables/PvpTB.java create mode 100644 src/main/java/ling/database/tables/pojos/PvpBO.java create mode 100644 src/main/java/ling/database/tables/records/PvpPO.java diff --git a/pom.xml b/pom.xml index a43abc9..72de1a7 100644 --- a/pom.xml +++ b/pom.xml @@ -72,7 +72,7 @@ org.jooq.meta.sqlite.SQLiteDatabase - Version|LocationNotepad|PlayerSettings|Tombstone + Version|LocationNotepad|PlayerSettings|Tombstone|PVP diff --git a/src/main/java/ling/coordinateRecorder/Listener/PlayerEventListener.java b/src/main/java/ling/coordinateRecorder/Listener/PlayerEventListener.java index 634c210..ef0b91c 100644 --- a/src/main/java/ling/coordinateRecorder/Listener/PlayerEventListener.java +++ b/src/main/java/ling/coordinateRecorder/Listener/PlayerEventListener.java @@ -34,12 +34,16 @@ import org.bukkit.inventory.meta.MapMeta; import org.bukkit.map.*; import org.bukkit.persistence.PersistentDataContainer; import org.jetbrains.annotations.NotNull; +import org.jooq.Record; +import java.math.BigDecimal; import java.sql.SQLException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; +import static ling.database.tables.PvpTB.PVP; + /// 玩家事件监听器 public class PlayerEventListener implements Listener { @@ -154,11 +158,16 @@ public class PlayerEventListener implements Listener { player.sendMessage( "要解锁此墓碑,请使用" + ChatColor.GOLD + "/zb unlock" + ChatColor.WHITE + " 命令解除锁定"); player.sendMessage("墓碑内有" + ChatColor.YELLOW + count + ChatColor.WHITE + "个物品"); - player.sendMessage( - "解锁将给您带来" + - Config.getFractionTimeMessage( - getUnlockPunish(data, tombstoneData, Arrays.asList(chest.getBlockInventory().getContents()))) + - "点沙雕值惩罚!(当前" + ChatColor.YELLOW + data.getFraction() + ChatColor.WHITE + ")"); + if (tombstoneData.isRevenge() && player.getUniqueId().toString().equals(tombstoneData.getOwnerDefeater())) { + player.sendMessage("这个墓碑由你复仇而产生,可以免费解锁!"); + } else { + player.sendMessage( + "解锁将给您带来" + + Config.getFractionTimeMessage( + getUnlockPunish(data, tombstoneData, + Arrays.asList(chest.getBlockInventory().getContents()))) + + "点沙雕值惩罚!(当前" + ChatColor.RED + data.getFraction() + ChatColor.WHITE + ")"); + } event.setCancelled(true); } @@ -352,6 +361,70 @@ public class PlayerEventListener implements Listener { } } + /// 检查击杀行为是否属于复仇 + public static boolean isRevenge(PlayerData target, PlayerData from) throws SQLException { + var ctx = CoordinateRecorder.getDatabase().getDSL(); + Record record = ctx.select().from(PVP).where(PVP.PLAYER.eq(target.getPlayer().getUniqueId().toString()) + .and(PVP.TARGETPLAYER.eq( + from.getPlayer().getUniqueId().toString()) + .and(PVP.ISDELETE.eq(false)) + .and(PVP.ISREVENGE.eq(false)))) + .limit(1) + .fetchOne(); + return record != null; + } + + /// 一个玩家击杀了另一个玩家 + protected void onPlayerKillPlayer(PlayerData target, PlayerData from, Location location, + TombstoneData tombstone) throws SQLException { + assert location.getWorld() != null; + boolean isRevenge = isRevenge(target, from); + var ctx = CoordinateRecorder.getDatabase().getDSL(); + ctx.insertInto(PVP).columns( + PVP.PLAYER, + PVP.TARGETPLAYER, + PVP.WORLD, + PVP.X, + PVP.Y, + PVP.Z, + PVP.TIME, + PVP.ISREVENGE) + .values(from.getPlayer().getUniqueId().toString(), + target.getPlayer().getUniqueId().toString(), + location.getWorld().getName(), + location.getBlockX(), + location.getBlockY(), + location.getBlockZ(), + BigDecimal.valueOf(System.currentTimeMillis()), + isRevenge).execute(); + + if (!isRevenge) { + from.addFraction(10); + from.getPlayer().sendMessage( + "你杀死了 " + target.getPlayer().getName() + " 受到" + Config.getFractionTimeMessage( + 10) + "点沙雕值惩罚!(当前" + Config.getFractionTimeMessage( + from.getFraction()) + ")"); + target.getPlayer().sendMessage( + from.getPlayer().getName() + " 杀死了你,惩罚已经施加!"); + target.setHarm(null); + PlayerMap.getCurrent().broadcastScore(from); + } else { + from.getPlayer().sendMessage("你杀死了 " + target.getPlayer().getName() + " 报仇雪恨,可免费解锁该墓碑!"); + target.getPlayer().sendMessage(from.getPlayer().getName() + " 报仇雪恨,可免费解锁你的墓碑。"); + tombstone.setRevenge(true); + //将一条记录标记为已复仇 + ctx.update(PVP).set(PVP.ISREVENGE, true).where(PVP.PLAYER.eq(target.getPlayer().getUniqueId().toString()) + .and(PVP.TARGETPLAYER.eq( + from.getPlayer().getUniqueId().toString()) + .and(PVP.ISREVENGE.eq(false) + .and(PVP.ISDELETE.eq( + false))))) + .limit(1).execute(); + } + tombstone.setOwnerDefeater(from.getPlayer()); + //记录到数据库中 + } + /// 在玩家死亡时,保管掉落物并记录死亡位置 @EventHandler public void playerDeath(PlayerDeathEvent event) { @@ -382,21 +455,23 @@ public class PlayerEventListener implements Listener { TombstoneData tombstoneData = new TombstoneData(player, null); if (data.getHarm() != null && data.getHarm().getTime() + Config.KILL_PLAYER_TIME > System.currentTimeMillis()) { try { - data.getHarm().getPlayer().addFraction(10); - tombstoneData.setOwnerDefeater(data.getHarm().getPlayer().getPlayer()); - data.getHarm().getPlayer().getPlayer().sendMessage( - "你杀死了 " + player.getName() + " 受到" + Config.getFractionTimeMessage( - 10) + "点沙雕值惩罚!(当前" + Config.getFractionTimeMessage( - data.getHarm().getPlayer().getFraction()) + ")"); - data.getPlayer().sendMessage( - data.getHarm().getPlayer().getPlayer().getName() + " 杀死了你,惩罚已经施加!"); - data.setHarm(null); - PlayerMap.getCurrent().broadcastScore(data.getHarm().getPlayer()); + onPlayerKillPlayer(data, data.getHarm().getPlayer(), save, tombstoneData); } catch (SQLException e) { data.getPlayer().sendMessage(ChatColor.RED + data.getHarm().getPlayer().getPlayer().getName() + " 杀死了你,但施加沙雕值惩罚失败,请联系管理员。"); } } + //在墓碑上方生成悬浮文字 + Location textLocation = location.clone().add(0, 1.5, 0); + World world = textLocation.getWorld(); + assert world != null; + ArmorStand armorStand = (ArmorStand) world.spawnEntity(textLocation, EntityType.ARMOR_STAND); + armorStand.setVisible(false); + armorStand.setGravity(false); + armorStand.setCustomName(tombstoneData.getOwnerTitle()); + armorStand.setCustomNameVisible(true); + armorStand.setMarker(true); + tombstoneData.setArmorStandUuid(armorStand.getUniqueId().toString()); tombstoneData.save(persistent); chest.setCustomName(player.getName() + " 的墓碑"); chest.update(); @@ -434,16 +509,6 @@ public class PlayerEventListener implements Listener { event.getDrops().clear(); event.getDrops().addAll(valuable); - //在墓碑上方生成悬浮文字 - Location textLocation = location.clone().add(0, 1.5, 0); - World world = textLocation.getWorld(); - assert world != null; - ArmorStand armorStand = (ArmorStand) world.spawnEntity(textLocation, EntityType.ARMOR_STAND); - armorStand.setVisible(false); - armorStand.setGravity(false); - armorStand.setCustomName(tombstoneData.getOwnerTitle()); - armorStand.setCustomNameVisible(true); - armorStand.setMarker(true); if (count[0] != 0) player.sendMessage("你有" + count[0] + "个物品无法放入墓碑,已掉落在死亡地点。"); } diff --git a/src/main/java/ling/coordinateRecorder/data/Database.java b/src/main/java/ling/coordinateRecorder/data/Database.java index 49d32b2..39737e9 100644 --- a/src/main/java/ling/coordinateRecorder/data/Database.java +++ b/src/main/java/ling/coordinateRecorder/data/Database.java @@ -114,6 +114,24 @@ public class Database { .on("Tombstone", "UID", "world", "x", "y", "z", "time", "isDelete") .execute(); } + //PVP记录 + if (ctx.meta().getTables("PVP").isEmpty()) { + ctx.createTable("PVP") + .column("ID", SQLDataType.INTEGER.identity(true)) + .column("player", SQLDataType.VARCHAR(64).nullable(false)) + .column("targetPlayer", SQLDataType.VARCHAR(64).nullable(false)) + .column("x", SQLDataType.INTEGER.nullable(false)) + .column("y", SQLDataType.INTEGER.nullable(false)) + .column("z", SQLDataType.INTEGER.nullable(false)) + .column("world", SQLDataType.VARCHAR(32).nullable(false)) + .column("time", SQLDataType.BIGINTUNSIGNED.nullable(false)) + .column("isRevenge", SQLDataType.BOOLEAN.nullable(false).default_(false)) + .column("isDelete", SQLDataType.BOOLEAN.nullable(false).default_(false)) + .execute(); + ctx.createIndex(DSL.name("PVPIndex")) + .on("PVP", "player", "targetPlayer", "isDelete", "isRevenge", "time") + .execute(); + } } diff --git a/src/main/java/ling/coordinateRecorder/data/PlayerData.java b/src/main/java/ling/coordinateRecorder/data/PlayerData.java index cb5b63f..c581f78 100644 --- a/src/main/java/ling/coordinateRecorder/data/PlayerData.java +++ b/src/main/java/ling/coordinateRecorder/data/PlayerData.java @@ -133,23 +133,24 @@ public class PlayerData { player.sendMessage(ChatColor.RED + "不是你的墓碑,无法解锁!"); return; } - - //先给予沙雕值惩罚 - int value = PlayerEventListener.getUnlockPunish(this, data, + int value = 0; + if (!data.isRevenge()) { + //先给予沙雕值惩罚 + value = PlayerEventListener.getUnlockPunish(this, data, Arrays.asList(chest.getBlockInventory().getContents())); - value += Config.TOMBSTONE_PUNISHMENT; - if (getFraction() > Config.UNLOCK_PROHIBITED) { - player.sendMessage( - "您的沙雕值过高,禁止解锁墓碑!( >" + ChatColor.RED + Config.UNLOCK_PROHIBITED + ChatColor.WHITE + " )"); - return; - } - try { - addFraction(value); - PlayerMap.getCurrent().broadcastScore(this); - } catch (SQLException e) { - player.sendMessage(ChatColor.RED + "解锁墓碑失败:服务器内部错误"); - CoordinateRecorder.getCurrent().getLogger().severe("添加沙雕值出错:" + e.getMessage()); - return; + if (getFraction() > Config.UNLOCK_PROHIBITED) { + player.sendMessage( + "您的沙雕值过高,禁止解锁墓碑!( >" + ChatColor.RED + Config.UNLOCK_PROHIBITED + ChatColor.WHITE + " )"); + return; + } + try { + addFraction(value); + PlayerMap.getCurrent().broadcastScore(this); + } catch (SQLException e) { + player.sendMessage(ChatColor.RED + "解锁墓碑失败:服务器内部错误"); + CoordinateRecorder.getCurrent().getLogger().severe("添加沙雕值出错:" + e.getMessage()); + return; + } } Location location = tombstoneBlock.getLocation(); @@ -157,7 +158,8 @@ public class PlayerData { assert world != null; //先清理盔甲架 for (Entity entity : world.getNearbyEntities(location, 3, 3, 3)) { - if (entity.getType() == EntityType.ARMOR_STAND && data.getOwnerTitle().equals(entity.getCustomName())) { + if (entity.getType() == EntityType.ARMOR_STAND && data.getArmorStandUuid().equals( + entity.getUniqueId().toString())) { entity.remove(); } } diff --git a/src/main/java/ling/coordinateRecorder/data/TombstoneData.java b/src/main/java/ling/coordinateRecorder/data/TombstoneData.java index 5bd2bb4..1f8f9ca 100644 --- a/src/main/java/ling/coordinateRecorder/data/TombstoneData.java +++ b/src/main/java/ling/coordinateRecorder/data/TombstoneData.java @@ -22,11 +22,17 @@ public class TombstoneData implements PersistentData { private static final NamespacedKey OWNER_TITLE = new NamespacedKey(current, "tombstoneOwnerTitle"); /// 击败者uid private static final NamespacedKey OWNER_DEFEATER = new NamespacedKey(current, "tombstoneOwnerDefeater"); + /// 复仇 + private static final NamespacedKey OWNER_REVENGE = new NamespacedKey(current, "tombstoneOwnerRevenge"); + /// 盔甲架uuid + private static final NamespacedKey OWNER_ARMOR_STAND = new NamespacedKey(current, "tombstoneOwnerArmorStand"); protected String ownerName; protected String ownerUuid; protected String ownerTitle; protected String ownerDefeater; + protected boolean isRevenge; + protected String armorStandUuid = ""; public TombstoneData(@NotNull Player owner, @Nullable Player defeater) { ownerName = owner.getName(); @@ -48,6 +54,22 @@ public class TombstoneData implements PersistentData { } } + public boolean isRevenge() { + return isRevenge; + } + + public String getArmorStandUuid() { + return armorStandUuid; + } + + public void setRevenge(boolean revenge) { + isRevenge = revenge; + } + + public void setArmorStandUuid(String armorStandUuid) { + this.armorStandUuid = armorStandUuid; + } + public void setOwnerName(String ownerName) { this.ownerName = ownerName; } @@ -82,7 +104,7 @@ public class TombstoneData implements PersistentData { public static boolean isTombstone(PersistentDataContainer data) { return data.has(OWNER_NAME) && data.has(OWNER_UUID) && data.has(OWNER_TITLE) && data.has( - OWNER_DEFEATER); + OWNER_DEFEATER) && data.has(OWNER_ARMOR_STAND) && data.has(OWNER_REVENGE); } @Override @@ -91,6 +113,8 @@ public class TombstoneData implements PersistentData { data.set(OWNER_UUID, PersistentDataType.STRING, ownerUuid); data.set(OWNER_TITLE, PersistentDataType.STRING, ownerTitle); data.set(OWNER_DEFEATER, PersistentDataType.STRING, ownerDefeater); + data.set(OWNER_REVENGE, PersistentDataType.BOOLEAN, isRevenge); + data.set(OWNER_ARMOR_STAND, PersistentDataType.STRING, armorStandUuid); } @Override @@ -101,6 +125,8 @@ public class TombstoneData implements PersistentData { this.ownerUuid = data.get(OWNER_UUID, PersistentDataType.STRING); this.ownerTitle = data.get(OWNER_TITLE, PersistentDataType.STRING); this.ownerDefeater = data.get(OWNER_DEFEATER, PersistentDataType.STRING); + this.isRevenge = Boolean.TRUE.equals(data.get(OWNER_REVENGE, PersistentDataType.BOOLEAN)); + this.armorStandUuid = data.get(OWNER_ARMOR_STAND, PersistentDataType.STRING); } @Override @@ -109,5 +135,7 @@ public class TombstoneData implements PersistentData { data.remove(OWNER_UUID); data.remove(OWNER_TITLE); data.remove(OWNER_DEFEATER); + data.remove(OWNER_ARMOR_STAND); + data.remove(OWNER_REVENGE); } } diff --git a/src/main/java/ling/database/DefaultSchema.java b/src/main/java/ling/database/DefaultSchema.java index f1d6363..55b19ca 100644 --- a/src/main/java/ling/database/DefaultSchema.java +++ b/src/main/java/ling/database/DefaultSchema.java @@ -9,6 +9,7 @@ import java.util.List; import ling.database.tables.LocationnotepadTB; import ling.database.tables.PlayersettingsTB; +import ling.database.tables.PvpTB; import ling.database.tables.TombstoneTB; import ling.database.tables.VersionTB; @@ -40,6 +41,11 @@ public class DefaultSchema extends SchemaImpl { */ public final PlayersettingsTB PLAYERSETTINGS = PlayersettingsTB.PLAYERSETTINGS; + /** + * The table PVP. + */ + public final PvpTB PVP = PvpTB.PVP; + /** * The table Tombstone. */ @@ -68,6 +74,7 @@ public class DefaultSchema extends SchemaImpl { return Arrays.asList( LocationnotepadTB.LOCATIONNOTEPAD, PlayersettingsTB.PLAYERSETTINGS, + PvpTB.PVP, TombstoneTB.TOMBSTONE, VersionTB.VERSION ); diff --git a/src/main/java/ling/database/Indexes.java b/src/main/java/ling/database/Indexes.java index 0023bbb..b941322 100644 --- a/src/main/java/ling/database/Indexes.java +++ b/src/main/java/ling/database/Indexes.java @@ -5,6 +5,7 @@ package ling.database; import ling.database.tables.LocationnotepadTB; +import ling.database.tables.PvpTB; import ling.database.tables.TombstoneTB; import org.jooq.Index; @@ -24,5 +25,6 @@ public class Indexes { // ------------------------------------------------------------------------- public static final Index PLAYERINDEX = Internal.createIndex(DSL.name("PlayerIndex"), LocationnotepadTB.LOCATIONNOTEPAD, new OrderField[] { LocationnotepadTB.LOCATIONNOTEPAD.UID, LocationnotepadTB.LOCATIONNOTEPAD.ISFIXED, LocationnotepadTB.LOCATIONNOTEPAD.ISDELETE, LocationnotepadTB.LOCATIONNOTEPAD.NAME }, false); + public static final Index PVPINDEX = Internal.createIndex(DSL.name("PVPIndex"), PvpTB.PVP, new OrderField[] { PvpTB.PVP.PLAYER, PvpTB.PVP.TARGETPLAYER, PvpTB.PVP.ISDELETE, PvpTB.PVP.ISREVENGE, PvpTB.PVP.TIME }, false); public static final Index TOMBSTONEINDEX = Internal.createIndex(DSL.name("TombstoneIndex"), TombstoneTB.TOMBSTONE, new OrderField[] { TombstoneTB.TOMBSTONE.UID, TombstoneTB.TOMBSTONE.WORLD, TombstoneTB.TOMBSTONE.X, TombstoneTB.TOMBSTONE.Y, TombstoneTB.TOMBSTONE.Z, TombstoneTB.TOMBSTONE.TIME, TombstoneTB.TOMBSTONE.ISDELETE }, false); } diff --git a/src/main/java/ling/database/Keys.java b/src/main/java/ling/database/Keys.java index cee6882..f684d6a 100644 --- a/src/main/java/ling/database/Keys.java +++ b/src/main/java/ling/database/Keys.java @@ -6,10 +6,12 @@ package ling.database; import ling.database.tables.LocationnotepadTB; import ling.database.tables.PlayersettingsTB; +import ling.database.tables.PvpTB; import ling.database.tables.TombstoneTB; import ling.database.tables.VersionTB; import ling.database.tables.records.LocationnotepadPO; import ling.database.tables.records.PlayersettingsPO; +import ling.database.tables.records.PvpPO; import ling.database.tables.records.TombstonePO; import ling.database.tables.records.VersionPO; @@ -32,6 +34,7 @@ public class Keys { public static final UniqueKey LOCATIONNOTEPAD__PK_LOCATIONNOTEPAD = Internal.createUniqueKey(LocationnotepadTB.LOCATIONNOTEPAD, DSL.name("pk_LocationNotepad"), new TableField[] { LocationnotepadTB.LOCATIONNOTEPAD.ID }, true); public static final UniqueKey PLAYERSETTINGS__PK_PLAYERSETTINGS = Internal.createUniqueKey(PlayersettingsTB.PLAYERSETTINGS, DSL.name("pk_PlayerSettings"), new TableField[] { PlayersettingsTB.PLAYERSETTINGS.UID }, true); + public static final UniqueKey PVP__PK_PVP = Internal.createUniqueKey(PvpTB.PVP, DSL.name("pk_PVP"), new TableField[] { PvpTB.PVP.ID }, true); public static final UniqueKey TOMBSTONE__PK_TOMBSTONE = Internal.createUniqueKey(TombstoneTB.TOMBSTONE, DSL.name("pk_Tombstone"), new TableField[] { TombstoneTB.TOMBSTONE.ID }, true); public static final UniqueKey VERSION__PK_VERSION = Internal.createUniqueKey(VersionTB.VERSION, DSL.name("pk_Version"), new TableField[] { VersionTB.VERSION.ID }, true); } diff --git a/src/main/java/ling/database/Tables.java b/src/main/java/ling/database/Tables.java index 269b750..e25ef58 100644 --- a/src/main/java/ling/database/Tables.java +++ b/src/main/java/ling/database/Tables.java @@ -6,6 +6,7 @@ package ling.database; import ling.database.tables.LocationnotepadTB; import ling.database.tables.PlayersettingsTB; +import ling.database.tables.PvpTB; import ling.database.tables.TombstoneTB; import ling.database.tables.VersionTB; @@ -26,6 +27,11 @@ public class Tables { */ public static final PlayersettingsTB PLAYERSETTINGS = PlayersettingsTB.PLAYERSETTINGS; + /** + * The table PVP. + */ + public static final PvpTB PVP = PvpTB.PVP; + /** * The table Tombstone. */ diff --git a/src/main/java/ling/database/tables/PvpTB.java b/src/main/java/ling/database/tables/PvpTB.java new file mode 100644 index 0000000..48fc172 --- /dev/null +++ b/src/main/java/ling/database/tables/PvpTB.java @@ -0,0 +1,279 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database.tables; + + +import java.math.BigDecimal; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import ling.database.DefaultSchema; +import ling.database.Indexes; +import ling.database.Keys; +import ling.database.tables.records.PvpPO; + +import org.jooq.Condition; +import org.jooq.Field; +import org.jooq.Identity; +import org.jooq.Index; +import org.jooq.Name; +import org.jooq.PlainSQL; +import org.jooq.QueryPart; +import org.jooq.SQL; +import org.jooq.Schema; +import org.jooq.Select; +import org.jooq.Stringly; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.SQLDataType; +import org.jooq.impl.TableImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PvpTB extends TableImpl { + + private static final long serialVersionUID = 1L; + + /** + * The reference instance of PVP + */ + public static final PvpTB PVP = new PvpTB(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return PvpPO.class; + } + + /** + * The column PVP.ID. + */ + public final TableField ID = createField(DSL.name("ID"), SQLDataType.INTEGER.nullable(false).identity(true), this, ""); + + /** + * The column PVP.player. + */ + public final TableField PLAYER = createField(DSL.name("player"), SQLDataType.VARCHAR(64).nullable(false), this, ""); + + /** + * The column PVP.targetPlayer. + */ + public final TableField TARGETPLAYER = createField(DSL.name("targetPlayer"), SQLDataType.VARCHAR(64).nullable(false), this, ""); + + /** + * The column PVP.x. + */ + public final TableField X = createField(DSL.name("x"), SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column PVP.y. + */ + public final TableField Y = createField(DSL.name("y"), SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column PVP.z. + */ + public final TableField Z = createField(DSL.name("z"), SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column PVP.world. + */ + public final TableField WORLD = createField(DSL.name("world"), SQLDataType.VARCHAR(32).nullable(false), this, ""); + + /** + * The column PVP.time. + */ + public final TableField TIME = createField(DSL.name("time"), SQLDataType.NUMERIC.nullable(false), this, ""); + + /** + * The column PVP.isRevenge. + */ + public final TableField ISREVENGE = createField(DSL.name("isRevenge"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BOOLEAN)), this, ""); + + /** + * The column PVP.isDelete. + */ + public final TableField ISDELETE = createField(DSL.name("isDelete"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BOOLEAN)), this, ""); + + private PvpTB(Name alias, Table aliased) { + this(alias, aliased, (Field[]) null, null); + } + + private PvpTB(Name alias, Table aliased, Field[] parameters, Condition where) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where); + } + + /** + * Create an aliased PVP table reference + */ + public PvpTB(String alias) { + this(DSL.name(alias), PVP); + } + + /** + * Create an aliased PVP table reference + */ + public PvpTB(Name alias) { + this(alias, PVP); + } + + /** + * Create a PVP table reference + */ + public PvpTB() { + this(DSL.name("PVP"), null); + } + + @Override + public Schema getSchema() { + return aliased() ? null : DefaultSchema.DEFAULT_SCHEMA; + } + + @Override + public List getIndexes() { + return Arrays.asList(Indexes.PVPINDEX); + } + + @Override + public Identity getIdentity() { + return (Identity) super.getIdentity(); + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.PVP__PK_PVP; + } + + @Override + public PvpTB as(String alias) { + return new PvpTB(DSL.name(alias), this); + } + + @Override + public PvpTB as(Name alias) { + return new PvpTB(alias, this); + } + + @Override + public PvpTB as(Table alias) { + return new PvpTB(alias.getQualifiedName(), this); + } + + /** + * Rename this table + */ + @Override + public PvpTB rename(String name) { + return new PvpTB(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public PvpTB rename(Name name) { + return new PvpTB(name, null); + } + + /** + * Rename this table + */ + @Override + public PvpTB rename(Table name) { + return new PvpTB(name.getQualifiedName(), null); + } + + /** + * Create an inline derived table from this table + */ + @Override + public PvpTB where(Condition condition) { + return new PvpTB(getQualifiedName(), aliased() ? this : null, null, condition); + } + + /** + * Create an inline derived table from this table + */ + @Override + public PvpTB where(Collection conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public PvpTB where(Condition... conditions) { + return where(DSL.and(conditions)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public PvpTB where(Field condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public PvpTB where(SQL condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public PvpTB where(@Stringly.SQL String condition) { + return where(DSL.condition(condition)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public PvpTB where(@Stringly.SQL String condition, Object... binds) { + return where(DSL.condition(condition, binds)); + } + + /** + * Create an inline derived table from this table + */ + @Override + @PlainSQL + public PvpTB where(@Stringly.SQL String condition, QueryPart... parts) { + return where(DSL.condition(condition, parts)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public PvpTB whereExists(Select select) { + return where(DSL.exists(select)); + } + + /** + * Create an inline derived table from this table + */ + @Override + public PvpTB whereNotExists(Select select) { + return where(DSL.notExists(select)); + } +} diff --git a/src/main/java/ling/database/tables/pojos/PvpBO.java b/src/main/java/ling/database/tables/pojos/PvpBO.java new file mode 100644 index 0000000..443a7de --- /dev/null +++ b/src/main/java/ling/database/tables/pojos/PvpBO.java @@ -0,0 +1,316 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database.tables.pojos; + + +import java.io.Serializable; +import java.math.BigDecimal; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PvpBO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + private String player; + private String targetplayer; + private Integer x; + private Integer y; + private Integer z; + private String world; + private BigDecimal time; + private Boolean isrevenge; + private Boolean isdelete; + + public PvpBO() {} + + public PvpBO(PvpBO value) { + this.id = value.id; + this.player = value.player; + this.targetplayer = value.targetplayer; + this.x = value.x; + this.y = value.y; + this.z = value.z; + this.world = value.world; + this.time = value.time; + this.isrevenge = value.isrevenge; + this.isdelete = value.isdelete; + } + + public PvpBO( + Integer id, + String player, + String targetplayer, + Integer x, + Integer y, + Integer z, + String world, + BigDecimal time, + Boolean isrevenge, + Boolean isdelete + ) { + this.id = id; + this.player = player; + this.targetplayer = targetplayer; + this.x = x; + this.y = y; + this.z = z; + this.world = world; + this.time = time; + this.isrevenge = isrevenge; + this.isdelete = isdelete; + } + + /** + * Getter for PVP.ID. + */ + public Integer getId() { + return this.id; + } + + /** + * Setter for PVP.ID. + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * Getter for PVP.player. + */ + public String getPlayer() { + return this.player; + } + + /** + * Setter for PVP.player. + */ + public void setPlayer(String player) { + this.player = player; + } + + /** + * Getter for PVP.targetPlayer. + */ + public String getTargetplayer() { + return this.targetplayer; + } + + /** + * Setter for PVP.targetPlayer. + */ + public void setTargetplayer(String targetplayer) { + this.targetplayer = targetplayer; + } + + /** + * Getter for PVP.x. + */ + public Integer getX() { + return this.x; + } + + /** + * Setter for PVP.x. + */ + public void setX(Integer x) { + this.x = x; + } + + /** + * Getter for PVP.y. + */ + public Integer getY() { + return this.y; + } + + /** + * Setter for PVP.y. + */ + public void setY(Integer y) { + this.y = y; + } + + /** + * Getter for PVP.z. + */ + public Integer getZ() { + return this.z; + } + + /** + * Setter for PVP.z. + */ + public void setZ(Integer z) { + this.z = z; + } + + /** + * Getter for PVP.world. + */ + public String getWorld() { + return this.world; + } + + /** + * Setter for PVP.world. + */ + public void setWorld(String world) { + this.world = world; + } + + /** + * Getter for PVP.time. + */ + public BigDecimal getTime() { + return this.time; + } + + /** + * Setter for PVP.time. + */ + public void setTime(BigDecimal time) { + this.time = time; + } + + /** + * Getter for PVP.isRevenge. + */ + public Boolean getIsrevenge() { + return this.isrevenge; + } + + /** + * Setter for PVP.isRevenge. + */ + public void setIsrevenge(Boolean isrevenge) { + this.isrevenge = isrevenge; + } + + /** + * Getter for PVP.isDelete. + */ + public Boolean getIsdelete() { + return this.isdelete; + } + + /** + * Setter for PVP.isDelete. + */ + public void setIsdelete(Boolean isdelete) { + this.isdelete = isdelete; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final PvpBO other = (PvpBO) obj; + if (this.id == null) { + if (other.id != null) + return false; + } + else if (!this.id.equals(other.id)) + return false; + if (this.player == null) { + if (other.player != null) + return false; + } + else if (!this.player.equals(other.player)) + return false; + if (this.targetplayer == null) { + if (other.targetplayer != null) + return false; + } + else if (!this.targetplayer.equals(other.targetplayer)) + return false; + if (this.x == null) { + if (other.x != null) + return false; + } + else if (!this.x.equals(other.x)) + return false; + if (this.y == null) { + if (other.y != null) + return false; + } + else if (!this.y.equals(other.y)) + return false; + if (this.z == null) { + if (other.z != null) + return false; + } + else if (!this.z.equals(other.z)) + return false; + if (this.world == null) { + if (other.world != null) + return false; + } + else if (!this.world.equals(other.world)) + return false; + if (this.time == null) { + if (other.time != null) + return false; + } + else if (!this.time.equals(other.time)) + return false; + if (this.isrevenge == null) { + if (other.isrevenge != null) + return false; + } + else if (!this.isrevenge.equals(other.isrevenge)) + return false; + if (this.isdelete == null) { + if (other.isdelete != null) + return false; + } + else if (!this.isdelete.equals(other.isdelete)) + return false; + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.id == null) ? 0 : this.id.hashCode()); + result = prime * result + ((this.player == null) ? 0 : this.player.hashCode()); + result = prime * result + ((this.targetplayer == null) ? 0 : this.targetplayer.hashCode()); + result = prime * result + ((this.x == null) ? 0 : this.x.hashCode()); + result = prime * result + ((this.y == null) ? 0 : this.y.hashCode()); + result = prime * result + ((this.z == null) ? 0 : this.z.hashCode()); + result = prime * result + ((this.world == null) ? 0 : this.world.hashCode()); + result = prime * result + ((this.time == null) ? 0 : this.time.hashCode()); + result = prime * result + ((this.isrevenge == null) ? 0 : this.isrevenge.hashCode()); + result = prime * result + ((this.isdelete == null) ? 0 : this.isdelete.hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("PvpBO ("); + + sb.append(id); + sb.append(", ").append(player); + sb.append(", ").append(targetplayer); + sb.append(", ").append(x); + sb.append(", ").append(y); + sb.append(", ").append(z); + sb.append(", ").append(world); + sb.append(", ").append(time); + sb.append(", ").append(isrevenge); + sb.append(", ").append(isdelete); + + sb.append(")"); + return sb.toString(); + } +} diff --git a/src/main/java/ling/database/tables/records/PvpPO.java b/src/main/java/ling/database/tables/records/PvpPO.java new file mode 100644 index 0000000..8b12d00 --- /dev/null +++ b/src/main/java/ling/database/tables/records/PvpPO.java @@ -0,0 +1,223 @@ +/* + * This file is generated by jOOQ. + */ +package ling.database.tables.records; + + +import java.math.BigDecimal; + +import ling.database.tables.PvpTB; +import ling.database.tables.pojos.PvpBO; + +import org.jooq.Record1; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" }) +public class PvpPO extends UpdatableRecordImpl { + + private static final long serialVersionUID = 1L; + + /** + * Setter for PVP.ID. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for PVP.ID. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for PVP.player. + */ + public void setPlayer(String value) { + set(1, value); + } + + /** + * Getter for PVP.player. + */ + public String getPlayer() { + return (String) get(1); + } + + /** + * Setter for PVP.targetPlayer. + */ + public void setTargetplayer(String value) { + set(2, value); + } + + /** + * Getter for PVP.targetPlayer. + */ + public String getTargetplayer() { + return (String) get(2); + } + + /** + * Setter for PVP.x. + */ + public void setX(Integer value) { + set(3, value); + } + + /** + * Getter for PVP.x. + */ + public Integer getX() { + return (Integer) get(3); + } + + /** + * Setter for PVP.y. + */ + public void setY(Integer value) { + set(4, value); + } + + /** + * Getter for PVP.y. + */ + public Integer getY() { + return (Integer) get(4); + } + + /** + * Setter for PVP.z. + */ + public void setZ(Integer value) { + set(5, value); + } + + /** + * Getter for PVP.z. + */ + public Integer getZ() { + return (Integer) get(5); + } + + /** + * Setter for PVP.world. + */ + public void setWorld(String value) { + set(6, value); + } + + /** + * Getter for PVP.world. + */ + public String getWorld() { + return (String) get(6); + } + + /** + * Setter for PVP.time. + */ + public void setTime(BigDecimal value) { + set(7, value); + } + + /** + * Getter for PVP.time. + */ + public BigDecimal getTime() { + return (BigDecimal) get(7); + } + + /** + * Setter for PVP.isRevenge. + */ + public void setIsrevenge(Boolean value) { + set(8, value); + } + + /** + * Getter for PVP.isRevenge. + */ + public Boolean getIsrevenge() { + return (Boolean) get(8); + } + + /** + * Setter for PVP.isDelete. + */ + public void setIsdelete(Boolean value) { + set(9, value); + } + + /** + * Getter for PVP.isDelete. + */ + public Boolean getIsdelete() { + return (Boolean) get(9); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached PvpPO + */ + public PvpPO() { + super(PvpTB.PVP); + } + + /** + * Create a detached, initialised PvpPO + */ + public PvpPO(Integer id, String player, String targetplayer, Integer x, Integer y, Integer z, String world, BigDecimal time, Boolean isrevenge, Boolean isdelete) { + super(PvpTB.PVP); + + setId(id); + setPlayer(player); + setTargetplayer(targetplayer); + setX(x); + setY(y); + setZ(z); + setWorld(world); + setTime(time); + setIsrevenge(isrevenge); + setIsdelete(isdelete); + resetChangedOnNotNull(); + } + + /** + * Create a detached, initialised PvpPO + */ + public PvpPO(PvpBO value) { + super(PvpTB.PVP); + + if (value != null) { + setId(value.getId()); + setPlayer(value.getPlayer()); + setTargetplayer(value.getTargetplayer()); + setX(value.getX()); + setY(value.getY()); + setZ(value.getZ()); + setWorld(value.getWorld()); + setTime(value.getTime()); + setIsrevenge(value.getIsrevenge()); + setIsdelete(value.getIsdelete()); + resetChangedOnNotNull(); + } + } +}