feat: updated to spigot 1.18.1 and GP 16.18-RC1 as a native dependency
This commit is contained in:
parent
2b9a5a97e3
commit
df6b5bede0
@ -6,11 +6,12 @@
|
||||
* Readme and changelog files
|
||||
* Error messages to *messages.yml*
|
||||
* List messages to *messages.yml*
|
||||
* Fixed build pipeline to build with GP
|
||||
* Support of [GriefPrevention v16.18-RC1](https://github.com/TechFortress/GriefPrevention/releases/tag/16.18-RC1)
|
||||
|
||||
### Modified
|
||||
* Changed java version to java 16
|
||||
* Changed spigot version to 1.17.1
|
||||
* Changed spigot version to 1.18.1
|
||||
* Removed requirement for custom GP jar file
|
||||
|
||||
### Fixed
|
||||
* Sign header color formatting being lost on server restart
|
||||
6
pom.xml
6
pom.xml
@ -127,7 +127,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -148,9 +148,9 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.EtienneDx</groupId>
|
||||
<groupId>com.github.TechFortress</groupId>
|
||||
<artifactId>GriefPrevention</artifactId>
|
||||
<version>1a4b2ea0b639c90f3858316fc4655478b5f0cdbc</version>
|
||||
<version>16.18-RC1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
49
src/me/EtienneDx/RealEstate/ClaimPermissionListener.java
Normal file
49
src/me/EtienneDx/RealEstate/ClaimPermissionListener.java
Normal file
@ -0,0 +1,49 @@
|
||||
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.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 b = RealEstate.transactionsStore.getTransaction(event.getClaim());
|
||||
if(
|
||||
b != null &&
|
||||
event.getCheckedUUID().equals(b.getOwner()) &&
|
||||
b instanceof BoughtTransaction &&
|
||||
((BoughtTransaction)b).getBuyer() != null
|
||||
) {
|
||||
switch(event.getRequiredPermission()) {
|
||||
case Edit:
|
||||
event.setDenialReason(() -> RealEstate.instance.messages.msgErrorClaimInTransactionCantEdit);
|
||||
break;
|
||||
case Access:
|
||||
event.setDenialReason(() -> RealEstate.instance.messages.msgErrorClaimInTransactionCantAccess);
|
||||
break;
|
||||
case Build:
|
||||
event.setDenialReason(() -> RealEstate.instance.messages.msgErrorClaimInTransactionCantBuild);
|
||||
break;
|
||||
case Inventory:
|
||||
event.setDenialReason(() -> RealEstate.instance.messages.msgErrorClaimInTransactionCantInventory);
|
||||
break;
|
||||
case Manage:
|
||||
event.setDenialReason(() -> RealEstate.instance.messages.msgErrorClaimInTransactionCantManage);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -60,6 +60,21 @@ public class Messages extends AnnotationConfig
|
||||
@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}";
|
||||
|
||||
@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!";
|
||||
|
||||
public Messages()
|
||||
{
|
||||
this.pdf = RealEstate.instance.getDescription();
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -355,7 +355,7 @@ 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();
|
||||
|
||||
@ -329,7 +329,7 @@ public class ClaimRent extends BoughtTransaction
|
||||
startDate = LocalDateTime.now();
|
||||
autoRenew = false;
|
||||
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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user