多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
> config.yml ``` pxp: #www.pxpmc.com的用户名/邮箱/手机号 user: '' #www.pxpmc.com内该插件的令牌码,在下载旁边的其他操作获得 key: '' #储存引擎 storage: #储存引擎 #支持 mysql type: "mysql" #mysql的设置 mysql: #连接地址 url: "127.0.0.1" #库名 table: "px" #表前缀 table-prefix: "px_" #连接参数,默认为空"",不懂留空即可 params: "" #用户名 user: "root" #用户密码 password: "root" #连接池的连接数,默认1,一般给稳定玩家数量/2即可 max-line: 2 #ui类型 ui: 'germ' #维护设置 maintenance-setting: # 需要设定一个主端为维护端 # 推荐使用人数少的端做为维护端 # 如果只开单端,填 true 即可 # 该值默认值为: false is-main: true #维护费用 #int maintenanceMoney(Store store); maintenance-money: |- //每个货柜增加5000和默认3000的维护费用 return store.getAmount() * 5000 + 3000; #基础设置 setting: #每个玩家可创建的商铺数量 #支持脚本,可以做权限判定 #int maxStore(Player player); max-store: 2 #每个商铺最多具有几个柜台(不支持脚本) max-page: 10 #每个柜台有多少个商品格子(不支持脚本) max-slot: 25 #扩张柜台的价格 #amount = 当前柜台数量 #int buyShopPrice(int amount,Store store); buy-shop-price: 50000 #税收 #double tax(Store store); tax: 0.05 #货币接口 #这种写法可以动态接入任何经济插件 money: #查询玩家货币 #double get(Player player); get: |- //MoneyAPI是PxTools内的一个库类,兼容的是Vault插件的经济(需要有一款给予Vault写的经济插件) //如果没在PxTools安装这个类库,可以在 https://www.kancloud.cn/qq245271830/pxpmc/content/PxTools/%E4%B8%80%E4%BA%9B%E9%80%9A%E7%94%A8%E7%9A%84%E5%B7%A5%E5%85%B7%E7%B1%BB/Vault.md 下载并安装 return MoneyAPI.get(player); #拿走玩家货币 #boolean make(Player player,double amount); make: |- return MoneyAPI.add(player,(0.0-amount)); #给予玩家货币 #boolean give(Player player,double amount); give: |- return MoneyAPI.add(player,amount); #货币名字 name: |- return "游戏币"; #名字验证器,返回false时,将不通过设定 #默认返回true #boolean nameValidator(Player player,String text); name-validator: |- if(text.contains("MD") || text.contains("操") || text.contains("草") || text.contains("艹") || text.contains("GM") || text.contains("管理")){ player.sendMessage("&c名字中不能含有敏感字符!!!"); return false; } else return true; #介绍验证器,返回false时,将不通过设定 #默认返回true #boolean introductionValidator(Player player,String text); introduction-validator: |- if(text.contains("MD") || text.contains("操") || text.contains("草") || text.contains("艹") || text.contains("GM") || text.contains("管理")){ player.sendMessage("&c介绍中不能含有敏感字符!!!"); return false; } else return true; #物品验证器,返回false时,将不可上架到商铺内 #默认返回true #boolean itemValidator(Player player,ItemStack itemStack); item-validator: |- //下面注释的内容为直接获取pxrpg的物品是否为"已绑定" //删除 /* */ 即可使用 /* import com.pxpmc.tools.nbt.api.NBTAPI; import com.pxpmc.tools.nbt.api.NBTCompound; NBTCompound nbt = NBTAPI.getItemNBT(itemStack); if(nbt.hasKey("PxRpg")){ NBTCompound pxrpg = nbt.getCompound("PxRpg"); NBTCompound data = pxrpg.getCompound("data"); if("已绑定".equals(data.getString("bind"))) { player.sendMessage("&c已绑定的物品无法上架"); return false; } }else */ if(itemStack.hasItemMeta()){ ItemMeta im = itemStack.getItemMeta(); if(im.hasLore()){ List lore = im.getLore(); for(String line : lore){ if(line.contains("已绑定")){ //当lore中含有 "已绑定" 就无法上架 player.sendMessage("&c已绑定的物品无法上架"); return false; }else if(line.contains("无法交易")){ //当lore中含有 "无法交易" 就无法上架 player.sendMessage("&c无法交易的物品无法上架"); return false; } } } } return true; #获取物品的唯一标识,用于记录近期成交价 #如果返回null或者"" 则不记录 #String itemUniqueId(ItemStack itemStack); item-unique-id: |- //下列为一个简单的例子,获取pxrpg item/gem/equip的唯一ID /* import com.pxpmc.tools.nbt.api.NBTAPI; import com.pxpmc.tools.nbt.api.NBTCompound; NBTCompound nbt = NBTAPI.getItemNBT(itemStack); if(nbt.hasKey("PxRpg")){ NBTCompound pxRpg = nbt.getCompound("PxRpg"); NBTCompound data = pxRpg.getCompound("data"); String type = pxRpg.getString("type"); if("equip".equals(type)) //是装备 return pxRpg.getString("type") +"_"+pxRpg.getString("id"); else if("item".equals(type)){ //是道具 //这里是用 PxItemExtend 写的一个道具,可以删除 NBTCompound extend = data.getCompound("extend"); if(extend.hasKey("要诀")){ NBTCompound sub = extend.getCompound("要诀"); if(sub.hasKey("技能")) return pxRpg.getString("type") +"_"+pxRpg.getString("id")+"_"+sub.getString("技能"); } //道具的通用模式 return pxRpg.getString("type") +"_"+pxRpg.getString("id")+ "_"+data.getInt("level"); //是宝石 }else return pxRpg.getString("type") +"_"+pxRpg.getString("id")+ "_"+data.getInt("level"); } */ return null; #事件 events: #修改名字 change-name: #修改之前鉴权,返回false将不继续执行,没特殊要求可直接返回true #在这之前会先调用名字验证器判定是否合格 #boolean before(Player player,Store store,String text); before: |- if(store.hasMoney(200000)) return true; player.sendMessage("商铺资金不足200000"); return false; #修改成功之后,没特殊要求可直接返回 #一般用作于条件达成之后减少相应的内容,比如减少商铺资金20W #void before(Player player,Store store,String text); after: |- store.addMoney(-200000); #修改介绍 change-introduction: #修改之前鉴权,返回false将不继续执行,没特殊要求可直接返回true #在这之前会先调用介绍验证器判定是否合格 #boolean before(Player player,Store store,String text); before: |- if(store.hasMoney(200000)) return true; player.sendMessage("商铺资金不足200000"); return false; #修改成功之后,没特殊要求可直接返回 #void before(Player player,Store store,String text); after: |- store.addMoney(-200000); #开始营业 start-trade: #玩家自主开始营业之前鉴权,返回false将无法开始营业,没特殊要求可直接返回true #boolean before(Player player,Store store); before: true #开启营业之后 after: return; #开始营业 stop-trade: #玩家自主停止营业之前鉴权,返回false将无法开始营业,没特殊要求可直接返回true #boolean before(Player player,Store store); before: true #停止营业之后 after: return; ```