Skip to content
Draft
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
54 changes: 54 additions & 0 deletions src/main/kotlin/me/clip/voteparty/cmds/CommandVoteParty.kt
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,60 @@ internal class CommandVoteParty(override val plugin: VotePartyPlugin) : BaseComm
sendMessage(currentCommandIssuer, Messages.CLAIM__SUCCESS_ALL)
}

@Subcommand("claimparty")
@Description("Claim Party Rewards")
@CommandPermission(CLAIM_PERM)
fun claimParty(player: Player)
{
val user = party.usersHandler[player]

if (user.partyClaimable <= 0)
{
return sendMessage(currentCommandIssuer, Messages.CLAIM__PARTY_NONE)
}

if (player.inventory.firstEmpty() == -1 && party.conf().getProperty(PartySettings.CLAIMABLE_IF_FULL))
{
return sendMessage(currentCommandIssuer, Messages.CLAIM__PARTY_FULL)
}

party.partyHandler.runAll(player)
user.partyClaimable--

sendMessage(currentCommandIssuer, Messages.CLAIM__PARTY_SUCCESS, null, "{claim}", user.partyClaimable)
}


@Subcommand("claimallparty")
@Description("Claim All Party Rewards")
@CommandPermission(CLAIM_PERM)
fun claimAllParty(player: Player)
{
val user = party.usersHandler[player]

if (user.partyClaimable <= 0)
{
return sendMessage(currentCommandIssuer, Messages.CLAIM__PARTY_NONE)
}

for (i in 1..user.partyClaimable)
{
if (player.inventory.firstEmpty() == -1 && party.conf().getProperty(PartySettings.CLAIMABLE_IF_FULL))
{
return sendMessage(currentCommandIssuer, Messages.CLAIM__PARTY_FULL_ALL, null, "{claimed}", i, "{claim}", user.partyClaimable)
}

if (party.conf().getProperty(PartySettings.USE_CRATE)) {
player.inventory.addItem(party.partyHandler.buildCrate(1))
} else {
party.partyHandler.runAll(player)
}

user.partyClaimable--
}
sendMessage(currentCommandIssuer, Messages.CLAIM__PARTY_SUCCESS_ALL)
}

@Subcommand("help")
@Description("Help")
@CommandPermission("voteparty.help")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ internal object PartySettings : SettingsHolder
@Comment("Choose to allow offline votes count towards the party")
val OFFLINE_VOTES: Property<Boolean> = newProperty("party.offline_votes", true)

@JvmField
@Comment("If a player's inventory is full when a party is triggered, do you want to send the vote to a /vote claimparty?")
val CLAIMABLE_IF_FULL: Property<Boolean> = newProperty("party.claim_if_full", true)

@JvmField
@Comment(
"There are 3 different ways that a party can work.",
Expand Down
16 changes: 16 additions & 0 deletions src/main/kotlin/me/clip/voteparty/handler/PartyHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,28 @@ class PartyHandler(override val plugin: VotePartyPlugin) : Addon
if (party.conf().getProperty(PartySettings.USE_CRATE)) {
val disabledWorlds = party.conf().getProperty(PartySettings.DISABLED_WORLDS)
targets.filterNot { it.world.name in disabledWorlds }.forEach {
if (it.inventory.firstEmpty() == -1 && party.conf().getProperty(PartySettings.CLAIMABLE_IF_FULL))
{
val user = party.usersHandler[it]
user.partyClaimable++
sendMessage(party.manager().getCommandIssuer(it), Messages.PARTY__INVENTORY_FULL)
return@forEach
}

it.inventory.addItem(buildCrate(1))
}
}
else {
targets.forEach()
{
if (it.inventory.firstEmpty() == -1 && party.conf().getProperty(PartySettings.CLAIMABLE_IF_FULL))
{
val user = party.usersHandler[it]
user.partyClaimable++
sendMessage(party.manager().getCommandIssuer(it), Messages.PARTY__INVENTORY_FULL)
return@forEach
}

giveGuaranteedPartyRewards(it)
giveRandomPartyRewards(it)
givePermissionPartyRewards(it)
Expand Down
6 changes: 6 additions & 0 deletions src/main/kotlin/me/clip/voteparty/messages/Messages.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ enum class Messages : MessageKeyProvider

PARTY__FORCE_START_SUCCESSFUL,
PARTY__REQUIREMENTS_NOT_MET,
PARTY__INVENTORY_FULL,

VOTES__VOTES_NEEDED_UPDATED,
VOTES__VOTE_COUNTER_UPDATED,
Expand All @@ -33,6 +34,11 @@ enum class Messages : MessageKeyProvider
CRATE__CRATE_GIVEN,
CRATE__CRATE_RECEIVED,

CLAIM__PARTY_NONE,
CLAIM__PARTY_FULL,
CLAIM__PARTY_FULL_ALL,
CLAIM__PARTY_SUCCESS,
CLAIM__PARTY_SUCCESS_ALL,
CLAIM__SUCCESS,
CLAIM__SUCCESS_ALL,
CLAIM__NONE,
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/me/clip/voteparty/user/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.bukkit.Bukkit
import org.bukkit.OfflinePlayer
import java.util.UUID

data class User(val uuid: UUID, var name: String, private val data: MutableList<Long>, var claimable: Int)
data class User(val uuid: UUID, var name: String, private val data: MutableList<Long>, var claimable: Int, var partyClaimable: Int)
{

fun voted()
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/me/clip/voteparty/user/UsersHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class UsersHandler(override val plugin: VotePartyPlugin) : Addon, State, Listene
{
return cached.getOrPut(uuid)
{
User(uuid, "", mutableListOf(), 0)
User(uuid, "", mutableListOf(), 0, 0)
}
}

Expand Down Expand Up @@ -267,7 +267,7 @@ class UsersHandler(override val plugin: VotePartyPlugin) : Addon, State, Listene

if (old == null)
{
val new = User(player.uniqueId, player.name, mutableListOf(), 0)
val new = User(player.uniqueId, player.name, mutableListOf(), 0, 0)

cached[new.uuid] = new
cached[new.name.lowercase(Locale.getDefault())] = new
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/languages/de-DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ info:
party:
force-start-successful: "&fDu hast eine &dVote Party gestartet &ffür alle Spieler online!"
requirements-not-met: "&fSorry, but you did not meet the requirements to join this party!"
inventory-full: "&fYour inventory seems to be full! We've put this party reward in your claimables! Do /vp claimparty once your inventory isn't full!"
votes:
votes-needed-updated: "&fNeue erforderlichen Stimmen wurden gesetzt! &d%voteparty_votes_required_party% Votes &fwerden benötigt für die nächste Party."
vote-counter-updated: "&fAktuell Votes wurden geupdated zu &d%voteparty_votes_recorded%&f!"
Expand All @@ -41,6 +42,11 @@ crate:
crate-given: "&fDu hast &d%player_name% &fvote bekommen oder erstellt!"
crate-received: "Du hast ein Vote erstellt!"
claim:
party-none: "&fYou don't have any rewards to claim from parties!"
party-full: "&aYour inventory is full! Make some space and try again!"
party-full-all: "&aYour inventory is full! Make some space and try again! You have claimed &d{claimed} &aparty rewards. You have &d{claim} &aleft to claim."
party-success: "&fYou successfully claimed the rewards from a party! You have &d{claim} &fleft to claim."
party-success-all: "&fYou successfully claimed the rewards for all parties!"
success: "&fDu hast erfolgreich die Belohnungen von deiner Offline-Abstimmung abgeholt! Du hast &d{claim} &fnoch zur abzuholen."
success-all: "&fYou successfully claimed the rewards for all offline votes!"
none: "&fDu hast keine Belohnungen von Offline-Votes!"
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/languages/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ info:
party:
force-start-successful: "&fYou've force started a &dVote Party &ffor all online players!"
requirements-not-met: "&fSorry, but you did not meet the requirements to join this party!"
inventory-full: "&fYour inventory seems to be full! We've put this party reward in your claimables! Do /vp claimparty once your inventory isn't full!"
votes:
votes-needed-updated: "&fNew required votes has been set! &d%voteparty_votes_required_party% Votes &fneeded for the next party."
vote-counter-updated: "&fCurrent votes updated to &d%voteparty_votes_recorded%&f!"
Expand All @@ -40,6 +41,11 @@ crate:
crate-given: "&fYou've given &d%player_name% &fvote crate(s)!"
crate-received: "&fYou've received a vote crate!"
claim:
party-none: "&fYou don't have any rewards to claim from parties!"
party-full: "&aYour inventory is full! Make some space and try again!"
party-full-all: "&aYour inventory is full! Make some space and try again! You have claimed &d{claimed} &aparty rewards. You have &d{claim} &aleft to claim."
party-success: "&fYou successfully claimed the rewards from a party! You have &d{claim} &fleft to claim."
party-success-all: "&fYou successfully claimed the rewards for all parties!"
success: "&fYou successfully claimed the rewards from an offline vote! You have &d{claim} &fleft to claim."
success-all: "&fYou successfully claimed the rewards for all offline votes!"
none: "&fYou don't have any rewards to claim from offline votes!"
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/languages/fr-FR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ info:
party:
force-start-successful: "&fVous avez lancé de force un &dVote Party &fpour tous les joueurs en ligne !"
requirements-not-met: "&fSorry, but you did not meet the requirements to join this party!"
inventory-full: "&fYour inventory seems to be full! We've put this party reward in your claimables! Do /vp claimparty once your inventory isn't full!"
votes:
votes-needed-updated: "&fDe nouveaux votes obligatoires ont été fixés ! &d%voteparty_votes_required_party% Vote Party &fpour tous les joueurs en ligne."
vote-counter-updated: "&fVotes actuels mis à jour à &d%voteparty_votes_recorded%&f!"
Expand All @@ -41,6 +42,11 @@ crate:
crate-given: "&fVous avez donné à &d%player_name% &f une vote crate(s)!"
crate-received: "&fVous avez reçu une caisse de vote !"
claim:
party-none: "&fYou don't have any rewards to claim from parties!"
party-full: "&aYour inventory is full! Make some space and try again!"
party-full-all: "&aYour inventory is full! Make some space and try again! You have claimed &d{claimed} &aparty rewards. You have &d{claim} &aleft to claim."
party-success: "&fYou successfully claimed the rewards from a party! You have &d{claim} &fleft to claim."
party-success-all: "&fYou successfully claimed the rewards for all parties!"
success: "&fVous avez réclamé les récompenses pour un vote hors ligne ! Il vous reste &d{claim} &fà récupérer."
success-all: "&fYou successfully claimed the rewards for all offline votes!"
none: "&fVous n'avez aucune récompense à réclamer pour des votes hors ligne !"
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/languages/nl-NL.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ info:
party:
force-start-successful: "&fJe hebt een &dVote Party &fvoor alle online spelers gestart!"
requirements-not-met: "&fSorry, je voldeed niet aan de vereisten om deel te nemen aan deze VoteParty!"
inventory-full: "&fYour inventory seems to be full! We've put this party reward in your claimables! Do /vp claimparty once your inventory isn't full!"
votes:
votes-needed-updated: "&fNieuwe vereiste stemmen zijn ingesteld! &d%voteparty_votes_required_party% Stemmen &zijn nodig voor de volgende party."
vote-counter-updated: "&fHuidige stemmen bijgewerkt naar &d%voteparty_votes_recorded%&f!"
Expand All @@ -41,6 +42,11 @@ crate:
crate-given: "&fJe hebt &d%player_name% &fvote crate(s) gegeven!"
crate-received: "&fJe hebt een vote crate ontvangen!"
claim:
party-none: "&fYou don't have any rewards to claim from parties!"
party-full: "&aYour inventory is full! Make some space and try again!"
party-full-all: "&aYour inventory is full! Make some space and try again! You have claimed &d{claimed} &aparty rewards. You have &d{claim} &aleft to claim."
party-success: "&fYou successfully claimed the rewards from a party! You have &d{claim} &fleft to claim."
party-success-all: "&fYou successfully claimed the rewards for all parties!"
success: "&fJe hebt succesvol de beloningen geclaimd van een offline stem! Je hebt &d{claim} &fover om te claimen."
success-all: "&fYou successfully claimed the rewards for all offline votes!"
none: "&fJe hebt geen beloningen die je kunt claimen van offline stemmen!"
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/languages/sv-SE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ info:
party:
force-start-successful: "&fDu tvingade igång ett &dVote Party &fför alla onlinespelare!"
requirements-not-met: "&fSorry, but you did not meet the requirements to join this party!"
inventory-full: "&fYour inventory seems to be full! We've put this party reward in your claimables! Do /vp claimparty once your inventory isn't full!"
votes:
votes-needed-updated: "&fNya nödvändiga röster har ändrats! &d%voteparty_votes_required_party% Röster &fbehövda för nästa party."
vote-counter-updated: "&fNuvarande röster uppdaterades till &d%voteparty_votes_recorded%&f!"
Expand All @@ -41,6 +42,11 @@ crate:
crate-given: "&fDu har gett &d%player_name% röstlådor!"
crate-received: "&fDu har fått en röstlåda!"
claim:
party-none: "&fYou don't have any rewards to claim from parties!"
party-full: "&aYour inventory is full! Make some space and try again!"
party-full-all: "&aYour inventory is full! Make some space and try again! You have claimed &d{claimed} &aparty rewards. You have &d{claim} &aleft to claim."
party-success: "&fYou successfully claimed the rewards from a party! You have &d{claim} &fleft to claim."
party-success-all: "&fYou successfully claimed the rewards for all parties!"
success: "&fDu har lyckats hämtat belöningarna från en offlineröst! Du har &d{claim} &fkvar att hämta."
success-all: "&fYou successfully claimed the rewards for all offline votes!"
none: "&fDu har inga belöningar från offlineröster att hämta!"
Expand Down
Loading