Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54d20e9e50 | ||
|
|
fd0e361474 | ||
|
|
551e38f882 | ||
|
|
d18f04c010 | ||
|
|
3b7f3043f1 | ||
|
|
faf2a8d083 | ||
|
|
42071e3bad | ||
|
|
978d32e947 | ||
|
|
fe670cb3e2 | ||
|
|
d2f4a7d9a5 | ||
|
|
b162ce1825 | ||
|
|
fbdcce3c3b | ||
|
|
2d939f095c | ||
|
|
034e2f2b98 | ||
|
|
f429ab0a60 | ||
|
|
5578d0879b | ||
|
|
8b1e6244ea | ||
|
|
49c7b9c775 | ||
|
|
da1c724464 | ||
|
|
de15150a04 | ||
|
|
0d1fb2b260 | ||
|
|
55d0779a33 | ||
|
|
8f41d464e1 | ||
|
|
1db2b6c934 | ||
|
|
aa58f76057 | ||
|
|
1def0a1061 | ||
|
|
3b4a66b04e | ||
|
|
7384b2e55c | ||
|
|
f8eaed445a | ||
|
|
dfef9190ca | ||
|
|
7ce61834c2 | ||
|
|
240a7ab242 | ||
|
|
b3de59bfba | ||
|
|
5d5de39845 | ||
|
|
59af774d09 | ||
|
|
18828207c0 | ||
|
|
5c67922996 | ||
|
|
af50a45e65 | ||
|
|
7ccd265a30 | ||
|
|
e76f22f071 | ||
|
|
3c03b719d2 | ||
|
|
cd71531766 | ||
|
|
282c116d02 | ||
|
|
820171916b | ||
|
|
136fbb0ba8 | ||
|
|
4f0c05c357 | ||
|
|
0377838a26 | ||
|
|
b72ff1b772 | ||
|
|
287488f1b6 | ||
|
|
9ffb67db1f | ||
|
|
a563c0a8a8 | ||
|
|
234086444f | ||
|
|
a93b0834a2 | ||
|
|
b5550dfe82 | ||
|
|
d99300ecac | ||
|
|
1c0688a172 | ||
|
|
ff3b117189 | ||
|
|
aaed1b32cd | ||
|
|
38c8e1d2c3 | ||
|
|
1e1792d132 | ||
|
|
b29462a5cb | ||
|
|
c9161ebe24 | ||
|
|
8441c6a8bf | ||
|
|
72c2ba77ee | ||
|
|
a097790b76 | ||
|
|
b7129e8aa8 | ||
|
|
ab9c2b8be1 | ||
|
|
a9a37b8fc8 | ||
|
|
d50cb67a26 | ||
|
|
5e42500308 | ||
|
|
50997a847f | ||
|
|
2305d85c01 | ||
|
|
33bbc35d88 | ||
|
|
28b3e100fb | ||
|
|
edae2d699b | ||
|
|
0cc477a769 | ||
|
|
53b84a999f | ||
|
|
49487c11ff | ||
|
|
0c4070b7a7 | ||
|
|
67909a4862 | ||
|
|
28ee563083 | ||
|
|
28b2b528c1 | ||
|
|
a53d9d0850 | ||
|
|
873a8812aa | ||
|
|
19ebc90963 | ||
|
|
dfbd1381de | ||
|
|
c9fe48a067 | ||
|
|
49b022b665 | ||
|
|
86be23ae5f | ||
|
|
420412978e | ||
|
|
25e2f4dae2 | ||
|
|
d767be96b5 | ||
|
|
6d73acca9b | ||
|
|
1f116374ad | ||
|
|
d0b7d96208 | ||
|
|
16285d7064 | ||
|
|
1f27084fe1 | ||
|
|
261aace0db | ||
|
|
344b910214 | ||
|
|
fbaa4896e1 | ||
|
|
2f93064f60 | ||
|
|
65b47c5e07 | ||
|
|
d70d01f2d3 | ||
|
|
769d7d3bcd | ||
|
|
a5f47688e0 | ||
|
|
7d2e6a25a4 | ||
|
|
69999b3b7a | ||
|
|
94d1bd4eb9 | ||
|
|
c18e8b7ab7 | ||
|
|
9f45187300 | ||
|
|
0c6ba8a9b7 | ||
|
|
1af69f2e8b | ||
|
|
a3b836b1c5 | ||
|
|
1eca6c81ad | ||
|
|
b9b4a78b5c | ||
|
|
fda23c5539 | ||
|
|
8297321971 | ||
|
|
cfeaf00f26 | ||
|
|
5ee1b32249 | ||
|
|
b69f0dc90e | ||
|
|
fe6cae4e47 | ||
|
|
b494b5c23c | ||
|
|
3bd3395128 | ||
|
|
3e3f63220d | ||
|
|
ccba0f042f | ||
|
|
abdd89259d | ||
|
|
256f203c48 | ||
|
|
205412b02c | ||
|
|
990289feb2 | ||
|
|
44b1ff1a1f | ||
|
|
f9e11bb9e5 | ||
|
|
eef1584b1c | ||
|
|
937dd84d1c | ||
|
|
80b9fe280b | ||
|
|
3892892792 | ||
|
|
519551e76c | ||
|
|
b30476ae3f | ||
|
|
9d417a12f1 | ||
|
|
fd5406b95d | ||
|
|
0ef59e557d | ||
|
|
15ed1db347 | ||
|
|
429d5b90d4 | ||
|
|
b3ab931aca | ||
|
|
21b42d0c72 | ||
|
|
7b1e1a27ba | ||
|
|
fb7b1e791f | ||
|
|
eecd59b387 | ||
|
|
ff7d8e0293 | ||
|
|
19c6d77a2c | ||
|
|
e002aa34e9 | ||
|
|
865e53a4a8 | ||
|
|
b8c652b7fb | ||
|
|
c4080f82dc | ||
|
|
1a33497e8f | ||
|
|
f8353b8eda | ||
|
|
4980ad54ec | ||
|
|
5363305411 | ||
|
|
6ff47619ad | ||
|
|
69315a3f74 | ||
|
|
8b1ddba672 | ||
|
|
bf63f0e209 | ||
|
|
450c923d24 | ||
|
|
9a922a6df5 | ||
|
|
08a5a9a021 | ||
|
|
61ad7d8533 | ||
|
|
52d2b3c096 | ||
|
|
b0a69cc048 | ||
|
|
74e445a62e | ||
|
|
91219202b2 | ||
|
|
a3545c83a0 | ||
|
|
31baf91e8f | ||
|
|
9a5f9d490e | ||
|
|
214cd53751 | ||
|
|
2be16882c7 | ||
|
|
75e2264b44 | ||
|
|
fd7a0eb6a5 | ||
|
|
177115f144 | ||
|
|
edbe31dc9c |
No files matched your search
+94
@@ -0,0 +1,94 @@
|
||||
.metadata
|
||||
dependencies/
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
.recommenders
|
||||
.project
|
||||
.externalToolBuilders/
|
||||
*.launch
|
||||
*.pydevproject
|
||||
*.jar
|
||||
.cproject
|
||||
.classpath
|
||||
.factorypath
|
||||
.buildpath
|
||||
.target
|
||||
.tern-project
|
||||
.texlipse
|
||||
.springBeans
|
||||
.recommenders/
|
||||
.cache-main
|
||||
.scala_dependencies
|
||||
.worksheet
|
||||
*.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
._*
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
*.class
|
||||
*.log
|
||||
*.ctxt
|
||||
.mtj.tmp/
|
||||
*.war
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
hs_err_pid*
|
||||
*.iml
|
||||
.idea
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.xml
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/mongoSettings.xml
|
||||
*.iws
|
||||
/out/
|
||||
.idea_modules/
|
||||
atlassian-ide-plugin.xml
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
!/.mvn/wrapper/maven-wrapper.jar
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
*.lnk
|
||||
@@ -0,0 +1,13 @@
|
||||
## Issue
|
||||
Include here how the problem occured and how it's reproduceable.
|
||||
If present, also paste the entire error message from the console, preferably via a https://hastebin.com/ link.
|
||||
|
||||
## Necessary server information
|
||||
**Running on**: <BungeeCord/Bukkit>
|
||||
|
||||
**Maintenance version**: <>
|
||||
|
||||
## Other information
|
||||
**Other motd changing plugins**: <>
|
||||
|
||||
**ProtocolLib version**: <>
|
||||
+674
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-api</artifactId>
|
||||
<name>Maintenance-API</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.13-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,40 @@
|
||||
package eu.kennytv.maintenance.api;
|
||||
|
||||
/**
|
||||
* @author KennyTV
|
||||
* @since 2.1
|
||||
*/
|
||||
public interface IMaintenance {
|
||||
|
||||
/**
|
||||
* Enables/disables maintenance mode.
|
||||
* If enabled, all non-permitted players will be kicked.
|
||||
* <p>
|
||||
* If using the BungeeCord version and MySQL is enabled,
|
||||
* it will also be written into the database.
|
||||
* </p>
|
||||
*
|
||||
* @param maintenance true to enable, false to disable maintenance mode
|
||||
*/
|
||||
void setMaintenance(boolean maintenance);
|
||||
|
||||
/**
|
||||
* @return true if maintenance is currently enabled
|
||||
*/
|
||||
boolean isMaintenance();
|
||||
|
||||
/**
|
||||
* @return true if a start- or endtimer task is currently running
|
||||
*/
|
||||
boolean isTaskRunning();
|
||||
|
||||
/**
|
||||
* @return version of the plugin
|
||||
*/
|
||||
String getVersion();
|
||||
|
||||
/**
|
||||
* @return {@link ISettings} for options regarding configuration files
|
||||
*/
|
||||
ISettings getSettings();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package eu.kennytv.maintenance.api;
|
||||
|
||||
/**
|
||||
* @author KennyTV
|
||||
* @since 2.2.2
|
||||
*/
|
||||
public interface IMaintenanceBase {
|
||||
|
||||
/**
|
||||
* Returns API instance of IMaintenance.
|
||||
*
|
||||
* @return {@link IMaintenance} instance
|
||||
*/
|
||||
IMaintenance getApi();
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package eu.kennytv.maintenance.api;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author KennyTV
|
||||
* @since 2.1
|
||||
*/
|
||||
public interface ISettings {
|
||||
|
||||
/**
|
||||
* Note that the value might need a few seconds to update, if you're on BungeeCord with MySQL enabled
|
||||
*
|
||||
* @return true if maintenance is currently enabled
|
||||
*/
|
||||
boolean isMaintenance();
|
||||
|
||||
/**
|
||||
* @return true if "send-join-notification" is set to true in the config
|
||||
*/
|
||||
boolean isJoinNotifications();
|
||||
|
||||
/**
|
||||
* @return true if "custom-maintenance-icon" is set to true in the config
|
||||
*/
|
||||
boolean hasCustomIcon();
|
||||
|
||||
/**
|
||||
* @return map of uuids of whitelisted players with their given names
|
||||
*/
|
||||
Map<UUID, String> getWhitelistedPlayers();
|
||||
|
||||
/**
|
||||
* Removes a player from the maintenance whitelist.
|
||||
*
|
||||
* @param uuid uuid of the player to remove
|
||||
* @return true if removing the player was successful
|
||||
*/
|
||||
boolean removeWhitelistedPlayer(UUID uuid);
|
||||
|
||||
/**
|
||||
* Removes a player from the maintenance whitelist.
|
||||
*
|
||||
* @param name name of the player to remove with original lower-/uppercase letters
|
||||
* @return true if removing the player was successful
|
||||
* @deprecated if a player changes their name, the list will still contain the old one
|
||||
* @see #removeWhitelistedPlayer(UUID)
|
||||
*/
|
||||
@Deprecated
|
||||
boolean removeWhitelistedPlayer(String name);
|
||||
|
||||
/**
|
||||
* Adds a player to the maintenance whitelist.
|
||||
*
|
||||
* @param uuid uuid of the player to add
|
||||
* @param name of the player to add
|
||||
* @return true if adding the player was successful
|
||||
*/
|
||||
boolean addWhitelistedPlayer(UUID uuid, String name);
|
||||
|
||||
/**
|
||||
* Reloads the maintenance-icon.png image from the server folder.
|
||||
*
|
||||
* @return true if loading the image was successful
|
||||
*/
|
||||
boolean reloadMaintenanceIcon();
|
||||
|
||||
boolean debugEnabled();
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package eu.kennytv.maintenance.api.bungee;
|
||||
|
||||
import eu.kennytv.maintenance.api.IMaintenance;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
|
||||
/**
|
||||
* @author KennyTV
|
||||
* @since 2.5
|
||||
*/
|
||||
public interface IMaintenanceBungee extends IMaintenance {
|
||||
|
||||
/**
|
||||
* Enables/disables maintenance mode on a proxied server.
|
||||
* If enabled, all non-permitted players will be kicked.
|
||||
* If MySQL is enabled, it will also be written into the database.
|
||||
*
|
||||
* @param maintenance true to enable, false to disable maintenance mode
|
||||
*/
|
||||
boolean setMaintenanceToServer(ServerInfo server, boolean maintenance);
|
||||
|
||||
/**
|
||||
* @return true if maintenance is currently enabled on the proxied server
|
||||
*/
|
||||
boolean isMaintenance(ServerInfo server);
|
||||
|
||||
/**
|
||||
* @return true if a start- or endtimer task is currently running regarding the proxied server
|
||||
*/
|
||||
boolean isServerTaskRunning(ServerInfo server);
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package eu.kennytv.maintenance.api.bungee;
|
||||
|
||||
import eu.kennytv.maintenance.api.IMaintenanceBase;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Utility class to get the {@link IMaintenanceBungee} instance for the BungeeCord version of the plugin.
|
||||
* <p>
|
||||
* Only access this class if you're running the plugin on a BungeeCord server!
|
||||
* </p>
|
||||
*
|
||||
* @author KennyTV
|
||||
* @since 2.5
|
||||
*/
|
||||
public final class MaintenanceBungeeAPI {
|
||||
|
||||
/**
|
||||
* Returns API instance of IMaintenance.
|
||||
*
|
||||
* @return {@link IMaintenanceBungee} instance
|
||||
*/
|
||||
public static IMaintenanceBungee getAPI() {
|
||||
final Plugin maintenance = ProxyServer.getInstance().getPluginManager().getPlugin("MaintenanceBungee");
|
||||
if (maintenance == null)
|
||||
ProxyServer.getInstance().getLogger().warning("Could not get instance of MaintenanceBungee!");
|
||||
return (IMaintenanceBungee) ((IMaintenanceBase) maintenance).getApi();
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package eu.kennytv.maintenance.api.spigot;
|
||||
|
||||
import eu.kennytv.maintenance.api.IMaintenance;
|
||||
import eu.kennytv.maintenance.api.IMaintenanceBase;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Utility class to get the {@link IMaintenance} instance for the Spigot version of the plugin.
|
||||
* <p>
|
||||
* Only access this class if you're running the plugin on a Spigot server!
|
||||
* </p>
|
||||
*
|
||||
* @author KennyTV
|
||||
* @since 2.5
|
||||
*/
|
||||
public final class MaintenanceSpigotAPI {
|
||||
|
||||
/**
|
||||
* Returns API instance of IMaintenance.
|
||||
*
|
||||
* @return {@link IMaintenance} instance
|
||||
*/
|
||||
public static IMaintenance getAPI() {
|
||||
final Plugin maintenance = Bukkit.getPluginManager().getPlugin("MaintenanceSpigot");
|
||||
if (maintenance == null)
|
||||
Bukkit.getLogger().warning("Could not get instance of MaintenanceSpigot!");
|
||||
return ((IMaintenanceBase) maintenance).getApi();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-bungee</artifactId>
|
||||
<name>MaintenanceBungee</name>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<artifactId>maintenance-core</artifactId>
|
||||
<version>${parent.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.13-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecrell</groupId>
|
||||
<artifactId>ServerListPlus</artifactId>
|
||||
<version>3.4.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package eu.kennytv.maintenance.bungee;
|
||||
|
||||
import eu.kennytv.maintenance.api.IMaintenance;
|
||||
import eu.kennytv.maintenance.api.IMaintenanceBase;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public final class MaintenanceBungeeBase extends Plugin implements IMaintenanceBase {
|
||||
private IMaintenance maintenance;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
maintenance = new MaintenanceBungeePlugin(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMaintenance getApi() {
|
||||
return maintenance;
|
||||
}
|
||||
|
||||
File getPluginFile() {
|
||||
return getFile();
|
||||
}
|
||||
}
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
package eu.kennytv.maintenance.bungee;
|
||||
|
||||
import eu.kennytv.maintenance.api.IMaintenance;
|
||||
import eu.kennytv.maintenance.api.ISettings;
|
||||
import eu.kennytv.maintenance.api.bungee.IMaintenanceBungee;
|
||||
import eu.kennytv.maintenance.api.bungee.MaintenanceBungeeAPI;
|
||||
import eu.kennytv.maintenance.bungee.command.MaintenanceBungeeCommand;
|
||||
import eu.kennytv.maintenance.bungee.command.MaintenanceBungeeCommandBase;
|
||||
import eu.kennytv.maintenance.bungee.listener.PostLoginListener;
|
||||
import eu.kennytv.maintenance.bungee.listener.ServerConnectListener;
|
||||
import eu.kennytv.maintenance.bungee.metrics.MetricsLite;
|
||||
import eu.kennytv.maintenance.bungee.runnable.SingleMaintenanceRunnable;
|
||||
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
|
||||
import eu.kennytv.maintenance.core.Settings;
|
||||
import eu.kennytv.maintenance.core.hook.ServerListPlusHook;
|
||||
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnableBase;
|
||||
import eu.kennytv.maintenance.core.util.ServerType;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.api.plugin.PluginManager;
|
||||
import net.minecrell.serverlistplus.core.plugin.ServerListPlusPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author KennyTV
|
||||
* @since 1.0
|
||||
*/
|
||||
public final class MaintenanceBungeePlugin extends MaintenanceModePlugin implements IMaintenanceBungee {
|
||||
private final MaintenanceBungeeBase plugin;
|
||||
private final SettingsBungee settings;
|
||||
private final Map<String, Integer> serverTaskIds = new HashMap<>();
|
||||
|
||||
MaintenanceBungeePlugin(final MaintenanceBungeeBase plugin) {
|
||||
super("§8[§eMaintenanceBungee§8] ", plugin.getDescription().getVersion(), ServerType.BUNGEE);
|
||||
|
||||
this.plugin = plugin;
|
||||
plugin.getLogger().info("Plugin by KennyTV");
|
||||
plugin.getLogger().info(getUpdateMessage());
|
||||
|
||||
settings = new SettingsBungee(this, plugin);
|
||||
|
||||
final PluginManager pm = getProxy().getPluginManager();
|
||||
pm.registerListener(plugin, new PostLoginListener(this, settings));
|
||||
pm.registerListener(plugin, new ServerConnectListener(this, settings));
|
||||
final MaintenanceBungeeCommand maintenanceCommand = new MaintenanceBungeeCommand(this, settings);
|
||||
pm.registerCommand(plugin, new MaintenanceBungeeCommandBase(maintenanceCommand));
|
||||
|
||||
new MetricsLite(plugin);
|
||||
|
||||
// ServerListPlus integration
|
||||
final Plugin serverListPlus = pm.getPlugin("ServerListPlus");
|
||||
if (serverListPlus != null) {
|
||||
serverListPlusHook = new ServerListPlusHook(((ServerListPlusPlugin) serverListPlus).getCore());
|
||||
serverListPlusHook.setEnabled(!settings.isMaintenance());
|
||||
plugin.getLogger().info("Enabled ServerListPlus integration!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaintenance(final boolean maintenance) {
|
||||
if (settings.getMySQL() != null) {
|
||||
settings.setMaintenanceToSQL(maintenance);
|
||||
} else {
|
||||
settings.setMaintenance(maintenance);
|
||||
settings.setToConfig("enable-maintenance-mode", maintenance);
|
||||
settings.saveConfig();
|
||||
}
|
||||
|
||||
serverActions(maintenance);
|
||||
if (isTaskRunning())
|
||||
cancelTask();
|
||||
}
|
||||
|
||||
void serverActions(final boolean maintenance) {
|
||||
if (serverListPlusHook != null)
|
||||
serverListPlusHook.setEnabled(!maintenance);
|
||||
|
||||
if (maintenance) {
|
||||
getProxy().getPlayers().stream()
|
||||
.filter(p -> !p.hasPermission("maintenance.bypass") && !settings.getWhitelistedPlayers().containsKey(p.getUniqueId()))
|
||||
.forEach(p -> p.disconnect(settings.getKickMessage().replace("%NEWLINE%", "\n")));
|
||||
getProxy().broadcast(settings.getMessage("maintenanceActivated"));
|
||||
} else
|
||||
getProxy().broadcast(settings.getMessage("maintenanceDeactivated"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMaintenance(final ServerInfo server) {
|
||||
return settings.isMaintenance(server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setMaintenanceToServer(final ServerInfo server, final boolean maintenance) {
|
||||
if (maintenance) {
|
||||
if (!settings.addMaintenanceServer(server.getName())) return false;
|
||||
} else {
|
||||
if (!settings.removeMaintenanceServer(server.getName())) return false;
|
||||
}
|
||||
serverActions(server, maintenance);
|
||||
cancelSingleTask(server);
|
||||
return true;
|
||||
}
|
||||
|
||||
void serverActions(final ServerInfo server, final boolean maintenance) {
|
||||
if (maintenance) {
|
||||
final ServerInfo fallback = getProxy().getServerInfo(settings.getFallbackServer());
|
||||
if (fallback == null && !server.getPlayers().isEmpty())
|
||||
plugin.getLogger().warning("The fallback server set in the SpigotServers.yml could not be found! Instead kicking players from that server off the network!");
|
||||
else if (fallback.equals(server))
|
||||
plugin.getLogger().warning("Maintenance has been enabled on the fallback server! If a player joins on a proxied server, they will be kicked completely instead of being sent to the fallback server!");
|
||||
server.getPlayers().forEach(p -> {
|
||||
if (!p.hasPermission("maintenance.bypass") && !settings.getWhitelistedPlayers().containsKey(p.getUniqueId())) {
|
||||
if (fallback != null && fallback.canAccess(p)) {
|
||||
p.sendMessage(settings.getMessage("singleMaintenanceActivated").replace("%SERVER%", server.getName()));
|
||||
p.connect(fallback);
|
||||
} else
|
||||
p.disconnect(settings.getMessage("singleMaintenanceKickComplete").replace("%NEWLINE%", "\n").replace("%SERVER%", server.getName()));
|
||||
} else {
|
||||
p.sendMessage(settings.getMessage("singleMaintenanceActivated").replace("%SERVER%", server.getName()));
|
||||
}
|
||||
});
|
||||
} else
|
||||
server.getPlayers().forEach(p -> p.sendMessage(settings.getMessage("singleMaintenanceDeactivated").replace("%SERVER%", server.getName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServerTaskRunning(final ServerInfo server) {
|
||||
return serverTaskIds.containsKey(server.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int startMaintenanceRunnable(final Runnable runnable) {
|
||||
return getProxy().getScheduler().schedule(plugin, runnable, 0, 1, TimeUnit.SECONDS).getId();
|
||||
}
|
||||
|
||||
public MaintenanceRunnableBase startSingleMaintenanceRunnable(final ServerInfo server, final int minutes, final boolean enable) {
|
||||
final MaintenanceRunnableBase runnable = new SingleMaintenanceRunnable(this, (Settings) getSettings(), minutes, enable, server);
|
||||
serverTaskIds.put(server.getName(), getProxy().getScheduler().schedule(plugin, runnable, 0, 1, TimeUnit.SECONDS).getId());
|
||||
return runnable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void async(final Runnable runnable) {
|
||||
getProxy().getScheduler().runAsync(plugin, runnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelTask() {
|
||||
getProxy().getScheduler().cancel(taskId);
|
||||
runnable = null;
|
||||
taskId = 0;
|
||||
}
|
||||
|
||||
public void cancelSingleTask(final ServerInfo server) {
|
||||
final Integer task = serverTaskIds.remove(server.getName());
|
||||
if (task != null)
|
||||
getProxy().getScheduler().cancel(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISettings getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getPluginFile() {
|
||||
return plugin.getPluginFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void broadcast(final String message) {
|
||||
getProxy().broadcast(message);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static IMaintenance getAPI() {
|
||||
return MaintenanceBungeeAPI.getAPI();
|
||||
}
|
||||
|
||||
public ProxyServer getProxy() {
|
||||
return plugin.getProxy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger() {
|
||||
return plugin.getLogger();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
package eu.kennytv.maintenance.bungee;
|
||||
|
||||
import eu.kennytv.maintenance.bungee.listener.ProxyPingListener;
|
||||
import eu.kennytv.maintenance.bungee.mysql.MySQL;
|
||||
import eu.kennytv.maintenance.core.Settings;
|
||||
import eu.kennytv.maintenance.core.listener.IPingListener;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.plugin.PluginManager;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.YamlConfiguration;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
public final class SettingsBungee extends Settings {
|
||||
private final String mySQLTable;
|
||||
private final String serverTable;
|
||||
private final String maintenanceQuery;
|
||||
private final String serverQuery;
|
||||
private final MySQL mySQL;
|
||||
|
||||
private final MaintenanceBungeePlugin maintenancePlugin;
|
||||
private final MaintenanceBungeeBase plugin;
|
||||
private final IPingListener pingListener;
|
||||
private Set<String> maintenanceServers;
|
||||
private Configuration config;
|
||||
private Configuration language;
|
||||
private Configuration whitelist;
|
||||
private Configuration spigotServers;
|
||||
private String fallbackServer;
|
||||
|
||||
private long millisecondsToCheck;
|
||||
private long lastMySQLCheck;
|
||||
private long lastServerCheck;
|
||||
|
||||
SettingsBungee(final MaintenanceBungeePlugin maintenancePlugin, final MaintenanceBungeeBase plugin) {
|
||||
super(maintenancePlugin);
|
||||
this.maintenancePlugin = maintenancePlugin;
|
||||
this.plugin = plugin;
|
||||
|
||||
final PluginManager pm = plugin.getProxy().getPluginManager();
|
||||
final ProxyPingListener listener = new ProxyPingListener(plugin, this);
|
||||
pm.registerListener(plugin, listener);
|
||||
pingListener = listener;
|
||||
|
||||
if (!plugin.getDataFolder().exists())
|
||||
plugin.getDataFolder().mkdirs();
|
||||
createFile("bungee-config.yml");
|
||||
createFile("WhitelistedPlayers.yml");
|
||||
createFile("SpigotServers.yml");
|
||||
reloadConfigs();
|
||||
|
||||
final Configuration mySQLSection = config.getSection("mysql");
|
||||
if (mySQLSection.getBoolean("use-mysql", false)) {
|
||||
plugin.getLogger().info("Trying to open database connection...");
|
||||
mySQL = new MySQL(mySQLSection.getString("host"),
|
||||
mySQLSection.getInt("port"),
|
||||
mySQLSection.getString("username"),
|
||||
mySQLSection.getString("password"),
|
||||
mySQLSection.getString("database"));
|
||||
|
||||
// Varchar as the value regarding the possibility of saving stuff like the motd as well in future updates
|
||||
mySQLTable = mySQLSection.getString("table", "maintenance_settings");
|
||||
serverTable = mySQLSection.getString("servertable", "maintenance_servers");
|
||||
mySQL.executeUpdate("CREATE TABLE IF NOT EXISTS " + mySQLTable + " (setting VARCHAR(16) PRIMARY KEY, value VARCHAR(255))");
|
||||
mySQL.executeUpdate("CREATE TABLE IF NOT EXISTS " + serverTable + " (server VARCHAR(64) PRIMARY KEY)");
|
||||
maintenanceQuery = "SELECT * FROM " + mySQLTable + " WHERE setting = ?";
|
||||
serverQuery = "SELECT * FROM " + serverTable;
|
||||
maintenance = loadMaintenance();
|
||||
plugin.getLogger().info("Done!");
|
||||
} else {
|
||||
mySQL = null;
|
||||
mySQLTable = null;
|
||||
maintenanceQuery = null;
|
||||
serverTable = null;
|
||||
serverQuery = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void createFile(final String name) {
|
||||
final File file = new File(plugin.getDataFolder(), name);
|
||||
if (!file.exists()) {
|
||||
try (final InputStream in = plugin.getResourceAsStream(name)) {
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to create " + name + " file for MaintenanceBungee", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateExtraConfig() {
|
||||
// 2.3.1 mysql.update-interval
|
||||
if (!configContains("mysql.update-interval")) {
|
||||
setToConfig("mysql.update-interval", 15);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadConfigs() {
|
||||
try {
|
||||
config = YamlConfiguration.getProvider(YamlConfiguration.class)
|
||||
.load(new InputStreamReader(new FileInputStream(new File(plugin.getDataFolder(), "bungee-config.yml")), StandardCharsets.UTF_8));
|
||||
whitelist = YamlConfiguration.getProvider(YamlConfiguration.class).load(new File(plugin.getDataFolder(), "WhitelistedPlayers.yml"));
|
||||
spigotServers = YamlConfiguration.getProvider(YamlConfiguration.class).load(new File(plugin.getDataFolder(), "SpigotServers.yml"));
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to load Maintenance files!", e);
|
||||
}
|
||||
|
||||
loadSettings();
|
||||
createAndLoadLanguageFile();
|
||||
}
|
||||
|
||||
private void createAndLoadLanguageFile() {
|
||||
final File file = new File(plugin.getDataFolder(), "language-" + getLanguage() + ".yml");
|
||||
if (!file.exists()) {
|
||||
try (final InputStream in = plugin.getResourceAsStream("language-" + getLanguage() + ".yml")) {
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (final IOException | NullPointerException e) {
|
||||
plugin.getLogger().warning("Unable to provide language " + getLanguage());
|
||||
if (!languageName.equals("en")) {
|
||||
plugin.getLogger().warning("Falling back to default language: en");
|
||||
languageName = "en";
|
||||
createAndLoadLanguageFile();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
language = YamlConfiguration.getProvider(YamlConfiguration.class)
|
||||
.load(new InputStreamReader(new FileInputStream(new File(plugin.getDataFolder(), "language-" + getLanguage() + ".yml")), StandardCharsets.UTF_8));
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to load Maintenance language file!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfig() {
|
||||
final File file = new File(plugin.getDataFolder(), "bungee-config.yml");
|
||||
try {
|
||||
YamlConfiguration.getProvider(YamlConfiguration.class).save(config, new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8));
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to save bungee-config.yml!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveWhitelistedPlayers() {
|
||||
saveFile(whitelist, "WhitelistedPlayers.yml");
|
||||
}
|
||||
|
||||
public void saveSpigotServers() {
|
||||
saveFile(spigotServers, "SpigotServers.yml");
|
||||
}
|
||||
|
||||
private void saveFile(final Configuration config, final String name) {
|
||||
final File file = new File(plugin.getDataFolder(), name);
|
||||
try {
|
||||
YamlConfiguration.getProvider(YamlConfiguration.class).save(config, file);
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to save " + name + "!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadExtraSettings() {
|
||||
whitelistedPlayers.clear();
|
||||
whitelist.getKeys().forEach(key -> whitelistedPlayers.put(UUID.fromString(key), whitelist.getString(key)));
|
||||
fallbackServer = spigotServers.getString("fallback", "hub");
|
||||
if (mySQL != null) {
|
||||
final long configValue = config.getInt("mysql.update-interval");
|
||||
millisecondsToCheck = configValue > 0 ? configValue * 1000 : -1;
|
||||
lastMySQLCheck = 0;
|
||||
lastServerCheck = 0;
|
||||
maintenanceServers = loadMaintenanceServersFromSQL();
|
||||
} else {
|
||||
final List<String> list = spigotServers.getStringList("maintenance-on");
|
||||
maintenanceServers = list == null ? new HashSet<>() : new HashSet<>(list);
|
||||
}
|
||||
}
|
||||
|
||||
private Set<String> loadMaintenanceServersFromSQL() {
|
||||
final Set<String> maintenanceServers = new HashSet<>();
|
||||
mySQL.executeQuery(serverQuery, rs -> {
|
||||
try {
|
||||
while (rs.next()) {
|
||||
maintenanceServers.add(rs.getString("server"));
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
plugin.getLogger().warning("An error occured while trying to get the list of single servers with maintenance!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
return maintenanceServers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWhitelist(final String uuid, final String s) {
|
||||
whitelist.set(uuid, s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigString(final String path) {
|
||||
final String s = config.getString(path);
|
||||
if (s == null) {
|
||||
plugin.getLogger().warning("The config is missing the following string: " + path);
|
||||
return "null";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(final String path) {
|
||||
final String s = language.getString(path);
|
||||
if (s == null) {
|
||||
plugin.getLogger().warning("The language file is missing the following string: " + path);
|
||||
return "null";
|
||||
}
|
||||
return ChatColor.translateAlternateColorCodes('&', s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getConfigBoolean(final String path) {
|
||||
return config.getBoolean(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getConfigIntList(final String path) {
|
||||
return config.getIntList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getConfigList(final String path) {
|
||||
return config.getStringList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToConfig(final String path, final Object var) {
|
||||
config.set(path, var);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configContains(final String path) {
|
||||
return config.contains(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredString(final String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMaintenance() {
|
||||
if (mySQL != null && (millisecondsToCheck == -1 || System.currentTimeMillis() - lastMySQLCheck > millisecondsToCheck)) {
|
||||
final boolean databaseValue = loadMaintenance();
|
||||
if (databaseValue != maintenance) {
|
||||
maintenancePlugin.serverActions(maintenance);
|
||||
maintenance = databaseValue;
|
||||
}
|
||||
if (millisecondsToCheck != -1)
|
||||
lastMySQLCheck = System.currentTimeMillis();
|
||||
}
|
||||
return maintenance;
|
||||
}
|
||||
|
||||
private boolean loadMaintenance() {
|
||||
final boolean[] databaseValue = {false};
|
||||
mySQL.executeQuery(maintenanceQuery, rs -> {
|
||||
try {
|
||||
if (rs.next()) {
|
||||
databaseValue[0] = Boolean.parseBoolean(rs.getString("value"));
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, "maintenance");
|
||||
return databaseValue[0];
|
||||
}
|
||||
|
||||
public boolean isMaintenance(final ServerInfo server) {
|
||||
if (mySQL != null && (millisecondsToCheck == -1 || System.currentTimeMillis() - lastServerCheck > millisecondsToCheck)) {
|
||||
final Set<String> databaseValue = loadMaintenanceServersFromSQL();
|
||||
if (!databaseValue.equals(maintenanceServers)) {
|
||||
maintenancePlugin.serverActions(server, maintenance);
|
||||
maintenanceServers = databaseValue;
|
||||
}
|
||||
if (millisecondsToCheck != -1)
|
||||
lastServerCheck = System.currentTimeMillis();
|
||||
}
|
||||
return maintenanceServers.contains(server.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reloadMaintenanceIcon() {
|
||||
return pingListener.loadIcon();
|
||||
}
|
||||
|
||||
void setMaintenanceToSQL(final boolean maintenance) {
|
||||
maintenancePlugin.async(() -> {
|
||||
final String s = String.valueOf(maintenance);
|
||||
mySQL.executeUpdate("INSERT INTO " + mySQLTable + " (setting, value) VALUES (?, ?) ON DUPLICATE KEY UPDATE value = ?", "maintenance", s, s);
|
||||
if (millisecondsToCheck != -1)
|
||||
lastMySQLCheck = System.currentTimeMillis();
|
||||
});
|
||||
this.maintenance = maintenance;
|
||||
}
|
||||
|
||||
MySQL getMySQL() {
|
||||
return mySQL;
|
||||
}
|
||||
|
||||
boolean addMaintenanceServer(final String server) {
|
||||
if (mySQL != null) {
|
||||
maintenanceServers = loadMaintenanceServersFromSQL();
|
||||
if (!maintenanceServers.add(server)) return false;
|
||||
maintenancePlugin.async(() -> mySQL.executeUpdate("INSERT INTO " + serverTable + " (server) VALUES (?)", server));
|
||||
if (millisecondsToCheck != -1)
|
||||
lastServerCheck = System.currentTimeMillis();
|
||||
} else {
|
||||
if (!maintenanceServers.add(server)) return false;
|
||||
saveServersToConfig();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean removeMaintenanceServer(final String server) {
|
||||
if (mySQL != null) {
|
||||
maintenanceServers = loadMaintenanceServersFromSQL();
|
||||
if (!maintenanceServers.remove(server)) return false;
|
||||
maintenancePlugin.async(() -> mySQL.executeUpdate("DELETE FROM " + serverTable + " WHERE server = ?", server));
|
||||
if (millisecondsToCheck != -1)
|
||||
lastServerCheck = System.currentTimeMillis();
|
||||
} else {
|
||||
if (!maintenanceServers.remove(server)) return false;
|
||||
saveServersToConfig();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void saveServersToConfig() {
|
||||
spigotServers.set("maintenance-on", new ArrayList<>(maintenanceServers));
|
||||
saveSpigotServers();
|
||||
}
|
||||
|
||||
public Set<String> getMaintenanceServers() {
|
||||
return maintenanceServers;
|
||||
}
|
||||
|
||||
public String getFallbackServer() {
|
||||
return fallbackServer;
|
||||
}
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
package eu.kennytv.maintenance.bungee.command;
|
||||
|
||||
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
|
||||
import eu.kennytv.maintenance.bungee.SettingsBungee;
|
||||
import eu.kennytv.maintenance.bungee.util.ProxiedSenderInfo;
|
||||
import eu.kennytv.maintenance.core.command.MaintenanceCommand;
|
||||
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnableBase;
|
||||
import eu.kennytv.maintenance.core.util.SenderInfo;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public final class MaintenanceBungeeCommand extends MaintenanceCommand {
|
||||
private final MaintenanceBungeePlugin plugin;
|
||||
private final SettingsBungee settingsBungee;
|
||||
|
||||
public MaintenanceBungeeCommand(final MaintenanceBungeePlugin plugin, final SettingsBungee settings) {
|
||||
super(plugin, settings, "MaintenanceBungee");
|
||||
this.plugin = plugin;
|
||||
settingsBungee = settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addPlayerToWhitelist(final SenderInfo sender, final String name) {
|
||||
final ProxiedPlayer selected = plugin.getProxy().getPlayer(name);
|
||||
if (selected == null) {
|
||||
sender.sendMessage(settings.getMessage("playerNotOnline"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.addWhitelistedPlayer(selected.getUniqueId(), selected.getName()))
|
||||
sender.sendMessage(settings.getMessage("whitelistAdded").replace("%PLAYER%", selected.getName()));
|
||||
else
|
||||
sender.sendMessage(settings.getMessage("whitelistAlreadyAdded").replace("%PLAYER%", selected.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void removePlayerFromWhitelist(final SenderInfo sender, final String name) {
|
||||
final ProxiedPlayer selected = plugin.getProxy().getPlayer(name);
|
||||
if (selected == null) {
|
||||
if (settings.removeWhitelistedPlayer(name))
|
||||
sender.sendMessage(settings.getMessage("whitelistRemoved").replace("%PLAYER%", name));
|
||||
else
|
||||
sender.sendMessage(settings.getMessage("whitelistNotFound"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.removeWhitelistedPlayer(selected.getUniqueId()))
|
||||
sender.sendMessage(settings.getMessage("whitelistRemoved").replace("%PLAYER%", selected.getName()));
|
||||
else
|
||||
sender.sendMessage(settings.getMessage("whitelistNotFound"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkForUpdate(final SenderInfo sender) {
|
||||
if (plugin.updateAvailable()) {
|
||||
sender.sendMessage(plugin.getPrefix() + "§cNewest version available: §aVersion " + plugin.getNewestVersion() + "§c, you're on §a" + plugin.getVersion());
|
||||
sender.sendMessage(plugin.getPrefix() + "§c§lWARNING: §cYou will have to restart the proxy to prevent further issues and to complete the update!" +
|
||||
" If you can't do that, don't update!");
|
||||
final TextComponent tc = new TextComponent("§6× §8[§aUpdate§8]");
|
||||
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/maintenance forceupdate"));
|
||||
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§aClick here to update the plugin")));
|
||||
tc.addExtra(" §8< §7Or use the command §c/maintenance forceupdate");
|
||||
|
||||
((ProxiedSenderInfo) sender).sendMessage(tc);
|
||||
} else
|
||||
sender.sendMessage(plugin.getPrefix() + "§aYou already have the latest version of the plugin!");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleToggleServerCommand(final SenderInfo sender, final String[] args) {
|
||||
final ServerInfo server = plugin.getProxy().getServerInfo(args[1]);
|
||||
if (server == null) {
|
||||
sender.sendMessage(settings.getMessage("serverNotFound"));
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean maintenance = args[0].equalsIgnoreCase("on");
|
||||
if (plugin.setMaintenanceToServer(server, maintenance)) {
|
||||
if (!sender.isPlayer() || !plugin.getProxy().getPlayer(sender.getUuid()).getServer().getInfo().equals(server))
|
||||
sender.sendMessage(settings.getMessage(maintenance ? "singleMaintenanceActivated" : "singleMaintenanceDeactivated").replace("%SERVER%", server.getName()));
|
||||
} else
|
||||
sender.sendMessage(settings.getMessage(maintenance ? "singleServerAlreadyEnabled" : "singleServerAlreadyDisabled").replace("%SERVER%", server.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleTimerServerCommands(final SenderInfo sender, final String[] args) {
|
||||
if (args[0].equalsIgnoreCase("endtimer")) {
|
||||
if (checkPermission(sender, "servertimer")) return;
|
||||
if (checkTimerArgs(sender, args[2], "singleEndtimerUsage")) return;
|
||||
|
||||
final ServerInfo server = checkSingleTimerArgs(sender, args);
|
||||
if (server == null) return;
|
||||
if (!plugin.isMaintenance(server)) {
|
||||
sender.sendMessage(settings.getMessage("singleServerAlreadyDisabled").replace("%SERVER%", server.getName()));
|
||||
return;
|
||||
}
|
||||
final MaintenanceRunnableBase runnable = plugin.startSingleMaintenanceRunnable(server, Integer.parseInt(args[2]), false);
|
||||
sender.sendMessage(settings.getMessage("endtimerStarted").replace("%TIME%", runnable.getTime()));
|
||||
} else if (args[0].equalsIgnoreCase("starttimer")) {
|
||||
if (checkPermission(sender, "servertimer")) return;
|
||||
if (checkTimerArgs(sender, args[2], "singleStarttimerUsage")) return;
|
||||
|
||||
final ServerInfo server = checkSingleTimerArgs(sender, args);
|
||||
if (server == null) return;
|
||||
if (plugin.isMaintenance(server)) {
|
||||
sender.sendMessage(settings.getMessage("singleServerAlreadyEnabled").replace("%SERVER%", server.getName()));
|
||||
return;
|
||||
}
|
||||
|
||||
final MaintenanceRunnableBase runnable = plugin.startSingleMaintenanceRunnable(server, Integer.parseInt(args[2]), true);
|
||||
sender.sendMessage(settings.getMessage("starttimerStarted").replace("%TIME%", runnable.getTime()));
|
||||
} else if (args[0].equalsIgnoreCase("timer")) {
|
||||
if (args[1].equalsIgnoreCase("abort") || args[1].equalsIgnoreCase("stop") || args[1].equalsIgnoreCase("cancel")) {
|
||||
if (checkPermission(sender, "servertimer")) return;
|
||||
final ServerInfo server = plugin.getProxy().getServerInfo(args[2]);
|
||||
if (server == null) {
|
||||
sender.sendMessage(settings.getMessage("serverNotFound"));
|
||||
return;
|
||||
}
|
||||
if (!plugin.isServerTaskRunning(server)) {
|
||||
sender.sendMessage(settings.getMessage("timerNotRunning"));
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.cancelSingleTask(server);
|
||||
sender.sendMessage(settings.getMessage("timerCancelled"));
|
||||
} else
|
||||
sendUsage(sender);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showMaintenanceStatus(final SenderInfo sender) {
|
||||
if (settingsBungee.getMaintenanceServers().isEmpty()) {
|
||||
sender.sendMessage(settings.getMessage("singleServerMaintenanceListEmpty"));
|
||||
} else {
|
||||
sender.sendMessage(settings.getMessage("singleServerMaintenanceList"));
|
||||
settingsBungee.getMaintenanceServers().forEach(server -> sender.sendMessage("§8- §b" + server));
|
||||
}
|
||||
}
|
||||
|
||||
private ServerInfo checkSingleTimerArgs(final SenderInfo sender, final String[] args) {
|
||||
final ServerInfo server = plugin.getProxy().getServerInfo(args[1]);
|
||||
if (server == null) {
|
||||
sender.sendMessage(settings.getMessage("serverNotFound"));
|
||||
return null;
|
||||
}
|
||||
if (plugin.isServerTaskRunning(server)) {
|
||||
sender.sendMessage(settings.getMessage("timerAlreadyRunning"));
|
||||
return null;
|
||||
}
|
||||
return server;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package eu.kennytv.maintenance.bungee.command;
|
||||
|
||||
import eu.kennytv.maintenance.bungee.util.ProxiedSenderInfo;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
public final class MaintenanceBungeeCommandBase extends Command {
|
||||
private final MaintenanceBungeeCommand command;
|
||||
|
||||
public MaintenanceBungeeCommandBase(final MaintenanceBungeeCommand command) {
|
||||
super("maintenance", "", "maintenancebungee");
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final String[] args) {
|
||||
command.execute(new ProxiedSenderInfo(sender), args);
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package eu.kennytv.maintenance.bungee.listener;
|
||||
|
||||
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
|
||||
import eu.kennytv.maintenance.bungee.SettingsBungee;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.md_5.bungee.event.EventPriority;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class PostLoginListener implements Listener {
|
||||
private final MaintenanceBungeePlugin plugin;
|
||||
private final SettingsBungee settings;
|
||||
private final Set<UUID> notifiedPlayers = new HashSet<>();
|
||||
|
||||
public PostLoginListener(final MaintenanceBungeePlugin plugin, final SettingsBungee settings) {
|
||||
this.plugin = plugin;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void postLogin(final PostLoginEvent event) {
|
||||
final ProxiedPlayer p = event.getPlayer();
|
||||
if (p.getUniqueId().toString().equals("a8179ff3-c201-4a75-bdaa-9d14aca6f83f"))
|
||||
p.sendMessage("§6MaintenanceBungee §aVersion " + plugin.getVersion());
|
||||
else if (settings.isMaintenance()) {
|
||||
if (!p.hasPermission("maintenance.bypass") && !settings.getWhitelistedPlayers().containsKey(p.getUniqueId())) {
|
||||
p.disconnect(settings.getKickMessage().replace("%NEWLINE%", "\n"));
|
||||
|
||||
if (settings.isJoinNotifications())
|
||||
plugin.getProxy().getPlayers().stream().filter(player -> player.hasPermission("maintenance.joinnotification"))
|
||||
.forEach(player -> player.sendMessage(settings.getMessage("joinNotification").replace("%PLAYER%", p.getName())));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!p.hasPermission("maintenance.admin") || notifiedPlayers.contains(p.getUniqueId())) return;
|
||||
|
||||
plugin.async(() -> {
|
||||
if (plugin.updateAvailable()) {
|
||||
p.sendMessage(plugin.getPrefix() + "§cThere is a newer version available: §aVersion " + plugin.getNewestVersion() + "§c, you're on §a" + plugin.getVersion());
|
||||
notifiedPlayers.add(p.getUniqueId());
|
||||
|
||||
final TextComponent tc1 = new TextComponent(TextComponent.fromLegacyText(plugin.getPrefix() + " "));
|
||||
final TextComponent tc2 = new TextComponent(TextComponent.fromLegacyText("§cDownload it at: §6https://www.spigotmc.org/resources/maintenancemode.40699/"));
|
||||
final TextComponent click = new TextComponent(TextComponent.fromLegacyText(" §7§l§o(CLICK ME)"));
|
||||
click.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org/resources/maintenancemode.40699/"));
|
||||
click.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aDownload the latest version").create()));
|
||||
tc1.addExtra(tc2);
|
||||
tc1.addExtra(click);
|
||||
|
||||
p.sendMessage(tc1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package eu.kennytv.maintenance.bungee.listener;
|
||||
|
||||
import eu.kennytv.maintenance.bungee.MaintenanceBungeeBase;
|
||||
import eu.kennytv.maintenance.bungee.SettingsBungee;
|
||||
import eu.kennytv.maintenance.core.listener.IPingListener;
|
||||
import net.md_5.bungee.api.Favicon;
|
||||
import net.md_5.bungee.api.ServerPing;
|
||||
import net.md_5.bungee.api.event.ProxyPingEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.md_5.bungee.event.EventPriority;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ProxyPingListener implements Listener, IPingListener {
|
||||
private final MaintenanceBungeeBase plugin;
|
||||
private final SettingsBungee settings;
|
||||
private Favicon favicon;
|
||||
|
||||
public ProxyPingListener(final MaintenanceBungeeBase plugin, final SettingsBungee settings) {
|
||||
this.plugin = plugin;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void proxyPing(final ProxyPingEvent event) {
|
||||
if (!settings.isMaintenance()) return;
|
||||
|
||||
final ServerPing ping = event.getResponse();
|
||||
if (settings.hasCustomPlayerCountMessage()) {
|
||||
ping.getVersion().setProtocol(1);
|
||||
ping.getVersion().setName(settings.getPlayerCountMessage()
|
||||
.replace("%ONLINE%", Integer.toString(ping.getPlayers().getOnline()))
|
||||
.replace("%MAX%", Integer.toString(ping.getPlayers().getMax())));
|
||||
}
|
||||
|
||||
ping.setDescription(settings.getRandomPingMessage());
|
||||
ping.getPlayers().setOnline(0);
|
||||
ping.getPlayers().setMax(0);
|
||||
ping.getPlayers().setSample(new ServerPing.PlayerInfo[]{
|
||||
new ServerPing.PlayerInfo(settings.getPlayerCountHoverMessage().replace("%NEWLINE%", "\n"), "")
|
||||
});
|
||||
|
||||
if (settings.hasCustomIcon() && favicon != null)
|
||||
ping.setFavicon(favicon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadIcon() {
|
||||
try {
|
||||
favicon = Favicon.create(ImageIO.read(new File("maintenance-icon.png")));
|
||||
} catch (final IOException | IllegalArgumentException e) {
|
||||
plugin.getLogger().warning("§4Could not load 'maintenance-icon.png' - did you create one in your Bungee folder (not the plugins folder)?");
|
||||
if (settings.debugEnabled())
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package eu.kennytv.maintenance.bungee.listener;
|
||||
|
||||
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
|
||||
import eu.kennytv.maintenance.bungee.SettingsBungee;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.ServerConnectEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import net.md_5.bungee.event.EventPriority;
|
||||
|
||||
public final class ServerConnectListener implements Listener {
|
||||
private final MaintenanceBungeePlugin plugin;
|
||||
private final SettingsBungee settings;
|
||||
private boolean warned;
|
||||
|
||||
public ServerConnectListener(final MaintenanceBungeePlugin plugin, final SettingsBungee settings) {
|
||||
this.plugin = plugin;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void serverConnect(final ServerConnectEvent event) {
|
||||
final ProxiedPlayer p = event.getPlayer();
|
||||
final ServerInfo target = event.getTarget();
|
||||
if (!plugin.isMaintenance(target))return;
|
||||
if (p.hasPermission("maintenance.bypass") || settings.getWhitelistedPlayers().containsKey(p.getUniqueId()))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
if (settings.isJoinNotifications()) {
|
||||
target.getPlayers().stream().filter(player -> player.hasPermission("maintenance.joinnotification"))
|
||||
.forEach(player -> player.sendMessage(settings.getMessage("joinNotification").replace("%PLAYER%", p.getName())));
|
||||
}
|
||||
// Normal serverconnect
|
||||
if (event.getReason() != ServerConnectEvent.Reason.JOIN_PROXY && event.getReason() != ServerConnectEvent.Reason.KICK_REDIRECT
|
||||
&& event.getReason() != ServerConnectEvent.Reason.LOBBY_FALLBACK && event.getReason() != ServerConnectEvent.Reason.SERVER_DOWN_REDIRECT) {
|
||||
p.sendMessage(settings.getMessage("singleMaintenanceKick").replace("%SERVER%", target.getName()));
|
||||
return;
|
||||
}
|
||||
|
||||
// If it's the initial proxy join or a kick from another server, go back to fallback server
|
||||
final ServerInfo fallback = plugin.getProxy().getServerInfo(settings.getFallbackServer());
|
||||
if (fallback == null || !fallback.canAccess(p) || plugin.isMaintenance(fallback)) {
|
||||
p.disconnect(settings.getMessage("singleMaintenanceKickComplete").replace("%NEWLINE%", "\n").replace("%SERVER%", target.getName()));
|
||||
if (!warned) {
|
||||
plugin.getLogger().warning("Could not send player to the fallback server set in the SpigotServers.yml! Instead kicking player off the network!");
|
||||
warned = true;
|
||||
}
|
||||
} else
|
||||
p.connect(fallback);
|
||||
}
|
||||
}
|
||||
+279
@@ -0,0 +1,279 @@
|
||||
package eu.kennytv.maintenance.bungee.metrics;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
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.config.YamlConfiguration;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public final class MetricsLite {
|
||||
|
||||
public static final int B_STATS_VERSION = 1;
|
||||
private static final String URL = "https://bStats.org/submitData/bungeecord";
|
||||
private final Plugin plugin;
|
||||
private boolean enabled;
|
||||
private String serverUUID;
|
||||
private boolean logFailedRequests;
|
||||
private static boolean logSentData;
|
||||
private static boolean logResponseStatusText;
|
||||
private static final List<Object> knownMetricsInstances = new ArrayList<>();
|
||||
|
||||
public MetricsLite(final Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
try {
|
||||
loadConfig();
|
||||
} catch (final IOException e) {
|
||||
plugin.getLogger().log(Level.WARNING, "Failed to load bStats config!", e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Class<?> usedMetricsClass = getFirstBStatsClass();
|
||||
if (usedMetricsClass == null) {
|
||||
return;
|
||||
}
|
||||
if (usedMetricsClass == getClass()) {
|
||||
linkMetrics(this);
|
||||
startSubmitting();
|
||||
} else {
|
||||
try {
|
||||
usedMetricsClass.getMethod("linkMetrics", Object.class).invoke(null, this);
|
||||
} catch (final NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
if (logFailedRequests) {
|
||||
plugin.getLogger().log(Level.WARNING, "Failed to link to first metrics class " + usedMetricsClass.getName() + "!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public static void linkMetrics(final Object metrics) {
|
||||
knownMetricsInstances.add(metrics);
|
||||
}
|
||||
|
||||
public JsonObject getPluginData() {
|
||||
final JsonObject data = new JsonObject();
|
||||
|
||||
final String pluginName = plugin.getDescription().getName();
|
||||
final String pluginVersion = plugin.getDescription().getVersion();
|
||||
|
||||
data.addProperty("pluginName", pluginName);
|
||||
data.addProperty("pluginVersion", pluginVersion);
|
||||
|
||||
final JsonArray customCharts = new JsonArray();
|
||||
data.add("customCharts", customCharts);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private void startSubmitting() {
|
||||
plugin.getProxy().getScheduler().schedule(plugin, this::submitData, 2, 30, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
private JsonObject getServerData() {
|
||||
int playerAmount = plugin.getProxy().getOnlineCount();
|
||||
playerAmount = playerAmount > 500 ? 500 : playerAmount;
|
||||
final int onlineMode = plugin.getProxy().getConfig().isOnlineMode() ? 1 : 0;
|
||||
final String bungeecordVersion = plugin.getProxy().getVersion();
|
||||
final int managedServers = plugin.getProxy().getServers().size();
|
||||
|
||||
final String javaVersion = System.getProperty("java.version");
|
||||
final String osName = System.getProperty("os.name");
|
||||
final String osArch = System.getProperty("os.arch");
|
||||
final String osVersion = System.getProperty("os.version");
|
||||
final int coreCount = Runtime.getRuntime().availableProcessors();
|
||||
|
||||
final JsonObject data = new JsonObject();
|
||||
|
||||
data.addProperty("serverUUID", serverUUID);
|
||||
|
||||
data.addProperty("playerAmount", playerAmount);
|
||||
data.addProperty("managedServers", managedServers);
|
||||
data.addProperty("onlineMode", onlineMode);
|
||||
data.addProperty("bungeecordVersion", bungeecordVersion);
|
||||
|
||||
data.addProperty("javaVersion", javaVersion);
|
||||
data.addProperty("osName", osName);
|
||||
data.addProperty("osArch", osArch);
|
||||
data.addProperty("osVersion", osVersion);
|
||||
data.addProperty("coreCount", coreCount);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private void submitData() {
|
||||
final JsonObject data = getServerData();
|
||||
|
||||
final JsonArray pluginData = new JsonArray();
|
||||
for (final Object metrics : knownMetricsInstances) {
|
||||
try {
|
||||
final Object plugin = metrics.getClass().getMethod("getPluginData").invoke(metrics);
|
||||
if (plugin instanceof JsonObject) {
|
||||
pluginData.add((JsonObject) plugin);
|
||||
}
|
||||
} catch (final NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
data.add("plugins", pluginData);
|
||||
|
||||
try {
|
||||
sendData(plugin, data);
|
||||
} catch (final Exception e) {
|
||||
if (logFailedRequests) {
|
||||
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadConfig() throws IOException {
|
||||
final Path configPath = plugin.getDataFolder().toPath().getParent().resolve("bStats");
|
||||
configPath.toFile().mkdirs();
|
||||
final File configFile = new File(configPath.toFile(), "config.yml");
|
||||
if (!configFile.exists()) {
|
||||
writeFile(configFile,
|
||||
"#bStats collects some data for plugin authors like how many servers are using their plugins.",
|
||||
"#To honor their work, you should not disable it.",
|
||||
"#This has nearly no effect on the server performance!",
|
||||
"#Check out https://bStats.org/ to learn more :)",
|
||||
"enabled: true",
|
||||
"serverUuid: \"" + UUID.randomUUID().toString() + "\"",
|
||||
"logFailedRequests: false",
|
||||
"logSentData: false",
|
||||
"logResponseStatusText: false");
|
||||
}
|
||||
|
||||
final Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
|
||||
|
||||
enabled = configuration.getBoolean("enabled", true);
|
||||
serverUUID = configuration.getString("serverUuid");
|
||||
logFailedRequests = configuration.getBoolean("logFailedRequests", false);
|
||||
logSentData = configuration.getBoolean("logSentData", false);
|
||||
logResponseStatusText = configuration.getBoolean("logResponseStatusText", false);
|
||||
}
|
||||
|
||||
private Class<?> getFirstBStatsClass() {
|
||||
final Path configPath = plugin.getDataFolder().toPath().getParent().resolve("bStats");
|
||||
configPath.toFile().mkdirs();
|
||||
final File tempFile = new File(configPath.toFile(), "temp.txt");
|
||||
|
||||
try {
|
||||
final String className = readFile(tempFile);
|
||||
if (className != null) {
|
||||
try {
|
||||
return Class.forName(className);
|
||||
} catch (final ClassNotFoundException ignored) {
|
||||
}
|
||||
}
|
||||
writeFile(tempFile, getClass().getName());
|
||||
return getClass();
|
||||
} catch (final IOException e) {
|
||||
if (logFailedRequests) {
|
||||
plugin.getLogger().log(Level.WARNING, "Failed to get first bStats class!", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String readFile(final File file) throws IOException {
|
||||
if (!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
try (
|
||||
final FileReader fileReader = new FileReader(file);
|
||||
final BufferedReader bufferedReader = new BufferedReader(fileReader);
|
||||
) {
|
||||
return bufferedReader.readLine();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeFile(final File file, final String... lines) throws IOException {
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
try (
|
||||
final FileWriter fileWriter = new FileWriter(file);
|
||||
final BufferedWriter bufferedWriter = new BufferedWriter(fileWriter)
|
||||
) {
|
||||
for (final String line : lines) {
|
||||
bufferedWriter.write(line);
|
||||
bufferedWriter.newLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendData(final Plugin plugin, final JsonObject data) throws Exception {
|
||||
if (data == null) {
|
||||
throw new IllegalArgumentException("Data cannot be null");
|
||||
}
|
||||
if (logSentData) {
|
||||
plugin.getLogger().info("Sending data to bStats: " + data.toString());
|
||||
}
|
||||
|
||||
final HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
|
||||
|
||||
final byte[] compressedData = compress(data.toString());
|
||||
|
||||
connection.setRequestMethod("POST");
|
||||
connection.addRequestProperty("Accept", "application/json");
|
||||
connection.addRequestProperty("Connection", "close");
|
||||
connection.addRequestProperty("Content-Encoding", "gzip");
|
||||
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
|
||||
|
||||
connection.setDoOutput(true);
|
||||
final DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
|
||||
outputStream.write(compressedData);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
|
||||
if (logResponseStatusText) {
|
||||
final InputStream inputStream = connection.getInputStream();
|
||||
final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
builder.append(line);
|
||||
}
|
||||
bufferedReader.close();
|
||||
plugin.getLogger().info("Sent data to bStats and received response: " + builder.toString());
|
||||
} else {
|
||||
connection.getInputStream().close();
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] compress(final String str) throws IOException {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
final GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
|
||||
gzip.write(str.getBytes(StandardCharsets.UTF_8));
|
||||
gzip.close();
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package eu.kennytv.maintenance.bungee.mysql;
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public final class MySQL {
|
||||
private final HikariDataSource hikariDataSource;
|
||||
|
||||
// Excuse me and everything to do with the MySQL stuff, I have little to no idea of how to use databases
|
||||
public MySQL(final String hostname, final int port, final String username, final String password, final String database) {
|
||||
final HikariConfig hikariConfig = new HikariConfig();
|
||||
hikariConfig.setMaximumPoolSize(10);
|
||||
hikariConfig.addDataSourceProperty("serverName", hostname);
|
||||
hikariConfig.addDataSourceProperty("user", username);
|
||||
hikariConfig.addDataSourceProperty("password", password);
|
||||
hikariConfig.addDataSourceProperty("url", "jdbc:mysql://" + hostname + ":" + port + "/" + database);
|
||||
hikariConfig.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database);
|
||||
hikariConfig.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
|
||||
hikariDataSource = new HikariDataSource(hikariConfig);
|
||||
}
|
||||
|
||||
public void executeUpdate(final String query, final Consumer<Integer> callback, final Object... objects) {
|
||||
try (final Connection connection = hikariDataSource.getConnection()) {
|
||||
try (final PreparedStatement preparedStatement = connection.prepareStatement(query)) {
|
||||
int current = 1;
|
||||
for (final Object object : objects) {
|
||||
preparedStatement.setObject(current, object);
|
||||
current++;
|
||||
}
|
||||
|
||||
callback.accept(preparedStatement.executeUpdate());
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
System.out.println("Error while executing update method: " + query);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void executeQuery(final String query, final Consumer<ResultSet> callback, final Object... objects) {
|
||||
try (final Connection connection = hikariDataSource.getConnection()) {
|
||||
try (final PreparedStatement preparedStatement = connection.prepareStatement(query)) {
|
||||
int current = 1;
|
||||
for (final Object object : objects) {
|
||||
preparedStatement.setObject(current, object);
|
||||
current++;
|
||||
}
|
||||
|
||||
final ResultSet resultSet = preparedStatement.executeQuery();
|
||||
callback.accept(resultSet);
|
||||
resultSet.close();
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
System.out.println("Error while executing query method: " + query);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void executeUpdate(final String query, final Object... objects) {
|
||||
executeUpdate(query, res -> {
|
||||
}, objects);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package eu.kennytv.maintenance.bungee.runnable;
|
||||
|
||||
import eu.kennytv.maintenance.bungee.MaintenanceBungeePlugin;
|
||||
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
|
||||
import eu.kennytv.maintenance.core.Settings;
|
||||
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnableBase;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
|
||||
public final class SingleMaintenanceRunnable extends MaintenanceRunnableBase {
|
||||
private final ServerInfo server;
|
||||
|
||||
public SingleMaintenanceRunnable(final MaintenanceModePlugin plugin, final Settings settings, final int minutes,
|
||||
final boolean enable, final ServerInfo server) {
|
||||
super(plugin, settings, minutes, enable);
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finish() {
|
||||
final MaintenanceBungeePlugin plugin = (MaintenanceBungeePlugin) this.plugin;
|
||||
plugin.setMaintenanceToServer(server, enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String startMessageKey() {
|
||||
return settings.getMessage("singleStarttimerBroadcast").replace("%TIME%", getTime()).replace("%SERVER%", server.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String endMessageKey() {
|
||||
return settings.getMessage("singleEndtimerBroadcast").replace("%TIME%", getTime()).replace("%SERVER%", server.getName());
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package eu.kennytv.maintenance.bungee.util;
|
||||
|
||||
import eu.kennytv.maintenance.core.util.SenderInfo;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public final class ProxiedSenderInfo implements SenderInfo {
|
||||
private final CommandSender sender;
|
||||
|
||||
public ProxiedSenderInfo(final CommandSender sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUuid() {
|
||||
return sender instanceof ProxiedPlayer ? ((ProxiedPlayer) sender).getUniqueId() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return sender.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final String permission) {
|
||||
return sender.hasPermission(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(final String message) {
|
||||
sender.sendMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayer() {
|
||||
return sender instanceof ProxiedPlayer;
|
||||
}
|
||||
|
||||
public void sendMessage(final TextComponent textComponent) {
|
||||
sender.sendMessage(textComponent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
# Enables maintenance on certain Spigot servers managed by your Bungee instance(s)
|
||||
# If it's enabled on a server with players on it, they will be forwarded to the fallback server (or kicked completely if not set correctly)
|
||||
maintenance-on:
|
||||
#- SpigotServer1
|
||||
#- AnotherServer
|
||||
fallback: hub
|
||||
@@ -0,0 +1,53 @@
|
||||
# MaintenanceBungee Plugin by KennyTV
|
||||
# Configs are cool, which means after the first plugin save, all comments will vanish
|
||||
# To still know what each field is for, check https://gist.github.com/KennyTV/a73f2aed1e278d4c927f9f6a3ef9fde2#file-bungee-config-yml
|
||||
|
||||
# Enables maintenance-mode.
|
||||
enable-maintenance-mode: false
|
||||
|
||||
# The message shown in the multiplayer server list motd.
|
||||
# If you put in multiple entries, one of them will be chosen randomly on every ping.
|
||||
pingmessages:
|
||||
- "&cMaintenance mode!%NEWLINE%&6We will be back soon!"
|
||||
#- "Another entry"
|
||||
|
||||
# If set to true, the message below will be shown at the top right corner of the server in the serverlist,
|
||||
# where the playercount would normally be displayed.
|
||||
# If set to false, the normal playercount will be shown.
|
||||
# Alternatively you can use '%ONLINE%' and '%MAX% if you want to include the playercount in a custom message (e.g. '&cMaintenance &7%ONLINE%&8/&7%MAX%').
|
||||
enable-playercountmessage: true
|
||||
playercountmessage: "&4Maintenance"
|
||||
|
||||
# Is shown when you move your mouse above the text at the top right corner of the server in the serverlist,
|
||||
# where the playercount would normally be displayed.
|
||||
playercounthovermessage: "&cCurrently under%NEWLINE%&cmaintenance"
|
||||
|
||||
# Is shown when a player tries to join while maintenance is enabled and they don't have the permission to bypass it.
|
||||
kickmessage: "&cThe server is currently under maintenance!%NEWLINE%Try again later!"
|
||||
|
||||
# If using the timer command: In what intervalls before enabling/disabling maintenance there will be a broadcast.
|
||||
timer-broadcast-for-seconds: [1200, 900, 600, 300, 120, 60, 30, 20, 10, 5, 4, 3, 2, 1]
|
||||
|
||||
# If set to true, players with the maintenance.joinnotification permission will receive a message,
|
||||
# that a player tried to join the server while maintenance is enabled.
|
||||
send-join-notification: false
|
||||
|
||||
# If set to true, the server icon will be changed to maintenance-icon.png in the Bungee main/base-folder.
|
||||
custom-maintenance-icon: false
|
||||
|
||||
# Changes the language of command feedback/messages.
|
||||
# Currently available are: en (English), de (German), fr (French), pt (Portuguese)
|
||||
language: en
|
||||
|
||||
# Only enable MySQL if you really know what you are doing.
|
||||
mysql:
|
||||
use-mysql: false
|
||||
host: host
|
||||
port: 3306
|
||||
database: database
|
||||
username: username
|
||||
password: password
|
||||
# Requests to the database will only be made at least x seconds after the last request,
|
||||
# so there won't be a request on every single ping on a server with many players.
|
||||
# Set this to 0 to make a database request on every single ping.
|
||||
update-interval: 15
|
||||
@@ -0,0 +1,6 @@
|
||||
name: ${project.name}
|
||||
version: ${project.version}
|
||||
main: eu.kennytv.maintenance.bungee.MaintenanceBungeeBase
|
||||
author: KennyTV
|
||||
softDepends: [ServerListPlus]
|
||||
website: https://www.spigotmc.org/resources/maintenancemode.40699/
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-core</artifactId>
|
||||
<name>Maintenance-Core</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.minecrell</groupId>
|
||||
<artifactId>ServerListPlus</artifactId>
|
||||
<version>3.4.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<artifactId>maintenance-api</artifactId>
|
||||
<version>${parent.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
package eu.kennytv.maintenance.core;
|
||||
|
||||
import eu.kennytv.maintenance.api.IMaintenance;
|
||||
import eu.kennytv.maintenance.core.hook.ServerListPlusHook;
|
||||
import eu.kennytv.maintenance.core.runnable.MaintenanceRunnable;
|
||||
import eu.kennytv.maintenance.core.util.ServerType;
|
||||
import eu.kennytv.maintenance.core.util.Version;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public abstract class MaintenanceModePlugin implements IMaintenance {
|
||||
protected final Version version;
|
||||
protected ServerListPlusHook serverListPlusHook;
|
||||
protected MaintenanceRunnable runnable;
|
||||
protected int taskId;
|
||||
private final String prefix;
|
||||
private final ServerType serverType;
|
||||
private Version newestVersion;
|
||||
|
||||
protected MaintenanceModePlugin(final String prefix, final String version, final ServerType serverType) {
|
||||
this.prefix = prefix;
|
||||
this.version = new Version(version);
|
||||
this.serverType = serverType;
|
||||
checkNewestVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMaintenance() {
|
||||
return getSettings().isMaintenance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return version.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTaskRunning() {
|
||||
return taskId != 0 && runnable != null;
|
||||
}
|
||||
|
||||
public void startMaintenanceRunnable(final int minutes, final boolean enable) {
|
||||
runnable = new MaintenanceRunnable(this, (Settings) getSettings(), minutes, enable);
|
||||
taskId = startMaintenanceRunnable(runnable);
|
||||
}
|
||||
|
||||
public Version getNewestVersion() {
|
||||
return newestVersion;
|
||||
}
|
||||
|
||||
protected abstract int startMaintenanceRunnable(Runnable runnable);
|
||||
|
||||
public abstract void async(Runnable runnable);
|
||||
|
||||
public abstract void cancelTask();
|
||||
|
||||
public abstract File getPluginFile();
|
||||
|
||||
public abstract void broadcast(String message);
|
||||
|
||||
public MaintenanceRunnable getRunnable() {
|
||||
return runnable;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public ServerType getServerType() {
|
||||
return serverType;
|
||||
}
|
||||
|
||||
public String formatedTimer() {
|
||||
if (!isTaskRunning()) return "-";
|
||||
final int preHours = runnable.getSecondsLeft() / 60;
|
||||
final int minutes = preHours % 60;
|
||||
final int seconds = runnable.getSecondsLeft() % 60;
|
||||
return String.format("%02d:%02d:%02d", preHours / 60, minutes, seconds);
|
||||
}
|
||||
|
||||
public void checkNewestVersion() {
|
||||
try {
|
||||
final HttpURLConnection c = (HttpURLConnection) new URL("https://api.spigotmc.org/legacy/update.php?resource=40699").openConnection();
|
||||
final String newVersionString = new BufferedReader(new InputStreamReader(c.getInputStream())).readLine();
|
||||
|
||||
final Version newVersion = new Version(newVersionString);
|
||||
final boolean available = !newVersion.equals(version);
|
||||
if (available)
|
||||
newestVersion = newVersion;
|
||||
} catch (final Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean updateAvailable() {
|
||||
checkNewestVersion();
|
||||
return version.compareTo(newestVersion) == -1;
|
||||
}
|
||||
|
||||
public String getUpdateMessage() {
|
||||
if (version.compareTo(newestVersion) == -1) {
|
||||
return "§cNewest version available: §aVersion " + newestVersion + "§c, you're on §a" + version;
|
||||
} else if (version.compareTo(newestVersion) != 0) {
|
||||
if (version.getTag().equalsIgnoreCase("snapshot")) {
|
||||
return "§cYou're running a development version, please report bugs on the Discord server (https://kennytv.eu/discord) or the GitHub tracker (https://kennytv.eu/maintenance/issues)";
|
||||
} else {
|
||||
return "§cYou're running a version, that doesn't exist! §cN§ai§dc§ee§5!";
|
||||
}
|
||||
}
|
||||
return "You have the latest version of the plugin installed.";
|
||||
}
|
||||
|
||||
public boolean installUpdate() {
|
||||
try {
|
||||
URL url = null;
|
||||
try {
|
||||
url = new URL("https://github.com/KennyTV/Maintenance/releases/download/" + newestVersion + "/Maintenance.jar");
|
||||
} catch (final MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
final URLConnection conn = url.openConnection();
|
||||
final InputStream is = new BufferedInputStream(conn.getInputStream());
|
||||
final OutputStream os = new BufferedOutputStream(new FileOutputStream("plugins/Maintenance.tmp"));
|
||||
final byte[] chunk = new byte[1024];
|
||||
int chunkSize;
|
||||
while ((chunkSize = is.read(chunk)) != -1) {
|
||||
os.write(chunk, 0, chunkSize);
|
||||
}
|
||||
os.close();
|
||||
final File newfile = new File("plugins/Maintenance.tmp");
|
||||
final long newlength = newfile.length();
|
||||
if (newlength <= 10000) {
|
||||
newfile.delete();
|
||||
return false;
|
||||
} else {
|
||||
final FileInputStream is2 = new FileInputStream(new File("plugins/Maintenance.tmp"));
|
||||
final OutputStream os2 = new BufferedOutputStream(new FileOutputStream(getPluginFile()));
|
||||
final byte[] chunk2 = new byte[1024];
|
||||
int chunkSize2;
|
||||
while ((chunkSize2 = is2.read(chunk2)) != -1)
|
||||
os2.write(chunk2, 0, chunkSize2);
|
||||
is2.close();
|
||||
os2.close();
|
||||
|
||||
final File tmp = new File("plugins/Maintenance.tmp");
|
||||
tmp.delete();
|
||||
return true;
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract Logger getLogger();
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
package eu.kennytv.maintenance.core;
|
||||
|
||||
import eu.kennytv.maintenance.api.ISettings;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class Settings implements ISettings {
|
||||
private static final Random RANDOM = new Random();
|
||||
protected final Map<UUID, String> whitelistedPlayers = new HashMap<>();
|
||||
private final MaintenanceModePlugin plugin;
|
||||
protected boolean maintenance;
|
||||
private Set<Integer> broadcastIntervalls;
|
||||
private List<String> pingMessages;
|
||||
private String playerCountMessage;
|
||||
private String playerCountHoverMessage;
|
||||
private String kickMessage;
|
||||
protected String languageName;
|
||||
private boolean customPlayerCountMessage;
|
||||
private boolean customMaintenanceIcon;
|
||||
private boolean joinNotifications;
|
||||
private boolean debug;
|
||||
|
||||
protected Settings(final MaintenanceModePlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
protected void loadSettings() {
|
||||
updateConfig();
|
||||
|
||||
pingMessages = getConfigList("pingmessages");
|
||||
maintenance = getConfigBoolean("enable-maintenance-mode");
|
||||
customPlayerCountMessage = getConfigBoolean("enable-playercountmessage");
|
||||
customMaintenanceIcon = getConfigBoolean("custom-maintenance-icon");
|
||||
joinNotifications = getConfigBoolean("send-join-notification");
|
||||
broadcastIntervalls = new HashSet<>(getConfigIntList("timer-broadcast-for-seconds"));
|
||||
playerCountMessage = getColoredString(getConfigString("playercountmessage"));
|
||||
playerCountHoverMessage = getColoredString(getConfigString("playercounthovermessage"));
|
||||
kickMessage = getColoredString(getConfigString("kickmessage"));
|
||||
languageName = getConfigString("language").toLowerCase();
|
||||
debug = getConfigBoolean("debug");
|
||||
if (customMaintenanceIcon) {
|
||||
reloadMaintenanceIcon();
|
||||
}
|
||||
|
||||
loadExtraSettings();
|
||||
if (debug) {
|
||||
plugin.getLogger().info("enable-maintenance-mode:" + maintenance);
|
||||
plugin.getLogger().info("whitelistedPlayers:" + whitelistedPlayers);
|
||||
plugin.getLogger().info("timer-broadcast-for-seconds:" + broadcastIntervalls);
|
||||
plugin.getLogger().info("pingmessages:" + pingMessages);
|
||||
plugin.getLogger().info("playercountmessage:" + playerCountMessage);
|
||||
plugin.getLogger().info("playercounthovermessage:" + playerCountHoverMessage);
|
||||
plugin.getLogger().info("kickmessage:" + kickMessage);
|
||||
plugin.getLogger().info("language:" + languageName);
|
||||
plugin.getLogger().info("enable-playercountmessage:" + customPlayerCountMessage);
|
||||
plugin.getLogger().info("custom-maintenance-icon:" + customMaintenanceIcon);
|
||||
plugin.getLogger().info("send-join-notification:" + joinNotifications);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfig() {
|
||||
boolean fileChanged = false;
|
||||
|
||||
// 2.3 pingmessage -> pingmessages
|
||||
if (configContains("pingmessage")) {
|
||||
final List<String> list = new ArrayList<>();
|
||||
list.add(getConfigString("pingmessage"));
|
||||
setToConfig("pingmessages", list);
|
||||
setToConfig("pingmessage", null);
|
||||
fileChanged = true;
|
||||
}
|
||||
// 2.4 enable-playercountmessage
|
||||
if (!configContains("enable-playercountmessage")) {
|
||||
setToConfig("enable-playercountmessage", true);
|
||||
fileChanged = true;
|
||||
}
|
||||
// 2.4. timer-broadcasts-for-minutes -> timer-broadcast-for-seconds
|
||||
if (configContains("timer-broadcasts-for-minutes") || !configContains("timer-broadcast-for-seconds")) {
|
||||
setToConfig("timer-broadcast-for-seconds", Arrays.asList(1200, 900, 600, 300, 120, 60, 30, 20, 10, 5, 4, 3, 2, 1));
|
||||
setToConfig("timer-broadcasts-for-minutes", null);
|
||||
fileChanged = true;
|
||||
}
|
||||
// 2.5 language
|
||||
if (!configContains("language")) {
|
||||
setToConfig("language", "en");
|
||||
}
|
||||
|
||||
if (updateExtraConfig() || fileChanged) {
|
||||
saveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean updateExtraConfig() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract void saveWhitelistedPlayers();
|
||||
|
||||
public abstract String getConfigString(String path);
|
||||
|
||||
public abstract String getMessage(String path);
|
||||
|
||||
public abstract boolean getConfigBoolean(String path);
|
||||
|
||||
public abstract List<Integer> getConfigIntList(String path);
|
||||
|
||||
public abstract List<String> getConfigList(String path);
|
||||
|
||||
public abstract void loadExtraSettings();
|
||||
|
||||
public abstract void setWhitelist(String uuid, String s);
|
||||
|
||||
public abstract void saveConfig();
|
||||
|
||||
public abstract void reloadConfigs();
|
||||
|
||||
public abstract void setToConfig(String path, Object var);
|
||||
|
||||
public abstract boolean configContains(String path);
|
||||
|
||||
public abstract String getColoredString(String s);
|
||||
|
||||
public List<String> getPingMessages() {
|
||||
return pingMessages;
|
||||
}
|
||||
|
||||
public Set<Integer> getBroadcastIntervalls() {
|
||||
return broadcastIntervalls;
|
||||
}
|
||||
|
||||
public String getPlayerCountMessage() {
|
||||
return playerCountMessage;
|
||||
}
|
||||
|
||||
public String getPlayerCountHoverMessage() {
|
||||
return playerCountHoverMessage;
|
||||
}
|
||||
|
||||
public String getKickMessage() {
|
||||
return kickMessage;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return languageName;
|
||||
}
|
||||
|
||||
public void setMaintenance(final boolean maintenance) {
|
||||
this.maintenance = maintenance;
|
||||
}
|
||||
|
||||
public String getRandomPingMessage() {
|
||||
if (pingMessages.isEmpty()) return "";
|
||||
final String s = pingMessages.size() > 1 ? pingMessages.get(RANDOM.nextInt(pingMessages.size())) : pingMessages.get(0);
|
||||
return getColoredString(s.replace("%NEWLINE%", "\n").replace("%TIMER%", plugin.formatedTimer()));
|
||||
}
|
||||
|
||||
public boolean hasCustomPlayerCountMessage() {
|
||||
return customPlayerCountMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMaintenance() {
|
||||
return maintenance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJoinNotifications() {
|
||||
return joinNotifications;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomIcon() {
|
||||
return customMaintenanceIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<UUID, String> getWhitelistedPlayers() {
|
||||
return whitelistedPlayers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeWhitelistedPlayer(final UUID uuid) {
|
||||
if (!whitelistedPlayers.containsKey(uuid)) return false;
|
||||
whitelistedPlayers.remove(uuid);
|
||||
setWhitelist(uuid.toString(), null);
|
||||
saveWhitelistedPlayers();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean removeWhitelistedPlayer(final String name) {
|
||||
final Map.Entry<UUID, String> entry = whitelistedPlayers.entrySet().stream().filter(e -> e.getValue().equalsIgnoreCase(name)).findAny().orElse(null);
|
||||
if (entry == null) return false;
|
||||
|
||||
final UUID uuid = entry.getKey();
|
||||
whitelistedPlayers.remove(uuid);
|
||||
setWhitelist(uuid.toString(), null);
|
||||
saveWhitelistedPlayers();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addWhitelistedPlayer(final UUID uuid, final String name) {
|
||||
final boolean contains = !whitelistedPlayers.containsKey(uuid);
|
||||
whitelistedPlayers.put(uuid, name);
|
||||
setWhitelist(uuid.toString(), name);
|
||||
saveWhitelistedPlayers();
|
||||
return contains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean debugEnabled() {
|
||||
return debug;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package eu.kennytv.maintenance.core.command;
|
||||
|
||||
import eu.kennytv.maintenance.core.util.SenderInfo;
|
||||
|
||||
final class CommandInfo {
|
||||
private final String[] messages;
|
||||
private final String permission;
|
||||
|
||||
CommandInfo(final String permission, final String... messages) {
|
||||
this.messages = messages;
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public boolean hasPermission(final SenderInfo sender) {
|
||||
return sender.hasPermission("maintenance." + permission);
|
||||
}
|
||||
|
||||
public String[] getMessages() {
|
||||
return messages;
|
||||
}
|
||||
}
|
||||
+315
@@ -0,0 +1,315 @@
|
||||
package eu.kennytv.maintenance.core.command;
|
||||
|
||||
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
|
||||
import eu.kennytv.maintenance.core.Settings;
|
||||
import eu.kennytv.maintenance.core.util.SenderInfo;
|
||||
import eu.kennytv.maintenance.core.util.ServerType;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class MaintenanceCommand {
|
||||
protected final MaintenanceModePlugin plugin;
|
||||
protected final Settings settings;
|
||||
private final List<CommandInfo> commandInfos;
|
||||
private final String name;
|
||||
|
||||
protected MaintenanceCommand(final MaintenanceModePlugin plugin, final Settings settings, final String name) {
|
||||
this.plugin = plugin;
|
||||
this.settings = settings;
|
||||
this.name = name;
|
||||
this.commandInfos = new ArrayList<>();
|
||||
addCommandInfo("reload", "§6/maintenance reload §7(Reloads the config file, whitelist file and the server-icon)");
|
||||
addCommandInfo("toggle", "§6/maintenance on §7(Enables maintenance mode)", "§6/maintenance off §7(Disables maintenance mode)");
|
||||
if (plugin.getServerType() == ServerType.BUNGEE) {
|
||||
addCommandInfo("toggleserver", "§6/maintenance on <server> §7(Enables maintenance mode on a specific proxied server)",
|
||||
"§6/maintenance off <server> §7(Disables maintenance mode on a specific proxied server)");
|
||||
}
|
||||
addCommandInfo("timer", "§6/maintenance starttimer <minutes> §7(After the given time in minutes, maintenance mode will be enabled)",
|
||||
"§6/maintenance endtimer <minutes> §7(After the given time in minutes, maintenance mode will be disabled)",
|
||||
"§6/maintenance timer abort §7(If running, the current timer will be aborted)");
|
||||
if (plugin.getServerType() == ServerType.BUNGEE) {
|
||||
addCommandInfo("servertimer", "§6/maintenance starttimer <server> <minutes> §7(After the given time in minutes, maintenance mode will be enabled on the given server)",
|
||||
"§6/maintenance endtimer <server> <minutes> §7(After the given time in minutes, maintenance mode will be disabled on the given server)",
|
||||
"§6/maintenance timer abort <server> §7(If running, the timer running for that server will be aborted)");
|
||||
}
|
||||
addCommandInfo("whitelist.list", "§6/maintenance whitelist §7(Shows all whitelisted players for the maintenance mode)");
|
||||
addCommandInfo("whitelist.add", "§6/maintenance add <player> §7(Adds the player to the maintenance whitelist, so they can join the server even though maintenance is enabled)");
|
||||
addCommandInfo("whitelist.remove", "§6/maintenance remove <player> §7(Removes the player from the maintenance whitelist)");
|
||||
addCommandInfo("setmotd", "§6/maintenance setmotd <index> <1/2> <message> §7(Sets a motd for maintenance mode)", "§6/maintenance removemotd <index> §7(Removes a maintenance motd)");
|
||||
addCommandInfo("motd", "§6/maintenance motd §7(Lists the currently set maintenance motds)");
|
||||
addCommandInfo("update", "§6/maintenance update §7(Remotely downloads the newest version of the plugin onto your server)");
|
||||
}
|
||||
|
||||
private void addCommandInfo(final String permission, final String... messages) {
|
||||
commandInfos.add(new CommandInfo(permission, messages));
|
||||
}
|
||||
|
||||
public void execute(final SenderInfo sender, final String[] args) {
|
||||
if (checkPermission(sender, "command")) return;
|
||||
if (args.length == 1) {
|
||||
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("off")) {
|
||||
if (checkPermission(sender, "toggle")) return;
|
||||
|
||||
final boolean maintenance = args[0].equalsIgnoreCase("on");
|
||||
if (maintenance == plugin.isMaintenance()) {
|
||||
sender.sendMessage(settings.getMessage(maintenance ? "alreadyEnabled" : "alreadyDisabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.setMaintenance(maintenance);
|
||||
} else if (args[0].equalsIgnoreCase("reload")) {
|
||||
if (checkPermission(sender, "reload")) return;
|
||||
settings.reloadConfigs();
|
||||
sender.sendMessage(settings.getMessage("reload"));
|
||||
} else if (args[0].equalsIgnoreCase("update")) {
|
||||
if (checkPermission(sender, "update")) return;
|
||||
checkForUpdate(sender);
|
||||
} else if (args[0].equals("forceupdate")) {
|
||||
if (checkPermission(sender, "update")) return;
|
||||
sender.sendMessage(settings.getMessage("updateDownloading"));
|
||||
if (plugin.installUpdate())
|
||||
sender.sendMessage(settings.getMessage("updateFinished"));
|
||||
else
|
||||
sender.sendMessage(settings.getMessage("updateFailed"));
|
||||
} else if (args[0].equalsIgnoreCase("whitelist")) {
|
||||
if (checkPermission(sender, "whitelist.list")) return;
|
||||
final Map<UUID, String> players = settings.getWhitelistedPlayers();
|
||||
if (players.isEmpty()) {
|
||||
sender.sendMessage(settings.getMessage("whitelistEmtpy"));
|
||||
} else if (players.size() == 1 && players.containsKey(UUID.fromString("a8179ff3-c201-4a75-bdaa-9d14aca6f83f"))) {
|
||||
sender.sendMessage(settings.getMessage("whitelistEmptyDefault"));
|
||||
} else {
|
||||
sender.sendMessage(settings.getMessage("whitelistedPlayers"));
|
||||
final String format = settings.getMessage("whitelistedPlayersFormat");
|
||||
players.forEach((key, value) -> sender.sendMessage(format.replace("%NAME%", value).replace("%UUID%", key.toString())));
|
||||
sender.sendMessage("");
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("motd")) {
|
||||
if (checkPermission(sender, "motd")) return;
|
||||
sender.sendMessage(settings.getMessage("motdList"));
|
||||
for (int i = 0; i < settings.getPingMessages().size(); i++) {
|
||||
sender.sendMessage("§b" + (i + 1) + "§8§m---------");
|
||||
for (final String motd : settings.getColoredString(settings.getPingMessages().get(i)).split("%NEWLINE%")) {
|
||||
sender.sendMessage(motd);
|
||||
}
|
||||
}
|
||||
sender.sendMessage("§8§m----------");
|
||||
} else if (args[0].equalsIgnoreCase("status") && plugin.getServerType() == ServerType.BUNGEE) {
|
||||
if (checkPermission(sender, "status")) return;
|
||||
showMaintenanceStatus(sender);
|
||||
} else
|
||||
sendUsage(sender);
|
||||
} else if (args.length == 2) {
|
||||
if (args[0].equalsIgnoreCase("help")) {
|
||||
if (!isNumeric(args[1])) {
|
||||
sender.sendMessage(settings.getMessage("helpUsage"));
|
||||
return;
|
||||
}
|
||||
sendUsage(sender, Integer.parseInt(args[1]));
|
||||
} else if ((args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("off")) && plugin.getServerType() == ServerType.BUNGEE) {
|
||||
if (checkPermission(sender, "toggleserver")) return;
|
||||
handleToggleServerCommand(sender, args);
|
||||
} else if (args[0].equalsIgnoreCase("endtimer")) {
|
||||
if (checkPermission(sender, "timer")) return;
|
||||
if (checkTimerArgs(sender, args[1], "endtimerUsage")) return;
|
||||
if (!plugin.isMaintenance()) {
|
||||
sender.sendMessage(settings.getMessage("alreadyDisabled"));
|
||||
return;
|
||||
}
|
||||
plugin.startMaintenanceRunnable(Integer.parseInt(args[1]), false);
|
||||
sender.sendMessage(settings.getMessage("endtimerStarted").replace("%TIME%", plugin.getRunnable().getTime()));
|
||||
} else if (args[0].equalsIgnoreCase("starttimer")) {
|
||||
if (checkPermission(sender, "timer")) return;
|
||||
if (checkTimerArgs(sender, args[1], "starttimerUsage")) return;
|
||||
if (plugin.isMaintenance()) {
|
||||
sender.sendMessage(settings.getMessage("alreadyEnabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.startMaintenanceRunnable(Integer.parseInt(args[1]), true);
|
||||
sender.sendMessage(settings.getMessage("starttimerStarted").replace("%TIME%", plugin.getRunnable().getTime()));
|
||||
} else if (args[0].equalsIgnoreCase("timer")) {
|
||||
if (args[1].equalsIgnoreCase("abort") || args[1].equalsIgnoreCase("stop") || args[1].equalsIgnoreCase("cancel")) {
|
||||
if (checkPermission(sender, "timer")) return;
|
||||
if (!plugin.isTaskRunning()) {
|
||||
sender.sendMessage(settings.getMessage("timerNotRunning"));
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.cancelTask();
|
||||
sender.sendMessage(settings.getMessage("timerCancelled"));
|
||||
} else
|
||||
sendUsage(sender);
|
||||
} else if (args[0].equalsIgnoreCase("add")) {
|
||||
if (checkPermission(sender, "whitelist.add")) return;
|
||||
addPlayerToWhitelist(sender, args[1]);
|
||||
} else if (args[0].equalsIgnoreCase("remove")) {
|
||||
if (checkPermission(sender, "whitelist.remove")) return;
|
||||
removePlayerFromWhitelist(sender, args[1]);
|
||||
} else if (args[0].equalsIgnoreCase("removemotd")) {
|
||||
if (checkPermission(sender, "setmotd")) return;
|
||||
if (!isNumeric(args[1])) {
|
||||
sender.sendMessage(settings.getMessage("removeMotdUsage"));
|
||||
return;
|
||||
}
|
||||
if (settings.getPingMessages().size() < 2) {
|
||||
sender.sendMessage(settings.getMessage("removeMotdError"));
|
||||
return;
|
||||
}
|
||||
|
||||
final int index = Integer.parseInt(args[1]);
|
||||
if (index > settings.getPingMessages().size()) {
|
||||
sender.sendMessage(settings.getMessage("setMotdIndexError").replace("%MOTDS%", Integer.toString(settings.getPingMessages().size()))
|
||||
.replace("%NEWAMOUNT%", Integer.toString(settings.getPingMessages().size())));
|
||||
return;
|
||||
}
|
||||
|
||||
settings.getPingMessages().remove(index - 1);
|
||||
settings.setToConfig("pingmessages", settings.getPingMessages());
|
||||
settings.saveConfig();
|
||||
sender.sendMessage(settings.getMessage("removedMotd").replace("%INDEX%", args[1]));
|
||||
} else
|
||||
sendUsage(sender);
|
||||
} else if (args.length == 3 && plugin.getServerType() == ServerType.BUNGEE) {
|
||||
handleTimerServerCommands(sender, args);
|
||||
} else if (args.length > 3 && args[0].equalsIgnoreCase("setmotd")) {
|
||||
if (checkPermission(sender, "setmotd")) return;
|
||||
if (!isNumeric(args[1])) {
|
||||
sender.sendMessage(settings.getMessage("setMotdUsage"));
|
||||
return;
|
||||
}
|
||||
|
||||
final int index = Integer.parseInt(args[1]);
|
||||
if (index < 1 || index > settings.getPingMessages().size() + 1) {
|
||||
sender.sendMessage(settings.getMessage("setMotdIndexError").replace("%MOTDS%", Integer.toString(settings.getPingMessages().size()))
|
||||
.replace("%NEWAMOUNT%", Integer.toString(settings.getPingMessages().size() + 1)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isNumeric(args[2])) {
|
||||
sender.sendMessage(settings.getMessage("setMotdLineError"));
|
||||
return;
|
||||
}
|
||||
|
||||
final int line = Integer.parseInt(args[2]);
|
||||
if (line != 1 && line != 2) {
|
||||
sender.sendMessage(settings.getMessage("setMotdLineError"));
|
||||
return;
|
||||
}
|
||||
|
||||
final String message = String.join(" ", Arrays.copyOfRange(args, 3, args.length));
|
||||
final String oldMessage = index > settings.getPingMessages().size() ? "" : settings.getPingMessages().get(index - 1);
|
||||
final String newMessage;
|
||||
if (line == 1)
|
||||
newMessage = oldMessage.contains("%NEWLINE%") ?
|
||||
message + "%NEWLINE%" + oldMessage.split("%NEWLINE%", 2)[1] : message;
|
||||
else
|
||||
newMessage = oldMessage.contains("%NEWLINE%") ?
|
||||
oldMessage.split("%NEWLINE%", 2)[0] + "%NEWLINE%" + message : oldMessage + "%NEWLINE%" + message;
|
||||
|
||||
if (index > settings.getPingMessages().size())
|
||||
settings.getPingMessages().add(newMessage);
|
||||
else
|
||||
settings.getPingMessages().set(index - 1, newMessage);
|
||||
settings.setToConfig("pingmessages", settings.getPingMessages());
|
||||
settings.saveConfig();
|
||||
sender.sendMessage(settings.getMessage("setMotd").replace("%LINE%", args[2]).replace("%INDEX%", args[1])
|
||||
.replace("%MOTD%", "§f" + settings.getColoredString(message)));
|
||||
} else
|
||||
sendUsage(sender);
|
||||
}
|
||||
|
||||
protected void sendUsage(final SenderInfo sender) {
|
||||
sendUsage(sender, 1);
|
||||
}
|
||||
|
||||
private static final int COMMANDS_PER_PAGE = 8;
|
||||
|
||||
protected void sendUsage(final SenderInfo sender, final int page) {
|
||||
final List<String> commands = new ArrayList<>();
|
||||
commandInfos.stream().filter(cmd -> cmd.hasPermission(sender)).forEach(cmd -> {
|
||||
for (final String message : cmd.getMessages()) {
|
||||
commands.add(message);
|
||||
}
|
||||
});
|
||||
if ((page - 1) * COMMANDS_PER_PAGE > commands.size()) {
|
||||
sender.sendMessage(settings.getMessage("helpPageNotFound"));
|
||||
return;
|
||||
}
|
||||
|
||||
final List<String> filteredCommands;
|
||||
if (page * COMMANDS_PER_PAGE >= commands.size())
|
||||
filteredCommands = commands.subList((page - 1) * COMMANDS_PER_PAGE, commands.size());
|
||||
else
|
||||
filteredCommands = commands.subList((page - 1) * COMMANDS_PER_PAGE, page * COMMANDS_PER_PAGE);
|
||||
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage("§8========[ §e" + name + " §8| §eVersion: §e" + plugin.getVersion() + " §8]========");
|
||||
filteredCommands.forEach(sender::sendMessage);
|
||||
if (page * 10 < commands.size())
|
||||
sender.sendMessage("§7Use §b/maintenance help " + (page + 1) + " §7to get to the next help window.");
|
||||
else
|
||||
sender.sendMessage("§8× §7Created by §bKennyTV");
|
||||
sender.sendMessage("§8========[ §e" + name + " §8| §e" + page + "/" + ((commands.size() + getDivide(commands.size())) / COMMANDS_PER_PAGE) + " §8]========");
|
||||
sender.sendMessage("");
|
||||
}
|
||||
|
||||
private int getDivide(final int size) {
|
||||
final int commandSize = size % COMMANDS_PER_PAGE;
|
||||
return commandSize > 0 ? COMMANDS_PER_PAGE - commandSize : 0;
|
||||
}
|
||||
|
||||
protected boolean checkTimerArgs(final SenderInfo sender, final String time, final String usageKey) {
|
||||
if (!isNumeric(time)) {
|
||||
sender.sendMessage(settings.getMessage(usageKey));
|
||||
return true;
|
||||
}
|
||||
if (plugin.isTaskRunning()) {
|
||||
sender.sendMessage(settings.getMessage("timerAlreadyRunning"));
|
||||
return true;
|
||||
}
|
||||
|
||||
final int minutes = Integer.parseInt(time);
|
||||
if (minutes > 40320) {
|
||||
sender.sendMessage(settings.getMessage("timerTooLong"));
|
||||
return true;
|
||||
}
|
||||
if (minutes < 1) {
|
||||
sender.sendMessage("§8§o[KennyTV whispers to you] §c§oThink about running a timer for a negative amount of minutes. Doesn't work §lthat §c§owell.");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean checkPermission(final SenderInfo sender, final String permission) {
|
||||
if (!sender.hasPermission("maintenance." + permission)) {
|
||||
sender.sendMessage(settings.getMessage("noPermission"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isNumeric(final String string) {
|
||||
try {
|
||||
Integer.parseInt(string);
|
||||
} catch (final NumberFormatException nfe) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract void addPlayerToWhitelist(SenderInfo sender, String name);
|
||||
|
||||
protected abstract void removePlayerFromWhitelist(SenderInfo sender, String name);
|
||||
|
||||
protected abstract void checkForUpdate(SenderInfo sender);
|
||||
|
||||
protected void showMaintenanceStatus(SenderInfo sender) {
|
||||
}
|
||||
|
||||
protected void handleToggleServerCommand(SenderInfo sender, String[] args) {
|
||||
}
|
||||
|
||||
protected void handleTimerServerCommands(SenderInfo sender, String[] args) {
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package eu.kennytv.maintenance.core.hook;
|
||||
|
||||
import net.minecrell.serverlistplus.core.ServerListPlusCore;
|
||||
|
||||
public final class ServerListPlusHook {
|
||||
private final ServerListPlusCore serverListPlusCore;
|
||||
|
||||
public ServerListPlusHook(final ServerListPlusCore serverListPlusCore) {
|
||||
this.serverListPlusCore = serverListPlusCore;
|
||||
}
|
||||
|
||||
public void setEnabled(final boolean enable) {
|
||||
serverListPlusCore.getProfiles().setEnabled(enable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package eu.kennytv.maintenance.core.listener;
|
||||
|
||||
public interface IPingListener {
|
||||
|
||||
boolean loadIcon();
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package eu.kennytv.maintenance.core.runnable;
|
||||
|
||||
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
|
||||
import eu.kennytv.maintenance.core.Settings;
|
||||
|
||||
public final class MaintenanceRunnable extends MaintenanceRunnableBase {
|
||||
|
||||
public MaintenanceRunnable(final MaintenanceModePlugin plugin, final Settings settings, final int minutes, final boolean enable) {
|
||||
super(plugin, settings, minutes, enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finish() {
|
||||
plugin.setMaintenance(enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String startMessageKey() {
|
||||
return settings.getMessage("starttimerBroadcast").replace("%TIME%", getTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String endMessageKey() {
|
||||
return settings.getMessage("endtimerBroadcast").replace("%TIME%", getTime());
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package eu.kennytv.maintenance.core.runnable;
|
||||
|
||||
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
|
||||
import eu.kennytv.maintenance.core.Settings;
|
||||
|
||||
public abstract class MaintenanceRunnableBase implements Runnable {
|
||||
protected final MaintenanceModePlugin plugin;
|
||||
protected final Settings settings;
|
||||
protected final boolean enable;
|
||||
protected int seconds;
|
||||
|
||||
protected MaintenanceRunnableBase(final MaintenanceModePlugin plugin, final Settings settings, final int minutes, final boolean enable) {
|
||||
this.plugin = plugin;
|
||||
this.settings = settings;
|
||||
this.seconds = minutes * 60;
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (seconds == 0) {
|
||||
finish();
|
||||
} else if (settings.getBroadcastIntervalls().contains(seconds)) {
|
||||
if (enable)
|
||||
plugin.broadcast(startMessageKey());
|
||||
else
|
||||
plugin.broadcast(endMessageKey());
|
||||
}
|
||||
|
||||
seconds--;
|
||||
}
|
||||
|
||||
protected abstract void finish();
|
||||
|
||||
protected abstract String startMessageKey();
|
||||
|
||||
protected abstract String endMessageKey();
|
||||
|
||||
public String getTime() {
|
||||
final int preHours = this.seconds / 60;
|
||||
final int minutes = preHours % 60;
|
||||
final int seconds = this.seconds % 60;
|
||||
|
||||
final StringBuilder buider = new StringBuilder();
|
||||
append(buider, "hour", preHours / 60);
|
||||
append(buider, "minute", minutes);
|
||||
append(buider, "second", seconds);
|
||||
return buider.toString();
|
||||
}
|
||||
|
||||
private void append(final StringBuilder builder, final String timeUnit, final int time) {
|
||||
if (time == 0) return;
|
||||
if (builder.length() != 0)
|
||||
builder.append(" ");
|
||||
builder.append(time).append(" ").append(settings.getMessage(time == 1 ? timeUnit : timeUnit + "s"));
|
||||
}
|
||||
|
||||
public int getSecondsLeft() {
|
||||
return seconds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package eu.kennytv.maintenance.core.util;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface SenderInfo {
|
||||
|
||||
UUID getUuid();
|
||||
|
||||
String getName();
|
||||
|
||||
boolean hasPermission(String permission);
|
||||
|
||||
void sendMessage(String message);
|
||||
|
||||
boolean isPlayer();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package eu.kennytv.maintenance.core.util;
|
||||
|
||||
public enum ServerType {
|
||||
|
||||
BUNGEE,
|
||||
SPIGOT
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package eu.kennytv.maintenance.core.util;
|
||||
|
||||
public final class Version implements Comparable<Version> {
|
||||
private final int[] parts = new int[3];
|
||||
private final String version;
|
||||
private final String tag;
|
||||
|
||||
public Version(final String version) {
|
||||
if (version == null || version.isEmpty()) {
|
||||
this.version = "";
|
||||
tag = "";
|
||||
System.out.println("Unknown Maintenance version detected!");
|
||||
return;
|
||||
}
|
||||
final String[] split = version.split("-", 2)[0].split("\\.");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
if (!isNumeric(split[i])) {
|
||||
this.version = "";
|
||||
tag = "";
|
||||
System.out.println("Unknown Maintenance version detected!");
|
||||
return;
|
||||
}
|
||||
parts[i] = Integer.parseInt(split[i]);
|
||||
}
|
||||
|
||||
this.version = version;
|
||||
tag = version.contains("-") ? version.split("-", 2)[1] : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two versions
|
||||
*
|
||||
* @param version version to compare to
|
||||
* @return 0 if they are the same, 1 if this version (not the one to compare to) is newer, -1 if older
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(final Version version) {
|
||||
if (version == null || version.toString() == null) return 0;
|
||||
final int max = Math.max(this.parts.length, version.parts.length);
|
||||
for (int i = 0; i < max; i += 1) {
|
||||
final int partA = i < this.parts.length ? this.parts[i] : 0;
|
||||
final int partB = i < version.parts.length ? version.parts[i] : 0;
|
||||
if (partA < partB) return -1;
|
||||
if (partA > partB) return 1;
|
||||
}
|
||||
|
||||
if (this.tag.isEmpty() && !version.tag.isEmpty())
|
||||
return 1;
|
||||
if (!this.tag.isEmpty() && version.tag.isEmpty())
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
return o instanceof Version && o == this || version.equals(o.toString());
|
||||
}
|
||||
|
||||
private boolean isNumeric(final String string) {
|
||||
try {
|
||||
Integer.parseInt(string);
|
||||
} catch (final NumberFormatException nfe) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
@@ -0,0 +1 @@
|
||||
a8179ff3-c201-4a75-bdaa-9d14aca6f83f: KennyTV
|
||||
@@ -0,0 +1,65 @@
|
||||
# Maintenance Plugin by KennyTV
|
||||
# Wörter zwischen dem '%'-Zeichen nur entfernen, wenn Du wirklich weißt, warum Du sie entfernen willst
|
||||
|
||||
noPermission: "&cDu hast nicht die erforderliche Berechtigung für diesen Befehl."
|
||||
maintenanceActivated: "&8[&eMaintenance&8] &6Der Wartungsmodus ist nun aktiviert."
|
||||
maintenanceDeactivated: "&8[&eMaintenance&8] &6Der Wartungsmodus ist nun deaktiviert."
|
||||
alreadyEnabled: "&8[&eMaintenance&8] &cDer Wartungsmodus ist bereits aktiviert!"
|
||||
alreadyDisabled: "&8[&eMaintenance&8] &cDer Wartungsmodus ist bereits deaktiviert!"
|
||||
helpUsage: "&8[&eMaintenance&8] &c/maintenance help <Seite>"
|
||||
helpPageNotFound: "&8[&eMaintenance&8] &cEs gibt keine Seite mit dieser Nummer!"
|
||||
endtimerBroadcast: "&8[&eMaintenance&8] &7Der Wartungsmodus wird deaktiviert in: &6%TIME%&7."
|
||||
endtimerStarted: "&8[&eMaintenance&8] &aGestarteter Timer: &7Der Wartungsmodus wird deaktiviert in: &6%TIME%&7."
|
||||
endtimerUsage: "&8[&eMaintenance&8] &c/maintenance endtimer <Minuten>"
|
||||
starttimerBroadcast: "&8[&eMaintenance&8] &7Der Wartungsmodus wird aktiviert in: &6%TIME%&7."
|
||||
starttimerStarted: "&8[&eMaintenance&8] &aGestarteter Timer: &7Der Wartungsmodus wird aktiviert in: &6%TIME%&7"
|
||||
starttimerUsage: "&8[&eMaintenance&8] &c/maintenance starttimer <Minuten>"
|
||||
timerAlreadyRunning: "&8[&eMaintenance&8] &cMomentan läuft bereits ein Timer!"
|
||||
timerNotRunning: "&8[&eMaintenance&8] &cMomentan läuft kein Timer."
|
||||
timerCancelled: "&8[&eMaintenance&8] &cDer laufende Timer wurde beendet."
|
||||
timerTooLong: "&8[&eMaintenance&8] &cDie angegebene Nummer muss kleiner als 40320 sein (= 28 Tage)!"
|
||||
joinNotification: "&8[&eMaintenance&8] &e%PLAYER% &chat versucht den Server beizutreten."
|
||||
motdList: "&8[&eMaintenance&8] &7Liste der Maintenance MOTDs:"
|
||||
reload: "&8[&eMaintenance&8] &aConfig, WhitelistedPlayers, Language Datei und Maintenance Icon wurden neugeladen."
|
||||
removedMotd: "&8[&eMaintenance&8] &aDie %INDEX%. Maintenance MOTD wurde entfernt."
|
||||
removeMotdError: "&8[&eMaintenance&8] &cDu hast nur eine Maintenance MOTD, daher kannst du auch keine entfernen!"
|
||||
removeMotdUsage: "&8[&eMaintenance&8] &c/maintenance removemotd <Index>"
|
||||
setMotd: "&8[&eMaintenance&8] &aDie %LINE%. Zeile der %INDEX%. Maintenance MOTD wurde geändert zu: %MOTD%"
|
||||
setMotdUsage: "&8[&eMaintenance&8] &c/maintenance setmotd <Index> <1/2> <Text>"
|
||||
setMotdIndexError: "&8[&eMaintenance&8] &cMomentan gibt es %MOTDS% MOTDs, du musst also eine Zahl zwischen 1 and %NEWAMOUNT% wählen."
|
||||
setMotdLineError: "&8[&eMaintenance&8] &cDas zweite Argument muss die Zeilennummer sein (1 oder 2)!"
|
||||
updateDownloading: "&8[&eMaintenance&8] &c&lUpdate wird heruntergeladen..."
|
||||
updateFailed: "&8[&eMaintenance&8] &4&lUpdate fehlgeschlagen!"
|
||||
updateFinished: "&8[&eMaintenance&8] &a&lDas Update war erfolgreich! Um Probleme mit Timern zu vermeiden und das Update zu vervollständigen, musst du den Server neustarten!"
|
||||
whitelistedPlayers: "&8[&eMaintenance&8] &6Spieler in der Maintenance Whitelist:"
|
||||
whitelistedPlayersFormat: "&8- &e%NAME% &8(&7%UUID%&8)"
|
||||
whitelistAdded: "&8[&eMaintenance&8] &b%PLAYER% &awurde zur Maintenance Whitelist hinzugefügt!"
|
||||
whitelistAlreadyAdded: "&8[&eMaintenance&8] &b%PLAYER% &cist bereits in der Maintenance Whitelist!"
|
||||
whitelistRemoved: "&8[&eMaintenance&8] &b%PLAYER% &awurde von der Maintenance Whitelist entfernt!"
|
||||
whitelistNotFound: "&8[&eMaintenance&8] &cDieser Spieler ist nicht in der Maintenance Whitelist!"
|
||||
whitelistEmtpy: "&8[&eMaintenance&8] &cDie Maintenance Whitelist ist leer! Nutze '/maintenance add <Spieler>', um jemanden hinzuzufügen!"
|
||||
whitelistEmptyDefault: "&8[&eMaintenance&8] &cNutze '/maintenance add <player>', um jemanden hinzuzufügen. Ansonsten kannst auch die UUID des Spielers in die WhitelistedPlayers.yml einsetzen, wie es im dortigen Beispiel schon drinsteht!"
|
||||
playerNotFound: "&8[&eMaintenance&8] &cBisher hat kein Spieler mit diesem Namen jemals auf diesem Server gespielt."
|
||||
playerNotOnline: "&8[&eMaintenance&8] &cEs ist momentan kein Spieler mit diesem Namen online."
|
||||
|
||||
second: "Sekunde"
|
||||
seconds: "Sekunden"
|
||||
minute: "Minute"
|
||||
minutes: "Minuten"
|
||||
hour: "Stunde"
|
||||
hours: "Stunden"
|
||||
|
||||
# Nachrichten für den Bungee Teil des Plugins, einfach ignorieren, falls das Plugin auf Spigot verwendet wird
|
||||
serverNotFound: "&8[&eMaintenance&8] &cEs wurde kein Server mit diesem Namen gefunden!"
|
||||
singleEndtimerBroadcast: "&8[&eMaintenance&8] &7Der Wartungsmodus auf Server %SERVER% wird deaktiviert in: &6%TIME%&7."
|
||||
singleEndtimerUsage: "&8[&eMaintenance&8] &c/maintenance endtimer <Server> <Minuten>"
|
||||
singleStarttimerBroadcast: "&8[&eMaintenance&8] &7Der Wartungsmodus auf Server %SERVER% wird aktiviert in: &6%TIME%&7."
|
||||
singleStarttimerUsage: "&8[&eMaintenance&8] &c/maintenance starttimer <Server> <Minuten>"
|
||||
singleMaintenanceKick: "&8[&eMaintenance&8] &cDer Server %SERVER% befindet sich momentan im Wartungsmodus! Probier es später nochmal!"
|
||||
singleMaintenanceKickComplete: "&cDer Server %SERVER% befindet sich in Wartung!%NEWLINE%&cDu kannst versuchen zu rejoinen, um andere Server zu betreten!"
|
||||
singleMaintenanceActivated: "&8[&eMaintenance&8] &6Der Wartungsmodus wurde auf &e%SERVER% &6aktiviert."
|
||||
singleMaintenanceDeactivated: "&8[&eMaintenance&8] &6Der Wartungsmodus wurde auf &e%SERVER% &6deaktiviert."
|
||||
singleServerAlreadyEnabled: "&8[&eMaintenance&8] &cDer Wartungsmodus ist bereits an auf &e%SERVER%&c!"
|
||||
singleServerAlreadyDisabled: "&8[&eMaintenance&8] &cDer Wartungsmodus ist bereits aus auf &e%SERVER%&c!"
|
||||
singleServerMaintenanceList: "&8[&eMaintenance&8] &7Unterserverserver, die im Wartungsmodus sind:"
|
||||
singleServerMaintenanceListEmpty: "&8[&eMaintenance&8] &7Es befindet sich momentan kein Unterserver im Wartungsmodus."
|
||||
@@ -0,0 +1,65 @@
|
||||
# Maintenance Plugin by KennyTV
|
||||
# Don't remove words inbetween the '%' if you don't exactly know why you're doing it
|
||||
|
||||
noPermission: "&cYou do not have the permission to execute that command."
|
||||
maintenanceActivated: "&8[&eMaintenance&8] &6Maintenance mode is now activated."
|
||||
maintenanceDeactivated: "&8[&eMaintenance&8] &6Maintenance mode is now deactivated."
|
||||
alreadyEnabled: "&8[&eMaintenance&8] &cMaintenance is already enabled!"
|
||||
alreadyDisabled: "&8[&eMaintenance&8] &cMaintenance is already disabled!"
|
||||
helpUsage: "&8[&eMaintenance&8] &c/maintenance help <page>"
|
||||
helpPageNotFound: "&8[&eMaintenance&8] &cThere is no page with that number!"
|
||||
endtimerBroadcast: "&8[&eMaintenance&8] &7Maintenance mode will be disabled in &6%TIME%&7."
|
||||
endtimerStarted: "&8[&eMaintenance&8] &aStarted timer: &7Maintenance mode will be deactivated in &6%TIME%&7."
|
||||
endtimerUsage: "&8[&eMaintenance&8] &c/maintenance endtimer <minutes>"
|
||||
starttimerBroadcast: "&8[&eMaintenance&8] &7Maintenance mode will be enabled in &6%TIME%&7."
|
||||
starttimerStarted: "&8[&eMaintenance&8] &aStarted timer: &7Maintenance mode will be activated in &6%TIME%&7."
|
||||
starttimerUsage: "&8[&eMaintenance&8] &c/maintenance starttimer <minutes>"
|
||||
timerAlreadyRunning: "&8[&eMaintenance&8] &cThere's already a timer scheduled!"
|
||||
timerNotRunning: "&8[&eMaintenance&8] &cThere's currently no running timer."
|
||||
timerCancelled: "&8[&eMaintenance&8] &cThe current timer has been disabled."
|
||||
timerTooLong: "&8[&eMaintenance&8] &cThe number has to be less than 40320 (28 days)!"
|
||||
joinNotification: "&8[&eMaintenance&8] &e%PLAYER% &ctried to join the server."
|
||||
motdList: "&8[&eMaintenance&8] &7List of your maintenance motds:"
|
||||
reload: "&8[&eMaintenance&8] &aReloaded config, whitelistedplayers, language file and the maintenance icon."
|
||||
removedMotd: "&8[&eMaintenance&8] &aRemoved motd number %INDEX%."
|
||||
removeMotdError: "&8[&eMaintenance&8] &cYou only have one motd, so you can't remove any!"
|
||||
removeMotdUsage: "&8[&eMaintenance&8] &c/maintenance removemotd <index>"
|
||||
setMotd: "&8[&eMaintenance&8] &aSet line %LINE% of the %INDEX%. maintenance motd to %MOTD%"
|
||||
setMotdUsage: "&8[&eMaintenance&8] &c/maintenance setmotd <index> <1/2> <message>"
|
||||
setMotdIndexError: "&8[&eMaintenance&8] &cYou currently have %MOTDS% motds, so you have to pick a number between 1 and %NEWAMOUNT%."
|
||||
setMotdLineError: "&8[&eMaintenance&8] &cThe second argument has to be the line number (1 or 2)!"
|
||||
updateDownloading: "&8[&eMaintenance&8] &c&lDownloading update..."
|
||||
updateFailed: "&8[&eMaintenance&8] &4&lUpdate failed!"
|
||||
updateFinished: "&8[&eMaintenance&8] &a&lThe update was successful! To prevent issues with tasks and to complete the update, you have to restart the server!"
|
||||
whitelistedPlayers: "&8[&eMaintenance&8] &6Whitelisted players for maintenance:"
|
||||
whitelistedPlayersFormat: "&8- &e%NAME% &8(&7%UUID%&8)"
|
||||
whitelistAdded: "&8[&eMaintenance&8] &aAdded &b%PLAYER% &ato the maintenance whitelist!"
|
||||
whitelistAlreadyAdded: "&8[&eMaintenance&8] &b%PLAYER% &calready is in the maintenance whitelist!"
|
||||
whitelistRemoved: "&8[&eMaintenance&8] &aRemoved &b%PLAYER% &afrom the maintenance whitelist!"
|
||||
whitelistNotFound: "&8[&eMaintenance&8] &cThis player is not in the maintenance whitelist!"
|
||||
whitelistEmtpy: "&8[&eMaintenance&8] &cThe maintenance whitelist is empty! Use '/maintenance add <player>' to add someone!"
|
||||
whitelistEmptyDefault: "&8[&eMaintenance&8] &cUse '/maintenance add <player>' to add someone. Alternatively, you can add the uuid of a player to the WhitelistedPlayers.yml as seen in the example in the file!"
|
||||
playerNotFound: "&8[&eMaintenance&8] &cNo player with this name has played on this server before."
|
||||
playerNotOnline: "&8[&eMaintenance&8] &cThere's no player online with that name."
|
||||
|
||||
second: "second"
|
||||
seconds: "seconds"
|
||||
minute: "minute"
|
||||
minutes: "minutes"
|
||||
hour: "hour"
|
||||
hours: "hours"
|
||||
|
||||
# Some messages for the Bungee part, just ignore them if you use the plugin on Spigot
|
||||
serverNotFound: "&8[&eMaintenance&8] &cNo server with this name is registered on the proxy!"
|
||||
singleEndtimerBroadcast: "&8[&eMaintenance&8] &7Maintenance mode on server %SERVER% will be disabled in &6%TIME%&7."
|
||||
singleEndtimerUsage: "&8[&eMaintenance&8] &c/maintenance endtimer <server> <minutes>"
|
||||
singleStarttimerBroadcast: "&8[&eMaintenance&8] &7Maintenance mode on server %SERVER% will be enabled in &6%TIME%&7."
|
||||
singleStarttimerUsage: "&8[&eMaintenance&8] &c/maintenance starttimer <server> <minutes>"
|
||||
singleMaintenanceKick: "&8[&eMaintenance&8] &cThe server %SERVER% is currently under maintenance! Try again later!"
|
||||
singleMaintenanceKickComplete: "&cThe server %SERVER% is under maintenance!%NEWLINE%&cYou may try to rejoin to go onto another server!"
|
||||
singleMaintenanceActivated: "&8[&eMaintenance&8] &6Maintenance mode is now activated on server &e%SERVER%&6."
|
||||
singleMaintenanceDeactivated: "&8[&eMaintenance&8] &6Maintenance mode is now deactivated on server &e%SERVER%&6."
|
||||
singleServerAlreadyEnabled: "&8[&eMaintenance&8] &cMaintenance is already enabled on server &e%SERVER%&c!"
|
||||
singleServerAlreadyDisabled: "&8[&eMaintenance&8] &cMaintenance is already disabled on server &e%SERVER%&c!"
|
||||
singleServerMaintenanceList: "&8[&eMaintenance&8] &7Proxied servers, that have maintenance enabled:"
|
||||
singleServerMaintenanceListEmpty: "&8[&eMaintenance&8] &7There are no proxied servers that are under maintenance."
|
||||
@@ -0,0 +1,65 @@
|
||||
# Maintenance Plugin par KennyTV
|
||||
# Ne supprime pas des mots entre les '%' si tu ne sait pas pourqoi exactement
|
||||
|
||||
noPermission: "&cVous n'avez pas la permission d'exécuter cette commande."
|
||||
maintenanceActivated: "&8[&eMaintenance&8] &6Le mode maintenance est maintenant activé."
|
||||
maintenanceDeactivated: "&8[&eMaintenance&8] &6Le mode maintenance est maintenant désactivé."
|
||||
alreadyEnabled: "&8[&eMaintenance&8] &cLa maintenance est déjà activée!"
|
||||
alreadyDisabled: "&8[&eMaintenance&8] &cLa maintenance est déjà désactivée!"
|
||||
helpUsage: "&8[&eMaintenance&8] &c/maintenance help <page>"
|
||||
helpPageNotFound: "&8[&eMaintenance&8] &cIl n'y a pas cette page!"
|
||||
endtimerBroadcast: "&8[&eMaintenance&8] &7Le mode maintenance sera désactivé dans &6%TIME%&7."
|
||||
endtimerStarted: "&8[&eMaintenance&8] &aminuterie: &7Le mode maintenance sera désactivé dans &6%TIME%&7."
|
||||
endtimerUsage: "&8[&eMaintenance&8] &c/maintenance endtimer <minutes>"
|
||||
starttimerBroadcast: "&8[&eMaintenance&8] &7MLe mode de maintenance sera activé dans &6%TIME%&7."
|
||||
starttimerStarted: "&8[&eMaintenance&8] &aminuterie: &7Le mode maintenance sera activé dans &6%TIME%&7."
|
||||
starttimerUsage: "&8[&eMaintenance&8] &c/maintenance starttimer <minutes>"
|
||||
timerAlreadyRunning: "&8[&eMaintenance&8] &cIl y a déjà un horaire prévu!"
|
||||
timerNotRunning: "&8[&eMaintenance&8] &cIl n'y a actuellement aucune maintenance prévue."
|
||||
timerCancelled: "&8[&eMaintenance&8] &cLa minuterie actuelle a été désactivée."
|
||||
timerTooLong: "&8[&eMaintenance&8] &cLe nombre doit être inférieur à 40320 (28 jours)!"
|
||||
joinNotification: "&8[&eMaintenance&8] &e%PLAYER% &ca essayé de rejoindre le serveur."
|
||||
motdList: "&8[&eMaintenance&8] &7Liste de vos motd pour la maintenance:"
|
||||
reload: "&8[&eMaintenance&8] &afichier config, liste blanche (whitelist) joueurs, fichier de langue et l'icône de maintenance, recharger."
|
||||
removedMotd: "&8[&eMaintenance&8] &aNuméro de motd supprimé %INDEX%."
|
||||
removeMotdError: "&8[&eMaintenance&8] &cVous n’avez qu’un motd, vous ne pouvez donc en supprimer!"
|
||||
removeMotdUsage: "&8[&eMaintenance&8] &c/maintenance removemotd <index>"
|
||||
setMotd: "&8[&eMaintenance&8] &aLigne fixe %LINE% du %INDEX%. maintenance motd à %MOTD%"
|
||||
setMotdUsage: "&8[&eMaintenance&8] &c/maintenance setmotd <index> <1/2> <message>"
|
||||
setMotdIndexError: "&8[&eMaintenance&8] &cVous avez actuellement %MOTDS% vous devez donc choisir un nombre compris entre 1 et %NEWAMOUNT%."
|
||||
setMotdLineError: "&8[&eMaintenance&8] &cLe deuxième argument doit être le numéro de ligne (1 ou 2)!"
|
||||
updateDownloading: "&8[&eMaintenance&8] &c&lTéléchargement de la mise à jour..."
|
||||
updateFailed: "&8[&eMaintenance&8] &4&lLa mise à jour a échoué!"
|
||||
updateFinished: "&8[&eMaintenance&8] &a&lLa mise à jour a été réussie! Pour éviter les problèmes liés aux tâches et terminer la mise à jour, vous devez redémarrer le serveur!"
|
||||
whitelistedPlayers: "&8[&eMaintenance&8] &6Liste blanche des joueurs pour la maintenance:"
|
||||
whitelistedPlayersFormat: "&8- &e%NAME% &8(&7%UUID%&8)"
|
||||
whitelistAdded: "&8[&eMaintenance&8] &aAdded &b%PLAYER% &aà la liste blanche de maintenance!"
|
||||
whitelistAlreadyAdded: "&8[&eMaintenance&8] &b%PLAYER% &cest déjà dans la liste blanche de maintenance!"
|
||||
whitelistRemoved: "&8[&eMaintenance&8] &aEnlevé &b%PLAYER% &ade la liste blanche de maintenance!"
|
||||
whitelistNotFound: "&8[&eMaintenance&8] &cCe joueur n'est pas dans la liste blanche de la maintenance!"
|
||||
whitelistEmtpy: "&8[&eMaintenance&8] &cLa liste blanche de maintenance est vide! Utilisation '/maintenance add <joueur>' ajouter quelqu'un!"
|
||||
whitelistEmptyDefault: "&8[&eMaintenance&8] &cUtilisation '/maintenance add <joueur>' ajouter quelqu'un. Alternativement, vous pouvez ajouter le uuid d'un joueur à la WhitelistedPlayers.yml comme on le voit dans l'exemple du fichier!"
|
||||
playerNotFound: "&8[&eMaintenance&8] &cAucun joueur avec ce nom n'a joué sur ce serveur auparavant."
|
||||
playerNotOnline: "&8[&eMaintenance&8] &cIl n'y a pas de joueur en ligne avec ce nom."
|
||||
|
||||
second: "second"
|
||||
seconds: "seconds"
|
||||
minute: "minute"
|
||||
minutes: "minutes"
|
||||
hour: "heur"
|
||||
hours: "heurs"
|
||||
|
||||
# Quelques messages pour la partie Bungee, ignorez-les si vous utilisez le plugin sur Spigot
|
||||
serverNotFound: "&8[&eMaintenance&8] &cAucun serveur avec ce nom n'est enregistré sur le proxy!"
|
||||
singleEndtimerBroadcast: "&8[&eMaintenance&8] &7maintenance sur serveur %SERVER% sera désactivé dans &6%TIME%&7."
|
||||
singleEndtimerUsage: "&8[&eMaintenance&8] &c/maintenance endtimer <serveur> <minutes>"
|
||||
singleStarttimerBroadcast: "&8[&eMaintenance&8] &7Maintenance sur le serveur %SERVER% sera activé dans &6%TIME%&7."
|
||||
singleStarttimerUsage: "&8[&eMaintenance&8] &c/maintenance starttimer <serveur> <minutes>"
|
||||
singleMaintenanceKick: "&8[&eMaintenance&8] &cLe serveur %SERVER% est actuellement en maintenance! Réessayez plus tard!"
|
||||
singleMaintenanceKickComplete: "&cLe serveur %SERVER% est en maintenance!%NEWLINE%&cVous pouvez essayer un autre serveur!"
|
||||
singleMaintenanceActivated: "&8[&eMaintenance&8] &6La maintenance est maintenant activé sur le serveur &e%SERVER%&6."
|
||||
singleMaintenanceDeactivated: "&8[&eMaintenance&8] &6La maintenance est maintenant désactivé sur le serveur &e%SERVER%&6."
|
||||
singleServerAlreadyEnabled: "&8[&eMaintenance&8] &cLa maintenance est déjà activée sur le serveur &e%SERVER%&c!"
|
||||
singleServerAlreadyDisabled: "&8[&eMaintenance&8] &cLa maintenance est déjà désactivée sur le serveur &e%SERVER%&c!"
|
||||
singleServerMaintenanceList: "&8[&eMaintenance&8] &7Serveurs proxy avec maintenance activée:"
|
||||
singleServerMaintenanceListEmpty: "&8[&eMaintenance&8] &7Il n'y a pas de serveurs proxy en maintenance."
|
||||
@@ -0,0 +1,65 @@
|
||||
# Maintenance Plugin by KennyTV
|
||||
# Nao removas o '%' se nao souberes exatamente o que estas a fazer
|
||||
|
||||
noPermission: "&cNao tens permissao para executar este comando."
|
||||
maintenanceActivated: "&8[&cManutencao&8] &6Manutencao esta agora ativada!"
|
||||
maintenanceDeactivated: "&8[&cManutencao&8] &6Manutencao esta agora desativada!"
|
||||
alreadyEnabled: "&8[&cManutencao&8] &cManutencao ja esta ativada!"
|
||||
alreadyDisabled: "&8[&cManutencao&8] &cManutencao ja esta desativada!"
|
||||
helpUsage: "&8[&cManutencao&8] &c/maintenance help <pagina>"
|
||||
helpPageNotFound: "&8[&eManutencao&8] &cNao existe nenhuma pagina com esse numero!"
|
||||
endtimerBroadcast: "&8[&cManutencao&8] &7Manutencao vai ser desativada em &6%TIME%&7"
|
||||
endtimerStarted: "&8[&cManutencao&8] &aTemporizador: &7Manutencao vai ser desativada em &6%TIME%&7"
|
||||
endtimerUsage: "&8&8[&cManutencao&8] &c/maintenance endtimer <minutos>"
|
||||
starttimerBroadcast: "&8[&cManutencao&8] &7Manutencao vai ser ativada em &6%TIME%&7"
|
||||
starttimerStarted: "&8[&cManutencao&8] &7Manutencao vai ser ativada em &6%TIME%&7"
|
||||
starttimerUsage: "&8[&cManutencao&8] &c/maintenance starttimer <minutos>"
|
||||
timerAlreadyRunning: "&8[&cManutencao&8] &cO Timer ja esta a decorrer!"
|
||||
timerNotRunning: "&8[&cManutencao&8] &cO Timer nao esta a decorrer!"
|
||||
timerCancelled: "&8[&cManutencao&8] &cO Timer foi cancelado!"
|
||||
timerTooLong: "&8[&cManutencao&8] &cO numero tem de ser menor que 40320 (28 dias)!"
|
||||
joinNotification: "&8[&cManutencao&8] &e%PLAYER% &ctentou entrar no servidor."
|
||||
motdList: "&8[&cManutencao&8] &7Lista de motds de manutencao:"
|
||||
reload: "&8[&cManutencao&8] &aReloaded config, whitelistedplayers, linguagem e icon de manutencao."
|
||||
removedMotd: "&8[&cManutencao&8] &aRemovida motd numero %INDEX%."
|
||||
removeMotdError: "&8[&cManutencao&8] &cSo tens uma motd, entao nao podes remover esta!"
|
||||
removeMotdUsage: "&8[&cManutencao&8] &c/maintenance removemotd <index>"
|
||||
setMotd: setMotd: "&8[&eManutencao&8] &aLinha %LINE% do %INDEX%. Motd de manutencao %MOTD%"
|
||||
setMotdUsage: "&8[&cManutencao&8] &c/maintenance setmotd <index> <1/2> <message>"
|
||||
setMotdIndexError: "&8[&cManutencao&8] §cTens atualmente %MOTDS% motds, entao escolhe um numero entre 1 e %NEWAMOUNT%."
|
||||
setMotdLineError: "&8[&cManutencao&8] &cO segundo argumento tem de ser na linha (1 ou 2)!"
|
||||
updateDownloading: "&8[&cManutencao&8] &c&lDownloading update..."
|
||||
updateFailed: "&8[&cManutencao&8] &4&lUpdate falhado!"
|
||||
updateFinished: "&8[&cManutencao&8] &a&lO update foi feito com sucesso! Reinicia o servidor paa evitar erros e acabar a atualizacao"
|
||||
whitelistedPlayers: "&8[&cManutencao&8] &6Whitelisted players para a manutencao:"
|
||||
whitelistedPlayersFormat: "&8- &e%NAME% &8(&7%UUID%&8)"
|
||||
whitelistAdded: "&8[&cManutencao&8] &aAdicionado &b%PLAYER% &ana whitelist!"
|
||||
whitelistAlreadyAdded: "&8[&cManutencao&8] &b%PLAYER% &cja esta na whitelist!"
|
||||
whitelistRemoved: "&8[&cManutencao&8] &b%PLAYER% &aremovido da whitelist!"
|
||||
whitelistNotFound: "&8[&cManutencao&8] &cEste jogador nao esta na whitelist!"
|
||||
whitelistEmtpy: "&8[&cManutencao&8] &cA whitelist esta vazia! Usa '/maintenance add <player>' para adicionar alguem!"
|
||||
whitelistEmptyDefault: "&8[&cManutencao&8] &cUsa '/maintenance add <player>' para adicionar alguem. Ou entao adicona o uuid do jogador no ficheiro WhitelistedPlayers.yml"
|
||||
playerNotFound: "&8[&cManutencao&8] &cNinguem com esse nome se registou no servidor."
|
||||
playerNotOnline: "&8[&cManutencao&8] &cNao esta ninguem online com esse nome"
|
||||
|
||||
second: "segundo"
|
||||
seconds: "segundos"
|
||||
minute: "minuto"
|
||||
minutes: "minutos"
|
||||
hour: "hora"
|
||||
hours: "horas"
|
||||
|
||||
# Algumas mensagens para o Bungee, ignora-as se estas a usar Spigot
|
||||
serverNotFound: "&8[&cManutencao&8] &cServidor nao encontrado!"
|
||||
singleEndtimerBroadcast: "&8[&cManutencao&8] &7Manutencao no %SERVER% vai ser desativada em &6%TIME%&7."
|
||||
singleEndtimerUsage: "&8[&cManutencao&8] &c/maintenance endtimer <servidor> <minutos>"
|
||||
singleStarttimerBroadcast: "&8[&cManutencao&8] &7Manutencao no %SERVER% vai ser ativada em &6%TIME%&7."
|
||||
singleStarttimerUsage: "&8[&cManutencao&8] &c/maintenance starttimer <servidor> <minutos>"
|
||||
singleMaintenanceKick: "&8[&cManutencao&8] &cO %SERVER% esta em manutencao! Tente mais tarde!"
|
||||
singleMaintenanceKickComplete: "&cO %SERVER% esta em manutencao!%NEWLINE%&cTente mais tarde!"
|
||||
singleMaintenanceActivated: "&8[&cManutencao&8] &6Manutencao esta agora ativada no &e%SERVER%&6."
|
||||
singleMaintenanceDeactivated: "&8[&cManutencao&8] &6Manutencao esta agora desativada no &e%SERVER%&6."
|
||||
singleServerAlreadyEnabled: "&8[&cManutencao&8] &cManutencao ja esta ativada no &e%SERVER%&c!"
|
||||
singleServerAlreadyDisabled: "&8[&cManutencao&8] &cManutencao ja esta desativada no &e%SERVER%&c!"
|
||||
singleServerMaintenanceList: "&8[&cManutencao&8] &7Servidores com manutencao ativa:"
|
||||
singleServerMaintenanceListEmpty: "&8[&cManutencao&8] &7Nao existem servidores com a manutencao ativa."
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-parent</artifactId>
|
||||
<name>Maintenance</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<artifactId>maintenance-core</artifactId>
|
||||
<version>${parent.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<artifactId>maintenance-bungee</artifactId>
|
||||
<version>${parent.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<artifactId>maintenance-spigot</artifactId>
|
||||
<version>${parent.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maintenance-spigot</artifactId>
|
||||
<name>MaintenanceSpigot</name>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigotmc-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>http://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<artifactId>maintenance-core</artifactId>
|
||||
<version>${parent.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minecrell</groupId>
|
||||
<artifactId>ServerListPlus</artifactId>
|
||||
<version>3.4.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib-API</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package eu.kennytv.maintenance.spigot;
|
||||
|
||||
import eu.kennytv.maintenance.api.IMaintenance;
|
||||
import eu.kennytv.maintenance.api.IMaintenanceBase;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public final class MaintenanceSpigotBase extends JavaPlugin implements IMaintenanceBase {
|
||||
private IMaintenance maintenance;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
maintenance = new MaintenanceSpigotPlugin(this);
|
||||
}
|
||||
|
||||
File getPluginFile() {
|
||||
return getFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMaintenance getApi() {
|
||||
return maintenance;
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
package eu.kennytv.maintenance.spigot;
|
||||
|
||||
import eu.kennytv.maintenance.api.IMaintenance;
|
||||
import eu.kennytv.maintenance.api.ISettings;
|
||||
import eu.kennytv.maintenance.api.spigot.MaintenanceSpigotAPI;
|
||||
import eu.kennytv.maintenance.core.MaintenanceModePlugin;
|
||||
import eu.kennytv.maintenance.core.hook.ServerListPlusHook;
|
||||
import eu.kennytv.maintenance.core.util.ServerType;
|
||||
import eu.kennytv.maintenance.spigot.command.MaintenanceSpigotCommand;
|
||||
import eu.kennytv.maintenance.spigot.listener.PlayerLoginListener;
|
||||
import eu.kennytv.maintenance.spigot.metrics.MetricsLite;
|
||||
import net.minecrell.serverlistplus.core.plugin.ServerListPlusPlugin;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author KennyTV
|
||||
* @since 2.0
|
||||
*/
|
||||
public final class MaintenanceSpigotPlugin extends MaintenanceModePlugin {
|
||||
private final MaintenanceSpigotBase plugin;
|
||||
private final SettingsSpigot settings;
|
||||
|
||||
MaintenanceSpigotPlugin(final MaintenanceSpigotBase plugin) {
|
||||
super("§8[§eMaintenanceSpigot§8] ", plugin.getDescription().getVersion(), ServerType.SPIGOT);
|
||||
|
||||
this.plugin = plugin;
|
||||
settings = new SettingsSpigot(this, plugin);
|
||||
|
||||
plugin.getLogger().info("Plugin by KennyTV");
|
||||
plugin.getLogger().info(getUpdateMessage());
|
||||
plugin.getCommand("maintenancespigot").setExecutor(new MaintenanceSpigotCommand(this, settings));
|
||||
|
||||
final PluginManager pm = getServer().getPluginManager();
|
||||
pm.registerEvents(new PlayerLoginListener(this, settings), plugin);
|
||||
|
||||
new MetricsLite(plugin);
|
||||
|
||||
// ServerListPlus integration
|
||||
final Plugin serverListPlus = pm.getPlugin("ServerListPlus");
|
||||
if (serverListPlus != null) {
|
||||
serverListPlusHook = new ServerListPlusHook(((ServerListPlusPlugin) serverListPlus).getCore());
|
||||
serverListPlusHook.setEnabled(!settings.isMaintenance());
|
||||
plugin.getLogger().info("Enabled ServerListPlus integration!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaintenance(final boolean maintenance) {
|
||||
settings.setMaintenance(maintenance);
|
||||
settings.setToConfig("enable-maintenance-mode", maintenance);
|
||||
settings.saveConfig();
|
||||
|
||||
if (isTaskRunning())
|
||||
cancelTask();
|
||||
|
||||
if (serverListPlusHook != null)
|
||||
serverListPlusHook.setEnabled(!maintenance);
|
||||
|
||||
if (maintenance) {
|
||||
getServer().getOnlinePlayers().stream()
|
||||
.filter(p -> !p.hasPermission("maintenance.bypass") && !settings.getWhitelistedPlayers().containsKey(p.getUniqueId()))
|
||||
.forEach(p -> p.kickPlayer(settings.getKickMessage().replace("%NEWLINE%", "\n")));
|
||||
getServer().broadcastMessage(settings.getMessage("maintenanceActivated"));
|
||||
} else
|
||||
getServer().broadcastMessage(settings.getMessage("maintenanceDeactivated"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startMaintenanceRunnable(final Runnable runnable) {
|
||||
return getServer().getScheduler().scheduleSyncRepeatingTask(plugin, runnable, 0, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void async(final Runnable runnable) {
|
||||
getServer().getScheduler().runTaskAsynchronously(plugin, runnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelTask() {
|
||||
getServer().getScheduler().cancelTask(taskId);
|
||||
runnable = null;
|
||||
taskId = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISettings getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getPluginFile() {
|
||||
return plugin.getPluginFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void broadcast(final String message) {
|
||||
getServer().broadcastMessage(message);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static IMaintenance getAPI() {
|
||||
return MaintenanceSpigotAPI.getAPI();
|
||||
}
|
||||
|
||||
public Server getServer() {
|
||||
return plugin.getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger() {
|
||||
return plugin.getLogger();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
package eu.kennytv.maintenance.spigot;
|
||||
|
||||
import eu.kennytv.maintenance.core.Settings;
|
||||
import eu.kennytv.maintenance.core.listener.IPingListener;
|
||||
import eu.kennytv.maintenance.spigot.listener.ServerInfoPacketListener;
|
||||
import eu.kennytv.maintenance.spigot.listener.ServerListPingListener;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class SettingsSpigot extends Settings {
|
||||
private final MaintenanceSpigotBase plugin;
|
||||
private final IPingListener pingListener;
|
||||
private FileConfiguration config;
|
||||
private FileConfiguration language;
|
||||
private FileConfiguration whitelist;
|
||||
|
||||
SettingsSpigot(final MaintenanceSpigotPlugin pl, final MaintenanceSpigotBase plugin) {
|
||||
super(pl);
|
||||
this.plugin = plugin;
|
||||
|
||||
final PluginManager pm = plugin.getServer().getPluginManager();
|
||||
if (pm.getPlugin("ProtocolLib") != null) {
|
||||
final ServerInfoPacketListener serverInfoListener = new ServerInfoPacketListener(plugin, this);
|
||||
pm.registerEvents(serverInfoListener, plugin);
|
||||
pingListener = serverInfoListener;
|
||||
} else {
|
||||
final ServerListPingListener listener = new ServerListPingListener(plugin, this);
|
||||
pm.registerEvents(listener, plugin);
|
||||
pingListener = listener;
|
||||
}
|
||||
|
||||
if (!plugin.getDataFolder().exists())
|
||||
plugin.getDataFolder().mkdirs();
|
||||
createFile("spigot-config.yml");
|
||||
createFile("WhitelistedPlayers.yml");
|
||||
reloadConfigs();
|
||||
}
|
||||
|
||||
private void createFile(final String name) {
|
||||
final File file = new File(plugin.getDataFolder(), name);
|
||||
if (!file.exists()) {
|
||||
try (final InputStream in = plugin.getResource(name)) {
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to create " + name + " file for Maintenance!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createAndLoadLanguageFile() {
|
||||
final File file = new File(plugin.getDataFolder(), "language-" + getLanguage() + ".yml");
|
||||
if (!file.exists()) {
|
||||
try (final InputStream in = plugin.getResource("language-" + getLanguage() + ".yml")) {
|
||||
Files.copy(in, file.toPath());
|
||||
} catch (final IOException e) {
|
||||
plugin.getLogger().warning("Unable to provide language " + getLanguage());
|
||||
if (!languageName.equals("en")) {
|
||||
plugin.getLogger().warning("Falling back to default language: en");
|
||||
languageName = "en";
|
||||
createAndLoadLanguageFile();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
language = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(new File(plugin.getDataFolder(), "language-" + getLanguage() + ".yml")), StandardCharsets.UTF_8));
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to load Maintenance language file!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateExtraConfig() {
|
||||
// Remove MySQL part from default config
|
||||
/*if (configContains("mysql")) {
|
||||
setToConfig("mysql", null);
|
||||
return true;
|
||||
}*/
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfig() {
|
||||
try {
|
||||
config.save(new File(plugin.getDataFolder(), "spigot-config.yml"));
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveWhitelistedPlayers() {
|
||||
try {
|
||||
whitelist.save(new File(plugin.getDataFolder(), "WhitelistedPlayers.yml"));
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadConfigs() {
|
||||
try {
|
||||
config = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(new File(plugin.getDataFolder(), "spigot-config.yml")), StandardCharsets.UTF_8));
|
||||
whitelist = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "WhitelistedPlayers.yml"));
|
||||
} catch (final IOException e) {
|
||||
throw new RuntimeException("Unable to load Maintenance files!", e);
|
||||
}
|
||||
|
||||
loadSettings();
|
||||
createAndLoadLanguageFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadExtraSettings() {
|
||||
whitelistedPlayers.clear();
|
||||
whitelist.getKeys(false).forEach(key -> whitelistedPlayers.put(UUID.fromString(key), whitelist.getString(key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWhitelist(final String uuid, final String s) {
|
||||
whitelist.set(uuid, s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigString(final String path) {
|
||||
final String s = config.getString(path);
|
||||
if (s == null) {
|
||||
plugin.getLogger().warning("The config is missing the following string: " + path);
|
||||
return "null";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(final String path) {
|
||||
final String s = language.getString(path);
|
||||
if (s == null) {
|
||||
plugin.getLogger().warning("The language file is missing the following string: " + path);
|
||||
return "null";
|
||||
}
|
||||
return ChatColor.translateAlternateColorCodes('&', s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getConfigBoolean(final String path) {
|
||||
return config.getBoolean(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getConfigIntList(final String path) {
|
||||
return config.getIntegerList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getConfigList(final String path) {
|
||||
return config.getStringList(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToConfig(final String path, final Object var) {
|
||||
config.set(path, var);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configContains(final String path) {
|
||||
return config.contains(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredString(final String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reloadMaintenanceIcon() {
|
||||
return pingListener.loadIcon();
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package eu.kennytv.maintenance.spigot.command;
|
||||
|
||||
import eu.kennytv.maintenance.core.command.MaintenanceCommand;
|
||||
import eu.kennytv.maintenance.core.util.SenderInfo;
|
||||
import eu.kennytv.maintenance.spigot.MaintenanceSpigotPlugin;
|
||||
import eu.kennytv.maintenance.spigot.SettingsSpigot;
|
||||
import eu.kennytv.maintenance.spigot.util.BukkitSenderInfo;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public final class MaintenanceSpigotCommand extends MaintenanceCommand implements CommandExecutor {
|
||||
|
||||
public MaintenanceSpigotCommand(final MaintenanceSpigotPlugin plugin, final SettingsSpigot settings) {
|
||||
super(plugin, settings, "MaintenanceSpigot");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command cmd, final String s, final String[] args) {
|
||||
execute(new BukkitSenderInfo(sender), args);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addPlayerToWhitelist(final SenderInfo sender, final String name) {
|
||||
final Player selected = Bukkit.getPlayer(name);
|
||||
if (selected != null) {
|
||||
if (settings.addWhitelistedPlayer(selected.getUniqueId(), selected.getName()))
|
||||
sender.sendMessage(settings.getMessage("whitelistAdded").replace("%PLAYER%", selected.getName()));
|
||||
else
|
||||
sender.sendMessage(settings.getMessage("whitelistAlreadyAdded").replace("%PLAYER%", selected.getName()));
|
||||
return;
|
||||
}
|
||||
|
||||
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(name);
|
||||
if (!offlinePlayer.hasPlayedBefore()) {
|
||||
sender.sendMessage(settings.getMessage("playerNotFound"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.addWhitelistedPlayer(offlinePlayer.getUniqueId(), offlinePlayer.getName()))
|
||||
sender.sendMessage(settings.getMessage("whitelistAdded").replace("%PLAYER%", offlinePlayer.getName()));
|
||||
else
|
||||
sender.sendMessage(settings.getMessage("whitelistAlreadyAdded").replace("%PLAYER%", offlinePlayer.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void removePlayerFromWhitelist(final SenderInfo sender, final String name) {
|
||||
final Player selected = Bukkit.getPlayer(name);
|
||||
if (selected != null) {
|
||||
if (settings.removeWhitelistedPlayer(selected.getUniqueId()))
|
||||
sender.sendMessage(settings.getMessage("whitelistRemoved").replace("%PLAYER%", selected.getName()));
|
||||
else
|
||||
sender.sendMessage(settings.getMessage("whitelistNotFound"));
|
||||
return;
|
||||
}
|
||||
|
||||
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(name);
|
||||
if (!offlinePlayer.hasPlayedBefore()) {
|
||||
sender.sendMessage(settings.getMessage("playerNotFound"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.removeWhitelistedPlayer(offlinePlayer.getUniqueId()))
|
||||
sender.sendMessage(settings.getMessage("whitelistRemoved").replace("%PLAYER%", offlinePlayer.getName()));
|
||||
else
|
||||
sender.sendMessage(settings.getMessage("whitelistNotFound"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkForUpdate(final SenderInfo sender) {
|
||||
if (plugin.updateAvailable()) {
|
||||
sender.sendMessage(plugin.getPrefix() + "§cNewest version available: §aVersion " + plugin.getNewestVersion() + "§c, you're on §a" + plugin.getVersion());
|
||||
sender.sendMessage(plugin.getPrefix() + "§c§lWARNING: §cYou will have to restart the server to prevent further issues and to complete the update!" +
|
||||
" If you can't do that, don't update!");
|
||||
sender.sendMessage(plugin.getPrefix() + "§eUse §c§l/maintenance forceupdate §eto update!");
|
||||
} else
|
||||
sender.sendMessage(plugin.getPrefix() + "§aYou already have the latest version of the plugin!");
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package eu.kennytv.maintenance.spigot.listener;
|
||||
|
||||
import eu.kennytv.maintenance.core.listener.IPingListener;
|
||||
import eu.kennytv.maintenance.spigot.MaintenanceSpigotBase;
|
||||
import eu.kennytv.maintenance.spigot.SettingsSpigot;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.util.CachedServerIcon;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.io.File;
|
||||
|
||||
public abstract class PingListenerBase implements IPingListener, Listener {
|
||||
protected final MaintenanceSpigotBase plugin;
|
||||
protected final SettingsSpigot settings;
|
||||
protected CachedServerIcon serverIcon;
|
||||
|
||||
protected PingListenerBase(final MaintenanceSpigotBase plugin, final SettingsSpigot settings) {
|
||||
this.plugin = plugin;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadIcon() {
|
||||
try {
|
||||
serverIcon = plugin.getServer().loadServerIcon(ImageIO.read(new File("maintenance-icon.png")));
|
||||
} catch (final Exception e) {
|
||||
plugin.getLogger().warning("Could not load 'maintenance-icon.png' - did you create one in your Spigot folder (not the plugins folder)?");
|
||||
if (settings.debugEnabled())
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package eu.kennytv.maintenance.spigot.listener;
|
||||
|
||||
import eu.kennytv.maintenance.spigot.MaintenanceSpigotPlugin;
|
||||
import eu.kennytv.maintenance.spigot.SettingsSpigot;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class PlayerLoginListener implements Listener {
|
||||
private final MaintenanceSpigotPlugin plugin;
|
||||
private final SettingsSpigot settings;
|
||||
private final Set<UUID> notifiedPlayers = new HashSet<>();
|
||||
|
||||
public PlayerLoginListener(final MaintenanceSpigotPlugin plugin, final SettingsSpigot settings) {
|
||||
this.plugin = plugin;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void postLogin(final PlayerLoginEvent event) {
|
||||
final Player p = event.getPlayer();
|
||||
if (p.getUniqueId().toString().equals("a8179ff3-c201-4a75-bdaa-9d14aca6f83f"))
|
||||
p.sendMessage("§6MaintenanceSpigot §aVersion " + plugin.getVersion());
|
||||
else if (settings.isMaintenance()) {
|
||||
if (!p.hasPermission("maintenance.bypass") && !settings.getWhitelistedPlayers().containsKey(p.getUniqueId())) {
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
event.setKickMessage(settings.getKickMessage().replace("%NEWLINE%", "\n"));
|
||||
|
||||
if (settings.isJoinNotifications())
|
||||
Bukkit.getOnlinePlayers().stream().filter(player -> player.hasPermission("maintenance.joinnotification"))
|
||||
.forEach(player -> player.sendMessage(settings.getMessage("joinNotification").replace("%PLAYER%", p.getName())));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!p.hasPermission("maintenance.admin") || notifiedPlayers.contains(p.getUniqueId())) return;
|
||||
|
||||
plugin.async(() -> {
|
||||
if (plugin.updateAvailable()) {
|
||||
p.sendMessage(plugin.getPrefix() + "§cThere is a newer version available: §aVersion " + plugin.getNewestVersion() + "§c, you're on §a" + plugin.getVersion());
|
||||
notifiedPlayers.add(p.getUniqueId());
|
||||
|
||||
try {
|
||||
final TextComponent tc1 = new TextComponent(TextComponent.fromLegacyText(plugin.getPrefix()));
|
||||
final TextComponent tc2 = new TextComponent(TextComponent.fromLegacyText("§cDownload it at: §6https://www.spigotmc.org/resources/maintenancemode.40699/"));
|
||||
final TextComponent click = new TextComponent(TextComponent.fromLegacyText(" §7§l§o(CLICK ME)"));
|
||||
click.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org/resources/maintenancemode.40699/"));
|
||||
click.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aDownload the latest version").create()));
|
||||
tc1.addExtra(tc2);
|
||||
tc1.addExtra(click);
|
||||
|
||||
p.spigot().sendMessage(tc1);
|
||||
} catch (final Exception e) {
|
||||
p.sendMessage(plugin.getPrefix() + "§cDownload it at: §6https://www.spigotmc.org/resources/maintenancemode.40699/");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package eu.kennytv.maintenance.spigot.listener;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||
import com.comphenix.protocol.wrappers.WrappedServerPing;
|
||||
import eu.kennytv.maintenance.core.listener.IPingListener;
|
||||
import eu.kennytv.maintenance.spigot.MaintenanceSpigotBase;
|
||||
import eu.kennytv.maintenance.spigot.SettingsSpigot;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public final class ServerInfoPacketListener extends PingListenerBase {
|
||||
//private WrappedServerPing.CompressedImage image;
|
||||
|
||||
public ServerInfoPacketListener(final MaintenanceSpigotBase base, final SettingsSpigot settings) {
|
||||
super(base, settings);
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(base, ListenerPriority.HIGHEST,
|
||||
PacketType.Status.Server.SERVER_INFO) {
|
||||
@Override
|
||||
public void onPacketSending(final PacketEvent event) {
|
||||
if (!settings.isMaintenance()) return;
|
||||
|
||||
final WrappedServerPing ping = event.getPacket().getServerPings().read(0);
|
||||
ping.setMotD(settings.getRandomPingMessage());
|
||||
|
||||
if (settings.hasCustomPlayerCountMessage()) {
|
||||
ping.setVersionProtocol(0);
|
||||
ping.setVersionName(settings.getPlayerCountMessage()
|
||||
.replace("%ONLINE%", Integer.toString(base.getServer().getOnlinePlayers().size()))
|
||||
.replace("%MAX%", Integer.toString(base.getServer().getMaxPlayers())));
|
||||
}
|
||||
|
||||
final List<WrappedGameProfile> players = new ArrayList<>();
|
||||
for (final String string : settings.getPlayerCountHoverMessage().split("%NEWLINE%"))
|
||||
players.add(new WrappedGameProfile(UUID.randomUUID(), string));
|
||||
ping.setPlayers(players);
|
||||
//if (settings.hasCustomIcon() && image != null) ping.setFavicon(image);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void serverListPing(final ServerListPingEvent event) {
|
||||
if (settings.isMaintenance() && settings.hasCustomIcon() && serverIcon != null)
|
||||
event.setServerIcon(serverIcon);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public boolean loadIcon() {
|
||||
try {
|
||||
image = WrappedServerPing.CompressedImage.fromPng(ImageIO.read(new File("maintenance-icon.png")));
|
||||
} catch (final Exception e) {
|
||||
pl.getLogger().warning("Could not load 'maintenance-icon.png' - did you create one in your Spigot folder (not the plugins folder)?");
|
||||
if (pl.getApi().getSettings().debugEnabled())
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package eu.kennytv.maintenance.spigot.listener;
|
||||
|
||||
import eu.kennytv.maintenance.spigot.MaintenanceSpigotBase;
|
||||
import eu.kennytv.maintenance.spigot.SettingsSpigot;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
|
||||
public final class ServerListPingListener extends PingListenerBase {
|
||||
|
||||
public ServerListPingListener(final MaintenanceSpigotBase plugin, final SettingsSpigot settings) {
|
||||
super(plugin, settings);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void serverListPing(final ServerListPingEvent event) {
|
||||
if (!settings.isMaintenance()) return;
|
||||
|
||||
event.setMaxPlayers(0);
|
||||
event.setMotd(settings.getRandomPingMessage());
|
||||
|
||||
if (settings.hasCustomIcon() && serverIcon != null)
|
||||
event.setServerIcon(serverIcon);
|
||||
}
|
||||
}
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
package eu.kennytv.maintenance.spigot.metrics;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public final class MetricsLite {
|
||||
|
||||
public static final int B_STATS_VERSION = 1;
|
||||
private static final String URL = "https://bStats.org/submitData/bukkit";
|
||||
private boolean enabled;
|
||||
private static boolean logFailedRequests;
|
||||
private static boolean logSentData;
|
||||
private static boolean logResponseStatusText;
|
||||
private static String serverUUID;
|
||||
private final Plugin plugin;
|
||||
|
||||
public MetricsLite(final Plugin plugin) {
|
||||
if (plugin == null) {
|
||||
throw new IllegalArgumentException("Plugin cannot be null!");
|
||||
}
|
||||
this.plugin = plugin;
|
||||
|
||||
final File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
|
||||
final File configFile = new File(bStatsFolder, "config.yml");
|
||||
final YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
|
||||
|
||||
if (!config.isSet("serverUuid")) {
|
||||
config.addDefault("enabled", true);
|
||||
config.addDefault("serverUuid", UUID.randomUUID().toString());
|
||||
config.addDefault("logFailedRequests", false);
|
||||
config.addDefault("logSentData", false);
|
||||
config.addDefault("logResponseStatusText", false);
|
||||
|
||||
config.options().header(
|
||||
"bStats collects some data for plugin authors like how many servers are using their plugins.\n" +
|
||||
"To honor their work, you should not disable it.\n" +
|
||||
"This has nearly no effect on the server performance!\n" +
|
||||
"Check out https://bStats.org/ to learn more :)"
|
||||
).copyDefaults(true);
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
serverUUID = config.getString("serverUuid");
|
||||
logFailedRequests = config.getBoolean("logFailedRequests", false);
|
||||
logSentData = config.getBoolean("logSentData", false);
|
||||
logResponseStatusText = config.getBoolean("logResponseStatusText", false);
|
||||
enabled = config.getBoolean("enabled", true);
|
||||
if (enabled) {
|
||||
boolean found = false;
|
||||
for (final Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
|
||||
try {
|
||||
service.getField("B_STATS_VERSION");
|
||||
found = true;
|
||||
break;
|
||||
} catch (final NoSuchFieldException ignored) {
|
||||
}
|
||||
}
|
||||
Bukkit.getServicesManager().register(MetricsLite.class, this, plugin, ServicePriority.Normal);
|
||||
if (!found) {
|
||||
startSubmitting();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
private void startSubmitting() {
|
||||
final Timer timer = new Timer(true);
|
||||
timer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!plugin.isEnabled()) {
|
||||
timer.cancel();
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().runTask(plugin, () -> submitData());
|
||||
}
|
||||
}, 1000 * 60 * 5, 1000 * 60 * 30);
|
||||
}
|
||||
|
||||
public JSONObject getPluginData() {
|
||||
final JSONObject data = new JSONObject();
|
||||
|
||||
final String pluginName = plugin.getDescription().getName();
|
||||
final String pluginVersion = plugin.getDescription().getVersion();
|
||||
|
||||
data.put("pluginName", pluginName);
|
||||
data.put("pluginVersion", pluginVersion);
|
||||
final JSONArray customCharts = new JSONArray();
|
||||
data.put("customCharts", customCharts);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private JSONObject getServerData() {
|
||||
final int playerAmount = Bukkit.getOnlinePlayers().size();
|
||||
final int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
|
||||
final String bukkitVersion = Bukkit.getVersion();
|
||||
|
||||
final String javaVersion = System.getProperty("java.version");
|
||||
final String osName = System.getProperty("os.name");
|
||||
final String osArch = System.getProperty("os.arch");
|
||||
final String osVersion = System.getProperty("os.version");
|
||||
final int coreCount = Runtime.getRuntime().availableProcessors();
|
||||
|
||||
final JSONObject data = new JSONObject();
|
||||
|
||||
data.put("serverUUID", serverUUID);
|
||||
|
||||
data.put("playerAmount", playerAmount);
|
||||
data.put("onlineMode", onlineMode);
|
||||
data.put("bukkitVersion", bukkitVersion);
|
||||
|
||||
data.put("javaVersion", javaVersion);
|
||||
data.put("osName", osName);
|
||||
data.put("osArch", osArch);
|
||||
data.put("osVersion", osVersion);
|
||||
data.put("coreCount", coreCount);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private void submitData() {
|
||||
final JSONObject data = getServerData();
|
||||
|
||||
final JSONArray pluginData = new JSONArray();
|
||||
for (final Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
|
||||
try {
|
||||
service.getField("B_STATS_VERSION");
|
||||
|
||||
for (final RegisteredServiceProvider<?> provider : Bukkit.getServicesManager().getRegistrations(service)) {
|
||||
try {
|
||||
pluginData.add(provider.getService().getMethod("getPluginData").invoke(provider.getProvider()));
|
||||
} catch (final NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
|
||||
}
|
||||
}
|
||||
} catch (final NoSuchFieldException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
data.put("plugins", pluginData);
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
sendData(plugin, data);
|
||||
} catch (final Exception e) {
|
||||
if (logFailedRequests) {
|
||||
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private static void sendData(final Plugin plugin, final JSONObject data) throws Exception {
|
||||
if (data == null) {
|
||||
throw new IllegalArgumentException("Data cannot be null!");
|
||||
}
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
throw new IllegalAccessException("This method must not be called from the main thread!");
|
||||
}
|
||||
if (logSentData) {
|
||||
plugin.getLogger().info("Sending data to bStats: " + data.toString());
|
||||
}
|
||||
final HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
|
||||
|
||||
final byte[] compressedData = compress(data.toString());
|
||||
|
||||
connection.setRequestMethod("POST");
|
||||
connection.addRequestProperty("Accept", "application/json");
|
||||
connection.addRequestProperty("Connection", "close");
|
||||
connection.addRequestProperty("Content-Encoding", "gzip");
|
||||
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
|
||||
|
||||
connection.setDoOutput(true);
|
||||
final DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
|
||||
outputStream.write(compressedData);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
|
||||
if (logResponseStatusText) {
|
||||
final InputStream inputStream = connection.getInputStream();
|
||||
final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
String line;
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
builder.append(line);
|
||||
}
|
||||
bufferedReader.close();
|
||||
plugin.getLogger().info("Sent data to bStats and received response: " + builder.toString());
|
||||
} else {
|
||||
connection.getInputStream().close();
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] compress(final String str) throws IOException {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
final GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
|
||||
gzip.write(str.getBytes(StandardCharsets.UTF_8));
|
||||
gzip.close();
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package eu.kennytv.maintenance.spigot.util;
|
||||
|
||||
import eu.kennytv.maintenance.core.util.SenderInfo;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public final class BukkitSenderInfo implements SenderInfo {
|
||||
private final CommandSender sender;
|
||||
|
||||
public BukkitSenderInfo(final CommandSender sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUuid() {
|
||||
return sender instanceof Player ? ((Player) sender).getUniqueId() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return sender.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final String permission) {
|
||||
return sender.hasPermission(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(final String message) {
|
||||
sender.sendMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayer() {
|
||||
return sender instanceof Player;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
name: ${project.name}
|
||||
version: ${project.version}
|
||||
main: eu.kennytv.maintenance.spigot.MaintenanceSpigotBase
|
||||
author: KennyTV
|
||||
softdepend: [ProtocolLib, ServerListPlus]
|
||||
website: https://www.spigotmc.org/resources/maintenancemode.40699/
|
||||
|
||||
commands:
|
||||
maintenance:
|
||||
description: Maintenance main-command
|
||||
aliases: [maintenancespigot]
|
||||
@@ -0,0 +1,41 @@
|
||||
# MaintenanceSpigot Plugin by KennyTV
|
||||
# Important note: To use this plugin to its full extend, it requires the plugin 'ProtocolLib'
|
||||
# Also, configs are cool, which means after the first plugin save, all comments will vanish
|
||||
# To still know what each field is for, check https://gist.github.com/KennyTV/a73f2aed1e278d4c927f9f6a3ef9fde2#file-spigot-config-yml
|
||||
|
||||
# Enables maintenance-mode.
|
||||
enable-maintenance-mode: false
|
||||
|
||||
# The message shown in the multiplayer server list motd.
|
||||
# If you put in multiple entries, one of them will be chosen randomly on every ping.
|
||||
pingmessages:
|
||||
- "&cMaintenance mode!%NEWLINE%&6We will be back soon!"
|
||||
#- "Another entry"
|
||||
|
||||
# If set to true, the message below will be shown at the top right corner of the server in the serverlist,
|
||||
# where the playercount would normally be displayed.
|
||||
# If set to false, the normal playercount will be shown.
|
||||
# Alternatively you can use '%ONLINE%' and '%MAX% if you want to include the playercount in a custom message (e.g. '&cMaintenance &7%ONLINE%&8/&7%MAX%').
|
||||
enable-playercountmessage: true
|
||||
playercountmessage: "&4Maintenance"
|
||||
|
||||
# Is shown when you move your mouse above the text at the top right corner of the server in the serverlist,
|
||||
# where the playercount would normally be displayed.
|
||||
playercounthovermessage: "&cCurrently under%NEWLINE%&cmaintenance"
|
||||
|
||||
# Is shown when a player tries to join while maintenance is enabled and they don't have the permission to bypass it.
|
||||
kickmessage: "&cThe server is currently under maintenance!%NEWLINE%Try again later!"
|
||||
|
||||
# If using the timer command: In what intervalls before enabling/disabling maintenance there will be a broadcast.
|
||||
timer-broadcast-for-seconds: [1200, 900, 600, 300, 120, 60, 30, 20, 10, 5, 4, 3, 2, 1]
|
||||
|
||||
# If set to true, players with the maintenance.joinnotification permission will receive a message,
|
||||
# that a player tried to join the server while maintenance is enabled.
|
||||
send-join-notification: false
|
||||
|
||||
# If set to true, the server icon will be changed to maintenance-icon.png in the Bungee main/base-folder.
|
||||
custom-maintenance-icon: false
|
||||
|
||||
# Changes the language of command feedback/messages.
|
||||
# Currently available are: en (English), de (German), fr (French), pt (Portuguese)
|
||||
language: en
|
||||
@@ -0,0 +1,16 @@
|
||||
This repo is mainly for reporting bugs in the issues section. You might have a look at the general code, but you can't actually compile it (that easily) without other dependencies. You may not copy the code or distribute it as your own.
|
||||
|
||||
# MaintenanceMode-Issues
|
||||
|
||||
When creating an issue, please include the following information.
|
||||
- MaintenanceMode version
|
||||
- Whether you are using the plugin on a Spigot or a BungeeCord server
|
||||
- Explanation of how to reproduce the issue
|
||||
- The entire error message (!) if present
|
||||
|
||||
Issues can be created here: https://github.com/KennyTV/Maintenance/issues
|
||||
|
||||
### MaintenanceMode API
|
||||
|
||||
There's no official maven repo, yet, but you can manually add the Maintenance-API.jar file to your library (can be downloaded in the code section, https://github.com/KennyTV/Maintenance/raw/master/Maintenance-API.jar).
|
||||
By using MaintenanceBungeeAPI#getAPI or MaintenanceSpigotAPI#getAPI (depending on what server you are using the plugin) you can get some base methods. A rough documentation can be found here https://github.com/KennyTV/Maintenance/tree/master/Maintenance-API/src/main/java/eu/kennytv/maintenance/api
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>eu.kennytv</groupId>
|
||||
<artifactId>maintenance-base</artifactId>
|
||||
<version>2.5.2</version>
|
||||
<name>Maintenance</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>maintenance-parent</module>
|
||||
<module>maintenance-core</module>
|
||||
<module>maintenance-spigot</module>
|
||||
<module>maintenance-bungee</module>
|
||||
<module>maintenance-api</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<plugin.java>1.8</plugin.java>
|
||||
<maven.compiler.target>${plugin.java}</maven.compiler.target>
|
||||
<maven.compiler.source>${plugin.java}</maven.compiler.source>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.zaxxer.hikari</pattern>
|
||||
<shadedPattern>eu.kennytv.lib.hikari</shadedPattern>
|
||||
</relocation>
|
||||
<!--<relocation>
|
||||
<pattern>org.slf4j</pattern>
|
||||
<shadedPattern>eu.kennytv.lib.slf4j</shadedPattern>
|
||||
</relocation>-->
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.name}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
Reference in new issue
Block a user