added messages, fixed sign header color

This commit is contained in:
Etienne Dx 2021-09-08 22:32:39 +02:00
parent a14504861f
commit 3aebd137a5
9 changed files with 49 additions and 36 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ target/*
build.bat
/bin/
/target/
.vscode

View File

@ -2,8 +2,8 @@ name: RealEstate
main: me.EtienneDx.RealEstate.RealEstate
version: ${project.version}
authors: [EtienneDx, DmitryRendov]
depend: [GriefPrevention, Vault]
api-version: "1.15"
depend: [Vault]
api-version: "1.17"
commands:
re:

24
pom.xml
View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>Me.EtienneDx</groupId>
<artifactId>RealEstate</artifactId>
<version>1.2.2</version>
<version>1.3.0-SNAPSHOT</version>
<name>RealEstate</name>
<description>A spigot plugin for selling, renting and leasing GriefPrevention claims</description>
<build>
@ -25,14 +25,14 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.0-SNAPSHOT</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<relocations>
@ -44,6 +44,10 @@
<pattern>me.EtienneDx.AnnotationConfig</pattern>
<shadedPattern>me.EtienneDx.RealEstate.AnnotationConfig</shadedPattern>
</relocation>
<relocation>
<pattern>me.ryanhamshire.GriefPrevention</pattern>
<shadedPattern>me.EtienneDx.RealEstate.GriefPrevention</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
@ -72,7 +76,7 @@
</repository>
<repository>
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
<url>https://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
<repository>
<id>aikar</id>
@ -84,11 +88,17 @@
<url>https://ci.ender.zone/plugin/repository/everything/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.3-R0.1-SNAPSHOT</version>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -112,7 +122,7 @@
<groupId>com.github.EtienneDx</groupId>
<artifactId>GriefPrevention</artifactId>
<version>1a4b2ea0b639c90f3858316fc4655478b5f0cdbc</version>
<scope>provided</scope>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>com.github.EtienneDx</groupId>

View File

@ -21,7 +21,7 @@ public class Config extends AnnotationConfig
public final String chatPrefix = "[" + ChatColor.GOLD + "RealEstate" + ChatColor.WHITE + "] ";
@ConfigField(name="RealEstate.Keywords.SignsHeader", comment = "What is displayed in top of the signs")
public String cfgSignsHeader = ChatColor.GOLD + "[RealEstate]";
public String cfgSignsHeader = "$6[RealEstate]";
//public List<String> cfgSigns;
@ConfigField(name="RealEstate.Keywords.Sell", comment = "List of all possible possible signs headers to sell a claim")

View File

@ -1,18 +1,12 @@
package me.EtienneDx.RealEstate;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.PluginDescriptionFile;
import me.EtienneDx.AnnotationConfig.AnnotationConfig;
import me.EtienneDx.AnnotationConfig.ConfigField;
import me.EtienneDx.AnnotationConfig.ConfigFile;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import java.util.Arrays;
import java.util.List;
@ConfigFile(header = "Use a YAML editor like NotepadPlusPlus to edit this file. \nAfter editing, back up your changes before reloading the server in case you made a syntax error. \nUse dollar signs ($) for formatting codes, which are documented here: http://minecraft.gamepedia.com/Formatting_codes.\n You can use {0}, {1} to include the different values indicated in the comments")
public class Messages extends AnnotationConfig
{
@ -33,28 +27,38 @@ public class Messages extends AnnotationConfig
@ConfigField(name="RealEstate.RenewRentCurrently", comment = "0: enabled/disabled; 1: type of claim")
public String msgRenewRentCurrently = "$bAutomatic renew is currently $a{0} $bfor this {1}";
public String msgErrorOutOfClaim = ChatColor.RED + "You must stand inside of a claim to use this command!";
@ConfigField(name="RealEstate.Errors.OutOfClaim")
public String msgErrorOutOfClaim = "$cYou must stand inside of a claim to use this command!";
public String msgErrorPlayerOnly = ChatColor.RED + "Only Players can perform this command!";
@ConfigField(name="RealEstate.Errors.PlayerOnlyCmd")
public String msgErrorPlayerOnly = "$cOnly Players can perform this command!";
public String msgErrorNoOngoingTransaction = ChatColor.RED + "This claim has no ongoing transactions!";
@ConfigField(name="RealEstate.Errors.NoOngoingTransaction")
public String msgErrorNoOngoingTransaction = "$cThis claim has no ongoing transactions!";
public String msgErrorNotRentNorLease = ChatColor.RED + "This claim is neither to rent or to lease!";
@ConfigField(name="RealEstate.Errors.NotRentNorLease")
public String msgErrorNotRentNorLease = "$cThis claim is neither to rent or to lease!";
public String msgErrorAlreadyBought = ChatColor.RED + "This claim already has a buyer!";
@ConfigField(name="RealEstate.Errors.AlreadyBought")
public String msgErrorAlreadyBought = "$cThis claim already has a buyer!";
public String msgErrorNotPartOfTransaction = ChatColor.RED + "You are not part of this transaction!";
@ConfigField(name="RealEstate.Errors.NotPartOfTransaction")
public String msgErrorNotPartOfTransaction = "$cYou are not part of this transaction!";
public String msgErrorRentOnly = ChatColor.RED + "This command only applies to rented claims!";
@ConfigField(name="RealEstate.Errors.RentOnly")
public String msgErrorRentOnly = "$cThis command only applies to rented claims!";
public String msgErrorValueGreaterThanZero = ChatColor.RED + "The value must be greater than zero!";
@ConfigField(name="RealEstate.Errors.ValueGreaterThanZero")
public String msgErrorValueGreaterThanZero = "$cThe value must be greater than zero!";
public String msgErrorInvalidOption = ChatColor.RED + "Invalid option provided!";
@ConfigField(name="RealEstate.Errors.InvalidOption")
public String msgErrorInvalidOption = "$cInvalid option provided!";
public String msgListTransactionsHeader = ChatColor.DARK_BLUE + "----= " + ChatColor.WHITE + "[ " + ChatColor.GOLD + "{0} page " + ChatColor.DARK_GREEN + " {1}" +
ChatColor.GOLD + " / " + ChatColor.DARK_GREEN + "{2}" + ChatColor.WHITE + " ]" + ChatColor.DARK_BLUE + " =----";
@ConfigField(name="RealEstate.List.Header", comment = "0: RE Offers|Sell Offers|Rent Offers|Lease Offers; 1: Page number; 2: Page count")
public String msgListTransactionsHeader = "$1----= $f[ $6{0} page $2 {1} $6/ $2{2} $f] $1=----";
public String msgListNextPage = ChatColor.GOLD + "To see the next page, type " + ChatColor.GREEN + "/re list {0} {1}";
@ConfigField(name="RealEstate.List.NextPage", comment="0: all|sell|rent|lease; 1: next page number")
public String msgListNextPage = "$6To see the next page, type $a/re list {0} {1}";
public Messages()
{

View File

@ -65,7 +65,7 @@ public class ClaimLease extends BoughtTransaction
if(sign.getBlock().getState() instanceof Sign)
{
Sign s = (Sign)sign.getBlock().getState();
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
s.setLine(0, RealEstate.instance.messages.getMessage(RealEstate.instance.config.cfgSignsHeader));
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceLease);
//s.setLine(2, owner != null ? Bukkit.getOfflinePlayer(owner).getName() : "SERVER");
//s.setLine(2, paymentsLeft + "x " + price + " " + RealEstate.econ.currencyNamePlural());

View File

@ -80,7 +80,7 @@ public class ClaimRent extends BoughtTransaction
if(sign.getBlock().getState() instanceof Sign)
{
Sign s = (Sign) sign.getBlock().getState();
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
s.setLine(0, RealEstate.instance.messages.getMessage(RealEstate.instance.config.cfgSignsHeader));
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceRent);
//s.setLine(2, owner != null ? Bukkit.getOfflinePlayer(owner).getName() : "SERVER");
String price_line = "";

View File

@ -37,7 +37,7 @@ public class ClaimSell extends ClaimTransaction
if(sign.getBlock().getState() instanceof Sign)
{
Sign s = (Sign) sign.getBlock().getState();
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
s.setLine(0, RealEstate.instance.messages.getMessage(RealEstate.instance.config.cfgSignsHeader));
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceSell);
s.setLine(2, owner != null ? Utils.getSignString(Bukkit.getOfflinePlayer(owner).getName()) : "SERVER");
if(RealEstate.instance.config.cfgUseCurrencySymbol)

View File

@ -42,7 +42,6 @@ public class TransactionsStore
public void run()
{
Iterator<ClaimRent> ite = claimRent.values().iterator();
int i = 0;
while(ite.hasNext())
{
if(ite.next().update())
@ -74,7 +73,6 @@ public class TransactionsStore
try {
RealEstate.instance.addLogEntry(new String(Files.readAllBytes(FileSystems.getDefault().getPath(this.dataFilePath))));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ConfigurationSection sell = config.getConfigurationSection("Sell");