Skip to content

Commit

Permalink
Merge branch 'develop' into config/claim-fill-max-chunks
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/resources/lang/lang_de_DE.properties
#	src/main/resources/lang/lang_en_GB.properties
#	src/main/resources/lang/lang_en_US.properties
#	src/main/resources/lang/lang_fr_FR.properties
  • Loading branch information
dmccoystephenson committed Jan 6, 2024
2 parents 06d52c5 + 7168da8 commit f7c7723
Show file tree
Hide file tree
Showing 13 changed files with 1,092 additions and 51 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Alternatively, you can use the External API, the documentation for which can be
| VoChiDanh | Refactored parts the PersistentData class in an attempt to resolve java compatibility issues |
| Kyrenic | Implemented contiguous claims config option |
| [Tems](https://github.com/Tems-py) | Fixed claim protection issues |
| MestreWilll | Contributed Brazilian Portueguese translation |

### Translators
| Name | Language(s) |
Expand All @@ -104,6 +105,7 @@ Alternatively, you can use the External API, the documentation for which can be
| JustGllenn | Dutch |
| TDL | Dutch |
| [n0virus](https://www.youtube.com/c/n0virus) | Dutch |
| MestreWilll | Brazilian Portuguese |

I created this plugin because I wanted to use the original [Factions](https://www.spigotmc.org/resources/factions.1900/) plugin for an upcoming server of mine, but it wasn't updated for the version of minecraft I was going to be using. I decided to take inspiration from the concept of factions - groups of players that can claim land - and create my own factions plugin.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ class MedievalFactions : JavaPlugin() {
MedievalFactionsPlaceholderExpansion(this).register()
}

if (config.getBoolean("dynmap.onlyRenderTerritoriesUponStartup")) {
logger.info(language["DynmapOnlyRenderTerritoriesUponStartupEnabled"])
}

if (dynmapService != null) {
factionService.factions.forEach { faction ->
dynmapService.scheduleUpdateClaims(faction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class MfClaimService(private val plugin: MedievalFactions, private val repositor
}
)
val dynmapService = plugin.services.dynmapService
if (dynmapService != null) {
if (dynmapService != null && !plugin.config.getBoolean("dynmap.onlyRenderTerritoriesUponStartup")) {
plugin.server.scheduler.runTask(
plugin,
Runnable {
Expand Down Expand Up @@ -167,7 +167,7 @@ class MfClaimService(private val plugin: MedievalFactions, private val repositor
if (dynmapService != null) {
val factionService = plugin.services.factionService
val faction = factionService.getFaction(claim.factionId)
if (faction != null) {
if (faction != null && !plugin.config.getBoolean("dynmap.onlyRenderTerritoriesUponStartup")) {
plugin.server.scheduler.runTask(
plugin,
Runnable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import com.dansplugins.factionsystem.command.faction.bonuspower.MfFactionBonusPo
import com.dansplugins.factionsystem.command.faction.breakalliance.MfFactionBreakAllianceCommand
import com.dansplugins.factionsystem.command.faction.bypass.MfFactionBypassCommand
import com.dansplugins.factionsystem.command.faction.chat.MfFactionChatCommand
import com.dansplugins.factionsystem.command.faction.claim.MfFactionClaimAutoCommand
import com.dansplugins.factionsystem.command.faction.claim.MfFactionClaimCheckCommand
import com.dansplugins.factionsystem.command.faction.claim.MfFactionClaimCommand
import com.dansplugins.factionsystem.command.faction.claim.MfFactionClaimFillCommand
import com.dansplugins.factionsystem.command.faction.create.MfFactionCreateCommand
import com.dansplugins.factionsystem.command.faction.declareindependence.MfFactionDeclareIndependenceCommand
import com.dansplugins.factionsystem.command.faction.declarewar.MfFactionDeclareWarCommand
Expand Down Expand Up @@ -44,7 +41,6 @@ import com.dansplugins.factionsystem.command.faction.vassalize.MfFactionVassaliz
import com.dansplugins.factionsystem.command.faction.who.MfFactionWhoCommand
import org.bukkit.ChatColor.AQUA
import org.bukkit.ChatColor.GRAY
import org.bukkit.ChatColor.RED
import org.bukkit.ChatColor.YELLOW
import org.bukkit.command.Command
import org.bukkit.command.CommandExecutor
Expand Down Expand Up @@ -92,11 +88,6 @@ class MfFactionCommand(private val plugin: MedievalFactions) : CommandExecutor,
private val factionAddMemberCommand = MfFactionAddMemberCommand(plugin)
private val factionDevCommand = MfFactionDevCommand(plugin)

// Backwards compatibility:
private val factionClaimAutoCommand = MfFactionClaimAutoCommand(plugin)
private val factionClaimFillCommand = MfFactionClaimFillCommand(plugin)
private val factionClaimCheckCommand = MfFactionClaimCheckCommand(plugin)

private val helpAliases = listOf("help", plugin.language["CmdFactionHelp"])
private val createAliases = listOf("create", plugin.language["CmdFactionCreate"])
private val claimAliases = listOf("claim", plugin.language["CmdFactionClaim"])
Expand Down Expand Up @@ -136,11 +127,6 @@ class MfFactionCommand(private val plugin: MedievalFactions) : CommandExecutor,
private val addMemberAliases = listOf("addmember", plugin.language["CmdFactionAddMember"])
private val devAliases = if (plugin.config.getBoolean("dev.enableDevCommands")) listOf("dev") else emptyList()

// Backwards compatibility:
private val claimAutoAliases = listOf("autoclaim")
private val claimFillAliases = listOf("claimfill")
private val claimCheckAliases = listOf("checkclaim")

private val subcommands = helpAliases +
createAliases +
claimAliases +
Expand Down Expand Up @@ -178,11 +164,7 @@ class MfFactionCommand(private val plugin: MedievalFactions) : CommandExecutor,
bonusPowerAliases +
relationshipAliases +
addMemberAliases +
devAliases +
// Backwards compatibility aliases:
claimAutoAliases +
claimFillAliases +
claimCheckAliases
devAliases

override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
return when (args.firstOrNull()?.lowercase()) {
Expand Down Expand Up @@ -224,19 +206,6 @@ class MfFactionCommand(private val plugin: MedievalFactions) : CommandExecutor,
in relationshipAliases -> factionRelationshipCommand.onCommand(sender, command, label, args.drop(1).toTypedArray())
in addMemberAliases -> factionAddMemberCommand.onCommand(sender, command, label, args.drop(1).toTypedArray())
in devAliases -> factionDevCommand.onCommand(sender, command, label, args.drop(1).toTypedArray())
// Backwards compatibility:
in claimAutoAliases -> {
sender.sendMessage("${RED}${plugin.language["DeprecationWarningAutoclaim"]}")
false
}
in claimFillAliases -> {
sender.sendMessage("${RED}${plugin.language["DeprecationWarningFillclaim"]}")
false
}
in claimCheckAliases -> {
sender.sendMessage("${RED}${plugin.language["DeprecationWarningCheckclaim"]}")
false
}
else -> {
sender.sendMessage("$AQUA${plugin.language["MedievalFactionsTitle", plugin.description.version]}")
sender.sendMessage("$GRAY${plugin.language["DeveloperList", plugin.description.authors.joinToString()]}")
Expand Down Expand Up @@ -295,10 +264,6 @@ class MfFactionCommand(private val plugin: MedievalFactions) : CommandExecutor,
in relationshipAliases -> factionRelationshipCommand.onTabComplete(sender, command, label, args.drop(1).toTypedArray())
in addMemberAliases -> factionAddMemberCommand.onTabComplete(sender, command, label, args.drop(1).toTypedArray())
in devAliases -> factionDevCommand.onTabComplete(sender, command, label, args.drop(1).toTypedArray())
// Backwards compatibility:
in claimAutoAliases -> factionClaimAutoCommand.onTabComplete(sender, command, label, args.drop(1).toTypedArray())
in claimFillAliases -> factionClaimFillCommand.onTabComplete(sender, command, label, args.drop(1).toTypedArray())
in claimCheckAliases -> factionClaimCheckCommand.onTabComplete(sender, command, label, args.drop(1).toTypedArray())
else -> emptyList()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ class MfFactionClaimCommand(private val plugin: MedievalFactions) : CommandExecu
private val fillAliases = listOf("fill", plugin.language["CmdFactionClaimFill"])
private val checkAliases = listOf("check", plugin.language["CmdFactionClaimCheck"])
private val circleAliases = listOf("circle", plugin.language["CmdFactionClaimCircle"])
// private val squareAliases = listOf("square", plugin.language["CmdFactionClaimSquare"])
// private val rectangleAliases = listOf("rectangle", plugin.language["CmdFactionClaimRectangle"])

private val subcommands = autoAliases + fillAliases + checkAliases + circleAliases

Expand All @@ -27,8 +25,6 @@ class MfFactionClaimCommand(private val plugin: MedievalFactions) : CommandExecu
in fillAliases -> factionClaimFillCommand.onCommand(sender, command, label, args.drop(1).toTypedArray())
in checkAliases -> factionClaimCheckCommand.onCommand(sender, command, label, args.drop(1).toTypedArray())
in circleAliases -> factionClaimCircleCommand.onCommand(sender, command, label, args.drop(1).toTypedArray())
// in squareAliases -> FactionClaimSquareCommand.onCommand(sender, command, label, args.drop(1).toTypedArray())
// in rectangleAliases -> FactionClaimRectangleCommand.onCommand(sender, command, label, args.drop(1).toTypedArray())
else -> {
return factionClaimCircleCommand.onCommand(sender, command, label, args)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class MfFactionService(private val plugin: MedievalFactions, private val reposit
val result = repository.upsert(factionToSave)
factionsById[result.id] = result
val dynmapService = plugin.services.dynmapService
if (dynmapService != null) {
if (dynmapService != null && !plugin.config.getBoolean("dynmap.onlyRenderTerritoriesUponStartup")) {
plugin.server.scheduler.runTask(
plugin,
Runnable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MfPlayerService(private val plugin: MedievalFactions, private val playerRe
if (dynmapService != null) {
val factionService = plugin.services.factionService
val faction = factionService.getFaction(result.id)
if (faction != null) {
if (faction != null && !plugin.config.getBoolean("dynmap.onlyRenderTerritoriesUponStartup")) {
plugin.server.scheduler.runTask(
plugin,
Runnable {
Expand All @@ -74,7 +74,7 @@ class MfPlayerService(private val plugin: MedievalFactions, private val playerRe
playerRepository.decreaseOfflinePlayerPower(onlinePlayerIds)
playersById.putAll(playerRepository.getPlayers().associateBy(MfPlayer::id))
val dynmapService = plugin.services.dynmapService
if (dynmapService != null) {
if (dynmapService != null && !plugin.config.getBoolean("dynmap.onlyRenderTerritoriesUponStartup")) {
val factionService = plugin.services.factionService
factionService.factions.forEach { faction ->
plugin.server.scheduler.runTask(
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@ duels:
notificationDistance: 64
dynmap:
enableDynmapIntegration: true
onlyRenderTerritoriesUponStartup: false
dev:
enableDevCommands: false
1 change: 1 addition & 0 deletions src/main/resources/lang/lang_de_DE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1074,4 +1074,5 @@ CommandFactionJoinFactionFull=Die Fraktion, der du beitreten m
CommandFactionAddMemberTargetFactionFull=Die Fraktion, zu der du diesen Spieler hinzufügen möchtest, ist voll.
PlayerInteractEntityFailedToSavePlayer=Der Spieler konnte nicht gespeichert werden.
PlayerInteractEntityCannotTradeWithVillager=Du kannst nicht mit diesem Dorfbewohner handeln.
DynmapOnlyRenderTerritoriesUponStartupEnabled=Die Konfigurationsoption ?dynmap.onlyRenderTerritoriesUponStartup? ist aktiviert. Gebiete werden nur beim Start gerendert.
CommandFactionClaimFillTooManyChunks=Du kannst nicht mehr als {0} Chunks gleichzeitig beanspruchen.
4 changes: 1 addition & 3 deletions src/main/resources/lang/lang_en_GB.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1068,12 +1068,10 @@ CommandFactionInfoAlliesTitle=Allies:
CommandFactionInfoEnemiesTitle=Enemies:
BlockNotLocked=That block is not locked.
CommandFactionRoleSetPermissionCannotModifyRolePermissionToModifyOwnRolePermission=You cannot modify your role''s permission to modify your own role''s permissions.
DeprecationWarningAutoclaim=Command deprecated. Use /f claim auto instead.
DeprecationWarningFillclaim=Command deprecated. Use /f claim fill instead.
DeprecationWarningCheckclaim=Command deprecated. Use /f claim check instead.
CommandFactionInviteFactionFull=You cannot invite any more members to your faction.
CommandFactionJoinFactionFull=The faction you are trying to join is full.
CommandFactionAddMemberTargetFactionFull=The faction you are trying to add a member to is full.
PlayerInteractEntityFailedToSavePlayer=Failed to save player.
PlayerInteractEntityCannotTradeWithVillager=You cannot trade with this villager.
DynmapOnlyRenderTerritoriesUponStartupEnabled=The `dynmap.onlyRenderTerritoriesUponStartup` config option is enabled. Territories will only be rendered upon startup.
CommandFactionClaimFillTooManyChunks=You cannot claim more than {0} chunks at once.
4 changes: 1 addition & 3 deletions src/main/resources/lang/lang_en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1068,12 +1068,10 @@ CommandFactionInfoVassalsTitle=Vassals:
CommandFactionInfoAlliesTitle=Allies:
CommandFactionInfoEnemiesTitle=Enemies:
CommandFactionRoleSetPermissionCannotModifyRolePermissionToModifyOwnRolePermission=You cannot modify your role''s permission to modify your own role''s permissions.
DeprecationWarningAutoclaim=Command deprecated. Use /f claim auto instead.
DeprecationWarningFillclaim=Command deprecated. Use /f claim fill instead.
DeprecationWarningCheckclaim=Command deprecated. Use /f claim check instead.
CommandFactionInviteFactionFull=You cannot invite any more members to your faction.
CommandFactionJoinFactionFull=The faction you are trying to join is full.
CommandFactionAddMemberTargetFactionFull=The faction you are trying to add a member to is full.
PlayerInteractEntityFailedToSavePlayer=Failed to save player.
PlayerInteractEntityCannotTradeWithVillager=You cannot trade with this villager.
DynmapOnlyRenderTerritoriesUponStartupEnabled=The `dynmap.onlyRenderTerritoriesUponStartup` config option is enabled. Territories will only be rendered upon startup.
CommandFactionClaimFillTooManyChunks=You cannot claim more than {0} chunks at once.
1 change: 1 addition & 0 deletions src/main/resources/lang/lang_fr_FR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1076,4 +1076,5 @@ CommandFactionJoinFactionFull=La faction est pleine.
CommandFactionAddMemberTargetFactionFull=La faction est pleine.
PlayerInteractEntityFailedToSavePlayer=Impossible de sauvegarder le joueur.
PlayerInteractEntityCannotTradeWithVillager=Vous ne pouvez pas commercer avec ce villageois.
DynmapOnlyRenderTerritoriesUponStartupEnabled=L'option de configuration `dynmap.onlyRenderTerritoriesUponStartup` est activée. Les territoires ne seront rendus qu'au démarrage.
CommandFactionClaimFillTooManyChunks=Vous ne pouvez pas réclamer plus de {0} morceaux à la fois.
Loading

0 comments on commit f7c7723

Please sign in to comment.