Skip to content

Commit

Permalink
added messages, fixed sign header color
Browse files Browse the repository at this point in the history
  • Loading branch information
EtienneDx committed Sep 8, 2021
1 parent a145048 commit 3aebd13
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ target/*
build.bat
/bin/
/target/
.vscode
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 17 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/me/EtienneDx/RealEstate/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
46 changes: 25 additions & 21 deletions src/me/EtienneDx/RealEstate/Messages.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion src/me/EtienneDx/RealEstate/Transactions/ClaimLease.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/me/EtienneDx/RealEstate/Transactions/ClaimRent.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down
2 changes: 1 addition & 1 deletion src/me/EtienneDx/RealEstate/Transactions/ClaimSell.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public TransactionsStore()
public void run()
{
Iterator<ClaimRent> ite = claimRent.values().iterator();
int i = 0;
while(ite.hasNext())
{
if(ite.next().update())
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 3aebd13

Please sign in to comment.