Skip to content

Commit

Permalink
Merge pull request #36 from EtienneDx/release/1.4.0
Browse files Browse the repository at this point in the history
Release 1.4.0
  • Loading branch information
EtienneDx authored Mar 7, 2022
2 parents 17f80c3 + 3cb0895 commit e686780
Show file tree
Hide file tree
Showing 20 changed files with 1,141 additions and 642 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/maven-publish.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ target/*
build.bat
/bin/
/target/
.vscode
1 change: 0 additions & 1 deletion .vscode/settings.json

This file was deleted.

22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: RealEstate
main: me.EtienneDx.RealEstate.RealEstate
version: ${project.version}
authors: [EtienneDx, DmitryRendov]
depend: [GriefPrevention, Vault]
api-version: "1.15"
depend: [Vault, GriefPrevention]
api-version: "1.18"

commands:
re:
Expand Down
66 changes: 49 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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 changes: 80 additions & 0 deletions src/me/EtienneDx/RealEstate/ClaimPermissionListener.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
6 changes: 4 additions & 2 deletions src/me/EtienneDx/RealEstate/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
93 changes: 0 additions & 93 deletions src/me/EtienneDx/RealEstate/GP_RealEstateHook.java

This file was deleted.

Loading

0 comments on commit e686780

Please sign in to comment.