实现复仇功能

This commit is contained in:
2024-12-25 21:59:44 +08:00
parent 00439aa000
commit e0c1fee55f
12 changed files with 993 additions and 44 deletions

View File

@@ -72,7 +72,7 @@
<name>org.jooq.meta.sqlite.SQLiteDatabase</name>
<inputSchema/>
<!-- 所有的表都包含进来,用于自动生成代码 -->
<includes>Version|LocationNotepad|PlayerSettings|Tombstone</includes>
<includes>Version|LocationNotepad|PlayerSettings|Tombstone|PVP</includes>
<excludes></excludes>
</database>

View File

@@ -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 + "个物品");
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.YELLOW + data.getFraction() + ChatColor.WHITE + "");
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] + "个物品无法放入墓碑,已掉落在死亡地点。");
}

View File

@@ -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();
}
}

View File

@@ -133,11 +133,11 @@ public class PlayerData {
player.sendMessage(ChatColor.RED + "不是你的墓碑,无法解锁!");
return;
}
int value = 0;
if (!data.isRevenge()) {
//先给予沙雕值惩罚
int value = PlayerEventListener.getUnlockPunish(this, data,
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 + " )");
@@ -151,13 +151,15 @@ public class PlayerData {
CoordinateRecorder.getCurrent().getLogger().severe("添加沙雕值出错:" + e.getMessage());
return;
}
}
Location location = tombstoneBlock.getLocation();
World world = location.getWorld();
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();
}
}

View File

@@ -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);
}
}

View File

@@ -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 <code>PVP</code>.
*/
public final PvpTB PVP = PvpTB.PVP;
/**
* The table <code>Tombstone</code>.
*/
@@ -68,6 +74,7 @@ public class DefaultSchema extends SchemaImpl {
return Arrays.asList(
LocationnotepadTB.LOCATIONNOTEPAD,
PlayersettingsTB.PLAYERSETTINGS,
PvpTB.PVP,
TombstoneTB.TOMBSTONE,
VersionTB.VERSION
);

View File

@@ -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);
}

View File

@@ -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<LocationnotepadPO> LOCATIONNOTEPAD__PK_LOCATIONNOTEPAD = Internal.createUniqueKey(LocationnotepadTB.LOCATIONNOTEPAD, DSL.name("pk_LocationNotepad"), new TableField[] { LocationnotepadTB.LOCATIONNOTEPAD.ID }, true);
public static final UniqueKey<PlayersettingsPO> PLAYERSETTINGS__PK_PLAYERSETTINGS = Internal.createUniqueKey(PlayersettingsTB.PLAYERSETTINGS, DSL.name("pk_PlayerSettings"), new TableField[] { PlayersettingsTB.PLAYERSETTINGS.UID }, true);
public static final UniqueKey<PvpPO> PVP__PK_PVP = Internal.createUniqueKey(PvpTB.PVP, DSL.name("pk_PVP"), new TableField[] { PvpTB.PVP.ID }, true);
public static final UniqueKey<TombstonePO> TOMBSTONE__PK_TOMBSTONE = Internal.createUniqueKey(TombstoneTB.TOMBSTONE, DSL.name("pk_Tombstone"), new TableField[] { TombstoneTB.TOMBSTONE.ID }, true);
public static final UniqueKey<VersionPO> VERSION__PK_VERSION = Internal.createUniqueKey(VersionTB.VERSION, DSL.name("pk_Version"), new TableField[] { VersionTB.VERSION.ID }, true);
}

View File

@@ -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 <code>PVP</code>.
*/
public static final PvpTB PVP = PvpTB.PVP;
/**
* The table <code>Tombstone</code>.
*/

View File

@@ -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<PvpPO> {
private static final long serialVersionUID = 1L;
/**
* The reference instance of <code>PVP</code>
*/
public static final PvpTB PVP = new PvpTB();
/**
* The class holding records for this type
*/
@Override
public Class<PvpPO> getRecordType() {
return PvpPO.class;
}
/**
* The column <code>PVP.ID</code>.
*/
public final TableField<PvpPO, Integer> ID = createField(DSL.name("ID"), SQLDataType.INTEGER.nullable(false).identity(true), this, "");
/**
* The column <code>PVP.player</code>.
*/
public final TableField<PvpPO, String> PLAYER = createField(DSL.name("player"), SQLDataType.VARCHAR(64).nullable(false), this, "");
/**
* The column <code>PVP.targetPlayer</code>.
*/
public final TableField<PvpPO, String> TARGETPLAYER = createField(DSL.name("targetPlayer"), SQLDataType.VARCHAR(64).nullable(false), this, "");
/**
* The column <code>PVP.x</code>.
*/
public final TableField<PvpPO, Integer> X = createField(DSL.name("x"), SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>PVP.y</code>.
*/
public final TableField<PvpPO, Integer> Y = createField(DSL.name("y"), SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>PVP.z</code>.
*/
public final TableField<PvpPO, Integer> Z = createField(DSL.name("z"), SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>PVP.world</code>.
*/
public final TableField<PvpPO, String> WORLD = createField(DSL.name("world"), SQLDataType.VARCHAR(32).nullable(false), this, "");
/**
* The column <code>PVP.time</code>.
*/
public final TableField<PvpPO, BigDecimal> TIME = createField(DSL.name("time"), SQLDataType.NUMERIC.nullable(false), this, "");
/**
* The column <code>PVP.isRevenge</code>.
*/
public final TableField<PvpPO, Boolean> ISREVENGE = createField(DSL.name("isRevenge"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BOOLEAN)), this, "");
/**
* The column <code>PVP.isDelete</code>.
*/
public final TableField<PvpPO, Boolean> ISDELETE = createField(DSL.name("isDelete"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BOOLEAN)), this, "");
private PvpTB(Name alias, Table<PvpPO> aliased) {
this(alias, aliased, (Field<?>[]) null, null);
}
private PvpTB(Name alias, Table<PvpPO> aliased, Field<?>[] parameters, Condition where) {
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where);
}
/**
* Create an aliased <code>PVP</code> table reference
*/
public PvpTB(String alias) {
this(DSL.name(alias), PVP);
}
/**
* Create an aliased <code>PVP</code> table reference
*/
public PvpTB(Name alias) {
this(alias, PVP);
}
/**
* Create a <code>PVP</code> table reference
*/
public PvpTB() {
this(DSL.name("PVP"), null);
}
@Override
public Schema getSchema() {
return aliased() ? null : DefaultSchema.DEFAULT_SCHEMA;
}
@Override
public List<Index> getIndexes() {
return Arrays.asList(Indexes.PVPINDEX);
}
@Override
public Identity<PvpPO, Integer> getIdentity() {
return (Identity<PvpPO, Integer>) super.getIdentity();
}
@Override
public UniqueKey<PvpPO> 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<? extends Condition> 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<Boolean> 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));
}
}

View File

@@ -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 <code>PVP.ID</code>.
*/
public Integer getId() {
return this.id;
}
/**
* Setter for <code>PVP.ID</code>.
*/
public void setId(Integer id) {
this.id = id;
}
/**
* Getter for <code>PVP.player</code>.
*/
public String getPlayer() {
return this.player;
}
/**
* Setter for <code>PVP.player</code>.
*/
public void setPlayer(String player) {
this.player = player;
}
/**
* Getter for <code>PVP.targetPlayer</code>.
*/
public String getTargetplayer() {
return this.targetplayer;
}
/**
* Setter for <code>PVP.targetPlayer</code>.
*/
public void setTargetplayer(String targetplayer) {
this.targetplayer = targetplayer;
}
/**
* Getter for <code>PVP.x</code>.
*/
public Integer getX() {
return this.x;
}
/**
* Setter for <code>PVP.x</code>.
*/
public void setX(Integer x) {
this.x = x;
}
/**
* Getter for <code>PVP.y</code>.
*/
public Integer getY() {
return this.y;
}
/**
* Setter for <code>PVP.y</code>.
*/
public void setY(Integer y) {
this.y = y;
}
/**
* Getter for <code>PVP.z</code>.
*/
public Integer getZ() {
return this.z;
}
/**
* Setter for <code>PVP.z</code>.
*/
public void setZ(Integer z) {
this.z = z;
}
/**
* Getter for <code>PVP.world</code>.
*/
public String getWorld() {
return this.world;
}
/**
* Setter for <code>PVP.world</code>.
*/
public void setWorld(String world) {
this.world = world;
}
/**
* Getter for <code>PVP.time</code>.
*/
public BigDecimal getTime() {
return this.time;
}
/**
* Setter for <code>PVP.time</code>.
*/
public void setTime(BigDecimal time) {
this.time = time;
}
/**
* Getter for <code>PVP.isRevenge</code>.
*/
public Boolean getIsrevenge() {
return this.isrevenge;
}
/**
* Setter for <code>PVP.isRevenge</code>.
*/
public void setIsrevenge(Boolean isrevenge) {
this.isrevenge = isrevenge;
}
/**
* Getter for <code>PVP.isDelete</code>.
*/
public Boolean getIsdelete() {
return this.isdelete;
}
/**
* Setter for <code>PVP.isDelete</code>.
*/
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();
}
}

View File

@@ -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<PvpPO> {
private static final long serialVersionUID = 1L;
/**
* Setter for <code>PVP.ID</code>.
*/
public void setId(Integer value) {
set(0, value);
}
/**
* Getter for <code>PVP.ID</code>.
*/
public Integer getId() {
return (Integer) get(0);
}
/**
* Setter for <code>PVP.player</code>.
*/
public void setPlayer(String value) {
set(1, value);
}
/**
* Getter for <code>PVP.player</code>.
*/
public String getPlayer() {
return (String) get(1);
}
/**
* Setter for <code>PVP.targetPlayer</code>.
*/
public void setTargetplayer(String value) {
set(2, value);
}
/**
* Getter for <code>PVP.targetPlayer</code>.
*/
public String getTargetplayer() {
return (String) get(2);
}
/**
* Setter for <code>PVP.x</code>.
*/
public void setX(Integer value) {
set(3, value);
}
/**
* Getter for <code>PVP.x</code>.
*/
public Integer getX() {
return (Integer) get(3);
}
/**
* Setter for <code>PVP.y</code>.
*/
public void setY(Integer value) {
set(4, value);
}
/**
* Getter for <code>PVP.y</code>.
*/
public Integer getY() {
return (Integer) get(4);
}
/**
* Setter for <code>PVP.z</code>.
*/
public void setZ(Integer value) {
set(5, value);
}
/**
* Getter for <code>PVP.z</code>.
*/
public Integer getZ() {
return (Integer) get(5);
}
/**
* Setter for <code>PVP.world</code>.
*/
public void setWorld(String value) {
set(6, value);
}
/**
* Getter for <code>PVP.world</code>.
*/
public String getWorld() {
return (String) get(6);
}
/**
* Setter for <code>PVP.time</code>.
*/
public void setTime(BigDecimal value) {
set(7, value);
}
/**
* Getter for <code>PVP.time</code>.
*/
public BigDecimal getTime() {
return (BigDecimal) get(7);
}
/**
* Setter for <code>PVP.isRevenge</code>.
*/
public void setIsrevenge(Boolean value) {
set(8, value);
}
/**
* Getter for <code>PVP.isRevenge</code>.
*/
public Boolean getIsrevenge() {
return (Boolean) get(8);
}
/**
* Setter for <code>PVP.isDelete</code>.
*/
public void setIsdelete(Boolean value) {
set(9, value);
}
/**
* Getter for <code>PVP.isDelete</code>.
*/
public Boolean getIsdelete() {
return (Boolean) get(9);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
@Override
public Record1<Integer> 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();
}
}
}