引入墓碑机制

This commit is contained in:
2024-12-20 10:43:12 +08:00
parent 78f4fcffc7
commit 76421fe12d
13 changed files with 1081 additions and 44 deletions

View File

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

View File

@@ -28,7 +28,7 @@ import static ling.database.tables.LocationnotepadTB.LOCATIONNOTEPAD;
public class ZbCommand implements CommandExecutor, TabCompleter {
protected final static List<String> TAB_1 = Arrays.asList("add", "remove", "help", "reload", "list", "fixed",
"unfixed");
"unfixed", "unlock");
public ZbCommand() {
@@ -115,6 +115,20 @@ public class ZbCommand implements CommandExecutor, TabCompleter {
player.sendMessage("当前第" + page + "页,共" + pageCount + "");
}
@SuppressWarnings("DuplicatedCode")
protected void unlock(Player player, String[] strings) {
if (strings.length > 1) {
player.sendMessage(ChatColor.RED + "命令过长");
return;
}
PlayerData data = PlayerMap.getCurrent().getPlayerData(player);
if (data == null) {
player.sendMessage(ChatColor.RED + "玩家未登录");
return;
}
data.unlockTombstoneBlock();
}
protected void remove(Player player, String[] strings) {
if (strings.length > 2) {
player.sendMessage(ChatColor.RED + "命令过长");
@@ -280,6 +294,9 @@ public class ZbCommand implements CommandExecutor, TabCompleter {
case "unfixed":
unfixed(player, strings);
break;
case "unlock":
unlock(player, strings);
break;
}
} catch (SQLException e) {
player.sendMessage(ChatColor.RED + "服务器内部错误,请联系管理员");

View File

@@ -6,6 +6,7 @@ import ling.coordinateRecorder.Listener.PlayerEventListener;
import ling.coordinateRecorder.Listener.PlayerLoginEventListener;
import ling.coordinateRecorder.data.Database;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
@@ -16,6 +17,10 @@ public final class CoordinateRecorder extends JavaPlugin {
private static CoordinateRecorder current;
private static Database database;
private static Plugin authMePlugin;
private static NamespacedKey tombstoneOwner;
private static NamespacedKey tombstoneOwnerName;
//墓碑配套盔甲架的名称
private static NamespacedKey tombstoneOwnerTitle;
private static void start() throws SQLException {
database.installPlugin();
@@ -36,6 +41,9 @@ public final class CoordinateRecorder extends JavaPlugin {
public void onEnable() {
// Plugin startup logic
current = this;
tombstoneOwner = new NamespacedKey(this, "tombstoneOwner");
tombstoneOwnerName = new NamespacedKey(this, "tombstoneOwnerName");
tombstoneOwnerTitle = new NamespacedKey(this, "tombstoneOwnerTitle");
authMePlugin = Bukkit.getPluginManager().getPlugin("AuthMe");
try {
database = new Database(this);
@@ -52,6 +60,18 @@ public final class CoordinateRecorder extends JavaPlugin {
}
}
public static NamespacedKey getTombstoneOwner() {
return tombstoneOwner;
}
public static NamespacedKey getTombstoneOwnerName() {
return tombstoneOwnerName;
}
public static NamespacedKey getTombstoneOwnerTitle() {
return tombstoneOwnerTitle;
}
@Override
public void onDisable() {
// Plugin shutdown logic

View File

@@ -1,9 +1,32 @@
package ling.coordinateRecorder.Listener;
import ling.coordinateRecorder.CoordinateRecorder;
import ling.coordinateRecorder.data.PlayerData;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/// 玩家事件监听器
public class PlayerEventListener implements Listener {
@@ -14,6 +37,171 @@ public class PlayerEventListener implements Listener {
PlayerMap.getCurrent().playerQuit(event.getPlayer());
}
/**
* 获取适合生成墓碑的位置。
*
* @param deathLocation 玩家死亡位置。
* @return 适合生成墓碑的位置(默认为死亡位置上方或附近空位)。
*/
public static Location getGraveLocation(Location deathLocation) {
// 检查当前位置是否为空气或可放置箱子的方块
Block block = deathLocation.getBlock();
if (isSuitableForGrave(block)) {
return deathLocation;
}
// 尝试在死亡位置上方寻找
Location aboveLocation = deathLocation.clone().add(0, 1, 0);
if (isSuitableForGrave(aboveLocation.getBlock())) {
return aboveLocation;
}
// 尝试在死亡位置周围(水平范围)寻找
for (int x = -2; x <= 2; x++) {
for (int z = -2; z <= 2; z++) {
Location nearbyLocation = deathLocation.clone().add(x, 0, z);
if (isSuitableForGrave(nearbyLocation.getBlock())) {
return nearbyLocation;
}
// 检查周围位置的上方
Location nearbyAboveLocation = nearbyLocation.clone().add(0, 1, 0);
if (isSuitableForGrave(nearbyAboveLocation.getBlock())) {
return nearbyAboveLocation;
}
}
}
// 如果找不到合适的位置,默认返回原始死亡位置
return deathLocation;
}
/**
* 判断是否适合生成墓碑。
*
* @param block 待检查的方块。
* @return 如果适合放置墓碑,返回 true否则返回 false。
*/
private static boolean isSuitableForGrave(Block block) {
Material type = block.getType();
return type == Material.AIR || block.isPassable();
}
public static String getTime() {
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
return now.format(formatter);
}
/// 保护墓碑
protected void onTombstoneProtect(Cancellable event, Player player, Block block) {
if (block.getType() != Material.CHEST) {
return;
}
Chest chest = (Chest) block.getState();
PersistentDataContainer persistent = chest.getPersistentDataContainer();
if (!persistent.has(CoordinateRecorder.getTombstoneOwner())) {
//没有存储元数据的箱子一定不是墓碑
return;
}
String uuid = persistent.get(CoordinateRecorder.getTombstoneOwner(), PersistentDataType.STRING);
String name = persistent.get(CoordinateRecorder.getTombstoneOwnerName(), PersistentDataType.STRING);
if (!player.getUniqueId().toString().equals(uuid)) {
player.sendMessage(ChatColor.RED + "这是 " + name + " 的墓碑,你无权访问!");
event.setCancelled(true);
} else {
int count = 0;
for (ItemStack item : chest.getBlockInventory().getContents()) {
if (item != null && item.getType() != Material.AIR) {
count += item.getAmount();
}
}
PlayerData data = PlayerMap.getCurrent().getPlayerData(player);
if (data == null) {
player.sendMessage(ChatColor.RED + "玩家没有注册");
return;
}
data.setTombstoneBlock(block);
player.sendMessage("这是你的墓碑,请使用/zb unlock 命令解除锁定");
player.sendMessage("墓碑内有" + count + "个物品");
event.setCancelled(true);
}
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
Block block = event.getClickedBlock();
if (block == null) return;
onTombstoneProtect(event, player, block);
}
/// 保护墓碑不被其他玩家摧毁
@EventHandler
public void onBlockBread(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
onTombstoneProtect(event, player, block);
}
/// 阻止墓碑被火焰点燃
@EventHandler
public void onBlockIgnite(BlockIgniteEvent event) {
Block block = event.getBlock();
if (block.getType() != Material.CHEST) return;
Chest chest = (Chest) block.getState();
PersistentDataContainer persistent = chest.getPersistentDataContainer();
if (persistent.has(CoordinateRecorder.getTombstoneOwner())) {
//有元数据的箱子一定是墓碑
System.out.println("阻止点燃");
event.setCancelled(true);
}
}
/// 在玩家死亡时,保管掉落物
@EventHandler
public void playerDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
Location location = player.getLocation();
//寻找可以生成墓碑的位置
Location save = getGraveLocation(location);
Block block = save.getBlock();
String text = ChatColor.YELLOW + "这里长眠着 " + player.getName();
//生成一个箱子
block.setType(Material.CHEST);
Chest chest = (Chest) block.getState();
//为墓碑附加元数据
PersistentDataContainer persistent = chest.getPersistentDataContainer();
persistent.set(CoordinateRecorder.getTombstoneOwner(), PersistentDataType.STRING,
player.getUniqueId().toString());
persistent.set(CoordinateRecorder.getTombstoneOwnerName(), PersistentDataType.STRING, player.getName());
persistent.set(CoordinateRecorder.getTombstoneOwnerTitle(), PersistentDataType.STRING, text);
chest.setCustomName(player.getName() + " 的墓碑");
chest.update();
//将玩家掉落物存入箱子
Inventory chestInventory = chest.getBlockInventory();
for (ItemStack item : event.getDrops()) {
if (item != null) chestInventory.addItem(item);
}
event.getDrops().clear();
//在墓碑上方生成悬浮文字
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(text);
armorStand.setCustomNameVisible(true);
armorStand.setMarker(true);
}
/// 玩家移动
@EventHandler
public void playerMove(PlayerMoveEvent event) {

View File

@@ -96,6 +96,22 @@ public class Database {
.constraint(DSL.primaryKey("UID"))
.execute();
}
//墓碑记录
if (ctx.meta().getTables("Tombstone").isEmpty()) {
ctx.createTable("Tombstone")
.column("ID", SQLDataType.INTEGER.identity(true))
.column("UID", SQLDataType.VARCHAR(64).nullable(false))
.column("world", SQLDataType.VARCHAR(32).nullable(false))
.column("x", SQLDataType.INTEGER.nullable(false))
.column("y", SQLDataType.INTEGER.nullable(false))
.column("z", SQLDataType.INTEGER.nullable(false))
.column("time", SQLDataType.BIGINTUNSIGNED.nullable(false))
.column("isDelete", SQLDataType.BOOLEAN.nullable(false).default_(false))
.execute();
ctx.createIndex(DSL.name("TombstoneIndex"))
.on("Tombstone", "UID", "world", "x", "y", "z", "time", "isDelete")
.execute();
}
}

View File

@@ -5,7 +5,15 @@ import ling.database.tables.records.LocationnotepadPO;
import ling.database.tables.records.PlayersettingsPO;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.jooq.Record;
import org.jooq.Result;
@@ -26,6 +34,8 @@ public class PlayerData {
protected PlayersettingsPO settings;
protected static final CoordinateRecorder plugin = CoordinateRecorder.getCurrent();
protected ScoreboardUI ui;
//正在交互的墓碑
protected Block tombstoneBlock;
public PlayerData(Player player) throws SQLException {
@@ -36,6 +46,50 @@ public class PlayerData {
locationListUpdate();
}
public void setTombstoneBlock(Block tombstone) {
this.tombstoneBlock = tombstone;
}
/// 解锁墓碑
public void unlockTombstoneBlock() {
if (tombstoneBlock == null) {
player.sendMessage(ChatColor.RED + "请先右键点击要解锁的墓碑");
return;
}
if (tombstoneBlock.getType() != Material.CHEST) {
player.sendMessage(ChatColor.RED + "目标不是一个墓碑!");
return;
}
if (player.getLocation().distance(tombstoneBlock.getLocation()) > 8) {
player.sendMessage(ChatColor.RED + "距离太远,无法解锁!");
return;
}
Chest chest = (Chest) tombstoneBlock.getState();
PersistentDataContainer persistent = chest.getPersistentDataContainer();
if (!persistent.has(CoordinateRecorder.getTombstoneOwnerTitle())) {
player.sendMessage(ChatColor.RED + "目标不是一个墓碑!");
return;
}
String name = persistent.get(CoordinateRecorder.getTombstoneOwnerTitle(), PersistentDataType.STRING);
assert name != null;
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 && name.equals(entity.getCustomName())) {
entity.remove();
}
}
//然后解除箱子的锁
persistent.remove(CoordinateRecorder.getTombstoneOwnerTitle());
persistent.remove(CoordinateRecorder.getTombstoneOwner());
persistent.remove(CoordinateRecorder.getTombstoneOwnerName());
chest.update();
player.sendMessage("墓碑已解锁!");
}
protected Record loadPlayerSettingsRecord() throws SQLException {
return CoordinateRecorder.getDatabase().getDSL().select().from(PLAYERSETTINGS).where(

View File

@@ -9,6 +9,7 @@ import java.util.List;
import ling.database.tables.LocationnotepadTB;
import ling.database.tables.PlayersettingsTB;
import ling.database.tables.TombstoneTB;
import ling.database.tables.VersionTB;
import org.jooq.Catalog;
@@ -39,6 +40,11 @@ public class DefaultSchema extends SchemaImpl {
*/
public final PlayersettingsTB PLAYERSETTINGS = PlayersettingsTB.PLAYERSETTINGS;
/**
* The table <code>Tombstone</code>.
*/
public final TombstoneTB TOMBSTONE = TombstoneTB.TOMBSTONE;
/**
* The table <code>Version</code>.
*/
@@ -62,6 +68,7 @@ public class DefaultSchema extends SchemaImpl {
return Arrays.asList(
LocationnotepadTB.LOCATIONNOTEPAD,
PlayersettingsTB.PLAYERSETTINGS,
TombstoneTB.TOMBSTONE,
VersionTB.VERSION
);
}

View File

@@ -5,6 +5,7 @@ package ling.database;
import ling.database.tables.LocationnotepadTB;
import ling.database.tables.TombstoneTB;
import org.jooq.Index;
import org.jooq.OrderField;
@@ -23,4 +24,5 @@ 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 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,9 +6,11 @@ package ling.database;
import ling.database.tables.LocationnotepadTB;
import ling.database.tables.PlayersettingsTB;
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.TombstonePO;
import ling.database.tables.records.VersionPO;
import org.jooq.TableField;
@@ -30,5 +32,6 @@ 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<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.TombstoneTB;
import ling.database.tables.VersionTB;
@@ -25,6 +26,11 @@ public class Tables {
*/
public static final PlayersettingsTB PLAYERSETTINGS = PlayersettingsTB.PLAYERSETTINGS;
/**
* The table <code>Tombstone</code>.
*/
public static final TombstoneTB TOMBSTONE = TombstoneTB.TOMBSTONE;
/**
* The table <code>Version</code>.
*/

View File

@@ -0,0 +1,269 @@
/*
* 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.TombstonePO;
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 TombstoneTB extends TableImpl<TombstonePO> {
private static final long serialVersionUID = 1L;
/**
* The reference instance of <code>Tombstone</code>
*/
public static final TombstoneTB TOMBSTONE = new TombstoneTB();
/**
* The class holding records for this type
*/
@Override
public Class<TombstonePO> getRecordType() {
return TombstonePO.class;
}
/**
* The column <code>Tombstone.ID</code>.
*/
public final TableField<TombstonePO, Integer> ID = createField(DSL.name("ID"), SQLDataType.INTEGER.nullable(false).identity(true), this, "");
/**
* The column <code>Tombstone.UID</code>.
*/
public final TableField<TombstonePO, String> UID = createField(DSL.name("UID"), SQLDataType.VARCHAR(64).nullable(false), this, "");
/**
* The column <code>Tombstone.world</code>.
*/
public final TableField<TombstonePO, String> WORLD = createField(DSL.name("world"), SQLDataType.VARCHAR(32).nullable(false), this, "");
/**
* The column <code>Tombstone.x</code>.
*/
public final TableField<TombstonePO, Integer> X = createField(DSL.name("x"), SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>Tombstone.y</code>.
*/
public final TableField<TombstonePO, Integer> Y = createField(DSL.name("y"), SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>Tombstone.z</code>.
*/
public final TableField<TombstonePO, Integer> Z = createField(DSL.name("z"), SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>Tombstone.time</code>.
*/
public final TableField<TombstonePO, BigDecimal> TIME = createField(DSL.name("time"), SQLDataType.NUMERIC.nullable(false), this, "");
/**
* The column <code>Tombstone.isDelete</code>.
*/
public final TableField<TombstonePO, Boolean> ISDELETE = createField(DSL.name("isDelete"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BOOLEAN)), this, "");
private TombstoneTB(Name alias, Table<TombstonePO> aliased) {
this(alias, aliased, (Field<?>[]) null, null);
}
private TombstoneTB(Name alias, Table<TombstonePO> aliased, Field<?>[] parameters, Condition where) {
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where);
}
/**
* Create an aliased <code>Tombstone</code> table reference
*/
public TombstoneTB(String alias) {
this(DSL.name(alias), TOMBSTONE);
}
/**
* Create an aliased <code>Tombstone</code> table reference
*/
public TombstoneTB(Name alias) {
this(alias, TOMBSTONE);
}
/**
* Create a <code>Tombstone</code> table reference
*/
public TombstoneTB() {
this(DSL.name("Tombstone"), null);
}
@Override
public Schema getSchema() {
return aliased() ? null : DefaultSchema.DEFAULT_SCHEMA;
}
@Override
public List<Index> getIndexes() {
return Arrays.asList(Indexes.TOMBSTONEINDEX);
}
@Override
public Identity<TombstonePO, Integer> getIdentity() {
return (Identity<TombstonePO, Integer>) super.getIdentity();
}
@Override
public UniqueKey<TombstonePO> getPrimaryKey() {
return Keys.TOMBSTONE__PK_TOMBSTONE;
}
@Override
public TombstoneTB as(String alias) {
return new TombstoneTB(DSL.name(alias), this);
}
@Override
public TombstoneTB as(Name alias) {
return new TombstoneTB(alias, this);
}
@Override
public TombstoneTB as(Table<?> alias) {
return new TombstoneTB(alias.getQualifiedName(), this);
}
/**
* Rename this table
*/
@Override
public TombstoneTB rename(String name) {
return new TombstoneTB(DSL.name(name), null);
}
/**
* Rename this table
*/
@Override
public TombstoneTB rename(Name name) {
return new TombstoneTB(name, null);
}
/**
* Rename this table
*/
@Override
public TombstoneTB rename(Table<?> name) {
return new TombstoneTB(name.getQualifiedName(), null);
}
/**
* Create an inline derived table from this table
*/
@Override
public TombstoneTB where(Condition condition) {
return new TombstoneTB(getQualifiedName(), aliased() ? this : null, null, condition);
}
/**
* Create an inline derived table from this table
*/
@Override
public TombstoneTB where(Collection<? extends Condition> conditions) {
return where(DSL.and(conditions));
}
/**
* Create an inline derived table from this table
*/
@Override
public TombstoneTB where(Condition... conditions) {
return where(DSL.and(conditions));
}
/**
* Create an inline derived table from this table
*/
@Override
public TombstoneTB where(Field<Boolean> condition) {
return where(DSL.condition(condition));
}
/**
* Create an inline derived table from this table
*/
@Override
@PlainSQL
public TombstoneTB where(SQL condition) {
return where(DSL.condition(condition));
}
/**
* Create an inline derived table from this table
*/
@Override
@PlainSQL
public TombstoneTB where(@Stringly.SQL String condition) {
return where(DSL.condition(condition));
}
/**
* Create an inline derived table from this table
*/
@Override
@PlainSQL
public TombstoneTB where(@Stringly.SQL String condition, Object... binds) {
return where(DSL.condition(condition, binds));
}
/**
* Create an inline derived table from this table
*/
@Override
@PlainSQL
public TombstoneTB where(@Stringly.SQL String condition, QueryPart... parts) {
return where(DSL.condition(condition, parts));
}
/**
* Create an inline derived table from this table
*/
@Override
public TombstoneTB whereExists(Select<?> select) {
return where(DSL.exists(select));
}
/**
* Create an inline derived table from this table
*/
@Override
public TombstoneTB whereNotExists(Select<?> select) {
return where(DSL.notExists(select));
}
}

View File

@@ -0,0 +1,264 @@
/*
* 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 TombstoneBO implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String uid;
private String world;
private Integer x;
private Integer y;
private Integer z;
private BigDecimal time;
private Boolean isdelete;
public TombstoneBO() {}
public TombstoneBO(TombstoneBO value) {
this.id = value.id;
this.uid = value.uid;
this.world = value.world;
this.x = value.x;
this.y = value.y;
this.z = value.z;
this.time = value.time;
this.isdelete = value.isdelete;
}
public TombstoneBO(
Integer id,
String uid,
String world,
Integer x,
Integer y,
Integer z,
BigDecimal time,
Boolean isdelete
) {
this.id = id;
this.uid = uid;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.time = time;
this.isdelete = isdelete;
}
/**
* Getter for <code>Tombstone.ID</code>.
*/
public Integer getId() {
return this.id;
}
/**
* Setter for <code>Tombstone.ID</code>.
*/
public void setId(Integer id) {
this.id = id;
}
/**
* Getter for <code>Tombstone.UID</code>.
*/
public String getUid() {
return this.uid;
}
/**
* Setter for <code>Tombstone.UID</code>.
*/
public void setUid(String uid) {
this.uid = uid;
}
/**
* Getter for <code>Tombstone.world</code>.
*/
public String getWorld() {
return this.world;
}
/**
* Setter for <code>Tombstone.world</code>.
*/
public void setWorld(String world) {
this.world = world;
}
/**
* Getter for <code>Tombstone.x</code>.
*/
public Integer getX() {
return this.x;
}
/**
* Setter for <code>Tombstone.x</code>.
*/
public void setX(Integer x) {
this.x = x;
}
/**
* Getter for <code>Tombstone.y</code>.
*/
public Integer getY() {
return this.y;
}
/**
* Setter for <code>Tombstone.y</code>.
*/
public void setY(Integer y) {
this.y = y;
}
/**
* Getter for <code>Tombstone.z</code>.
*/
public Integer getZ() {
return this.z;
}
/**
* Setter for <code>Tombstone.z</code>.
*/
public void setZ(Integer z) {
this.z = z;
}
/**
* Getter for <code>Tombstone.time</code>.
*/
public BigDecimal getTime() {
return this.time;
}
/**
* Setter for <code>Tombstone.time</code>.
*/
public void setTime(BigDecimal time) {
this.time = time;
}
/**
* Getter for <code>Tombstone.isDelete</code>.
*/
public Boolean getIsdelete() {
return this.isdelete;
}
/**
* Setter for <code>Tombstone.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 TombstoneBO other = (TombstoneBO) obj;
if (this.id == null) {
if (other.id != null)
return false;
}
else if (!this.id.equals(other.id))
return false;
if (this.uid == null) {
if (other.uid != null)
return false;
}
else if (!this.uid.equals(other.uid))
return false;
if (this.world == null) {
if (other.world != null)
return false;
}
else if (!this.world.equals(other.world))
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.time == null) {
if (other.time != null)
return false;
}
else if (!this.time.equals(other.time))
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.uid == null) ? 0 : this.uid.hashCode());
result = prime * result + ((this.world == null) ? 0 : this.world.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.time == null) ? 0 : this.time.hashCode());
result = prime * result + ((this.isdelete == null) ? 0 : this.isdelete.hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("TombstoneBO (");
sb.append(id);
sb.append(", ").append(uid);
sb.append(", ").append(world);
sb.append(", ").append(x);
sb.append(", ").append(y);
sb.append(", ").append(z);
sb.append(", ").append(time);
sb.append(", ").append(isdelete);
sb.append(")");
return sb.toString();
}
}

View File

@@ -0,0 +1,191 @@
/*
* This file is generated by jOOQ.
*/
package ling.database.tables.records;
import java.math.BigDecimal;
import ling.database.tables.TombstoneTB;
import ling.database.tables.pojos.TombstoneBO;
import org.jooq.Record1;
import org.jooq.impl.UpdatableRecordImpl;
/**
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" })
public class TombstonePO extends UpdatableRecordImpl<TombstonePO> {
private static final long serialVersionUID = 1L;
/**
* Setter for <code>Tombstone.ID</code>.
*/
public void setId(Integer value) {
set(0, value);
}
/**
* Getter for <code>Tombstone.ID</code>.
*/
public Integer getId() {
return (Integer) get(0);
}
/**
* Setter for <code>Tombstone.UID</code>.
*/
public void setUid(String value) {
set(1, value);
}
/**
* Getter for <code>Tombstone.UID</code>.
*/
public String getUid() {
return (String) get(1);
}
/**
* Setter for <code>Tombstone.world</code>.
*/
public void setWorld(String value) {
set(2, value);
}
/**
* Getter for <code>Tombstone.world</code>.
*/
public String getWorld() {
return (String) get(2);
}
/**
* Setter for <code>Tombstone.x</code>.
*/
public void setX(Integer value) {
set(3, value);
}
/**
* Getter for <code>Tombstone.x</code>.
*/
public Integer getX() {
return (Integer) get(3);
}
/**
* Setter for <code>Tombstone.y</code>.
*/
public void setY(Integer value) {
set(4, value);
}
/**
* Getter for <code>Tombstone.y</code>.
*/
public Integer getY() {
return (Integer) get(4);
}
/**
* Setter for <code>Tombstone.z</code>.
*/
public void setZ(Integer value) {
set(5, value);
}
/**
* Getter for <code>Tombstone.z</code>.
*/
public Integer getZ() {
return (Integer) get(5);
}
/**
* Setter for <code>Tombstone.time</code>.
*/
public void setTime(BigDecimal value) {
set(6, value);
}
/**
* Getter for <code>Tombstone.time</code>.
*/
public BigDecimal getTime() {
return (BigDecimal) get(6);
}
/**
* Setter for <code>Tombstone.isDelete</code>.
*/
public void setIsdelete(Boolean value) {
set(7, value);
}
/**
* Getter for <code>Tombstone.isDelete</code>.
*/
public Boolean getIsdelete() {
return (Boolean) get(7);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
@Override
public Record1<Integer> key() {
return (Record1) super.key();
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached TombstonePO
*/
public TombstonePO() {
super(TombstoneTB.TOMBSTONE);
}
/**
* Create a detached, initialised TombstonePO
*/
public TombstonePO(Integer id, String uid, String world, Integer x, Integer y, Integer z, BigDecimal time, Boolean isdelete) {
super(TombstoneTB.TOMBSTONE);
setId(id);
setUid(uid);
setWorld(world);
setX(x);
setY(y);
setZ(z);
setTime(time);
setIsdelete(isdelete);
resetChangedOnNotNull();
}
/**
* Create a detached, initialised TombstonePO
*/
public TombstonePO(TombstoneBO value) {
super(TombstoneTB.TOMBSTONE);
if (value != null) {
setId(value.getId());
setUid(value.getUid());
setWorld(value.getWorld());
setX(value.getX());
setY(value.getY());
setZ(value.getZ());
setTime(value.getTime());
setIsdelete(value.getIsdelete());
resetChangedOnNotNull();
}
}
}