Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
654ee73945 | ||
|
|
b113a068fd | ||
|
|
216f9e878f | ||
|
|
3c1404c429 | ||
|
|
80d7251540 | ||
|
|
5d4fa15a0b | ||
|
|
02258478bb | ||
|
|
c4274e30ff | ||
|
|
aade5c2a80 | ||
|
|
a09113f2c6 | ||
|
|
d5cd6cd16a | ||
|
|
fc7ad2a3ff | ||
|
|
1539d4199c | ||
|
|
bf4fc1cb56 | ||
|
|
9bc2ec59e5 | ||
|
|
32baf04a75 | ||
|
|
a62da35686 | ||
|
|
7a9f409b59 | ||
|
|
12c103e354 | ||
|
|
cd62cbf576 | ||
|
|
e550d93ca5 | ||
|
|
25effd4805 | ||
|
|
bb6066d867 | ||
|
|
c44f40afd0 | ||
|
|
fa677ace84 | ||
|
|
37e312a6d9 | ||
|
|
1358e32470 | ||
|
|
e08eddb0c0 | ||
|
|
f7ac8b5fa4 | ||
|
|
7d192be572 | ||
|
|
7984dec523 | ||
|
|
bb420bc709 | ||
|
|
78b9a336d9 | ||
|
|
667a4ea749 | ||
|
|
4ede4ff88b | ||
|
|
e26043958a | ||
|
|
d3a6c267c6 | ||
|
|
0d92dfa563 | ||
|
|
6e9916fcbd | ||
|
|
e81c3e27bc | ||
|
|
f4613cdce4 | ||
|
|
799340ce06 | ||
|
|
ea1a033f2e | ||
|
|
dabdd8ae8f | ||
|
|
3e2b7eede9 | ||
|
|
f941deed79 | ||
|
|
f601b4a134 | ||
|
|
26630725bd | ||
|
|
7faa90ce43 | ||
|
|
4c99b6b06e | ||
|
|
2f2d8278a4 | ||
|
|
e8be2974f9 | ||
|
|
4930feff94 | ||
|
|
132d871039 | ||
|
|
aea6954dbb | ||
|
|
1ee8819e4c | ||
|
|
41e3b7fbf6 | ||
|
|
4218d240bc | ||
|
|
683d6fcc42 | ||
|
|
c9f6ab2fa6 | ||
|
|
c99d3baa3c | ||
|
|
d0ade2feff | ||
|
|
dcebe5a701 | ||
|
|
d33791fb28 | ||
|
|
8512b3ab4f | ||
|
|
4395d8cc89 | ||
|
|
55f4e6872c | ||
|
|
6699a9204c | ||
|
|
14e1a975c9 | ||
|
|
7ab3c4bcf9 | ||
|
|
1866196571 | ||
|
|
301c21ed20 | ||
|
|
2d5208a568 | ||
|
|
44a543e64c | ||
|
|
458c66819a | ||
|
|
dcf4f3f15d | ||
|
|
e33ef5420a | ||
|
|
8d1c3a05ce | ||
|
|
9a167a46d8 | ||
|
|
ffe60808b6 | ||
|
|
1affd6c2fa | ||
|
|
17225dca5b | ||
|
|
fc9f55ead8 | ||
|
|
eec877623e | ||
|
|
a06b0573c5 | ||
|
|
dfcfee302f |
No files matched your search
@@ -2,6 +2,12 @@
|
||||
Plugin on SpigotMC
|
||||
https://www.spigotmc.org/resources/votingplugin.15358/
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
## License
|
||||
### Creative Commons Arttribution 3.0 Unported
|
||||
https://github.com/Ben12345rocks/VotingPlugin/blob/master/VotingPlugin/LICENSE.txt
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
@@ -17,40 +8,14 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.doc.comment.support=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||
@@ -59,65 +24,4 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=info
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
Binary file not shown.
@@ -42,12 +42,12 @@ AllowUnjoined: false
|
||||
VoteReminding:
|
||||
# Enable vote reminding
|
||||
# This will remind player when he can vote on all sites
|
||||
# Requires VoteDelay's to be setup properly
|
||||
# Requires VoteDelays to be setup properly
|
||||
# Use /vote next to see when you can be reminded
|
||||
# Players require the perm "VotingPlugin.Login.RemindVotes" or "VotingPlugin.Player"
|
||||
Enabled: true
|
||||
|
||||
# Wether or t to remind only once when the player can vote
|
||||
# Whether or not to remind only once when the player can vote
|
||||
# Does not apply to login reminds.
|
||||
RemindOnlyOnce: true
|
||||
|
||||
@@ -91,7 +91,7 @@ VoteReminding:
|
||||
# Set Message to '' (2 ') to disable message
|
||||
|
||||
Commands:
|
||||
# Wether or not the following commands will open GUIs rather than display text
|
||||
# Whether or not the following commands will open GUIs rather than display text
|
||||
UseGUI:
|
||||
Today: true
|
||||
TopVoter: true
|
||||
@@ -224,6 +224,9 @@ Format:
|
||||
- '&3Highest Week Streak: &3&l%BestWeeklyStreak%'
|
||||
- '&3Highest Month Streak: &3&l%BestMonthlyStreak%'
|
||||
|
||||
Today:
|
||||
Line: '&6%player% : %VoteSite% : %Time%'
|
||||
|
||||
# PlaceHolders:
|
||||
# %VotesRequired% = VotesRequired
|
||||
# %NeededVotes% = Number of votes needed to reach VotesRequired
|
||||
@@ -282,9 +285,16 @@ Format:
|
||||
# User not exist message, from commands such as /vote next (player)
|
||||
UserNotExist: '&cUser does not exist: %player%'
|
||||
|
||||
# Text for page buttons in inventories
|
||||
PrevPage: '&aPrevious Page'
|
||||
NextPage: '&aNext Page'
|
||||
# Prev/Next page tems in GUIs
|
||||
PrevItem:
|
||||
Material: 'BLACK_STAINED_GLASS_PANE'
|
||||
Amount: 1
|
||||
Name: '&aPrevious Page'
|
||||
|
||||
NextItem:
|
||||
Material: 'BLACK_STAINED_GLASS_PANE'
|
||||
Amount: 1
|
||||
Name: '&aNext Page'
|
||||
|
||||
InvFull: '&cInventory full, dropping items on ground'
|
||||
|
||||
@@ -442,6 +452,11 @@ GUI:
|
||||
# Number of topvoters to display on page +9
|
||||
# 9 Slots on the botton are used for page buttons
|
||||
Size: 27
|
||||
# If true, /vote top will show player heads
|
||||
UseSkull: true
|
||||
# Item for player in GUI if use skull is false
|
||||
PlayerItem:
|
||||
Material: 'PAPER'
|
||||
VoteTotal:
|
||||
Name: 'VoteTotal: %player%'
|
||||
BackButton: true
|
||||
@@ -562,7 +577,7 @@ Shop:
|
||||
Permission: ''
|
||||
# Limit how many times you can buy this
|
||||
#Limit: 3
|
||||
# Rewards to run if player buys succesfully
|
||||
# Rewards to run if player buys successfully
|
||||
Rewards:
|
||||
Items:
|
||||
Diamond:
|
||||
@@ -693,6 +708,9 @@ VoteStreak:
|
||||
Day: 50
|
||||
Week: 50
|
||||
Month: 50
|
||||
|
||||
# Reward given when vote cooldown ended
|
||||
VoteCoolDownEndedReward: []
|
||||
|
||||
|
||||
# ONLY USE THIS FOR TITLES/SOUNDS AND OTHER EFFECTS
|
||||
@@ -793,6 +811,13 @@ PointsOnVote: 1
|
||||
# Not really recommended
|
||||
AddTotals: true
|
||||
|
||||
# Click sound when using gui
|
||||
# Set to none for no sound
|
||||
ClickSound:
|
||||
Sound: 'UI_BUTTON_CLICK'
|
||||
Volume: 1.0
|
||||
Pitch: 1.0
|
||||
|
||||
# Debug
|
||||
Debug: false
|
||||
|
||||
@@ -819,7 +844,7 @@ RequestAPI:
|
||||
DefaultMethod: 'Anvil'
|
||||
DisabledMethods: []
|
||||
|
||||
# Wether or not to log every vote to a file
|
||||
# Whether or not to log every vote to a file
|
||||
# Use this if you wanna track player votes
|
||||
# Not recommended though
|
||||
LogVotesToFile: false
|
||||
@@ -875,6 +900,9 @@ AutoDownload: false
|
||||
# Whether or not to disable update checks
|
||||
DisableUpdateChecking: false
|
||||
|
||||
# Allow transfer of vote points
|
||||
AllowVotePointTransfers: false
|
||||
|
||||
# Disable this on a hub server for example
|
||||
# Still processes rewards for offline rewards (just won't give any)
|
||||
ProcessRewards: true
|
||||
@@ -886,6 +914,14 @@ DisableAdvancedTab: false
|
||||
# Requires restart to take effect
|
||||
LoadCommandAliases: true
|
||||
|
||||
# Wait until user is logged in with AuthMe
|
||||
# Requires AuthMe
|
||||
WaitUntilLoggedIn: true
|
||||
|
||||
# Preload skulls to improve performance
|
||||
# If false, skulls will be cached as they are used
|
||||
PreloadSkulls: false
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Mysql cache options
|
||||
# Clearing cache forces the plugin to pull from database
|
||||
@@ -919,4 +955,4 @@ ClearCacheOnVote: false
|
||||
|
||||
# Disable checking on world change
|
||||
# May improve performance
|
||||
#DisableCheckOnWorldChange: false
|
||||
#DisableCheckOnWorldChange: false
|
||||
@@ -16,7 +16,8 @@ VoteSites:
|
||||
|
||||
# The serviceName from the vote, has to be correct to work correctly
|
||||
# Gotten from voting on the site (will be in console/log)
|
||||
# Usually is the main part of the url(e.g. PlanetMinecraft.com)
|
||||
# Usually is the main part of the url(e.g. PlanetMinecraft.com), but not always
|
||||
# See console when you vote (it will notify you if the plugin didn't find a votingsite matching the service site
|
||||
ServiceSite: 'PlanetMinecraft.com'
|
||||
|
||||
# vote url for /vote
|
||||
@@ -29,9 +30,11 @@ VoteSites:
|
||||
VoteDelay: 24
|
||||
|
||||
# Require waiting until votedelay time has pasted in order to accept vote
|
||||
# Recommend: false
|
||||
WaitUntilVoteDelay: false
|
||||
|
||||
# Reset vote delay each day (for certain sites that do this)
|
||||
# Recommend: false
|
||||
VoteDelayDaily: false
|
||||
|
||||
# If true, rewards can be executed offline (requires ForceOffline to be true in the reward)
|
||||
@@ -48,8 +51,10 @@ VoteSites:
|
||||
# Rewards to give
|
||||
# https://github.com/Ben12345rocks/AdvancedCore/wiki/Rewards
|
||||
Rewards:
|
||||
# Execute console commands
|
||||
Commands:
|
||||
- 'say hello'
|
||||
# Send player a message
|
||||
Messages:
|
||||
Player: 'You voted'
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ main: com.Ben12345rocks.VotingPlugin.Main
|
||||
description: Highly Customizable Voting Listener!
|
||||
website: https://www.spigotmc.org/resources/votingplugin.15358/
|
||||
author: Ben12345rocks
|
||||
softdepend: [MVdWPlaceholders]
|
||||
api-version: 1.13
|
||||
commands:
|
||||
vote:
|
||||
@@ -63,6 +64,9 @@ commands:
|
||||
votechoices:
|
||||
description: A command
|
||||
alaises: vchoices
|
||||
votegivepoints:
|
||||
description: A command
|
||||
alaises: vgivepoints
|
||||
adminvotehelp:
|
||||
description: Open adminvote help
|
||||
aliases: avhelp
|
||||
@@ -108,18 +112,9 @@ commands:
|
||||
adminvotevote:
|
||||
description: Command Alias
|
||||
aliases: [avvote, fakevote]
|
||||
adminvotesetpoints:
|
||||
description: Command Alias
|
||||
aliases: avsetpoints
|
||||
adminvoteaddpoints:
|
||||
description: Command Alias
|
||||
aliases: avaddpoints
|
||||
adminvotegui:
|
||||
description: Command Alias
|
||||
aliases: avgui
|
||||
votesetrequestmethod:
|
||||
description: Command Alias
|
||||
aliases: [vsetrequestmethod, setrequesetmethod]
|
||||
adminvotegivereward:
|
||||
description: Command Alias
|
||||
aliases: avgivereward
|
||||
@@ -140,9 +135,6 @@ commands:
|
||||
adminvoteConvertFrom:
|
||||
description: Command Alias
|
||||
aliases: avConvertFrom
|
||||
adminvoteRemovePoints:
|
||||
description: Command Alias
|
||||
aliases: avRemovePoints
|
||||
adminvoteServiceSites:
|
||||
description: Command Alias
|
||||
aliases: avServiceSites
|
||||
@@ -191,39 +183,18 @@ commands:
|
||||
adminvoteDownloadJenkins:
|
||||
description: Command Alias
|
||||
aliases: avDownloadJenkins
|
||||
adminvoteAddTotal:
|
||||
description: Command Alias
|
||||
aliases: avTotal
|
||||
adminvoteAddMilestoneCount:
|
||||
description: Command Alias
|
||||
aliases: avAddMilestoneCount
|
||||
adminvoteSetMilestoneCount:
|
||||
description: Command Alias
|
||||
aliases: avSetMilestoneCount
|
||||
adminvoteForceVoteParty:
|
||||
description: Command Alias
|
||||
aliases: avForceVoteParty
|
||||
adminvoteForceMilestone:
|
||||
description: Command Alias
|
||||
aliases: avForceMilestone
|
||||
adminvoteForceCummulative:
|
||||
description: Command Alias
|
||||
aliases: avForceCummulative
|
||||
adminvoteForceAllSites:
|
||||
description: Command Alias
|
||||
aliases: avForceAllSites
|
||||
adminvoteForceFirstVote:
|
||||
description: Command Alias
|
||||
aliases: avForceFirstVote
|
||||
adminvoteForceVoteStreak:
|
||||
description: Command Alias
|
||||
aliases: avForceVoteStreak
|
||||
adminvoteUserEditValue:
|
||||
description: Command Alias
|
||||
aliases: avUserEditValue
|
||||
adminvoteSetRequestMethod:
|
||||
description: Command Alias
|
||||
aliases: avSetRequestMethod
|
||||
adminvoteUser:
|
||||
description: Command Alias
|
||||
aliases: avUser
|
||||
permissions:
|
||||
VotingPlugin.Player:
|
||||
description: Allows basic access player commands
|
||||
|
||||
+13
-2
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.17.1</version>
|
||||
<version>5.19</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
@@ -120,6 +120,10 @@
|
||||
<pattern>com.zaxxer.HikariCP</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.HikariCP</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.zaxxer.hikari</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.hikari</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.slf4j.slf4j-simple</pattern>
|
||||
<shadedPattern>${project.groupId}.${project.artifactId}.slf4j-simple</shadedPattern>
|
||||
@@ -241,7 +245,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.14.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -278,5 +282,12 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/SuperbVote-0.5.3.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>be.maximvdw</groupId>
|
||||
<artifactId>MVdWPlaceholderAPI</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/MVdWPlaceholderAPI.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -80,6 +80,8 @@ public class CommandLoader {
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
private Object pointLock = new Object();
|
||||
|
||||
/**
|
||||
* Gets the single instance of CommandLoader.
|
||||
*
|
||||
@@ -264,7 +266,6 @@ public class CommandLoader {
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ConvertFrom", "VoteRoulette" },
|
||||
"VotingPlugin.Commands.AdminVote.ConvertFrom.GAL|" + adminPerm, "Convert from VoteRoulette") {
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("VoteRoulette") != null) {
|
||||
@@ -308,16 +309,18 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "SetPoints", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetPoints|" + adminPerm, "Set players voting points") {
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "SetPoints", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetPoints|" + adminPerm, "Set players voting points") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.setPoints(Integer.parseInt(args[2]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cSet " + args[1] + " points to " + args[2]));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.setPoints(Integer.parseInt(args[3]));
|
||||
sender.sendMessage(
|
||||
StringUtils.getInstance().colorize("&cSet " + args[1] + " points to " + args[3]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ResyncMilestones" },
|
||||
"VotingPlugin.Commands.AdminVote.SetResyncMilestones|" + adminPerm, "Resync Milestones") {
|
||||
@@ -334,29 +337,33 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "AddPoints", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.AddPoints|" + adminPerm, "Add to players voting points") {
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "AddPoints", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.AddPoints|" + adminPerm, "Add to players voting points") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.addPoints(Integer.parseInt(args[2]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cGave " + args[1] + " " + args[2] + " points"
|
||||
+ ", " + args[1] + " now has " + user.getPoints() + " points"));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
synchronized (pointLock) {
|
||||
user.addPoints(Integer.parseInt(args[3]));
|
||||
}
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cGave " + args[1] + " " + args[3]
|
||||
+ " points" + ", " + args[1] + " now has " + user.getPoints() + " points"));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "RemovePoints", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.RemovePoints|" + adminPerm, "Remove voting points") {
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "RemovePoints", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.RemovePoints|" + adminPerm, "Remove voting points") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.removePoints(Integer.parseInt(args[2]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cRemoved " + args[2] + " points from " + args[1]
|
||||
+ ", " + args[1] + " now has " + user.getPoints() + " points"));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.removePoints(Integer.parseInt(args[3]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cRemoved " + args[3] + " points from "
|
||||
+ args[1] + ", " + args[1] + " now has " + user.getPoints() + " points"));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "Help&?" },
|
||||
"VotingPlugin.Commands.AdminVote.Help|" + adminPerm, "See this page") {
|
||||
@@ -611,58 +618,37 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "SetTotal", "Month", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetTotal.Month|" + adminPerm, "Set month totals for player") {
|
||||
for (final TopVoter top : TopVoter.values()) {
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "SetTotal", top.toString(), "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetTotal." + top.toString() + "|" + adminPerm,
|
||||
"Set " + top.toString() + " totals for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
UserManager.getInstance().getVotingPluginUser(args[2]).setTotal(TopVoter.Monthly,
|
||||
Integer.parseInt(args[3]));
|
||||
sender.sendMessage(StringUtils.getInstance()
|
||||
.colorize("&cSet month total for '" + args[2] + "' to " + args[3]));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
UserManager.getInstance().getVotingPluginUser(args[1]).setTotal(top,
|
||||
Integer.parseInt(args[4]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize(
|
||||
"&cSet " + top.toString() + " total for '" + args[1] + "' to " + args[4]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "SetTotal", "AllTime", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetTotal.AllTime|" + adminPerm,
|
||||
"Set alltime totals for player") {
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "AddTotal", top.toString(), "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.AddTotal." + top.toString() + "|" + adminPerm,
|
||||
"Add " + top.toString() + " totals for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
UserManager.getInstance().getVotingPluginUser(args[2]).setTotal(TopVoter.AllTime,
|
||||
Integer.parseInt(args[3]));
|
||||
sender.sendMessage(StringUtils.getInstance()
|
||||
.colorize("&cSet alltime total for '" + args[2] + "' to " + args[3]));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.setTotal(top, user.getTotal(top) + Integer.parseInt(args[4]));
|
||||
sender.sendMessage(StringUtils.getInstance()
|
||||
.colorize("&cAdded " + top.toString() + " total for " + args[1]));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "SetTotal", "Week", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetTotal.Week|" + adminPerm, "Set week totals for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
UserManager.getInstance().getVotingPluginUser(args[2]).setTotal(TopVoter.Weekly,
|
||||
Integer.parseInt(args[3]));
|
||||
sender.sendMessage(
|
||||
StringUtils.getInstance().colorize("&cSet week total for '" + args[2] + "' to " + args[3]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "SetTotal", "Day", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetTotal.Day|" + adminPerm, "Set day totals for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
UserManager.getInstance().getVotingPluginUser(args[2]).setTotal(TopVoter.Daily,
|
||||
Integer.parseInt(args[3]));
|
||||
sender.sendMessage(
|
||||
StringUtils.getInstance().colorize("&cSet day total for '" + args[2] + "' to " + args[3]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ClearTotal", "(player)" },
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "User", "(player)", "ClearTotal" },
|
||||
"VotingPlugin.Commands.AdminVote.ClearTotal|" + adminPerm, "Clear Totals for player") {
|
||||
|
||||
@Override
|
||||
@@ -674,75 +660,42 @@ public class CommandLoader {
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "AddTotal", "Month", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.AddTotal.Month|" + adminPerm, "Add month totals for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[2]);
|
||||
user.setTotal(TopVoter.Monthly, user.getTotal(TopVoter.Monthly) + Integer.parseInt(args[3]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded month total for " + args[2]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "AddTotal", "AllTime", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.AddTotal.AllTime|" + adminPerm,
|
||||
"Add alltime totals for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[2]);
|
||||
user.setTotal(TopVoter.AllTime, user.getTotal(TopVoter.AllTime) + Integer.parseInt(args[3]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded alltime total for " + args[2]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "AddTotal", "Week", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.AddTotal.Week|" + adminPerm, "Add week totals for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[2]);
|
||||
user.setTotal(TopVoter.Weekly, user.getTotal(TopVoter.Weekly) + Integer.parseInt(args[3]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded week total for " + args[2]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "AddTotal", "Day", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.AddTotal.Day|" + adminPerm, "Add day totals for player") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[2]);
|
||||
user.setTotal(TopVoter.Daily, user.getTotal(TopVoter.Daily) + Integer.parseInt(args[3]));
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded day total for " + args[2]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "AddMilestoneCount", "(player)", "(number)" },
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "AddMilestoneCount", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.AddMilestoneCount|" + adminPerm, "Add milestonecount") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.setMilestoneCount(user.getMilestoneCount() + Integer.parseInt(args[2]));
|
||||
user.setMilestoneCount(user.getMilestoneCount() + Integer.parseInt(args[3]));
|
||||
SpecialRewards.getInstance().checkMilestone(user);
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded milestonecount for " + args[1]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "SetMilestoneCount", "(player)", "(number)" },
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "SetMilestoneCount", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetMilestoneCount|" + adminPerm, "Set milestonecount") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.setMilestoneCount(Integer.parseInt(args[2]));
|
||||
user.setMilestoneCount(Integer.parseInt(args[3]));
|
||||
SpecialRewards.getInstance().checkMilestone(user);
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded milestonecount for " + args[1]));
|
||||
sender.sendMessage(StringUtils.getInstance()
|
||||
.colorize("&cSet milestonecount for " + args[1] + " to " + args[3]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "SetData", "(text)", "(text)" },
|
||||
"VotingPlugin.Commands.AdminVote.SetData|" + adminPerm, "Set data") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.getData().setString(args[3], args[4]);
|
||||
sender.sendMessage(StringUtils.getInstance()
|
||||
.colorize("&cSet " + args[3] + " for " + args[1] + " to " + args[4]));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -764,6 +717,39 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "User", "(Player)", "ViewData" },
|
||||
"VotingPlugin.Commands.AdminVote.ViewData|" + adminPerm, "View playerdata") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
for (String key : user.getData().getKeys()) {
|
||||
user.sendMessage("&c&l" + key + " &c" + user.getData().getString(key));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(Player)", "ForceVote", "(Sitename)" },
|
||||
"VotingPlugin.Commands.AdminVote.Vote|" + adminPerm, "Trigger manual vote") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(args[3]), args[1], args[3],
|
||||
false);
|
||||
sendMessage(sender, "&cTriggering vote...");
|
||||
if (voteEvent.getVoteSite() != null) {
|
||||
if (!voteEvent.getVoteSite().isVaidServiceSite()) {
|
||||
sendMessage(sender,
|
||||
"&cPossible issue with service site, has the server gotten the vote from "
|
||||
+ voteEvent.getServiceSite() + "?");
|
||||
}
|
||||
}
|
||||
plugin.getServer().getPluginManager().callEvent(voteEvent);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "VoteSite", "(sitename)", "Create" },
|
||||
"VotingPlugin.Commands.AdminVote.VoteSite.Edit|" + adminPerm, "Create VoteSite") {
|
||||
|
||||
@@ -978,6 +964,19 @@ public class CommandLoader {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "TestReward", "(Player)", "(reward)", "(number)" },
|
||||
"VotingPlugin.Commands.AdminVote.TestReward|" + adminPerm, "Test reward times") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VoteTester.getInstance().testRewards(Integer.parseInt(args[3]), args[1], args[2]);
|
||||
if (isPlayer(sender)) {
|
||||
sendMessage(sender, "&cSee console for details");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "Placeholders" },
|
||||
@@ -1027,27 +1026,29 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ForceMilestone", "(Number)", "(Player)" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceMilestone|" + adminPerm, "Force a milestone") {
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "ForceMilestone", "(Number)" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceMilestone|" + adminPerm, "Force a milestone") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[2]);
|
||||
SpecialRewards.getInstance().giveMilestoneVoteReward(user, user.isOnline(), parseInt(args[1]));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
SpecialRewards.getInstance().giveMilestoneVoteReward(user, user.isOnline(), parseInt(args[3]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ForceCummulative", "(Number)", "(Player)" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceCummulative|" + adminPerm, "Force a cummulative reward") {
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "ForceCummulative", "(Number)" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceCummulative|" + adminPerm, "Force a cummulative reward") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[2]);
|
||||
SpecialRewards.getInstance().giveCumulativeVoteReward(user, user.isOnline(), parseInt(args[1]));
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
SpecialRewards.getInstance().giveCumulativeVoteReward(user, user.isOnline(), parseInt(args[3]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ForceAllSites", "(Player)" },
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "User", "(player)", "ForceAllSites" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceAllSites|" + adminPerm, "Force a allsites reward") {
|
||||
|
||||
@Override
|
||||
@@ -1057,7 +1058,7 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "ForceFirstVote", "(Player)" },
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "User", "(player)", "ForceFirstVote" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceFirstVote|" + adminPerm, "Force a firstvote reward") {
|
||||
|
||||
@Override
|
||||
@@ -1068,14 +1069,14 @@ public class CommandLoader {
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "ForceVoteStreak", "(Text)", "(Number)", "(Player)" },
|
||||
.add(new CommandHandler(new String[] { "User", "(player)", "ForceVoteStreak", "(Text)", "(Number)" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceVoteStreak|" + adminPerm, "Force a votestreak reward") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[3]);
|
||||
SpecialRewards.getInstance().giveVoteStreakReward(user, user.isOnline(), args[1], args[2],
|
||||
parseInt(args[2]));
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
SpecialRewards.getInstance().giveVoteStreakReward(user, user.isOnline(), args[3], args[4],
|
||||
parseInt(args[4]));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1111,14 +1112,14 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "" },
|
||||
"VotingPlugin.Commands.AdminVote|" + adminPerm, "Base command") {
|
||||
plugin.getAdminVoteCommand().add(
|
||||
new CommandHandler(new String[] {}, "VotingPlugin.Commands.AdminVote|" + adminPerm, "Base command") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sendMessage(sender, "&cInvalid command, see /adminvote help");
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sendMessage(sender, "&cInvalid command, see /adminvote help");
|
||||
}
|
||||
});
|
||||
|
||||
ArrayList<CommandHandler> avCommands = com.Ben12345rocks.AdvancedCore.Commands.CommandLoader.getInstance()
|
||||
.getBasicAdminCommands("VotingPlugin");
|
||||
@@ -1347,14 +1348,16 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "Shop" },
|
||||
"VotingPlugin.Commands.Vote.Shop|" + playerPerm, "Open VoteShop GUI", false) {
|
||||
if (Config.getInstance().getVoteShopEnabled()) {
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "Shop" },
|
||||
"VotingPlugin.Commands.Vote.Shop|" + playerPerm, "Open VoteShop GUI", false) {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
PlayerGUIs.getInstance().openVoteShop((Player) sender);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
PlayerGUIs.getInstance().openVoteShop((Player) sender);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "URL" },
|
||||
"VotingPlugin.Commands.Vote.URL|" + playerPerm, "Open VoteURL GUI", false) {
|
||||
@@ -1997,6 +2000,31 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
if (Config.getInstance().isAllowVotePointTransfers()) {
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "GivePoints", "(player)", "(number)" },
|
||||
"VotingPlugin.Commands.Vote.GivePoints", "Give someone points from your points", false) {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (Config.getInstance().isAllowVotePointTransfers()) {
|
||||
User cPlayer = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
int pointsToGive = Integer.parseInt(args[2]);
|
||||
if (cPlayer.getPoints() >= pointsToGive) {
|
||||
user.addPoints(pointsToGive);
|
||||
cPlayer.removePoints(pointsToGive);
|
||||
sendMessage(sender, "&c" + pointsToGive + " points given to " + user.getPlayerName());
|
||||
user.sendMessage(
|
||||
"&cYou received " + pointsToGive + " points from " + cPlayer.getPlayerName());
|
||||
} else {
|
||||
sendMessage(sender, "&cNot enough points");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
plugin.getVoteCommand().add(
|
||||
new CommandHandler(new String[] {}, "VotingPlugin.Commands.Vote|" + playerPerm, "See voting URLs") {
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.bukkit.permissions.Permission;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.CommandHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.TimeChecker;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
@@ -732,8 +733,9 @@ public class Commands {
|
||||
String info = new String();
|
||||
|
||||
long time = user.getTime(voteSite);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault());
|
||||
LocalDateTime now = TimeChecker.getInstance().getTime();
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault())
|
||||
.plusHours(AdvancedCoreHook.getInstance().getOptions().getTimeHourOffSet());
|
||||
|
||||
if (!voteSite.isVoteDelayDaily()) {
|
||||
double votedelay = voteSite.getVoteDelay();
|
||||
@@ -762,7 +764,7 @@ public class Commands {
|
||||
}
|
||||
} else {
|
||||
if (lastVote.getDayOfYear() == now.getDayOfYear() && lastVote.getYear() == now.getYear()) {
|
||||
LocalDateTime midnight = LocalDateTime.now().plusDays(1).withHour(0).withMinute(0);
|
||||
LocalDateTime midnight = TimeChecker.getInstance().getTime().plusDays(1).withHour(0).withMinute(0);
|
||||
Duration dur = Duration.between(now, midnight);
|
||||
|
||||
int diffHours = (int) (dur.getSeconds() / (60 * 60));
|
||||
@@ -888,7 +890,14 @@ public class Commands {
|
||||
for (VoteSite voteSite : plugin.getVoteToday().get(user).keySet()) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(Config.getInstance().getFormatTimeFormat());
|
||||
String timeString = plugin.getVoteToday().get(user).get(voteSite).format(formatter);
|
||||
msg.add("&6" + user.getPlayerName() + " : " + voteSite.getKey() + " : " + timeString);
|
||||
HashMap<String, String> placeholders = new HashMap<String, String>();
|
||||
placeholders.put("player", user.getPlayerName());
|
||||
placeholders.put("votesite", voteSite.getKey());
|
||||
placeholders.put("time", timeString);
|
||||
msg.add(StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getFormatCommandsVoteTodayLine(), placeholders));
|
||||
// msg.add("&6" + user.getPlayerName() + " : " + voteSite.getKey() + " : " +
|
||||
// timeString);
|
||||
}
|
||||
}
|
||||
msg = ArrayUtils.getInstance().colorize(msg);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Commands.GUI;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -161,30 +163,44 @@ public class PlayerGUIs {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getWhoClicked();
|
||||
String cmd = Config.getInstance().getVoteGUISlotCommand(slot);
|
||||
User user = getSelectedPlayer(player);
|
||||
if (!cmd.equals("")) {
|
||||
player.performCommand(cmd);
|
||||
} else {
|
||||
if (slot.equalsIgnoreCase("url")) {
|
||||
openVoteURL(player);
|
||||
} else if (slot.equalsIgnoreCase("next")) {
|
||||
openVoteNext(player, user);
|
||||
} else if (slot.equalsIgnoreCase("last")) {
|
||||
openVoteLast(player, user);
|
||||
} else if (slot.equalsIgnoreCase("total")) {
|
||||
openVoteTotal(player, user);
|
||||
} else if (slot.equalsIgnoreCase("top")) {
|
||||
openVoteTop(player, null);
|
||||
} else if (slot.equalsIgnoreCase("today")) {
|
||||
openVoteToday(player);
|
||||
} else if (slot.equalsIgnoreCase("help")) {
|
||||
player.performCommand("vote help");
|
||||
} else if (slot.equalsIgnoreCase("shop")) {
|
||||
openVoteShop(player);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Player player = event.getWhoClicked();
|
||||
String cmd = Config.getInstance().getVoteGUISlotCommand(slot);
|
||||
User user = getSelectedPlayer(player);
|
||||
if (cmd.equalsIgnoreCase("none")) {
|
||||
return;
|
||||
} else if (!cmd.equals("")) {
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.performCommand(cmd);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (slot.equalsIgnoreCase("url")) {
|
||||
openVoteURL(player);
|
||||
} else if (slot.equalsIgnoreCase("next")) {
|
||||
openVoteNext(player, user);
|
||||
} else if (slot.equalsIgnoreCase("last")) {
|
||||
openVoteLast(player, user);
|
||||
} else if (slot.equalsIgnoreCase("total")) {
|
||||
openVoteTotal(player, user);
|
||||
} else if (slot.equalsIgnoreCase("top")) {
|
||||
openVoteTop(player, null);
|
||||
} else if (slot.equalsIgnoreCase("today")) {
|
||||
openVoteToday(player);
|
||||
} else if (slot.equalsIgnoreCase("help")) {
|
||||
player.performCommand("vote help");
|
||||
} else if (slot.equalsIgnoreCase("shop")) {
|
||||
openVoteShop(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
@@ -471,25 +487,27 @@ public class PlayerGUIs {
|
||||
|
||||
int pos = 1;
|
||||
for (Entry<User, Integer> entry : users) {
|
||||
ItemBuilder playerItem;
|
||||
|
||||
inv.addButton(new BInventoryButton(
|
||||
new ItemBuilder(MiscUtils.getInstance().setSkullOwner(entry.getKey().getOfflinePlayer()))
|
||||
.setName(Config.getInstance().getGUIVoteTopItemName())
|
||||
.addLoreLine(Config.getInstance().getGUIVoteTopItemLore())
|
||||
.addPlaceholder("position", "" + pos)
|
||||
.addPlaceholder("player", entry.getKey().getPlayerName())
|
||||
.addPlaceholder("votes", "" + entry.getValue())) {
|
||||
if (Config.getInstance().isGuiVoteTopUseSkull()) {
|
||||
playerItem = new ItemBuilder(entry.getKey().getPlayerHead());
|
||||
} else {
|
||||
playerItem = new ItemBuilder(Material.valueOf(Config.getInstance().getGuiVoteTopPlayerItemMaterial()));
|
||||
}
|
||||
|
||||
playerItem.setLore(new ArrayList<String>());
|
||||
|
||||
inv.addButton(new BInventoryButton(playerItem.setName(Config.getInstance().getGUIVoteTopItemName())
|
||||
.addLoreLine(Config.getInstance().getGUIVoteTopItemLore()).addPlaceholder("position", "" + pos)
|
||||
.addPlaceholder("player", entry.getKey().getPlayerName())
|
||||
.addPlaceholder("votes", "" + entry.getValue())) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
// ItemBuilder item = new ItemBuilder(clickEvent.getClickedItem());
|
||||
// String name = ChatColor.stripColor(item.getName()).split(":")[1].trim();
|
||||
String name = (String) clickEvent.getButton().getData("player");
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(name);
|
||||
User user = (User) getData("User");
|
||||
openVoteGUI(player, user);
|
||||
}
|
||||
}.addData("player", entry.getKey().getPlayerName()));
|
||||
}.addData("player", entry.getKey().getPlayerName()).addData("User", entry.getKey()));
|
||||
pos++;
|
||||
}
|
||||
|
||||
|
||||
@@ -252,9 +252,25 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean loadCommandAliases = true;
|
||||
|
||||
@ConfigDataBoolean(path = "GUI.VoteTop.UseSkull")
|
||||
@Getter
|
||||
private boolean guiVoteTopUseSkull = true;
|
||||
|
||||
@ConfigDataString(path = "GUI.VoteTop.PlayerItem.Material")
|
||||
@Getter
|
||||
private String guiVoteTopPlayerItemMaterial = "PAPER";
|
||||
|
||||
@ConfigDataBoolean(path = "AllowVotePointTransfers")
|
||||
@Getter
|
||||
private boolean allowVotePointTransfers = false;
|
||||
|
||||
@Getter
|
||||
private int formatPageSize = 10;
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Today.Line")
|
||||
@Getter
|
||||
private String formatCommandsVoteTodayLine = "&6%player% : %VoteSite% : %Time%";
|
||||
|
||||
/**
|
||||
* Instantiates a new config.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.Ben12345rocks.VotingPlugin.CoolDown;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardOptions;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.Events.DateChangedEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UserManager;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteCoolDownEndEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class VoteReminding.
|
||||
*/
|
||||
public class CoolDownCheck implements Listener {
|
||||
|
||||
/** The instance. */
|
||||
static CoolDownCheck instance = new CoolDownCheck();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of VoteReminding.
|
||||
*
|
||||
* @return single instance of VoteReminding
|
||||
*/
|
||||
public static CoolDownCheck getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new vote reminding.
|
||||
*/
|
||||
private CoolDownCheck() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new vote reminding.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public CoolDownCheck(Main plugin) {
|
||||
CoolDownCheck.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onDayChangeEnd(DateChangedEvent event) {
|
||||
checkAll();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onCoolDownEnd(PlayerVoteCoolDownEndEvent event) {
|
||||
RewardHandler.getInstance().giveReward(event.getPlayer(), Config.getInstance().getData(),
|
||||
"VoteCoolDownEndedReward",
|
||||
new RewardOptions().addPlaceholder("Votesite", event.getVoteSite().getDisplayName()));
|
||||
}
|
||||
|
||||
public void checkAll() {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void run() {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = new User(new UUID(uuid));
|
||||
if (user.getUserData().hasData() && user.hasLoggedOnBefore()) {
|
||||
user.checkCoolDownEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Events;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PlayerVoteEvent.
|
||||
*/
|
||||
public class PlayerReceivePointsEvent extends Event {
|
||||
|
||||
/** The Constant handlers. */
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* Gets the handler list.
|
||||
*
|
||||
* @return the handler list
|
||||
*/
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private User player;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private int points;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean cancelled;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String serviceSite = "";
|
||||
|
||||
public PlayerReceivePointsEvent(User user, int points) {
|
||||
super(true);
|
||||
this.player = user;
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.bukkit.event.Event#getHandlers()
|
||||
*/
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -40,8 +40,8 @@ public class PlayerSpecialRewardEvent extends Event {
|
||||
|
||||
public PlayerSpecialRewardEvent(User user, SpecialRewardType type) {
|
||||
super(true);
|
||||
setType(type);
|
||||
setUser(user);
|
||||
this.type = type;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Events;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PlayerVoteEvent.
|
||||
*/
|
||||
public class PlayerVoteCoolDownEndEvent extends Event {
|
||||
|
||||
/** The Constant handlers. */
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* Gets the handler list.
|
||||
*
|
||||
* @return the handler list
|
||||
*/
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private User player;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private VoteSite voteSite;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean cancelled;
|
||||
|
||||
public PlayerVoteCoolDownEndEvent(User user, VoteSite site) {
|
||||
super(true);
|
||||
player = user;
|
||||
voteSite = site;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.bukkit.event.Event#getHandlers()
|
||||
*/
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,10 +48,10 @@ public class PlayerVoteEvent extends Event {
|
||||
|
||||
public PlayerVoteEvent(VoteSite voteSite, String voteUsername, String serviceSite, boolean realVote) {
|
||||
super(true);
|
||||
setPlayer(voteUsername);
|
||||
setVoteSite(voteSite);
|
||||
setRealVote(realVote);
|
||||
setServiceSite(serviceSite);
|
||||
this.player = voteUsername;
|
||||
this.voteSite = voteSite;
|
||||
this.realVote = realVote;
|
||||
this.serviceSite = serviceSite;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -4,9 +4,9 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.Listeners.AdvancedCoreLoginEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UserStorage;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
@@ -19,6 +19,7 @@ import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
public class PlayerJoinEvent implements Listener {
|
||||
|
||||
/** The plugin. */
|
||||
@SuppressWarnings("unused")
|
||||
private static Main plugin;
|
||||
|
||||
/**
|
||||
@@ -38,31 +39,22 @@ public class PlayerJoinEvent implements Listener {
|
||||
* the event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
public void onPlayerLogin(AdvancedCoreLoginEvent event) {
|
||||
if (event.getPlayer() == null || (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)
|
||||
&& AdvancedCoreHook.getInstance().getMysql() == null)) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (event.getPlayer() == null
|
||||
|| (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)
|
||||
&& AdvancedCoreHook.getInstance().getMysql() == null)) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
|
||||
if (player != null) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
// run remind
|
||||
user.loginMessage();
|
||||
|
||||
// run remind
|
||||
user.loginMessage();
|
||||
|
||||
if (user.getData().hasData()) {
|
||||
// give offline vote (if they voted offline)
|
||||
user.offVote();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 20L);
|
||||
if (user.getData().hasData()) {
|
||||
// give offline vote (if they voted offline)
|
||||
user.offVote();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -108,6 +108,7 @@ public class PlayerVoteListener implements Listener {
|
||||
|
||||
// update last vote time
|
||||
user.setTime(voteSite);
|
||||
user.setLastVoteCoolDownCheck(false, voteSite);
|
||||
|
||||
// check first vote rewards
|
||||
SpecialRewards.getInstance().checkFirstVote(user);
|
||||
@@ -138,6 +139,8 @@ public class PlayerVoteListener implements Listener {
|
||||
user.addPoints();
|
||||
}
|
||||
|
||||
user.checkDayVoteStreak();
|
||||
|
||||
// other rewards
|
||||
SpecialRewards.getInstance().checkAllSites(user);
|
||||
SpecialRewards.getInstance().checkCumualativeVotes(user);
|
||||
|
||||
@@ -51,6 +51,7 @@ public class VotiferEvent implements Listener {
|
||||
|
||||
Vote vote = event.getVote();
|
||||
final String voteSite = vote.getServiceName();
|
||||
final String IP = vote.getAddress();
|
||||
final String voteUsername = vote.getUsername().trim();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@@ -65,10 +66,12 @@ public class VotiferEvent implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getLogger().info("Recieved a vote from '" + voteSite + "' by player '" + voteUsername + "'!");
|
||||
plugin.getLogger()
|
||||
.info("Recieved a vote from '" + voteSite + "(" + IP + ")' by player '" + voteUsername + "'!");
|
||||
|
||||
plugin.debug("PlayerUsername: " + voteUsername);
|
||||
plugin.debug("VoteSite: " + voteSite);
|
||||
plugin.debug("IP: " + IP);
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ import com.Ben12345rocks.VotingPlugin.Commands.TabCompleter.AdminVoteTabComplete
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.TabCompleter.VoteTabCompleter;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.CoolDown.CoolDownCheck;
|
||||
import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.BlockBreak;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.PlayerCommandSendListener;
|
||||
@@ -68,6 +69,7 @@ import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoterHandler;
|
||||
import com.Ben12345rocks.VotingPlugin.Updater.CheckUpdate;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
import com.Ben12345rocks.VotingPlugin.Util.PlaceHolders.MVdWPlaceholders;
|
||||
import com.Ben12345rocks.VotingPlugin.Util.PlaceHolders.PlaceHolders;
|
||||
import com.Ben12345rocks.VotingPlugin.VoteParty.VoteParty;
|
||||
import com.Ben12345rocks.VotingPlugin.VoteReminding.VoteReminding;
|
||||
@@ -274,31 +276,37 @@ public class Main extends JavaPlugin {
|
||||
/**
|
||||
* Gets the vote site name.
|
||||
*
|
||||
* @param url
|
||||
* @param urls
|
||||
* the url
|
||||
* @return the vote site name
|
||||
*/
|
||||
public String getVoteSiteName(String url) {
|
||||
public String getVoteSiteName(String... urls) {
|
||||
ArrayList<String> sites = ConfigVoteSites.getInstance().getVoteSitesNames();
|
||||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
if (sites != null) {
|
||||
for (String siteName : sites) {
|
||||
String URL = ConfigVoteSites.getInstance().getServiceSite(siteName);
|
||||
if (URL != null) {
|
||||
if (URL.equalsIgnoreCase(url)) {
|
||||
for (String url : urls) {
|
||||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
if (sites != null) {
|
||||
for (String siteName : sites) {
|
||||
String URL = ConfigVoteSites.getInstance().getServiceSite(siteName);
|
||||
if (URL != null) {
|
||||
if (URL.equalsIgnoreCase(url)) {
|
||||
return siteName;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String siteName : sites) {
|
||||
if (siteName.equalsIgnoreCase(url)) {
|
||||
return siteName;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String siteName : sites) {
|
||||
if (siteName.equalsIgnoreCase(url)) {
|
||||
return siteName;
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
return url;
|
||||
for (String url : urls) {
|
||||
return url;
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
@@ -343,9 +351,26 @@ public class Main extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
update();
|
||||
if (plugin != null) {
|
||||
update();
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}, 1000, 1000 * 60 * Config.getInstance().getDelayBetweenUpdates());
|
||||
|
||||
AdvancedCoreHook.getInstance().getTimer().schedule(new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (plugin != null) {
|
||||
CoolDownCheck.getInstance().checkAll();
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}, 1000 * 60 * 10, 1000 * 60 * 5);
|
||||
|
||||
}
|
||||
}, 40L);
|
||||
|
||||
@@ -704,6 +729,14 @@ public class Main extends JavaPlugin {
|
||||
public void onEnable() {
|
||||
plugin = this;
|
||||
|
||||
// disable plugin for older versions below 1.12
|
||||
if (NMSManager.getInstance().isVersion("1.7", "1.8", "1.9", "1.10", "1.11", "1.12")) {
|
||||
plugin.getLogger().severe("Detected running " + NMSManager.getInstance().getVersion()
|
||||
+ ", this version is not supported on this build. Disabling");
|
||||
Bukkit.getPluginManager().disablePlugin(plugin);
|
||||
return;
|
||||
}
|
||||
|
||||
setupFiles();
|
||||
loadVoteSites();
|
||||
AdvancedCoreHook.getInstance().setJenkinsSite("ben12345rocks.com");
|
||||
@@ -714,7 +747,6 @@ public class Main extends JavaPlugin {
|
||||
checkVotifier();
|
||||
CheckUpdate.getInstance().startUp();
|
||||
VoteReminding.getInstance().loadRemindChecking();
|
||||
|
||||
plugin.signs = new ArrayList<SignHandler>();
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
@@ -744,6 +776,7 @@ public class Main extends JavaPlugin {
|
||||
|
||||
metrics();
|
||||
|
||||
// javascript api
|
||||
AdvancedCoreHook.getInstance().getJavascriptEngineRequests().add(new JavascriptPlaceholderRequest("User") {
|
||||
|
||||
@Override
|
||||
@@ -751,11 +784,18 @@ public class Main extends JavaPlugin {
|
||||
return getUserManager().getVotingPluginUser(player);
|
||||
}
|
||||
});
|
||||
AdvancedCoreHook.getInstance().getJavascriptEngine().put("VotingPluginHooks", VotingPluginHooks.getInstance());
|
||||
|
||||
loadTimer();
|
||||
|
||||
// placeholderapi loading
|
||||
PlaceHolders.getInstance().load();
|
||||
|
||||
// MVDW placeholders, may be removed in the future
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("MVdWPlaceholderAPI")) {
|
||||
MVdWPlaceholders.getInstance().loadMVdWPlaceholders();
|
||||
}
|
||||
|
||||
// set columns
|
||||
if (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)) {
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("TopVoterIgnore", "VARCHAR(5)");
|
||||
@@ -763,7 +803,7 @@ public class Main extends JavaPlugin {
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("Reminded", "VARCHAR(5)");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("DisableBroadcast", "VARCHAR(5)");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("LastOnline", "VARCHAR(20)");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("PlayerName", "VARCHAR(20)");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("PlayerName", "VARCHAR(30)");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("DailyTotal", "INT DEFAULT '0'");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("WeeklyTotal", "INT DEFAULT '0'");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("DayVoteStreak", "INT DEFAULT '0'");
|
||||
@@ -783,21 +823,23 @@ public class Main extends JavaPlugin {
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("LastMonthTotal", "INT DEFAULT '0'");
|
||||
}
|
||||
|
||||
RewardHandler.getInstance().getInjectedRewards().add(new RewardInjectInt("Points", 0) {
|
||||
RewardHandler.getInstance().addInjectedReward(new RewardInjectInt("Points", 0) {
|
||||
|
||||
@Override
|
||||
public void onRewardRequest(Reward reward, com.Ben12345rocks.AdvancedCore.UserManager.User user, int num,
|
||||
public String onRewardRequest(Reward reward, com.Ben12345rocks.AdvancedCore.UserManager.User user, int num,
|
||||
HashMap<String, String> placeholders) {
|
||||
UserManager.getInstance().getVotingPluginUser(user).addPoints(num);
|
||||
return null;
|
||||
}
|
||||
}.addEditButton(new EditGUIButton(new ItemBuilder(Material.PAPER), new EditGUIValueNumber("Points", null) {
|
||||
}.synchronize().addEditButton(
|
||||
new EditGUIButton(new ItemBuilder(Material.PAPER), new EditGUIValueNumber("Points", null) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Number value) {
|
||||
Reward reward = (Reward) getInv().getData("Reward");
|
||||
reward.getConfig().set("Points", value.intValue());
|
||||
}
|
||||
})));
|
||||
@Override
|
||||
public void setValue(Player player, Number value) {
|
||||
Reward reward = (Reward) getInv().getData("Reward");
|
||||
reward.getConfig().set("Points", value.intValue());
|
||||
}
|
||||
})));
|
||||
|
||||
plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
|
||||
|
||||
@@ -832,15 +874,10 @@ public class Main extends JavaPlugin {
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getLogger().warning(
|
||||
"Detected an issue with voting sites, check the plugin startup log for more details");
|
||||
"Detected an issue with voting sites, check the server startup log for more details");
|
||||
}
|
||||
}, 30l);
|
||||
}
|
||||
|
||||
if (NMSManager.getInstance().isVersion("1.7", "1.8", "1.9", "1.10", "1.11", "1.12")) {
|
||||
plugin.getLogger().severe("Detected running " + NMSManager.getInstance().getVersion()
|
||||
+ ", this version is not supported on this build. Support is limited");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -866,6 +903,7 @@ public class Main extends JavaPlugin {
|
||||
if (perm != null) {
|
||||
if (Config.getInstance().getGiveDefaultPermission()) {
|
||||
perm.setDefault(PermissionDefault.TRUE);
|
||||
getLogger().info("Giving VotingPlugin.Player permission by default, can be disabled in the config");
|
||||
} else {
|
||||
perm.setDefault(PermissionDefault.OP);
|
||||
}
|
||||
@@ -889,6 +927,7 @@ public class Main extends JavaPlugin {
|
||||
pm.registerEvents(new PlayerInteract(this), this);
|
||||
pm.registerEvents(new VotingPluginUpdateEvent(this), this);
|
||||
pm.registerEvents(new PlayerCommandSendListener(this), this);
|
||||
pm.registerEvents(new CoolDownCheck(this), this);
|
||||
|
||||
plugin.debug("Loaded Events");
|
||||
|
||||
@@ -907,6 +946,7 @@ public class Main extends JavaPlugin {
|
||||
AdvancedCoreHook.getInstance().setConfigData(Config.getInstance().getData());
|
||||
AdvancedCoreHook.getInstance().reload();
|
||||
PlaceHolders.getInstance().load();
|
||||
CoolDownCheck.getInstance().checkAll();
|
||||
}
|
||||
|
||||
private void setupFiles() {
|
||||
@@ -995,8 +1035,8 @@ public class Main extends JavaPlugin {
|
||||
time1 = ((System.currentTimeMillis() - time) / 1000);
|
||||
plugin.debug("Background task finished in " + time1 + " seconds");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
plugin.getLogger().info("Looks like something went wrong.");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,18 +11,22 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardOptions;
|
||||
import com.Ben12345rocks.AdvancedCore.TimeChecker.TimeChecker;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.MiscUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.ConfigVoteSites;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerReceivePointsEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteCoolDownEndEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.SpecialRewards.SpecialRewards;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
|
||||
import com.Ben12345rocks.VotingPlugin.VoteParty.VoteParty;
|
||||
@@ -125,6 +129,33 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
}
|
||||
}
|
||||
|
||||
public void checkDayVoteStreak() {
|
||||
if (!voteStreakUpdatedToday(LocalDateTime.now())) {
|
||||
if (!Config.getInstance().isVoteStreakRequirementUsePercentage()
|
||||
|| hasPercentageTotal(TopVoter.Daily, Config.getInstance().getVoteStreakRequirementDay(), null)) {
|
||||
addDayVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(this, "Day");
|
||||
setDayVoteStreakLastUpdate(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean voteStreakUpdatedToday(LocalDateTime time) {
|
||||
return MiscUtils.getInstance().getTime(getDayVoteStreakLastUpdate()).getDayOfYear() == time.getDayOfYear();
|
||||
}
|
||||
|
||||
public long getDayVoteStreakLastUpdate() {
|
||||
String str = getData().getString("DayVoteStreakLastUpdate");
|
||||
if (str.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
return Long.parseLong(str);
|
||||
}
|
||||
|
||||
public void setDayVoteStreakLastUpdate(long time) {
|
||||
getData().setString("DayVoteStreakLastUpdate", "" + time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the points.
|
||||
*/
|
||||
@@ -142,7 +173,13 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
* the value
|
||||
*/
|
||||
public void addPoints(int value) {
|
||||
setPoints(getPoints() + value);
|
||||
PlayerReceivePointsEvent event = new PlayerReceivePointsEvent(this, value);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
setPoints(getPoints() + event.getPoints());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,8 +243,9 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
if (time == 0) {
|
||||
return true;
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault());
|
||||
LocalDateTime now = TimeChecker.getInstance().getTime();
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault())
|
||||
.plusHours(AdvancedCoreHook.getInstance().getOptions().getTimeHourOffSet());
|
||||
|
||||
if (!voteSite.isVoteDelayDaily()) {
|
||||
int votedelay = ConfigVoteSites.getInstance().getVoteDelay(siteName);
|
||||
@@ -300,6 +338,61 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
return getUserData().getInt("DailyTotal");
|
||||
}
|
||||
|
||||
public void setLastVoteCoolDownCheck(boolean lastDelay, VoteSite voteSite) {
|
||||
HashMap<VoteSite, Boolean> array = getLastCoolDownCheckArray();
|
||||
array.put(voteSite, Boolean.valueOf(lastDelay));
|
||||
setLastCoolDownCheckArray(array);
|
||||
}
|
||||
|
||||
public void setLastCoolDownCheckArray(HashMap<VoteSite, Boolean> lastVotesCheck) {
|
||||
ArrayList<String> data = new ArrayList<String>();
|
||||
for (Entry<VoteSite, Boolean> entry : lastVotesCheck.entrySet()) {
|
||||
String str = entry.getKey().getKey() + "//" + entry.getValue().booleanValue();
|
||||
data.add(str);
|
||||
}
|
||||
getUserData().setStringList("LastVoteCoolDownCheck", data);
|
||||
}
|
||||
|
||||
public HashMap<VoteSite, Boolean> getLastCoolDownCheckArray() {
|
||||
HashMap<VoteSite, Boolean> lastVotesCheck = new HashMap<VoteSite, Boolean>();
|
||||
ArrayList<String> LastVotesCheckList = getUserData().getStringList("LastVoteCoolDownCheck");
|
||||
for (String str : LastVotesCheckList) {
|
||||
String[] data = str.split("//");
|
||||
if (data.length > 1 && plugin.hasVoteSite(data[0])) {
|
||||
VoteSite site = plugin.getVoteSite(data[0]);
|
||||
if (site != null) {
|
||||
Boolean value = Boolean.FALSE;
|
||||
try {
|
||||
value = Boolean.valueOf(data[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
plugin.debug("Not value: " + data[1]);
|
||||
}
|
||||
lastVotesCheck.put(site, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lastVotesCheck;
|
||||
}
|
||||
|
||||
public boolean getLastCoolDownCheck(VoteSite site) {
|
||||
HashMap<VoteSite, Boolean> array = getLastCoolDownCheckArray();
|
||||
if (array.containsKey(site)) {
|
||||
return array.get(site).booleanValue();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void checkCoolDownEvents() {
|
||||
for (VoteSite site : plugin.getVoteSites()) {
|
||||
if (canVoteSite(site) != getLastCoolDownCheck(site)) {
|
||||
plugin.debug(getPlayerName() + " vote cooldown ended: " + site.getKey());
|
||||
PlayerVoteCoolDownEndEvent event = new PlayerVoteCoolDownEndEvent(this, site);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
setLastVoteCoolDownCheck(true, site);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getDayVoteStreak() {
|
||||
return getData().getInt("DayVoteStreak");
|
||||
}
|
||||
@@ -431,6 +524,8 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
return getData().getInt("MonthTotal");
|
||||
case Weekly:
|
||||
return getUserData().getInt("WeeklyTotal");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -454,12 +549,14 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
|
||||
public void giveDailyTopVoterAward(int place, String path) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getDailyAwardRewardsPath(path))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Daily").send(this);
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Daily").setOnline(isOnline())
|
||||
.send(this);
|
||||
}
|
||||
|
||||
public void giveMonthlyTopVoterAward(int place, String path) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getMonthlyAwardRewardsPath(path))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Monthly").send(this);
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Monthly").setOnline(isOnline())
|
||||
.send(this);
|
||||
}
|
||||
|
||||
public void giveOfflineOtherRewards() {
|
||||
@@ -514,7 +611,8 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
|
||||
public void giveWeeklyTopVoterAward(int place, String path) {
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getWeeklyAwardRewardsPath(path))
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Weekly").send(this);
|
||||
.withPlaceHolder("place", "" + place).withPlaceHolder("topvoter", "Weekly").setOnline(isOnline())
|
||||
.send(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -126,6 +126,8 @@ public class VoteSite {
|
||||
}
|
||||
|
||||
MiscUtils.getInstance().broadcast(bc, players);
|
||||
} else {
|
||||
plugin.debug(user.getPlayerName() + " is vanished, not broadcasting");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.block.data.Directional;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
@@ -258,9 +259,9 @@ public class SignHandler {
|
||||
|
||||
public void updateSkulls(Location loc1, Location loc2) {
|
||||
BlockState state = getLocation().getBlock().getState();
|
||||
if (state instanceof Sign) {
|
||||
org.bukkit.material.Sign s = (org.bukkit.material.Sign) state.getData();
|
||||
Block b = location.getBlock().getRelative(s.getAttachedFace());
|
||||
if (state instanceof Sign && state.getBlockData() instanceof Directional) {
|
||||
Directional s = (Directional) state.getBlockData();
|
||||
Block b = location.getBlock().getRelative(s.getFacing());
|
||||
Block above = b.getRelative(BlockFace.UP);
|
||||
if (checkSkull(above)) {
|
||||
return;
|
||||
|
||||
@@ -3,8 +3,12 @@ package com.Ben12345rocks.VotingPlugin.Test;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.Reward;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardOptions;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
public class VoteTester {
|
||||
@@ -42,4 +46,31 @@ public class VoteTester {
|
||||
+ Main.plugin.getVoteSites().size() + " votesites");
|
||||
}
|
||||
|
||||
public void testRewards(int amount, String name, String rewardName) {
|
||||
long time1 = System.currentTimeMillis();
|
||||
ArrayList<Long> timesPerReward = new ArrayList<Long>();
|
||||
User user = UserManager.getInstance().getVotingPluginUser(name);
|
||||
Reward reward = RewardHandler.getInstance().getReward(rewardName);
|
||||
int rewardsGiven = 0;
|
||||
for (int i = 0; i < amount; i++) {
|
||||
long start1 = System.currentTimeMillis();
|
||||
if (reward.canGiveReward(user, new RewardOptions())) {
|
||||
rewardsGiven++;
|
||||
RewardHandler.getInstance().giveReward(user, reward, new RewardOptions().setIgnoreRequirements(true));
|
||||
}
|
||||
long start2 = System.currentTimeMillis();
|
||||
timesPerReward.add(start2 - start1);
|
||||
}
|
||||
long time2 = System.currentTimeMillis();
|
||||
long time = time2 - time1;
|
||||
long timeTotal = 0;
|
||||
for (Long t : timesPerReward) {
|
||||
timeTotal += t.longValue();
|
||||
}
|
||||
long timePerRewardAvg = timeTotal / timesPerReward.size();
|
||||
Main.plugin.getLogger().info("Time to process rewards (" + amount + "): " + time + " ms, average per reward "
|
||||
+ timePerRewardAvg + " ms. " + AdvancedCoreHook.getInstance().getStorageType() + ", "
|
||||
+ UserManager.getInstance().getAllUUIDs().size() + " users. " + rewardsGiven + " rewards given");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -107,13 +107,9 @@ public class TopVoterHandler implements Listener {
|
||||
public void onDayChange(DayChangeEvent event) {
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
if (user.getTotal(TopVoter.Daily) == 0 && user.getDayVoteStreak() != 0) {
|
||||
user.setDayVoteStreak(0);
|
||||
} else {
|
||||
if (!Config.getInstance().isVoteStreakRequirementUsePercentage() || user
|
||||
.hasPercentageTotal(TopVoter.Daily, Config.getInstance().getVoteStreakRequirementDay(), null)) {
|
||||
user.addDayVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Day");
|
||||
if (!user.voteStreakUpdatedToday(LocalDateTime.now().minusDays(1))) {
|
||||
if (user.getDayVoteStreak() != 0) {
|
||||
user.setDayVoteStreak(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Util.PlaceHolders;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
import be.maximvdw.placeholderapi.PlaceholderAPI;
|
||||
import be.maximvdw.placeholderapi.PlaceholderReplaceEvent;
|
||||
import be.maximvdw.placeholderapi.PlaceholderReplacer;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PlaceHolders.
|
||||
*/
|
||||
public class MVdWPlaceholders {
|
||||
|
||||
/** The instance. */
|
||||
static MVdWPlaceholders instance = new MVdWPlaceholders();
|
||||
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
/**
|
||||
* Gets the single instance of PlaceHolders.
|
||||
*
|
||||
* @return single instance of PlaceHolders
|
||||
*/
|
||||
public static MVdWPlaceholders getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new place holders.
|
||||
*/
|
||||
private MVdWPlaceholders() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new place holders.
|
||||
*
|
||||
* @param plugin
|
||||
* the plugin
|
||||
*/
|
||||
public MVdWPlaceholders(Main plugin) {
|
||||
MVdWPlaceholders.plugin = plugin;
|
||||
}
|
||||
|
||||
public void loadMVdWPlaceholders() {
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("MVdWPlaceholderAPI")) {
|
||||
// The plugin is enabled
|
||||
for (final PlaceHolder place : PlaceHolders.getInstance().getPlaceholders()) {
|
||||
String str = place.getIdentifier();
|
||||
if (!str.endsWith("_")) {
|
||||
PlaceholderAPI.registerPlaceholder(Main.plugin, "VotingPlugin_" + str, new PlaceholderReplacer() {
|
||||
|
||||
@Override
|
||||
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
|
||||
return place.placeholderRequest(event.getOfflinePlayer(),
|
||||
UserManager.getInstance().getVotingPluginUser(event.getOfflinePlayer()),
|
||||
event.getPlaceholder().substring("VotingPlugin_".length()));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (final PlaceHolder place : PlaceHolders.getInstance().getNonPlayerPlaceholders()) {
|
||||
String str = place.getIdentifier();
|
||||
if (!str.endsWith("_")) {
|
||||
PlaceholderAPI.registerPlaceholder(Main.plugin, "VotingPlugin_" + str, new PlaceholderReplacer() {
|
||||
|
||||
@Override
|
||||
public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
|
||||
return place.placeholderRequest(event.getOfflinePlayer(), null,
|
||||
event.getPlaceholder().substring("VotingPlugin_".length()));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -480,5 +480,53 @@ public class PlaceHolders {
|
||||
return Integer.toString(VoteParty.getInstance().getVotesRequired());
|
||||
}
|
||||
}.withDescription("Amount of votes needed for voteparty"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("GlobalMonthTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int total = 0;
|
||||
for (int num : Main.plugin.getTopVoter(TopVoter.Monthly).values()) {
|
||||
total += num;
|
||||
}
|
||||
return Integer.toString(total);
|
||||
}
|
||||
}.withDescription("Global month total"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("GlobalAllTimeTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int total = 0;
|
||||
for (int num : Main.plugin.getTopVoter(TopVoter.AllTime).values()) {
|
||||
total += num;
|
||||
}
|
||||
return Integer.toString(total);
|
||||
}
|
||||
}.withDescription("Global alltime total"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("GlobalWeeklyTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int total = 0;
|
||||
for (int num : Main.plugin.getTopVoter(TopVoter.Weekly).values()) {
|
||||
total += num;
|
||||
}
|
||||
return Integer.toString(total);
|
||||
}
|
||||
}.withDescription("Global weekly total"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("GlobalDailyTotal") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int total = 0;
|
||||
for (int num : Main.plugin.getTopVoter(TopVoter.Daily).values()) {
|
||||
total += num;
|
||||
}
|
||||
return Integer.toString(total);
|
||||
}
|
||||
}.withDescription("Global daily total"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.Ben12345rocks.VotingPlugin;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.Injected.RewardInject;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.InjectedRequirement.RequirementInject;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
|
||||
public class VotingPluginHooks {
|
||||
private static VotingPluginHooks instance = new VotingPluginHooks();
|
||||
|
||||
public static VotingPluginHooks getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public Main getMainClass() {
|
||||
return Main.plugin;
|
||||
}
|
||||
|
||||
public void addCustomReward(RewardInject inject) {
|
||||
RewardHandler.getInstance().addInjectedReward(inject);
|
||||
}
|
||||
|
||||
public void addCustomRequirement(RequirementInject inject) {
|
||||
RewardHandler.getInstance().addInjectedRequirements(inject);
|
||||
}
|
||||
|
||||
public UserManager getUserManager() {
|
||||
return UserManager.getInstance();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user