Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea30de47d1 | ||
|
|
a76daf3aba | ||
|
|
e1ff13f4bf | ||
|
|
12f941cf83 | ||
|
|
243377a76a | ||
|
|
d7eab03860 | ||
|
|
ddd1f473f1 | ||
|
|
3e52bb0936 | ||
|
|
eb60220b1e | ||
|
|
00902bd597 | ||
|
|
d3606088cd | ||
|
|
ef2512e4e2 | ||
|
|
7f95a1c7c3 | ||
|
|
68a2fe27ff | ||
|
|
b05317c460 | ||
|
|
62fee6f347 | ||
|
|
ef7d4254e1 | ||
|
|
b6720ccc1f | ||
|
|
69d3d33008 | ||
|
|
7a193c87a9 | ||
|
|
f2cf2fb734 | ||
|
|
836079b5ea | ||
|
|
a7f6456480 | ||
|
|
82f25c3899 | ||
|
|
cb2cdbd4fc | ||
|
|
40d2b651a8 | ||
|
|
a999d9e9bb | ||
|
|
b144f2db9c | ||
|
|
24060a10ed | ||
|
|
4c8919804f | ||
|
|
66618260bb | ||
|
|
f441ede6b0 | ||
|
|
593ae76354 | ||
|
|
aa49dc5bc1 | ||
|
|
8941d909ca | ||
|
|
2946792dec | ||
|
|
0567f0ac66 | ||
|
|
fe78992477 | ||
|
|
195e1c82bd | ||
|
|
9479fe06c0 | ||
|
|
0807caed98 | ||
|
|
9fdcf5aa78 | ||
|
|
8d26e66dc0 | ||
|
|
14e61ba6bf | ||
|
|
6d361cc83f | ||
|
|
1e32fd65e0 | ||
|
|
5f0d8fff2f | ||
|
|
0d828a99bc | ||
|
|
0e8bd23784 | ||
|
|
a8af2a49ad | ||
|
|
54b08019ec | ||
|
|
27f01a6c3a | ||
|
|
337aab384f | ||
|
|
a94e1c1dd6 | ||
|
|
1445d97ce0 | ||
|
|
9e8abe0768 |
No files matched your search
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="Resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
@@ -1,3 +1,7 @@
|
||||
/bin/
|
||||
/target/
|
||||
/doc/
|
||||
/doc/
|
||||
/.idea/
|
||||
/*.iml
|
||||
/.settings/
|
||||
/.classpath
|
||||
@@ -1,7 +0,0 @@
|
||||
add_todo=false
|
||||
eclipse.preferences.version=1
|
||||
include_subpackages=true
|
||||
mode=mode_replace
|
||||
project_specific_settings=true
|
||||
replacements=<?xml version\="1.0" standalone\="yes"?>\n\n<replacements>\n<replacement key\="get" scope\="1" mode\="0">Gets the</replacement>\n<replacement key\="set" scope\="1" mode\="0">Sets the</replacement>\n<replacement key\="add" scope\="1" mode\="0">Adds the</replacement>\n<replacement key\="edit" scope\="1" mode\="0">Edits the</replacement>\n<replacement key\="remove" scope\="1" mode\="0">Removes the</replacement>\n<replacement key\="init" scope\="1" mode\="0">Inits the</replacement>\n<replacement key\="parse" scope\="1" mode\="0">Parses the</replacement>\n<replacement key\="create" scope\="1" mode\="0">Creates the</replacement>\n<replacement key\="build" scope\="1" mode\="0">Builds the</replacement>\n<replacement key\="is" scope\="1" mode\="0">Checks if is</replacement>\n<replacement key\="print" scope\="1" mode\="0">Prints the</replacement>\n<replacement key\="has" scope\="1" mode\="0">Checks for</replacement>\n</replacements>\n\n
|
||||
use_internal_formatter=true
|
||||
@@ -1,4 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=Cp1252
|
||||
encoding/Resources=Cp1252
|
||||
encoding/src=Cp1252
|
||||
@@ -1,131 +0,0 @@
|
||||
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
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
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.APILeak=warning
|
||||
org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info
|
||||
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.enablePreviewFeatures=disabled
|
||||
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
|
||||
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
|
||||
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=ignore
|
||||
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.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info
|
||||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
|
||||
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.unstableAutoModuleName=warning
|
||||
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.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
||||
@@ -1,4 +0,0 @@
|
||||
activeProfiles=dev
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -1,3 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
project.repository.kind=github
|
||||
project.repository.url=http\://github.com/Ben12345rocks/VotingPlugin
|
||||
@@ -1,8 +0,0 @@
|
||||
DELEGATES_PREFERENCE=delegateValidatorList
|
||||
USER_BUILD_PREFERENCE=enabledBuildValidatorList
|
||||
USER_MANUAL_PREFERENCE=enabledManualValidatorList
|
||||
USER_PREFERENCE=overrideGlobalPreferencesfalse
|
||||
eclipse.preferences.version=1
|
||||
override=false
|
||||
suspend=false
|
||||
vf.version=3
|
||||
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.jboss.ide.eclipse.as.core.singledeployable.deployableList=\n
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -29,12 +29,21 @@ BungeeBroadcast: false
|
||||
# Whether to broadcast on cached votes
|
||||
BungeeBroadcastAlways: false
|
||||
|
||||
# If true, the server won't broadcast votes
|
||||
# To be used in conjuction with Broadcast setting on bungee
|
||||
DisableBroadcast: false
|
||||
|
||||
# If true, offline rewards will be stored per server, rather than global
|
||||
# This shouldn't need to be set unless you get alot of cross server rewards issues
|
||||
# You can also specify the server within the rewards
|
||||
# Requires server name below to be correct
|
||||
PerServerRewards: false
|
||||
|
||||
# If true, milestones work per server
|
||||
# Please note totals still sync, but milestones can be claimed on each server
|
||||
# Needs to be set across all needed servers
|
||||
PerServerMilestones: false
|
||||
|
||||
# If true, points will be given on a per server level
|
||||
# Points will be added when server gets vote from bungee
|
||||
PerServerPoints: false
|
||||
@@ -47,6 +56,12 @@ TriggerVotifierEvent: false
|
||||
# Also can be applied to rewards
|
||||
Server: PleaseSet
|
||||
|
||||
# Rewards from bungee vote party
|
||||
# Gives to only players only
|
||||
# Use regular voteparty rewards otherwise
|
||||
# Can edit via /av gui
|
||||
BungeeVotePartyRewards: {}
|
||||
|
||||
# -----------------------------
|
||||
# For socket setup below only
|
||||
# -----------------------------
|
||||
|
||||
@@ -22,10 +22,6 @@ MySQL:
|
||||
Password: ''
|
||||
# Max number of connections
|
||||
MaxConnections: 1
|
||||
# Maxium size of caching mysql
|
||||
# -1 for no limit
|
||||
# Affecting this value may affect performance
|
||||
MaxSize: -1
|
||||
# Table name prefix, for use with mutliple servers
|
||||
# Don't use with PLUGINMESSAGING bungee setup
|
||||
Prefix: ''
|
||||
@@ -426,6 +422,10 @@ LimitMonthlyVotes: false
|
||||
# Shoudn't be needed, but enable if you have trouble with milestones
|
||||
PreventRepeatMilestones: false
|
||||
|
||||
# Close inventory on player vote
|
||||
# This is to prevent any possible exploits
|
||||
CloseInventoryOnVote: true
|
||||
|
||||
# When enabled the command /vote setprimaryaccount (playername)
|
||||
# will be shown (after restart)
|
||||
# Primary account will be used instead of the players account to get
|
||||
|
||||
@@ -79,8 +79,8 @@ CHEST:
|
||||
# Name: 'Extra item'
|
||||
## Works on most GUI items
|
||||
# Slot: 10
|
||||
## Send rewards on click, run commands, check conditions, etc
|
||||
# Rewards: []
|
||||
## Send rewards on click, run commands, check conditions, etc
|
||||
# Rewards: []
|
||||
|
||||
# GUI for /vote url, /vote
|
||||
VoteURL:
|
||||
|
||||
@@ -18,9 +18,14 @@ AllSites:
|
||||
Messages:
|
||||
Player: '&aYou voted on all sites in 1 day!'
|
||||
|
||||
|
||||
# If true only cumulative reward at a time can be given
|
||||
# The cumulative rewards will go in order as listed under Cumulative, so if true
|
||||
# the first cumulative (in the order as listed) that can be given will, then will ignore the rest
|
||||
OnlyOneCumulative: false
|
||||
# NOTE: This is not a 1 time reward, that's what milestones are for!
|
||||
# If total votes (Can be changed) divided by cumulative amount
|
||||
# and as no remainder (So divides perfectly)then a reward is given
|
||||
# and with no remainder (So divides perfectly) then a reward is given
|
||||
Cumulative:
|
||||
# Number of votes required
|
||||
# Allows multiple cumulative rewards
|
||||
@@ -168,6 +173,11 @@ LogoutRewards: {}
|
||||
|
||||
EnableMonthlyAwards: true
|
||||
|
||||
# TopVoter Placeholders:
|
||||
#%place% - place in topvoter
|
||||
#%topvoter% - topvoter type
|
||||
#%votes% - current total votes related to top voter
|
||||
|
||||
# Rewards to give
|
||||
MonthlyAwards:
|
||||
# Position. 1 is first in top voter, 2 is second, etc...
|
||||
|
||||
@@ -11,10 +11,6 @@ Username: ''
|
||||
Password: ''
|
||||
# Max number of connections
|
||||
MaxConnections: 1
|
||||
# Maxium size of caching mysql
|
||||
# -1 for no limit
|
||||
# Affecting this value may affect performance
|
||||
MaxSize: -1
|
||||
# Table name prefix, for use with mutliple servers
|
||||
Prefix: ''
|
||||
#UseSSL: true
|
||||
@@ -25,13 +21,13 @@ Debug: false
|
||||
# If false, will send to online server only
|
||||
SendVotesToAllServers: true
|
||||
# List of servers the plugin won't send the vote to
|
||||
# Uses names from bungeecoord config if not using SOCKETS method
|
||||
# Uses names from bungeecoord config, only needed for non SOCKETS setup
|
||||
BlockedServers:
|
||||
- hub
|
||||
|
||||
# What type of bungee setup
|
||||
# Requires restart and set on all servers
|
||||
# https://github.com/Ben12345rocks/VotingPlugin/wiki/Bungeecoord-Setups
|
||||
# https://github.com/BenCodez/VotingPlugin/wiki/Bungeecoord-Setups
|
||||
# Available:
|
||||
# SOCKETS
|
||||
# PLUGINMESSAGING
|
||||
@@ -43,6 +39,7 @@ BungeeMethod: PLUGINMESSAGING
|
||||
# This requires spigot servers AllowUnJoined to be set to true in Config.yml
|
||||
AllowUnJoined: false
|
||||
|
||||
# Points to give on vote
|
||||
PointsOnVote: 1
|
||||
|
||||
# If true, bungee will handle adding totals
|
||||
@@ -51,22 +48,42 @@ PointsOnVote: 1
|
||||
# Recommened to leave true, setting to false setups are currently unsupported
|
||||
BungeeManageTotals: true
|
||||
|
||||
# Tell servers to broadcast
|
||||
# Set DisableBroadcast to true on spigot servers (BungeeSettings.yml) as well
|
||||
Broadcast: true
|
||||
|
||||
VoteParty:
|
||||
# If enabled, will trigger vote party reward
|
||||
# in BungeeSettings.yml under BungeeVotePartyReward
|
||||
# Only runs rewards for online players
|
||||
Enabled: false
|
||||
# Votes required
|
||||
VotesRequired: 100
|
||||
# Increase amount required on each vote party
|
||||
IncreaseVotesRequired: 0
|
||||
# If false, will only send to servers listed below
|
||||
SendToAllServers: true
|
||||
# Servers to send to, if SendToAllServers is false
|
||||
ServersToSend: []
|
||||
# List of commands to run on bungee server
|
||||
# Set spigot commands in BungeeSettings.yml
|
||||
BungeeCommands: []
|
||||
Broadcast: '&aVote party has been reached!'
|
||||
|
||||
|
||||
# ----------------------------
|
||||
# PLUGINMESSAGING Settings
|
||||
# ----------------------------
|
||||
|
||||
# Applies to PLUGINMESSAGING & when SendVotesToAllServers is true
|
||||
# Applies to PLUGINMESSAGING only
|
||||
# Votes will be forwarded when specific player is online
|
||||
WaitForUserOnline: false
|
||||
|
||||
# ----------------------------
|
||||
# SOCKET Settings, do not touch otherwise
|
||||
# SOCKET Settings
|
||||
# ONLY for SOCKET method
|
||||
# ----------------------------
|
||||
|
||||
# Tell servers to broadcast
|
||||
# For socket method
|
||||
Broadcast: true
|
||||
|
||||
# Server to send vote to if player is offline
|
||||
FallBackServer: factions
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ softdepend: [MVdWPlaceholders, Votifier, VotifierPlus, NuVotifier, CMI, Vault, P
|
||||
loadbefore: [MCPerks]
|
||||
api-version: 1.13
|
||||
libraries:
|
||||
- org.openjdk.nashorn:nashorn-core:15.2
|
||||
- org.openjdk.nashorn:nashorn-core:15.3
|
||||
commands:
|
||||
vote:
|
||||
description: Vote command
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
time: '${timestamp}'
|
||||
profile: ${build.profile.id}
|
||||
version: ${project.version}
|
||||
profile: '${build.profile.id}'
|
||||
version: '${project.version}'
|
||||
buildnumber: '${build.number}'
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.bencodez</groupId>
|
||||
<artifactId>votingplugin</artifactId>
|
||||
<version>6.6</version>
|
||||
<version>6.7.1</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>VotingPlugin</name>
|
||||
<properties>
|
||||
@@ -12,6 +12,7 @@
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<github.global.server>github</github.global.server>
|
||||
<project.build.sourceEncoding>Cp1252</project.build.sourceEncoding>
|
||||
<build.number>NOTSET</build.number>
|
||||
</properties>
|
||||
<build>
|
||||
<resources>
|
||||
@@ -236,15 +237,13 @@
|
||||
<groupId>com.vexsoftware</groupId>
|
||||
<artifactId>nuvotifier-universal</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/nuvotifier.jar</systemPath>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>be.maximvdw</groupId>
|
||||
<artifactId>MVdWPlaceholderAPI</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/Jars/MVdWPlaceholderAPI.jar</systemPath>
|
||||
<artifactId>mvdwplaceholderapi</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.velocitypowered</groupId>
|
||||
|
||||
@@ -4,7 +4,12 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.bencodez.advancedcore.api.misc.MiscUtils;
|
||||
import com.bencodez.advancedcore.api.misc.encryption.EncryptionHandler;
|
||||
import com.bencodez.advancedcore.api.rewards.RewardBuilder;
|
||||
import com.bencodez.advancedcore.bungeeapi.pluginmessage.PluginMessageHandler;
|
||||
import com.bencodez.advancedcore.bungeeapi.sockets.ClientHandler;
|
||||
import com.bencodez.advancedcore.bungeeapi.sockets.SocketHandler;
|
||||
@@ -53,7 +58,7 @@ public class BungeeHandler {
|
||||
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
plugin.registerBungeeChannels("vp:vp");
|
||||
|
||||
plugin.getPluginMessaging().setDebug(true);
|
||||
plugin.getPluginMessaging().setDebug(plugin.getBungeeSettings().isBungeeDebug());
|
||||
|
||||
plugin.getPluginMessaging().add(new PluginMessageHandler("Vote") {
|
||||
@Override
|
||||
@@ -81,20 +86,33 @@ public class BungeeHandler {
|
||||
|
||||
user.clearCache();
|
||||
|
||||
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline);
|
||||
if (plugin.getBungeeSettings().isPerServerPoints()) {
|
||||
user.addPoints(plugin.getConfigFile().getPointsOnVote());
|
||||
boolean broadcast = true;
|
||||
boolean bungeeBroadcast = false;
|
||||
|
||||
if (args.size() > 9) {
|
||||
bungeeBroadcast = Boolean.valueOf(args.get(9));
|
||||
}
|
||||
|
||||
if (!plugin.getBungeeSettings().isBungeeBroadcast()) {
|
||||
if (wasOnline || plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
|
||||
VoteSite site = plugin.getVoteSite(service, true);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
if (!bungeeBroadcast) {
|
||||
if (!plugin.getBungeeSettings().isBungeeBroadcast()
|
||||
&& !plugin.getBungeeSettings().isDisableBroadcast()) {
|
||||
if (wasOnline || plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
|
||||
VoteSite site = plugin.getVoteSite(service, true);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
broadcast = false;
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
broadcast = false;
|
||||
}
|
||||
|
||||
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline, broadcast);
|
||||
if (plugin.getBungeeSettings().isPerServerPoints()) {
|
||||
user.addPoints(plugin.getConfigFile().getPointsOnVote());
|
||||
}
|
||||
|
||||
if (Boolean.valueOf(args.get(5))) {
|
||||
@@ -135,17 +153,34 @@ public class BungeeHandler {
|
||||
|
||||
boolean wasOnline = Boolean.valueOf(args.get(4));
|
||||
|
||||
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline);
|
||||
boolean broadcast = true;
|
||||
boolean bungeeBroadcast = false;
|
||||
|
||||
if (!plugin.getBungeeSettings().isBungeeBroadcast()) {
|
||||
if (Boolean.valueOf(args.get(4)) || plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
|
||||
VoteSite site = plugin.getVoteSite(service, true);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
if (args.size() > 9) {
|
||||
bungeeBroadcast = Boolean.valueOf(args.get(9));
|
||||
}
|
||||
|
||||
if (!bungeeBroadcast) {
|
||||
if (!plugin.getBungeeSettings().isBungeeBroadcast()
|
||||
&& !plugin.getBungeeSettings().isDisableBroadcast()) {
|
||||
if (Boolean.valueOf(args.get(4))
|
||||
|| plugin.getBungeeSettings().isBungeeBroadcastAlways()) {
|
||||
VoteSite site = plugin.getVoteSite(service, true);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
broadcast = false;
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
broadcast = false;
|
||||
}
|
||||
|
||||
user.bungeeVotePluginMessaging(service, time, text, !setTotals, wasOnline, broadcast);
|
||||
if (plugin.getBungeeSettings().isPerServerPoints()) {
|
||||
user.addPoints(plugin.getConfigFile().getPointsOnVote());
|
||||
}
|
||||
|
||||
if (Boolean.valueOf(args.get(5))) {
|
||||
@@ -174,14 +209,17 @@ public class BungeeHandler {
|
||||
plugin.getPluginMessaging().add(new PluginMessageHandler("VoteBroadcast") {
|
||||
@Override
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
String uuid = args.get(0);
|
||||
String service = args.get(1);
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid));
|
||||
VoteSite site = plugin.getVoteSite(service, true);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
if (args.size() > 2) {
|
||||
String uuid = args.get(0);
|
||||
String service = args.get(2);
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(UUID.fromString(uuid),
|
||||
args.get(1));
|
||||
VoteSite site = plugin.getVoteSite(service, true);
|
||||
if (site != null) {
|
||||
site.broadcastVote(user, false);
|
||||
} else {
|
||||
plugin.getLogger().warning("No votesite for " + service);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -195,6 +233,23 @@ public class BungeeHandler {
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getPluginMessaging().add(new PluginMessageHandler("VotePartyBungee") {
|
||||
@Override
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
new RewardBuilder(plugin.getBungeeSettings().getData(), "BungeeVotePartyRewards").send(p);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plugin.getPluginMessaging().add(new PluginMessageHandler("VotePartyBroadcast") {
|
||||
@Override
|
||||
public void onRecieve(String subChannel, ArrayList<String> args) {
|
||||
String broadcast = args.get(0);
|
||||
MiscUtils.getInstance().broadcast(broadcast);
|
||||
}
|
||||
});
|
||||
|
||||
} else if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
encryptionHandler = new EncryptionHandler(new File(plugin.getDataFolder(), "secretkey.key"));
|
||||
|
||||
@@ -293,6 +348,25 @@ public class BungeeHandler {
|
||||
}
|
||||
});
|
||||
|
||||
socketHandler.add(new SocketReceiver("VotePartyBungee") {
|
||||
|
||||
@Override
|
||||
public void onReceive(String[] data) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
new RewardBuilder(plugin.getBungeeSettings().getData(), "BungeeVotePartyRewards").send(p);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
socketHandler.add(new SocketReceiver("VotePartyBroadcast") {
|
||||
|
||||
@Override
|
||||
public void onReceive(String[] data) {
|
||||
String broadcast = data[0];
|
||||
MiscUtils.getInstance().broadcast(broadcast);
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.getOptions().getServer().equalsIgnoreCase("pleaseset")) {
|
||||
plugin.getLogger().warning("Server name for bungee voting is not set, please set it");
|
||||
}
|
||||
|
||||
@@ -146,6 +146,9 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
@Getter
|
||||
private String profile = "";
|
||||
|
||||
@Getter
|
||||
private String buildNumber = "NOTSET";
|
||||
|
||||
@Getter
|
||||
private ServerData serverData;
|
||||
|
||||
@@ -267,7 +270,11 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
}
|
||||
|
||||
public LinkedHashMap<TopVoterPlayer, Integer> getTopVoter(TopVoter top) {
|
||||
return topVoter.get(top);
|
||||
LinkedHashMap<TopVoterPlayer, Integer> top1 = topVoter.get(top);
|
||||
if (top1 == null) {
|
||||
top1 = new LinkedHashMap<TopVoterPlayer, Integer>();
|
||||
}
|
||||
return top1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -843,6 +850,28 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
});
|
||||
}
|
||||
|
||||
addDirectlyDefinedRewards(new DirectlyDefinedReward("BungeeVotePartyRewards") {
|
||||
|
||||
@Override
|
||||
public void createSection(String key) {
|
||||
getBungeeSettings().createSection(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection getFileData() {
|
||||
return getBungeeSettings().getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
getBungeeSettings().saveData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(String path, Object value) {
|
||||
getBungeeSettings().setValue(path, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadTimer() {
|
||||
@@ -884,6 +913,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
if (conf != null) {
|
||||
time = conf.getString("time", "");
|
||||
profile = conf.getString("profile", "");
|
||||
buildNumber = conf.getString("buildnumber", "NOTSET");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1073,7 +1103,8 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
|
||||
plugin.getLogger().info("Enabled VotingPlugin " + plugin.getDescription().getVersion());
|
||||
if (getProfile().contains("dev")) {
|
||||
plugin.getLogger().warning("Using dev build, this is not a stable build, use at your own risk");
|
||||
plugin.getLogger().info(
|
||||
"Using dev build, this is not a stable build, use at your own risk. Build number: " + buildNumber);
|
||||
}
|
||||
|
||||
boolean hasRewards = RewardHandler.getInstance().hasRewards(getConfigVoteSites().getData(),
|
||||
@@ -1085,7 +1116,7 @@ public class VotingPluginMain extends AdvancedCorePlugin {
|
||||
if (!site.hasRewards() && !hasRewards) {
|
||||
issues = false;
|
||||
plugin.getLogger().warning("No rewards detected for the site: " + site.getKey()
|
||||
+ ". See https://github.com/BenCodez/VotingPlugin/wiki/Rewards on how to add rewards");
|
||||
+ ". See https://github.com/BenCodez/VotingPlugin/wiki/Rewards");
|
||||
}
|
||||
|
||||
boolean contains = false;
|
||||
|
||||
@@ -188,14 +188,28 @@ public class VotingPluginMetrics {
|
||||
}
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("number_of_users", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
int total = UserManager.getInstance().getAllUUIDs().size() / 1000;
|
||||
return "" + total;
|
||||
}
|
||||
}));
|
||||
int users = UserManager.getInstance().getAllUUIDs().size();
|
||||
if (users > 1000) {
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("number_of_users_in_thousands", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
int total = UserManager.getInstance().getAllUUIDs().size() / 1000;
|
||||
return "" + total;
|
||||
}
|
||||
}));
|
||||
}
|
||||
if (users > 10000) {
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("number_of_users_in_thousands_plus_10", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
int total = UserManager.getInstance().getAllUUIDs().size() / 1000;
|
||||
return "" + total;
|
||||
}
|
||||
}));
|
||||
}
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("data_storage", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
@@ -320,5 +334,15 @@ public class VotingPluginMetrics {
|
||||
.hasRewards(plugin.getSpecialRewardsConfig().getData(), "VoteCoolDownEndedReward"));
|
||||
}
|
||||
}));
|
||||
|
||||
if (!plugin.getBuildNumber().equals("NOTSET")) {
|
||||
metrics.addCustomChart(new BStatsMetrics.SimplePie("dev_build_number", new Callable<String>() {
|
||||
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return "" + plugin.getBuildNumber();
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,34 @@ public class Config {
|
||||
return getData().getBoolean("WaitForUserOnline", false);
|
||||
}
|
||||
|
||||
public boolean getVotePartyEnabled() {
|
||||
return getData().getBoolean("VoteParty.Enabled", false);
|
||||
}
|
||||
|
||||
public boolean getVotePartySendToAllServers() {
|
||||
return getData().getBoolean("VoteParty.SendToAllServers", true);
|
||||
}
|
||||
|
||||
public int getVotePartyVotesRequired() {
|
||||
return getData().getInt("VoteParty.VotesRequired", 100);
|
||||
}
|
||||
|
||||
public int getVotePartyIncreaseVotesRequired() {
|
||||
return getData().getInt("VoteParty.IncreaseVotesRequired", 0);
|
||||
}
|
||||
|
||||
public String getVotePartyBroadcast() {
|
||||
return getData().getString("VoteParty.Broadcast", "");
|
||||
}
|
||||
|
||||
public List<String> getVotePartyServersToSend() {
|
||||
return getData().getStringList("VoteParty.ServersToSend");
|
||||
}
|
||||
|
||||
public List<String> getVotePartyBungeeCommands() {
|
||||
return getData().getStringList("VoteParty.BungeeCommands");
|
||||
}
|
||||
|
||||
public void load() {
|
||||
if (!bungee.getDataFolder().exists()) {
|
||||
bungee.getDataFolder().mkdir();
|
||||
|
||||
@@ -18,6 +18,30 @@ public class VoteCache {
|
||||
this.bungee = bungee;
|
||||
}
|
||||
|
||||
public int getVotePartyCurrentVotes() {
|
||||
return getData().getInt("VoteParty.CurrentVotes", 0);
|
||||
}
|
||||
|
||||
public int getVotePartyInreaseVotesRequired() {
|
||||
return getData().getInt("VoteParty.IncreaseVotes", 0);
|
||||
}
|
||||
|
||||
public void setVotePartyCurrentVotes(int amount) {
|
||||
getData().set("VoteParty.CurrentVotes", amount);
|
||||
}
|
||||
|
||||
public void setVotePartyInreaseVotesRequired(int amount) {
|
||||
getData().set("VoteParty.IncreaseVotes", amount);
|
||||
}
|
||||
|
||||
public void setVotePartyCache(String server, int amount) {
|
||||
getData().set("VoteParty.Cache." + server, amount);
|
||||
}
|
||||
|
||||
public int getVotePartyCache(String server) {
|
||||
return getData().getInt("VoteParty.Cache." + server, 0);
|
||||
}
|
||||
|
||||
public void addVote(String server, int num, OfflineBungeeVote voteData) {
|
||||
Configuration section = getData().getSection("VoteCache." + server + "." + num);
|
||||
section.set("Name", voteData.getPlayerName());
|
||||
|
||||
@@ -8,8 +8,10 @@ import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.security.CodeSource;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
@@ -19,9 +21,12 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import com.bencodez.advancedcore.api.misc.ArrayUtils;
|
||||
import com.bencodez.advancedcore.api.misc.encryption.EncryptionHandler;
|
||||
import com.bencodez.advancedcore.api.misc.jsonparser.JsonParser;
|
||||
import com.bencodez.advancedcore.api.user.usercache.value.DataValue;
|
||||
import com.bencodez.advancedcore.api.user.usercache.value.DataValueInt;
|
||||
import com.bencodez.advancedcore.api.user.usercache.value.DataValueString;
|
||||
@@ -32,19 +37,20 @@ import com.bencodez.advancedcore.bungeeapi.sockets.SocketHandler;
|
||||
import com.bencodez.advancedcore.bungeeapi.sockets.SocketReceiver;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.connection.Server;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.ConfigurationProvider;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
public class VotingPluginBungee extends Plugin implements Listener {
|
||||
@@ -74,7 +80,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
|
||||
private boolean votifierEnabled = true;
|
||||
|
||||
public void checkCachedVotes(String server) {
|
||||
public synchronized void checkCachedVotes(String server) {
|
||||
if (getProxy().getServerInfo(server) != null) {
|
||||
if (!getProxy().getServerInfo(server).getPlayers().isEmpty()) {
|
||||
if (cachedVotes.containsKey(server) && !config.getBlockedServers().contains(server)) {
|
||||
@@ -98,7 +104,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
cache.getService(), "" + cache.getTime(), Boolean.FALSE.toString(),
|
||||
"" + cache.isRealVote(), cache.getText(),
|
||||
"" + getConfig().getBungeeManageTotals(),
|
||||
"" + BungeeVersion.getPluginMessageVersion());
|
||||
"" + BungeeVersion.getPluginMessageVersion(), "" + config.getBroadcast());
|
||||
} else {
|
||||
debug("Not sending vote because user isn't on server " + server + ": "
|
||||
+ cache.toString());
|
||||
@@ -113,7 +119,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
|
||||
}
|
||||
|
||||
public void checkOnlineVotes(ProxiedPlayer player, String uuid, String server) {
|
||||
public synchronized void checkOnlineVotes(ProxiedPlayer player, String uuid, String server) {
|
||||
if (player != null && player.isConnected() && cachedOnlineVotes.containsKey(uuid)) {
|
||||
ArrayList<OfflineBungeeVote> c = cachedOnlineVotes.get(uuid);
|
||||
if (!c.isEmpty()) {
|
||||
@@ -125,7 +131,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
sendPluginMessageServer(server, "VoteOnline", cache.getPlayerName(), cache.getUuid(),
|
||||
cache.getService(), "" + cache.getTime(), Boolean.FALSE.toString(),
|
||||
"" + cache.isRealVote(), cache.getText(), "" + getConfig().getBungeeManageTotals(),
|
||||
"" + BungeeVersion.getPluginMessageVersion());
|
||||
"" + BungeeVersion.getPluginMessageVersion(), "" + config.getBroadcast());
|
||||
}
|
||||
cachedOnlineVotes.put(uuid, new ArrayList<OfflineBungeeVote>());
|
||||
}
|
||||
@@ -154,7 +160,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
|
||||
// Parse JSON response and get UUID
|
||||
JsonElement element = new JsonParser().parse(bufferedReader);
|
||||
JsonElement element = JsonParser.parseReader(bufferedReader);
|
||||
JsonObject object = element.getAsJsonObject();
|
||||
String uuidAsString = object.get("id").getAsString();
|
||||
|
||||
@@ -245,12 +251,45 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
getMysql().alterColumnType("DayVoteStreakLastUpdate", "MEDIUMTEXT");
|
||||
}
|
||||
|
||||
/*
|
||||
* private int mysqlUpdate(ArrayList<Column> cols, String uuid, String column,
|
||||
* int toAdd) { int num = getValue(cols, column) + toAdd; debug("Setting " +
|
||||
* column + " to " + num + " for " + uuid); mysql.update(uuid, column, num,
|
||||
* DataType.INTEGER); return int; }
|
||||
*/
|
||||
private String buildNumber = "NOTSET";
|
||||
|
||||
public void loadVersionFile() {
|
||||
Configuration conf = getVersionFile();
|
||||
if (conf != null) {
|
||||
buildNumber = conf.get("buildnumber", "NOTSET");
|
||||
}
|
||||
}
|
||||
|
||||
private Configuration getVersionFile() {
|
||||
try {
|
||||
CodeSource src = this.getClass().getProtectionDomain().getCodeSource();
|
||||
if (src != null) {
|
||||
URL jar = src.getLocation();
|
||||
ZipInputStream zip = null;
|
||||
zip = new ZipInputStream(jar.openStream());
|
||||
while (true) {
|
||||
ZipEntry e = zip.getNextEntry();
|
||||
if (e != null) {
|
||||
String name = e.getName();
|
||||
if (name.equals("votingpluginversion.yml")) {
|
||||
Reader defConfigStream = new InputStreamReader(zip);
|
||||
if (defConfigStream != null) {
|
||||
Configuration conf = ConfigurationProvider
|
||||
.getProvider(net.md_5.bungee.config.YamlConfiguration.class)
|
||||
.load(defConfigStream);
|
||||
|
||||
defConfigStream.close();
|
||||
return conf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
@@ -272,9 +311,12 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
voteCacheFile.save();
|
||||
}
|
||||
voteCacheFile.save();
|
||||
nonVotedPlayersCache.save();
|
||||
if (mysql != null) {
|
||||
mysql.shutdown();
|
||||
}
|
||||
getLogger().info("VotingPlugin disabled");
|
||||
}
|
||||
|
||||
@@ -319,15 +361,12 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
this.getProxy().registerChannel("vp:vp");
|
||||
|
||||
if (mysqlLoaded) {
|
||||
if (method.equals(BungeeMethod.MYSQL)) {
|
||||
// this.getProxy().registerChannel("vp:vp");
|
||||
voteCacheFile = new VoteCache(this);
|
||||
voteCacheFile.load();
|
||||
|
||||
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
voteCacheFile = new VoteCache(this);
|
||||
voteCacheFile.load();
|
||||
|
||||
nonVotedPlayersCache = new NonVotedPlayersCache(this);
|
||||
nonVotedPlayersCache.load();
|
||||
nonVotedPlayersCache = new NonVotedPlayersCache(this);
|
||||
nonVotedPlayersCache.load();
|
||||
if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
|
||||
try {
|
||||
for (String server : voteCacheFile.getServers()) {
|
||||
@@ -432,6 +471,10 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
currentVotePartyVotesRequired = getConfig().getVotePartyVotesRequired()
|
||||
+ voteCacheFile.getVotePartyInreaseVotesRequired();
|
||||
votePartyVotes = voteCacheFile.getVotePartyCurrentVotes();
|
||||
|
||||
BStatsMetricsBungee metrics = new BStatsMetricsBungee(this, 9453);
|
||||
|
||||
metrics.addCustomChart(
|
||||
@@ -452,8 +495,17 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
metrics.addCustomChart(
|
||||
new BStatsMetricsBungee.SimplePie("waitforuseronline", () -> "" + getConfig().getWaitForUserOnline()));
|
||||
|
||||
if (!buildNumber.equals("NOTSET")) {
|
||||
metrics.addCustomChart(new BStatsMetricsBungee.SimplePie("dev_build_number", () -> "" + buildNumber));
|
||||
}
|
||||
|
||||
loadVersionFile();
|
||||
|
||||
getLogger().info("VotingPlugin loaded, using method: " + method.toString() + ", PluginMessagingVersion: "
|
||||
+ BungeeVersion.getPluginMessageVersion());
|
||||
if (!buildNumber.equals("NOTSET")) {
|
||||
getLogger().info("Detected using dev build number: " + buildNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -496,9 +548,18 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
debug("Login: " + player);
|
||||
ProxiedPlayer p = getProxy().getPlayer(player);
|
||||
if (p != null && p.isConnected()) {
|
||||
String server = p.getServer().getInfo().getName();
|
||||
checkCachedVotes(server);
|
||||
checkOnlineVotes(p, p.getUniqueId().toString(), server);
|
||||
if (p.getServer() != null && p.getServer().getInfo() != null) {
|
||||
final String server = p.getServer().getInfo().getName();
|
||||
final ProxiedPlayer proixedPlayer = p;
|
||||
getProxy().getScheduler().runAsync(this, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
checkCachedVotes(server);
|
||||
checkOnlineVotes(proixedPlayer, proixedPlayer.getUniqueId().toString(), server);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
@@ -520,21 +581,6 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerConnected(ServerConnectedEvent event) {
|
||||
final String server = event.getServer().getInfo().getName();
|
||||
final String uuid = event.getPlayer().getUniqueId().toString();
|
||||
getProxy().getScheduler().schedule(this, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
checkCachedVotes(server);
|
||||
checkOnlineVotes(event.getPlayer(), uuid, server);
|
||||
}
|
||||
|
||||
}, 3, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private UUID parseUUIDFromString(String uuidAsString) {
|
||||
String[] parts = { "0x" + uuidAsString.substring(0, 8), "0x" + uuidAsString.substring(8, 12),
|
||||
"0x" + uuidAsString.substring(12, 16), "0x" + uuidAsString.substring(16, 20),
|
||||
@@ -555,6 +601,8 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
|
||||
public void reload(boolean loadMysql) {
|
||||
config.load();
|
||||
currentVotePartyVotesRequired = getConfig().getVotePartyVotesRequired()
|
||||
+ voteCacheFile.getVotePartyInreaseVotesRequired();
|
||||
if (loadMysql) {
|
||||
try {
|
||||
if (!config.getData().getString("Host", "").isEmpty()) {
|
||||
@@ -665,6 +713,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
String uuid = getUUID(player);
|
||||
if (uuid.isEmpty()) {
|
||||
if (config.getAllowUnJoined()) {
|
||||
debug("Fetching UUID online, since allowunjoined is enabled");
|
||||
UUID u = null;
|
||||
try {
|
||||
u = fetchUUID(player);
|
||||
@@ -721,13 +770,7 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
text = new BungeeMessageData(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* String text = mysqlUpdate(data, uuid, "AllTimeTotal", 1) + "//" +
|
||||
* mysqlUpdate(data, uuid, "MonthTotal", 1) + "//" + mysqlUpdate(data, uuid,
|
||||
* "WeeklyTotal", 1) + "//" + mysqlUpdate(data, uuid, "DailyTotal", 1) + "//" +
|
||||
* mysqlUpdate(data, uuid, "Points", 1) + "//" + mysqlUpdate(data, uuid,
|
||||
* "MilestoneCount", 1);
|
||||
*/
|
||||
addVoteParty();
|
||||
|
||||
long time = LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||
|
||||
@@ -759,7 +802,10 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
sendPluginMessageServer(s, "Vote", player, uuid, service, "" + time,
|
||||
Boolean.TRUE.toString(), "" + realVote, text.toString(),
|
||||
"" + getConfig().getBungeeManageTotals(),
|
||||
"" + BungeeVersion.getPluginMessageVersion());
|
||||
"" + BungeeVersion.getPluginMessageVersion(), "" + config.getBroadcast());
|
||||
}
|
||||
if (config.getBroadcast()) {
|
||||
sendPluginMessageServer(s, "VoteBroadcast", uuid, player, service);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -769,7 +815,8 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
&& !config.getBlockedServers().contains(p.getServer().getInfo().getName())) {
|
||||
sendPluginMessageServer(p.getServer().getInfo().getName(), "VoteOnline", player, uuid, service,
|
||||
"" + time, Boolean.TRUE.toString(), "" + realVote, text.toString(),
|
||||
"" + getConfig().getBungeeManageTotals(), "" + BungeeVersion.getPluginMessageVersion());
|
||||
"" + getConfig().getBungeeManageTotals(), "" + BungeeVersion.getPluginMessageVersion(),
|
||||
"" + config.getBroadcast());
|
||||
} else {
|
||||
if (!cachedOnlineVotes.containsKey(uuid)) {
|
||||
cachedOnlineVotes.put(uuid, new ArrayList<OfflineBungeeVote>());
|
||||
@@ -784,6 +831,9 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
}
|
||||
for (String s : getProxy().getServers().keySet()) {
|
||||
sendPluginMessageServer(s, "VoteUpdate", uuid);
|
||||
if (config.getBroadcast()) {
|
||||
sendPluginMessageServer(s, "VoteBroadcast", uuid, player, service);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
@@ -795,4 +845,63 @@ public class VotingPluginBungee extends Plugin implements Listener {
|
||||
|
||||
}
|
||||
|
||||
private int votePartyVotes = 0;
|
||||
private int currentVotePartyVotesRequired = 0;
|
||||
|
||||
public void addCurrentVotePartyVotes(int amount) {
|
||||
votePartyVotes += amount;
|
||||
voteCacheFile.setVotePartyCurrentVotes(votePartyVotes);
|
||||
debug("Current vote party total: " + votePartyVotes);
|
||||
}
|
||||
|
||||
public void addVoteParty() {
|
||||
if (getConfig().getVotePartyEnabled()) {
|
||||
addCurrentVotePartyVotes(1);
|
||||
|
||||
if (votePartyVotes >= currentVotePartyVotesRequired) {
|
||||
debug("Vote party reached");
|
||||
addCurrentVotePartyVotes(-currentVotePartyVotesRequired);
|
||||
|
||||
currentVotePartyVotesRequired += getConfig().getVotePartyIncreaseVotesRequired();
|
||||
voteCacheFile.setVotePartyInreaseVotesRequired(voteCacheFile.getVotePartyInreaseVotesRequired()
|
||||
+ getConfig().getVotePartyIncreaseVotesRequired());
|
||||
|
||||
if (!getConfig().getVotePartyBroadcast().isEmpty()) {
|
||||
getProxy().broadcast(new TextComponent(
|
||||
ChatColor.translateAlternateColorCodes('&', getConfig().getVotePartyBroadcast())));
|
||||
}
|
||||
|
||||
for (String command : getConfig().getVotePartyBungeeCommands()) {
|
||||
getProxy().getPluginManager().dispatchCommand(getProxy().getConsole(), command);
|
||||
}
|
||||
|
||||
if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
if (getConfig().getVotePartySendToAllServers()) {
|
||||
for (Entry<String, ServerInfo> entry : getProxy().getServers().entrySet()) {
|
||||
sendVoteParty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
} else {
|
||||
for (String server : getConfig().getVotePartyServersToSend()) {
|
||||
ServerInfo serverInfo = getProxy().getServerInfo(server);
|
||||
if (serverInfo != null) {
|
||||
sendVoteParty(server, serverInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
voteCacheFile.save();
|
||||
}
|
||||
}
|
||||
|
||||
public void sendVoteParty(String server, ServerInfo serverInfo) {
|
||||
if (!serverInfo.getPlayers().isEmpty()) {
|
||||
if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
sendPluginMessageServer(server, "VotePartyBungee");
|
||||
} else if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
sendServerMessageServer(server, "VotePartyBungee");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,6 +63,38 @@ public class Config extends VelocityYMLFile {
|
||||
return getBoolean(getNode("SendVotesToAllServers"), true);
|
||||
}
|
||||
|
||||
public boolean getVotePartyEnabled() {
|
||||
return getBoolean(getVotePartyNode().getNode("Enabled"), false);
|
||||
}
|
||||
|
||||
public ConfigurationNode getVotePartyNode() {
|
||||
return getNode("VoteParty");
|
||||
}
|
||||
|
||||
public boolean getVotePartySendToAllServers() {
|
||||
return getBoolean(getVotePartyNode().getNode("SendToAllServers"), false);
|
||||
}
|
||||
|
||||
public int getVotePartyVotesRequired() {
|
||||
return getInt(getVotePartyNode().getNode("VotesRequired"), 100);
|
||||
}
|
||||
|
||||
public int getVotePartyIncreaseVotesRequired() {
|
||||
return getInt(getVotePartyNode().getNode("IncreaseVotesRequired"), 0);
|
||||
}
|
||||
|
||||
public String getVotePartyBroadcast() {
|
||||
return getString(getVotePartyNode().getNode("Broadcast"), "");
|
||||
}
|
||||
|
||||
public List<String> getVotePartyServersToSend() {
|
||||
return getStringList(getVotePartyNode().getNode("ServersToSend"), new ArrayList<String>());
|
||||
}
|
||||
|
||||
public List<String> getVotePartyBungeeCommands() {
|
||||
return getStringList(getVotePartyNode().getNode("BungeeCommands"), new ArrayList<String>());
|
||||
}
|
||||
|
||||
public ConfigurationNode getSpigotServerConfiguration(String s) {
|
||||
return getNode("SpigotServers", s);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,30 @@ public class VoteCache extends VelocityYMLFile {
|
||||
super(file);
|
||||
}
|
||||
|
||||
public int getVotePartyCurrentVotes() {
|
||||
return getInt(getNode("VoteParty").getNode("CurrentVotes"), 0);
|
||||
}
|
||||
|
||||
public int getVotePartyInreaseVotesRequired() {
|
||||
return getInt(getNode("VoteParty").getNode("IncreaseVotes"), 0);
|
||||
}
|
||||
|
||||
public void setVotePartyCurrentVotes(int amount) {
|
||||
getNode("VoteParty").getNode("CurrentVotes").setValue(amount);
|
||||
}
|
||||
|
||||
public void setVotePartyInreaseVotesRequired(int amount) {
|
||||
getNode("VoteParty").getNode("IncreaseVotes").setValue(amount);
|
||||
}
|
||||
|
||||
public void setVotePartyCache(String server, int amount) {
|
||||
getNode("VoteParty").getNode("Cache").getNode(server).setValue(amount);
|
||||
}
|
||||
|
||||
public int getVotePartyCache(String server) {
|
||||
return getNode("VoteParty").getNode("Cache").getNode(server).getInt(0);
|
||||
}
|
||||
|
||||
public void addVote(String server, int num, OfflineBungeeVote voteData) {
|
||||
String[] path = new String[] { "VoteCache", server, "" + num };
|
||||
|
||||
|
||||
+143
-30
@@ -20,9 +20,12 @@ import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.ZipEntry;
|
||||
@@ -34,6 +37,7 @@ import org.slf4j.Logger;
|
||||
|
||||
import com.bencodez.advancedcore.api.misc.ArrayUtils;
|
||||
import com.bencodez.advancedcore.api.misc.encryption.EncryptionHandler;
|
||||
import com.bencodez.advancedcore.api.misc.jsonparser.JsonParser;
|
||||
import com.bencodez.advancedcore.api.user.usercache.value.DataValue;
|
||||
import com.bencodez.advancedcore.api.user.usercache.value.DataValueInt;
|
||||
import com.bencodez.advancedcore.api.user.usercache.value.DataValueString;
|
||||
@@ -48,7 +52,6 @@ import com.bencodez.votingplugin.bungee.BungeeVersion;
|
||||
import com.bencodez.votingplugin.bungee.OfflineBungeeVote;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.command.CommandMeta;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
@@ -64,7 +67,6 @@ import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.vexsoftware.votifier.model.Vote;
|
||||
import com.vexsoftware.votifier.velocity.event.VotifierEvent;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -104,6 +106,8 @@ public class VotingPluginVelocity {
|
||||
|
||||
private VoteCache voteCacheFile;
|
||||
|
||||
private Timer timer;
|
||||
|
||||
@Inject
|
||||
public VotingPluginVelocity(ProxyServer server, Logger logger, Metrics.Factory metricsFactory,
|
||||
@DataDirectory Path dataDirectory) {
|
||||
@@ -111,9 +115,10 @@ public class VotingPluginVelocity {
|
||||
this.logger = logger;
|
||||
this.dataDirectory = dataDirectory;
|
||||
this.metricsFactory = metricsFactory;
|
||||
timer = new Timer();
|
||||
}
|
||||
|
||||
public void checkCachedVotes(RegisteredServer serverToCheck) {
|
||||
public synchronized void checkCachedVotes(RegisteredServer serverToCheck) {
|
||||
if (!serverToCheck.getPlayersConnected().isEmpty()) {
|
||||
if (cachedVotes.containsKey(serverToCheck)
|
||||
&& !config.getBlockedServers().contains(serverToCheck.getServerInfo().getName())) {
|
||||
@@ -139,7 +144,7 @@ public class VotingPluginVelocity {
|
||||
sendPluginMessageServer(serverToCheck, "Vote", cache.getPlayerName(), cache.getUuid(),
|
||||
cache.getService(), "" + cache.getTime(), Boolean.FALSE.toString(),
|
||||
"" + cache.isRealVote(), cache.getText(), "" + getConfig().getBungeeManageTotals(),
|
||||
"" + BungeeVersion.getPluginMessageVersion());
|
||||
"" + BungeeVersion.getPluginMessageVersion(), "" + config.getBroadcast());
|
||||
} else {
|
||||
debug("Not sending vote because user isn't on server " + serverToCheck + ": "
|
||||
+ cache.toString());
|
||||
@@ -153,7 +158,7 @@ public class VotingPluginVelocity {
|
||||
|
||||
}
|
||||
|
||||
public void checkOnlineVotes(Player player, String uuid, RegisteredServer serverToCheck) {
|
||||
public synchronized void checkOnlineVotes(Player player, String uuid, RegisteredServer serverToCheck) {
|
||||
if (player != null && player.isActive() && cachedOnlineVotes.containsKey(uuid)) {
|
||||
ArrayList<OfflineBungeeVote> c = cachedOnlineVotes.get(uuid);
|
||||
if (!c.isEmpty()) {
|
||||
@@ -165,7 +170,7 @@ public class VotingPluginVelocity {
|
||||
sendPluginMessageServer(serverToCheck, "VoteOnline", cache.getPlayerName(), cache.getUuid(),
|
||||
cache.getService(), "" + cache.getTime(), Boolean.FALSE.toString(),
|
||||
"" + cache.isRealVote(), cache.getText(), "" + getConfig().getBungeeManageTotals(),
|
||||
"" + BungeeVersion.getPluginMessageVersion());
|
||||
"" + BungeeVersion.getPluginMessageVersion(), "" + config.getBroadcast());
|
||||
}
|
||||
cachedOnlineVotes.put(uuid, new ArrayList<OfflineBungeeVote>());
|
||||
}
|
||||
@@ -194,7 +199,7 @@ public class VotingPluginVelocity {
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
|
||||
// Parse JSON response and get UUID
|
||||
JsonElement element = new JsonParser().parse(bufferedReader);
|
||||
JsonElement element = JsonParser.parseReader(bufferedReader);
|
||||
JsonObject object = element.getAsJsonObject();
|
||||
String uuidAsString = object.get("id").getAsString();
|
||||
|
||||
@@ -312,9 +317,22 @@ public class VotingPluginVelocity {
|
||||
} else if (subchannel.equalsIgnoreCase("login")) {
|
||||
String player = in.readUTF();
|
||||
debug("Login: " + player);
|
||||
Player p = server.getPlayer(player).get();
|
||||
checkCachedVotes(p.getCurrentServer().get().getServer());
|
||||
checkOnlineVotes(p, p.getUniqueId().toString(), p.getCurrentServer().get().getServer());
|
||||
if (server.getPlayer(player).isPresent()) {
|
||||
Player p = server.getPlayer(player).get();
|
||||
if (p.getCurrentServer().isPresent()) {
|
||||
final RegisteredServer server = p.getCurrentServer().get().getServer();
|
||||
final Player p1 = p;
|
||||
timer.schedule(new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
checkCachedVotes(server);
|
||||
checkOnlineVotes(p1, p.getUniqueId().toString(), server);
|
||||
}
|
||||
}, 0);
|
||||
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -357,10 +375,12 @@ public class VotingPluginVelocity {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
voteCacheFile.save();
|
||||
}
|
||||
voteCacheFile.save();
|
||||
nonVotedPlayersCache.save();
|
||||
if (mysql != null) {
|
||||
mysql.shutDown();
|
||||
}
|
||||
logger.info("VotingPlugin disabled");
|
||||
}
|
||||
|
||||
@@ -411,14 +431,10 @@ public class VotingPluginVelocity {
|
||||
server.getCommandManager().register(meta, new VotingPluginVelocityCommand(this));
|
||||
|
||||
if (mysqlLoaded) {
|
||||
if (method.equals(BungeeMethod.MYSQL)) {
|
||||
// this.getProxy().registerChannel("vp:vp");
|
||||
|
||||
} else if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
voteCacheFile = new VoteCache(new File(dataDirectory.toFile(), "votecache.yml"));
|
||||
nonVotedPlayersCache = new NonVotedPlayersCache(
|
||||
new File(dataDirectory.toFile(), "nonvotedplayerscache.yml"), this);
|
||||
|
||||
voteCacheFile = new VoteCache(new File(dataDirectory.toFile(), "votecache.yml"));
|
||||
nonVotedPlayersCache = new NonVotedPlayersCache(
|
||||
new File(dataDirectory.toFile(), "nonvotedplayerscache.yml"), this);
|
||||
if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
try {
|
||||
for (String serverToCheck : voteCacheFile.getServers()) {
|
||||
ArrayList<OfflineBungeeVote> vote = new ArrayList<OfflineBungeeVote>();
|
||||
@@ -460,7 +476,9 @@ public class VotingPluginVelocity {
|
||||
}
|
||||
|
||||
for (String player : cachedOnlineVotes.keySet()) {
|
||||
checkOnlineVotes(server.getPlayer(UUID.fromString(player)).get(), player, null);
|
||||
if (server.getPlayer(UUID.fromString(player)).isPresent()) {
|
||||
checkOnlineVotes(server.getPlayer(UUID.fromString(player)).get(), player, null);
|
||||
}
|
||||
}
|
||||
}).delay(15L, TimeUnit.SECONDS).repeat(30l, TimeUnit.SECONDS).schedule();
|
||||
|
||||
@@ -518,6 +536,10 @@ public class VotingPluginVelocity {
|
||||
}
|
||||
}
|
||||
|
||||
currentVotePartyVotesRequired = getConfig().getVotePartyVotesRequired()
|
||||
+ voteCacheFile.getVotePartyInreaseVotesRequired();
|
||||
votePartyVotes = voteCacheFile.getVotePartyCurrentVotes();
|
||||
|
||||
try {
|
||||
getVersionFile();
|
||||
if (versionFile != null) {
|
||||
@@ -544,12 +566,20 @@ public class VotingPluginVelocity {
|
||||
|
||||
metrics.addCustomChart(new SimplePie("plugin_version", () -> "" + version));
|
||||
|
||||
if (!buildNumber.equals("NOTSET")) {
|
||||
metrics.addCustomChart(new SimplePie("dev_build_number", () -> "" + buildNumber));
|
||||
}
|
||||
|
||||
logger.info("VotingPlugin velocity loaded, method: " + method.toString() + ", PluginMessagingVersion: "
|
||||
+ BungeeVersion.getPluginMessageVersion() + ", Internal Jar Version: " + version);
|
||||
if (!buildNumber.equals("NOTSET")) {
|
||||
logger.info("Detected using dev build number: " + buildNumber);
|
||||
}
|
||||
}
|
||||
|
||||
private String version = "";
|
||||
private File versionFile;
|
||||
private String buildNumber = "NOTSET";
|
||||
|
||||
private void getVersionFile() {
|
||||
try {
|
||||
@@ -585,6 +615,7 @@ public class VotingPluginVelocity {
|
||||
ConfigurationNode node = loader.load();
|
||||
if (node != null) {
|
||||
version = node.getNode("version").getString("");
|
||||
buildNumber = node.getNode("buildnumber").getString("NOTSET");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -599,19 +630,20 @@ public class VotingPluginVelocity {
|
||||
|
||||
@Subscribe
|
||||
public void onVotifierEvent(VotifierEvent event) {
|
||||
server.getScheduler().buildTask(this, new Runnable() {
|
||||
final String serviceSiteVote = event.getVote().getServiceName();
|
||||
final String name = event.getVote().getUsername();
|
||||
timer.schedule(new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Vote vote = event.getVote();
|
||||
String serviceSite = vote.getServiceName();
|
||||
logger.info("Vote received " + vote.getUsername() + " from service site " + serviceSite);
|
||||
String serviceSite = serviceSiteVote;
|
||||
logger.info("Vote received " + name + " from service site " + serviceSite);
|
||||
if (serviceSite.isEmpty()) {
|
||||
serviceSite = "Empty";
|
||||
}
|
||||
vote(vote.getUsername(), serviceSite, true);
|
||||
vote(name, serviceSite, true);
|
||||
}
|
||||
});
|
||||
}, 0);
|
||||
|
||||
}
|
||||
|
||||
@@ -641,6 +673,8 @@ public class VotingPluginVelocity {
|
||||
|
||||
public void reload(boolean loadMySQL) {
|
||||
config.reload();
|
||||
currentVotePartyVotesRequired = getConfig().getVotePartyVotesRequired()
|
||||
+ voteCacheFile.getVotePartyInreaseVotesRequired();
|
||||
if (loadMySQL) {
|
||||
if (!config.getString(config.getNode("Host"), "").isEmpty()) {
|
||||
loadMysql();
|
||||
@@ -746,6 +780,7 @@ public class VotingPluginVelocity {
|
||||
String uuid = getUUID(player);
|
||||
if (uuid.isEmpty()) {
|
||||
if (config.getAllowUnJoined()) {
|
||||
debug("Fetching UUID online, since allowunjoined is enabled");
|
||||
UUID u = null;
|
||||
try {
|
||||
u = fetchUUID(player);
|
||||
@@ -842,17 +877,24 @@ public class VotingPluginVelocity {
|
||||
sendPluginMessageServer(s, "Vote", player, uuid, service, "" + time,
|
||||
Boolean.TRUE.toString(), "" + realVote, text.toString(),
|
||||
"" + getConfig().getBungeeManageTotals(),
|
||||
"" + BungeeVersion.getPluginMessageVersion());
|
||||
"" + BungeeVersion.getPluginMessageVersion(), "" + config.getBroadcast());
|
||||
}
|
||||
if (config.getBroadcast()) {
|
||||
sendPluginMessageServer(s, "VoteBroadcast", uuid, player, service);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Player p = server.getPlayer(UUID.fromString(uuid)).get();
|
||||
Player p = null;
|
||||
if (server.getPlayer(UUID.fromString(uuid)).isPresent()) {
|
||||
p = server.getPlayer(UUID.fromString(uuid)).get();
|
||||
}
|
||||
if (p != null && p.isActive() && !config.getBlockedServers()
|
||||
.contains(p.getCurrentServer().get().getServerInfo().getName())) {
|
||||
sendPluginMessageServer(p.getCurrentServer().get().getServer(), "VoteOnline", player, uuid,
|
||||
service, "" + time, Boolean.TRUE.toString(), "" + realVote, text.toString(),
|
||||
"" + getConfig().getBungeeManageTotals(), "" + BungeeVersion.getPluginMessageVersion());
|
||||
"" + getConfig().getBungeeManageTotals(), "" + BungeeVersion.getPluginMessageVersion(),
|
||||
"" + config.getBroadcast());
|
||||
} else {
|
||||
if (!cachedOnlineVotes.containsKey(uuid)) {
|
||||
cachedOnlineVotes.put(uuid, new ArrayList<OfflineBungeeVote>());
|
||||
@@ -868,6 +910,9 @@ public class VotingPluginVelocity {
|
||||
|
||||
for (RegisteredServer s : server.getAllServers()) {
|
||||
sendPluginMessageServer(s, "VoteUpdate", uuid);
|
||||
if (config.getBroadcast()) {
|
||||
sendPluginMessageServer(s, "VoteBroadcast", uuid, player, service);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
@@ -877,4 +922,72 @@ public class VotingPluginVelocity {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private int votePartyVotes = 0;
|
||||
private int currentVotePartyVotesRequired = 0;
|
||||
|
||||
public void addCurrentVotePartyVotes(int amount) {
|
||||
votePartyVotes += amount;
|
||||
voteCacheFile.setVotePartyCurrentVotes(votePartyVotes);
|
||||
debug("Current vote party total: " + votePartyVotes);
|
||||
}
|
||||
|
||||
public void addVoteParty() {
|
||||
if (getConfig().getVotePartyEnabled()) {
|
||||
addCurrentVotePartyVotes(1);
|
||||
|
||||
if (votePartyVotes >= currentVotePartyVotesRequired) {
|
||||
debug("Current vote party total: " + votePartyVotes);
|
||||
addCurrentVotePartyVotes(-currentVotePartyVotesRequired);
|
||||
|
||||
currentVotePartyVotesRequired += getConfig().getVotePartyIncreaseVotesRequired();
|
||||
voteCacheFile.setVotePartyInreaseVotesRequired(voteCacheFile.getVotePartyInreaseVotesRequired()
|
||||
+ getConfig().getVotePartyIncreaseVotesRequired());
|
||||
|
||||
if (!getConfig().getVotePartyBroadcast().isEmpty()) {
|
||||
for (RegisteredServer server : getVotePartyServers()) {
|
||||
if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
sendPluginMessageServer(server, "VotePartyBroadcast", config.getVotePartyBroadcast());
|
||||
} else if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
sendServerMessageServer(server.getServerInfo().getName(), config.getVotePartyBroadcast());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (String command : getConfig().getVotePartyBungeeCommands()) {
|
||||
server.getCommandManager().executeAsync(server.getConsoleCommandSource(), command);
|
||||
}
|
||||
|
||||
if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
for (RegisteredServer server : getVotePartyServers()) {
|
||||
sendVoteParty(server);
|
||||
}
|
||||
}
|
||||
}
|
||||
voteCacheFile.save();
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<RegisteredServer> getVotePartyServers() {
|
||||
if (getConfig().getVotePartySendToAllServers()) {
|
||||
return server.getAllServers();
|
||||
}
|
||||
Collection<RegisteredServer> list = new ArrayList<RegisteredServer>();
|
||||
for (String server : getConfig().getVotePartyServersToSend()) {
|
||||
if (this.server.getServer(server).isPresent()) {
|
||||
list.add(this.server.getServer(server).get());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void sendVoteParty(RegisteredServer server) {
|
||||
if (!server.getPlayersConnected().isEmpty()) {
|
||||
if (method.equals(BungeeMethod.PLUGINMESSAGING)) {
|
||||
sendPluginMessageServer(server, "VotePartyBungee");
|
||||
} else if (method.equals(BungeeMethod.SOCKETS)) {
|
||||
sendServerMessageServer(server.getServerInfo().getName(), "VotePartyBungee");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,6 +318,16 @@ public class CommandLoader {
|
||||
+ user.getMilestoneCount());
|
||||
user.setHasGotteMilestone(num, true);
|
||||
}
|
||||
} else {
|
||||
if (user.hasGottenMilestone(num)) {
|
||||
sendMessage(sender,
|
||||
"&cMilestone " + num + " for " + user.getPlayerName()
|
||||
+ " already given when it shouldn't be, Current AllTimeTotal: "
|
||||
+ user.getTotal(TopVoter.AllTime) + ", Current MileStoneCount: "
|
||||
+ user.getMilestoneCount());
|
||||
user.setHasGotteMilestone(num, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -363,6 +373,7 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.clearCache();
|
||||
synchronized (pointLock) {
|
||||
user.addPoints(Integer.parseInt(args[3]));
|
||||
}
|
||||
@@ -378,6 +389,7 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(args[1]);
|
||||
user.clearCache();
|
||||
user.removePoints(Integer.parseInt(args[3]));
|
||||
sender.sendMessage(StringParser.getInstance().colorize("&cRemoved " + args[3] + " points from "
|
||||
+ args[1] + ", " + args[1] + " now has " + user.getPoints() + " points"));
|
||||
@@ -622,6 +634,12 @@ public class CommandLoader {
|
||||
|
||||
sendMessage(sender,
|
||||
"Using AdvancedCore " + plugin.getVersion() + "' built on '" + plugin.getBuildTime());
|
||||
if (!plugin.getAdvancedCoreBuildNumber().equals("NOTSET")) {
|
||||
sendMessage(sender, "AdvancedCore Jenkins build number: " + plugin.getAdvancedCoreBuildNumber());
|
||||
}
|
||||
if (!plugin.getBuildNumber().equals("NOTSET")) {
|
||||
sendMessage(sender, "Using votingplugin jenkins build: " + plugin.getBuildNumber());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1995,7 +2013,8 @@ public class CommandLoader {
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
new VoteTopVoter(plugin, sender, null, top, 1).open(GUIMethod.CHAT);
|
||||
new VoteTopVoter(plugin, sender, null, top, 1)
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2005,7 +2024,8 @@ public class CommandLoader {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
int page = Integer.parseInt(args[2]);
|
||||
new VoteTopVoter(plugin, sender, null, top, page).open(GUIMethod.CHAT);
|
||||
new VoteTopVoter(plugin, sender, null, top, page)
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2017,7 +2037,8 @@ public class CommandLoader {
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
int page = Integer.parseInt(args[1]);
|
||||
|
||||
new VoteTopVoter(plugin, sender, null, TopVoter.getDefault(), page).open(GUIMethod.CHAT);
|
||||
new VoteTopVoter(plugin, sender, null, TopVoter.getDefault(), page)
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodTopVoter().toUpperCase()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -149,6 +149,15 @@ public class AdminGUI {
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder(Material.STONE, 1).setName("&cEdit BungeeVotePartyRewards")) {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
RewardEditGUI.getInstance().openRewardGUI(clickEvent.getPlayer(),
|
||||
RewardHandler.getInstance().getDirectlyDefined("BungeeVotePartyRewards"));
|
||||
}
|
||||
});
|
||||
|
||||
buttons.add(new BInventoryButton(new ItemBuilder("GRASS_BLOCK").setName("&cEdit BungeeSettings.yml")) {
|
||||
|
||||
@Override
|
||||
|
||||
+9
@@ -95,6 +95,15 @@ public class AdminVoteBungeeSettings extends GUIHandler {
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("PerServerMilestones", plugin.getBungeeSettings().isPerServerMilestones()) {
|
||||
|
||||
@Override
|
||||
public void setValue(Player player, boolean value) {
|
||||
setPathData(getKey(), value);
|
||||
}
|
||||
}));
|
||||
|
||||
inv.addButton(new EditGUIButton(
|
||||
new EditGUIValueBoolean("PerServerPoints", plugin.getBungeeSettings().isPerServerPoints()) {
|
||||
|
||||
|
||||
@@ -51,7 +51,11 @@ public class VoteShop extends GUIHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.user == null) {
|
||||
user = plugin.getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
}
|
||||
BInventory inv = new BInventory(plugin.getGui().getChestVoteShopName());
|
||||
inv.addPlaceholder("points", "" + user.getPoints());
|
||||
inv.dontClose();
|
||||
|
||||
for (final String identifier : plugin.getGui().getChestShopIdentifiers()) {
|
||||
@@ -68,7 +72,6 @@ public class VoteShop extends GUIHandler {
|
||||
|
||||
boolean limitPass = true;
|
||||
if (limit > 0) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
if (user.getVoteShopIdentifierLimit(identifier) >= limit) {
|
||||
limitPass = false;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class VoteShopConfirm extends GUIHandler {
|
||||
if (plugin.getGui().getChestVoteShopCloseGUI(identifier)) {
|
||||
event.getButton().getInv().closeInv(player, null);
|
||||
} else {
|
||||
new VoteShop(plugin, event.getPlayer(), user);
|
||||
new VoteShop(plugin, event.getPlayer(), user).open();;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -104,8 +104,8 @@ public class VoteTopVoter extends GUIHandler {
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
if (plugin.getGui().getChestVoteTopOpenMainGUIOnClick()) {
|
||||
VotingPluginUser user = (VotingPluginUser) getData("User");
|
||||
new VoteGUI(plugin, player, user)
|
||||
TopVoterPlayer user = (TopVoterPlayer) getData("User");
|
||||
new VoteGUI(plugin, player, user.getUser())
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
|
||||
} else {
|
||||
getInv().forceClose(clickEvent.getPlayer());
|
||||
|
||||
+2
-2
@@ -74,8 +74,8 @@ public class VoteTopVoterLastMonth extends GUIHandler {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
VotingPluginUser user = (VotingPluginUser) getData("User");
|
||||
new VoteGUI(plugin, player, user)
|
||||
TopVoterPlayer user = (TopVoterPlayer) getData("User");
|
||||
new VoteGUI(plugin, player, user.getUser())
|
||||
.open(GUIMethod.valueOf(plugin.getGui().getGuiMethodGUI().toUpperCase()));
|
||||
}
|
||||
}.addData("player", entry.getKey().getPlayerName()).addData("User", entry.getKey()));
|
||||
|
||||
@@ -41,6 +41,10 @@ public class BungeeSettings extends YMLFile {
|
||||
@Getter
|
||||
private boolean perServerPoints = false;
|
||||
|
||||
@ConfigDataBoolean(path = "PerServerMilestones")
|
||||
@Getter
|
||||
private boolean perServerMilestones = false;
|
||||
|
||||
@ConfigDataBoolean(path = "PerServerRewards")
|
||||
@Getter
|
||||
private boolean perServerRewards = false;
|
||||
@@ -73,6 +77,10 @@ public class BungeeSettings extends YMLFile {
|
||||
@Getter
|
||||
private boolean votifierBypass = false;
|
||||
|
||||
@ConfigDataBoolean(path = "DisableBroadcast")
|
||||
@Getter
|
||||
private boolean disableBroadcast = false;
|
||||
|
||||
public BungeeSettings(VotingPluginMain plugin) {
|
||||
super(plugin, new File(plugin.getDataFolder(), "BungeeSettings.yml"));
|
||||
}
|
||||
|
||||
@@ -117,6 +117,10 @@ public class Config extends YMLFile {
|
||||
@Getter
|
||||
private boolean extraAllSitesCheck = false;
|
||||
|
||||
@ConfigDataBoolean(path = "CloseInventoryOnVote")
|
||||
@Getter
|
||||
private boolean closeInventoryOnVote = true;
|
||||
|
||||
@ConfigDataBoolean(path = "ExtraBackgroundUpdate")
|
||||
@Getter
|
||||
private boolean extraBackgroundUpdate = false;
|
||||
|
||||
@@ -34,6 +34,10 @@ public class SpecialRewardsConfig extends YMLFile {
|
||||
@Getter
|
||||
private boolean enableWeeklyAwards = false;
|
||||
|
||||
@ConfigDataBoolean(path = "OnlyOneCumulative")
|
||||
@Getter
|
||||
private boolean onlyOneCumulative = false;
|
||||
|
||||
@Getter
|
||||
private String firstVoteRewardsPath = "FirstVote";
|
||||
|
||||
|
||||
@@ -76,6 +76,10 @@ public class PlayerVoteEvent extends Event {
|
||||
@Setter
|
||||
private boolean wasOnline;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean broadcast = true;
|
||||
|
||||
public PlayerVoteEvent(VoteSite voteSite, String voteUsername, String serviceSite, boolean realVote) {
|
||||
super(true);
|
||||
this.player = voteUsername;
|
||||
|
||||
@@ -103,26 +103,28 @@ public class PlayerVoteListener implements Listener {
|
||||
user = UserManager.getInstance().getVotingPluginUser(playerName);
|
||||
}
|
||||
|
||||
// reupdate cache
|
||||
user.clearCache();
|
||||
|
||||
user.updateName(true);
|
||||
|
||||
if (voteSite.isWaitUntilVoteDelay() && !user.canVoteSite(voteSite)) {
|
||||
plugin.getLogger().info(user.getPlayerName() + " must wait until votedelay is over, ignoring vote");
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (object) {
|
||||
// reupdate cache
|
||||
user.clearCache();
|
||||
user.cache();
|
||||
|
||||
user.updateName(true);
|
||||
|
||||
// vote party
|
||||
plugin.getVoteParty().vote(user, event.isRealVote(), event.isForceBungee());
|
||||
|
||||
// broadcast vote if enabled in config
|
||||
if (plugin.getConfigFile().isBroadcastVotesEnabled()
|
||||
&& (plugin.getBungeeSettings().isBungeeBroadcast() || !event.isBungee())) {
|
||||
if (!plugin.getConfigFile().getFormatBroadcastWhenOnline() || user.isOnline()) {
|
||||
voteSite.broadcastVote(user);
|
||||
if (event.isBroadcast() && !plugin.getBungeeSettings().isDisableBroadcast()) {
|
||||
// broadcast vote if enabled in config
|
||||
if (plugin.getConfigFile().isBroadcastVotesEnabled()
|
||||
&& (plugin.getBungeeSettings().isBungeeBroadcast() || !event.isBungee())) {
|
||||
if (!plugin.getConfigFile().getFormatBroadcastWhenOnline() || user.isOnline()) {
|
||||
voteSite.broadcastVote(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +169,9 @@ public class PlayerVoteListener implements Listener {
|
||||
}
|
||||
user.playerVote(voteSite, online, false, event.isForceBungee());
|
||||
user.sendVoteEffects(online);
|
||||
user.closeInv();
|
||||
if (plugin.getConfigFile().isCloseInventoryOnVote()) {
|
||||
user.closeInv();
|
||||
}
|
||||
} else {
|
||||
user.addOfflineVote(voteSite.getKey());
|
||||
plugin.debug(
|
||||
|
||||
@@ -52,13 +52,6 @@ public class VotiferEvent implements Listener {
|
||||
// ignore own plugin calls of event
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getServerData().addServiceSite(voteSite);
|
||||
}
|
||||
});
|
||||
|
||||
if (voteUsername.length() == 0) {
|
||||
plugin.getLogger().warning("No name from vote on " + voteSite);
|
||||
@@ -76,12 +69,12 @@ public class VotiferEvent implements Listener {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
plugin.getServerData().addServiceSite(voteSite);
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord() && !plugin.getBungeeSettings().isVotifierBypass()
|
||||
&& (plugin.getBungeeHandler().getMethod().equals(BungeeMethod.PLUGINMESSAGING)
|
||||
|| plugin.getBungeeHandler().getMethod().equals(BungeeMethod.SOCKETS))) {
|
||||
plugin.getLogger().severe(
|
||||
"Ignoring vote from votifier since pluginmessaging or socket bungee method is enabled, this means you aren't setup correctly for those methods");
|
||||
"Ignoring vote from votifier since pluginmessaging or socket bungee method is enabled, this means you aren't setup correctly for those methods, please check: https://github.com/BenCodez/VotingPlugin/wiki/Bungeecord-Setups");
|
||||
return;
|
||||
}
|
||||
String voteSiteNameStr = plugin.getVoteSiteName(false, voteSite);
|
||||
|
||||
@@ -94,10 +94,14 @@ public class SpecialRewards {
|
||||
}
|
||||
|
||||
if (gotCumulative) {
|
||||
gotCumulativeAny = true;
|
||||
plugin.debug(user.getPlayerName() + " got cumulative " + votesRequired + ", total: "
|
||||
+ top.toString() + ", current total: " + total);
|
||||
giveCumulativeVoteReward(user, user.isOnline(), votesRequired, forceBungee);
|
||||
if (!plugin.getSpecialRewardsConfig().isOnlyOneCumulative() || !gotCumulativeAny) {
|
||||
gotCumulativeAny = true;
|
||||
plugin.debug(user.getPlayerName() + " got cumulative " + votesRequired + ", total: "
|
||||
+ top.toString() + ", current total: " + total);
|
||||
giveCumulativeVoteReward(user, user.isOnline(), votesRequired, forceBungee);
|
||||
} else {
|
||||
plugin.debug("Already got one cumulative");
|
||||
}
|
||||
} else {
|
||||
plugin.devDebug(user.getPlayerName() + " not able to get cumulative " + votesRequired
|
||||
+ ", total required: " + top.toString() + ", current player total: " + total);
|
||||
@@ -187,6 +191,8 @@ public class SpecialRewards {
|
||||
plugin.debug(user.getPlayerName() + " got milestone " + votesRequired);
|
||||
|
||||
}
|
||||
} else {
|
||||
plugin.debug("Milestone " + votesRequired + " not enabled or has no rewards");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -57,10 +57,8 @@ public class CheckUpdate {
|
||||
final Updater.UpdateResult result = plugin.getUpdater().getResult();
|
||||
switch (result) {
|
||||
case UPDATE_AVAILABLE: {
|
||||
plugin.getLogger()
|
||||
.info(plugin.getName() + " has an update available! Your Version: "
|
||||
+ plugin.getDescription().getVersion() + " New Version: " + plugin.getUpdater().getVersion()
|
||||
+ " Use /av download to get the latest update!");
|
||||
plugin.getLogger().info(plugin.getName() + " has an update available! Your Version: "
|
||||
+ plugin.getDescription().getVersion() + " New Version: " + plugin.getUpdater().getVersion());
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
@@ -159,7 +159,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
|
||||
public void bungeeVote(String service, BungeeMessageData text, boolean setTotals) {
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
VotingPluginMain.plugin.debug("Bungee vote for " + getPlayerName() + " on " + service);
|
||||
plugin.debug("Bungee vote for " + getPlayerName() + " on " + service);
|
||||
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(service, true), getPlayerName(), service,
|
||||
true);
|
||||
@@ -180,7 +180,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
|
||||
public void bungeeVoteOnline(String service, BungeeMessageData text, boolean setTotals) {
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
VotingPluginMain.plugin.debug("Bungee online vote for " + getPlayerName() + " on " + service);
|
||||
plugin.debug("Bungee online vote for " + getPlayerName() + " on " + service);
|
||||
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(service, true), getPlayerName(), service,
|
||||
true);
|
||||
@@ -200,9 +200,9 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
}
|
||||
|
||||
public void bungeeVotePluginMessaging(String service, long time, BungeeMessageData text, boolean setTotals,
|
||||
boolean wasOnline) {
|
||||
boolean wasOnline, boolean broadcast) {
|
||||
if (plugin.getBungeeSettings().isUseBungeecoord()) {
|
||||
VotingPluginMain.plugin.debug("Pluginmessaging vote for " + getPlayerName() + " on " + service);
|
||||
plugin.debug("Pluginmessaging vote for " + getPlayerName() + " on " + service);
|
||||
|
||||
PlayerVoteEvent voteEvent = new PlayerVoteEvent(plugin.getVoteSite(service, true), getPlayerName(), service,
|
||||
true);
|
||||
@@ -213,6 +213,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
voteEvent.setAddTotals(setTotals);
|
||||
voteEvent.setBungeeTextTotals(text);
|
||||
voteEvent.setWasOnline(wasOnline);
|
||||
voteEvent.setBroadcast(broadcast);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
@@ -267,7 +268,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
try {
|
||||
LocalDateTime now = plugin.getTimeChecker().getTime();
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault())
|
||||
.plusHours(VotingPluginMain.plugin.getOptions().getTimeHourOffSet());
|
||||
.plusHours(plugin.getOptions().getTimeHourOffSet());
|
||||
|
||||
if (!voteSite.isVoteDelayDaily()) {
|
||||
double votedelay = voteSite.getVoteDelay();
|
||||
@@ -305,12 +306,14 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
ArrayList<Integer> days = new ArrayList<Integer>();
|
||||
|
||||
for (VoteSite voteSite : plugin.getVoteSites()) {
|
||||
long time = user.getTime(voteSite);
|
||||
if (time != 0) {
|
||||
months.add(MiscUtils.getInstance().getMonthFromMili(time));
|
||||
days.add(MiscUtils.getInstance().getDayFromMili(time));
|
||||
} else {
|
||||
return false;
|
||||
if (voteSite.isEnabled() && !voteSite.isHidden()) {
|
||||
long time = user.getTime(voteSite);
|
||||
if (time != 0) {
|
||||
months.add(MiscUtils.getInstance().getMonthFromMili(time));
|
||||
days.add(MiscUtils.getInstance().getDayFromMili(time));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,7 +400,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
|
||||
public HashMap<String, Boolean> getHasGottenMilestone() {
|
||||
HashMap<String, Boolean> hasGottenMilestone = new HashMap<String, Boolean>();
|
||||
ArrayList<String> milestoneList = getUserData().getStringList("GottenMileStones");
|
||||
ArrayList<String> milestoneList = getUserData().getStringList(getGottenMilestonesPath());
|
||||
for (String str : milestoneList) {
|
||||
String[] data = str.split("//");
|
||||
if (data.length > 1) {
|
||||
@@ -569,27 +572,6 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
.setOnline(isOnline()).send(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* public Integer hasLastCumulative(int votesRequired) { HashMap<Integer,
|
||||
* Integer> lastCumative = getLastCumulatives(); if
|
||||
* (lastCumative.containsKey(votesRequired)) { return
|
||||
* lastCumative.get(votesRequired); } return 0; } public HashMap<Integer,
|
||||
* Integer> getLastCumulatives() { HashMap<Integer, Integer> lastCumulative =
|
||||
* new HashMap<Integer, Integer>(); ArrayList<String> milestoneList =
|
||||
* getUserData().getStringList("LastCumulative"); for (String str :
|
||||
* milestoneList) { String[] data = str.split("//"); if (data.length > 1) { try
|
||||
* { lastCumulative.put(Integer.parseInt(data[0]), Integer.parseInt(data[1])); }
|
||||
* catch (Exception e) { e.printStackTrace(); } } } return lastCumulative; }
|
||||
* public void setLastCumulatives(HashMap<Integer, Integer> lastCumulative) {
|
||||
* ArrayList<String> data = new ArrayList<String>(); for (Entry<Integer,
|
||||
* Integer> entry : lastCumulative.entrySet()) { String str = entry.getKey() +
|
||||
* "//" + entry.getValue(); data.add(str); }
|
||||
* getUserData().setStringList("LastCumulative", data); } public void
|
||||
* setLastCumulative(int votesRequired, int value) { HashMap<Integer, Integer>
|
||||
* lastCumulative = getLastCumulatives(); lastCumulative.put(votesRequired,
|
||||
* value); setLastCumulatives(lastCumulative); }
|
||||
*/
|
||||
|
||||
public void giveMonthlyTopVoterAward(int place, String path) {
|
||||
new RewardBuilder(plugin.getSpecialRewardsConfig().getData(),
|
||||
plugin.getSpecialRewardsConfig().getMonthlyAwardRewardsPath(path)).withPlaceHolder("place", "" + place)
|
||||
@@ -686,14 +668,14 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
* Off vote.
|
||||
*/
|
||||
public void offVote() {
|
||||
if (!VotingPluginMain.plugin.getOptions().isProcessRewards()) {
|
||||
VotingPluginMain.plugin.debug("Processing rewards is disabled");
|
||||
if (!plugin.getOptions().isProcessRewards()) {
|
||||
plugin.debug("Processing rewards is disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = getPlayer();
|
||||
if (player != null) {
|
||||
VotingPluginMain.plugin.extraDebug("Checking offline vote site votes for " + player.getName());
|
||||
plugin.extraDebug("Checking offline vote site votes for " + player.getName());
|
||||
|
||||
boolean topVoterIngorePerm = player.hasPermission("VotingPlugin.TopVoter.Ignore");
|
||||
if (isTopVoterIgnore() != topVoterIngorePerm) {
|
||||
@@ -719,7 +701,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
|
||||
public void playerVote(VoteSite voteSite, boolean online, boolean broadcast, boolean bungee) {
|
||||
if (plugin.getConfigFile().getFormatBroadcastWhenOnline() && plugin.getConfigFile().isBroadcastVotesEnabled()
|
||||
&& broadcast) {
|
||||
&& broadcast && !plugin.getBungeeSettings().isDisableBroadcast()) {
|
||||
voteSite.broadcastVote(this);
|
||||
}
|
||||
voteSite.giveRewards(this, online, bungee);
|
||||
@@ -806,7 +788,14 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
String str = entry.getKey() + "//" + entry.getValue().booleanValue();
|
||||
data.add(str);
|
||||
}
|
||||
getUserData().setStringList("GottenMileStones", data);
|
||||
getUserData().setStringList(getGottenMilestonesPath(), data);
|
||||
}
|
||||
|
||||
public String getGottenMilestonesPath() {
|
||||
if (plugin.getBungeeSettings().isPerServerMilestones()) {
|
||||
return plugin.getOptions().getServer() + "_" + "GottenMilestones";
|
||||
}
|
||||
return "GottenMileStones";
|
||||
}
|
||||
|
||||
public void setHighestDailyTotal(int total) {
|
||||
@@ -1081,7 +1070,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
LocalDateTime now = plugin.getTimeChecker().getTime();
|
||||
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault())
|
||||
.plusHours(VotingPluginMain.plugin.getOptions().getTimeHourOffSet());
|
||||
.plusHours(plugin.getOptions().getTimeHourOffSet());
|
||||
|
||||
if (!voteSite.isVoteDelayDaily()) {
|
||||
double votedelay = voteSite.getVoteDelay();
|
||||
@@ -1178,7 +1167,7 @@ public class VotingPluginUser extends com.bencodez.advancedcore.api.user.Advance
|
||||
LocalDateTime now = plugin.getTimeChecker().getTime();
|
||||
|
||||
LocalDateTime lastVote = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault())
|
||||
.plusHours(VotingPluginMain.plugin.getOptions().getTimeHourOffSet());
|
||||
.plusHours(plugin.getOptions().getTimeHourOffSet());
|
||||
|
||||
if (!voteSite.isVoteDelayDaily()) {
|
||||
double votedelay = voteSite.getVoteDelay();
|
||||
|
||||
@@ -62,7 +62,7 @@ public class VoteReminding {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (plugin != null) {
|
||||
if (plugin != null && plugin.isEnabled()) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
checkRemind(user);
|
||||
|
||||
Reference in new issue
Block a user