mirror of
https://github.com/songoda/EpicBuckets.git
synced 2024-06-28 15:44:48 +02:00
Stop gen with source block break
Factions support needs testing
This commit is contained in:
parent
75360b96b5
commit
fd05ec61d7
6
pom.xml
6
pom.xml
|
@ -196,12 +196,6 @@
|
|||
<version>RELEASE</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.markeh</groupId>
|
||||
<artifactId>factionsframework</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.massivecraft</groupId>
|
||||
<artifactId>factions</artifactId>
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.songoda.epicbuckets.command.CommandGenbucket;
|
|||
import com.songoda.epicbuckets.file.ConfigManager;
|
||||
import com.songoda.epicbuckets.genbucket.GenbucketManager;
|
||||
import com.songoda.epicbuckets.listener.GenbucketPlaceListener;
|
||||
import com.songoda.epicbuckets.listener.SourceBlockBreakListener;
|
||||
import com.songoda.epicbuckets.shop.ShopManager;
|
||||
import com.songoda.epicbuckets.util.ChatUtil;
|
||||
import com.songoda.epicbuckets.util.Debugger;
|
||||
|
@ -63,6 +64,7 @@ public class EpicBuckets extends ExtendedJavaPlugin {
|
|||
commandManager.registerCommand(new CommandGenbucket());
|
||||
|
||||
getServer().getPluginManager().registerEvents(new GenbucketPlaceListener(), this);
|
||||
getServer().getPluginManager().registerEvents(new SourceBlockBreakListener(), this);
|
||||
|
||||
setupEconomy();
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.songoda.epicbuckets.genbucket;
|
||||
|
||||
import com.songoda.epicbuckets.EpicBuckets;
|
||||
import com.songoda.epicbuckets.regionhandler.RegionFactions;
|
||||
import com.songoda.epicbuckets.regionhandler.RegionGriefPrevention;
|
||||
import com.songoda.epicbuckets.regionhandler.RegionWorldBorder;
|
||||
import com.songoda.epicbuckets.regionhandler.RegionWorldGuard;
|
||||
import com.songoda.epicbuckets.regionhandler.*;
|
||||
import com.songoda.epicbuckets.util.ChatUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Location;
|
||||
|
@ -89,12 +86,12 @@ public class GenbucketManager {
|
|||
}
|
||||
|
||||
public boolean canPlaceGenbucket(Player player, Location location) {
|
||||
boolean factionsCheck = RegionFactions.canBuild(player, location);
|
||||
boolean factionsMassiveCraftCheck = RegionMassiveCraftFactions.canBuild(player, location);
|
||||
boolean griefPreventionCheck = RegionGriefPrevention.canBuild(player, location);
|
||||
boolean worldGuardCheck = RegionWorldGuard.canBuild(player, location);
|
||||
boolean worldBorderCheck = RegionWorldBorder.isOutsideOfBorder(location);
|
||||
|
||||
if (!factionsCheck || !griefPreventionCheck || !worldGuardCheck || worldBorderCheck) {
|
||||
if (!factionsMassiveCraftCheck || !griefPreventionCheck || !worldGuardCheck || worldBorderCheck) {
|
||||
player.sendMessage(ChatUtil.colorPrefix(epicBuckets.getLocale().getMessage("event.place.nothere")));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class SourceBlockBreakListener implements Listener {
|
|||
epicBuckets.getGenbucketManager().getActiveGens().forEach((uuid, genbuckets) -> {
|
||||
if (genbuckets.size() > 0) {
|
||||
genbuckets.forEach(genbucket -> {
|
||||
if (genbucket.getSourceBlock().getLocation() == e.getBlock().getLocation()) {
|
||||
if (genbucket.getSourceBlock().getLocation().equals(e.getBlock().getLocation())) {
|
||||
genbucket.getGeneration().cancel();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package com.songoda.epicbuckets.regionhandler;
|
||||
|
||||
import com.songoda.epicbuckets.EpicBuckets;
|
||||
import me.markeh.factionsframework.entities.Faction;
|
||||
import me.markeh.factionsframework.entities.Factions;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class RegionFactions {
|
||||
|
||||
public static boolean canBuild(Player player, Location location) {
|
||||
|
||||
if (!EpicBuckets.getInstance().getConfigManager().isSupportFactions())
|
||||
return true;
|
||||
|
||||
Faction factionAt = Factions.getFactionAt(location);
|
||||
|
||||
boolean enableGensInWilderness = EpicBuckets.getInstance().getConfigManager().isGensInWilderness();
|
||||
|
||||
if (factionAt.isNone()) {
|
||||
return enableGensInWilderness;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.songoda.epicbuckets.regionhandler;
|
||||
|
||||
import com.massivecraft.factions.*;
|
||||
import com.songoda.epicbuckets.EpicBuckets;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class RegionMassiveCraftFactions {
|
||||
|
||||
public static boolean canBuild(Player player, Location location) {
|
||||
if (!EpicBuckets.getInstance().getConfigManager().isSupportFactions()) return true;
|
||||
if (!EpicBuckets.getInstance().getServer().getPluginManager().isPluginEnabled("Factions")) return true;
|
||||
|
||||
Faction f = Board.getInstance().getFactionAt(new FLocation(location));
|
||||
|
||||
if (f == null) return false;
|
||||
|
||||
if (FPlayers.getInstance().getByPlayer(player).getFaction() != f) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user