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 | ||
|
|
cb1cc27c60 | ||
|
|
aed30a94c0 | ||
|
|
8e172e2647 | ||
|
|
ca355e1a01 | ||
|
|
b0e18d5224 | ||
|
|
f5fc80ef14 | ||
|
|
21f846f0bc | ||
|
|
a6a742b91e | ||
|
|
4ca6510910 | ||
|
|
e06ea06884 | ||
|
|
2c79dff678 | ||
|
|
56c4a094cf | ||
|
|
1898af9fea | ||
|
|
885d2bc019 | ||
|
|
12c604d09c | ||
|
|
7b48699b39 | ||
|
|
3b5593882f | ||
|
|
8c72154eed | ||
|
|
0dc942ecfd | ||
|
|
bc4d051590 | ||
|
|
011a0322ea | ||
|
|
ed90db12a4 | ||
|
|
3afea03485 | ||
|
|
6da17ee181 | ||
|
|
e5d1c255c0 | ||
|
|
b43754661c | ||
|
|
89c419c8df | ||
|
|
bd6b2b1edb | ||
|
|
b7c73902f2 | ||
|
|
c0995447de | ||
|
|
d970506c76 | ||
|
|
74fb06302a | ||
|
|
1cfed8aa98 | ||
|
|
9f563c37e5 | ||
|
|
d311588984 | ||
|
|
8c5324f602 | ||
|
|
17832a0bf7 | ||
|
|
3c415c63c9 | ||
|
|
6ab27775d2 | ||
|
|
e04bf8210f | ||
|
|
7b4879ddf1 | ||
|
|
081ac7bb3c | ||
|
|
d9894c6b74 | ||
|
|
f13f56c830 | ||
|
|
b6a67f2aeb | ||
|
|
a5b416b210 | ||
|
|
caa4a7a714 | ||
|
|
72aa819361 | ||
|
|
cf52db0c7d | ||
|
|
5021c4bf67 | ||
|
|
9dd8e757d4 | ||
|
|
da7cdb74d4 | ||
|
|
18c6ee6614 | ||
|
|
cafe2b1de7 | ||
|
|
74c94746c1 | ||
|
|
61130a1b2b | ||
|
|
7dafa5c8eb | ||
|
|
c89edc47c3 | ||
|
|
0b89df6262 | ||
|
|
c2218b2c67 | ||
|
|
1950cfdd2d | ||
|
|
71af70a026 | ||
|
|
b269c29f7c |
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.
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
|
||||
@@ -165,9 +165,10 @@ Format:
|
||||
# Lines for each vote site
|
||||
# %time% = time, using timeformat below
|
||||
# %timesince% = time since vote
|
||||
Line: '&3%SiteName%: &6%timeSince% ago'
|
||||
Line: '&3%SiteName%: &6%timeSince%'
|
||||
# Spelling of TimeType can be changed under Format.Commands.TimeFormats
|
||||
TimeFormat: '%amount% %TimeType%'
|
||||
LastVoted: '%times% ago'
|
||||
NeverVoted: 'Never voted'
|
||||
|
||||
# Format for /vote total
|
||||
@@ -223,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
|
||||
@@ -245,7 +249,7 @@ Format:
|
||||
# See https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
|
||||
TimeFormat: 'EEE, d MMM yyyy HH:mm'
|
||||
|
||||
TimeFomrats:
|
||||
TimeFormats:
|
||||
Day: 'Day'
|
||||
Days: 'Days'
|
||||
Hour: 'Hour'
|
||||
@@ -281,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'
|
||||
|
||||
@@ -389,6 +400,8 @@ GUI:
|
||||
Data: 0
|
||||
Amount: 1
|
||||
URLText: '%VoteUrl%'
|
||||
|
||||
VoteRewardBackButton: false
|
||||
# Customize /vote reward
|
||||
# Show players what you get when you vote on each site
|
||||
VoteReward:
|
||||
@@ -439,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
|
||||
@@ -559,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:
|
||||
@@ -648,7 +666,7 @@ MileStones:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: '&aYou got %milestone% milestone votes!'
|
||||
|
||||
|
||||
VoteStreak:
|
||||
# Valid options: Day, Week, Month
|
||||
Day:
|
||||
@@ -682,6 +700,17 @@ VoteStreak:
|
||||
Rewards:
|
||||
Messages:
|
||||
Player: "&aYou voted for %Streak% %Type%'s in a row!"
|
||||
Requirement:
|
||||
# Require certain percentage of votes
|
||||
UsePercentage: false
|
||||
# Percentage requirements of votes
|
||||
# 50 = %50
|
||||
Day: 50
|
||||
Week: 50
|
||||
Month: 50
|
||||
|
||||
# Reward given when vote cooldown ended
|
||||
VoteCoolDownEndedReward: []
|
||||
|
||||
|
||||
# ONLY USE THIS FOR TITLES/SOUNDS AND OTHER EFFECTS
|
||||
@@ -782,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
|
||||
|
||||
@@ -808,12 +844,12 @@ 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
|
||||
|
||||
# Only update the background when needed when set to false
|
||||
# Only update in the background when needed when set to false
|
||||
AlwaysUpdate: false
|
||||
|
||||
# Update in the background only if players are online
|
||||
@@ -861,10 +897,31 @@ AutoCreateVoteSites: true
|
||||
# You can also use /av download
|
||||
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
|
||||
|
||||
# Disable checking permissions on tab complete
|
||||
DisableAdvancedTab: false
|
||||
|
||||
# Load command aliases, such as /avgui
|
||||
# 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
|
||||
@@ -898,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
|
||||
@@ -28,7 +29,12 @@ VoteSites:
|
||||
# Most sites are 24 hours
|
||||
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)
|
||||
@@ -45,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:
|
||||
@@ -27,9 +28,6 @@ commands:
|
||||
votetop:
|
||||
description: See top voters
|
||||
aliases: vtop
|
||||
voteinfo:
|
||||
description: See player info
|
||||
aliases: vinfo
|
||||
votetoday:
|
||||
description: See who voted today
|
||||
aliases: vtoday
|
||||
@@ -63,19 +61,18 @@ commands:
|
||||
votepoints:
|
||||
description: A command
|
||||
aliases: vpoints
|
||||
votegivereward:
|
||||
description: A command
|
||||
votechoices:
|
||||
description: A command
|
||||
alaises: vchoices
|
||||
votegivepoints:
|
||||
description: A command
|
||||
alaises: vgivepoints
|
||||
adminvotehelp:
|
||||
description: Open adminvote help
|
||||
aliases: avhelp
|
||||
adminvote?:
|
||||
description: Open adminvote help
|
||||
aliases: av?
|
||||
adminvoteconvert:
|
||||
description: A command
|
||||
adminvotereport:
|
||||
description: Command Alias
|
||||
aliases: avreport
|
||||
@@ -97,24 +94,15 @@ commands:
|
||||
adminvoterewards:
|
||||
description: Command Alias
|
||||
aliases: avrewards
|
||||
adminvotereward:
|
||||
description: Command Alias
|
||||
aliases: avreward
|
||||
adminvoteuuid:
|
||||
description: Command Alias
|
||||
aliases: avuuid
|
||||
adminvotereset:
|
||||
description: Command Alias
|
||||
aliases: avreset
|
||||
adminvotevotesite:
|
||||
description: Command Alias
|
||||
aliases: avvotesite
|
||||
adminvoteconfig:
|
||||
description: Command Alias
|
||||
aliases: avconfig
|
||||
adminvoteserverdata:
|
||||
description: Command Alias
|
||||
aliases: avserverdata
|
||||
adminvotesettotal:
|
||||
description: Command Alias
|
||||
aliases: avsettotal
|
||||
@@ -124,36 +112,20 @@ commands:
|
||||
adminvotevote:
|
||||
description: Command Alias
|
||||
aliases: [avvote, fakevote]
|
||||
adminvoteTriggerPlayerVoteEvent:
|
||||
description: Command Alias
|
||||
aliases: avTriggerPlayerVoteEvent
|
||||
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
|
||||
adminvoteusers:
|
||||
description: Command Alias
|
||||
aliases: avusers
|
||||
adminvoteClearTotal:
|
||||
description: Command Alias
|
||||
aliases: avClearTotal
|
||||
adminvoteConvertFromData:
|
||||
description: Command Alias
|
||||
aliases: avConvertFromData
|
||||
adminvoteClearTotal:
|
||||
description: Command Alias
|
||||
aliases: avClearTotal
|
||||
adminvoteBackgroundUpdate:
|
||||
description: Command Alias
|
||||
aliases: avBackgroundUpdate
|
||||
@@ -163,9 +135,6 @@ commands:
|
||||
adminvoteConvertFrom:
|
||||
description: Command Alias
|
||||
aliases: avConvertFrom
|
||||
adminvoteRemovePoints:
|
||||
description: Command Alias
|
||||
aliases: avRemovePoints
|
||||
adminvoteServiceSites:
|
||||
description: Command Alias
|
||||
aliases: avServiceSites
|
||||
@@ -214,6 +183,18 @@ commands:
|
||||
adminvoteDownloadJenkins:
|
||||
description: Command Alias
|
||||
aliases: avDownloadJenkins
|
||||
adminvoteForceVoteParty:
|
||||
description: Command Alias
|
||||
aliases: avForceVoteParty
|
||||
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
|
||||
@@ -233,4 +214,6 @@ permissions:
|
||||
VotingPlugin.NoRemind:
|
||||
description: Ignore vote reminding
|
||||
default: false
|
||||
VotingPlugin.Sign.Create:
|
||||
description: Permission to create sign
|
||||
|
||||
+20
-2
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.Ben12345rocks</groupId>
|
||||
<artifactId>VotingPlugin</artifactId>
|
||||
<version>5.16.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>
|
||||
@@ -271,5 +275,19 @@
|
||||
<version>1.18.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.mimimum.minecraft</groupId>
|
||||
<artifactId>SuperbVote</artifactId>
|
||||
<version>0.5.3</version>
|
||||
<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>
|
||||
@@ -42,6 +42,7 @@ import com.Ben12345rocks.VotingPlugin.Data.ServerData;
|
||||
import com.Ben12345rocks.VotingPlugin.Events.PlayerVoteEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
import com.Ben12345rocks.VotingPlugin.SpecialRewards.SpecialRewards;
|
||||
import com.Ben12345rocks.VotingPlugin.Test.VoteTester;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoterHandler;
|
||||
@@ -58,6 +59,9 @@ import com.swifteh.GAL.GAL;
|
||||
import com.swifteh.GAL.GALVote;
|
||||
import com.swifteh.GAL.VoteType;
|
||||
|
||||
import io.minimum.minecraft.superbvote.SuperbVote;
|
||||
import io.minimum.minecraft.superbvote.util.PlayerVotes;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CommandLoader.
|
||||
@@ -76,6 +80,8 @@ public class CommandLoader {
|
||||
/** The plugin. */
|
||||
static Main plugin = Main.plugin;
|
||||
|
||||
private Object pointLock = new Object();
|
||||
|
||||
/**
|
||||
* Gets the single instance of CommandLoader.
|
||||
*
|
||||
@@ -140,6 +146,71 @@ public class CommandLoader {
|
||||
return playerPerm;
|
||||
}
|
||||
|
||||
public boolean hasPermission(Player player, String cmd) {
|
||||
if (cmd.startsWith("votingplugin:")) {
|
||||
cmd = cmd.substring("votingplugin:".length());
|
||||
}
|
||||
|
||||
if (commands.containsKey(cmd)) {
|
||||
return commands.get(cmd).hasPerm(player);
|
||||
}
|
||||
|
||||
boolean adminCommand = false;
|
||||
|
||||
if (cmd.startsWith("vote")) {
|
||||
cmd = cmd.substring("vote".length());
|
||||
} else if (cmd.startsWith("v")) {
|
||||
cmd = cmd.substring(1);
|
||||
} else if (cmd.startsWith("av")) {
|
||||
adminCommand = true;
|
||||
cmd = cmd.substring("av".length());
|
||||
} else if (cmd.startsWith("adminvote")) {
|
||||
adminCommand = true;
|
||||
cmd = cmd.substring("adminvote".length());
|
||||
}
|
||||
// plugin.debug(cmd);
|
||||
if (!adminCommand) {
|
||||
for (CommandHandler handle : plugin.getVoteCommand()) {
|
||||
if (handle.isCommand(cmd)) {
|
||||
// plugin.debug("is handle " + ArrayUtils.getInstance()
|
||||
// .makeStringList(ArrayUtils.getInstance().convert(handle.getArgs())));
|
||||
if (handle.hasPerm(player)) {
|
||||
// plugin.debug("has perm");
|
||||
return true;
|
||||
} else {
|
||||
// plugin.debug("no perm " + cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (CommandHandler handle : plugin.getAdminVoteCommand()) {
|
||||
if (handle.isCommand(cmd)) {
|
||||
// plugin.debug("is handle " + ArrayUtils.getInstance()
|
||||
// .makeStringList(ArrayUtils.getInstance().convert(handle.getArgs())));
|
||||
if (handle.hasPerm(player)) {
|
||||
// plugin.debug("has perm");
|
||||
return true;
|
||||
} else {
|
||||
// plugin.debug("no perm " + cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isVotingPluginCommand(Player player, String cmd) {
|
||||
if (plugin.getCommand(cmd) != null || cmd.startsWith("votingplugin")) {
|
||||
return true;
|
||||
}
|
||||
for (String str : commands.keySet()) {
|
||||
if (str.equalsIgnoreCase(cmd)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load admin vote command.
|
||||
*/
|
||||
@@ -195,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) {
|
||||
@@ -215,17 +285,43 @@ 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[] { "ConvertFrom", "SuperbVote" },
|
||||
"VotingPlugin.Commands.AdminVote.ConvertFrom.SuperbVote|" + adminPerm, "Convert from SuperbVote") {
|
||||
|
||||
@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]));
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin("SuperbVote") != null) {
|
||||
sender.sendMessage("Starting to convert");
|
||||
|
||||
for (OfflinePlayer p : Bukkit.getOfflinePlayers()) {
|
||||
PlayerVotes votes = SuperbVote.getPlugin().getVoteStorage().getVotes(p.getUniqueId());
|
||||
if (votes != null) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(p);
|
||||
if (votes.getVotes() > 0) {
|
||||
user.setTotal(TopVoter.AllTime, votes.getVotes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
sender.sendMessage("SuperbVote not loaded");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
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[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") {
|
||||
|
||||
@@ -241,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") {
|
||||
@@ -289,19 +389,22 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
sendMessage(sender, "&cEvery service site the server has gotten from votifier:");
|
||||
|
||||
for (String serviceSites : ServerData.getInstance().getServiceSites()) {
|
||||
boolean hasSite = plugin.hasVoteSite(serviceSites);
|
||||
if (hasSite) {
|
||||
String siteName = plugin.getVoteSiteName(serviceSites);
|
||||
sendMessage(sender, serviceSites + " : Current site = " + siteName);
|
||||
} else {
|
||||
sendMessage(sender, serviceSites
|
||||
+ " : No site with this service site, did you do something wrong?");
|
||||
ArrayList<String> serviceSites = ServerData.getInstance().getServiceSites();
|
||||
if (!serviceSites.isEmpty()) {
|
||||
sendMessage(sender, "&cEvery service site the server has gotten from votifier:");
|
||||
for (String serviceSite : serviceSites) {
|
||||
boolean hasSite = plugin.hasVoteSite(serviceSite);
|
||||
if (hasSite) {
|
||||
String siteName = plugin.getVoteSiteName(serviceSite);
|
||||
sendMessage(sender, serviceSite + " : Current site = " + siteName);
|
||||
} else {
|
||||
sendMessage(sender, serviceSite
|
||||
+ " : No site with this service site, did you do something wrong?");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sendMessage(sender, "&cNo votes have been received. Please check your votifier settings.");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -515,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
|
||||
@@ -577,6 +659,46 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.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[3]));
|
||||
SpecialRewards.getInstance().checkMilestone(user);
|
||||
sender.sendMessage(StringUtils.getInstance().colorize("&cAdded milestonecount for " + args[1]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.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[3]));
|
||||
SpecialRewards.getInstance().checkMilestone(user);
|
||||
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]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "Vote", "(player)", "(Sitename)" },
|
||||
"VotingPlugin.Commands.AdminVote.Vote|" + adminPerm, "Trigger manual vote") {
|
||||
|
||||
@@ -595,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") {
|
||||
|
||||
@@ -809,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" },
|
||||
@@ -824,13 +992,94 @@ public class CommandLoader {
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "#";
|
||||
}
|
||||
msg.add("%VotingPlugin_" + identifier + "%");
|
||||
if (placeholder.hasDescription()) {
|
||||
msg.add("%VotingPlugin_" + identifier + "% - " + placeholder.getDescription());
|
||||
} else {
|
||||
msg.add("%VotingPlugin_" + identifier + "%");
|
||||
}
|
||||
}
|
||||
|
||||
for (PlaceHolder placeholder : PlaceHolders.getInstance().getNonPlayerPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "#";
|
||||
}
|
||||
if (placeholder.hasDescription()) {
|
||||
msg.add("%VotingPlugin_" + identifier + "% - " + placeholder.getDescription());
|
||||
} else {
|
||||
msg.add("%VotingPlugin_" + identifier + "%");
|
||||
}
|
||||
}
|
||||
|
||||
sendMessage(sender, msg);
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "ForceVoteParty" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceVoteParty|" + adminPerm,
|
||||
"Force a voteparty reward, resets vote count") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VoteParty.getInstance().giveRewards();
|
||||
}
|
||||
});
|
||||
|
||||
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[1]);
|
||||
SpecialRewards.getInstance().giveMilestoneVoteReward(user, user.isOnline(), parseInt(args[3]));
|
||||
}
|
||||
});
|
||||
|
||||
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[1]);
|
||||
SpecialRewards.getInstance().giveCumulativeVoteReward(user, user.isOnline(), parseInt(args[3]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "User", "(player)", "ForceAllSites" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceAllSites|" + adminPerm, "Force a allsites reward") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
SpecialRewards.getInstance().giveAllSitesRewards(user, user.isOnline());
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand().add(new CommandHandler(new String[] { "User", "(player)", "ForceFirstVote" },
|
||||
"VotingPlugin.Commands.AdminVote.ForceFirstVote|" + adminPerm, "Force a firstvote reward") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
SpecialRewards.getInstance().giveFirstVoteRewards(user, user.isOnline());
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.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[1]);
|
||||
SpecialRewards.getInstance().giveVoteStreakReward(user, user.isOnline(), args[3], args[4],
|
||||
parseInt(args[4]));
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getAdminVoteCommand()
|
||||
.add(new CommandHandler(new String[] { "Placeholders", "(player)" },
|
||||
"VotingPlugin.Commands.AdminVote.Placeholders.Players|" + adminPerm,
|
||||
@@ -850,10 +1099,28 @@ public class CommandLoader {
|
||||
+ placeholder.placeholderRequest(user.getOfflinePlayer(), user, identifier));
|
||||
}
|
||||
|
||||
for (PlaceHolder placeholder : PlaceHolders.getInstance().getNonPlayerPlaceholders()) {
|
||||
String identifier = placeholder.getIdentifier();
|
||||
if (identifier.endsWith("_")) {
|
||||
identifier += "1";
|
||||
}
|
||||
msg.add("%VotingPlugin_" + identifier + "% = "
|
||||
+ placeholder.placeholderRequest(user.getOfflinePlayer(), user, identifier));
|
||||
}
|
||||
|
||||
sendMessage(sender, msg);
|
||||
}
|
||||
});
|
||||
|
||||
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");
|
||||
}
|
||||
});
|
||||
|
||||
ArrayList<CommandHandler> avCommands = com.Ben12345rocks.AdvancedCore.Commands.CommandLoader.getInstance()
|
||||
.getBasicAdminCommands("VotingPlugin");
|
||||
for (CommandHandler cmd : avCommands) {
|
||||
@@ -868,15 +1135,22 @@ public class CommandLoader {
|
||||
*/
|
||||
public void loadAliases() {
|
||||
commands = new HashMap<String, CommandHandler>();
|
||||
if (!Config.getInstance().isLoadCommandAliases()) {
|
||||
return;
|
||||
}
|
||||
for (CommandHandler cmdHandle : plugin.getVoteCommand()) {
|
||||
if (cmdHandle.getArgs().length > 0) {
|
||||
String[] args = cmdHandle.getArgs()[0].split("&");
|
||||
for (String arg : args) {
|
||||
commands.put("vote" + arg, cmdHandle);
|
||||
try {
|
||||
plugin.getCommand("vote" + arg).setExecutor(new CommandAliases(cmdHandle, false));
|
||||
|
||||
plugin.getCommand("vote" + arg)
|
||||
.setTabCompleter(new AliasesTabCompleter().setCMDHandle(cmdHandle, false));
|
||||
for (String str : plugin.getCommand("vote" + arg).getAliases()) {
|
||||
commands.put(str, cmdHandle);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
plugin.debug("Failed to load command and tab completer for /vote" + arg);
|
||||
}
|
||||
@@ -889,11 +1163,15 @@ public class CommandLoader {
|
||||
if (cmdHandle.getArgs().length > 0) {
|
||||
String[] args = cmdHandle.getArgs()[0].split("&");
|
||||
for (String arg : args) {
|
||||
commands.put("adminvote" + arg, cmdHandle);
|
||||
try {
|
||||
plugin.getCommand("adminvote" + arg).setExecutor(new CommandAliases(cmdHandle, true));
|
||||
|
||||
plugin.getCommand("adminvote" + arg)
|
||||
.setTabCompleter(new AliasesTabCompleter().setCMDHandle(cmdHandle, true));
|
||||
for (String str : plugin.getCommand("adminvote" + arg).getAliases()) {
|
||||
commands.put(str, cmdHandle);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
plugin.debug("Failed to load command and tab completer for /adminvote" + arg + ": "
|
||||
+ ex.getMessage());
|
||||
@@ -1070,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) {
|
||||
@@ -1236,21 +1516,15 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "Points", },
|
||||
"VotingPlugin.Commands.Vote.Points|" + playerPerm, "View your points") {
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] { "Points" },
|
||||
"VotingPlugin.Commands.Vote.Points|" + playerPerm, "View your points", false) {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
String msg = Config.getInstance().getFormatCommandVotePoints()
|
||||
.replace("%Player%", user.getPlayerName()).replace("%Points%", "" + user.getPoints());
|
||||
user.sendMessage(msg);
|
||||
} else {
|
||||
sender.sendMessage("Must be a player to use this!");
|
||||
}
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
String msg = Config.getInstance().getFormatCommandVotePoints().replace("%Player%", user.getPlayerName())
|
||||
.replace("%Points%", "" + user.getPoints());
|
||||
user.sendMessage(msg);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1726,23 +2000,49 @@ public class CommandLoader {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getVoteCommand().add(new CommandHandler(new String[] {}, "", "See voting URLs") {
|
||||
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().isCommandsUseGUIVote() || !(sender instanceof Player)) {
|
||||
if (isPlayer(sender)) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
user.sendMessage(Commands.getInstance().voteURLs(user));
|
||||
} else {
|
||||
sender.sendMessage(Commands.getInstance().voteURLs(null));
|
||||
@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");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
PlayerGUIs.getInstance().openVoteURL((Player) sender);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
plugin.getVoteCommand().add(
|
||||
new CommandHandler(new String[] {}, "VotingPlugin.Commands.Vote|" + playerPerm, "See voting URLs") {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (!Config.getInstance().isCommandsUseGUIVote() || !(sender instanceof Player)) {
|
||||
if (isPlayer(sender)) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser((Player) sender);
|
||||
user.sendMessage(Commands.getInstance().voteURLs(user));
|
||||
} else {
|
||||
sender.sendMessage(Commands.getInstance().voteURLs(null));
|
||||
}
|
||||
} else {
|
||||
PlayerGUIs.getInstance().openVoteURL((Player) sender);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ArrayList<CommandHandler> avCommands = com.Ben12345rocks.AdvancedCore.Commands.CommandLoader.getInstance()
|
||||
.getBasicCommands("VotingPlugin");
|
||||
|
||||
@@ -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;
|
||||
@@ -669,6 +670,9 @@ public class Commands {
|
||||
Config.getInstance().getFormatTimeFormatsSeconds()), "amount", "" + diffSeconds);
|
||||
}
|
||||
|
||||
info = StringUtils.getInstance()
|
||||
.replacePlaceHolder(Config.getInstance().getFormatCommandsVoteLastLastVoted(), "times", info);
|
||||
|
||||
return info;
|
||||
}
|
||||
return Config.getInstance().getFormatCommandsVoteLastNeverVoted();
|
||||
@@ -729,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();
|
||||
@@ -759,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));
|
||||
@@ -885,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);
|
||||
|
||||
@@ -10,11 +10,12 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.EditGUI;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.EditGUIButton;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.EditGUIValueType;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.ValueTypes.EditGUIValueBoolean;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.ValueTypes.EditGUIValueNumber;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.ValueTypes.EditGUIValueString;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventory;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventory.ClickEvent;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Inventory.BInventoryButton;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Item.ItemBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.ArrayUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.PlayerUtils;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.ValueRequest.InputMethod;
|
||||
@@ -163,99 +164,91 @@ public class AdminGUI {
|
||||
}
|
||||
});
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "Priority", voteSite.getPriority(),
|
||||
EditGUIValueType.NUMBER) {
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueNumber("Priority", voteSite.getPriority()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
ConfigVoteSites.getInstance().setPriority(voteSite.getKey(), (int) value);
|
||||
public void setValue(Player player, Number num) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
ConfigVoteSites.getInstance().setPriority(voteSite.getKey(), num.intValue());
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "ServiceSite", voteSite.getServiceSite(),
|
||||
EditGUIValueType.STRING) {
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueString("ServiceSite", voteSite.getServiceSite()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
public void setValue(Player player, String value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setServiceSite(siteName, (String) value);
|
||||
ConfigVoteSites.getInstance().setServiceSite(siteName, value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "Name", voteSite.getDisplayName(),
|
||||
EditGUIValueType.STRING) {
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueString("Name", voteSite.getDisplayName()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
ConfigVoteSites.getInstance().setDisplayName(voteSite.getKey(), (String) value);
|
||||
public void setValue(Player player, String value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
ConfigVoteSites.getInstance().setDisplayName(voteSite.getKey(), value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "VoteURL", voteSite.getVoteURL(),
|
||||
EditGUIValueType.STRING) {
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueString("VoteURL", voteSite.getVoteURL()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
public void setValue(Player player, String value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setVoteURL(siteName, (String) value);
|
||||
ConfigVoteSites.getInstance().setVoteURL(siteName, value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "VoteDelay", voteSite.getVoteDelay(),
|
||||
EditGUIValueType.NUMBER) {
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueNumber("VoteDelay", voteSite.getVoteDelay()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
public void setValue(Player player, Number num) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setVoteDelay(siteName, (int) value);
|
||||
ConfigVoteSites.getInstance().setVoteDelay(siteName, num.intValue());
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "Enabled", voteSite.isEnabled(),
|
||||
EditGUIValueType.BOOLEAN) {
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("Enabled", voteSite.isEnabled()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
public void setValue(Player player, boolean value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setEnabled(siteName, (boolean) value);
|
||||
ConfigVoteSites.getInstance().setEnabled(siteName, value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "ForceOffline", voteSite.isGiveOffline(),
|
||||
EditGUIValueType.BOOLEAN) {
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("ForceOffline", voteSite.isGiveOffline()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
public void setValue(Player player, boolean value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setForceOffline(siteName, (boolean) value);
|
||||
ConfigVoteSites.getInstance().setForceOffline(siteName, value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(new ItemBuilder(Material.DIAMOND), "VoteDelayDaily",
|
||||
voteSite.isVoteDelayDaily(), EditGUIValueType.BOOLEAN) {
|
||||
inv.addButton(new EditGUIButton(new EditGUIValueBoolean("VoteDelayDaily", voteSite.isVoteDelayDaily()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, Object value) {
|
||||
VoteSite voteSite = (VoteSite) getMeta(player, "VoteSite");
|
||||
public void setValue(Player player, boolean value) {
|
||||
VoteSite voteSite = (VoteSite) getInv().getMeta(player, "VoteSite");
|
||||
String siteName = voteSite.getKey();
|
||||
ConfigVoteSites.getInstance().setVoteDelayDaily(siteName, (boolean) value);
|
||||
ConfigVoteSites.getInstance().setVoteDelayDaily(siteName, value);
|
||||
plugin.reload();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -584,8 +602,6 @@ public class PlayerGUIs {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(event.getPlayer());
|
||||
Player player = event.getWhoClicked();
|
||||
player.closeInventory();
|
||||
user.sendMessage(Commands.getInstance().voteURLs(user));
|
||||
|
||||
}
|
||||
@@ -609,10 +625,8 @@ public class PlayerGUIs {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Player player = event.getWhoClicked();
|
||||
Player player = event.getPlayer();
|
||||
if (player != null) {
|
||||
player.closeInventory();
|
||||
|
||||
if (Config.getInstance().isCommandsVoteRewardFromVoteURL()
|
||||
&& event.getClick().equals(ClickType.RIGHT)) {
|
||||
voteReward(player, voteSite.getKey());
|
||||
@@ -741,6 +755,16 @@ public class PlayerGUIs {
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.getInstance().isVoteRewardBackButton()) {
|
||||
inv.addButton(new BInventoryButton(getBackButton()) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openVoteGUI(event.getPlayer(), getSelectedPlayer(event.getPlayer()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
inv.openInventory(player);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.AnnotationHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataBoolean;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataDouble;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataInt;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Annotation.ConfigDataString;
|
||||
import com.Ben12345rocks.AdvancedCore.YML.YMLFile;
|
||||
@@ -67,6 +68,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private String formatCommandsVoteLastNeverVoted;
|
||||
|
||||
@ConfigDataString(path = "Format.Commands.Vote.Last.LastVoted", defaultValue = "%times% ago")
|
||||
@Getter
|
||||
private String formatCommandsVoteLastLastVoted;
|
||||
|
||||
@ConfigDataString(path = "Format.TimeFormats.Days", defaultValue = "Days")
|
||||
@Getter
|
||||
private String formatTimeFormatsDays;
|
||||
@@ -181,6 +186,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean countFakeVotes = true;
|
||||
|
||||
@ConfigDataBoolean(path = "GUI.VoteRewardBackButton")
|
||||
@Getter
|
||||
private boolean voteRewardBackButton = false;
|
||||
|
||||
@ConfigDataInt(path = "ConvertDelay", defaultValue = 30000)
|
||||
@Getter
|
||||
private int convertDelay;
|
||||
@@ -189,6 +198,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean enableDailyRewards = false;
|
||||
|
||||
@ConfigDataBoolean(path = "DisableUpdateChecking")
|
||||
@Getter
|
||||
private boolean disableUpdateChecking = false;
|
||||
|
||||
@ConfigDataInt(path = "DelayBetweenUpdates")
|
||||
@Getter
|
||||
private int delayBetweenUpdates = 3;
|
||||
@@ -197,6 +210,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean disableNoServiceSiteMessage = false;
|
||||
|
||||
@ConfigDataBoolean(path = "DisableAdvancedTab")
|
||||
@Getter
|
||||
private boolean disableAdvancedTab = false;
|
||||
|
||||
@Getter
|
||||
private String firstVoteRewardsPath = "FirstVote";
|
||||
|
||||
@@ -215,6 +232,45 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean enableWeeklyAwards = false;
|
||||
|
||||
@ConfigDataDouble(path = "VoteStreak.Requirement.Day")
|
||||
@Getter
|
||||
private double voteStreakRequirementDay = 50;
|
||||
|
||||
@ConfigDataDouble(path = "VoteStreak.Requirement.Week")
|
||||
@Getter
|
||||
private double voteStreakRequirementWeek = 50;
|
||||
|
||||
@ConfigDataDouble(path = "VoteStreak.Requirement.Month")
|
||||
@Getter
|
||||
private double voteStreakRequirementMonth = 50;
|
||||
|
||||
@ConfigDataBoolean(path = "VoteStreak.Requirement.UsePercentage")
|
||||
@Getter
|
||||
private boolean voteStreakRequirementUsePercentage = false;
|
||||
|
||||
@ConfigDataBoolean(path = "LoadCommandAliases")
|
||||
@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.
|
||||
*/
|
||||
@@ -562,9 +618,6 @@ public class Config extends YMLFile {
|
||||
public String getFormatNotNumber() {
|
||||
return getData().getString("Format.NotNumber", "&cError on &6%arg%&c, number expected!");
|
||||
}
|
||||
|
||||
@Getter
|
||||
private int formatPageSize = 10;
|
||||
|
||||
public String getFormatPrevPage() {
|
||||
return getData().getString("Format.PrevPage", "&aPrevious Page");
|
||||
@@ -1029,10 +1082,6 @@ public class Config extends YMLFile {
|
||||
return getData().getBoolean("TopVoterIgnorePermission");
|
||||
}
|
||||
|
||||
public int getUserVotesRequired() {
|
||||
return getData().getInt("VoteParty.UserVotesRequired");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote GUI slot command.
|
||||
*
|
||||
@@ -1128,6 +1177,10 @@ public class Config extends YMLFile {
|
||||
return getData().getBoolean("VoteParty.ResetMonthly");
|
||||
}
|
||||
|
||||
public int getVotePartyUserVotesRequired() {
|
||||
return getData().getInt("VoteParty.UserVotesRequired");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vote party votes required.
|
||||
*
|
||||
|
||||
@@ -252,6 +252,10 @@ public class ConfigVoteSites extends YMLFile {
|
||||
return getData(siteName).getString("VoteURL");
|
||||
}
|
||||
|
||||
public boolean getWaitUntilVoteDelay(String siteName) {
|
||||
return getData(siteName).getBoolean("WaitUntilVoteDelay", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is service site good.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -39,9 +39,9 @@ public class PlayerSpecialRewardEvent extends Event {
|
||||
private boolean cancelled;
|
||||
|
||||
public PlayerSpecialRewardEvent(User user, SpecialRewardType type) {
|
||||
super();
|
||||
setType(type);
|
||||
setUser(user);
|
||||
super(true);
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -6,10 +6,9 @@ public enum SpecialRewardType {
|
||||
ALLSITE, CUMMULATIVE, MILESTONE, VOTESTREAK, FIRSTVOTE;
|
||||
|
||||
@Getter
|
||||
|
||||
private int amount = -1;
|
||||
@Getter
|
||||
|
||||
@Getter
|
||||
private String type = "";
|
||||
|
||||
public SpecialRewardType setAmount(int num) {
|
||||
|
||||
@@ -29,7 +29,7 @@ public class VotePartyEvent extends Event {
|
||||
private boolean cancelled;
|
||||
|
||||
public VotePartyEvent() {
|
||||
super();
|
||||
super(true);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.Ben12345rocks.VotingPlugin.Listeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandSendEvent;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.CommandLoader;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class PlayerJoinEvent.
|
||||
*/
|
||||
public class PlayerCommandSendListener implements Listener {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static Main plugin;
|
||||
|
||||
public PlayerCommandSendListener(Main plugin) {
|
||||
PlayerCommandSendListener.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onTab(PlayerCommandSendEvent event) {
|
||||
if (Config.getInstance().isDisableAdvancedTab()) {
|
||||
return;
|
||||
}
|
||||
ArrayList<String> removeCmds = new ArrayList<String>();
|
||||
ArrayList<String> whiteListed = new ArrayList<String>();
|
||||
for (String cmd : event.getCommands()) {
|
||||
if (CommandLoader.getInstance().isVotingPluginCommand(event.getPlayer(), cmd)) {
|
||||
if (!CommandLoader.getInstance().hasPermission(event.getPlayer(), cmd) && !whiteListed.contains(cmd)) {
|
||||
removeCmds.add(cmd);
|
||||
// plugin.debug("removed " + cmd);
|
||||
} else {
|
||||
removeCmds.remove(cmd);
|
||||
whiteListed.add(cmd);
|
||||
// plugin.debug("has " + cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
event.getCommands().removeAll(removeCmds);
|
||||
}
|
||||
}
|
||||
@@ -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,36 +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() {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
|
||||
if (event.getPlayer() == null
|
||||
|| (AdvancedCoreHook.getInstance().getStorageType().equals(UserStorage.MYSQL)
|
||||
&& AdvancedCoreHook.getInstance().getMysql() == null)) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
// run remind
|
||||
user.loginMessage();
|
||||
|
||||
if (player != null) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -83,11 +83,17 @@ public class PlayerVoteListener implements Listener {
|
||||
}
|
||||
|
||||
User user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
user.updateName();
|
||||
|
||||
if (Config.getInstance().isClearCacheOnVote()) {
|
||||
user.clearCache();
|
||||
}
|
||||
|
||||
if (voteSite.isWaitUntilVoteDelay() && !user.canVoteSite(voteSite)) {
|
||||
plugin.getLogger().info(user.getPlayerName() + " must wait until votedelay is over, ignoring vote");
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (object) {
|
||||
|
||||
// vote party
|
||||
@@ -102,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);
|
||||
@@ -132,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() {
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@@ -27,9 +28,14 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import com.Ben12345rocks.AdvancedCore.AdvancedCoreHook;
|
||||
import com.Ben12345rocks.AdvancedCore.CommandAPI.CommandHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.NMSManager.NMSManager;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.Reward;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.RewardHandler;
|
||||
import com.Ben12345rocks.AdvancedCore.Rewards.Injected.RewardInjectInt;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UUID;
|
||||
import com.Ben12345rocks.AdvancedCore.UserManager.UserStorage;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.EditGUIButton;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.EditGUI.ValueTypes.EditGUIValueNumber;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Item.ItemBuilder;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Javascript.JavascriptPlaceholderRequest;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Logger.Logger;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Metrics.BStatsMetrics;
|
||||
@@ -45,8 +51,10 @@ 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;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.PlayerInteract;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.PlayerJoinEvent;
|
||||
import com.Ben12345rocks.VotingPlugin.Listeners.PlayerVoteListener;
|
||||
@@ -61,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;
|
||||
@@ -117,10 +126,14 @@ public class Main extends JavaPlugin {
|
||||
@Getter
|
||||
private boolean updateStarted = false;
|
||||
|
||||
public AdvancedCoreHook getAdvancedCoreHook() {
|
||||
return AdvancedCoreHook.getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check votifier.
|
||||
*/
|
||||
public void checkVotifier() {
|
||||
private void checkVotifier() {
|
||||
try {
|
||||
Class.forName("com.vexsoftware.votifier.model.VotifierEvent");
|
||||
} catch (ClassNotFoundException e) {
|
||||
@@ -263,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 "";
|
||||
|
||||
}
|
||||
|
||||
@@ -332,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);
|
||||
|
||||
@@ -693,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");
|
||||
@@ -701,11 +745,8 @@ public class Main extends JavaPlugin {
|
||||
registerCommands();
|
||||
registerEvents();
|
||||
checkVotifier();
|
||||
|
||||
CheckUpdate.getInstance().startUp();
|
||||
|
||||
VoteReminding.getInstance().loadRemindChecking();
|
||||
|
||||
plugin.signs = new ArrayList<SignHandler>();
|
||||
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
@@ -721,11 +762,11 @@ public class Main extends JavaPlugin {
|
||||
topVoter.put(top, new LinkedHashMap<User, Integer>());
|
||||
}
|
||||
voteToday = new LinkedHashMap<User, HashMap<VoteSite, LocalDateTime>>();
|
||||
|
||||
voteLog = new Logger(plugin, new File(plugin.getDataFolder() + File.separator + "Log", "votelog.txt"));
|
||||
|
||||
AdminGUI.getInstance().loadHook();
|
||||
|
||||
// vote party
|
||||
if (Config.getInstance().getVotePartyEnabled()) {
|
||||
VoteParty.getInstance().check();
|
||||
}
|
||||
@@ -735,6 +776,7 @@ public class Main extends JavaPlugin {
|
||||
|
||||
metrics();
|
||||
|
||||
// javascript api
|
||||
AdvancedCoreHook.getInstance().getJavascriptEngineRequests().add(new JavascriptPlaceholderRequest("User") {
|
||||
|
||||
@Override
|
||||
@@ -742,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)");
|
||||
@@ -754,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'");
|
||||
@@ -772,19 +821,36 @@ public class Main extends JavaPlugin {
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("MonthTotal", "INT DEFAULT '0'");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("HighestWeeklyTotal", "INT DEFAULT '0'");
|
||||
AdvancedCoreHook.getInstance().getMysql().alterColumnType("LastMonthTotal", "INT DEFAULT '0'");
|
||||
|
||||
}
|
||||
|
||||
RewardHandler.getInstance().addInjectedReward(new RewardInjectInt("Points", 0) {
|
||||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
}.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());
|
||||
}
|
||||
})));
|
||||
|
||||
plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
|
||||
|
||||
boolean hasRewards = RewardHandler.getInstance().hasRewards(ConfigVoteSites.getInstance().getData(),
|
||||
ConfigVoteSites.getInstance().getEverySiteRewardPath());
|
||||
|
||||
boolean noIssues = true;
|
||||
boolean issues = true;
|
||||
ArrayList<String> services = ServerData.getInstance().getServiceSites();
|
||||
for (VoteSite site : getVoteSites()) {
|
||||
if (!site.hasRewards() && !hasRewards) {
|
||||
noIssues = false;
|
||||
issues = false;
|
||||
plugin.getLogger().warning("No rewards detected for the site: " + site.getKey()
|
||||
+ ". See https://github.com/Ben12345rocks/AdvancedCore/wiki/Rewards on how to add rewards");
|
||||
}
|
||||
@@ -796,27 +862,22 @@ public class Main extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
if (!contains) {
|
||||
noIssues = false;
|
||||
issues = false;
|
||||
plugin.getLogger().warning("No vote has been recieved from " + site.getServiceSite()
|
||||
+ ", may be an invalid service site. Vote on the site and look in console for a service site, if you get nothing then there is an issue with votifier");
|
||||
}
|
||||
}
|
||||
|
||||
if (!noIssues) {
|
||||
if (!issues) {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@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");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -842,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);
|
||||
}
|
||||
@@ -860,14 +922,12 @@ public class Main extends JavaPlugin {
|
||||
pm.registerEvents(new PlayerJoinEvent(this), this);
|
||||
pm.registerEvents(new VotiferEvent(this), this);
|
||||
pm.registerEvents(new PlayerVoteListener(this), this);
|
||||
|
||||
pm.registerEvents(new SignChange(this), this);
|
||||
|
||||
pm.registerEvents(new BlockBreak(this), this);
|
||||
|
||||
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");
|
||||
|
||||
@@ -886,14 +946,10 @@ public class Main extends JavaPlugin {
|
||||
AdvancedCoreHook.getInstance().setConfigData(Config.getInstance().getData());
|
||||
AdvancedCoreHook.getInstance().reload();
|
||||
PlaceHolders.getInstance().load();
|
||||
// loadTimer();
|
||||
|
||||
CoolDownCheck.getInstance().checkAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup files.
|
||||
*/
|
||||
public void setupFiles() {
|
||||
private void setupFiles() {
|
||||
try {
|
||||
config = Config.getInstance();
|
||||
config.setup();
|
||||
@@ -979,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;
|
||||
@@ -111,6 +115,47 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
setOfflineVotes(offlineVotes);
|
||||
}
|
||||
|
||||
public boolean hasPercentageTotal(TopVoter top, double percentage, LocalDateTime time) {
|
||||
int total = getTotal(top);
|
||||
switch (top) {
|
||||
case Daily:
|
||||
return total / plugin.getVoteSites().size() * 100 > percentage;
|
||||
case Monthly:
|
||||
return total / (plugin.getVoteSites().size() * time.getMonth().length(false)) * 100 > percentage;
|
||||
case Weekly:
|
||||
return total / (plugin.getVoteSites().size() * 7) * 100 > percentage;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
@@ -128,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());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,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);
|
||||
@@ -286,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");
|
||||
}
|
||||
@@ -356,9 +463,9 @@ public class User extends com.Ben12345rocks.AdvancedCore.UserManager.User {
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
times.put(voteSite, getTime(voteSite));
|
||||
}
|
||||
LinkedHashMap<VoteSite, Long> sorted = (LinkedHashMap<VoteSite, Long>) times.entrySet().stream()
|
||||
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
LinkedHashMap<VoteSite, Long> sorted = new LinkedHashMap<>(
|
||||
times.entrySet().stream().sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
|
||||
return sorted;
|
||||
}
|
||||
|
||||
@@ -417,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;
|
||||
}
|
||||
@@ -440,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() {
|
||||
@@ -500,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,6 +76,10 @@ public class VoteSite {
|
||||
@Setter
|
||||
private boolean giveOffline;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean waitUntilVoteDelay;
|
||||
|
||||
/**
|
||||
* Instantiates a new vote site.
|
||||
*
|
||||
@@ -122,6 +126,8 @@ public class VoteSite {
|
||||
}
|
||||
|
||||
MiscUtils.getInstance().broadcast(bc, players);
|
||||
} else {
|
||||
plugin.debug(user.getPlayerName() + " is vanished, not broadcasting");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +182,7 @@ public class VoteSite {
|
||||
item = configVoteSites.getItem(key);
|
||||
voteDelayDaily = configVoteSites.getVoteSiteResetVoteDelayDaily(key);
|
||||
giveOffline = configVoteSites.getVoteSiteGiveOffline(key);
|
||||
waitUntilVoteDelay = configVoteSites.getWaitUntilVoteDelay(key);
|
||||
}
|
||||
|
||||
public boolean isVaidServiceSite() {
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,18 +100,18 @@ public class TopVoterHandler implements Listener {
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onDateChanged(DateChangedEvent event) {
|
||||
plugin.setUpdate(true);
|
||||
plugin.update();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
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 {
|
||||
user.addDayVoteStreak();
|
||||
if (!user.voteStreakUpdatedToday(LocalDateTime.now().minusDays(1))) {
|
||||
if (user.getDayVoteStreak() != 0) {
|
||||
user.setDayVoteStreak(0);
|
||||
}
|
||||
}
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Day");
|
||||
|
||||
if (user.getHighestDailyTotal() < user.getTotal(TopVoter.Daily)) {
|
||||
user.setHighestDailyTotal(user.getTotal(TopVoter.Daily));
|
||||
@@ -154,8 +154,12 @@ public class TopVoterHandler implements Listener {
|
||||
if (user.getTotal(TopVoter.Monthly) == 0 && user.getMonthVoteStreak() != 0) {
|
||||
user.setMonthVoteStreak(0);
|
||||
} else {
|
||||
user.addMonthVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Month");
|
||||
if (!Config.getInstance().isVoteStreakRequirementUsePercentage() || user.hasPercentageTotal(
|
||||
TopVoter.Monthly, Config.getInstance().getVoteStreakRequirementMonth(),
|
||||
LocalDateTime.now().minusDays(1))) {
|
||||
user.addMonthVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Month");
|
||||
}
|
||||
}
|
||||
|
||||
if (user.getHighestMonthlyTotal() < user.getTotal(TopVoter.Monthly)) {
|
||||
@@ -214,8 +218,11 @@ public class TopVoterHandler implements Listener {
|
||||
if (user.getTotal(TopVoter.Weekly) == 0 && user.getWeekVoteStreak() != 0) {
|
||||
user.setWeekVoteStreak(0);
|
||||
} else {
|
||||
user.addWeekVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Week");
|
||||
if (!Config.getInstance().isVoteStreakRequirementUsePercentage() || user.hasPercentageTotal(
|
||||
TopVoter.Weekly, Config.getInstance().getVoteStreakRequirementWeek(), null)) {
|
||||
user.addWeekVoteStreak();
|
||||
SpecialRewards.getInstance().checkVoteStreak(user, "Week");
|
||||
}
|
||||
}
|
||||
|
||||
if (user.getHighestWeeklyTotal() < user.getTotal(TopVoter.Weekly)) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
|
||||
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Updater.Updater;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
@@ -49,6 +50,9 @@ public class CheckUpdate {
|
||||
* Check update.
|
||||
*/
|
||||
public void checkUpdate() {
|
||||
if (Config.getInstance().isDisableUpdateChecking()) {
|
||||
return;
|
||||
}
|
||||
plugin.setUpdater(new Updater(plugin, 15358, false));
|
||||
final Updater.UpdateResult result = plugin.getUpdater().getResult();
|
||||
switch (result) {
|
||||
@@ -75,6 +79,9 @@ public class CheckUpdate {
|
||||
}
|
||||
|
||||
public void checkUpdateBasic() {
|
||||
if (Config.getInstance().isDisableUpdateChecking()) {
|
||||
return;
|
||||
}
|
||||
plugin.setUpdater(new Updater(plugin, 15358, false));
|
||||
final Updater.UpdateResult result = plugin.getUpdater().getResult();
|
||||
switch (result) {
|
||||
@@ -95,6 +102,9 @@ public class CheckUpdate {
|
||||
* Start up.
|
||||
*/
|
||||
public void startUp() {
|
||||
if (Config.getInstance().isDisableUpdateChecking()) {
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,6 +32,10 @@ public class UserManager {
|
||||
return com.Ben12345rocks.AdvancedCore.UserManager.UserManager.getInstance().getAllUUIDs();
|
||||
}
|
||||
|
||||
public User getVotingPluginUser(com.Ben12345rocks.AdvancedCore.UserManager.User user) {
|
||||
return getVotingPluginUser(java.util.UUID.fromString(user.getUUID()));
|
||||
}
|
||||
|
||||
public User getVotingPluginUser(java.util.UUID uuid) {
|
||||
return getVotingPluginUser(new UUID(uuid.toString()));
|
||||
}
|
||||
|
||||
+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()));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ public abstract class PlaceHolder {
|
||||
private String identifier;
|
||||
@Getter
|
||||
private boolean useStartsWith = false;
|
||||
@Getter
|
||||
private String description;
|
||||
|
||||
public PlaceHolder(String identifier) {
|
||||
this.identifier = identifier;
|
||||
@@ -22,6 +24,10 @@ public abstract class PlaceHolder {
|
||||
this.useStartsWith = useStartsWith;
|
||||
}
|
||||
|
||||
public boolean hasDescription() {
|
||||
return description != null;
|
||||
}
|
||||
|
||||
public boolean matches(String identifier) {
|
||||
if (isUseStartsWith()) {
|
||||
if (StringUtils.getInstance().startsWithIgnoreCase(identifier, getIdentifier())) {
|
||||
@@ -42,4 +48,9 @@ public abstract class PlaceHolder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlaceHolder withDescription(String desc) {
|
||||
description = desc;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
+178
-30
@@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
|
||||
import com.Ben12345rocks.AdvancedCore.Util.Misc.StringUtils;
|
||||
import com.Ben12345rocks.VotingPlugin.Main;
|
||||
import com.Ben12345rocks.VotingPlugin.Commands.Commands;
|
||||
import com.Ben12345rocks.VotingPlugin.Config.Config;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.VoteSite;
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
|
||||
@@ -96,7 +97,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getTotal(TopVoter.Monthly));
|
||||
}
|
||||
});
|
||||
}.withDescription("Month total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("alltimetotal") {
|
||||
|
||||
@@ -104,7 +105,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getTotal(TopVoter.AllTime));
|
||||
}
|
||||
});
|
||||
}.withDescription("Alltime total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("lastmonthtotal") {
|
||||
|
||||
@@ -112,18 +113,46 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getLastMonthTotal());
|
||||
}
|
||||
});
|
||||
}.withDescription("Last month total"));
|
||||
|
||||
// end of older placeholders
|
||||
|
||||
placeholders.add(new PlaceHolder("DisableBroadcast") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return "" + user.getDisableBroadcast();
|
||||
}
|
||||
}.withDescription("Returns true/false if user has broadcast disabled"));
|
||||
|
||||
placeholders.add(new PlaceHolder("MilestoneCount") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return "" + user.getMilestoneCount();
|
||||
}
|
||||
}.withDescription("User milestonecount"));
|
||||
|
||||
for (final String identifier : Config.getInstance().getIdentifiers()) {
|
||||
if (Config.getInstance().getIdentifierLimit(identifier) > 0) {
|
||||
placeholders.add(new PlaceHolder("VoteShopLimit_" + identifier) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String ident) {
|
||||
return "" + user.getVoteShopIdentifierLimit(identifier);
|
||||
}
|
||||
}.withDescription("User voteshop limit for " + identifier));
|
||||
}
|
||||
}
|
||||
|
||||
for (final TopVoter top : TopVoter.values()) {
|
||||
placeholders.add(new PlaceHolder("total_" + top.toString()) {
|
||||
placeholders.add(new PlaceHolder("Total_" + top.toString()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getTotal(top));
|
||||
}
|
||||
});
|
||||
}.withDescription("User total for " + top.getName()));
|
||||
}
|
||||
|
||||
placeholders.add(new PlaceHolder("BestDailyTotal") {
|
||||
@@ -132,7 +161,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getHighestDailyTotal());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best daily total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestWeeklyTotal") {
|
||||
|
||||
@@ -140,7 +169,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getHighestWeeklyTotal());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best weekly total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestMonthlyTotal") {
|
||||
|
||||
@@ -148,7 +177,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getHighestMonthlyTotal());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best monthly total"));
|
||||
|
||||
placeholders.add(new PlaceHolder("DailyVoteStreak") {
|
||||
|
||||
@@ -156,7 +185,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getDayVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Current daily votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("WeeklyVoteStreak") {
|
||||
|
||||
@@ -164,7 +193,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getWeekVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Current weekly votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("MonthVoteStreak") {
|
||||
|
||||
@@ -172,7 +201,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getMonthVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Current month votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestDailyVoteStreak") {
|
||||
|
||||
@@ -180,7 +209,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getBestDayVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best daily votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestWeeklyVoteStreak") {
|
||||
|
||||
@@ -188,7 +217,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getBestWeekVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best weekly votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("BestMonthVoteStreak") {
|
||||
|
||||
@@ -196,7 +225,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getBestMonthVoteStreak());
|
||||
}
|
||||
});
|
||||
}.withDescription("Best month votestreak"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Points") {
|
||||
|
||||
@@ -204,7 +233,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(user.getPoints());
|
||||
}
|
||||
});
|
||||
}.withDescription("User points"));
|
||||
|
||||
placeholders.add(new PlaceHolder("CanVote") {
|
||||
|
||||
@@ -212,7 +241,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Boolean.toString(user.canVoteAll());
|
||||
}
|
||||
});
|
||||
}.withDescription("Return true/false if player can vote on all sites"));
|
||||
|
||||
for (final VoteSite voteSite : plugin.getVoteSites()) {
|
||||
placeholders.add(new PlaceHolder("Next_" + voteSite.getKey()) {
|
||||
@@ -221,14 +250,21 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Commands.getInstance().voteCommandNextInfo(user, voteSite);
|
||||
}
|
||||
});
|
||||
}.withDescription("How long until user can vote on " + voteSite.getKey()));
|
||||
placeholders.add(new PlaceHolder("Last_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Commands.getInstance().voteCommandLastDuration(user, voteSite);
|
||||
}
|
||||
});
|
||||
}.withDescription("How long ago user voted on " + voteSite.getKey()));
|
||||
placeholders.add(new PlaceHolder("CanVote_" + voteSite.getKey()) {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return "" + user.canVoteSite(voteSite);
|
||||
}
|
||||
}.withDescription("Whether or not player can vote on " + voteSite.getKey()));
|
||||
}
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_All_Position") {
|
||||
@@ -244,7 +280,23 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_AllVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.AllTime).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.AllTime);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at position in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_All_") {
|
||||
|
||||
@@ -260,7 +312,7 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith());
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Month_Position") {
|
||||
|
||||
@@ -275,7 +327,7 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Month_") {
|
||||
|
||||
@@ -291,7 +343,23 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith());
|
||||
}.useStartsWith().withDescription("Get user at position in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_MonthVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Monthly).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Monthly);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at position in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Week_Position") {
|
||||
|
||||
@@ -306,7 +374,7 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Week_") {
|
||||
|
||||
@@ -322,7 +390,23 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith());
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_WeekVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Weekly).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Weekly);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at position in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Daily_Position") {
|
||||
|
||||
@@ -337,14 +421,14 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}.withDescription("Get user top voter position"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_Daily_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[3]);
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
if (num == number) {
|
||||
return entry.getKey().getPlayerName();
|
||||
@@ -353,7 +437,23 @@ public class PlaceHolders {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith());
|
||||
}.useStartsWith().withDescription("Get user at postion in top voter"));
|
||||
|
||||
placeholders.add(new PlaceHolder("Top_DailyVotes_") {
|
||||
|
||||
@Override
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
int num = 1;
|
||||
int number = Integer.parseInt(identifier.split("_")[2]);
|
||||
for (Entry<User, Integer> entry : plugin.getTopVoter(TopVoter.Daily).entrySet()) {
|
||||
if (num == number) {
|
||||
return "" + entry.getKey().getTotal(TopVoter.Daily);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}.useStartsWith().withDescription("Get user votes at position in top voter"));
|
||||
|
||||
// non players
|
||||
|
||||
@@ -363,7 +463,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(VoteParty.getInstance().getTotalVotes());
|
||||
}
|
||||
});
|
||||
}.withDescription("Current amount of voteparty votes"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("VotePartyVotesNeeded") {
|
||||
|
||||
@@ -371,7 +471,7 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
return Integer.toString(VoteParty.getInstance().getNeededVotes());
|
||||
}
|
||||
});
|
||||
}.withDescription("Voteparty votes needed"));
|
||||
|
||||
nonPlayerPlaceholders.add(new PlaceHolder("VotePartyVotesRequired") {
|
||||
|
||||
@@ -379,6 +479,54 @@ public class PlaceHolders {
|
||||
public String placeholderRequest(OfflinePlayer p, User user, String identifier) {
|
||||
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"));
|
||||
}
|
||||
}
|
||||
@@ -95,8 +95,8 @@ public class VoteParty implements Listener {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
giveRewards();
|
||||
MiscUtils.getInstance().broadcast(Config.getInstance().getVotePartyBroadcast());
|
||||
giveRewards();
|
||||
|
||||
if (Config.getInstance().getVotePartyIncreaseVotesRquired() > 0) {
|
||||
ServerData.getInstance().setVotePartyExtraRequired(ServerData.getInstance().getVotePartyExtraRequired()
|
||||
@@ -173,14 +173,16 @@ public class VoteParty implements Listener {
|
||||
return required;
|
||||
}
|
||||
|
||||
public void giveReward(User user) {
|
||||
if (Config.getInstance().getVotePartyUserVotesRequired() > 0) {
|
||||
if (user.getVotePartyVotes() < Config.getInstance().getVotePartyUserVotesRequired()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
giveReward(user, user.isOnline());
|
||||
}
|
||||
|
||||
public void giveReward(User user, boolean online) {
|
||||
/*
|
||||
* if (PlayerUtils.getInstance().isPlayerOnline(user.getPlayerName())) { if
|
||||
* (user.getVotePartyVotes() >= Config.getInstance().getUserVotesRequired()) {
|
||||
* RewardHandler.getInstance().giveReward(user, Config.getInstance().getData(),
|
||||
* Config.getInstance().getVotePartyRewardsPath()); } } else {
|
||||
* user.addOfflineOtherReward("VoteParty"); }
|
||||
*/
|
||||
new RewardBuilder(Config.getInstance().getData(), Config.getInstance().getVotePartyRewardsPath())
|
||||
.setOnline(online)
|
||||
.withPlaceHolder("VotesRequired", "" + Config.getInstance().getVotePartyVotesRequired()).send(user);
|
||||
@@ -202,14 +204,16 @@ public class VoteParty implements Listener {
|
||||
}
|
||||
|
||||
if (Config.getInstance().getVotePartyGiveAllPlayers()) {
|
||||
plugin.debug("Giving all players vote party");
|
||||
for (String uuid : UserManager.getInstance().getAllUUIDs()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
giveReward(user, true);
|
||||
giveReward(user);
|
||||
}
|
||||
} else {
|
||||
plugin.debug(ArrayUtils.getInstance().makeStringList(getVotedUsers()));
|
||||
for (String uuid : getVotedUsers()) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(new UUID(uuid));
|
||||
giveReward(user, true);
|
||||
giveReward(user);
|
||||
}
|
||||
}
|
||||
reset();
|
||||
|
||||
@@ -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