本帖最后由 名副其实 于 2022-7-27 22:22 编辑 
【前言】
2022/7/19 0:45
挖坑。虽然量不多但足够逼着我连同 PlayerPoints 一起翻译完了。
2022/7/27 22:22
填坑。总算是把这个玩意给弄好了,下次再也不敢随便挖坑了,累死个人。XP
原贴地址: https://foresttech.gitbook.io/redshop/
SpigotMC 地址: https://www.spigotmc.org/resourc ... al-for-money.96723/
【导引】
【前言】
2022/7/19 0:45
挖坑。虽然量不多但足够逼着我连同 PlayerPoints 一起翻译完了。
2022/7/27 22:22
填坑。总算是把这个玩意给弄好了,下次再也不敢随便挖坑了,累死个人。XP
原贴地址: https://foresttech.gitbook.io/redshop/
SpigotMC 地址: https://www.spigotmc.org/resourc ... al-for-money.96723/
【导引】
| 插件介绍 初次使用 插件安装 config.yml frameshop.yml redclick.yml 开发者 API 自定义货币 | 
 本帖最后由 名副其实 于 2022-7-27 21:47 编辑 
RedShop
非官方翻译的中文维基页面。
欢迎来到本插件的主页!本插件是那些想要追求创造性与全新机制服务器的不二之选!
RedShop 允许你出售红石信号赚钱!你想要让你的红石机器收费激活吗?现在有了这插件,你做得到。你是否在游戏内建造了抽奖机?现在可以用本插件,通过更简单的方式来激活机器。你需要的只是一个告示牌!
我们同样支持多经济插件。如果你不能在配置文本里面见到你想要的相关设置,请在 Discord 群组服上联系我们。
本插件的 SpigotMC 资源帖: https://www.spigotmc.org/resourc ... al-for-money.96723/
本插件的 Discord 官方群组服: https://discord.gg/2PpdrfxhD4
【脚注】
[注1] 原文如此。应当改为 "other"。
RedShop
非官方翻译的中文维基页面。
Welcome on the main page of the RedShop's wiki! Plugin is made for economy servers that want something new and creative!
RedShop offers your players to sell redstone signal for money! Do you want to sell activation of your machine to toher[注1] players? You can sell it. Do you have some in-game gamble machine? You can sell it's activaiton. All you need is sign!
We also support multiple currencies! If you can't see your own in the config file, tell us on Discord.
欢迎来到本插件的主页!本插件是那些想要追求创造性与全新机制服务器的不二之选!
RedShop 允许你出售红石信号赚钱!你想要让你的红石机器收费激活吗?现在有了这插件,你做得到。你是否在游戏内建造了抽奖机?现在可以用本插件,通过更简单的方式来激活机器。你需要的只是一个告示牌!
我们同样支持多经济插件。如果你不能在配置文本里面见到你想要的相关设置,请在 Discord 群组服上联系我们。
本插件的 SpigotMC 资源帖: https://www.spigotmc.org/resourc ... al-for-money.96723/
本插件的 Discord 官方群组服: https://discord.gg/2PpdrfxhD4
【脚注】
[注1] 原文如此。应当改为 "other"。
 本帖最后由 名副其实 于 2022-7-27 21:48 编辑 
安装本插件
1. 停止你的服务器。
2. 将插件本体(RedShop.jar)放入服务器 /plugins 文件夹下。
3. 开启你的服务器。
4. 根据喜好编辑配置文件 (见配置文件章节)。
5. 重启你的服务器。
6. 大功告成!
安装本插件
1. Stop your server
2. Put RedShop.jar into your plugins folder
3. Start your server
4. Edit your configuration (see Configuration section)
5. Restart your server
6. Done!
1. 停止你的服务器。
2. 将插件本体(RedShop.jar)放入服务器 /plugins 文件夹下。
3. 开启你的服务器。
4. 根据喜好编辑配置文件 (见配置文件章节)。
5. 重启你的服务器。
6. 大功告成!
 本帖最后由 名副其实 于 2022-7-27 22:08 编辑 
config.yml
语言选项
你可以在这个设置所在的位置决定本插件在服务器中所使用的语言。本插件默认支持英语,但你可以通过添加文件 message_<语言名称>.yml 的方式创建自己的语言。复制代码日期显示
当玩家使用本插件的展示框商店功能购买物品时,告示牌可用于记录购买某物品的日期。你可以在下列设置处更改插件显示时间的格式。支持显示的时间格式全列表可以在这里找到:
https://docs.oracle.com/javase/7 ... mpleDateFormat.html复制代码数量显示
我们想要为货币显示样式提供多样的支持。你可以使用下列的四种样式。
样式1复制代码
样式2复制代码
样式3复制代码
样式4复制代码多经济
我们支持许多许多的多经济插件。你也可以同时使用许多种类的货币——这都取决于你。
! 你也可以通过下面章节所述的 API 来添加自定义种类的货币!复制代码
模块
你只能同时启用下列模块中的一个!可以在下列的设置中修改启用的模块。复制代码
config.yml
语言选项
You can edit the messages file using this setting in your config file. Plugin supports english by default, but you can add your custom language by adding messages_<tag>.yml file.
你可以在这个设置所在的位置决定本插件在服务器中所使用的语言。本插件默认支持英语,但你可以通过添加文件 message_<语言名称>.yml 的方式创建自己的语言。
- lang: en
When user buys something using FrameShop, the sign can contain date of the purchase. You can edit the display format of the date using following setting. Full list of supported date formats is here: https://docs.oracle.com/javase/7 ... mpleDateFormat.html
当玩家使用本插件的展示框商店功能购买物品时,告示牌可用于记录购买某物品的日期。你可以在下列设置处更改插件显示时间的格式。支持显示的时间格式全列表可以在这里找到:
https://docs.oracle.com/javase/7 ... mpleDateFormat.html
- # This will write date in following format: 28.03.2021 14:54:22
 
- dateFormat: "dd.MM.yyyy HH:mm:ss"
We wanted to provide support for multiple price display formats. You can use following.
我们想要为货币显示样式提供多样的支持。你可以使用下列的四种样式。
样式1
- # XXX,XXX.### (e.g. 154,798.20 $) - default
 
- priceDisplayFormat: 1
样式2
- # XXX XXX,### (e.g. 154 798,20 $)
 
- priceDisplayFormat: 2
样式3
- # XXX.XXX,### (e.g. 154.798,20 $)
 
- priceDisplayFormat: 3
样式4
- # XXX XXX.### (e.g. 154 798.20 $)
 
- priceDisplayFormat: 4
We provide support for many currency plugins. You can also use multiple at once - it's just up to you.
我们支持许多许多的多经济插件。你也可以同时使用许多种类的货币——这都取决于你。
! 你也可以通过下面章节所述的 API 来添加自定义种类的货币!
- # List of supported currencies. You can register your own currency using RedShop API
 
- # Make sure the corresponding plugin is installed and enabled on your server before enabling
 
- currencies:
 
-   # Default currency used by Vault plugin (required economy plugin, such as CMI/Essentials etc.)
 
-   vault:
 
-     # Whether the Vault currency should be enabled
 
-     enabled: true
 
-     # Display name of the currency (!must be unique!)
 
-     # Full name is used in signs as display name of the currency
 
-     # The value is case-sensitive
 
-     # NOTE! If you change this line, already existing signs won't work anymore!!!
 
-     fullname: "Dollars"
 
-     # Symbol of the currency (!must be unique!)
 
-     # Currency symbol can be also used as alias in shop sign creation
 
-     # The value is case-sensitive
 
-     symbol: "[        DISCUZ_CODE_6        ]quot;
 
-     # List of aliases used by players in shop signs (!must be unique!)
 
-     # The value is case-insensitive
 
-     # After sign is created, the alias will be updated to fullname
 
-     aliases:
 
-       - "dollars"
 
-       - "dol"
 
-   # Experience points as currency (requires nothing else)
 
-   exp:
 
-     enabled: true
 
-     fullname: "Experience"
 
-     symbol: "EXP"
 
-     aliases:
 
-       - "xp"
 
-       - "exp"
 
-   # TokenManager plugin integration (requires TokenManager installed)
 
-   tokenmanager:
 
-     enabled: false
 
-     fullname: "TokenManager"
 
-     symbol: "TM"
 
-     aliases:
 
-       - "tm"
 
-   # PlayerPoints plugin integration (requires PlayerPoints installed)
 
-   playerpoints:
 
-     enabled: false
 
-     fullname: "PlayerPoints"
 
-     symbol: "PP"
 
-     aliases:
 
-       - "plpoints"
 
-   # BeastTokens plugin integration (requires BeastTokens installed)
 
-   beasttokens:
 
-     enabled: false
 
-     fullname: "BeastTokens"
 
-     symbol: "BT"
 
-     aliases:
 
-       - "btoken"
 
- - "btokens"
模块
You can enable only one of the module! Just enable/disable them.
你只能同时启用下列模块中的一个!可以在下列的设置中修改启用的模块。
- modules:
 
-   frameshop: true
 
- redclick: true
 本帖最后由 名副其实 于 2022-7-27 22:11 编辑 
frameshop.yml/redclick.yml[注1]
支持货币
在该区域内你可以决定玩家可以在该模块内使用哪个种类的货币。
! 所有货币名称都应小写。若要使用默认的硬币,请使用 "vault" 作为其名称而不是 "Dollars"复制代码
默认货币
默认货币是当玩家没有任何货币时使用的货币种类。这里的货币必须是上述多货币中出现过的。复制代码
Discord 记录
Discord 记录器可有效监控玩家行为。你也可以设置自定义衔接网页,决定哪一种聊天软件?会被用于记录新商店等信息。复制代码
【脚注】
[注1] 由于 redclick.yml 与 frameshop.yml 结构一致,故仅保留后者的翻译页面。
frameshop.yml/redclick.yml[注1]
支持货币
In currencies section you can configure what currencies can players use in this module.
在该区域内你可以决定玩家可以在该模块内使用哪个种类的货币。
! 所有货币名称都应小写。若要使用默认的硬币,请使用 "vault" 作为其名称而不是 "Dollars"
- currencies:
 
-   - "vault"
 
-   - "tokenmanager"
 
-   - "playerpoints"
 
-   - "beasttokens"
 
- - "exp"
默认货币
Default currency is used when players don't fill last (currency) line. The selected currency must be enabled and added to currencies list above.
默认货币是当玩家没有任何货币时使用的货币种类。这里的货币必须是上述多货币中出现过的。
- defaultCurrency: "vault"
Discord 记录
Discord logger is useful for monitoring activity of the players. You can setup custom webhook which will be used to send information about new shops etc.
Discord 记录器可有效监控玩家行为。你也可以设置自定义衔接网页,决定哪一种聊天软件?会被用于记录新商店等信息。
- # Discord logger configuration
 
- discordLogger:
 
-   # Enable Discord logging
 
-   enabled: false
 
-   # Webhook URL (find more here: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks)
 
-   webhook: https://discord.com/api/webhooks/WEBHOOK_CODE_HERE
 
-   # List of logged events
 
-   loggedEvents:
 
-     shopCreate: false
 
-     shopRemove: false
 
- shopBuy: false
【脚注】
[注1] 由于 redclick.yml 与 frameshop.yml 结构一致,故仅保留后者的翻译页面。
 本帖最后由 名副其实 于 2022-7-27 22:21 编辑 
自定义货币
构造函数相关参数
Fullname - 货币全称,这些名称将被用在告示牌上。
! 不同货币之间名称不可重复。
Enabled - 何时货币才会启用。
Symbol - 货币在信息中使用的单位后缀。
! 不同货币之间后缀不可重复。
Aliases - 除货币本身名称外,玩家还可在创建商店过程中使用的货币别名。
! 不同货币之间别名不可重复。
Offline - 决定本货币是否能够处理下线玩家。若设置为 false,那么你可以使用方法 在 #giveAmount 中操作线下玩家,这样本插件就可以保证在玩家不在线时能够保存数据,同时在玩家上线时确保交易完成。详细请见下列代码。
ExampleCurrency.java
Main.java
自定义货币
构造函数相关参数
Fullname - 货币全称,这些名称将被用在告示牌上。
! 不同货币之间名称不可重复。
Enabled - 何时货币才会启用。
Symbol - 货币在信息中使用的单位后缀。
! 不同货币之间后缀不可重复。
Aliases - 除货币本身名称外,玩家还可在创建商店过程中使用的货币别名。
! 不同货币之间别名不可重复。
Offline - 决定本货币是否能够处理下线玩家。若设置为 false,那么你可以使用方法 在 #giveAmount 中操作线下玩家,这样本插件就可以保证在玩家不在线时能够保存数据,同时在玩家上线时确保交易完成。详细请见下列代码。
ExampleCurrency.java
ExampleCurrency.java JAVA
/**
* Your currency object needs to extend SupportedCurrency abstract class
*/
public class ExampleCurrency extends SupportedCurrency {
//Your economy class
private ExampleEconomy myEconomy;
/**
* Currency constructor. You can use your own variables if needed.
*
* Fun-fact: Check config.yml - you can see we use the same system for pre-defined currencies
*/
public ExampleCurrency() {
//Calling abstract class constructor - REQUIRED!
super(
"ExampleDollars", //used as display name on signs, MUST BE UNIQUE!
true, //if the currency is available (enabled)
"$", //symbol used as suffix in messages, MUST BE UNIQUE!
Arrays.asList("dol", "doll"), //list of aliases players can use instead of fullname, MUST BE UNIQUE!
false, //if the currency/economy can handle offline player transactions - if not, we'll use pending.yml file to store the pending payments until player joins
"ExampleCurrency" //system name of the currency (usually name of the plugin), MUST BE UNIQUE!
);
if (enabled) {
//Setup your economy
myEconomy = MyPlugin.getMyEconomy();
if (myEconomy == null) {
enabled = false;
}
}
}
/**
* Shall the currency use double or integer?
*
* true = allows prices with decimal (e.g. 15.56)
* false = allows only integer prices (e.g. 15)
*/
@Override
public boolean useDoubleValues() {
return true;
}
@Override
public double getAmount(OfflinePlayer offlinePlayer) {
if (!enabled) {
return 0;
}
//Plugin checks balance of only online players, so we can cast it to Player
return myEconomy.getBalance((Player) offlinePlayer);
}
@Override
public boolean giveAmount(OfflinePlayer offlinePlayer, double amount) {
if (!enabled) {
return false;
}
//If the seller is offline and currency cannot pay offlinePlayer, we need to handle it
if (!offlinePlayer().isOnline() && !offlineReady()) {
//API method saves the amount to pending.yml and auto-pays the amount when the player joins
return giveOffline(offlinePlayer, amount);
}
//Otherwise, OfflinePlayer is online, so we can cast it to Player
return myEconomy.depositPlayer(offlinePlayer.getPlayer(), amount).transactionSuccess();
}
@Override
public boolean takeAmount(OfflinePlayer offlinePlayer, double amount) {
if (!enabled) {
return false;
}
//Plugin takes money only from online players, so we can cast it to Player
return myEconomy.withdrawPlayer((Player) offlinePlayer, amount).transactionSuccess();
}
}
Main.java
Main.java JAVA
@Override
public void onEnable() {
//... Your stuff ...
if (setupCurrency()) {
this.getServer().getConsoleSender().sendMessage("Custom RedShop currency successfully registered!");
} else {
this.getServer().getConsoleSender().sendMessage("Custom RedShop currency registration failed!");
}
//... Your other stuff ...
}
/**
* setupCurrency method registers your currency to RedShop
*
* Choose ONE of the method below - both does the same thing
*/
private boolean setupCurrency() {
/* METHOD ONE */
ExampleCurrency customCurrency = new ExampleCurrency();
return customCurrency.register();
/* METHOD TWO */
RedShop redShopAPI = this.getServer().getPluginManager().getPlugin("RedShop");
if (redShopAPI == null || redShopAPI.isEnabled()) {
//RedShop is not installed OR is disabled
return false;
}
return redShopAPI.registerCurrency(new ExampleCurrency());
}