Fix sign error with short names
This commit is contained in:
parent
abb2ca2d57
commit
96a50c1107
4
pom.xml
4
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Me.EtienneDx</groupId>
|
||||
<artifactId>RealEstate</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.2-SNAPSHOT</version>
|
||||
<name>RealEstate</name>
|
||||
<description>A spigot plugin for selling, renting and leasing GriefPrevention claims</description>
|
||||
<build>
|
||||
@ -117,7 +117,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.EtienneDx</groupId>
|
||||
<artifactId>AnnotationConfig</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>master-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -107,7 +107,7 @@ public class ClaimRent extends BoughtTransaction
|
||||
{
|
||||
Sign s = (Sign) sign.getBlock().getState();
|
||||
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
|
||||
s.setLine(1, ("Rented by " + Bukkit.getOfflinePlayer(buyer).getName()).substring(0, 16));
|
||||
s.setLine(1, Utils.getSignString("Rented by " + Bukkit.getOfflinePlayer(buyer).getName()));
|
||||
s.setLine(2, "Time remaining : ");
|
||||
|
||||
int daysLeft = duration - days - 1;// we need to remove the current day
|
||||
|
||||
@ -30,7 +30,7 @@ public class ClaimSell extends ClaimTransaction
|
||||
Sign s = (Sign) sign.getBlock().getState();
|
||||
s.setLine(0, RealEstate.instance.config.cfgSignsHeader);
|
||||
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceSell);
|
||||
s.setLine(2, owner != null ? Bukkit.getOfflinePlayer(owner).getName() : "SERVER");
|
||||
s.setLine(2, owner != null ? Utils.getSignString(Bukkit.getOfflinePlayer(owner).getName()) : "SERVER");
|
||||
if(RealEstate.instance.config.cfgUseCurrencySymbol)
|
||||
{
|
||||
s.setLine(3, RealEstate.instance.config.cfgCurrencySymbol + " " + price);
|
||||
|
||||
@ -144,4 +144,11 @@ public class Utils
|
||||
GriefPrevention.instance.dataStore.saveClaim(claim);
|
||||
|
||||
}
|
||||
|
||||
public static String getSignString(String str)
|
||||
{
|
||||
if(str.length() > 16)
|
||||
str = str.substring(0, 16);
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user