Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
6a7d106d31 | |||
79f3f8e3d2 | |||
d50d9b42c4 | |||
b0c3fea730 | |||
04cfd1b89e |
28
README.md
28
README.md
@ -1,7 +1,7 @@
|
|||||||
# Paid signs
|
# Paid signs
|
||||||
|
|
||||||
The paid-signs plugin is a plugin that lets you add costs for creating plugin signs. This allows restricting usage of
|
The paid-signs plugin is a plugin that lets you add costs for creating plugin signs. This allows restricting usage of
|
||||||
signs such as CraftBook's gate/lift and other signs while still allowing every player to use the signs.
|
signs such as CraftBook's gate/lift and other signs while still allowing every player to create the signs.
|
||||||
|
|
||||||
Note: OP players, and players with the '*' permission will have the `paidsigns.paymentexempt` permission and will not
|
Note: OP players, and players with the '*' permission will have the `paidsigns.paymentexempt` permission and will not
|
||||||
see any payment messages. For testing, you'll need to un-set the `paidsigns.paymentexempt` permission.
|
see any payment messages. For testing, you'll need to un-set the `paidsigns.paymentexempt` permission.
|
||||||
@ -25,8 +25,9 @@ There are three ways this can be solved:
|
|||||||
1. Make the player (or anyone else) place an empty sign in the same location and break it again. The player should be
|
1. Make the player (or anyone else) place an empty sign in the same location and break it again. The player should be
|
||||||
refunded as long as refunds are enabled.
|
refunded as long as refunds are enabled.
|
||||||
2. Reload PaidSigns. The player should be refunded as long as refunds are enabled.
|
2. Reload PaidSigns. The player should be refunded as long as refunds are enabled.
|
||||||
3. Restart the server. The player should be refunded as long as refunds are enabled. Never place a new paid sign in this
|
3. Restart the server. The player should be refunded as long as refunds are enabled. Never place a new paid sign in the
|
||||||
situation, as the old sign will be overwritten, and the ability to refund the player automatically will be lost.
|
same location in this situation, as the old sign will be overwritten, and the ability to refund the player
|
||||||
|
automatically will be lost.
|
||||||
|
|
||||||
### Players have to pay for signs, even if the plugin sign isn't created
|
### Players have to pay for signs, even if the plugin sign isn't created
|
||||||
|
|
||||||
@ -44,6 +45,14 @@ This plugin is known to be helpful with two tasks:
|
|||||||
2. Add a swearing jar/swearing filter to the server. This can be done with a paid sign matching ANY condition, where the
|
2. Add a swearing jar/swearing filter to the server. This can be done with a paid sign matching ANY condition, where the
|
||||||
list of swear words is given as a regEx. The same regEx should be added for each of the four sign lines.
|
list of swear words is given as a regEx. The same regEx should be added for each of the four sign lines.
|
||||||
|
|
||||||
|
## Custom parser
|
||||||
|
|
||||||
|
Before anything else, it's important to note that as an experiment, I used a custom command-parser for this plugin. This
|
||||||
|
means that sign names can contain spaces, as long as the name is in quotes. In most cases, this actually works fine,
|
||||||
|
even though it differs a lot from the default behavior, but if you tab-complete the first word in the name first, and
|
||||||
|
then try to tab-complete the rest, tab-completion will fill in the second world with the entire name, which is
|
||||||
|
unfortunate. That's really just how tab-completion works, and not something I think I can do anything with.
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
An argument marked by "<>" is required to execute the command. An argument marked by "[]" is optional. For empty
|
An argument marked by "<>" is required to execute the command. An argument marked by "[]" is optional. For empty
|
||||||
@ -62,8 +71,6 @@ arguments, such as no paid sign permission, you should use empty quotes ("").
|
|||||||
|
|
||||||
## Command explanation
|
## Command explanation
|
||||||
|
|
||||||
### /paidsigns
|
|
||||||
|
|
||||||
### /addpaidsign
|
### /addpaidsign
|
||||||
|
|
||||||
This command adds a new paid sign that does nothing until a condition is added.
|
This command adds a new paid sign that does nothing until a condition is added.
|
||||||
@ -99,10 +106,11 @@ a paid sign condition to a line that already has one will replace the previous c
|
|||||||
|
|
||||||
This lists registered paid signs and paid sign conditions. No arguments will print a list of paid signs
|
This lists registered paid signs and paid sign conditions. No arguments will print a list of paid signs
|
||||||
|
|
||||||
`/listpaidsigns [name (of a paid sign)] [line number]`
|
`/listpaidsigns [page number]/[name (of a paid sign)] [line number]`
|
||||||
|
|
||||||
| Argument | Usage |
|
| Argument | Usage |
|
||||||
| ----- | ----- |
|
| ----- | ----- |
|
||||||
|
| page number | Paid signs are listed 7 at a time, so the page number is used to see the next 7 |
|
||||||
| name | The name of the paid sign to see information about |
|
| name | The name of the paid sign to see information about |
|
||||||
| line number | The line number of the condition to see information about |
|
| line number | The line number of the condition to see information about |
|
||||||
|
|
||||||
@ -163,9 +171,11 @@ Removes a registered paid sign
|
|||||||
## Language customization
|
## Language customization
|
||||||
|
|
||||||
All strings, even time units, are customizable. If you place a strings.yml file in the plugin folder, it will take
|
All strings, even time units, are customizable. If you place a strings.yml file in the plugin folder, it will take
|
||||||
priority over built-in languages. If you want to change strings, look at PaidSigns/src/main/resources/strings.yml for
|
priority over built-in languages. If you want to change strings, look
|
||||||
the proper keys. All strings have the format: ENUM: "Displayed string". The enum must be identical as it defines which
|
at [PaidSigns/src/main/resources/strings.yml](https://git.knarcraft.net/EpicKnarvik97/PaidSigns/src/branch/master/src/main/resources/strings.yml)
|
||||||
string you have changed. All strings belonging to a language are beneath the language code and indented with two spaces.
|
for the proper keys. All strings have the format: ENUM: "Displayed string". The enum must be identical as it defines
|
||||||
|
which string you have changed. All strings belonging to a language are beneath the language code and indented with two
|
||||||
|
spaces.
|
||||||
|
|
||||||
The easiest way to add a new language is to copy an existing language and paste it into your custom strings.yml and
|
The easiest way to add a new language is to copy an existing language and paste it into your custom strings.yml and
|
||||||
change strings as necessary. If you don't include all strings, the remaining will use the built-in English translation.
|
change strings as necessary. If you don't include all strings, the remaining will use the built-in English translation.
|
||||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.knarcraft</groupId>
|
<groupId>net.knarcraft</groupId>
|
||||||
<artifactId>paidsigns</artifactId>
|
<artifactId>paidsigns</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Paid Signs</name>
|
<name>Paid Signs</name>
|
||||||
|
@ -77,6 +77,13 @@ public final class TrackedSignManager {
|
|||||||
for (String key : signSection.getKeys(false)) {
|
for (String key : signSection.getKeys(false)) {
|
||||||
loadSign(signSection, key);
|
loadSign(signSection, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Save tracked signs in case some were invalidated after loading
|
||||||
|
try {
|
||||||
|
TrackedSignManager.saveTrackedSigns();
|
||||||
|
} catch (IOException e) {
|
||||||
|
PaidSigns.getInstance().getLogger().log(Level.WARNING, "Unable to save tracked signs");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,9 +111,11 @@ public final class TrackedSignManager {
|
|||||||
|
|
||||||
//Prevent destroyed signs from being tracked indefinitely
|
//Prevent destroyed signs from being tracked indefinitely
|
||||||
if (!(signLocation.getBlock().getState() instanceof Sign)) {
|
if (!(signLocation.getBlock().getState() instanceof Sign)) {
|
||||||
PaidSigns.getInstance().getLogger().log(Level.WARNING, "The sign at " + signLocation + " no longer " +
|
Bukkit.getScheduler().scheduleSyncDelayedTask(PaidSigns.getInstance(), () -> {
|
||||||
"exists. Removing from sign tracker. Refunding the player.");
|
PaidSigns.getInstance().getLogger().log(Level.WARNING, "The sign at " + signLocation +
|
||||||
refund(trackedSign, true);
|
" no longer exists. Removing from sign tracker. Refunding the player.");
|
||||||
|
refund(trackedSign, true);
|
||||||
|
}, 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +127,7 @@ public final class TrackedSignManager {
|
|||||||
*
|
*
|
||||||
* @throws IOException <p>If unable to write to the data file</p>
|
* @throws IOException <p>If unable to write to the data file</p>
|
||||||
*/
|
*/
|
||||||
private static void saveTrackedSigns() throws IOException {
|
public static void saveTrackedSigns() throws IOException {
|
||||||
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(signsFile);
|
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(signsFile);
|
||||||
ConfigurationSection signSection = configuration.createSection("trackedSigns");
|
ConfigurationSection signSection = configuration.createSection("trackedSigns");
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ description: Add costs for creating plugin signs
|
|||||||
website: https://git.knarcraft.net/EpicKnarvik97/PaidSigns
|
website: https://git.knarcraft.net/EpicKnarvik97/PaidSigns
|
||||||
commands:
|
commands:
|
||||||
paidsigns:
|
paidsigns:
|
||||||
description: Displays information about paid signs commends
|
description: Displays information about paid signs commands
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permission: paidsigns.info
|
permission: paidsigns.info
|
||||||
addpaidsign:
|
addpaidsign:
|
||||||
|
Reference in New Issue
Block a user