引入add和help子命令,显示侧边栏信息

This commit is contained in:
2024-12-20 03:03:08 +08:00
parent 72d5df30a5
commit d51403b58e
17 changed files with 1003 additions and 15 deletions

View File

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

View File

@@ -1,31 +1,133 @@
package ling.coordinateRecorder.Commands;
import ling.coordinateRecorder.CoordinateRecorder;
import ling.coordinateRecorder.Listener.PlayerMap;
import ling.coordinateRecorder.data.PlayerData;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import org.jetbrains.annotations.NotNull;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/// zb命令处理器
public class ZbCommand implements CommandExecutor, TabCompleter {
protected final static List<String> TAB_1 = Arrays.asList("add", "remove", "help", "reload");
public ZbCommand() {
}
protected void add(Player player, String[] strings) {
if (strings.length > 3) {
player.sendMessage(ChatColor.RED + "命令过长");
return;
}
if (strings.length < 2) {
player.sendMessage(ChatColor.RED + "语法错误add需要 [name] 参数,作为当前地标的名称");
return;
}
boolean isFixed = false;
String name = strings[1];
if (strings.length == 3) {
if (strings[2].equals("true")) {
isFixed = true;
} else if (!strings[2].equals("false")) {
player.sendMessage(ChatColor.RED + "无法解析的参数:" + strings[3]);
}
}
PlayerData data = PlayerMap.getCurrent().getPlayerData(player);
if (data == null) {
player.sendMessage(ChatColor.RED + "玩家未登录");
return;
}
try {
data.addLocation(name, isFixed);
player.sendMessage("坐标记录完毕!");
} catch (SQLException e) {
CoordinateRecorder.getCurrent().getLogger().severe("记录坐标出错:" + e.getMessage());
player.sendMessage(ChatColor.RED + "服务器内部错误:记录数据失败");
}
}
/// 显示帮助
protected void help(Player player) {
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) book.getItemMeta();
assert bookMeta != null;
bookMeta.setGeneration(BookMeta.Generation.COPY_OF_COPY);
bookMeta.setTitle("帮助信息");
bookMeta.setAuthor("StarPoles");
bookMeta.addPage("欢迎使用坐标管理器!你好," + player.getName() + "\n\n" +
"本书将向你介绍如何使用指令记录曾探索过的地点,以避免迷路\n" +
"如果需要再次查看帮助信息,请使用 /zb help\n",
"/zb add <地点名称> <固定到侧边栏> \n" +
"记录当前地点到数据库中,例如\n" +
"/zb add Home\n" +
"将会记录当前的位置,取名为 Home并固定到屏幕右侧\n",
"如果不想固定到屏幕右侧,可以像这样使用\n" +
"/zb add Home false\n" +
"然后,你可以使用/zb list来查看已经保存的位置\n" +
"使用/zb fixed <Name> 来将地点固定到屏幕右侧\n" +
"使用/zb unfixed <Name> 来取消固定。\n");
book.setItemMeta(bookMeta);
player.openBook(book);
}
protected boolean execute(Player player, String[] strings) {
if (strings.length < 1) {
player.sendMessage(ChatColor.RED + "语法错误:需要 [选项]");
return false;
}
if (strings[0].equals("add")) {
add(player, strings);
}
if (strings[0].equals("help")) {
help(player);
}
return true;
}
@Override
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command,
@NotNull String s, @NotNull String[] strings) {
assert s.equals("zb");
if (!(commandSender instanceof Player)) {
if (!(commandSender instanceof Player player)) {
System.out.println("该命令只能由玩家执行");
return false;
}
Player player = (Player) commandSender;
return false;
return execute(player, strings);
}
@Override
public List<String> onTabComplete(CommandSender commandSender, Command command, String s, String[] strings) {
String latest = null;
if (strings.length != 0) {
latest = strings[strings.length - 1];
}
if (strings.length == 1)
return filter(latest, new ArrayList<>(TAB_1));
return List.of();
}
private List<String> filter(String latest, List<String> list) {
if (list.isEmpty() || latest == null) {
return List.of();
}
String ll = latest.toLowerCase();
list.removeIf(k -> !k.toLowerCase().startsWith(ll));
return list;
}
}

View File

@@ -1,5 +1,6 @@
package ling.coordinateRecorder;
import ling.coordinateRecorder.Commands.ZbCommand;
import ling.coordinateRecorder.Listener.PlayerAuthMeLoginEventListener;
import ling.coordinateRecorder.Listener.PlayerEventListener;
import ling.coordinateRecorder.Listener.PlayerLoginEventListener;
@@ -40,6 +41,11 @@ public final class CoordinateRecorder extends JavaPlugin {
database = new Database(this);
start();
loadListener();
ZbCommand zb = new ZbCommand();
var command = Bukkit.getPluginCommand("zb");
assert command != null;
command.setExecutor(zb);
command.setTabCompleter(zb);
getLogger().info("加载完毕");
} catch (SQLException e) {
throw new RuntimeException("插件初始化失败", e);

View File

@@ -2,9 +2,11 @@ package ling.coordinateRecorder.Listener;
import ling.coordinateRecorder.CoordinateRecorder;
import ling.coordinateRecorder.data.PlayerData;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.UUID;
@@ -32,17 +34,23 @@ public class PlayerMap {
/// 玩家登录
protected void playerLogin(Player player) {
if (!playerList.containsKey(player.getUniqueId())) {
plugin.getLogger().info("玩家[" + player.getName() + "]登录服务器,已添加到管理列表");
playerList.put(player.getUniqueId(), new PlayerData(player));
} else {
plugin.getLogger().warning("玩家[" + player.getName() + "]已经在管理列表中");
try {
if (!playerList.containsKey(player.getUniqueId())) {
plugin.getLogger().info("玩家[" + player.getName() + "]登录服务器,已添加到管理列表");
playerList.put(player.getUniqueId(), new PlayerData(player));
} else {
plugin.getLogger().warning("玩家[" + player.getName() + "]已经在管理列表中");
}
} catch (SQLException e) {
plugin.getLogger().severe("查询玩家数据出错!" + e.getMessage());
player.sendMessage(ChatColor.RED + "警告!载入玩家数据出错,坐标管理器不可用,请联系管理员!");
}
}
/// 玩家退出
protected void playerQuit(Player player) {
if (playerList.containsKey(player.getUniqueId())) {
playerList.get(player.getUniqueId()).closeUI();
playerList.remove(player.getUniqueId());
plugin.getLogger().info("玩家[" + player.getName() + "]退出服务器,停止管理");
}

View File

@@ -72,7 +72,28 @@ public class Database {
.column("y", SQLDataType.INTEGER.nullable(false))
.column("z", SQLDataType.INTEGER.nullable(false))
.column("time", SQLDataType.BIGINTUNSIGNED.nullable(false))
.column("isFixed", SQLDataType.BOOLEAN.nullable(false).default_(false))
.column("isDelete", SQLDataType.BOOLEAN.nullable(false).default_(false))
.constraints(DSL.primaryKey("ID"))
.execute();
ctx.createIndex(DSL.name("PlayerIndex"))
.on("LocationNotepad", "UID", "isFixed", "isDelete", "name")
.execute();
}
//玩家设置表
if (ctx.meta().getTables("PlayerSettings").isEmpty()) {
ctx.createTable("PlayerSettings")
.column("UID", SQLDataType.VARCHAR(64).nullable(false))
//控制是否在玩家屏幕右侧通过计分板显示插件信息
.column("displaySwitch", SQLDataType.BOOLEAN.nullable(false).default_(true))
//控制是否在计分板上显示当前时间刻对应的时间
.column("showTime", SQLDataType.BOOLEAN.nullable(false).default_(true))
//控制是否允许他人请求向自己传送
.column("tpMe", SQLDataType.BOOLEAN.nullable(false).default_(true))
//当他人的传送请求被设置自动拒绝时,展示给它的提示信息
.column("settingsRejectTpMessage",
SQLDataType.CHAR.nullable(false).default_("对方的设置不允许任何人向他传送!"))
.constraint(DSL.primaryKey("UID"))
.execute();
}
@@ -89,7 +110,8 @@ public class Database {
var version = getVersion();
//数据库已经初始化
if (version != null) {
CoordinateRecorder.getCurrent().getLogger().info("数据库版本:" + version.getVersion() + "" + version.getVersionname());
CoordinateRecorder.getCurrent().getLogger().info(
"数据库版本:" + version.getVersion() + "" + version.getVersionname());
return;
}
ctx.insertInto(VersionTB.VERSION)

View File

@@ -1,13 +1,110 @@
package ling.coordinateRecorder.data;
import ling.coordinateRecorder.CoordinateRecorder;
import ling.database.tables.records.LocationnotepadPO;
import ling.database.tables.records.PlayersettingsPO;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jooq.Record;
import org.jooq.Result;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.List;
import java.util.Objects;
import static ling.database.Tables.PLAYERSETTINGS;
import static ling.database.tables.LocationnotepadTB.LOCATIONNOTEPAD;
/// 玩家的附加信息
public class PlayerData {
protected final Player player;
/// 此玩家固定在展示页的地点列表
protected List<LocationnotepadPO> locationList;
protected PlayersettingsPO settings;
protected static final CoordinateRecorder plugin = CoordinateRecorder.getCurrent();
protected ScoreboardUI ui;
public PlayerData(Player player) {
public PlayerData(Player player) throws SQLException {
this.player = player;
loadPlayerSettings();
ui = new ScoreboardUI(this);
ui.createScoreboard();
locationListUpdate();
}
protected Record loadPlayerSettingsRecord() throws SQLException {
return CoordinateRecorder.getDatabase().getDSL().select().from(PLAYERSETTINGS).where(
PLAYERSETTINGS.UID.eq(player.getUniqueId().toString())
).fetchOne();
}
/// 关闭ui
public void closeUI() {
ui.closeUI();
}
/// 将当前位置记录到坐标记录中
public boolean addLocation(String name, boolean isFixed) throws SQLException {
var ctx = CoordinateRecorder.getDatabase().getDSL();
Record record = ctx.select().from(LOCATIONNOTEPAD).where(
LOCATIONNOTEPAD.UID.eq(player.getUniqueId().toString())
.and(LOCATIONNOTEPAD.NAME.eq(name))
.and(LOCATIONNOTEPAD.ISDELETE.eq(false))
).fetchOne();
if (record != null) {
player.sendMessage(ChatColor.RED + "该名称的地点已经存在");
return false;
}
Location location = player.getLocation();
ctx.insertInto(LOCATIONNOTEPAD).columns(
LOCATIONNOTEPAD.UID,
LOCATIONNOTEPAD.WORLD,
LOCATIONNOTEPAD.NAME,
LOCATIONNOTEPAD.X,
LOCATIONNOTEPAD.Y,
LOCATIONNOTEPAD.Z,
LOCATIONNOTEPAD.TIME,
LOCATIONNOTEPAD.ISFIXED
).values(
player.getUniqueId().toString(),
Objects.requireNonNull(location.getWorld()).getName(),
name,
(int) location.getX(),
(int) location.getY(),
(int) location.getZ(),
BigDecimal.valueOf(System.currentTimeMillis()),
isFixed
).execute();
locationListUpdate();
return true;
}
/// 载入玩家设置
public void loadPlayerSettings() throws SQLException {
var record = loadPlayerSettingsRecord();
if (record == null) {
//设置不存在,新建一行
CoordinateRecorder.getDatabase().getDSL().insertInto(PLAYERSETTINGS)
.columns(PLAYERSETTINGS.UID)
.values(player.getUniqueId().toString())
.execute();
record = loadPlayerSettingsRecord();
assert record != null;
}
this.settings = record.into(PlayersettingsPO.class);
}
/// 重新载入玩家的固定地点数据
public void locationListUpdate() throws SQLException {
Result<Record> result = CoordinateRecorder.getDatabase().getDSL().select().from(LOCATIONNOTEPAD).where(
LOCATIONNOTEPAD.UID.eq(player.getUniqueId().toString()).and(LOCATIONNOTEPAD.ISFIXED.eq(true))
.and(LOCATIONNOTEPAD.ISDELETE.eq(false))).fetch();
locationList = result.into(LocationnotepadPO.class);
ui.flashLocations();
}
/// 玩家位置信息发生改变

View File

@@ -0,0 +1,91 @@
package ling.coordinateRecorder.data;
import ling.database.tables.records.LocationnotepadPO;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*;
import java.util.ArrayList;
import java.util.List;
/// 玩家的计分板UI界面
public class ScoreboardUI {
protected final Player player;
protected final PlayerData playerData;
protected Scoreboard scoreboard;
protected Objective objective;
protected Location location;
protected Score meLocation;
protected Score time;
protected List<String> locals = new ArrayList<>();
protected ScoreboardUI(PlayerData data) {
this.playerData = data;
this.player = data.player;
this.location = player.getLocation();
}
/// 创建记分牌信息
protected void createScoreboard() {
var manager = Bukkit.getScoreboardManager();
assert manager != null;
this.scoreboard = manager.getNewScoreboard();
//玩家设置不显示计分板
if (!playerData.settings.getDisplayswitch()) {
//player.setScoreboard(this.scoreboard);
return;
}
this.objective = scoreboard.registerNewObjective("坐标", Criteria.DUMMY,
ChatColor.GOLD.toString() + ChatColor.BOLD + "坐标管理器");
this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
meLocation = this.objective.getScore(getLocationString());
meLocation.setScore(999);
if (playerData.settings.getShowtime()) {
time = this.objective.getScore("时间");
time.setScore(998);
}
player.setScoreboard(this.scoreboard);
flashLocations();
}
protected void closeUI() {
var manager = Bukkit.getScoreboardManager();
assert manager != null;
player.setScoreboard(manager.getNewScoreboard());
}
/// 渲染所有保存的坐标
protected void flashLocations() {
if (!playerData.settings.getDisplayswitch()) {
return;
}
//先移除计分板中所有的坐标
for (String local : locals) {
scoreboard.resetScores(local);
}
locals.clear();
//然后在将坐标信息添加进去
var list = playerData.locationList;
if (list == null)
return;
for (LocationnotepadPO po : list) {
String item = po.getName() + " X " + po.getX() + " Y " + po.getY() + " Z " + po.getZ();
locals.add(item);
Score score = objective.getScore(item);
score.setScore(locals.size());
//最多只允许展示20个条目
if (locals.size() > 20) {
break;
}
}
}
protected String getLocationString() {
return "X " + (int) location.getX() + " Y " + (int) location.getY() + " Z " + (int) location.getZ();
}
}

View File

@@ -8,6 +8,7 @@ import java.util.Arrays;
import java.util.List;
import ling.database.tables.LocationnotepadTB;
import ling.database.tables.PlayersettingsTB;
import ling.database.tables.VersionTB;
import org.jooq.Catalog;
@@ -33,6 +34,11 @@ public class DefaultSchema extends SchemaImpl {
*/
public final LocationnotepadTB LOCATIONNOTEPAD = LocationnotepadTB.LOCATIONNOTEPAD;
/**
* The table <code>PlayerSettings</code>.
*/
public final PlayersettingsTB PLAYERSETTINGS = PlayersettingsTB.PLAYERSETTINGS;
/**
* The table <code>Version</code>.
*/
@@ -55,6 +61,7 @@ public class DefaultSchema extends SchemaImpl {
public final List<Table<?>> getTables() {
return Arrays.asList(
LocationnotepadTB.LOCATIONNOTEPAD,
PlayersettingsTB.PLAYERSETTINGS,
VersionTB.VERSION
);
}

View File

@@ -0,0 +1,26 @@
/*
* This file is generated by jOOQ.
*/
package ling.database;
import ling.database.tables.LocationnotepadTB;
import org.jooq.Index;
import org.jooq.OrderField;
import org.jooq.impl.DSL;
import org.jooq.impl.Internal;
/**
* A class modelling indexes of tables in the default schema.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" })
public class Indexes {
// -------------------------------------------------------------------------
// INDEX definitions
// -------------------------------------------------------------------------
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);
}

View File

@@ -5,8 +5,10 @@ package ling.database;
import ling.database.tables.LocationnotepadTB;
import ling.database.tables.PlayersettingsTB;
import ling.database.tables.VersionTB;
import ling.database.tables.records.LocationnotepadPO;
import ling.database.tables.records.PlayersettingsPO;
import ling.database.tables.records.VersionPO;
import org.jooq.TableField;
@@ -27,5 +29,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<VersionPO> VERSION__PK_VERSION = Internal.createUniqueKey(VersionTB.VERSION, DSL.name("pk_Version"), new TableField[] { VersionTB.VERSION.ID }, true);
}

View File

@@ -5,6 +5,7 @@ package ling.database;
import ling.database.tables.LocationnotepadTB;
import ling.database.tables.PlayersettingsTB;
import ling.database.tables.VersionTB;
@@ -19,6 +20,11 @@ public class Tables {
*/
public static final LocationnotepadTB LOCATIONNOTEPAD = LocationnotepadTB.LOCATIONNOTEPAD;
/**
* The table <code>PlayerSettings</code>.
*/
public static final PlayersettingsTB PLAYERSETTINGS = PlayersettingsTB.PLAYERSETTINGS;
/**
* The table <code>Version</code>.
*/

View File

@@ -5,15 +5,19 @@ 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.LocationnotepadPO;
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;
@@ -91,6 +95,11 @@ public class LocationnotepadTB extends TableImpl<LocationnotepadPO> {
*/
public final TableField<LocationnotepadPO, BigDecimal> TIME = createField(DSL.name("time"), SQLDataType.NUMERIC.nullable(false), this, "");
/**
* The column <code>LocationNotepad.isFixed</code>.
*/
public final TableField<LocationnotepadPO, Boolean> ISFIXED = createField(DSL.name("isFixed"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BOOLEAN)), this, "");
/**
* The column <code>LocationNotepad.isDelete</code>.
*/
@@ -130,6 +139,11 @@ public class LocationnotepadTB extends TableImpl<LocationnotepadPO> {
return aliased() ? null : DefaultSchema.DEFAULT_SCHEMA;
}
@Override
public List<Index> getIndexes() {
return Arrays.asList(Indexes.PLAYERINDEX);
}
@Override
public Identity<LocationnotepadPO, Integer> getIdentity() {
return (Identity<LocationnotepadPO, Integer>) super.getIdentity();

View File

@@ -0,0 +1,238 @@
/*
* This file is generated by jOOQ.
*/
package ling.database.tables;
import java.util.Collection;
import ling.database.DefaultSchema;
import ling.database.Keys;
import ling.database.tables.records.PlayersettingsPO;
import org.jooq.Condition;
import org.jooq.Field;
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 PlayersettingsTB extends TableImpl<PlayersettingsPO> {
private static final long serialVersionUID = 1L;
/**
* The reference instance of <code>PlayerSettings</code>
*/
public static final PlayersettingsTB PLAYERSETTINGS = new PlayersettingsTB();
/**
* The class holding records for this type
*/
@Override
public Class<PlayersettingsPO> getRecordType() {
return PlayersettingsPO.class;
}
/**
* The column <code>PlayerSettings.UID</code>.
*/
public final TableField<PlayersettingsPO, String> UID = createField(DSL.name("UID"), SQLDataType.VARCHAR(64).nullable(false), this, "");
/**
* The column <code>PlayerSettings.displaySwitch</code>.
*/
public final TableField<PlayersettingsPO, Boolean> DISPLAYSWITCH = createField(DSL.name("displaySwitch"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("1"), SQLDataType.BOOLEAN)), this, "");
/**
* The column <code>PlayerSettings.showTime</code>.
*/
public final TableField<PlayersettingsPO, Boolean> SHOWTIME = createField(DSL.name("showTime"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("1"), SQLDataType.BOOLEAN)), this, "");
/**
* The column <code>PlayerSettings.tpMe</code>.
*/
public final TableField<PlayersettingsPO, Boolean> TPME = createField(DSL.name("tpMe"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("1"), SQLDataType.BOOLEAN)), this, "");
/**
* The column <code>PlayerSettings.settingsRejectTpMessage</code>.
*/
public final TableField<PlayersettingsPO, String> SETTINGSREJECTTPMESSAGE = createField(DSL.name("settingsRejectTpMessage"), SQLDataType.CHAR.nullable(false).defaultValue(DSL.field(DSL.raw("'对方的设置不允许任何人向他传送!'"), SQLDataType.CHAR)), this, "");
private PlayersettingsTB(Name alias, Table<PlayersettingsPO> aliased) {
this(alias, aliased, (Field<?>[]) null, null);
}
private PlayersettingsTB(Name alias, Table<PlayersettingsPO> aliased, Field<?>[] parameters, Condition where) {
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table(), where);
}
/**
* Create an aliased <code>PlayerSettings</code> table reference
*/
public PlayersettingsTB(String alias) {
this(DSL.name(alias), PLAYERSETTINGS);
}
/**
* Create an aliased <code>PlayerSettings</code> table reference
*/
public PlayersettingsTB(Name alias) {
this(alias, PLAYERSETTINGS);
}
/**
* Create a <code>PlayerSettings</code> table reference
*/
public PlayersettingsTB() {
this(DSL.name("PlayerSettings"), null);
}
@Override
public Schema getSchema() {
return aliased() ? null : DefaultSchema.DEFAULT_SCHEMA;
}
@Override
public UniqueKey<PlayersettingsPO> getPrimaryKey() {
return Keys.PLAYERSETTINGS__PK_PLAYERSETTINGS;
}
@Override
public PlayersettingsTB as(String alias) {
return new PlayersettingsTB(DSL.name(alias), this);
}
@Override
public PlayersettingsTB as(Name alias) {
return new PlayersettingsTB(alias, this);
}
@Override
public PlayersettingsTB as(Table<?> alias) {
return new PlayersettingsTB(alias.getQualifiedName(), this);
}
/**
* Rename this table
*/
@Override
public PlayersettingsTB rename(String name) {
return new PlayersettingsTB(DSL.name(name), null);
}
/**
* Rename this table
*/
@Override
public PlayersettingsTB rename(Name name) {
return new PlayersettingsTB(name, null);
}
/**
* Rename this table
*/
@Override
public PlayersettingsTB rename(Table<?> name) {
return new PlayersettingsTB(name.getQualifiedName(), null);
}
/**
* Create an inline derived table from this table
*/
@Override
public PlayersettingsTB where(Condition condition) {
return new PlayersettingsTB(getQualifiedName(), aliased() ? this : null, null, condition);
}
/**
* Create an inline derived table from this table
*/
@Override
public PlayersettingsTB where(Collection<? extends Condition> conditions) {
return where(DSL.and(conditions));
}
/**
* Create an inline derived table from this table
*/
@Override
public PlayersettingsTB where(Condition... conditions) {
return where(DSL.and(conditions));
}
/**
* Create an inline derived table from this table
*/
@Override
public PlayersettingsTB where(Field<Boolean> condition) {
return where(DSL.condition(condition));
}
/**
* Create an inline derived table from this table
*/
@Override
@PlainSQL
public PlayersettingsTB where(SQL condition) {
return where(DSL.condition(condition));
}
/**
* Create an inline derived table from this table
*/
@Override
@PlainSQL
public PlayersettingsTB where(@Stringly.SQL String condition) {
return where(DSL.condition(condition));
}
/**
* Create an inline derived table from this table
*/
@Override
@PlainSQL
public PlayersettingsTB where(@Stringly.SQL String condition, Object... binds) {
return where(DSL.condition(condition, binds));
}
/**
* Create an inline derived table from this table
*/
@Override
@PlainSQL
public PlayersettingsTB where(@Stringly.SQL String condition, QueryPart... parts) {
return where(DSL.condition(condition, parts));
}
/**
* Create an inline derived table from this table
*/
@Override
public PlayersettingsTB whereExists(Select<?> select) {
return where(DSL.exists(select));
}
/**
* Create an inline derived table from this table
*/
@Override
public PlayersettingsTB whereNotExists(Select<?> select) {
return where(DSL.notExists(select));
}
}

View File

@@ -24,6 +24,7 @@ public class LocationnotepadBO implements Serializable {
private Integer y;
private Integer z;
private BigDecimal time;
private Boolean isfixed;
private Boolean isdelete;
public LocationnotepadBO() {}
@@ -37,6 +38,7 @@ public class LocationnotepadBO implements Serializable {
this.y = value.y;
this.z = value.z;
this.time = value.time;
this.isfixed = value.isfixed;
this.isdelete = value.isdelete;
}
@@ -49,6 +51,7 @@ public class LocationnotepadBO implements Serializable {
Integer y,
Integer z,
BigDecimal time,
Boolean isfixed,
Boolean isdelete
) {
this.id = id;
@@ -59,6 +62,7 @@ public class LocationnotepadBO implements Serializable {
this.y = y;
this.z = z;
this.time = time;
this.isfixed = isfixed;
this.isdelete = isdelete;
}
@@ -174,6 +178,20 @@ public class LocationnotepadBO implements Serializable {
this.time = time;
}
/**
* Getter for <code>LocationNotepad.isFixed</code>.
*/
public Boolean getIsfixed() {
return this.isfixed;
}
/**
* Setter for <code>LocationNotepad.isFixed</code>.
*/
public void setIsfixed(Boolean isfixed) {
this.isfixed = isfixed;
}
/**
* Getter for <code>LocationNotepad.isDelete</code>.
*/
@@ -245,6 +263,12 @@ public class LocationnotepadBO implements Serializable {
}
else if (!this.time.equals(other.time))
return false;
if (this.isfixed == null) {
if (other.isfixed != null)
return false;
}
else if (!this.isfixed.equals(other.isfixed))
return false;
if (this.isdelete == null) {
if (other.isdelete != null)
return false;
@@ -266,6 +290,7 @@ public class LocationnotepadBO implements Serializable {
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.isfixed == null) ? 0 : this.isfixed.hashCode());
result = prime * result + ((this.isdelete == null) ? 0 : this.isdelete.hashCode());
return result;
}
@@ -282,6 +307,7 @@ public class LocationnotepadBO implements Serializable {
sb.append(", ").append(y);
sb.append(", ").append(z);
sb.append(", ").append(time);
sb.append(", ").append(isfixed);
sb.append(", ").append(isdelete);
sb.append(")");

View File

@@ -0,0 +1,185 @@
/*
* This file is generated by jOOQ.
*/
package ling.database.tables.pojos;
import java.io.Serializable;
/**
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" })
public class PlayersettingsBO implements Serializable {
private static final long serialVersionUID = 1L;
private String uid;
private Boolean displayswitch;
private Boolean showtime;
private Boolean tpme;
private String settingsrejecttpmessage;
public PlayersettingsBO() {}
public PlayersettingsBO(PlayersettingsBO value) {
this.uid = value.uid;
this.displayswitch = value.displayswitch;
this.showtime = value.showtime;
this.tpme = value.tpme;
this.settingsrejecttpmessage = value.settingsrejecttpmessage;
}
public PlayersettingsBO(
String uid,
Boolean displayswitch,
Boolean showtime,
Boolean tpme,
String settingsrejecttpmessage
) {
this.uid = uid;
this.displayswitch = displayswitch;
this.showtime = showtime;
this.tpme = tpme;
this.settingsrejecttpmessage = settingsrejecttpmessage;
}
/**
* Getter for <code>PlayerSettings.UID</code>.
*/
public String getUid() {
return this.uid;
}
/**
* Setter for <code>PlayerSettings.UID</code>.
*/
public void setUid(String uid) {
this.uid = uid;
}
/**
* Getter for <code>PlayerSettings.displaySwitch</code>.
*/
public Boolean getDisplayswitch() {
return this.displayswitch;
}
/**
* Setter for <code>PlayerSettings.displaySwitch</code>.
*/
public void setDisplayswitch(Boolean displayswitch) {
this.displayswitch = displayswitch;
}
/**
* Getter for <code>PlayerSettings.showTime</code>.
*/
public Boolean getShowtime() {
return this.showtime;
}
/**
* Setter for <code>PlayerSettings.showTime</code>.
*/
public void setShowtime(Boolean showtime) {
this.showtime = showtime;
}
/**
* Getter for <code>PlayerSettings.tpMe</code>.
*/
public Boolean getTpme() {
return this.tpme;
}
/**
* Setter for <code>PlayerSettings.tpMe</code>.
*/
public void setTpme(Boolean tpme) {
this.tpme = tpme;
}
/**
* Getter for <code>PlayerSettings.settingsRejectTpMessage</code>.
*/
public String getSettingsrejecttpmessage() {
return this.settingsrejecttpmessage;
}
/**
* Setter for <code>PlayerSettings.settingsRejectTpMessage</code>.
*/
public void setSettingsrejecttpmessage(String settingsrejecttpmessage) {
this.settingsrejecttpmessage = settingsrejecttpmessage;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final PlayersettingsBO other = (PlayersettingsBO) obj;
if (this.uid == null) {
if (other.uid != null)
return false;
}
else if (!this.uid.equals(other.uid))
return false;
if (this.displayswitch == null) {
if (other.displayswitch != null)
return false;
}
else if (!this.displayswitch.equals(other.displayswitch))
return false;
if (this.showtime == null) {
if (other.showtime != null)
return false;
}
else if (!this.showtime.equals(other.showtime))
return false;
if (this.tpme == null) {
if (other.tpme != null)
return false;
}
else if (!this.tpme.equals(other.tpme))
return false;
if (this.settingsrejecttpmessage == null) {
if (other.settingsrejecttpmessage != null)
return false;
}
else if (!this.settingsrejecttpmessage.equals(other.settingsrejecttpmessage))
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.uid == null) ? 0 : this.uid.hashCode());
result = prime * result + ((this.displayswitch == null) ? 0 : this.displayswitch.hashCode());
result = prime * result + ((this.showtime == null) ? 0 : this.showtime.hashCode());
result = prime * result + ((this.tpme == null) ? 0 : this.tpme.hashCode());
result = prime * result + ((this.settingsrejecttpmessage == null) ? 0 : this.settingsrejecttpmessage.hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("PlayersettingsBO (");
sb.append(uid);
sb.append(", ").append(displayswitch);
sb.append(", ").append(showtime);
sb.append(", ").append(tpme);
sb.append(", ").append(settingsrejecttpmessage);
sb.append(")");
return sb.toString();
}
}

View File

@@ -133,18 +133,32 @@ public class LocationnotepadPO extends UpdatableRecordImpl<LocationnotepadPO> {
return (BigDecimal) get(7);
}
/**
* Setter for <code>LocationNotepad.isFixed</code>.
*/
public void setIsfixed(Boolean value) {
set(8, value);
}
/**
* Getter for <code>LocationNotepad.isFixed</code>.
*/
public Boolean getIsfixed() {
return (Boolean) get(8);
}
/**
* Setter for <code>LocationNotepad.isDelete</code>.
*/
public void setIsdelete(Boolean value) {
set(8, value);
set(9, value);
}
/**
* Getter for <code>LocationNotepad.isDelete</code>.
*/
public Boolean getIsdelete() {
return (Boolean) get(8);
return (Boolean) get(9);
}
// -------------------------------------------------------------------------
@@ -170,7 +184,7 @@ public class LocationnotepadPO extends UpdatableRecordImpl<LocationnotepadPO> {
/**
* Create a detached, initialised LocationnotepadPO
*/
public LocationnotepadPO(Integer id, String uid, String world, String name, Integer x, Integer y, Integer z, BigDecimal time, Boolean isdelete) {
public LocationnotepadPO(Integer id, String uid, String world, String name, Integer x, Integer y, Integer z, BigDecimal time, Boolean isfixed, Boolean isdelete) {
super(LocationnotepadTB.LOCATIONNOTEPAD);
setId(id);
@@ -181,6 +195,7 @@ public class LocationnotepadPO extends UpdatableRecordImpl<LocationnotepadPO> {
setY(y);
setZ(z);
setTime(time);
setIsfixed(isfixed);
setIsdelete(isdelete);
resetChangedOnNotNull();
}
@@ -200,6 +215,7 @@ public class LocationnotepadPO extends UpdatableRecordImpl<LocationnotepadPO> {
setY(value.getY());
setZ(value.getZ());
setTime(value.getTime());
setIsfixed(value.getIsfixed());
setIsdelete(value.getIsdelete());
resetChangedOnNotNull();
}

View File

@@ -0,0 +1,141 @@
/*
* This file is generated by jOOQ.
*/
package ling.database.tables.records;
import ling.database.tables.PlayersettingsTB;
import ling.database.tables.pojos.PlayersettingsBO;
import org.jooq.Record1;
import org.jooq.impl.UpdatableRecordImpl;
/**
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" })
public class PlayersettingsPO extends UpdatableRecordImpl<PlayersettingsPO> {
private static final long serialVersionUID = 1L;
/**
* Setter for <code>PlayerSettings.UID</code>.
*/
public void setUid(String value) {
set(0, value);
}
/**
* Getter for <code>PlayerSettings.UID</code>.
*/
public String getUid() {
return (String) get(0);
}
/**
* Setter for <code>PlayerSettings.displaySwitch</code>.
*/
public void setDisplayswitch(Boolean value) {
set(1, value);
}
/**
* Getter for <code>PlayerSettings.displaySwitch</code>.
*/
public Boolean getDisplayswitch() {
return (Boolean) get(1);
}
/**
* Setter for <code>PlayerSettings.showTime</code>.
*/
public void setShowtime(Boolean value) {
set(2, value);
}
/**
* Getter for <code>PlayerSettings.showTime</code>.
*/
public Boolean getShowtime() {
return (Boolean) get(2);
}
/**
* Setter for <code>PlayerSettings.tpMe</code>.
*/
public void setTpme(Boolean value) {
set(3, value);
}
/**
* Getter for <code>PlayerSettings.tpMe</code>.
*/
public Boolean getTpme() {
return (Boolean) get(3);
}
/**
* Setter for <code>PlayerSettings.settingsRejectTpMessage</code>.
*/
public void setSettingsrejecttpmessage(String value) {
set(4, value);
}
/**
* Getter for <code>PlayerSettings.settingsRejectTpMessage</code>.
*/
public String getSettingsrejecttpmessage() {
return (String) get(4);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
@Override
public Record1<String> key() {
return (Record1) super.key();
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached PlayersettingsPO
*/
public PlayersettingsPO() {
super(PlayersettingsTB.PLAYERSETTINGS);
}
/**
* Create a detached, initialised PlayersettingsPO
*/
public PlayersettingsPO(String uid, Boolean displayswitch, Boolean showtime, Boolean tpme, String settingsrejecttpmessage) {
super(PlayersettingsTB.PLAYERSETTINGS);
setUid(uid);
setDisplayswitch(displayswitch);
setShowtime(showtime);
setTpme(tpme);
setSettingsrejecttpmessage(settingsrejecttpmessage);
resetChangedOnNotNull();
}
/**
* Create a detached, initialised PlayersettingsPO
*/
public PlayersettingsPO(PlayersettingsBO value) {
super(PlayersettingsTB.PLAYERSETTINGS);
if (value != null) {
setUid(value.getUid());
setDisplayswitch(value.getDisplayswitch());
setShowtime(value.getShowtime());
setTpme(value.getTpme());
setSettingsrejecttpmessage(value.getSettingsrejecttpmessage());
resetChangedOnNotNull();
}
}
}