Skip to content

Commit

Permalink
Added support for GP patch to prevent claim resizes & all
Browse files Browse the repository at this point in the history
  • Loading branch information
EtienneDx committed May 17, 2019
1 parent 72617e6 commit 6a9ed14
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.TechFortress</groupId>
<artifactId>GriefPrevention</artifactId>
<version>16.11.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>co.aikar</groupId>
<artifactId>acf-bukkit</artifactId>
Expand All @@ -110,5 +104,11 @@
<version>2.16.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.EtienneDx</groupId>
<artifactId>GriefPrevention</artifactId>
<version>master-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
78 changes: 78 additions & 0 deletions src/me/EtienneDx/RealEstate/GP_RealEstateHook.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
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.IRealEstate;

public class GP_RealEstateHook implements IRealEstate
{
@Override
public String allowEdit(Claim claim, Player player)
{
Transaction b = RealEstate.transactionsStore.getTransaction(claim);
if(b != null && b.getOwner().equals(player.getUniqueId()) && 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 && b.getOwner().equals(player.getUniqueId()) && 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 && b.getOwner().equals(player.getUniqueId()) && 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 && b.getOwner().equals(player.getUniqueId()) && 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)
return "This claim is currently involved in a transaction, you can't change any permission!";
}
return null;
}

@Override
public boolean anyTransaction(Claim claim)
{
return RealEstate.transactionsStore.anyTransaction(claim);
}
}
2 changes: 2 additions & 0 deletions src/me/EtienneDx/RealEstate/RealEstate.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public void onEnable()
manager.enableUnstableAPI("help");
registerConditions();
manager.registerCommand(new RECommand());

GriefPrevention.realEstate = new GP_RealEstateHook();
}

private void registerConditions()
Expand Down

0 comments on commit 6a9ed14

Please sign in to comment.