Configurable Option For Click To Claim

This commit is contained in:
Driftay 2020-03-10 06:36:47 -04:00
parent 81bac35b51
commit 36c8d53a85
3 changed files with 9 additions and 4 deletions

View File

@ -259,6 +259,7 @@ public class Conf {
public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class); public static Set<Material> territoryBypassProtectedMaterials = EnumSet.noneOf(Material.class);
// Dependency check // Dependency check
public static boolean dependencyCheck = true; public static boolean dependencyCheck = true;
public static boolean enableClickToClaim = true;
public static Set<Material> territoryCancelAndAllowItemUseMaterial = new HashSet<>(); public static Set<Material> territoryCancelAndAllowItemUseMaterial = new HashSet<>();
public static Set<Material> territoryDenySwitchMaterials = new HashSet<>(); public static Set<Material> territoryDenySwitchMaterials = new HashSet<>();

View File

@ -8,6 +8,7 @@ import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.FactionsPlugin; import com.massivecraft.factions.FactionsPlugin;
import com.massivecraft.factions.util.XMaterial; import com.massivecraft.factions.util.XMaterial;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -15,6 +16,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* @author Saser * @author Saser
@ -26,8 +28,8 @@ public class FUpgradeFrame {
public FUpgradeFrame(Faction f) { public FUpgradeFrame(Faction f) {
this.gui = new Gui(FactionsPlugin.getInstance(), this.gui = new Gui(FactionsPlugin.getInstance(),
FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Rows", 5), FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Rows", 5),
ChatColor.translateAlternateColorCodes('&', FactionsPlugin.getInstance().getConfig() ChatColor.translateAlternateColorCodes('&', Objects.requireNonNull(FactionsPlugin.getInstance().getConfig()
.getString("fupgrades.MainMenu.Title").replace("{faction}", f.getTag()))); .getString("fupgrades.MainMenu.Title")).replace("{faction}", f.getTag())));
} }
public void buildGUI(FPlayer fplayer) { public void buildGUI(FPlayer fplayer) {

View File

@ -236,8 +236,10 @@ public abstract class MemoryBoard extends Board {
row.then("-").color(Conf.colorWilderness); row.then("-").color(Conf.colorWilderness);
// Lol someone didnt add the x and z making it claim the wrong position Can i copyright this xD // Lol someone didnt add the x and z making it claim the wrong position Can i copyright this xD
if (fplayer.getPlayer().hasPermission(Permission.CLAIMAT.node)) { if (fplayer.getPlayer().hasPermission(Permission.CLAIMAT.node)) {
row.tooltip(TL.CLAIM_CLICK_TO_CLAIM.format(dx + topLeft.getX(), dz + topLeft.getZ())) if (Conf.enableClickToClaim) {
.command(String.format("/f claimat %s %d %d", flocation.getWorldName(), dx + topLeft.getX(), dz + topLeft.getZ())); row.tooltip(TL.CLAIM_CLICK_TO_CLAIM.format(dx + topLeft.getX(), dz + topLeft.getZ()))
.command(String.format("/f claimat %s %d %d", flocation.getWorldName(), dx + topLeft.getX(), dz + topLeft.getZ()));
}
} }
} else if (factionHere.isSafeZone()) { } else if (factionHere.isSafeZone()) {
row.then("+").color(Conf.colorSafezone).tooltip(oneLineToolTip(factionHere, fplayer)); row.then("+").color(Conf.colorSafezone).tooltip(oneLineToolTip(factionHere, fplayer));