Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ slimJar {


dependencies {

// Slimjar
implementation slimjar("1.2.6")

Expand All @@ -110,8 +109,9 @@ dependencies {
// Cross-Version Support
implementation('com.github.cryptomorin:XSeries:8.4.0')

// Adventure
// Adventure and MiniMessage
implementation("net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT")
//implementation("net.kyori:adventure-text-minimessage:4.2.0-SNAPSHOT")

// GUI Lib
implementation("dev.triumphteam:triumph-gui:3.0.3")
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/me/glaremasters/guilds/Guilds.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import me.glaremasters.guilds.api.GuildsAPI;
import me.glaremasters.guilds.arena.ArenaHandler;
import me.glaremasters.guilds.challenges.ChallengeHandler;
import me.glaremasters.guilds.claim.ClaimUtils;
import me.glaremasters.guilds.conf.GuildBuffSettings;
import me.glaremasters.guilds.configuration.SettingsHandler;
import me.glaremasters.guilds.configuration.sections.HooksSettings;
Expand Down Expand Up @@ -291,6 +292,10 @@ public void onEnable() {

chatListener = new ChatListener(this);

if (ClaimUtils.isEnable(settingsHandler.getMainConf())) {
ClaimUtils.reload(this, settingsHandler.getMainConf());
}

LoggingUtils.info("Ready to go! That only took " + (System.currentTimeMillis() - startingTime) + "ms");
getServer().getScheduler().scheduleAsyncRepeatingTask(this, () -> {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,7 @@
import ch.jalu.configme.configurationdata.ConfigurationData;
import ch.jalu.configme.configurationdata.ConfigurationDataBuilder;
import me.glaremasters.guilds.conf.GuildBuffSettings;
import me.glaremasters.guilds.configuration.sections.ClaimSettings;
import me.glaremasters.guilds.configuration.sections.CodeSettings;
import me.glaremasters.guilds.configuration.sections.CooldownSettings;
import me.glaremasters.guilds.configuration.sections.CostSettings;
import me.glaremasters.guilds.configuration.sections.GuildInfoMemberSettings;
import me.glaremasters.guilds.configuration.sections.GuildInfoSettings;
import me.glaremasters.guilds.configuration.sections.GuildListSettings;
import me.glaremasters.guilds.configuration.sections.GuildSettings;
import me.glaremasters.guilds.configuration.sections.GuildVaultSettings;
import me.glaremasters.guilds.configuration.sections.HooksSettings;
import me.glaremasters.guilds.configuration.sections.PluginSettings;
import me.glaremasters.guilds.configuration.sections.RoleSettings;
import me.glaremasters.guilds.configuration.sections.StorageSettings;
import me.glaremasters.guilds.configuration.sections.TicketSettings;
import me.glaremasters.guilds.configuration.sections.TierSettings;
import me.glaremasters.guilds.configuration.sections.VaultPickerSettings;
import me.glaremasters.guilds.configuration.sections.WarSettings;
import me.glaremasters.guilds.configuration.sections.*;

/**
* Created by GlareMasters
Expand All @@ -57,7 +41,7 @@ private GuildConfigurationBuilder() {

public static ConfigurationData buildConfigurationData() {
return ConfigurationDataBuilder.createConfiguration(
PluginSettings.class, StorageSettings.class, HooksSettings.class, GuildListSettings.class,
PluginSettings.class, StorageSettings.class, HooksSettings.class, GuildListSettings.class, GuildMapSettings.class,
VaultPickerSettings.class, GuildVaultSettings.class, GuildInfoSettings.class,
GuildInfoMemberSettings.class, GuildSettings.class,
WarSettings.class, CooldownSettings.class, CostSettings.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@
*/
public class ClaimSettings implements SettingsHolder {

@Comment({"This is the number of blocks around the player it will try to create the region.",
"Keep in mind this is the RADIUS, it will go this many blocks in both directions.",
"For example, if you take the default 15, it'll do 30 total as it will go 15 blocks in both directions.",
"This is a CUBOID region, not SPHERE."
})
public static final Property<Integer> RADIUS =
newProperty("claims.radius", 15);

@Comment({"Customize the entrance and exit message of joining claims.",
"Supports {prefix} for guild prefix and {guild} for guild name.",
"Also supports color codes!"
Expand Down Expand Up @@ -77,6 +69,14 @@ public class ClaimSettings implements SettingsHolder {
public static final Property<Boolean> FORCE_CLAIM_SIGNS =
newProperty("claims.force-claim-signs", false);

@Comment({"Would you like to require claims to be made next to other claimed land?"})
public static final Property<Boolean> CLAIM_ADJACENT =
newProperty("claims.claim-adjacent", true);

@Comment({"How far would you like claims from different guilds to be apart? e.g as a buffer."})
public static final Property<Integer> CLAIM_PROXIMITY =
newProperty("claims.claim-proximity", 5);

private ClaimSettings() {
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* MIT License
*
* Copyright (c) 2019 Glare
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package me.glaremasters.guilds.configuration.sections;

import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.configurationdata.CommentsConfiguration;
import ch.jalu.configme.properties.Property;

import java.util.List;

import static ch.jalu.configme.properties.PropertyInitializer.newListProperty;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;

/**
* Created by Glare
* Date: 4/13/2019
* Time: 8:24 PM
*/
public class GuildMapSettings implements SettingsHolder {

private static final String LIST_PATH = "guis.guild-map.";

@Comment("What should the name of the inventory be?")
public static final Property<String> GUILD_MAP_NAME =
newProperty(LIST_PATH + "gui-name", "Area Map");

@Comment({"What should the name of the all the items be in the inventory?",
"Currently supports {player} and {guild}."})
public static final Property<String> GUILD_MAP_ITEM_NAME =
newProperty(LIST_PATH + "guilds-on-map-name", "&f{player}'s Guild");

@Comment({"What should the name of the all the items be in the inventory?",
"Currently supports {player} and {guild}."})
public static final Property<String> GUILD_MAP_CENTER_NAME =
newProperty(LIST_PATH + "center-item-name", "You");

@Comment("What should be the default texture url for textures that fail to load in? Refer to the Guild Manage settings to see how to change the texture!")
public static final Property<String> GUILD_MAP_HEAD_DEFAULT_URL =
newProperty(LIST_PATH + "head-default-url", "7a2df315b43583b1896231b77bae1a507dbd7e43ad86c1cfbe3b2b8ef3430e9e");

@Comment("What should be the texture url for the point representing the person upon the map?")
public static final Property<String> GUILD_MAP_CENTER_HEAD_DEFAULT_URL =
newProperty(LIST_PATH + "head-center-url", "7a2df315b43583b1896231b77bae1a507dbd7e43ad86c1cfbe3b2b8ef3430e9e");

@Comment("Do we want to try to use skull textures or just ignore them and use the one provided?")
public static final Property<Boolean> USE_DEFAULT_TEXTURE =
newProperty(LIST_PATH + "use-default-texture", false);

@Comment({"You are free to design this to your liking", "This is just an example of all the available placeholders that you can use for the lore!",
"Note: With v3.6.7 and on, you can now use {guild-tier-name} for the name of the tier.",
"Also, from v3.6.7 and on, {guild-status} will now apply from what you set for the guild-info GUI for the status being public or private.",
"In version 3.5.2.2, {guild-challenge-wins} and {guild-challenge-loses} have been added.",
"In version 3.5.3.3, {creation} was added to display the creation date of the guild"})
public static final Property<List<String>> GUILD_MAP_ITEM_LORE =
newListProperty(LIST_PATH + "head-lore", "&cName&8: &a{guild-name}", "&cPrefix&8: &a{guild-prefix}", "&cMaster&8: &a{guild-master}", "&cStatus&8: &a{guild-status}", "&cTier&8: &a{guild-tier}", "&cBalance&8: &a{guild-balance}", "&cMember Count&8: &a{guild-member-count}", "&cCreation Date&8: &a{creation}");


private GuildMapSettings() {
}

@Override
public void registerComments(CommentsConfiguration conf) {
String[] pluginHeader = {
"Use the following website to get available materials: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html",
"This can work across all MC versions and will attempt to use the proper material based on what version of MC you are using."
};
conf.setComment("guis", pluginHeader);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ public class TierSettings implements SettingsHolder {
public static final Property<Boolean> ONE_BUFFS =
newProperty(LIST_PATH + "1.use-buffs", true);

@Comment("How many claims would you like this tier to be able to use?")
public static final Property<Integer> ONE_CLAIMABLE =
newProperty(LIST_PATH + "1.claimable-land", 1);

@Comment("If you wish to give this tier extra permissions, put them here.")
public static final Property<List<String>> ONE_PERMS =
newListProperty(LIST_PATH + "1.permissions", "example.perm.here");
Expand Down Expand Up @@ -137,6 +141,10 @@ public class TierSettings implements SettingsHolder {
public static final Property<Boolean> TWO_BUFFS =
newProperty(LIST_PATH + "2.use-buffs", true);

@Comment("How many claims would you like this tier to be able to use?")
public static final Property<Integer> TWO_CLAIMABLE =
newProperty(LIST_PATH + "2.claimable-land", 5);

@Comment("If you wish to give this tier extra permissions, put them here.")
public static final Property<List<String>> TWO_PERMS =
newListProperty(LIST_PATH + "2.permissions", "example.perm.here");
Expand Down Expand Up @@ -184,6 +192,10 @@ public class TierSettings implements SettingsHolder {
public static final Property<Boolean> THREE_BUFFS =
newProperty(LIST_PATH + "3.use-buffs", true);

@Comment("How many claims would you like this tier to be able to use?")
public static final Property<Integer> THREE_CLAIMABLE =
newProperty(LIST_PATH + "3.claimable-land", 10);

@Comment("If you wish to give this tier extra permissions, put them here.")
public static final Property<List<String>> THREE_PERMS =
newListProperty(LIST_PATH + "3.permissions", "example.perm.here");
Expand Down
55 changes: 46 additions & 9 deletions src/main/java/me/glaremasters/guilds/guild/Guild.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import co.aikar.commands.ACFUtil;
import co.aikar.commands.CommandManager;
import me.glaremasters.guilds.Guilds;
import me.glaremasters.guilds.claim.GuildClaim;
import me.glaremasters.guilds.configuration.sections.GuildListSettings;
import me.glaremasters.guilds.exceptions.ExpectationNotMet;
import me.glaremasters.guilds.messages.Messages;
Expand All @@ -51,7 +52,7 @@ public Guild(UUID id) {
this.id = id;
}

public Guild(UUID id, String name, String prefix, String motd, GuildMember guildMaster, GuildHome home, GuildSkull guildSkull, Status status, GuildTier tier, GuildScore guildScore, double balance, List<GuildMember> members, List<UUID> invitedMembers, List<UUID> allies, List<UUID> pendingAllies, List<GuildCode> codes, List<String> vaults, long lastDefended) {
public Guild(UUID id, String name, String prefix, String motd, GuildMember guildMaster, GuildHome home, GuildSkull guildSkull, Status status, GuildTier tier, GuildScore guildScore, double balance, List<GuildMember> members, List<UUID> invitedMembers, List<UUID> allies, List<UUID> pendingAllies, List<GuildCode> codes, List<String> vaults, long lastDefended, List<GuildClaim> claimedLand) {
this.id = id;
this.name = name;
this.prefix = prefix;
Expand All @@ -70,6 +71,7 @@ public Guild(UUID id, String name, String prefix, String motd, GuildMember guild
this.codes = codes;
this.vaults = vaults;
this.lastDefended = lastDefended;
this.claimedLand = claimedLand;
}

public static GuildBuilder builder() {
Expand Down Expand Up @@ -132,9 +134,7 @@ public void setPendingAllies(List<UUID> pendingAllies) {
this.pendingAllies = pendingAllies;
}

public void setCodes(List<GuildCode> codes) {
this.codes = codes;
}
public void setCodes(List<GuildCode> codes) {this.codes = codes;}

public void setVaults(List<String> vaults) {
this.vaults = vaults;
Expand All @@ -148,9 +148,9 @@ public long getCreationDate() {
return creationDate;
}

public void setCreationDate(long creationDate) {
this.creationDate = creationDate;
}
public void setCreationDate(long creationDate) {this.creationDate = creationDate; }

public void setClaimedLand(List<GuildClaim> newClaimedLand) { this.claimedLand = newClaimedLand; }

public enum Status {
Public("Public"),
Expand Down Expand Up @@ -184,6 +184,7 @@ public enum Status {
private long lastDefended;
private long creationDate;

private List<GuildClaim> claimedLand;
/**
* Get a member in the guild
* @param uuid the uuid of the member
Expand Down Expand Up @@ -566,6 +567,29 @@ public boolean memberHasPermission(Player player, GuildRolePerm perm) {
return role.hasPerm(perm);
}

/**
* Add a guild claim to the list of claims
* @param claim the claim to add
*/
public void addGuildClaim(GuildClaim claim) {
claimedLand.add(claim);
}

/**
* Remove a guild claim from the list of claims
* @param claim the claim to remove
*/
public void removeGuildClaim(GuildClaim claim) {
claimedLand.remove(claim);
}

/**
* Clear all the guild claims in list
*/
public void clearGuildClaims() {
claimedLand.clear();
}

public void updateGuildSkull(Player player, SettingsManager settingsManager) {
Guilds.newChain().async(() -> {
try{
Expand Down Expand Up @@ -673,6 +697,13 @@ public long getLastDefended() {
return lastDefended;
}

public List<GuildClaim> getClaimedLand() {
if (this.claimedLand == null) {
this.claimedLand = new ArrayList<>();
}
return this.claimedLand;
}

public static class GuildBuilder {
private UUID id;
private String name;
Expand All @@ -692,6 +723,7 @@ public static class GuildBuilder {
private List<GuildCode> codes;
private List<String> vaults;
private long lastDefended;
private List<GuildClaim> claimedLand;

GuildBuilder() {
}
Expand Down Expand Up @@ -786,12 +818,17 @@ public Guild.GuildBuilder lastDefended(long lastDefended) {
return this;
}

public Guild.GuildBuilder claimedLand(List<GuildClaim> claimedLand) {
this.claimedLand = claimedLand;
return this;
}

public Guild build() {
return new Guild(id, name, prefix, motd, guildMaster, home, guildSkull, status, tier, guildScore, balance, members, invitedMembers, allies, pendingAllies, codes, vaults, lastDefended);
return new Guild(id, name, prefix, motd, guildMaster, home, guildSkull, status, tier, guildScore, balance, members, invitedMembers, allies, pendingAllies, codes, vaults, lastDefended, claimedLand);
}

public String toString() {
return "Guild.GuildBuilder(id=" + this.id + ", name=" + this.name + ", prefix=" + this.prefix + ", motd=" + this.motd + ", guildMaster=" + this.guildMaster + ", home=" + this.home + ", guildSkull=" + this.guildSkull + ", status=" + this.status + ", tier=" + this.tier + ", guildScore=" + this.guildScore + ", balance=" + this.balance + ", members=" + this.members + ", invitedMembers=" + this.invitedMembers + ", allies=" + this.allies + ", pendingAllies=" + this.pendingAllies + ", codes=" + this.codes + ", vaults=" + this.vaults + ", lastDefended=" + this.lastDefended + ")";
return "Guild.GuildBuilder(id=" + this.id + ", name=" + this.name + ", prefix=" + this.prefix + ", motd=" + this.motd + ", guildMaster=" + this.guildMaster + ", home=" + this.home + ", guildSkull=" + this.guildSkull + ", status=" + this.status + ", tier=" + this.tier + ", guildScore=" + this.guildScore + ", balance=" + this.balance + ", members=" + this.members + ", invitedMembers=" + this.invitedMembers + ", allies=" + this.allies + ", pendingAllies=" + this.pendingAllies + ", codes=" + this.codes + ", vaults=" + this.vaults + ", lastDefended=" + this.lastDefended + ", claimedLand=" + this.claimedLand.toString() + ")";
}
}
}
Expand Down
Loading