Skip to content

Commit e686780

Browse files
authored
Merge pull request #36 from EtienneDx/release/1.4.0
Release 1.4.0
2 parents 17f80c3 + 3cb0895 commit e686780

20 files changed

Lines changed: 1141 additions & 642 deletions

.github/workflows/maven-publish.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ target/*
77
build.bat
88
/bin/
99
/target/
10+
.vscode

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Changelog
2+
3+
## 1.4.0
4+
5+
### Added
6+
* Readme and changelog files
7+
* Error messages to *messages.yml*
8+
* List messages to *messages.yml*
9+
* Info messages to *messages.yml*
10+
* Support of [GriefPrevention v16.18](https://github.com/TechFortress/GriefPrevention/releases/tag/16.18) and up
11+
* Disabled resizing of parent claims when subclaims are being rented
12+
13+
### Modified
14+
* Changed java version to java 16
15+
* Changed spigot version to 1.18.1 (should still support 1.17)
16+
* Removed requirement for custom GP jar file
17+
18+
### Fixed
19+
* Sign header color formatting being lost on server restart
20+
* Fixed issue preventing to buy claims due to currencies using $ character
21+
* Fixed error with `/re list`
22+
* Fixed error regarding renewrent

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# RealEstate
2+
3+
RealEstate is a spigot plugin built on top of GriefPrevention to provide players with an ability to sell and rent claims to other players.
4+
5+
The plugin is documented in the [GitHub wiki](https://github.com/EtienneDx/RealEstate/wiki).
6+
7+
Please feel free to report any issue in the [GitHub Issue section](https://github.com/EtienneDx/RealEstate/issues).
8+
9+
## GriefPrevention
10+
11+
This plugin is dependent on GriefPrevention version 16.18 and up.
12+
13+
GriefPrevention plugin can be found [here](https://github.com/TechFortress/GriefPrevention).

plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: RealEstate
22
main: me.EtienneDx.RealEstate.RealEstate
33
version: ${project.version}
44
authors: [EtienneDx, DmitryRendov]
5-
depend: [GriefPrevention, Vault]
6-
api-version: "1.15"
5+
depend: [Vault, GriefPrevention]
6+
api-version: "1.18"
77

88
commands:
99
re:

pom.xml

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>Me.EtienneDx</groupId>
6-
<artifactId>RealEstate</artifactId>
7-
<version>1.3.0</version>
6+
<artifactId>real-estate</artifactId>
7+
<version>1.4.0</version>
88
<name>RealEstate</name>
99
<description>A spigot plugin for selling, renting and leasing GriefPrevention claims</description>
1010
<build>
@@ -25,16 +25,24 @@
2525
<artifactId>maven-compiler-plugin</artifactId>
2626
<version>3.8.0</version>
2727
<configuration>
28-
<source>1.8</source>
29-
<target>1.8</target>
28+
<source>16</source>
29+
<target>16</target>
3030
</configuration>
3131
</plugin>
3232
<plugin>
3333
<groupId>org.apache.maven.plugins</groupId>
3434
<artifactId>maven-shade-plugin</artifactId>
35-
<version>3.2.1</version>
35+
<version>3.3.0-SNAPSHOT</version>
3636
<configuration>
3737
<createDependencyReducedPom>false</createDependencyReducedPom>
38+
<filters>
39+
<filter>
40+
<artifact>*:*</artifact>
41+
<excludes>
42+
<exclude>META-INF/MANIFEST.MF</exclude>
43+
</excludes>
44+
</filter>
45+
</filters>
3846
<relocations>
3947
<relocation>
4048
<pattern>co.aikar.commands</pattern>
@@ -55,15 +63,33 @@
5563
</execution>
5664
</executions>
5765
</plugin>
66+
<plugin>
67+
<artifactId>maven-assembly-plugin</artifactId>
68+
<version>2.4.1</version>
69+
<configuration>
70+
<finalName>${project.name}-${project.version}</finalName>
71+
<appendAssemblyId>false</appendAssemblyId>
72+
<descriptorRefs>
73+
<descriptorRef>jar-with-dependencies</descriptorRef>
74+
</descriptorRefs>
75+
<archive>
76+
<manifest>
77+
<mainClass>sampler.Main</mainClass>
78+
</manifest>
79+
</archive>
80+
</configuration>
81+
<executions>
82+
<execution>
83+
<id>make-assembly</id>
84+
<phase>package</phase>
85+
<goals>
86+
<goal>single</goal>
87+
</goals>
88+
</execution>
89+
</executions>
90+
</plugin>
5891
</plugins>
5992
</build>
60-
<distributionManagement>
61-
<repository>
62-
<id>github</id>
63-
<name>GitHub Packages</name>
64-
<url>https://maven.pkg.github.com/EtienneDx/RealEstate</url>
65-
</repository>
66-
</distributionManagement>
6793
<repositories>
6894
<repository>
6995
<id>spigot-repo</id>
@@ -79,7 +105,7 @@
79105
</repository>
80106
<repository>
81107
<id>vault-repo</id>
82-
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
108+
<url>https://nexus.hc.to/content/repositories/pub_releases</url>
83109
</repository>
84110
<repository>
85111
<id>aikar</id>
@@ -91,11 +117,17 @@
91117
<url>https://ci.ender.zone/plugin/repository/everything/</url>
92118
</repository>
93119
</repositories>
120+
<pluginRepositories>
121+
<pluginRepository>
122+
<id>maven-snapshots</id>
123+
<url>https://repository.apache.org/content/repositories/snapshots/</url>
124+
</pluginRepository>
125+
</pluginRepositories>
94126
<dependencies>
95127
<dependency>
96128
<groupId>org.spigotmc</groupId>
97129
<artifactId>spigot-api</artifactId>
98-
<version>1.16.3-R0.1-SNAPSHOT</version>
130+
<version>1.18.1-R0.1-SNAPSHOT</version>
99131
<scope>provided</scope>
100132
</dependency>
101133
<dependency>
@@ -116,15 +148,15 @@
116148
<scope>provided</scope>
117149
</dependency>
118150
<dependency>
119-
<groupId>com.github.EtienneDx</groupId>
151+
<groupId>com.github.TechFortress</groupId>
120152
<artifactId>GriefPrevention</artifactId>
121-
<version>1a4b2ea0b639c90f3858316fc4655478b5f0cdbc</version>
153+
<version>16.18</version>
122154
<scope>provided</scope>
123155
</dependency>
124156
<dependency>
125157
<groupId>com.github.EtienneDx</groupId>
126158
<artifactId>AnnotationConfig</artifactId>
127-
<version>cff4221</version>
159+
<version>e9eab24</version>
128160
</dependency>
129161
</dependencies>
130162
</project>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package me.EtienneDx.RealEstate;
2+
3+
import org.bukkit.event.EventHandler;
4+
import org.bukkit.event.Listener;
5+
import org.bukkit.plugin.PluginManager;
6+
7+
import me.EtienneDx.RealEstate.Transactions.BoughtTransaction;
8+
import me.EtienneDx.RealEstate.Transactions.Transaction;
9+
import me.ryanhamshire.GriefPrevention.Claim;
10+
import me.ryanhamshire.GriefPrevention.ClaimPermission;
11+
import me.ryanhamshire.GriefPrevention.events.ClaimDeletedEvent;
12+
import me.ryanhamshire.GriefPrevention.events.ClaimPermissionCheckEvent;
13+
14+
public class ClaimPermissionListener implements Listener {
15+
void registerEvents()
16+
{
17+
PluginManager pm = RealEstate.instance.getServer().getPluginManager();
18+
19+
pm.registerEvents(this, RealEstate.instance);
20+
}
21+
22+
@EventHandler
23+
public void onClaimPermission(ClaimPermissionCheckEvent event) {
24+
Transaction transaction = RealEstate.transactionsStore.getTransaction(event.getClaim());
25+
// we only have to remove the owner's access, the rest is handled by GP
26+
if(
27+
// if there is a transaction and the player is the owner
28+
transaction != null &&
29+
(
30+
event.getCheckedUUID().equals(transaction.getOwner()) ||
31+
(event.getClaim().isAdminClaim() && event.getCheckedPlayer().hasPermission("griefprevention.adminclaims"))
32+
) &&
33+
transaction instanceof BoughtTransaction &&
34+
((BoughtTransaction)transaction).getBuyer() != null
35+
) {
36+
switch(event.getRequiredPermission()) {
37+
case Edit:
38+
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorClaimInTransactionCantEdit));
39+
break;
40+
case Access:
41+
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorClaimInTransactionCantAccess));
42+
break;
43+
case Build:
44+
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorClaimInTransactionCantBuild));
45+
break;
46+
case Inventory:
47+
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorClaimInTransactionCantInventory));
48+
break;
49+
case Manage:
50+
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorClaimInTransactionCantManage));
51+
break;
52+
default:
53+
break;
54+
}
55+
}
56+
57+
if(event.getRequiredPermission() == ClaimPermission.Edit || event.getRequiredPermission() == ClaimPermission.Manage) {
58+
for (Claim child : event.getClaim().children) {
59+
Transaction tr = RealEstate.transactionsStore.getTransaction(child);
60+
if(tr != null &&
61+
tr instanceof BoughtTransaction &&
62+
((BoughtTransaction)tr).getBuyer() != null
63+
) {
64+
event.setDenialReason(() -> Messages.getMessage(RealEstate.instance.messages.msgErrorSubclaimInTransaction));
65+
}
66+
}
67+
}
68+
}
69+
70+
// more of a safety measure, normally it shouldn't be needed
71+
@EventHandler
72+
public void onClaimDeleted(ClaimDeletedEvent event) {
73+
Transaction tr = RealEstate.transactionsStore.getTransaction(event.getClaim());
74+
if(tr != null) tr.tryCancelTransaction(null, true);
75+
for (Claim child : event.getClaim().children) {
76+
tr = RealEstate.transactionsStore.getTransaction(child);
77+
if(tr != null) tr.tryCancelTransaction(null, true);
78+
}
79+
}
80+
}

src/me/EtienneDx/RealEstate/Config.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ public class Config extends AnnotationConfig
1818

1919
public final String configFilePath = RealEstate.pluginDirPath + "config.yml";
2020
public final String logFilePath = RealEstate.pluginDirPath + "GriefProtection_RealEstate.log";
21-
public final String chatPrefix = "[" + ChatColor.GOLD + "RealEstate" + ChatColor.WHITE + "] ";
21+
22+
@ConfigField(name="RealEstate.Keywords.ChatPrefix", comment="What is displayed before any chat message")
23+
public String chatPrefix = "$f[$6RealEstate$f] ";
2224

2325
@ConfigField(name="RealEstate.Keywords.SignsHeader", comment = "What is displayed in top of the signs")
24-
public String cfgSignsHeader = ChatColor.GOLD + "[RealEstate]";
26+
public String cfgSignsHeader = "$6[RealEstate]";
2527
//public List<String> cfgSigns;
2628

2729
@ConfigField(name="RealEstate.Keywords.Sell", comment = "List of all possible possible signs headers to sell a claim")

src/me/EtienneDx/RealEstate/GP_RealEstateHook.java

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)