commit
e6867800ed
20
.github/workflows/maven-publish.yml
vendored
20
.github/workflows/maven-publish.yml
vendored
@ -1,20 +0,0 @@
|
||||
name: Publish package to GitHub Packages
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '16'
|
||||
distribution: 'adopt'
|
||||
- name: Publish package
|
||||
run: mvn --batch-mode deploy
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@ target/*
|
||||
build.bat
|
||||
/bin/
|
||||
/target/
|
||||
.vscode
|
||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -1 +0,0 @@
|
||||
{}
|
||||
22
CHANGELOG.md
Normal file
22
CHANGELOG.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
## 1.4.0
|
||||
|
||||
### Added
|
||||
* Readme and changelog files
|
||||
* Error messages to *messages.yml*
|
||||
* List messages to *messages.yml*
|
||||
* Info messages to *messages.yml*
|
||||
* Support of [GriefPrevention v16.18](https://github.com/TechFortress/GriefPrevention/releases/tag/16.18) and up
|
||||
* Disabled resizing of parent claims when subclaims are being rented
|
||||
|
||||
### Modified
|
||||
* Changed java version to java 16
|
||||
* Changed spigot version to 1.18.1 (should still support 1.17)
|
||||
* Removed requirement for custom GP jar file
|
||||
|
||||
### Fixed
|
||||
* Sign header color formatting being lost on server restart
|
||||
* Fixed issue preventing to buy claims due to currencies using $ character
|
||||
* Fixed error with `/re list`
|
||||
* Fixed error regarding renewrent
|
||||
13
README.md
Normal file
13
README.md
Normal file
@ -0,0 +1,13 @@
|
||||
# RealEstate
|
||||
|
||||
RealEstate is a spigot plugin built on top of GriefPrevention to provide players with an ability to sell and rent claims to other players.
|
||||
|
||||
The plugin is documented in the [GitHub wiki](https://github.com/EtienneDx/RealEstate/wiki).
|
||||
|
||||
Please feel free to report any issue in the [GitHub Issue section](https://github.com/EtienneDx/RealEstate/issues).
|
||||
|
||||
## GriefPrevention
|
||||
|
||||
This plugin is dependent on GriefPrevention version 16.18 and up.
|
||||
|
||||
GriefPrevention plugin can be found [here](https://github.com/TechFortress/GriefPrevention).
|
||||
@ -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, GriefPrevention]
|
||||
api-version: "1.18"
|
||||
|
||||
commands:
|
||||
re:
|
||||
|
||||
66
pom.xml
66
pom.xml
@ -3,8 +3,8 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>Me.EtienneDx</groupId>
|
||||
<artifactId>RealEstate</artifactId>
|
||||
<version>1.3.0</version>
|
||||
<artifactId>real-estate</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<name>RealEstate</name>
|
||||
<description>A spigot plugin for selling, renting and leasing GriefPrevention claims</description>
|
||||
<build>
|
||||
@ -25,16 +25,24 @@
|
||||
<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>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/MANIFEST.MF</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>co.aikar.commands</pattern>
|
||||
@ -55,15 +63,33 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.4.1</version>
|
||||
<configuration>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>sampler.Main</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<name>GitHub Packages</name>
|
||||
<url>https://maven.pkg.github.com/EtienneDx/RealEstate</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
@ -79,7 +105,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>
|
||||
@ -91,11 +117,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.18.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -116,15 +148,15 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.EtienneDx</groupId>
|
||||
<groupId>com.github.TechFortress</groupId>
|
||||
<artifactId>GriefPrevention</artifactId>
|
||||
<version>1a4b2ea0b639c90f3858316fc4655478b5f0cdbc</version>
|
||||
<version>16.18</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.EtienneDx</groupId>
|
||||
<artifactId>AnnotationConfig</artifactId>
|
||||
<version>cff4221</version>
|
||||
<version>e9eab24</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
80
src/me/EtienneDx/RealEstate/ClaimPermissionListener.java
Normal file
80
src/me/EtienneDx/RealEstate/ClaimPermissionListener.java
Normal file
@ -0,0 +1,80 @@
|
||||
package me.EtienneDx.RealEstate;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import me.EtienneDx.RealEstate.Transactions.BoughtTransaction;
|
||||
import me.EtienneDx.RealEstate.Transactions.Transaction;
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import me.ryanhamshire.GriefPrevention.ClaimPermission;
|
||||
import me.ryanhamshire.GriefPrevention.events.ClaimDeletedEvent;
|
||||
import me.ryanhamshire.GriefPrevention.events.ClaimPermissionCheckEvent;
|
||||
|
||||
public class ClaimPermissionListener implements Listener {
|
||||
void registerEvents()
|
||||
{
|
||||
PluginManager pm = RealEstate.instance.getServer().getPluginManager();
|
||||
|
||||
pm.registerEvents(this, RealEstate.instance);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClaimPermission(ClaimPermissionCheckEvent event) {
|
||||
Transaction transaction = RealEstate.transactionsStore.getTransaction(event.getClaim());
|
||||
// we only have to remove the owner's access, the rest is handled by GP
|
||||
if(
|
||||
// if there is a transaction and the player is the owner
|
||||
transaction != null &&
|
||||
(
|
||||
event.getCheckedUUID().equals(transaction.getOwner()) ||
|
||||
(event.getClaim().isAdminClaim() && event.getCheckedPlayer().hasPermission("griefprevention.adminclaims"))
|
||||
) &&
|
||||
transaction instanceof BoughtTransaction &&
|
||||
((BoughtTransaction)transaction).getBuyer() != null
|
||||
) {
|
||||
switch(event.getRequiredPermission()) {
|
||||
case Edit:
|
||||
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorClaimInTransactionCantEdit));
|
||||
break;
|
||||
case Access:
|
||||
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorClaimInTransactionCantAccess));
|
||||
break;
|
||||
case Build:
|
||||
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorClaimInTransactionCantBuild));
|
||||
break;
|
||||
case Inventory:
|
||||
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorClaimInTransactionCantInventory));
|
||||
break;
|
||||
case Manage:
|
||||
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorClaimInTransactionCantManage));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(event.getRequiredPermission() == ClaimPermission.Edit || event.getRequiredPermission() == ClaimPermission.Manage) {
|
||||
for (Claim child : event.getClaim().children) {
|
||||
Transaction tr = RealEstate.transactionsStore.getTransaction(child);
|
||||
if(tr != null &&
|
||||
tr instanceof BoughtTransaction &&
|
||||
((BoughtTransaction)tr).getBuyer() != null
|
||||
) {
|
||||
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorSubclaimInTransaction));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// more of a safety measure, normally it shouldn't be needed
|
||||
@EventHandler
|
||||
public void onClaimDeleted(ClaimDeletedEvent event) {
|
||||
Transaction tr = RealEstate.transactionsStore.getTransaction(event.getClaim());
|
||||
if(tr != null) tr.tryCancelTransaction(null, true);
|
||||
for (Claim child : event.getClaim().children) {
|
||||
tr = RealEstate.transactionsStore.getTransaction(child);
|
||||
if(tr != null) tr.tryCancelTransaction(null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,10 +18,12 @@ public class Config extends AnnotationConfig
|
||||
|
||||
public final String configFilePath = RealEstate.pluginDirPath + "config.yml";
|
||||
public final String logFilePath = RealEstate.pluginDirPath + "GriefProtection_RealEstate.log";
|
||||
public final String chatPrefix = "[" + ChatColor.GOLD + "RealEstate" + ChatColor.WHITE + "] ";
|
||||
|
||||
@ConfigField(name="RealEstate.Keywords.ChatPrefix", comment="What is displayed before any chat message")
|
||||
public String chatPrefix = "$f[$6RealEstate$f] ";
|
||||
|
||||
@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")
|
||||
|
||||
@ -1,93 +0,0 @@
|
||||
package me.EtienneDx.RealEstate;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import me.EtienneDx.RealEstate.Transactions.BoughtTransaction;
|
||||
import me.EtienneDx.RealEstate.Transactions.Transaction;
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import me.ryanhamshire.GriefPrevention.IAddonPlugin;
|
||||
|
||||
public class GP_RealEstateHook implements IAddonPlugin
|
||||
{
|
||||
@Override
|
||||
public String allowEdit(Claim claim, Player player)
|
||||
{
|
||||
Transaction b = RealEstate.transactionsStore.getTransaction(claim);
|
||||
if(b != null && player.getUniqueId().equals(b.getOwner()) && b instanceof BoughtTransaction)
|
||||
{
|
||||
if(((BoughtTransaction)b).getBuyer() != null)
|
||||
return "This claim is currently involved in a transaction, you can't edit it!";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String allowBuild(Claim claim, Player player, Material material)
|
||||
{
|
||||
Transaction b = RealEstate.transactionsStore.getTransaction(claim);
|
||||
if(b != null && player.getUniqueId().equals(b.getOwner()) && b instanceof BoughtTransaction)// ??
|
||||
{
|
||||
if(((BoughtTransaction)b).getBuyer() != null)
|
||||
return "This claim is currently involved in a transaction, you can't build on it!";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String allowAccess(Claim claim, Player player)
|
||||
{
|
||||
Transaction b = RealEstate.transactionsStore.getTransaction(claim);
|
||||
if(b != null && player.getUniqueId().equals(b.getOwner()) && b instanceof BoughtTransaction)
|
||||
{
|
||||
if(((BoughtTransaction)b).getBuyer() != null)
|
||||
return "This claim is currently involved in a transaction, you can't access it!";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String allowContainers(Claim claim, Player player)
|
||||
{
|
||||
Transaction b = RealEstate.transactionsStore.getTransaction(claim);
|
||||
if(b != null && player.getUniqueId().equals(b.getOwner()) && b instanceof BoughtTransaction)
|
||||
{
|
||||
if(((BoughtTransaction)b).getBuyer() != null)
|
||||
return "This claim is currently involved in a transaction, you can't access it's containers!";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String allowGrantPermission(Claim claim, Player player)
|
||||
{
|
||||
Transaction b = RealEstate.transactionsStore.getTransaction(claim);
|
||||
if(b != null && b instanceof BoughtTransaction)
|
||||
{
|
||||
if(((BoughtTransaction)b).getBuyer() != null && !((BoughtTransaction)b).getBuyer().equals(player.getUniqueId()))
|
||||
return "This claim is currently involved in a transaction, you can't change any permission!";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String mayResizeClaim(Claim claim, Player player, int newx1, int newx2, int newy1, int newy2, int newz1,
|
||||
int newz2)
|
||||
{
|
||||
if(RealEstate.transactionsStore.anyTransaction(claim))
|
||||
{
|
||||
return "This claim is currently involved in a transaction, you can't resize it!";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String mayAbandonClaim(Claim claim, Player player)
|
||||
{
|
||||
if(RealEstate.transactionsStore.anyTransaction(claim))
|
||||
{
|
||||
return "This claim is currently involved in a transaction, you can't abandon it!";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,25 +1,46 @@
|
||||
package me.EtienneDx.RealEstate;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
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;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
@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
|
||||
{
|
||||
public PluginDescriptionFile pdf;
|
||||
|
||||
@ConfigField(name="RealEstate.Keywords.Enabled", comment = "Keywords used within other messages but with a longer text at the end just because i need to test some stuff")
|
||||
public String keywordEnabled = "enabled";
|
||||
|
||||
@ConfigField(name="RealEstate.Keywords.Disabled")
|
||||
public String keywordDisabled = "disabled";
|
||||
|
||||
@ConfigField(name="RealEstate.Keywords.Claim")
|
||||
public String keywordClaim = "claim";
|
||||
|
||||
@ConfigField(name="RealEstate.Keywords.Subclaim")
|
||||
public String keywordSubclaim = "subclaim";
|
||||
|
||||
@ConfigField(name="RealEstate.Keywords.AdminClaimPrefix")
|
||||
public String keywordAdminClaimPrefix = "an admin";
|
||||
|
||||
@ConfigField(name="RealEstate.Keywords.ClaimPrefix")
|
||||
public String keywordClaimPrefix = "a";
|
||||
|
||||
@ConfigField(name="RealEstate.Keywords.TheServer")
|
||||
public String keywordTheServer = "The server";
|
||||
|
||||
@ConfigField(name="RealEstate.NoTransactionFound")
|
||||
public String msgNoTransactionFound = "$cNo transaction found at your location!";
|
||||
public String msgNoTransactionFound = "$cNo transaction found!";
|
||||
|
||||
@ConfigField(name="RealEstate.NoTransactionFoundHere")
|
||||
public String msgNoTransactionFoundHere = "$cNo transaction found at your location!";
|
||||
|
||||
@ConfigField(name="RealEstate.PageMustBePositive")
|
||||
public String msgPageMustBePositive = "$cPage must be a positive option";
|
||||
@ -33,28 +54,378 @@ 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!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ClaimInTransaction.CantOwner")
|
||||
public String msgErrorClaimInTransactionCantOwner = "$cThis claim is currently involved in a transaction, you can't modify it!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ClaimInTransaction.CantEdit")
|
||||
public String msgErrorClaimInTransactionCantEdit = "$cThis claim is currently involved in a transaction, you can't edit it!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ClaimInTransaction.CantAccess")
|
||||
public String msgErrorClaimInTransactionCantAccess = "$cThis claim is currently involved in a transaction, you can't access it!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ClaimInTransaction.CantBuild")
|
||||
public String msgErrorClaimInTransactionCantBuild = "$cThis claim is currently involved in a transaction, you can't build on it!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ClaimInTransaction.CantInventory")
|
||||
public String msgErrorClaimInTransactionCantInventory = "$cThis claim is currently involved in a transaction, you can't access its containers!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ClaimInTransaction.CantManage")
|
||||
public String msgErrorClaimInTransactionCantManage = "$cThis claim is currently involved in a transaction, you can't manage it!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ClaimInTransaction.Subclaim")
|
||||
public String msgErrorSubclaimInTransaction = "$cA subclaim is currently involved in a transaction, you can't edit or manage the parent claim!";
|
||||
|
||||
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.Errors.Command.Usage", comment = "0: command usage")
|
||||
public String msgErrorCommandUsage = "$cUsage: {0}";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.BuyerOnly")
|
||||
public String msgErrorBuyerOnly = "$cOnly the buyer can perform this command!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Unexpected")
|
||||
public String msgErrorUnexpected = "$cAn unexpected error has occured!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.InvalidNumber", comment = "0: number")
|
||||
public String msgErrorInvalidNumber = "$c{0} is not a valid number!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.NegativeNumber", comment = "0: number")
|
||||
public String msgErrorNegativeNumber = "$c{0} is a negative number!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.NegativePrice", comment = "0: price")
|
||||
public String msgErrorNegativePrice = "$cThe price must be greater than zero!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.NonIntegerPrice", comment = "0: price")
|
||||
public String msgErrorNonIntegerPrice = "$cThe price must be an integer!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.InvalidDuration", comment = "0: duration, 1: example of duration format, 2: example, 3: example")
|
||||
public String msgErrorInvalidDuration = "$c{0} is not a valid duration! Durations must be in the format $a{1}$c or $a{2}$c or $a{3}$c!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.NoMoneySelf")
|
||||
public String msgErrorNoMoneySelf = "$cYou don't have enough money to make this transaction!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.NoMoneyOther", comment = "0: Other player")
|
||||
public String msgErrorNoMoneyOther = "$c{0} doesn't have enough money to make this transaction!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.NoWithdrawSelf")
|
||||
public String msgErrorNoWithdrawSelf = "$cCould not withdraw the money!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.NoWithdrawOther", comment = "0: Other player")
|
||||
public String msgErrorNoWithdrawOther = "$cCould not withdraw the money from {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.NoDepositSelf", comment = "0: Other player")
|
||||
public String msgErrorNoDepositSelf = "$cCould not deposit the money to you, refunding {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.NoDepositOther", comment = "0: Other player")
|
||||
public String msgErrorNoDepositOther = "$cCould not deposit the money to {0}, refunding you!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.CantCancelAlreadyLeased", comment = "0: claim type")
|
||||
public String msgErrorCantCancelAlreadyLeased = "$cThis {0} is currently being leased, you can't cancel the transaction!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.CantCancelAlreadyRented", comment = "0: claim type")
|
||||
public String msgErrorCantCancelAlreadyRented = "$cThis {0} is currently being rented, you can't cancel the transaction!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.AutoRenew.Disabled")
|
||||
public String msgErrorAutoRenewDisabled = "$cAutomatic renew is disabled!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ExitOffer.AlreadyExists")
|
||||
public String msgErrorExitOfferAlreadyExists = "$cThere is already an exit proposition for this transaction!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ExitOffer.NoBuyer")
|
||||
public String msgErrorExitOfferNoBuyer = "$cNo one is engaged by this transaction yet!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ExitOffer.None")
|
||||
public String msgErrorExitOfferNone = "$cThere is currently no exit offer for this claim!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ExitOffer.CantAcceptSelf")
|
||||
public String msgErrorExitOfferCantAcceptSelf = "$cYou can't accept your own exit offer!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ExitOffer.CantRefuseSelf")
|
||||
public String msgErrorExitOfferCantRefuseSelf = "$cYou can't refuse your own exit offer!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.ExitOffer.CantCancelOther")
|
||||
public String msgErrorExitOfferCantCancelOther = "$cOnly the player who created this exit proposition may cancel it!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NotInClaim")
|
||||
public String msgErrorSignNotInClaim = "$cThe sign you placed is not inside a claim!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.OngoingTransaction")
|
||||
public String msgErrorSignOngoingTransaction = "$cThis claim already has an ongoing transaction!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.ParentOngoingTransaction")
|
||||
public String msgErrorSignParentOngoingTransaction = "$cThis claim's parent already has an ongoing transaction!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.SubclaimOngoingTransaction")
|
||||
public String msgErrorSignSubclaimOngoingTransaction = "$cThis claim has subclaims with ongoing transactions!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.SellingDisabled")
|
||||
public String msgErrorSignSellingDisabled = "$cSelling is disabled!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.LeasingDisabled")
|
||||
public String msgErrorSignLeasingDisabled = "$cLeasing is disabled!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.RentingDisabled")
|
||||
public String msgErrorSignRentingDisabled = "$cRenting is disabled!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NoSellPermission", comment = "0: claim type")
|
||||
public String msgErrorSignNoSellPermission = "$cYou don't have permission to sell this {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NoLeasePermission", comment = "0: claim type")
|
||||
public String msgErrorSignNoLeasePermission = "$cYou don't have permission to lease this {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NoRentPermission", comment = "0: claim type")
|
||||
public String msgErrorSignNoRentPermission = "$cYou don't have permission to rent this {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NoAdminSellPermission", comment = "0: claim type")
|
||||
public String msgErrorSignNoAdminSellPermission = "$cYou don't have permission to sell this admin {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NoAdminLeasePermission", comment = "0: claim type")
|
||||
public String msgErrorSignNoAdminLeasePermission = "$cYou don't have permission to lease this admin {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NoAdminRentPermission", comment = "0: claim type")
|
||||
public String msgErrorSignNoAdminRentPermission = "$cYou don't have permission to rent this admin {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NotOwner", comment = "0: claim type")
|
||||
public String msgErrorSignNotOwner = "$cYou can only sell/rent/lease {0} you own!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NotAuthor")
|
||||
public String msgErrorSignNotAuthor = "$cOnly the author of the sell/rent/lease sign is allowed to destroy it!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NotAdmin")
|
||||
public String msgErrorSignNotAdmin = "$cOnly an admin is allowed to destroy this sign!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Sign.NoTransaction")
|
||||
public String msgErrorSignNoTransaction = "$cThis claim is no longer for rent, sell or lease, sorry...";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.DoesNotExist")
|
||||
public String msgErrorClaimDoesNotExist = "$cThis claim does not exist!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.AlreadyOwner", comment = "0: claim type")
|
||||
public String msgErrorClaimAlreadyOwner = "$cYou are already the owner of this {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.NotSoldByOwner", comment = "0: claim type")
|
||||
public String msgErrorClaimNotSoldByOwner = "$cThis {0} is not sold by its owner!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.NotLeasedByOwner", comment = "0: claim type")
|
||||
public String msgErrorClaimNotLeasedByOwner = "$cThis {0} is not leased by its owner!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.NotRentedByOwner", comment = "0: claim type")
|
||||
public String msgErrorClaimNotRentedByOwner = "$cThis {0} is not rented by its owner!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.NoBuyPermission", comment = "0: claim type")
|
||||
public String msgErrorClaimNoBuyPermission = "$cYou don't have permission to buy this {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.NoLeasePermission", comment = "0: claim type")
|
||||
public String msgErrorClaimNoLeasePermission = "$cYou don't have permission to lease this {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.NoRentPermission", comment = "0: claim type")
|
||||
public String msgErrorClaimNoRentPermission = "$cYou don't have permission to rent this {0}!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.AlreadyLeased", comment = "0: claim type")
|
||||
public String msgErrorClaimAlreadyLeased = "$cThis {0} is already leased!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.AlreadyRented", comment = "0: claim type")
|
||||
public String msgErrorClaimAlreadyRented = "$cThis {0} is already rented!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.NoInfoPermission")
|
||||
public String msgErrorClaimNoInfoPermission = "$cYou don't have permission to view this real estate informations!";
|
||||
|
||||
@ConfigField(name="RealEstate.Errors.Claim.NoClaimBlocks", comment = "0: area; 1: claim blocks remaining; 2: missing claim blocks")
|
||||
public String msgErrorClaimNoClaimBlocks = "$cYou don't have enough claim blocks! You need $a{2}$c more claim blocks to claim this area. The claim requires $a{0}$c claim blocks, you only have $a{1}$c claim blocks left.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.None")
|
||||
public String msgInfoExitOfferNone = "$bThere is currently no exit offer for this claim!";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.MadeByStatus", comment = "0: formatted price")
|
||||
public String msgInfoExitOfferMadeByStatus = "$bYou offered to exit the contract for $a{0}$b, but your offer hasn't been accepted or denied yet...";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.MadeToStatus", comment = "0: player who made the offer; 1: formatted price")
|
||||
public String msgInfoExitOfferMadeToStatus = "$a{0} $boffered to exit the contract for $a{1}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.Cancel", comment = "0: cancel command")
|
||||
public String msgInfoExitOfferCancel = "$bTo cancel your offer, use $d{0}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.Accept", comment = "0: accept command")
|
||||
public String msgInfoExitOfferAccept = "$bTo accept this offer, use $d{0}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.Reject", comment = "0: reject command")
|
||||
public String msgInfoExitOfferReject = "$bTo reject this offer, use $d{0}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.CreatedBySelf", comment = "0: formatted price")
|
||||
public String msgInfoExitOfferCreatedBySelf = "$bThe offer has been successfully created for $a{0}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.CreatedByOther", comment = "0: player name, 1: claim type, 2: formatted price, 3: claim location")
|
||||
public String msgInfoExitOfferCreatedByOther = "$a{0} $bhas created an offer to exit the transaction for the {1} at $a{3} $bfor $a{2}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.AcceptedBySelf", comment = "0: claim type, 1:formatted price")
|
||||
public String msgInfoExitOfferAcceptedBySelf = "$bThe {0} is no longer rented or leased, you have been charged $a{1}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.AcceptedByOther", comment = "0: player name, 1: claim type, 2: formatted price, 3: claim location")
|
||||
public String msgInfoExitOfferAcceptedByOther = "$a{0} $bhas accepted the offer to exit the transaction for the {1} at $a{3} $bfor $a{2}. It is no longer leased or rented.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.RejectedBySelf")
|
||||
public String msgInfoExitOfferRejectedBySelf = "$bThe exit offer has been refused.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.RejectedByOther", comment = "0: player name, 1: claim type, 2: claim location")
|
||||
public String msgInfoExitOfferRejectedByOther = "$a{0} $bhas refused the offer to exit the transaction for the {1} at $a{2}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.CancelledBySelf")
|
||||
public String msgInfoExitOfferCancelledBySelf = "$bThe exit offer has been cancelled.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.ExitOffer.CancelledByOther", comment = "0: player name, 1: claim type, 2: claim location")
|
||||
public String msgInfoExitOfferCancelledByOther = "$a{0} $bhas cancelled the offer to exit the transaction for the {1} at $a{2}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.OwnerSold", comment = "0: buyer name, 1: claim type, 2: formatted price, 3: claim location")
|
||||
public String msgInfoClaimOwnerSold = "$a{0} $bhas bought the {1} at $a{3} $bfor $a{2}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.OwnerLeaseStarted", comment = "0: buyer name, 1: claim type, 2: formatted price, 3: claim location, 4: payments left")
|
||||
public String msgInfoClaimOwnerLeaseStarted = "$a{0} $bhas leased the {1} at $a{3} $bfor $a{2} with $a{4} $bpayments left";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.OwnerRented", comment = "0: buyer name, 1: claim type, 2: formatted price, 3: claim location")
|
||||
public String msgInfoClaimOwnerRented = "$a{0} $bhas rented the {1} at $a{3} $bfor $a{2}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.BuyerBought", comment = "0: claim type, 1: formatted price")
|
||||
public String msgInfoClaimBuyerSold = "$bYou have bought the {0} for $a{1}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.BuyerLeaseStarted", comment = "0: claim type, 1: formatted price, 2: payments left")
|
||||
public String msgInfoClaimBuyerLeaseStarted = "$bYou have leased the {0} for $a{1} with $a{2} $bpayments left";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.BuyerRented", comment = "0: claim type, 1: formatted price")
|
||||
public String msgInfoClaimBuyerRented = "$bYou have rented the {0} for $a{1}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Lease.Header")
|
||||
public String msgInfoClaimInfoLeaseHeader = "$9-----= $f[$6RealEstate Lease Info$f]$9 =-----";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Lease.GeneralNoBuyer", comment = "0: claim type, 1: payments left, 2: formatted price, 3: frequency")
|
||||
public String msgInfoClaimInfoGeneralLeaseNoBuyer = "$bThis {0} is for lease for $a{1} $bpayments of $a{2} each. Payments are due every $a{3}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Lease.GeneralBuyer", comment = "0: claim type, 1: buyer name, 2: formatted price, 3: payments left, 4: next payment due, 5: frequency")
|
||||
public String msgInfoClaimInfoGeneralLeaseBuyer = "$bThis {0} is currently leased by $a{1}$b for $a{2}$b. There is $a{3} $bpayments left. Next payment is in $a{4}$b. Payments are due every $a{5}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Lease.Oneline", comment = "0: claim area, 1: location, 2: payments left, 3: period, 4: formatted price")
|
||||
public String msgInfoClaimInfoLeaseOneline = "$2{0} $bblocks to $2Lease $bat $2{1} $bfor $a{2} periods of $a{3}$b, each period costs $a{4}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Lease.PaymentBuyer", comment = "0: claim type, 1: location, 2: formatted price, 3: payments left")
|
||||
public String msgInfoClaimInfoLeasePaymentBuyer = "$bPaid lease for the {0} at $a{1} $bfor $a{2}$b. There are $a{3} $bpayments left.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Lease.PaymentOwner", comment = "0: player name, 1: claim type, 2: location, 3: formatted price, 4: payments left")
|
||||
public String msgInfoClaimInfoLeasePaymentOwner = "$a{0} $bpaid lease for the {1} at $a{2} $bfor $a{3}$b. There are $a{4} $bpayments left.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Lease.PaymentBuyerFinal", comment = "0: claim type, 1: location, 2: formatted price")
|
||||
public String msgInfoClaimInfoLeasePaymentBuyerFinal = "$bPaid final lease for the {0} at $a{1} $bfor $a{2}$b. The {0} is now your property.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Lease.PaymentOwnerFinal", comment = "0: player name, 1: claim type, 2: location, 3: formatted price")
|
||||
public String msgInfoClaimInfoLeasePaymentOwnerFinal = "$a{0} $bpaid final lease for the {1} at $a{2} $bfor $a{3}$b. The {1} is now $a{0}$b's property.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Lease.PaymentBuyerCancelled", comment = "0: claim type, 1: location, 2: formatted price")
|
||||
public String msgInfoClaimInfoLeasePaymentBuyerCancelled = "$bCouldn't pay the lease for the {0} at $a{1} $bfor $a{2}$b. The lease has been cancelled.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Lease.PaymentOwnerCancelled", comment = "0: player name, 1: claim type, 2: location, 3: formatted price")
|
||||
public String msgInfoClaimInfoLeasePaymentOwnerCancelled = "$a{0} $bcouldn't pay the lease for the {1} at $a{2} $bfor $a{3}$b. The lease has been cancelled.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.Header")
|
||||
public String msgInfoClaimInfoRentHeader = "$9-----= $f[$6RealEstate Rent Info$f]$9 =-----";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.GeneralNoBuyer", comment = "0: claim type, 1: formatted price, 2: duration")
|
||||
public String msgInfoClaimInfoGeneralRentNoBuyer = "$bThis {0} is for rent for $a{1}$b per $a{2}$b.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.GeneralBuyer", comment = "0: claim type, 1: buyer name, 2: formatted price, 3: time left in current period, 4: duration of a period")
|
||||
public String msgInfoClaimInfoGeneralRentBuyer = "$bThis {0} is currently rented by $a{1}$b for $a{2}$b. The {0} is rented for another $a{3}$b. The rent period is $a{4}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.MaxPeriod", comment = "0: max periods")
|
||||
public String msgInfoClaimInfoRentMaxPeriod = "$bIt can be rented for a maximum of $a{0}$b periods.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.RemainingPeriods", comment = "0: periods left")
|
||||
public String msgInfoClaimInfoRentRemainingPeriods = "$bThe contract will end after another $a{0}$b periods.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.AutoRenew", comment = "0: enabled / disabled")
|
||||
public String msgInfoClaimInfoRentAutoRenew = "$bAutomatic renew is currently $a{0}$b.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.Oneline", comment = "0: claim area, 1: location, 2: formatted price, 3: duration")
|
||||
public String msgInfoClaimInfoRentOneline = "$2{0} $bblocks to $2Rent $bat $2{1} $bfor $a{2}$b per $a{3}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.PaymentBuyer", comment = "0: claim type, 1: location, 2: formatted price")
|
||||
public String msgInfoClaimInfoRentPaymentBuyer = "$bPaid rent for the {0} at $a{1} $bfor $a{2}$b.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.PaymentOwner", comment = "0: player name, 1: claim type, 2: location, 3: formatted price")
|
||||
public String msgInfoClaimInfoRentPaymentOwner = "$a{0} $bpaid rent for the {1} at $a{2} $bfor $a{3}$b.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.PaymentBuyerCancelled", comment = "0: claim type, 1: location, 2: formatted price")
|
||||
public String msgInfoClaimInfoRentPaymentBuyerCancelled = "$bCouldn't pay the rent for the {0} at $a{1} $bfor $a{2}$b. The rent has been cancelled.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.PaymentOwnerCancelled", comment = "0: player name, 1: claim type, 2: location, 3: formatted price")
|
||||
public String msgInfoClaimInfoRentPaymentOwnerCancelled = "$a{0} $bcouldn't pay the rent for the {1} at $a{2} $bfor $a{3}$b. The rent has been cancelled.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Rent.RentCancelled", comment = "0: claim type, 1: location")
|
||||
public String msgInfoClaimInfoRentCancelled = "$bThe rent for the {0} at $a{1} $bis now over, your access has been revoked.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Sell.Header")
|
||||
public String msgInfoClaimInfoSellHeader = "$9-----= $f[$6RealEstate Sale Info$f]$9 =-----";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Sell.General", comment = "0: claim type, 1: formatted price")
|
||||
public String msgInfoClaimInfoSellGeneral = "$bThis {0} is for sale for $a{1}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Sell.Oneline", comment = "0: claim area, 1: location, 2: formatted price")
|
||||
public String msgInfoClaimInfoSellOneline = "$2{0} $bblocks to $2Sell $bat $2{1} $bfor $a{2}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Owner", comment = "0: owner name")
|
||||
public String msgInfoClaimInfoOwner = "$bThe current owner is $a{0}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.MainOwner", comment = "0: owner name")
|
||||
public String msgInfoClaimInfoMainOwner = "$bThe main claim's owner is $a{0}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Info.Note")
|
||||
public String msgInfoClaimInfoNote = "$dNote: You will only get access to this subclaim.";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Created.Sell", comment = "0: claim prefix, 1: claim type, 2: formatted price")
|
||||
public String msgInfoClaimCreatedSell = "$bYou have successfully created {0} {1} sale for $a{2}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Created.Lease", comment = "0: claim prefix, 1: claim type, 2: formatted price, 3: payments count, 4: frequency")
|
||||
public String msgInfoClaimCreatedLease = "$bYou have successfully created {0} {1} lease for $a{3}$b payments of $a{2}$b each. Payments are due every $a{4}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Created.Rent", comment = "0: claim prefix, 1: claim type, 2: formatted price, 3: duration")
|
||||
public String msgInfoClaimCreatedRent = "$bYou have successfully created {0} {1} rent for $a{2}$b per $a{3}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Created.SellBroadcast", comment = "0: player name, 1: claim prefix, 2: claim type, 3: formatted price")
|
||||
public String msgInfoClaimCreatedSellBroadcast = "$a{0} $bhas created {1} {2} sale for $a{3}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Created.LeaseBroadcast", comment = "0: player name, 1: claim prefix, 2: claim type, 3: formatted price, 4: payments count, 5: frequency")
|
||||
public String msgInfoClaimCreatedLeaseBroadcast = "$a{0} $bhas created {1} {2} lease for $a{4}$b payments of $a{3}$b each. Payments are due every $a{5}";
|
||||
|
||||
@ConfigField(name="RealEstate.Info.Claim.Created.RentBroadcast", comment = "0: player name, 1: claim prefix, 2: claim type, 3: formatted price, 4: duration")
|
||||
public String msgInfoClaimCreatedRentBroadcast = "$a{0} $bhas created {1} {2} rent for $a{3}$b per $a{4}";
|
||||
|
||||
@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=----";
|
||||
|
||||
@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 String msgListNextPage = ChatColor.GOLD + "To see the next page, type " + ChatColor.GREEN + "/re list {0} {1}";
|
||||
|
||||
public Messages()
|
||||
{
|
||||
@ -67,13 +438,23 @@ public class Messages extends AnnotationConfig
|
||||
this.loadConfig(RealEstate.languagesDirectory + "/" + RealEstate.instance.config.languageFile);
|
||||
}
|
||||
|
||||
synchronized public String getMessage(String msgTemplate, String... args) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
String param = args[i];
|
||||
msgTemplate = msgTemplate.replace("{" + i + "}", param);
|
||||
public static String getMessage(String msgTemplate, String... args) {
|
||||
return getMessage(msgTemplate, true, args);
|
||||
}
|
||||
|
||||
public static String getMessage(String msgTemplate, boolean withPrefix, String... args) {
|
||||
if (withPrefix) {
|
||||
msgTemplate = RealEstate.instance.config.chatPrefix + msgTemplate;
|
||||
}
|
||||
|
||||
return msgTemplate.replace('$', (char) 0x00A7);
|
||||
msgTemplate = msgTemplate.replace('$', ChatColor.COLOR_CHAR);
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
String param = args[i];
|
||||
msgTemplate = msgTemplate.replaceAll("\\{" + i + "\\}", Matcher.quoteReplacement(param));
|
||||
}
|
||||
|
||||
return msgTemplate;
|
||||
}
|
||||
//sends a color-coded message to a player
|
||||
public static void sendMessage(CommandSender player, String msgTemplate, String... args) {
|
||||
@ -82,19 +463,13 @@ public class Messages extends AnnotationConfig
|
||||
|
||||
//sends a color-coded message to a player
|
||||
public static void sendMessage(CommandSender player, String msgTemplate, long delayInTicks, String... args) {
|
||||
String message = RealEstate.instance.messages.getMessage(msgTemplate, args);
|
||||
String message = getMessage(msgTemplate, args);
|
||||
sendMessage(player, message, delayInTicks);
|
||||
}
|
||||
|
||||
//sends a color-coded message to a player
|
||||
public static void sendMessage(CommandSender player, String message) {
|
||||
if (message == null || message.length() == 0) return;
|
||||
|
||||
if (player == null) {
|
||||
RealEstate.instance.log.info(message);
|
||||
} else {
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + message.replace('$', (char) 0x00A7));
|
||||
}
|
||||
sendMessage(player, getMessage(message), 0);
|
||||
}
|
||||
|
||||
public static void sendMessage(CommandSender player, String message, long delayInTicks) {
|
||||
|
||||
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -48,7 +47,7 @@ public class RECommand extends BaseCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgNoTransactionFound);
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgNoTransactionFoundHere);
|
||||
}
|
||||
|
||||
}
|
||||
@ -156,29 +155,36 @@ public class RECommand extends BaseCommand
|
||||
Location loc = player.getLocation();
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(loc, false, null);
|
||||
ClaimRent cr = (ClaimRent)RealEstate.transactionsStore.getTransaction(claim);
|
||||
String claimType = claim.parent == null ? "claim" : "subclaim";
|
||||
String claimType = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim : RealEstate.instance.messages.keywordSubclaim;
|
||||
if(!RealEstate.instance.config.cfgEnableAutoRenew)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Automatic renew is disabled!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorAutoRenewDisabled);
|
||||
return;
|
||||
}
|
||||
if(newStatus == null)
|
||||
{
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgRenewRentCurrently, cr.autoRenew ? "enabled" : "disabled", claimType);
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgRenewRentCurrently, cr.autoRenew ?
|
||||
RealEstate.instance.messages.keywordEnabled :
|
||||
RealEstate.instance.messages.keywordDisabled,
|
||||
claimType);
|
||||
}
|
||||
else if(!newStatus.equalsIgnoreCase("enable") && !newStatus.equalsIgnoreCase("disable"))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Usage : /re renewrent [enable|disable]!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorCommandUsage, "/re renewrent [enable|disable]");
|
||||
}
|
||||
else if(cr.buyer.equals(player.getUniqueId()))
|
||||
{
|
||||
cr.autoRenew = newStatus.equalsIgnoreCase("enable");
|
||||
RealEstate.transactionsStore.saveData();
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgRenewRentNow, cr.autoRenew ? "enabled" : "disabled", claimType);
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgRenewRentNow, cr.autoRenew ?
|
||||
RealEstate.instance.messages.keywordEnabled :
|
||||
RealEstate.instance.messages.keywordDisabled,
|
||||
claimType);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Only the buyer may change this setting!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorBuyerOnly);
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,24 +200,23 @@ public class RECommand extends BaseCommand
|
||||
BoughtTransaction bt = (BoughtTransaction)RealEstate.transactionsStore.getTransaction(player);
|
||||
if(bt.exitOffer == null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "There is currently no exit offer for this claim!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoExitOfferNone);
|
||||
}
|
||||
else if(bt.exitOffer.offerBy.equals(player.getUniqueId()))
|
||||
{
|
||||
String msg = RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "You offered to exit the contract for " +
|
||||
ChatColor.GREEN + bt.exitOffer.price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA +
|
||||
", but your offer hasn't been accepted or denied yet...\n";
|
||||
msg += ChatColor.AQUA + "To cancel your offer, just type " + ChatColor.LIGHT_PURPLE + "/re exitoffer cancel";
|
||||
player.sendMessage(msg);
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoExitOfferMadeByStatus,
|
||||
RealEstate.econ.format(bt.exitOffer.price));
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoExitOfferCancel,
|
||||
"/re exitoffer cancel");
|
||||
}
|
||||
else// it is the other person
|
||||
else// it is the other player
|
||||
{
|
||||
String msg = RealEstate.instance.config.chatPrefix + ChatColor.GREEN + Bukkit.getOfflinePlayer(bt.exitOffer.offerBy).getName() +
|
||||
ChatColor.AQUA + " offered to exit the contract for " +
|
||||
ChatColor.GREEN + bt.exitOffer.price + " " + RealEstate.econ.currencyNamePlural() + "\n";
|
||||
msg += ChatColor.AQUA + "To accept the offer, just type " + ChatColor.LIGHT_PURPLE + "/re exitoffer accept\n";
|
||||
msg += ChatColor.AQUA + "To refuse the offer, just type " + ChatColor.LIGHT_PURPLE + "/re exitoffer refuse\n";
|
||||
player.sendMessage(msg);
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoExitOfferMadeToStatus,
|
||||
Bukkit.getOfflinePlayer(bt.exitOffer.offerBy).getName(), RealEstate.econ.format(bt.exitOffer.price));
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoExitOfferAccept,
|
||||
"/re exitoffer accept");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoExitOfferReject,
|
||||
"/re exitoffer refuse");
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,40 +228,39 @@ public class RECommand extends BaseCommand
|
||||
BoughtTransaction bt = (BoughtTransaction)RealEstate.transactionsStore.getTransaction(player);
|
||||
if(bt.exitOffer != null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"There is already an exit proposition for this transaction!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorExitOfferAlreadyExists);
|
||||
return;
|
||||
}
|
||||
if(bt.buyer == null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"No one is engaged by this transaction yet!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorExitOfferNoBuyer);
|
||||
return;
|
||||
}
|
||||
bt.exitOffer = new ExitOffer(player.getUniqueId(), price);
|
||||
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"The proposition has been successfully created!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoExitOfferCreatedBySelf,
|
||||
RealEstate.econ.format(price));
|
||||
|
||||
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
||||
if(other != null)// not an admin claim
|
||||
{
|
||||
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
||||
Location loc = player.getLocation();
|
||||
String claimType = GriefPrevention.instance.dataStore.getClaimAt(loc, false, null).parent == null ? "claim" : "subclaim";
|
||||
String claimType = GriefPrevention.instance.dataStore.getClaimAt(loc, false, null).parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim : RealEstate.instance.messages.keywordSubclaim;
|
||||
String location = "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() + ", Z: "
|
||||
+ loc.getBlockZ() + "]";
|
||||
|
||||
if(otherP.isOnline())
|
||||
{
|
||||
((Player)otherP).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
|
||||
ChatColor.AQUA + " has created an offer to exit the rent/lease contract for the " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() + ", Z: "
|
||||
+ loc.getBlockZ() + "]" + ChatColor.AQUA + " for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(otherP.getPlayer(), RealEstate.instance.messages.msgInfoExitOfferCreatedByOther,
|
||||
player.getName(), claimType, RealEstate.econ.format(price), location);
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(other);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
|
||||
ChatColor.AQUA + " has created an offer to exit the rent/lease contract for the " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() + ", Z: "
|
||||
+ loc.getBlockZ() + "]" + ChatColor.AQUA + " for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoExitOfferCreatedByOther,
|
||||
player.getName(), claimType, RealEstate.econ.format(price), location));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -271,36 +275,34 @@ public class RECommand extends BaseCommand
|
||||
String claimType = claim.parent == null ? "claim" : "subclaim";
|
||||
if(bt.exitOffer == null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"There has been no exit propositions for this transaction!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorExitOfferNone);
|
||||
}
|
||||
else if(bt.exitOffer.offerBy.equals(player.getUniqueId()))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"You can't accept or refuse an offer you made!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorExitOfferCantAcceptSelf);
|
||||
}
|
||||
else if(Utils.makePayment(player.getUniqueId(), bt.exitOffer.offerBy, bt.exitOffer.price, true, false))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"This exit offer has been accepted, the " + claimType + " is no longer rented or leased!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoExitOfferAcceptedBySelf,
|
||||
claimType, RealEstate.econ.format(bt.exitOffer.price));
|
||||
|
||||
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
||||
String location = "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
|
||||
", Z: " + loc.getBlockZ() + "]";
|
||||
if(other != null)
|
||||
{
|
||||
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
||||
if(otherP.isOnline())
|
||||
{
|
||||
((Player)otherP).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
|
||||
ChatColor.AQUA + " has accepted your offer to exit the rent/lease contract for the " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
|
||||
", Z: " + loc.getBlockZ() + "]. It is no longer rented or leased.");
|
||||
Messages.sendMessage(otherP.getPlayer(), RealEstate.instance.messages.msgInfoExitOfferAcceptedByOther,
|
||||
player.getName(), claimType, RealEstate.econ.format(bt.exitOffer.price), location);
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(other);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
|
||||
ChatColor.AQUA + " has accepted your offer to exit the rent/lease contract for the " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
|
||||
", Z: " + loc.getBlockZ() + "]. It is no longer rented or leased.");
|
||||
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoExitOfferAcceptedByOther,
|
||||
player.getName(), claimType, RealEstate.econ.format(bt.exitOffer.price), location));
|
||||
}
|
||||
}
|
||||
bt.exitOffer = null;
|
||||
@ -323,37 +325,32 @@ public class RECommand extends BaseCommand
|
||||
String claimType = claim.parent == null ? "claim" : "subclaim";
|
||||
if(bt.exitOffer == null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"There has been no exit propositions for this transaction!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorExitOfferNone);
|
||||
}
|
||||
else if(bt.exitOffer.offerBy.equals(player.getUniqueId()))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"You can't accept or refuse an offer you made!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorExitOfferCantRefuseSelf);
|
||||
}
|
||||
else
|
||||
{
|
||||
bt.exitOffer = null;
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"This exit offer has been refused");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoExitOfferRejectedBySelf);
|
||||
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
||||
String location = "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
|
||||
", Z: " + loc.getBlockZ() + "]";
|
||||
if(other != null)
|
||||
{
|
||||
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
||||
if(otherP.isOnline())
|
||||
{
|
||||
((Player)otherP).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
|
||||
ChatColor.AQUA + " has refused your offer to exit the rent/lease contract for the " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
|
||||
", Z: " + loc.getBlockZ() + "]");
|
||||
Messages.sendMessage(otherP.getPlayer(), RealEstate.instance.messages.msgInfoExitOfferRejectedByOther,
|
||||
player.getName(), claimType, location);
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(other);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
|
||||
ChatColor.AQUA + " has refused your offer to exit the rent/lease contract for the " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
|
||||
", Z: " + loc.getBlockZ() + "]");
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoExitOfferRejectedByOther,
|
||||
player.getName(), claimType, location));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -370,33 +367,30 @@ public class RECommand extends BaseCommand
|
||||
if(bt.exitOffer.offerBy.equals(player.getUniqueId()))
|
||||
{
|
||||
bt.exitOffer = null;
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"This exit offer has been cancelled");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoExitOfferCancelledBySelf);
|
||||
|
||||
UUID other = player.getUniqueId().equals(bt.owner) ? bt.buyer : bt.owner;
|
||||
String location = "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() +
|
||||
", Z: " + loc.getBlockZ() + "]";
|
||||
if(other != null)
|
||||
{
|
||||
OfflinePlayer otherP = Bukkit.getOfflinePlayer(other);
|
||||
if(otherP.isOnline())
|
||||
{
|
||||
((Player)otherP).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
|
||||
ChatColor.AQUA + " has cancelled his offer to exit the rent/lease contract for the " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() + ", Z: "
|
||||
+ loc.getBlockZ() + "]");
|
||||
Messages.sendMessage(otherP.getPlayer(), RealEstate.instance.messages.msgInfoExitOfferCancelledByOther,
|
||||
player.getName(), claimType, location);
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(other);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() +
|
||||
ChatColor.AQUA + " has cancelled his offer to exit the rent/lease contract for the " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + loc.getWorld().getName() + ", X: " + loc.getBlockX() + ", Y: " + loc.getBlockY() + ", Z: "
|
||||
+ loc.getBlockZ() + "]");
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoExitOfferCancelledByOther,
|
||||
player.getName(), claimType, location));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"Only the player who created this exit proposition may cancel it");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorExitOfferCantCancelOther);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,21 +44,21 @@ public class REListener implements Listener
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(loc, false, null);
|
||||
if(claim == null)// must have something to sell
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The sign you placed is not inside a claim!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNotInClaim);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
if(RealEstate.transactionsStore.anyTransaction(claim))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "This claim already has an ongoing transaction!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignOngoingTransaction);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
if(RealEstate.transactionsStore.anyTransaction(claim.parent))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The parent claim already has an ongoing transaction!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignParentOngoingTransaction);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -67,8 +67,7 @@ public class REListener implements Listener
|
||||
{
|
||||
if(RealEstate.transactionsStore.anyTransaction(c))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"A subclaim of this claim already has an ongoing transaction!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignSubclaimOngoingTransaction);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -80,16 +79,18 @@ public class REListener implements Listener
|
||||
{
|
||||
if(!RealEstate.instance.config.cfgEnableSell)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Selling is disabled!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignSellingDisabled);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
|
||||
String type = claim.parent == null ? "claim" : "subclaim";
|
||||
String typeDisplay = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim : RealEstate.instance.messages.keywordSubclaim;
|
||||
if(!RealEstate.perms.has(player, "realestate." + type + ".sell"))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to sell " + type + "s!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNoSellPermission, typeDisplay);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -103,21 +104,21 @@ public class REListener implements Listener
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price you entered is not a valid number!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorInvalidNumber, event.getLine(1));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
if(price <= 0)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price must be greater than 0!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorNegativePrice, event.getLine(1));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
if((price%1)!=0 && !RealEstate.instance.config.cfgUseDecimalCurrency) //if the price has a decimal number AND Decimal currency is disabled
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price cannot have a decimal number!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorNonIntegerPrice, event.getLine(1));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -127,7 +128,7 @@ public class REListener implements Listener
|
||||
{
|
||||
if(!RealEstate.perms.has(player, "realestate.admin"))// admin may sell admin claims
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to sell admin claims!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNoAdminSellPermission, typeDisplay);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -135,7 +136,7 @@ public class REListener implements Listener
|
||||
}
|
||||
else if(type.equals("claim") && !player.getUniqueId().equals(claim.ownerID))// only the owner may sell his claim
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You can only sell claims you own!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNotOwner, typeDisplay);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -150,15 +151,17 @@ public class REListener implements Listener
|
||||
{
|
||||
if(!RealEstate.instance.config.cfgEnableRent)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Renting is disabled!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignRentingDisabled);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
String type = claim.parent == null ? "claim" : "subclaim";
|
||||
String typeDisplay = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim : RealEstate.instance.messages.keywordSubclaim;
|
||||
if(!RealEstate.perms.has(player, "realestate." + type + ".rent"))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to rent " + type + "s!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNoRentPermission, typeDisplay);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -172,21 +175,21 @@ public class REListener implements Listener
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price you entered is not a valid number!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorInvalidNumber, event.getLine(1));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
if(price <= 0)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price must be greater than 0!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorNegativePrice, event.getLine(1));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
if((price%1)!=0 && !RealEstate.instance.config.cfgUseDecimalCurrency) //if the price has a decimal number AND Decimal currency is disabled
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price cannot have a decimal number!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorNonIntegerPrice, event.getLine(1));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -199,9 +202,10 @@ public class REListener implements Listener
|
||||
int duration = parseDuration(event.getLine(2));
|
||||
if(duration == 0)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Couldn't read the date!\n" +
|
||||
"Date must be formatted as follow : " + ChatColor.GREEN + "10 weeks" + ChatColor.RED + " or " +
|
||||
ChatColor.GREEN + "3 days" + ChatColor.RED + " or " + ChatColor.GREEN + "1 week 3 days");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorInvalidDuration, event.getLine(2),
|
||||
"10 weeks",
|
||||
"3 days",
|
||||
"1 week 3 days");
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -219,16 +223,14 @@ public class REListener implements Listener
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"The number of rent periods you entered is not a valid number!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorInvalidNumber, event.getLine(3));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
if(rentPeriods <= 0)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"The number of rent periods must be greater than 0!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorNegativeNumber, event.getLine(3));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -239,7 +241,7 @@ public class REListener implements Listener
|
||||
{
|
||||
if(!RealEstate.perms.has(player, "realestate.admin"))// admin may sell admin claims
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to rent admin claims!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNoAdminRentPermission, typeDisplay);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -247,7 +249,7 @@ public class REListener implements Listener
|
||||
}
|
||||
else if(type.equals("claim") && !player.getUniqueId().equals(claim.ownerID))// only the owner may sell his claim
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You can only rent claims you own!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNotOwner, typeDisplay);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -262,15 +264,18 @@ public class REListener implements Listener
|
||||
{
|
||||
if(!RealEstate.instance.config.cfgEnableLease)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Leasing is disabled!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignLeasingDisabled);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
String type = claim.parent == null ? "claim" : "subclaim";
|
||||
String typeDisplay = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim;
|
||||
if(!RealEstate.perms.has(player, "realestate." + type + ".lease"))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to lease " + type + "s!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNoLeasePermission, typeDisplay);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -284,21 +289,21 @@ public class REListener implements Listener
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price you entered is not a valid number!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorInvalidNumber, event.getLine(1));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
if(price <= 0)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price must be greater than 0!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorNegativePrice, event.getLine(1));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
}
|
||||
if((price%1)!=0 && !RealEstate.instance.config.cfgUseDecimalCurrency) //if the price has a decimal number AND Decimal currency is disabled
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "The price cannot have a decimal number!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorNonIntegerPrice, event.getLine(1));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -315,8 +320,7 @@ public class REListener implements Listener
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"The number of payments you enterred is not a valid number!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorInvalidNumber, event.getLine(2));
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -329,9 +333,10 @@ public class REListener implements Listener
|
||||
int frequency = parseDuration(event.getLine(3));
|
||||
if(frequency == 0)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Couldn't read the date!\n" +
|
||||
"Date must be formatted as follow" + ChatColor.GREEN + "10 weeks" + ChatColor.RED + " or " +
|
||||
ChatColor.GREEN + "3 days" + ChatColor.RED + " or " + ChatColor.GREEN + "1 week 3 days");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorInvalidDuration, event.getLine(3),
|
||||
"10 weeks",
|
||||
"3 days",
|
||||
"1 week 3 days");
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -341,7 +346,7 @@ public class REListener implements Listener
|
||||
{
|
||||
if(!RealEstate.perms.has(player, "realestate.admin"))// admin may sell admin claims
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to lease admin claims!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNoAdminLeasePermission, typeDisplay);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -349,7 +354,7 @@ public class REListener implements Listener
|
||||
}
|
||||
else if(type.equals("claim") && !player.getUniqueId().equals(claim.ownerID))// only the owner may sell his claim
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You can only lease claims you own!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNotOwner, typeDisplay);
|
||||
event.setCancelled(true);
|
||||
event.getBlock().breakNaturally();
|
||||
return;
|
||||
@ -394,16 +399,17 @@ public class REListener implements Listener
|
||||
event.getClickedBlock().getState() instanceof Sign)
|
||||
{
|
||||
Sign sign = (Sign)event.getClickedBlock().getState();
|
||||
RealEstate.instance.log.info(sign.getLine(0));
|
||||
// it is a real estate sign
|
||||
if(ChatColor.stripColor(sign.getLine(0)).equalsIgnoreCase(ChatColor.stripColor(RealEstate.instance.config.cfgSignsHeader)))
|
||||
if(ChatColor.stripColor(sign.getLine(0)).equalsIgnoreCase(ChatColor.stripColor(
|
||||
Messages.getMessage(RealEstate.instance.config.cfgSignsHeader, false))))
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(event.getClickedBlock().getLocation(), false, null);
|
||||
|
||||
if(!RealEstate.transactionsStore.anyTransaction(claim))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"This claim is no longer for rent, sell or lease, sorry...");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorSignNoTransaction);
|
||||
event.getClickedBlock().breakNaturally();
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -432,15 +438,13 @@ public class REListener implements Listener
|
||||
if(event.getPlayer() != null && tr.getOwner() != null && !event.getPlayer().getUniqueId().equals(tr.getOwner()) &&
|
||||
!RealEstate.perms.has(event.getPlayer(), "realestate.destroysigns"))
|
||||
{
|
||||
event.getPlayer().sendMessage(RealEstate.instance.config.chatPrefix +
|
||||
ChatColor.RED + "Only the author of the sell/rent/lease sign is allowed to destroy it");
|
||||
Messages.sendMessage(event.getPlayer(), RealEstate.instance.messages.msgErrorSignNotAuthor);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
else if(event.getPlayer() != null && tr.getOwner() == null && !RealEstate.perms.has(event.getPlayer(), "realestate.admin"))
|
||||
{
|
||||
event.getPlayer().sendMessage(RealEstate.instance.config.chatPrefix +
|
||||
ChatColor.RED + "Only an admin is allowed to destroy this sign");
|
||||
Messages.sendMessage(event.getPlayer(), RealEstate.instance.messages.msgErrorSignNotAdmin);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -96,13 +96,12 @@ public class RealEstate extends JavaPlugin
|
||||
RealEstate.transactionsStore = new TransactionsStore();
|
||||
|
||||
new REListener().registerEvents();
|
||||
new ClaimPermissionListener().registerEvents();
|
||||
|
||||
manager = new BukkitCommandManager(this);
|
||||
manager.enableUnstableAPI("help");
|
||||
registerConditions();
|
||||
manager.registerCommand(new RECommand());
|
||||
|
||||
GriefPrevention.addonPlugins.add(new GP_RealEstateHook());
|
||||
}
|
||||
|
||||
private void registerConditions()
|
||||
@ -113,78 +112,78 @@ public class RealEstate extends JavaPlugin
|
||||
{
|
||||
return;
|
||||
}
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorOutOfClaim);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorOutOfClaim));
|
||||
});
|
||||
manager.getCommandConditions().addCondition("claimHasTransaction", (context) -> {
|
||||
if(!context.getIssuer().isPlayer())
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorPlayerOnly);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorPlayerOnly));
|
||||
}
|
||||
Claim c = GriefPrevention.instance.dataStore.getClaimAt(context.getIssuer().getPlayer().getLocation(), false, null);
|
||||
if(c == null)
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorOutOfClaim);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorOutOfClaim));
|
||||
}
|
||||
Transaction tr = transactionsStore.getTransaction(c);
|
||||
if(tr == null)
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorNoOngoingTransaction);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorNoOngoingTransaction));
|
||||
}
|
||||
});
|
||||
manager.getCommandConditions().addCondition("inPendingTransactionClaim", (context) -> {
|
||||
if(!context.getIssuer().isPlayer())
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorPlayerOnly);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorPlayerOnly));
|
||||
}
|
||||
Claim c = GriefPrevention.instance.dataStore.getClaimAt(context.getIssuer().getPlayer().getLocation(), false, null);
|
||||
if(c == null)
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorOutOfClaim);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorOutOfClaim));
|
||||
}
|
||||
Transaction tr = transactionsStore.getTransaction(c);
|
||||
if(tr == null)
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorNotRentNorLease);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorNotRentNorLease));
|
||||
}
|
||||
else if(tr instanceof BoughtTransaction && ((BoughtTransaction)tr).getBuyer() != null)
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorAlreadyBought);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorAlreadyBought));
|
||||
}
|
||||
});
|
||||
manager.getCommandConditions().addCondition("inBoughtClaim", (context) -> {
|
||||
if(!context.getIssuer().isPlayer())
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorPlayerOnly);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorPlayerOnly));
|
||||
}
|
||||
Claim c = GriefPrevention.instance.dataStore.getClaimAt(context.getIssuer().getPlayer().getLocation(), false, null);
|
||||
if(c == null)
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorOutOfClaim);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorOutOfClaim));
|
||||
}
|
||||
Transaction tr = transactionsStore.getTransaction(c);
|
||||
if(tr == null || !(tr instanceof BoughtTransaction))
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorNotRentNorLease);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorNotRentNorLease));
|
||||
}
|
||||
});
|
||||
manager.getCommandConditions().addCondition("partOfBoughtTransaction", context -> {
|
||||
if(!context.getIssuer().isPlayer())
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorPlayerOnly);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorPlayerOnly));
|
||||
}
|
||||
Claim c = GriefPrevention.instance.dataStore.getClaimAt(context.getIssuer().getPlayer().getLocation(), false, null);
|
||||
if(c == null)
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorOutOfClaim);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorOutOfClaim));
|
||||
}
|
||||
Transaction tr = transactionsStore.getTransaction(c);
|
||||
if(tr == null)
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorNoOngoingTransaction);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorNoOngoingTransaction));
|
||||
}
|
||||
if(!(tr instanceof BoughtTransaction))
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorNotRentNorLease);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorNotRentNorLease));
|
||||
}
|
||||
if((((BoughtTransaction)tr).buyer != null && ((BoughtTransaction)tr).buyer.equals(context.getIssuer().getPlayer().getUniqueId())) ||
|
||||
(tr.getOwner() != null && (tr.getOwner().equals(context.getIssuer().getPlayer().getUniqueId()))) ||
|
||||
@ -192,26 +191,26 @@ public class RealEstate extends JavaPlugin
|
||||
{
|
||||
return;
|
||||
}
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorNotPartOfTransaction);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorNotPartOfTransaction));
|
||||
});
|
||||
manager.getCommandConditions().addCondition("partOfRent", context -> {
|
||||
if(!context.getIssuer().isPlayer())
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorPlayerOnly);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorPlayerOnly));
|
||||
}
|
||||
Claim c = GriefPrevention.instance.dataStore.getClaimAt(context.getIssuer().getPlayer().getLocation(), false, null);
|
||||
if(c == null)
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorOutOfClaim);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorOutOfClaim));
|
||||
}
|
||||
Transaction tr = transactionsStore.getTransaction(c);
|
||||
if(tr == null)
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorNoOngoingTransaction);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorNoOngoingTransaction));
|
||||
}
|
||||
if(!(tr instanceof ClaimRent))
|
||||
{
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorRentOnly);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorRentOnly));
|
||||
}
|
||||
if((((ClaimRent)tr).buyer != null && ((ClaimRent)tr).buyer.equals(context.getIssuer().getPlayer().getUniqueId())) ||
|
||||
(tr.getOwner() != null && (tr.getOwner().equals(context.getIssuer().getPlayer().getUniqueId()))) ||
|
||||
@ -219,11 +218,11 @@ public class RealEstate extends JavaPlugin
|
||||
{
|
||||
return;
|
||||
}
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorNotPartOfTransaction);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorNotPartOfTransaction));
|
||||
});
|
||||
manager.getCommandConditions().addCondition(Double.class, "positiveDouble", (c, exec, value) -> {
|
||||
if(value > 0) return;
|
||||
throw new ConditionFailedException(config.chatPrefix + messages.msgErrorValueGreaterThanZero);
|
||||
throw new ConditionFailedException(Messages.getMessage(messages.msgErrorValueGreaterThanZero));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -17,11 +17,12 @@ class SendPlayerMessageTask implements Runnable
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(player == null)
|
||||
{
|
||||
RealEstate.instance.log.info(message);
|
||||
return;
|
||||
}
|
||||
Messages.sendMessage(this.player, this.message);
|
||||
if (message == null || message.length() == 0) return;
|
||||
|
||||
if (player == null) {
|
||||
RealEstate.instance.log.info(message);
|
||||
} else {
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
|
||||
import me.EtienneDx.RealEstate.Messages;
|
||||
import me.EtienneDx.RealEstate.RealEstate;
|
||||
import me.EtienneDx.RealEstate.Utils;
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
@ -65,7 +66,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, Messages.getMessage(RealEstate.instance.config.cfgSignsHeader, false));
|
||||
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());
|
||||
@ -124,7 +125,10 @@ public class ClaimLease extends BoughtTransaction
|
||||
OfflinePlayer buyerPlayer = Bukkit.getOfflinePlayer(buyer);
|
||||
OfflinePlayer seller = owner == null ? null : Bukkit.getOfflinePlayer(owner);
|
||||
|
||||
String claimType = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null).parent == null ? "claim" : "subclaim";
|
||||
String claimType = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null).parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim : RealEstate.instance.messages.keywordSubclaim;
|
||||
String location = "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() +
|
||||
", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]";
|
||||
|
||||
if(Utils.makePayment(owner, buyer, price, false, false))
|
||||
{
|
||||
@ -134,42 +138,42 @@ public class ClaimLease extends BoughtTransaction
|
||||
{
|
||||
if(buyerPlayer.isOnline() && RealEstate.instance.config.cfgMessageBuyer)
|
||||
{
|
||||
((Player)buyerPlayer).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"Paid lease for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() +
|
||||
", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + " for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
|
||||
ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
|
||||
Messages.sendMessage(buyerPlayer.getPlayer(), RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentBuyer,
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price),
|
||||
paymentsLeft + "");
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.buyer);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"Paid lease for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() +
|
||||
", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + " for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
|
||||
ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentBuyer,
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price),
|
||||
paymentsLeft + ""));
|
||||
}
|
||||
|
||||
if(owner != null)
|
||||
{
|
||||
if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner)
|
||||
{
|
||||
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
|
||||
ChatColor.AQUA + " has paid lease for the " + claimType + " at " + ChatColor.BLUE + "[" +
|
||||
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + " at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
|
||||
ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
|
||||
Messages.sendMessage(seller.getPlayer(), RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentOwner,
|
||||
buyerPlayer.getName(),
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price),
|
||||
paymentsLeft + "");
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.owner);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
|
||||
ChatColor.AQUA + " has paid lease for the " + claimType + " at " + ChatColor.BLUE + "[" +
|
||||
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + " at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
|
||||
ChatColor.AQUA + ", " + ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentOwner,
|
||||
buyerPlayer.getName(),
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price),
|
||||
paymentsLeft + ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -177,40 +181,36 @@ public class ClaimLease extends BoughtTransaction
|
||||
{
|
||||
if(buyerPlayer.isOnline() && RealEstate.instance.config.cfgMessageBuyer)
|
||||
{
|
||||
((Player)buyerPlayer).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"Paid final lease for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() +
|
||||
", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + " for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
|
||||
ChatColor.AQUA + ", the " + claimType + " is now yours");
|
||||
Messages.sendMessage(buyerPlayer.getPlayer(), RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentBuyerFinal,
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price));
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.buyer);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"Paid final lease for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() +
|
||||
", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + " for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
|
||||
ChatColor.AQUA + ", the " + claimType + " is now yours");
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentBuyerFinal,
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price)));
|
||||
}
|
||||
|
||||
if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner)
|
||||
{
|
||||
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
|
||||
ChatColor.AQUA + " has paid lease for the " + claimType + " at " + ChatColor.BLUE + "[" +
|
||||
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + "at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
|
||||
ChatColor.AQUA + ", the " + claimType + " is now his property");
|
||||
Messages.sendMessage(seller.getPlayer(), RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentOwnerFinal,
|
||||
buyerPlayer.getName(),
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price));
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.owner);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
|
||||
ChatColor.AQUA + " has paid lease for the " + claimType + " at " + ChatColor.BLUE + "[" +
|
||||
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + "at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() +
|
||||
ChatColor.AQUA + ", the " + claimType + " is now his property");
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentOwnerFinal,
|
||||
buyerPlayer.getName(),
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price)));
|
||||
}
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
|
||||
|
||||
@ -235,39 +235,44 @@ public class ClaimLease extends BoughtTransaction
|
||||
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
|
||||
|
||||
String claimType = claim.parent == null ? "claim" : "subclaim";
|
||||
String claimType = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim;
|
||||
String location = "[" + sign.getWorld().getName() + ", X: " +
|
||||
sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]";
|
||||
|
||||
if(buyerPlayer.isOnline() && RealEstate.instance.config.cfgMessageBuyer)
|
||||
{
|
||||
((Player)buyerPlayer).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"Couldn't pay the lease for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " +
|
||||
sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + ChatColor.RED + ", the transaction has been cancelled.");
|
||||
Messages.sendMessage(buyerPlayer.getPlayer(), RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentBuyerCancelled,
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price));
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.buyer);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"Couldn't pay the lease for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " +
|
||||
sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + ChatColor.RED + ", the transaction has been cancelled.");
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentBuyerCancelled,
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price)));
|
||||
}
|
||||
if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner)
|
||||
{
|
||||
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
|
||||
ChatColor.AQUA + " couldn't pay lease for the " + claimType + " at " + ChatColor.BLUE + "[" +
|
||||
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + ", the transaction has been cancelled");
|
||||
Messages.sendMessage(seller.getPlayer(), RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentOwnerCancelled,
|
||||
buyerPlayer.getName(),
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price));
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.owner);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + buyerPlayer.getName() +
|
||||
ChatColor.AQUA + " couldn't pay lease for the " + claimType + " at " + ChatColor.BLUE + "[" +
|
||||
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + ", the transaction has been cancelled");
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoLeasePaymentOwnerCancelled,
|
||||
buyerPlayer.getName(),
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price)));
|
||||
}
|
||||
|
||||
claim.managers.remove(buyer.toString());
|
||||
@ -293,9 +298,13 @@ public class ClaimLease extends BoughtTransaction
|
||||
else
|
||||
{
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
|
||||
if(p != null)
|
||||
p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "This " + (claim.parent == null ? "claim" : "subclaim") +
|
||||
" is currently leased, you can't cancel the transaction!");
|
||||
if(p != null) {
|
||||
Messages.sendMessage(p, RealEstate.instance.messages.msgErrorCantCancelAlreadyLeased,
|
||||
claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -312,40 +321,34 @@ public class ClaimLease extends BoughtTransaction
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);// getting by id creates errors for subclaims
|
||||
if(claim == null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "This claim does not exist!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimDoesNotExist);
|
||||
RealEstate.transactionsStore.cancelTransaction(claim);
|
||||
return;
|
||||
}
|
||||
String claimType = claim.parent == null ? "claim" : "subclaim";
|
||||
String claimTypeDisplay = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim;
|
||||
|
||||
if (owner != null && owner.equals(player.getUniqueId()))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You already own this " + claimType + "!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimAlreadyOwner, claimTypeDisplay);
|
||||
return;
|
||||
}
|
||||
if(claim.parent == null && owner != null && !owner.equals(claim.ownerID))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + Bukkit.getPlayer(owner).getDisplayName() +
|
||||
" does not have the right to put this " + claimType + " for lease!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimNotLeasedByOwner, claimTypeDisplay);
|
||||
RealEstate.transactionsStore.cancelTransaction(claim);
|
||||
return;
|
||||
}
|
||||
if(!player.hasPermission("realestate." + claimType + ".lease"))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You do not have the permission to lease " +
|
||||
claimType + "s!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimNoLeasePermission, claimTypeDisplay);
|
||||
return;
|
||||
}
|
||||
if(player.getUniqueId().equals(buyer))
|
||||
if(player.getUniqueId().equals(buyer) || buyer != null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You are already leasing this " +
|
||||
claimType + "!");
|
||||
return;
|
||||
}
|
||||
if(buyer != null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Someone already leases this " +
|
||||
claimType + "!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimAlreadyLeased, claimTypeDisplay);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -355,48 +358,51 @@ public class ClaimLease extends BoughtTransaction
|
||||
lastPayment = LocalDateTime.now();
|
||||
paymentsLeft--;
|
||||
claim.setPermission(buyer.toString(), ClaimPermission.Build);
|
||||
claim.allowGrantPermission(player);
|
||||
claim.setPermission(player.getUniqueId().toString(), ClaimPermission.Manage);
|
||||
GriefPrevention.instance.dataStore.saveClaim(claim);
|
||||
getHolder().breakNaturally();// leases don't have signs indicating the remaining time
|
||||
update();
|
||||
RealEstate.transactionsStore.saveData();
|
||||
|
||||
String location = "[" + player.getLocation().getWorld() + ", " +
|
||||
"X: " + player.getLocation().getBlockX() + ", " +
|
||||
"Y: " + player.getLocation().getBlockY() + ", " +
|
||||
"Z: " + player.getLocation().getBlockZ() + "]";
|
||||
|
||||
RealEstate.instance.addLogEntry(
|
||||
"[" + RealEstate.transactionsStore.dateFormat.format(RealEstate.transactionsStore.date) + "] " + player.getName() +
|
||||
" has started leasing a " + claimType + " at " +
|
||||
"[" + player.getLocation().getWorld() + ", " +
|
||||
"X: " + player.getLocation().getBlockX() + ", " +
|
||||
"Y: " + player.getLocation().getBlockY() + ", " +
|
||||
"Z: " + player.getLocation().getBlockZ() + "] " +
|
||||
"Price: " + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
location +
|
||||
" Price: " + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
|
||||
if(owner != null)
|
||||
{
|
||||
OfflinePlayer seller = Bukkit.getOfflinePlayer(owner);
|
||||
if(RealEstate.instance.config.cfgMessageOwner && seller.isOnline())
|
||||
{
|
||||
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() + ChatColor.AQUA +
|
||||
" has just paid for your lease for the " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " + sign.getBlockY() + ", Z: "
|
||||
+ sign.getBlockZ() + "]" + ChatColor.AQUA +
|
||||
" for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + ", " +
|
||||
ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
|
||||
Messages.sendMessage(seller.getPlayer(), RealEstate.instance.messages.msgInfoClaimOwnerLeaseStarted,
|
||||
player.getName(),
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
location,
|
||||
paymentsLeft + "");
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.owner);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() + ChatColor.AQUA +
|
||||
" has just paid for your lease for the " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " + sign.getBlockY() + ", Z: "
|
||||
+ sign.getBlockZ() + "]" + ChatColor.AQUA +
|
||||
" for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + ", " +
|
||||
ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimOwnerLeaseStarted,
|
||||
player.getName(),
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
location,
|
||||
paymentsLeft + ""));
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "You have successfully paid lease for this " + claimType +
|
||||
" for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + ", " +
|
||||
ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoClaimBuyerLeaseStarted,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
paymentsLeft + "");
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,27 +410,32 @@ public class ClaimLease extends BoughtTransaction
|
||||
public void preview(Player player)
|
||||
{
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
|
||||
String msg = "";
|
||||
if(player.hasPermission("realestate.info"))
|
||||
{
|
||||
String claimType = claim.parent == null ? "claim" : "subclaim";
|
||||
msg = ChatColor.BLUE + "-----= " + ChatColor.WHITE + "[" + ChatColor.GOLD + "RealEstate Rent Info" + ChatColor.WHITE + "]" +
|
||||
ChatColor.BLUE + " =-----\n";
|
||||
String claimTypeDisplay = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim;
|
||||
String msg;
|
||||
msg = Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoLeaseHeader) + "\n";
|
||||
if(buyer == null)
|
||||
{
|
||||
msg += ChatColor.AQUA + "This " + claimType + " is for lease for " +
|
||||
ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments of " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + " each.\nPayments are due every " +
|
||||
ChatColor.GREEN + Utils.getTime(frequency, null, true) + "\n";
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoGeneralLeaseNoBuyer,
|
||||
claimTypeDisplay,
|
||||
paymentsLeft + "",
|
||||
RealEstate.econ.format(price),
|
||||
Utils.getTime(frequency, null, true)) + "\n";
|
||||
|
||||
if(claimType.equalsIgnoreCase("claim"))
|
||||
{
|
||||
msg += ChatColor.AQUA + "The current owner is: " + ChatColor.GREEN + claim.getOwnerName();
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoOwner,
|
||||
claim.getOwnerName()) + "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += ChatColor.AQUA + "The main claim owner is: " + ChatColor.GREEN + claim.getOwnerName() + "\n";
|
||||
msg += ChatColor.LIGHT_PURPLE + "Note: " + ChatColor.AQUA + "You will only get access to this subclaim!";
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoMainOwner,
|
||||
claim.parent.getOwnerName()) + "\n";
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoNote) + "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -439,40 +450,46 @@ public class ClaimLease extends BoughtTransaction
|
||||
int daysLeft = frequency - days - 1;// we need to remove the current day
|
||||
Duration timeRemaining = Duration.ofHours(24).minus(hours);
|
||||
|
||||
msg += ChatColor.AQUA + "This " + claimType + " is currently leased by " +
|
||||
ChatColor.GREEN + Bukkit.getOfflinePlayer(buyer).getName() + ChatColor.AQUA + " for " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + ". There is " +
|
||||
ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " payments left. Next payment is in " +
|
||||
ChatColor.GREEN + Utils.getTime(daysLeft, timeRemaining, true) + ChatColor.AQUA + ".\n";
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoGeneralLeaseBuyer,
|
||||
claimTypeDisplay,
|
||||
Bukkit.getOfflinePlayer(buyer).getName(),
|
||||
RealEstate.econ.format(price),
|
||||
paymentsLeft + "",
|
||||
Utils.getTime(daysLeft, timeRemaining, true),
|
||||
Utils.getTime(frequency, null, true)) + "\n";
|
||||
if(claimType.equalsIgnoreCase("claim"))
|
||||
{
|
||||
msg += ChatColor.AQUA + "The current owner is: " + ChatColor.GREEN + claim.getOwnerName();
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += ChatColor.AQUA + "The main claim owner is: " + ChatColor.GREEN + claim.getOwnerName();
|
||||
}
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoOwner,
|
||||
claim.getOwnerName()) + "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoMainOwner,
|
||||
claim.parent.getOwnerName()) + "\n";
|
||||
}
|
||||
}
|
||||
Messages.sendMessage(player, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to view real estate informations!";
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimNoInfoPermission);
|
||||
}
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void msgInfo(CommandSender cs)
|
||||
{
|
||||
cs.sendMessage(ChatColor.DARK_GREEN + "" + GriefPrevention.instance.dataStore.getClaim(claimId).getArea() +
|
||||
ChatColor.AQUA + " blocks to " + ChatColor.DARK_GREEN + "Lease " + ChatColor.AQUA + "at " + ChatColor.DARK_GREEN +
|
||||
"[" + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getWorld().getName() + ", " +
|
||||
"X: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockX() + ", " +
|
||||
"Y: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockY() + ", " +
|
||||
"Z: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockZ() + "] " + ChatColor.AQUA + "for " +
|
||||
ChatColor.GREEN + paymentsLeft + ChatColor.AQUA + " periods of " + ChatColor.GREEN + Utils.getTime(frequency, Duration.ZERO, false) +
|
||||
ChatColor.AQUA + ", each period costs " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural()
|
||||
);
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
|
||||
String location = "[" + claim.getLesserBoundaryCorner().getWorld().getName() + ", " +
|
||||
"X: " + claim.getLesserBoundaryCorner().getBlockX() + ", " +
|
||||
"Y: " + claim.getLesserBoundaryCorner().getBlockY() + ", " +
|
||||
"Z: " + claim.getLesserBoundaryCorner().getBlockZ() + "]";
|
||||
|
||||
Messages.sendMessage(cs, RealEstate.instance.messages.msgInfoClaimInfoLeaseOneline,
|
||||
claim.getArea() + "",
|
||||
location,
|
||||
RealEstate.econ.format(price),
|
||||
paymentsLeft + "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
|
||||
import me.EtienneDx.RealEstate.Messages;
|
||||
import me.EtienneDx.RealEstate.RealEstate;
|
||||
import me.EtienneDx.RealEstate.Utils;
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
@ -80,7 +81,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, Messages.getMessage(RealEstate.instance.config.cfgSignsHeader, false));
|
||||
s.setLine(1, ChatColor.DARK_GREEN + RealEstate.instance.config.cfgReplaceRent);
|
||||
//s.setLine(2, owner != null ? Bukkit.getOfflinePlayer(owner).getName() : "SERVER");
|
||||
String price_line = "";
|
||||
@ -163,10 +164,15 @@ public class ClaimRent extends BoughtTransaction
|
||||
GriefPrevention.instance.dataStore.saveClaim(claim);
|
||||
if(msgBuyer && Bukkit.getOfflinePlayer(buyer).isOnline() && RealEstate.instance.config.cfgMessageBuyer)
|
||||
{
|
||||
Bukkit.getPlayer(buyer).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"The rent for the " + (claim.parent == null ? "claim" : "subclaim") + " at " + ChatColor.BLUE + "[" +
|
||||
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + ChatColor.AQUA + " is now over, your access has been revoked.");
|
||||
String location = "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]";
|
||||
String claimType = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim;
|
||||
|
||||
Messages.sendMessage(Bukkit.getPlayer(buyer), RealEstate.instance.messages.msgInfoClaimInfoRentCancelled,
|
||||
claimType,
|
||||
location);
|
||||
}
|
||||
buyer = null;
|
||||
RealEstate.transactionsStore.saveData();
|
||||
@ -180,46 +186,50 @@ public class ClaimRent extends BoughtTransaction
|
||||
OfflinePlayer buyerPlayer = Bukkit.getOfflinePlayer(this.buyer);
|
||||
OfflinePlayer seller = owner == null ? null : Bukkit.getOfflinePlayer(owner);
|
||||
|
||||
String claimType = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null).parent == null ? "claim" : "subclaim";
|
||||
String claimType = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null).parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim;
|
||||
String location = "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]";
|
||||
|
||||
if((autoRenew || periodCount < maxPeriod) && Utils.makePayment(owner, this.buyer, price, false, false))
|
||||
if((autoRenew || periodCount + 1 < maxPeriod) && Utils.makePayment(owner, this.buyer, price, false, false))
|
||||
{
|
||||
periodCount = (periodCount + 1) % maxPeriod;
|
||||
startDate = LocalDateTime.now();
|
||||
if(buyerPlayer.isOnline() && RealEstate.instance.config.cfgMessageBuyer)
|
||||
{
|
||||
((Player)buyerPlayer).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"Paid rent for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() +
|
||||
", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + "for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(buyerPlayer.getPlayer(), RealEstate.instance.messages.msgInfoClaimInfoRentPaymentBuyer,
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price));
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.buyer);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.AQUA +
|
||||
"Paid rent for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() +
|
||||
", Y: " + sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + "for the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoRentPaymentBuyer,
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price)));
|
||||
}
|
||||
|
||||
if(seller != null)
|
||||
{
|
||||
if(seller.isOnline() && RealEstate.instance.config.cfgMessageOwner)
|
||||
{
|
||||
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + buyerPlayer.getName() +
|
||||
" has paid rent for the " + claimType + " at " + ChatColor.BLUE + "[" +
|
||||
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + "at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(seller.getPlayer(), RealEstate.instance.messages.msgInfoClaimInfoRentPaymentOwner,
|
||||
buyerPlayer.getName(),
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price));
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.owner);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + buyerPlayer.getName() +
|
||||
" has paid rent for the " + claimType + " at " + ChatColor.BLUE + "[" +
|
||||
sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" +
|
||||
ChatColor.AQUA + "at the price of " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoRentPaymentOwner,
|
||||
buyerPlayer.getName(),
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,18 +238,18 @@ public class ClaimRent extends BoughtTransaction
|
||||
{
|
||||
if(buyerPlayer.isOnline() && RealEstate.instance.config.cfgMessageBuyer)
|
||||
{
|
||||
((Player)buyerPlayer).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"Couldn't pay the rent for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " +
|
||||
sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + ChatColor.RED + ", your access has been revoked.");
|
||||
Messages.sendMessage(buyerPlayer.getPlayer(), RealEstate.instance.messages.msgInfoClaimInfoRentPaymentBuyerCancelled,
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price));
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.buyer);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"Couldn't pay the rent for the " + claimType + " at " + ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " +
|
||||
sign.getBlockX() + ", Y: " +
|
||||
sign.getBlockY() + ", Z: " + sign.getBlockZ() + "]" + ChatColor.RED + ", your access has been revoked.");
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoRentPaymentBuyerCancelled,
|
||||
claimType,
|
||||
location,
|
||||
RealEstate.econ.format(price)));
|
||||
}
|
||||
unRent(false);
|
||||
return;
|
||||
@ -267,9 +277,13 @@ public class ClaimRent extends BoughtTransaction
|
||||
else
|
||||
{
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
|
||||
if(p != null)
|
||||
p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "This " + (claim.parent == null ? "claim" : "subclaim") +
|
||||
" is currently rented, you can't cancel the transaction!");
|
||||
if(p != null) {
|
||||
Messages.sendMessage(p, RealEstate.instance.messages.msgErrorCantCancelAlreadyRented,
|
||||
claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -286,40 +300,33 @@ public class ClaimRent extends BoughtTransaction
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);// getting by id creates errors for subclaims
|
||||
if(claim == null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "This claim does not exist!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimDoesNotExist);
|
||||
RealEstate.transactionsStore.cancelTransaction(claim);
|
||||
return;
|
||||
}
|
||||
String claimType = claim.parent == null ? "claim" : "subclaim";
|
||||
String claimTypeDisplay = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim : RealEstate.instance.messages.keywordSubclaim;
|
||||
|
||||
if (owner != null && owner.equals(player.getUniqueId()))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You already own this " + claimType + "!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimAlreadyOwner, claimTypeDisplay);
|
||||
return;
|
||||
}
|
||||
if(claim.parent == null && owner != null && !owner.equals(claim.ownerID))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + Bukkit.getOfflinePlayer(owner).getName() +
|
||||
" does not have the right to rent this " + claimType + "!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimNotRentedByOwner, claimTypeDisplay);
|
||||
RealEstate.transactionsStore.cancelTransaction(claim);
|
||||
return;
|
||||
}
|
||||
if(!player.hasPermission("realestate." + claimType + ".rent"))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You do not have the permission to rent " +
|
||||
claimType + "s!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimNoRentPermission, claimTypeDisplay);
|
||||
return;
|
||||
}
|
||||
if(player.getUniqueId().equals(buyer))
|
||||
if(player.getUniqueId().equals(buyer) || buyer != null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You are already renting this " +
|
||||
claimType + "!");
|
||||
return;
|
||||
}
|
||||
if(buyer != null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Someone already rents this " +
|
||||
claimType + "!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimAlreadyRented, claimTypeDisplay);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -328,8 +335,9 @@ public class ClaimRent extends BoughtTransaction
|
||||
buyer = player.getUniqueId();
|
||||
startDate = LocalDateTime.now();
|
||||
autoRenew = false;
|
||||
periodCount = 0;
|
||||
claim.setPermission(buyer.toString(), buildTrust ? ClaimPermission.Build : ClaimPermission.Inventory);
|
||||
claim.allowGrantPermission(player);
|
||||
claim.setPermission(player.getUniqueId().toString(), ClaimPermission.Manage);
|
||||
claim.managers.add(player.getUniqueId().toString());
|
||||
claim.setSubclaimRestrictions(true);
|
||||
GriefPrevention.instance.dataStore.saveClaim(claim);
|
||||
@ -348,28 +356,33 @@ public class ClaimRent extends BoughtTransaction
|
||||
if(owner != null)
|
||||
{
|
||||
OfflinePlayer seller = Bukkit.getOfflinePlayer(owner);
|
||||
String location = "[" + sign.getWorld().getName() + ", " +
|
||||
"X: " + sign.getBlockX() + ", " +
|
||||
"Y: " + sign.getBlockY() + ", " +
|
||||
"Z: " + sign.getBlockZ() + "]";
|
||||
|
||||
if(RealEstate.instance.config.cfgMessageOwner && seller.isOnline())
|
||||
{
|
||||
((Player)seller).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() + ChatColor.AQUA +
|
||||
" has just rented your " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " + sign.getBlockY() + ", Z: "
|
||||
+ sign.getBlockZ() + "]" + ChatColor.AQUA +
|
||||
" for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(seller.getPlayer(), RealEstate.instance.messages.msgInfoClaimOwnerRented,
|
||||
player.getName(),
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
location);
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(this.owner);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.GREEN + player.getName() + ChatColor.AQUA +
|
||||
" has just rented your " + claimType + " at " +
|
||||
ChatColor.BLUE + "[" + sign.getWorld().getName() + ", X: " + sign.getBlockX() + ", Y: " + sign.getBlockY() + ", Z: "
|
||||
+ sign.getBlockZ() + "]" + ChatColor.AQUA +
|
||||
" for " + ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimOwnerRented,
|
||||
player.getName(),
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
location));
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "You have successfully rented this " + claimType +
|
||||
" for " + ChatColor.GREEN + price + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoClaimBuyerRented,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price));
|
||||
|
||||
destroySign();
|
||||
}
|
||||
@ -379,27 +392,36 @@ public class ClaimRent extends BoughtTransaction
|
||||
public void preview(Player player)
|
||||
{
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
|
||||
String msg = "";
|
||||
if(player.hasPermission("realestate.info"))
|
||||
{
|
||||
String claimType = claim.parent == null ? "claim" : "subclaim";
|
||||
msg = ChatColor.BLUE + "-----= " + ChatColor.WHITE + "[" + ChatColor.GOLD + "RealEstate Rent Info" + ChatColor.WHITE + "]" +
|
||||
ChatColor.BLUE + " =-----\n";
|
||||
String claimTypeDisplay = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim;
|
||||
String msg;
|
||||
msg = Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoRentHeader) + "\n";
|
||||
if(buyer == null)
|
||||
{
|
||||
msg += ChatColor.AQUA + "This " + claimType + " is for rent for " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + " for " +
|
||||
(maxPeriod > 1 ? "" + ChatColor.GREEN + maxPeriod + ChatColor.AQUA + " periods of " : "") +
|
||||
ChatColor.GREEN + Utils.getTime(duration, null, true) + "\n";
|
||||
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoGeneralRentNoBuyer,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
Utils.getTime(duration, null, true)) + "\n";
|
||||
if(maxPeriod > 1)
|
||||
{
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoRentMaxPeriod,
|
||||
maxPeriod + "") + "\n";
|
||||
}
|
||||
|
||||
if(claimType.equalsIgnoreCase("claim"))
|
||||
{
|
||||
msg += ChatColor.AQUA + "The current owner is: " + ChatColor.GREEN + claim.getOwnerName();
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoOwner,
|
||||
claim.getOwnerName()) + "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += ChatColor.AQUA + "The main claim owner is: " + ChatColor.GREEN + claim.getOwnerName() + "\n";
|
||||
msg += ChatColor.LIGHT_PURPLE + "Note: " + ChatColor.AQUA + "You will only rent access to this subclaim!";
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoMainOwner,
|
||||
claim.parent.getOwnerName()) + "\n";
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoNote) + "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -414,44 +436,59 @@ public class ClaimRent extends BoughtTransaction
|
||||
int daysLeft = duration - days - 1;// we need to remove the current day
|
||||
Duration timeRemaining = Duration.ofHours(24).minus(hours);
|
||||
|
||||
msg += ChatColor.AQUA + "This " + claimType + " is currently rented by " +
|
||||
ChatColor.GREEN + Bukkit.getOfflinePlayer(buyer).getName() + ChatColor.AQUA + " for " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + " for " +
|
||||
(maxPeriod - periodCount > 1 ? "" + ChatColor.GREEN + (maxPeriod - periodCount) + ChatColor.AQUA + " periods of " +
|
||||
ChatColor.GREEN + Utils.getTime(duration, null, false) + ChatColor.AQUA + ". The current period will end in " : "another ") +
|
||||
ChatColor.GREEN + Utils.getTime(daysLeft, timeRemaining, true) + "\n";
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoGeneralRentBuyer,
|
||||
claimTypeDisplay,
|
||||
Bukkit.getOfflinePlayer(buyer).getName(),
|
||||
RealEstate.econ.format(price),
|
||||
Utils.getTime(daysLeft, timeRemaining, true),
|
||||
Utils.getTime(duration, null, true)) + "\n";
|
||||
|
||||
if(maxPeriod > 1 && maxPeriod - periodCount > 0)
|
||||
{
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoRentRemainingPeriods,
|
||||
(maxPeriod - periodCount) + "") + "\n";
|
||||
}
|
||||
|
||||
if((owner != null && owner.equals(player.getUniqueId()) || buyer.equals(player.getUniqueId())) && RealEstate.instance.config.cfgEnableAutoRenew)
|
||||
{
|
||||
msg += ChatColor.AQUA + "Automatic renew is currently " + ChatColor.LIGHT_PURPLE + (autoRenew ? "enabled" : "disabled") + "\n";
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoRentAutoRenew,
|
||||
autoRenew ?
|
||||
RealEstate.instance.messages.keywordEnabled :
|
||||
RealEstate.instance.messages.keywordDisabled) + "\n";
|
||||
}
|
||||
if(claimType.equalsIgnoreCase("claim"))
|
||||
{
|
||||
msg += ChatColor.AQUA + "The current owner is: " + ChatColor.GREEN + claim.getOwnerName();
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += ChatColor.AQUA + "The main claim owner is: " + ChatColor.GREEN + claim.getOwnerName();
|
||||
}
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoOwner,
|
||||
claim.getOwnerName()) + "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoMainOwner,
|
||||
claim.parent.getOwnerName()) + "\n";
|
||||
}
|
||||
}
|
||||
Messages.sendMessage(player, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to view real estate informations!";
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimNoInfoPermission);
|
||||
}
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void msgInfo(CommandSender cs)
|
||||
{
|
||||
cs.sendMessage(ChatColor.DARK_GREEN + "" + GriefPrevention.instance.dataStore.getClaim(claimId).getArea() +
|
||||
ChatColor.AQUA + " blocks to " + ChatColor.DARK_GREEN + "Rent " + ChatColor.AQUA + "at " + ChatColor.DARK_GREEN +
|
||||
"[" + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getWorld().getName() + ", " +
|
||||
"X: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockX() + ", " +
|
||||
"Y: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockY() + ", " +
|
||||
"Z: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockZ() + "] " + ChatColor.AQUA + "for " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + ChatColor.AQUA + " per period of " + ChatColor.GREEN +
|
||||
Utils.getTime(duration, Duration.ZERO, false));
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
|
||||
String location = "[" + claim.getLesserBoundaryCorner().getWorld().getName() + ", " +
|
||||
"X: " + claim.getLesserBoundaryCorner().getBlockX() + ", " +
|
||||
"Y: " + claim.getLesserBoundaryCorner().getBlockY() + ", " +
|
||||
"Z: " + claim.getLesserBoundaryCorner().getBlockZ() + "]";
|
||||
|
||||
Messages.sendMessage(cs, RealEstate.instance.messages.msgInfoClaimInfoRentOneline,
|
||||
claim.getArea() + "",
|
||||
location,
|
||||
RealEstate.econ.format(price),
|
||||
Utils.getTime(duration, Duration.ZERO, false));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
|
||||
import me.EtienneDx.RealEstate.Messages;
|
||||
import me.EtienneDx.RealEstate.RealEstate;
|
||||
import me.EtienneDx.RealEstate.Utils;
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
@ -37,7 +38,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, Messages.getMessage(RealEstate.instance.config.cfgSignsHeader, false));
|
||||
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)
|
||||
@ -85,38 +86,40 @@ public class ClaimSell extends ClaimTransaction
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);// getting by id creates errors for subclaims
|
||||
if(claim == null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "This claim does not exist!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimDoesNotExist);
|
||||
RealEstate.transactionsStore.cancelTransaction(claim);
|
||||
return;
|
||||
}
|
||||
String claimType = claim.parent == null ? "claim" : "subclaim";
|
||||
String claimTypeDisplay = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim : RealEstate.instance.messages.keywordSubclaim;
|
||||
|
||||
if (player.getUniqueId().equals(owner))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You already own this " + claimType + "!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimAlreadyOwner, claimTypeDisplay);
|
||||
return;
|
||||
}
|
||||
if(claim.parent == null && owner != null && !owner.equals(claim.ownerID))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + Bukkit.getPlayer(owner).getDisplayName() +
|
||||
" does not have the right to sell this " + claimType + "!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimNotSoldByOwner, claimTypeDisplay);
|
||||
RealEstate.transactionsStore.cancelTransaction(claim);
|
||||
return;
|
||||
}
|
||||
if(!player.hasPermission("realestate." + claimType + ".buy"))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "You do not have the permission to purchase " +
|
||||
claimType + "s!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimNoBuyPermission, claimTypeDisplay);
|
||||
return;
|
||||
}
|
||||
// for real claims, you may need to have enough claim blocks in reserve to purchase it (if transferClaimBlocks is false)
|
||||
if(claimType.equalsIgnoreCase("claim") && !RealEstate.instance.config.cfgTransferClaimBlocks &&
|
||||
GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId()).getRemainingClaimBlocks() < claim.getArea())
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"You don't have enough claim blocks to purchase this claim, you need to get " + ChatColor.DARK_GREEN +
|
||||
(claim.getArea() - GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId()).getRemainingClaimBlocks()) +
|
||||
ChatColor.RED + " more blocks!");
|
||||
int remaining = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId()).getRemainingClaimBlocks();
|
||||
int area = claim.getArea();
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimNoClaimBlocks,
|
||||
area + "",
|
||||
remaining + "",
|
||||
(area - remaining) + "");
|
||||
return;
|
||||
}
|
||||
// the player has the right to buy, let's make the payment
|
||||
@ -127,8 +130,15 @@ public class ClaimSell extends ClaimTransaction
|
||||
// normally, this is always the case, so it's not necessary, but until I proven my point, here
|
||||
if(claim.parent != null || claim.ownerID.equals(player.getUniqueId()))
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "You have successfully purchased this " + claimType +
|
||||
" for " + ChatColor.GREEN + price + RealEstate.econ.currencyNamePlural());
|
||||
String location = "[" + player.getLocation().getWorld() + ", " +
|
||||
"X: " + player.getLocation().getBlockX() + ", " +
|
||||
"Y: " + player.getLocation().getBlockY() + ", " +
|
||||
"Z: " + player.getLocation().getBlockZ() + "]";
|
||||
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoClaimBuyerSold,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price));
|
||||
|
||||
RealEstate.instance.addLogEntry(
|
||||
"[" + RealEstate.transactionsStore.dateFormat.format(RealEstate.transactionsStore.date) + "] " + player.getName() +
|
||||
" has purchased a " + claimType + " at " +
|
||||
@ -143,30 +153,26 @@ public class ClaimSell extends ClaimTransaction
|
||||
OfflinePlayer oldOwner = Bukkit.getOfflinePlayer(owner);
|
||||
if(oldOwner.isOnline())
|
||||
{
|
||||
((Player) oldOwner).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + player.getDisplayName() +
|
||||
" has purchased your " + claimType + " at " + ChatColor.BLUE +
|
||||
"[" + player.getLocation().getWorld().getName() + ", " +
|
||||
"X: " + player.getLocation().getBlockX() + ", " +
|
||||
"Y: " + player.getLocation().getBlockY() + ", " +
|
||||
"Z: " + player.getLocation().getBlockZ() + "] " + ChatColor.AQUA + "for " + ChatColor.GREEN +
|
||||
price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(oldOwner.getPlayer(), RealEstate.instance.messages.msgInfoClaimOwnerSold,
|
||||
player.getName(),
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
location);
|
||||
}
|
||||
else if(RealEstate.instance.config.cfgMailOffline && RealEstate.ess != null)
|
||||
{
|
||||
User u = RealEstate.ess.getUser(owner);
|
||||
u.addMail(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + player.getDisplayName() +
|
||||
" has purchased your " + claimType + " at " + ChatColor.BLUE +
|
||||
"[" + player.getLocation().getWorld().getName() + ", " +
|
||||
"X: " + player.getLocation().getBlockX() + ", " +
|
||||
"Y: " + player.getLocation().getBlockY() + ", " +
|
||||
"Z: " + player.getLocation().getBlockZ() + "] " + ChatColor.AQUA + "for " + ChatColor.GREEN +
|
||||
price + " " + RealEstate.econ.currencyNamePlural());;
|
||||
u.addMail(Messages.getMessage(RealEstate.instance.messages.msgInfoClaimOwnerSold,
|
||||
player.getName(),
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
location));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED + "Cannot purchase claim!");
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorUnexpected);
|
||||
return;
|
||||
}
|
||||
RealEstate.transactionsStore.cancelTransaction(claim);
|
||||
@ -177,29 +183,35 @@ public class ClaimSell extends ClaimTransaction
|
||||
public void preview(Player player)
|
||||
{
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
|
||||
String msg = "";
|
||||
if(player.hasPermission("realestate.info"))
|
||||
{
|
||||
String claimType = claim.parent == null ? "claim" : "subclaim";
|
||||
msg = ChatColor.BLUE + "-----= " + ChatColor.WHITE + "[" + ChatColor.GOLD + "RealEstate Sale Info" + ChatColor.WHITE + "]" +
|
||||
ChatColor.BLUE + " =-----\n";
|
||||
msg += ChatColor.AQUA + "This " + claimType + " is for sale for " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural() + "\n";
|
||||
String claimTypeDisplay = claim.parent == null ?
|
||||
RealEstate.instance.messages.keywordClaim : RealEstate.instance.messages.keywordSubclaim;
|
||||
|
||||
String msg = Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoSellHeader) + "\n";
|
||||
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoSellGeneral,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price)) + "\n";
|
||||
|
||||
if(claimType.equalsIgnoreCase("claim"))
|
||||
{
|
||||
msg += ChatColor.AQUA + "The current owner is: " + ChatColor.GREEN + claim.getOwnerName();
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += ChatColor.AQUA + "The main claim owner is: " + ChatColor.GREEN + claim.getOwnerName() + "\n";
|
||||
msg += ChatColor.LIGHT_PURPLE + "Note: " + ChatColor.AQUA + "You will only buy access to this subclaim!";
|
||||
}
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoOwner,
|
||||
claim.getOwnerName()) + "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoMainOwner,
|
||||
claim.parent.getOwnerName()) + "\n";
|
||||
msg += Messages.getMessage(RealEstate.instance.messages.msgInfoClaimInfoNote) + "\n";
|
||||
}
|
||||
Messages.sendMessage(player, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = RealEstate.instance.config.chatPrefix + ChatColor.RED + "You don't have the permission to view real estate informations!";
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgErrorClaimNoInfoPermission);
|
||||
}
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -211,12 +223,19 @@ public class ClaimSell extends ClaimTransaction
|
||||
@Override
|
||||
public void msgInfo(CommandSender cs)
|
||||
{
|
||||
cs.sendMessage(ChatColor.DARK_GREEN + "" + GriefPrevention.instance.dataStore.getClaim(claimId).getArea() +
|
||||
ChatColor.AQUA + " blocks to " + ChatColor.DARK_GREEN + "Sell " + ChatColor.AQUA + "at " + ChatColor.DARK_GREEN +
|
||||
"[" + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getWorld().getName() + ", " +
|
||||
"X: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockX() + ", " +
|
||||
"Y: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockY() + ", " +
|
||||
"Z: " + GriefPrevention.instance.dataStore.getClaim(claimId).getLesserBoundaryCorner().getBlockZ() + "] " + ChatColor.AQUA + "for " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(sign, false, null);
|
||||
if(claim == null) {
|
||||
tryCancelTransaction(null, true);
|
||||
return;
|
||||
}
|
||||
String location = "[" + claim.getLesserBoundaryCorner().getWorld().getName() + ", " +
|
||||
"X: " + claim.getLesserBoundaryCorner().getBlockX() + ", " +
|
||||
"Y: " + claim.getLesserBoundaryCorner().getBlockY() + ", " +
|
||||
"Z: " + claim.getLesserBoundaryCorner().getBlockZ() + "]";
|
||||
|
||||
Messages.sendMessage(cs, RealEstate.instance.messages.msgInfoClaimInfoSellOneline,
|
||||
claim.getArea() + "",
|
||||
location,
|
||||
RealEstate.econ.format(price));
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,10 +17,12 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import me.EtienneDx.RealEstate.Messages;
|
||||
import me.EtienneDx.RealEstate.RealEstate;
|
||||
import me.EtienneDx.RealEstate.Utils;
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class TransactionsStore
|
||||
{
|
||||
@ -42,7 +44,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 +75,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");
|
||||
@ -196,12 +196,18 @@ public class TransactionsStore
|
||||
"Y: " + claim.getGreaterBoundaryCorner().getBlockY() + ", " +
|
||||
"Z: " + claim.getGreaterBoundaryCorner().getBlockZ() + "] " +
|
||||
"Price: " + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
|
||||
|
||||
String claimPrefix = claim.isAdminClaim() ? RealEstate.instance.messages.keywordAdminClaimPrefix :
|
||||
RealEstate.instance.messages.keywordClaimPrefix;
|
||||
String claimTypeDisplay = claim.parent == null ? RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim;
|
||||
|
||||
if(player != null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "You have successfully created " +
|
||||
(claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " sale for " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoClaimCreatedSell,
|
||||
claimPrefix,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price));
|
||||
}
|
||||
if(RealEstate.instance.config.cfgBroadcastSell)
|
||||
{
|
||||
@ -209,10 +215,11 @@ public class TransactionsStore
|
||||
{
|
||||
if(p != player)
|
||||
{
|
||||
p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.DARK_GREEN + (player == null ? "The Server" : player.getDisplayName()) +
|
||||
ChatColor.AQUA + " has put " +
|
||||
(claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for sale for " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(p, RealEstate.instance.messages.msgInfoClaimCreatedSellBroadcast,
|
||||
player == null ? RealEstate.instance.messages.keywordTheServer : player.getDisplayName(),
|
||||
claimPrefix,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,12 +239,19 @@ public class TransactionsStore
|
||||
"Y: " + claim.getLesserBoundaryCorner().getBlockY() + ", " +
|
||||
"Z: " + claim.getLesserBoundaryCorner().getBlockZ() + "] " +
|
||||
"Price: " + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
|
||||
String claimPrefix = claim.isAdminClaim() ? RealEstate.instance.messages.keywordAdminClaimPrefix :
|
||||
RealEstate.instance.messages.keywordClaimPrefix;
|
||||
String claimTypeDisplay = claim.parent == null ? RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim;
|
||||
|
||||
if(player != null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "You have successfully put " +
|
||||
(claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for" + (buildTrust ? "" : " container") + " rent for " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoClaimCreatedRent,
|
||||
claimPrefix,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
Utils.getTime(duration, null, false));
|
||||
}
|
||||
if(RealEstate.instance.config.cfgBroadcastSell)
|
||||
{
|
||||
@ -245,10 +259,12 @@ public class TransactionsStore
|
||||
{
|
||||
if(p != player)
|
||||
{
|
||||
p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.DARK_GREEN + (player == null ? "The Server" : player.getDisplayName()) +
|
||||
ChatColor.AQUA + " has put " +
|
||||
(claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for" + (buildTrust ? "" : " container") + " rent for " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(p, RealEstate.instance.messages.msgInfoClaimCreatedRentBroadcast,
|
||||
player == null ? RealEstate.instance.messages.keywordTheServer : player.getDisplayName(),
|
||||
claimPrefix,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
Utils.getTime(duration, null, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -269,13 +285,20 @@ public class TransactionsStore
|
||||
"Z: " + claim.getLesserBoundaryCorner().getBlockZ() + "] " +
|
||||
"Payments Count : " + paymentsCount + " " +
|
||||
"Price: " + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
|
||||
String claimPrefix = claim.isAdminClaim() ? RealEstate.instance.messages.keywordAdminClaimPrefix :
|
||||
RealEstate.instance.messages.keywordClaimPrefix;
|
||||
String claimTypeDisplay = claim.parent == null ? RealEstate.instance.messages.keywordClaim :
|
||||
RealEstate.instance.messages.keywordSubclaim;
|
||||
|
||||
if(player != null)
|
||||
{
|
||||
player.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.AQUA + "You have successfully put " +
|
||||
(claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for lease for " +
|
||||
ChatColor.GREEN + paymentsCount + ChatColor.AQUA + " payments of " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(player, RealEstate.instance.messages.msgInfoClaimCreatedLease,
|
||||
claimPrefix,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
paymentsCount + "",
|
||||
Utils.getTime(frequency, null, false));
|
||||
}
|
||||
if(RealEstate.instance.config.cfgBroadcastSell)
|
||||
{
|
||||
@ -283,11 +306,13 @@ public class TransactionsStore
|
||||
{
|
||||
if(p != player)
|
||||
{
|
||||
p.sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.DARK_GREEN + (player == null ? "The Server" : player.getDisplayName()) +
|
||||
ChatColor.AQUA + " has put " +
|
||||
(claim.isAdminClaim() ? "an admin" : "a") + " " + (claim.parent == null ? "claim" : "subclaim") + " for lease for " +
|
||||
ChatColor.GREEN + paymentsCount + ChatColor.AQUA + " payments of " +
|
||||
ChatColor.GREEN + price + " " + RealEstate.econ.currencyNamePlural());
|
||||
Messages.sendMessage(p, RealEstate.instance.messages.msgInfoClaimCreatedLeaseBroadcast,
|
||||
player == null ? RealEstate.instance.messages.keywordTheServer : player.getDisplayName(),
|
||||
claimPrefix,
|
||||
claimTypeDisplay,
|
||||
RealEstate.econ.format(price),
|
||||
paymentsCount + "",
|
||||
Utils.getTime(frequency, null, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,13 +5,11 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import me.ryanhamshire.GriefPrevention.ClaimPermission;
|
||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||
import me.ryanhamshire.GriefPrevention.PlayerData;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
|
||||
public class Utils
|
||||
@ -24,13 +22,11 @@ public class Utils
|
||||
{
|
||||
if(b.isOnline() && msgBuyer)
|
||||
{
|
||||
((Player)b).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"You don't have enough money to make this transaction!");
|
||||
Messages.sendMessage(b.getPlayer(), RealEstate.instance.messages.msgErrorNoMoneySelf);
|
||||
}
|
||||
if(s != null && s.isOnline() && msgSeller)
|
||||
{
|
||||
((Player)s).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
b.getName() + " doesn't have enough money to make this transaction!");
|
||||
Messages.sendMessage(s.getPlayer(), RealEstate.instance.messages.msgErrorNoMoneyOther, b.getName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -39,13 +35,11 @@ public class Utils
|
||||
{
|
||||
if(b.isOnline() && msgBuyer)
|
||||
{
|
||||
((Player)b).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"Could not withdraw the money!");
|
||||
Messages.sendMessage(b.getPlayer(), RealEstate.instance.messages.msgErrorNoWithdrawSelf);
|
||||
}
|
||||
if(s != null && s.isOnline() && msgSeller)
|
||||
{
|
||||
((Player)s).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"Could not withdraw the money!");
|
||||
Messages.sendMessage(b.getPlayer(), RealEstate.instance.messages.msgErrorNoWithdrawOther);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -56,13 +50,11 @@ public class Utils
|
||||
{
|
||||
if(b.isOnline() && msgBuyer)
|
||||
{
|
||||
((Player)b).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"Could not deposit to " + s.getName() + ", refunding Player!");
|
||||
Messages.sendMessage(b.getPlayer(), RealEstate.instance.messages.msgErrorNoDepositOther, s.getName());
|
||||
}
|
||||
if(s != null && s.isOnline() && msgSeller)
|
||||
{
|
||||
((Player)s).sendMessage(RealEstate.instance.config.chatPrefix + ChatColor.RED +
|
||||
"Could not deposit to you, refunding" + b.getName() + "!");
|
||||
Messages.sendMessage(b.getPlayer(), RealEstate.instance.messages.msgErrorNoDepositSelf, b.getName());
|
||||
}
|
||||
RealEstate.econ.depositPlayer(b, amount);
|
||||
return false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user