diff --git a/.gitignore b/.gitignore index 5c2d75b..5318537 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ target/* build.bat /bin/ /target/ +.vscode \ No newline at end of file diff --git a/plugin.yml b/plugin.yml index 802974e..4ef629d 100644 --- a/plugin.yml +++ b/plugin.yml @@ -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: diff --git a/pom.xml b/pom.xml index b0a8080..ab586db 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 Me.EtienneDx RealEstate - 1.2.2 + 1.3.0-SNAPSHOT RealEstate A spigot plugin for selling, renting and leasing GriefPrevention claims @@ -25,14 +25,14 @@ maven-compiler-plugin 3.8.0 - 1.8 - 1.8 + 16 + 16 org.apache.maven.plugins maven-shade-plugin - 3.2.1 + 3.3.0-SNAPSHOT false @@ -44,6 +44,10 @@ me.EtienneDx.AnnotationConfig me.EtienneDx.RealEstate.AnnotationConfig + + me.ryanhamshire.GriefPrevention + me.EtienneDx.RealEstate.GriefPrevention + @@ -72,7 +76,7 @@ vault-repo - http://nexus.hc.to/content/repositories/pub_releases + https://nexus.hc.to/content/repositories/pub_releases aikar @@ -84,11 +88,17 @@ https://ci.ender.zone/plugin/repository/everything/ + + + maven-snapshots + https://repository.apache.org/content/repositories/snapshots/ + + org.spigotmc spigot-api - 1.16.3-R0.1-SNAPSHOT + 1.17.1-R0.1-SNAPSHOT provided @@ -112,7 +122,7 @@ com.github.EtienneDx GriefPrevention 1a4b2ea0b639c90f3858316fc4655478b5f0cdbc - provided + com.github.EtienneDx diff --git a/src/me/EtienneDx/RealEstate/Config.java b/src/me/EtienneDx/RealEstate/Config.java index b6f0e35..f86086c 100644 --- a/src/me/EtienneDx/RealEstate/Config.java +++ b/src/me/EtienneDx/RealEstate/Config.java @@ -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 cfgSigns; @ConfigField(name="RealEstate.Keywords.Sell", comment = "List of all possible possible signs headers to sell a claim") diff --git a/src/me/EtienneDx/RealEstate/Messages.java b/src/me/EtienneDx/RealEstate/Messages.java index 4d69565..189e073 100644 --- a/src/me/EtienneDx/RealEstate/Messages.java +++ b/src/me/EtienneDx/RealEstate/Messages.java @@ -1,17 +1,11 @@ package me.EtienneDx.RealEstate; -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; +import me.EtienneDx.AnnotationConfig.AnnotationConfig; +import me.EtienneDx.AnnotationConfig.ConfigField; +import me.EtienneDx.AnnotationConfig.ConfigFile; @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() { diff --git a/src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java b/src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java index 2eb7461..af8f20a 100644 --- a/src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java +++ b/src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java @@ -65,7 +65,7 @@ public boolean update() 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()); diff --git a/src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java b/src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java index 92be5ad..d288039 100644 --- a/src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java +++ b/src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java @@ -80,7 +80,7 @@ public boolean update() 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 = ""; diff --git a/src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java b/src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java index 38d6f94..db06f6c 100644 --- a/src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java +++ b/src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java @@ -37,7 +37,7 @@ public boolean update() 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) diff --git a/src/me/EtienneDx/RealEstate/Transactions/TransactionsStore.java b/src/me/EtienneDx/RealEstate/Transactions/TransactionsStore.java index 1cf30ba..ba99442 100644 --- a/src/me/EtienneDx/RealEstate/Transactions/TransactionsStore.java +++ b/src/me/EtienneDx/RealEstate/Transactions/TransactionsStore.java @@ -42,7 +42,6 @@ public TransactionsStore() public void run() { Iterator ite = claimRent.values().iterator(); - int i = 0; while(ite.hasNext()) { if(ite.next().update()) @@ -74,7 +73,6 @@ public void loadData() 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");