Add 'AliPresents/' from commit '6b53cc00ed8c78f81d7e2a54ebeeb53b4211bf40'
git-subtree-dir: AliPresents git-subtree-mainline:dac32390c5
git-subtree-split:6b53cc00ed
This commit is contained in:
commit
8703e26146
114 changed files with 6041 additions and 0 deletions
224
AliPresents/.gitignore
vendored
Normal file
224
AliPresents/.gitignore
vendored
Normal file
|
@ -0,0 +1,224 @@
|
||||||
|
#################
|
||||||
|
## Eclipse
|
||||||
|
#################
|
||||||
|
|
||||||
|
*.pydevproject
|
||||||
|
.project
|
||||||
|
.metadata/
|
||||||
|
bin/
|
||||||
|
tmp/
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*~.nib
|
||||||
|
local.properties
|
||||||
|
.classpath
|
||||||
|
.settings/
|
||||||
|
.loadpath
|
||||||
|
target/
|
||||||
|
.project
|
||||||
|
|
||||||
|
# External tool builders
|
||||||
|
.externalToolBuilders/
|
||||||
|
|
||||||
|
# Locally stored "Eclipse launch configurations"
|
||||||
|
*.launch
|
||||||
|
|
||||||
|
# CDT-specific
|
||||||
|
.cproject
|
||||||
|
|
||||||
|
# PDT-specific
|
||||||
|
.buildpath
|
||||||
|
|
||||||
|
|
||||||
|
#################
|
||||||
|
## Visual Studio
|
||||||
|
#################
|
||||||
|
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
|
||||||
|
[Dd]ebug/
|
||||||
|
[Rr]elease/
|
||||||
|
x64/
|
||||||
|
build/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.log
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
*.ncrunch*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.Publish.xml
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# NuGet Packages Directory
|
||||||
|
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||||
|
#packages/
|
||||||
|
|
||||||
|
# Windows Azure Build Output
|
||||||
|
csx
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Windows Store app package directory
|
||||||
|
AppPackages/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
sql/
|
||||||
|
*.Cache
|
||||||
|
ClientBin/
|
||||||
|
[Ss]tyle[Cc]op.*
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file to a newer
|
||||||
|
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
App_Data/*.mdf
|
||||||
|
App_Data/*.ldf
|
||||||
|
|
||||||
|
#############
|
||||||
|
## Windows detritus
|
||||||
|
#############
|
||||||
|
|
||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Mac crap
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
|
||||||
|
#############
|
||||||
|
## Python
|
||||||
|
#############
|
||||||
|
|
||||||
|
*.py[cod]
|
||||||
|
|
||||||
|
# Packages
|
||||||
|
*.egg
|
||||||
|
*.egg-info
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
eggs/
|
||||||
|
parts/
|
||||||
|
var/
|
||||||
|
sdist/
|
||||||
|
develop-eggs/
|
||||||
|
.installed.cfg
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
.coverage
|
||||||
|
.tox
|
||||||
|
|
||||||
|
#Translations
|
||||||
|
*.mo
|
||||||
|
|
||||||
|
#Mr Developer
|
||||||
|
.mr.developer.cfg
|
||||||
|
.metadata/*
|
||||||
|
TheButtonAutoFlair/out/artifacts/Autoflair/Autoflair.jar
|
||||||
|
*.iml
|
||||||
|
*.name
|
||||||
|
.idea/compiler.xml
|
||||||
|
*.xml
|
23
AliPresents/.project
Normal file
23
AliPresents/.project
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>AliPresents</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
3
AliPresents/.settings/org.eclipse.core.resources.prefs
Normal file
3
AliPresents/.settings/org.eclipse.core.resources.prefs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
||||||
|
encoding/src=UTF-8
|
5
AliPresents/.settings/org.eclipse.jdt.core.prefs
Normal file
5
AliPresents/.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
4
AliPresents/.settings/org.eclipse.m2e.core.prefs
Normal file
4
AliPresents/.settings/org.eclipse.m2e.core.prefs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
674
AliPresents/LICENSE
Normal file
674
AliPresents/LICENSE
Normal file
|
@ -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:
|
||||||
|
|
||||||
|
{project} Copyright (C) {year} {fullname}
|
||||||
|
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>.
|
16
AliPresents/README.md
Normal file
16
AliPresents/README.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# AliPresents
|
||||||
|
A plugin that contains most of Ali's Projects
|
||||||
|
|
||||||
|
Components:
|
||||||
|
- Flairdoors
|
||||||
|
- GhostiePowers
|
||||||
|
- AliLinks
|
||||||
|
|
||||||
|
CreativeBoundaries
|
||||||
|
|
||||||
|
Magic:
|
||||||
|
- BoomBow
|
||||||
|
- AliArrowTrails
|
||||||
|
|
||||||
|
ButtonMinigames
|
||||||
|
Ultrahardcore
|
0
AliPresents/config.yml
Normal file
0
AliPresents/config.yml
Normal file
0
AliPresents/metrics.yml
Normal file
0
AliPresents/metrics.yml
Normal file
23
AliPresents/plugin.yml
Normal file
23
AliPresents/plugin.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
main: buttondevteam.alipresents.AliPresents
|
||||||
|
name: AliPresents
|
||||||
|
version: 2.0.2
|
||||||
|
|
||||||
|
commands:
|
||||||
|
alilink:
|
||||||
|
description: creates wireless redstone
|
||||||
|
cb:
|
||||||
|
description: creates creative boundaries
|
||||||
|
dungeons:
|
||||||
|
description: handles the resource dungeons scattered around the map
|
||||||
|
debug:
|
||||||
|
description: debug commands
|
||||||
|
flaircolour:
|
||||||
|
description: flaaairs
|
||||||
|
gpower:
|
||||||
|
description: powerssss
|
||||||
|
insurance:
|
||||||
|
description: item block insurance
|
||||||
|
magic:
|
||||||
|
description: magic
|
||||||
|
metrics:
|
||||||
|
description: metrics system
|
118
AliPresents/pom.xml
Normal file
118
AliPresents/pom.xml
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
<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>com.github.tbmcplugins</groupId>
|
||||||
|
<artifactId>AliPresents</artifactId>
|
||||||
|
<version>2.0.2-SNAPSHOT</version>
|
||||||
|
<name>AliPresents</name>
|
||||||
|
<description>A bucket of aaall the stuff Ali makes. It's a bit smelly.</description>
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>src</sourceDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src</directory>
|
||||||
|
<excludes>
|
||||||
|
<exclude>**/*.java</exclude>
|
||||||
|
</excludes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>.</directory>
|
||||||
|
<includes>
|
||||||
|
<include>*.yml</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.3</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy</id>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>target</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
<repository> <!-- This repo fixes issues with transitive dependencies -->
|
||||||
|
<id>jcenter</id>
|
||||||
|
<url>http://jcenter.bintray.com</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack.io</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>ess-repo</id>
|
||||||
|
<url>http://repo.ess3.net/content/groups/essentials</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>citizensnpcs</id>
|
||||||
|
<url>http://repo.citizensnpcs.co/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.11-R0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
||||||
|
<artifactId>ButtonCore</artifactId>
|
||||||
|
<version>master-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.ess3</groupId>
|
||||||
|
<artifactId>Essentials</artifactId>
|
||||||
|
<version>2.14-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.citizensnpcs</groupId>
|
||||||
|
<artifactId>citizens-v1_11_R1</artifactId>
|
||||||
|
<version>2.0.21-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
||||||
|
<artifactId>Towny</artifactId>
|
||||||
|
<version>master-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
41
AliPresents/src/buttondevteam/alipresents/AliPresents.java
Normal file
41
AliPresents/src/buttondevteam/alipresents/AliPresents.java
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
package buttondevteam.alipresents;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
//import alisolarflare.links.AliLinkSubPlug;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.components.alilinks.AliLinkComponent;
|
||||||
|
import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundariesComponent;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.FlairColourComponent;
|
||||||
|
import buttondevteam.alipresents.components.gpower.GPowerComponent;
|
||||||
|
import buttondevteam.alipresents.components.hotfix.HotfixComponent;
|
||||||
|
import buttondevteam.alipresents.components.insurance.InsuranceComponent;
|
||||||
|
import buttondevteam.alipresents.components.magic.MagicComponent;
|
||||||
|
|
||||||
|
public class AliPresents extends JavaPlugin{
|
||||||
|
public void onEnable(){
|
||||||
|
PluginDescriptionFile pdfFile = getDescription();
|
||||||
|
|
||||||
|
Logger logger = getLogger();
|
||||||
|
logger.info(pdfFile.getName() + " has been started (V." + pdfFile.getVersion()+ ").");
|
||||||
|
|
||||||
|
|
||||||
|
new AliLinkComponent().register(this);
|
||||||
|
new CreativeBoundariesComponent().register(this);
|
||||||
|
new DungeonComponent().register(this);
|
||||||
|
new FlairColourComponent().register(this);
|
||||||
|
new GPowerComponent().register(this);
|
||||||
|
new HotfixComponent().register(this);
|
||||||
|
new InsuranceComponent().register(this);
|
||||||
|
new MagicComponent().register(this);
|
||||||
|
//new MetricsComponent().register(this);
|
||||||
|
|
||||||
|
|
||||||
|
logger.info(pdfFile.getName() + " has fully registered (V." + pdfFile.getVersion()+ ").");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package buttondevteam.alipresents.architecture;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.BaseCommand;
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Module class allows the compacting of projects into one single package.
|
||||||
|
*
|
||||||
|
* Each feature can have its commands and listeners coded into the Module class,
|
||||||
|
* as well as any other pointers to memory units, or other classes in the package.
|
||||||
|
*
|
||||||
|
* This package can then be moved from eclipse project to eclipse project smoothly,
|
||||||
|
* as long as the destination project has the Module abstract class, and as long as all dependencies are either
|
||||||
|
* contained in the moved package, or moved along with it.
|
||||||
|
* @author Alisolarflare
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public abstract class Component{
|
||||||
|
/**
|
||||||
|
* Registers the module, when called by the JavaPlugin class. Call
|
||||||
|
* registerCommand() and registerListener() within this method.
|
||||||
|
*
|
||||||
|
* @param plugin Plugin class called to register commands and listeners
|
||||||
|
*/
|
||||||
|
public abstract void register(JavaPlugin plugin);
|
||||||
|
/**
|
||||||
|
* Registers a TBMCCommand to the plugin
|
||||||
|
* @param plugin Main plugin responsible for stuff
|
||||||
|
* @param label Name of the command in plugin.yml
|
||||||
|
* @param commandExecutor Custom coded CommandExecutor class
|
||||||
|
*/
|
||||||
|
protected void registerCommand(JavaPlugin plugin, BaseCommand commandBase){
|
||||||
|
TBMCChatAPI.AddCommand(plugin, commandBase);
|
||||||
|
//plugin.getCommand(commandBase.getClass().getSimpleName().toString()).setExecutor(commandBase);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Registers a Listener to this plugin
|
||||||
|
* @param plugin Main plugin responsible for stuff
|
||||||
|
* @param label Name of the command in plugin.yml
|
||||||
|
* @param commandExecutor Custom coded CommandExecutor class
|
||||||
|
*/
|
||||||
|
protected Listener registerListener(JavaPlugin plugin, Listener listener){
|
||||||
|
TBMCCoreAPI.RegisterEventsForExceptions(listener, plugin);
|
||||||
|
return listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveData(FileConfiguration config, String pathToData, Object data){
|
||||||
|
config.set("moduledata." + this.getClassName() + "." + pathToData, data);
|
||||||
|
}
|
||||||
|
public Object getData(FileConfiguration config, String pathToData, Object data){
|
||||||
|
return config.get("moduledata." + this.getClassName() + "." + pathToData, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClassName(){
|
||||||
|
Class<?> enclosingClass = getClass().getEnclosingClass();
|
||||||
|
String className = "nullModule";
|
||||||
|
if (enclosingClass != null) {
|
||||||
|
className = (enclosingClass.getName());
|
||||||
|
} else {
|
||||||
|
className = (getClass().getName());
|
||||||
|
}
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package buttondevteam.alipresents.architecture.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
|
public abstract class BaseCommand extends TBMCCommandBase implements CommandExecutor{
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return OnCommand(sender, label, args);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[] {
|
||||||
|
"This command doesn't have help text ask a dev to write one",
|
||||||
|
"If you're a dev, write the help text you lazy bastard. -Ali"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package buttondevteam.alipresents.architecture.commands;
|
||||||
|
|
||||||
|
public abstract class CommandBlockCommand extends BaseCommand{
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[] {
|
||||||
|
"This command doesn't have help text. ",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package buttondevteam.alipresents.architecture.commands;
|
||||||
|
|
||||||
|
public abstract class ModCommand extends PlayerCommand{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[] {
|
||||||
|
"This command doesn't have help text, ask a dev to add one",
|
||||||
|
"If you're a dev, write the help text you lazy bastard. -Ali"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package buttondevteam.alipresents.architecture.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public abstract class PlayerCommand extends BaseCommand{
|
||||||
|
/**replaces CommandExecutor functionality*/
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String string, String[] args){
|
||||||
|
return OnCommand(sender, string, args);
|
||||||
|
}
|
||||||
|
/**replaces TBMCCommandBase functionality*/
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(CommandSender sender, String alias, String[] args){
|
||||||
|
return OnCommand((Player) sender, alias, args);
|
||||||
|
}
|
||||||
|
public abstract boolean OnCommand(Player player, String alias, String[] args);
|
||||||
|
@Override
|
||||||
|
public boolean GetPlayerOnly() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean GetModOnly() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[] {
|
||||||
|
"This command doesn't have help text. ",
|
||||||
|
"If you're a player, ask a mod to write one",
|
||||||
|
"If you're a mod, ask a dev to write one",
|
||||||
|
"If you're a dev, write the help text you lazy bastard. -Ali"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package buttondevteam.alipresents.components.alilinks;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.components.alilinks.entities.Link;
|
||||||
|
|
||||||
|
public class AliLinkAPI {
|
||||||
|
public static List<Link> linkList = new ArrayList<Link>();
|
||||||
|
/**"Usage: /pressalilink <frequency>"*/
|
||||||
|
public static boolean sendPressEvent(CommandSender sender, String[] inputFrequencies, JavaPlugin plugin) {
|
||||||
|
if (inputFrequencies.length == 0) {
|
||||||
|
sender.sendMessage("You must specify a link frequency");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> inputFrequencyList= Arrays.asList(inputFrequencies);
|
||||||
|
for (Link link : linkList) {
|
||||||
|
if(inputFrequencyList.contains(link.frequency)){
|
||||||
|
link.press(plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage("Link pressed!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public static boolean createAliLink(Player player, String[] args) {
|
||||||
|
if (args == null || args.length < 1) {
|
||||||
|
player.sendMessage("You must specify a link frequency");
|
||||||
|
player.sendMessage("/pressalilink [name]");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String frequency = args[0];
|
||||||
|
World world = player.getWorld();
|
||||||
|
int x = player.getLocation().getBlockX();
|
||||||
|
int y = player.getLocation().getBlockY();
|
||||||
|
int z = player.getLocation().getBlockZ();
|
||||||
|
|
||||||
|
if (args.length > 4) {
|
||||||
|
boolean arg1isNumber = StringUtils.isNumericSpace(args[1]);
|
||||||
|
boolean arg2isNumber = StringUtils.isNumericSpace(args[2]);
|
||||||
|
boolean arg3isNumber = StringUtils.isNumericSpace(args[3]);
|
||||||
|
if (arg1isNumber && arg2isNumber && arg3isNumber) {
|
||||||
|
x = Integer.parseInt(args[1]);
|
||||||
|
y = Integer.parseInt(args[2]);
|
||||||
|
z = Integer.parseInt(args[3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Link link = new Link(frequency, world, x, y, z);
|
||||||
|
linkList.add(link);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@SuppressWarnings({ "unchecked", "unused" })
|
||||||
|
private List<Link> MapToLinkList(List<Map<?, ?>> mapList, Server server) {
|
||||||
|
List<Link> linkList = new ArrayList<Link>();
|
||||||
|
for (Map<?, ?> MapWithLinkData : mapList){
|
||||||
|
linkList.add(new Link((Map<String,String>) MapWithLinkData, server));
|
||||||
|
}
|
||||||
|
return linkList;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package buttondevteam.alipresents.components.alilinks;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.Component;
|
||||||
|
import buttondevteam.alipresents.components.alilinks.commands.ListLinks;
|
||||||
|
import buttondevteam.alipresents.components.alilinks.commands.Press;
|
||||||
|
import buttondevteam.alipresents.components.alilinks.commands.Set;
|
||||||
|
|
||||||
|
public class AliLinkComponent extends Component {
|
||||||
|
private static JavaPlugin p;
|
||||||
|
|
||||||
|
public static JavaPlugin getPlugin() {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
p = plugin;
|
||||||
|
registerCommand(plugin, new Press());
|
||||||
|
registerCommand(plugin, new Set());
|
||||||
|
registerCommand(plugin, new ListLinks());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package buttondevteam.alipresents.components.alilinks.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.PlayerCommand;
|
||||||
|
import buttondevteam.alipresents.components.alilinks.AliLinkAPI;
|
||||||
|
import buttondevteam.alipresents.components.alilinks.entities.Link;
|
||||||
|
|
||||||
|
public class ListLinks extends PlayerCommand {
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
for (Link link : AliLinkAPI.linkList){
|
||||||
|
player.sendMessage(link.toString());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "alilink listlinks";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package buttondevteam.alipresents.components.alilinks.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.CommandBlockCommand;
|
||||||
|
import buttondevteam.alipresents.components.alilinks.AliLinkAPI;
|
||||||
|
import buttondevteam.alipresents.components.alilinks.AliLinkComponent;
|
||||||
|
|
||||||
|
public class Press extends CommandBlockCommand {
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "alilink press";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[] {
|
||||||
|
"Usage: type /"+this.GetCommandPath()+" <frequency> activate a wireless redstone block listening",
|
||||||
|
"to your frequency of choice"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
|
if (args.length < 1)
|
||||||
|
return false;
|
||||||
|
return AliLinkAPI.sendPressEvent(sender, args, AliLinkComponent.getPlugin());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package buttondevteam.alipresents.components.alilinks.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.alilinks.AliLinkAPI;
|
||||||
|
|
||||||
|
public class Set extends ModCommand {
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "alilink set";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
if (args.length < 1)
|
||||||
|
return false;
|
||||||
|
return AliLinkAPI.createAliLink(player, args);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[] {
|
||||||
|
"Usage: type /"+this.GetCommandPath()+" <frequency> set a wireless redstone block that listens",
|
||||||
|
"for signals from the players pressing the frequency of your choice"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package buttondevteam.alipresents.components.alilinks.entities;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.components.alilinks.tasks.UnpressTask;
|
||||||
|
|
||||||
|
public class Link{
|
||||||
|
|
||||||
|
public String frequency;
|
||||||
|
public World world;
|
||||||
|
public int x;
|
||||||
|
public int y;
|
||||||
|
public int z;
|
||||||
|
|
||||||
|
/**Constructor for copying links*/
|
||||||
|
public Link(Link link){
|
||||||
|
this.frequency = link.frequency;
|
||||||
|
this.world = link.world;
|
||||||
|
this.x = link.x;
|
||||||
|
this.y = link.y;
|
||||||
|
this.z = link.z;
|
||||||
|
}
|
||||||
|
/**Constructor for deserialization*/
|
||||||
|
public Link(Map<String,String> linkFromMap, Server server){
|
||||||
|
this.frequency = linkFromMap.get("frequency");
|
||||||
|
this.world = server.getWorld(linkFromMap.get("world"));
|
||||||
|
this.x = Integer.parseInt(linkFromMap.get("x"));
|
||||||
|
this.y = Integer.parseInt(linkFromMap.get("y"));
|
||||||
|
this.z = Integer.parseInt(linkFromMap.get("z"));
|
||||||
|
}
|
||||||
|
/**Constructor for Location inputs*/
|
||||||
|
public Link(String frequency, Location location){
|
||||||
|
this.frequency = frequency;
|
||||||
|
this.world = location.getWorld();
|
||||||
|
this.x = location.getBlockX();
|
||||||
|
this.y = location.getBlockY();
|
||||||
|
this.z = location.getBlockZ();
|
||||||
|
}
|
||||||
|
/**Pure Constructor*/
|
||||||
|
public Link(String frequency, World world, int x, int y, int z){
|
||||||
|
this.frequency = frequency;
|
||||||
|
this.world = world;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activates the Ali-Link
|
||||||
|
* @param plugin
|
||||||
|
*/
|
||||||
|
public void press(JavaPlugin plugin) {
|
||||||
|
Location location = new Location(this.world, this.x, this.y, this.z);
|
||||||
|
location.getBlock().setType(Material.REDSTONE_BLOCK);
|
||||||
|
new UnpressTask(location).runTaskLater(plugin, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String,String> toMap(){
|
||||||
|
Map<String, String> linkAsMap = new HashMap<String,String>();
|
||||||
|
|
||||||
|
linkAsMap.put("frequency", frequency);
|
||||||
|
linkAsMap.put("world", world.getName());
|
||||||
|
linkAsMap.put("x", Integer.toString(this.x));
|
||||||
|
linkAsMap.put("y", Integer.toString(this.y));
|
||||||
|
linkAsMap.put("z", Integer.toString(this.z));
|
||||||
|
|
||||||
|
return linkAsMap;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package buttondevteam.alipresents.components.alilinks.tasks;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class UnpressTask extends BukkitRunnable {
|
||||||
|
private Location location;
|
||||||
|
public UnpressTask(Location location){
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
location.getBlock().setType(Material.STAINED_CLAY);
|
||||||
|
location.getBlock().setData((byte) 14);
|
||||||
|
this.cancel();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package buttondevteam.alipresents.components.creativeboundaries;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||||
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
|
import com.palmergames.bukkit.towny.object.Town;
|
||||||
|
import com.palmergames.bukkit.towny.object.TownBlock;
|
||||||
|
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
||||||
|
|
||||||
|
public class CreativeBoundariesAPI {
|
||||||
|
private static List<Player> cbCreatives = new ArrayList<Player>();
|
||||||
|
private static boolean forceBoundaries = false;
|
||||||
|
public CreativeBoundariesAPI(List<Player> cbCreatives){
|
||||||
|
CreativeBoundariesAPI.cbCreatives = cbCreatives;
|
||||||
|
}
|
||||||
|
public static void toSurvival(Player player){
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
cbCreatives.remove(player);
|
||||||
|
}
|
||||||
|
public static boolean toCreative(Player player){
|
||||||
|
if (player.getWorld().getName().equalsIgnoreCase("World")){
|
||||||
|
player.sendMessage("Creative Boundaries is disabled on the New Map!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
|
||||||
|
|
||||||
|
if (tb == null) {
|
||||||
|
player.sendMessage("Some error occured.");
|
||||||
|
player.sendMessage("TownBlock is null.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Town town;
|
||||||
|
try {
|
||||||
|
town = tb.getTown();
|
||||||
|
} catch (NotRegisteredException e) {
|
||||||
|
player.sendMessage("You aren't standing in a town, head to your home town to use this command.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean playerIsInTown = false;
|
||||||
|
for(Resident res : town.getResidents()){
|
||||||
|
if (res.getName().toString().equals(player.getName().toString())){
|
||||||
|
playerIsInTown = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!playerIsInTown){
|
||||||
|
player.sendMessage("Sorry, you're not part of this town");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.setGameMode(GameMode.CREATIVE);
|
||||||
|
cbCreatives.add(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public static void setForceBoundaries(boolean forceBoundaries){
|
||||||
|
CreativeBoundariesAPI.forceBoundaries = forceBoundaries;
|
||||||
|
}
|
||||||
|
public static boolean setForceBoundaries(Player player, String[] args){
|
||||||
|
if(args.length < 1){
|
||||||
|
player.sendMessage("You must use True, False, 1, or 0 as arguments!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String firstArgument = args[0];
|
||||||
|
if(firstArgument.startsWith("t") || firstArgument.equals("1")){
|
||||||
|
player.sendMessage("Dickmode has been turned on!");
|
||||||
|
forceBoundaries = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(firstArgument.startsWith("f") || firstArgument.equals("0")){
|
||||||
|
player.sendMessage("Dickmode has been turned off!");
|
||||||
|
forceBoundaries = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public static boolean getforceBoundaries(){
|
||||||
|
return forceBoundaries;
|
||||||
|
}
|
||||||
|
public static boolean isCBCreative(Player player){
|
||||||
|
return cbCreatives.contains(player);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package buttondevteam.alipresents.components.creativeboundaries;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.Component;
|
||||||
|
import buttondevteam.alipresents.components.creativeboundaries.commands.Cbgm0;
|
||||||
|
import buttondevteam.alipresents.components.creativeboundaries.commands.Cbgm1;
|
||||||
|
import buttondevteam.alipresents.components.creativeboundaries.commands.SetForceBoundaries;
|
||||||
|
import buttondevteam.alipresents.components.creativeboundaries.listeners.PlotChangeListener;
|
||||||
|
|
||||||
|
|
||||||
|
public class CreativeBoundariesComponent extends Component{
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
registerCommand(plugin, new Cbgm1());
|
||||||
|
registerCommand(plugin, new Cbgm0());
|
||||||
|
registerCommand(plugin, new SetForceBoundaries());
|
||||||
|
|
||||||
|
registerListener(plugin, new PlotChangeListener());
|
||||||
|
//registerListener(plugin, new ItemRestrictionListener(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package buttondevteam.alipresents.components.creativeboundaries.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.PlayerCommand;
|
||||||
|
import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundariesAPI;
|
||||||
|
|
||||||
|
public class Cbgm0 extends PlayerCommand{
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "cb gm0";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String arg2, String[] arg3) {
|
||||||
|
CreativeBoundariesAPI.toSurvival(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{"Creative Boundaries Usage: /"+this.GetCommandPath()+""};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package buttondevteam.alipresents.components.creativeboundaries.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.PlayerCommand;
|
||||||
|
import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundariesAPI;
|
||||||
|
|
||||||
|
public class Cbgm1 extends PlayerCommand {
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "cb gm1";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String arg2, String[] arg3) {
|
||||||
|
return CreativeBoundariesAPI.toCreative(player);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[] {
|
||||||
|
"Usage: When in a town that you either own or are a resident of, type /"+this.GetCommandPath()+" to gain creative"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package buttondevteam.alipresents.components.creativeboundaries.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundariesAPI;
|
||||||
|
|
||||||
|
public class SetForceBoundaries extends ModCommand{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "cb set forceboundaries";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String label, String[] args) {
|
||||||
|
return (CreativeBoundariesAPI.setForceBoundaries(player, args));
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{"Usage: /"+this.GetCommandPath()+" <True/False/0/1>"};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package buttondevteam.alipresents.components.creativeboundaries.listeners;
|
||||||
|
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
import com.palmergames.bukkit.towny.event.PlayerChangePlotEvent;
|
||||||
|
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||||
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
|
import com.palmergames.bukkit.towny.object.Town;
|
||||||
|
import com.palmergames.bukkit.towny.object.TownBlock;
|
||||||
|
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.components.creativeboundaries.CreativeBoundariesAPI;
|
||||||
|
|
||||||
|
public class PlotChangeListener implements Listener{
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerPlotChange(PlayerChangePlotEvent plotEvent){
|
||||||
|
Player player = plotEvent.getPlayer();
|
||||||
|
if (CreativeBoundariesAPI.getforceBoundaries() == false){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (plotEvent.getPlayer().getGameMode() != GameMode.CREATIVE){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(CreativeBoundariesAPI.isCBCreative(player))){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TownBlock tb = TownyUniverse.getTownBlock(player.getLocation());
|
||||||
|
if (tb == null) {
|
||||||
|
player.sendMessage("You have left your town boundaries!");
|
||||||
|
CreativeBoundariesAPI.toSurvival(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Town town;
|
||||||
|
try {
|
||||||
|
town = tb.getTown();
|
||||||
|
} catch (NotRegisteredException e) {
|
||||||
|
player.sendMessage("You have left your town boundaries!!");
|
||||||
|
CreativeBoundariesAPI.toSurvival(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (town == null) {
|
||||||
|
player.sendMessage("You have left your town boundaries!!!");
|
||||||
|
CreativeBoundariesAPI.toSurvival(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean townHasRes = false;
|
||||||
|
for(Resident res : town.getResidents()){
|
||||||
|
if (res.getName().toString().equals(player.getName().toString())){
|
||||||
|
townHasRes = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!townHasRes){
|
||||||
|
player.sendMessage("You have left your town boundaries!!!!");
|
||||||
|
CreativeBoundariesAPI.toSurvival(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.Component;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.commands.DisplayDebug;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.commands.Enter;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.commands.Exit;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.commands.SetEntrance;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.commands.SetExit;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.dungeons.GenericDungeonA1;
|
||||||
|
|
||||||
|
public class DungeonComponent extends Component {
|
||||||
|
public GenericDungeonA1 dungeonA1;
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
dungeonA1 = new GenericDungeonA1(plugin);
|
||||||
|
|
||||||
|
registerCommand(plugin, new DisplayDebug(this));
|
||||||
|
registerCommand(plugin, new Enter(this));
|
||||||
|
registerCommand(plugin, new Exit(this));
|
||||||
|
registerCommand(plugin, new SetEntrance(this));
|
||||||
|
registerCommand(plugin, new SetExit(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
|
||||||
|
public class DisplayDebug extends ModCommand {
|
||||||
|
|
||||||
|
private DungeonComponent component;
|
||||||
|
|
||||||
|
public DisplayDebug(DungeonComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
player.sendMessage("Entrance Location: "+component.dungeonA1.getDungeonEntrance().toString());
|
||||||
|
player.sendMessage("Exit Location: "+component.dungeonA1.getDungeonExit().toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "dungeons display debug";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
|
||||||
|
public class Enter extends ModCommand{
|
||||||
|
private DungeonComponent component;
|
||||||
|
public Enter(DungeonComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
component.dungeonA1.enterDungeon(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "dungeons enter";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.PlayerCommand;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
|
||||||
|
public class Exit extends PlayerCommand {
|
||||||
|
|
||||||
|
private DungeonComponent component;
|
||||||
|
public Exit(DungeonComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
component.dungeonA1.exitDungeon(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "dungeons exit";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
|
||||||
|
public class SetEntrance extends ModCommand {
|
||||||
|
|
||||||
|
private DungeonComponent component;
|
||||||
|
public SetEntrance(DungeonComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
player.sendMessage("Setting DungeonA1's Entrance!");
|
||||||
|
component.dungeonA1.setEntrance(player.getLocation());
|
||||||
|
player.sendMessage("Entrance Set!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "dungeons set entrance";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||||
|
|
||||||
|
public class SetExit extends ModCommand {
|
||||||
|
|
||||||
|
private DungeonComponent component;
|
||||||
|
|
||||||
|
public SetExit(DungeonComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
player.sendMessage("Setting DungeonA1's Exit!");
|
||||||
|
component.dungeonA1.setExit(player.getLocation());
|
||||||
|
player.sendMessage("DungeonA1's Exit Set!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "dungeons set exit";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.dungeons;
|
||||||
|
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**Dungeon Object that represents a dungeon*/
|
||||||
|
public abstract class Dungeon {
|
||||||
|
public abstract Location getDungeonEntrance();
|
||||||
|
public abstract Location getDungeonExit();
|
||||||
|
public abstract void setEntrance(Location location);
|
||||||
|
public abstract void setExit(Location location);
|
||||||
|
public boolean enterDungeon(Player player){
|
||||||
|
|
||||||
|
if (getDungeonEntrance() == null){
|
||||||
|
player.sendMessage("There has been a collapse! You may not enter the dungeon now.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
player.teleport(getDungeonEntrance());
|
||||||
|
player.setGameMode(GameMode.ADVENTURE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public boolean exitDungeon(Player player){
|
||||||
|
if (getDungeonExit() == null){
|
||||||
|
player.sendMessage("Oh god, something went horribly wrong with exiting... Yell for help!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
player.teleport(getDungeonExit());
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package buttondevteam.alipresents.components.dungeons.dungeons;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
public class GenericDungeonA1 extends Dungeon{
|
||||||
|
private Location entrance;
|
||||||
|
private Location exit;
|
||||||
|
private JavaPlugin plugin;
|
||||||
|
|
||||||
|
public GenericDungeonA1(JavaPlugin plugin){
|
||||||
|
if(!initDungeon(plugin)){
|
||||||
|
plugin.getServer().broadcastMessage("DungeonA1 cant be initialized!");
|
||||||
|
}
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
private boolean initDungeon(JavaPlugin plugin){
|
||||||
|
/*
|
||||||
|
if (plugin.getServer().getWorld("Dungeons") == null || plugin.getServer().getWorld("world") == null){
|
||||||
|
plugin.getServer().broadcastMessage("GenericDungeonA1Error! One of the worlds is null!");
|
||||||
|
plugin.getServer().broadcastMessage("Available Worlds... " + plugin.getServer().getWorlds().toString());
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
Location temp;
|
||||||
|
if ((temp = loadLocation(plugin, "dungeons.dungeona1.enter")) != null){
|
||||||
|
entrance = temp;
|
||||||
|
}else if(plugin.getServer().getWorld("Dungeons") != null){
|
||||||
|
entrance = new Location(plugin.getServer().getWorld("Dungeons"), -7.5, 138.0, -91.5);
|
||||||
|
}else{
|
||||||
|
plugin.getServer().broadcastMessage("There is no working default dungeon entrance for A1, setting to null");
|
||||||
|
entrance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = null;
|
||||||
|
if ((temp = loadLocation(plugin, "dungeons.dungeona1.exit")) != null){
|
||||||
|
exit = temp;
|
||||||
|
}else if (plugin.getServer().getWorld("world") != null){
|
||||||
|
exit = plugin.getServer().getWorld("world").getSpawnLocation().clone();
|
||||||
|
}else{
|
||||||
|
plugin.getServer().broadcastMessage("There is no working default dungeon exit for A1, setting to null");
|
||||||
|
exit = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entrance == null || exit == null){
|
||||||
|
plugin.getServer().broadcastMessage("DungeonA1Error! Dungeon Entrance or Exit is null!");
|
||||||
|
plugin.getServer().broadcastMessage("Dungeon Entrance: " + entrance.toString());
|
||||||
|
plugin.getServer().broadcastMessage("Dungeon Exit: " + exit.toString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setEntrance(Location location){
|
||||||
|
saveLocation(plugin, "dungeons.dungeona1.enter", location);
|
||||||
|
entrance = location;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setExit(Location location){
|
||||||
|
saveLocation(plugin, "dungeons.dungeona1.exit", location);
|
||||||
|
exit = location;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Location getDungeonEntrance() {
|
||||||
|
return entrance;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Location getDungeonExit() {
|
||||||
|
return exit;
|
||||||
|
}
|
||||||
|
private void saveLocation(JavaPlugin plugin, String path, Location location){
|
||||||
|
plugin.getConfig().set(path+".world", location.getWorld().getName());
|
||||||
|
plugin.getConfig().set(path+".x", location.getX());
|
||||||
|
plugin.getConfig().set(path+".y", location.getY());
|
||||||
|
plugin.getConfig().set(path+".z", location.getZ());
|
||||||
|
plugin.saveConfig();
|
||||||
|
}
|
||||||
|
private Location loadLocation(JavaPlugin plugin, String path){
|
||||||
|
try{
|
||||||
|
String worldname = plugin.getConfig().getString(path+".world");
|
||||||
|
if(worldname == null) return null;
|
||||||
|
|
||||||
|
World world = plugin.getServer().getWorld(worldname);
|
||||||
|
double x = plugin.getConfig().getDouble(path+".x");
|
||||||
|
double y = plugin.getConfig().getDouble(path+".y");
|
||||||
|
double z = plugin.getConfig().getDouble(path+".z");
|
||||||
|
if (world == null) return null;
|
||||||
|
|
||||||
|
return new Location(world, x, y, z);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
package buttondevteam.alipresents.components.flaircolour;
|
||||||
|
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.User;
|
||||||
|
|
||||||
|
public class FlairColourAPI {
|
||||||
|
public static void recolourPlayer(User user, DyeColor dyecolour){
|
||||||
|
String name = "";
|
||||||
|
if ((name = user._getNickname()) == null && (name = user.getDisplayName()) == null){
|
||||||
|
name = user.getName();
|
||||||
|
}
|
||||||
|
String sanitizedName = "";
|
||||||
|
for(int i = 0; i < name.length(); i++){
|
||||||
|
if (name.charAt(i) == '§'){
|
||||||
|
i++;//Skips the data value, the 4 in "§4Alisolarflare"
|
||||||
|
}else{
|
||||||
|
sanitizedName += name.charAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String colourCode = dyeToColourCode(dyecolour);
|
||||||
|
String newName = colourCode + sanitizedName;
|
||||||
|
|
||||||
|
user.setNickname(newName);
|
||||||
|
user.sendMessage("Adding the colour " + colourCode + dyecolour.name() + "§f!");
|
||||||
|
user.sendMessage("Your name is now: " + user.getNickname() +"!");
|
||||||
|
}
|
||||||
|
public static String colourShiftRight(String input, DyeColor newDye){
|
||||||
|
return dyeToColourCode(newDye) + shiftColoursRight(input);
|
||||||
|
}
|
||||||
|
private static String shiftColoursRight(String input){
|
||||||
|
String output = "";
|
||||||
|
if (input.length() <= 2){
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
for(int ptr = 0; ptr < input.length(); ptr++){
|
||||||
|
if (input.charAt(ptr) == '§'){
|
||||||
|
boolean foundLegalCharacter = false;
|
||||||
|
for (int i = ptr + 2; i < input.length(); i++){
|
||||||
|
if (input.charAt(i - 1) == '§' || input.charAt(i) == '§'){
|
||||||
|
continue;
|
||||||
|
}else{//SecondPtr points to a legal character
|
||||||
|
foundLegalCharacter = true;
|
||||||
|
output += input.charAt(i) + input.substring(ptr, i);
|
||||||
|
ptr = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (foundLegalCharacter == false){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
output += input.charAt(ptr); //copy over
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
public static String dyeToColourCode(DyeColor dyeColour){
|
||||||
|
String colourChanger;
|
||||||
|
switch(dyeColour){
|
||||||
|
case WHITE:
|
||||||
|
colourChanger = "§f";
|
||||||
|
break;
|
||||||
|
case SILVER:
|
||||||
|
colourChanger = "§7";
|
||||||
|
break;
|
||||||
|
case GRAY:
|
||||||
|
colourChanger = "§8";
|
||||||
|
break;
|
||||||
|
case BLACK:
|
||||||
|
colourChanger = "§0";
|
||||||
|
break;
|
||||||
|
case PINK:
|
||||||
|
colourChanger = "§d";
|
||||||
|
break;
|
||||||
|
case RED:
|
||||||
|
colourChanger = "§c";
|
||||||
|
break;
|
||||||
|
case ORANGE:
|
||||||
|
colourChanger = "§6";
|
||||||
|
break;
|
||||||
|
case YELLOW:
|
||||||
|
colourChanger = "§e";
|
||||||
|
break;
|
||||||
|
case LIME:
|
||||||
|
colourChanger = "§a";
|
||||||
|
break;
|
||||||
|
case GREEN:
|
||||||
|
colourChanger = "§2";
|
||||||
|
break;
|
||||||
|
case LIGHT_BLUE:
|
||||||
|
colourChanger = "§b";
|
||||||
|
break;
|
||||||
|
case CYAN:
|
||||||
|
colourChanger = "§3";
|
||||||
|
break;
|
||||||
|
case BLUE:
|
||||||
|
colourChanger = "§9";
|
||||||
|
break;
|
||||||
|
case PURPLE:
|
||||||
|
colourChanger = "§5";
|
||||||
|
break;
|
||||||
|
case MAGENTA:
|
||||||
|
colourChanger = "§d";
|
||||||
|
break;
|
||||||
|
case BROWN:
|
||||||
|
colourChanger = "§4"; //Technically a dark red
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
colourChanger = "§m";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return colourChanger;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package buttondevteam.alipresents.components.flaircolour;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.ShapedRecipe;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Essentials;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.Component;
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.letterdyes.GetLetterDye;
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.letterdyes.LetterDye;
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.letterdyes.LetterDyeListener;
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.portals.FlairMe;
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.portals.PlayerProximityLoop;
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.portals.PortalListener;
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.portals.SetProximityLocation;
|
||||||
|
|
||||||
|
public class FlairColourComponent extends Component {
|
||||||
|
public List<Player> playersToBeFlaired = new ArrayList<Player>();
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
registerCommand(plugin, new FlairMe(this));
|
||||||
|
registerCommand(plugin, new SetProximityLocation());
|
||||||
|
registerCommand(plugin, new GetLetterDye());
|
||||||
|
|
||||||
|
registerListener(plugin, new PortalListener(plugin, this));
|
||||||
|
registerListener(plugin, new PlayerProximityLoop(plugin, this));
|
||||||
|
registerListener(plugin, new LetterDyeListener((Essentials) Bukkit.getPluginManager().getPlugin("Essentials")));
|
||||||
|
|
||||||
|
registerRecipies(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerRecipies(JavaPlugin plugin){
|
||||||
|
ItemStack testItem = LetterDye.getLetterDye();
|
||||||
|
ShapedRecipe testRecipie = new ShapedRecipe(testItem);
|
||||||
|
testRecipie.shape("***","*C*","***");
|
||||||
|
|
||||||
|
testRecipie.setIngredient('*', Material.INK_SACK);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package buttondevteam.alipresents.components.flaircolour.letterdyes;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.PlayerCommand;
|
||||||
|
|
||||||
|
public class GetLetterDye extends PlayerCommand{
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "flaircolour getletterdye";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
player.getInventory().addItem(LetterDye.getLetterDye());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: Type /"+this.GetCommandPath()+" to get letter dyes that can change your username!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package buttondevteam.alipresents.components.flaircolour.letterdyes;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
public class LetterDye {
|
||||||
|
public static ItemStack getLetterDye(){
|
||||||
|
ItemStack item = new ItemStack(Material.INK_SACK);
|
||||||
|
item.addUnsafeEnchantment(Enchantment.LUCK, 10);
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
meta.setDisplayName("LetterDye");
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package buttondevteam.alipresents.components.flaircolour.letterdyes;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.Dye;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Essentials;
|
||||||
|
import com.earth2me.essentials.User;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.FlairColourAPI;
|
||||||
|
|
||||||
|
public class LetterDyeListener implements Listener{
|
||||||
|
private Essentials essentials;
|
||||||
|
public LetterDyeListener(Essentials essentials) {
|
||||||
|
this.essentials = essentials;
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onLetterDye(PlayerInteractEvent event){
|
||||||
|
try{
|
||||||
|
if((event.getAction() != Action.RIGHT_CLICK_AIR)) return;
|
||||||
|
ItemStack item = event.getItem();
|
||||||
|
|
||||||
|
if(item.getType() != Material.INK_SACK) return;
|
||||||
|
if(item.getItemMeta().hasEnchant(Enchantment.LUCK)) return;
|
||||||
|
if(item.getItemMeta().getEnchantLevel(Enchantment.LUCK) == 10) return;
|
||||||
|
if(item.getItemMeta().getDisplayName() == "LetterDye") return;
|
||||||
|
|
||||||
|
Dye dye = (Dye) event.getItem().getData();
|
||||||
|
User user = essentials.getUser(event.getPlayer());
|
||||||
|
user.setNickname(FlairColourAPI.colourShiftRight(user._getNickname(), dye.getColor()));
|
||||||
|
}catch(Exception e){
|
||||||
|
event.getPlayer().sendMessage(e.getStackTrace().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package buttondevteam.alipresents.components.flaircolour.portals;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.PlayerCommand;
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.FlairColourComponent;
|
||||||
|
|
||||||
|
public class FlairMe extends PlayerCommand {
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "flaircolour flairme";
|
||||||
|
}
|
||||||
|
|
||||||
|
private FlairColourComponent component;
|
||||||
|
public FlairMe(FlairColourComponent flairDoorComponent) {
|
||||||
|
this.component = flairDoorComponent;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String label, String[] args) {
|
||||||
|
component.playersToBeFlaired.add(player);
|
||||||
|
player.sendMessage("Setup Successful! Walk through a portal to get your flair");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: Type /"+this.GetCommandPath()+" and enter a portal with coloured",
|
||||||
|
"wool underneath to change your flair"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package buttondevteam.alipresents.components.flaircolour.portals;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.FlairColourComponent;
|
||||||
|
|
||||||
|
public class PlayerProximityLoop extends BukkitRunnable implements Listener{
|
||||||
|
private static JavaPlugin plugin;
|
||||||
|
private static FlairColourComponent component;
|
||||||
|
private static Location startLocation;
|
||||||
|
private static Location endLocation;
|
||||||
|
|
||||||
|
private static int sX;
|
||||||
|
private static int sY;
|
||||||
|
private static int sZ;
|
||||||
|
private static int eX;
|
||||||
|
private static int eY;
|
||||||
|
private static int eZ;
|
||||||
|
|
||||||
|
public PlayerProximityLoop(JavaPlugin plugin, FlairColourComponent component) {
|
||||||
|
PlayerProximityLoop.plugin = plugin;
|
||||||
|
PlayerProximityLoop.component = component;
|
||||||
|
this.runTaskTimer(plugin, 0, 20);
|
||||||
|
}
|
||||||
|
public static void setStartLocation(Location location){
|
||||||
|
PlayerProximityLoop.sX = location.getBlockX();
|
||||||
|
PlayerProximityLoop.sY = location.getBlockY();
|
||||||
|
PlayerProximityLoop.sZ = location.getBlockZ();
|
||||||
|
PlayerProximityLoop.startLocation = location;
|
||||||
|
|
||||||
|
if (endLocation == null)
|
||||||
|
PlayerProximityLoop.endLocation = location;
|
||||||
|
else
|
||||||
|
PlayerProximityLoop.endLocation.setWorld(location.getWorld());
|
||||||
|
}
|
||||||
|
public static void setEndLocation(Location location){
|
||||||
|
PlayerProximityLoop.eX = location.getBlockX();
|
||||||
|
PlayerProximityLoop.eY = location.getBlockY();
|
||||||
|
PlayerProximityLoop.eZ = location.getBlockZ();
|
||||||
|
PlayerProximityLoop.startLocation.setWorld(location.getWorld());
|
||||||
|
if (endLocation == null)
|
||||||
|
PlayerProximityLoop.endLocation = location;
|
||||||
|
else
|
||||||
|
PlayerProximityLoop.endLocation.setWorld(location.getWorld());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (startLocation == null || endLocation == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int playerX;
|
||||||
|
int playerY;
|
||||||
|
int playerZ;
|
||||||
|
Location playerLocation;
|
||||||
|
for (Player player : plugin.getServer().getOnlinePlayers()){
|
||||||
|
playerLocation = player.getLocation();
|
||||||
|
if(playerLocation.getWorld() != startLocation.getWorld())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
playerX = playerLocation.getBlockX();
|
||||||
|
if((playerX < sX && playerX < eX) || (playerX > sX && playerX > eX))
|
||||||
|
continue;
|
||||||
|
playerY = playerLocation.getBlockY();
|
||||||
|
if((playerY < sY && playerY < eY) || (playerY > sY && playerY > eY))
|
||||||
|
continue;
|
||||||
|
playerZ = playerLocation.getBlockZ();
|
||||||
|
if((playerZ < sZ && playerZ < eZ) || (playerZ > sZ && playerZ > eZ))
|
||||||
|
continue;
|
||||||
|
component.playersToBeFlaired.add(player);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
package buttondevteam.alipresents.components.flaircolour.portals;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerPortalEvent;
|
||||||
|
import org.bukkit.material.Wool;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Essentials;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.FlairColourAPI;
|
||||||
|
import buttondevteam.alipresents.components.flaircolour.FlairColourComponent;
|
||||||
|
|
||||||
|
public class PortalListener implements Listener{
|
||||||
|
public JavaPlugin plugin;
|
||||||
|
|
||||||
|
Essentials essentials;
|
||||||
|
|
||||||
|
private FlairColourComponent component;
|
||||||
|
|
||||||
|
public PortalListener(JavaPlugin plugin, FlairColourComponent component) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.component = component;
|
||||||
|
this.essentials = ((Essentials) Bukkit.getPluginManager().getPlugin("Essentials"));
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onPortalEnter(PlayerPortalEvent event){
|
||||||
|
if(!(event.getPlayer() instanceof Player)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if(!(component.playersToBeFlaired.contains(player))){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setTo(player.getLocation());
|
||||||
|
|
||||||
|
int x = player.getLocation().getBlockX();
|
||||||
|
int y = player.getLocation().getBlockY();
|
||||||
|
int z = player.getLocation().getBlockZ();
|
||||||
|
|
||||||
|
Block HigherBlock = player.getWorld().getBlockAt(x,y-2,z); //Block under obsidian
|
||||||
|
Block MiddleBlock = player.getWorld().getBlockAt(x,y-3,z); //Block under higher block
|
||||||
|
Block BottomBlock = player.getWorld().getBlockAt(x,y-4,z); //Block under middle block
|
||||||
|
|
||||||
|
if(HigherBlock.getType() == Material.STONE){
|
||||||
|
FlairColourAPI.recolourPlayer(essentials.getUser(player), DyeColor.GRAY);
|
||||||
|
component.playersToBeFlaired.remove(player.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DyeColor woolColour = DyeColor.PINK; //Illegal value
|
||||||
|
if(HigherBlock.getType() == Material.WOOL){
|
||||||
|
woolColour = ((Wool) HigherBlock.getState().getData()).getColor();
|
||||||
|
}else if(MiddleBlock.getType() == Material.WOOL){
|
||||||
|
woolColour = ((Wool) MiddleBlock.getState().getData()).getColor();
|
||||||
|
}else if (BottomBlock.getType() == Material.WOOL){
|
||||||
|
woolColour = ((Wool) BottomBlock.getState().getData()).getColor();
|
||||||
|
}else{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (essentials.getUser(player) == null){
|
||||||
|
player.sendMessage("Error! essentials.getUser() returns null!");
|
||||||
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
if (woolColour == null){
|
||||||
|
player.sendMessage("Error! Wool colour returns null!");
|
||||||
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
|
||||||
|
FlairColourAPI.recolourPlayer(essentials.getUser(player), woolColour);
|
||||||
|
component.playersToBeFlaired.remove(player.getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package buttondevteam.alipresents.components.flaircolour.portals;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
|
||||||
|
public class SetProximityLocation extends ModCommand{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
if (args.length < 1){
|
||||||
|
player.sendMessage("You must enter an argument");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String firstChar = args[0].substring(0, 1);
|
||||||
|
|
||||||
|
switch(firstChar){
|
||||||
|
case "s":
|
||||||
|
case "0":
|
||||||
|
PlayerProximityLoop.setStartLocation(player.getLocation());
|
||||||
|
return true;
|
||||||
|
case "e":
|
||||||
|
case "1":
|
||||||
|
PlayerProximityLoop.setEndLocation(player.getLocation());
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
player.sendMessage("You must provide a vaild argument!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[] {
|
||||||
|
"Usage: /"+this.GetCommandPath()+" <start/end/0/1>",
|
||||||
|
"Use this command to set a proximity space: all players",
|
||||||
|
"within this space will become flair-able, and portals will",
|
||||||
|
"change their colour state."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "flaircolour setproximitylocation";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package buttondevteam.alipresents.components.gpower;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.Component;
|
||||||
|
import buttondevteam.alipresents.components.gpower.commands.Test;
|
||||||
|
import buttondevteam.alipresents.components.gpower.enchant.EnchantingLoop;
|
||||||
|
import buttondevteam.alipresents.components.gpower.powerstate.PowerDown;
|
||||||
|
import buttondevteam.alipresents.components.gpower.powerstate.PowerUp;
|
||||||
|
|
||||||
|
public class GPowerComponent extends Component {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
registerCommand(plugin, new Test());
|
||||||
|
registerCommand(plugin, new PowerUp());
|
||||||
|
registerCommand(plugin, new PowerDown());
|
||||||
|
|
||||||
|
registerListener(plugin, new EnchantingLoop(plugin));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package buttondevteam.alipresents.components.gpower;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class PoweredPlayer{
|
||||||
|
public UUID uuid;
|
||||||
|
public String colour;
|
||||||
|
public Boolean isPowersActive;
|
||||||
|
|
||||||
|
public PoweredPlayer(UUID uuid, String colour, Boolean activated){
|
||||||
|
this.uuid = (uuid);
|
||||||
|
this.colour = (colour);
|
||||||
|
this.isPowersActive = (activated);
|
||||||
|
}
|
||||||
|
public String toString(){
|
||||||
|
return "[UUID: "+ uuid.toString() + ", Colour: "+ colour+", IsActivated: "+isPowersActive + "]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package buttondevteam.alipresents.components.gpower.api;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.components.gpower.PoweredPlayer;
|
||||||
|
|
||||||
|
public class GPowerAPI{
|
||||||
|
public static final int defaultPowerLength = 300;
|
||||||
|
public static Map<UUID, PoweredPlayer> poweredPlayerList = new HashMap<UUID, PoweredPlayer>();
|
||||||
|
|
||||||
|
public static void addPlayer(Player player, String colour, boolean powerIsActive){
|
||||||
|
poweredPlayerList.put(player.getUniqueId(), new PoweredPlayer(player.getUniqueId(), colour, true));
|
||||||
|
}
|
||||||
|
public static void PowerUpPlayer(Player player){
|
||||||
|
player.sendMessage("Powering up!");
|
||||||
|
if(poweredPlayerList.containsKey(player.getUniqueId())){
|
||||||
|
poweredPlayerList.get(player.getUniqueId()).isPowersActive = true;
|
||||||
|
player.sendMessage("Powered up!");
|
||||||
|
}else{
|
||||||
|
player.sendMessage("You must instantiate your power settings using /GPower");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void PowerUpAllPlayers(){
|
||||||
|
for (PoweredPlayer poweredPlayer : GPowerAPI.poweredPlayerList.values()){
|
||||||
|
poweredPlayer.isPowersActive = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PowerDownPlayer(Player player){
|
||||||
|
player.sendMessage("Powering down!");
|
||||||
|
if (poweredPlayerList.containsKey(player.getUniqueId())){
|
||||||
|
player.sendMessage("Powered down!");
|
||||||
|
poweredPlayerList.get(player.getUniqueId()).isPowersActive = false;
|
||||||
|
}else{
|
||||||
|
player.sendMessage("P down!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void activatePower(Player player){
|
||||||
|
activatePower(player, poweredPlayerList.get(player.getUniqueId()).colour, defaultPowerLength);
|
||||||
|
}
|
||||||
|
public static void activatePower(Player player, String colour){
|
||||||
|
activatePower(player, colour, defaultPowerLength);
|
||||||
|
}
|
||||||
|
public static void activatePower(Player player, String colour, int powerLength) {
|
||||||
|
//GREY
|
||||||
|
for (PotionEffect potionEffect : player.getActivePotionEffects()){
|
||||||
|
player.removePotionEffect(potionEffect.getType());
|
||||||
|
}
|
||||||
|
if ((colour.startsWith("grey") || colour.startsWith("gra")) && (player.getWorld().getTime() > 12575 && player.getWorld().getTime() < 22925)){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, powerLength, 0, true, false, Color.GRAY), true);
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, powerLength+100, 0, true, false, Color.GRAY), true);
|
||||||
|
//RED
|
||||||
|
}else if (colour.startsWith("r")){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, powerLength, 0, true, false, Color.RED), true);
|
||||||
|
//ORANGE
|
||||||
|
}else if (colour.startsWith("o")){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, powerLength, 0, true, false, Color.ORANGE), true);
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, powerLength, 0, true, false, Color.ORANGE), true);
|
||||||
|
//YELLOW
|
||||||
|
}else if (colour.startsWith("y") && player.getLocation().getBlock().getLightFromSky() == 15 && player.getLocation().getBlock().getLightFromBlocks() == 15){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, powerLength, 0, true, false, Color.YELLOW), true);
|
||||||
|
//GREEN
|
||||||
|
}else if (colour.startsWith("g") && !colour.startsWith("gra") && !colour.startsWith("grey")){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.LUCK, powerLength, 1, true, false, Color.GREEN), true);
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, powerLength, 0, true, false, Color.GREEN), true);
|
||||||
|
//BLUE
|
||||||
|
}else if (colour.startsWith("b")){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, powerLength, 1, true, false, Color.BLUE), true);
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, powerLength, 0, true, false, Color.BLUE), true);
|
||||||
|
//PURPLE
|
||||||
|
}else if (colour.startsWith("p")){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, powerLength, 0, true, false, Color.PURPLE), true);
|
||||||
|
//NULL
|
||||||
|
}else{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static boolean playerHasActivePowers(Player player){
|
||||||
|
return poweredPlayerList.containsKey(player.getUniqueId()) && poweredPlayerList.get(player.getUniqueId()).isPowersActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package buttondevteam.alipresents.components.gpower.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.gpower.api.GPowerAPI;
|
||||||
|
|
||||||
|
public class Test extends ModCommand{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
if (args.length < 2) {
|
||||||
|
player.sendMessage("Proper Usage to test G-Powers:");
|
||||||
|
player.sendMessage("/gpowertest [colour=red,orange,yellow,green,blue,purple] [active=true/false]");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String colour;
|
||||||
|
if (args[0].startsWith("r") || args[0].startsWith("o") || args[0].startsWith("y") || args[0].startsWith("g")
|
||||||
|
|| args[0].startsWith("b") || args[0].startsWith("p")) {
|
||||||
|
colour = args[0];
|
||||||
|
} else {
|
||||||
|
player.sendMessage("error: colour. Proper Usage to configure G-Powers:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean isActive;
|
||||||
|
if (args[1].startsWith("t")) {
|
||||||
|
isActive = true;
|
||||||
|
} else if (args[1].startsWith("f")) {
|
||||||
|
isActive = false;
|
||||||
|
} else {
|
||||||
|
player.sendMessage("error: active. Proper Usage to configure G-Powers:");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
player.sendMessage("Terms Vaild!");
|
||||||
|
player.sendMessage("Saving Data: "+ player.getName() + "|" + colour + "|" + isActive);
|
||||||
|
GPowerAPI.addPlayer(player, colour, isActive);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "gpower test";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: /"+this.GetCommandPath()+" [colour=red,orange,yellow,green,blue,purple,grey] [active=true/false]"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package buttondevteam.alipresents.components.gpower.enchant;
|
||||||
|
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.components.gpower.api.GPowerAPI;
|
||||||
|
|
||||||
|
public class EnchantingLoop extends BukkitRunnable implements Listener{
|
||||||
|
private Server server;
|
||||||
|
|
||||||
|
|
||||||
|
public EnchantingLoop(JavaPlugin plugin){
|
||||||
|
this.server = plugin.getServer();
|
||||||
|
this.runTaskTimer(plugin, 0, 190);
|
||||||
|
}
|
||||||
|
|
||||||
|
//REPEATS EVERY 5 SECONDS
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (Player player : server.getOnlinePlayers()){
|
||||||
|
if(GPowerAPI.playerHasActivePowers(player)){
|
||||||
|
GPowerAPI.activatePower(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package buttondevteam.alipresents.components.gpower.powerstate;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.gpower.api.GPowerAPI;
|
||||||
|
|
||||||
|
public class PowerAll extends ModCommand{
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
GPowerAPI.PowerUpAllPlayers();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: Type /PowerAll to activate all powers for all players with gpowers"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "gpower powerall";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package buttondevteam.alipresents.components.gpower.powerstate;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.PlayerCommand;
|
||||||
|
import buttondevteam.alipresents.components.gpower.api.GPowerAPI;
|
||||||
|
|
||||||
|
public class PowerDown extends PlayerCommand {
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String label, String[] args) {
|
||||||
|
GPowerAPI.PowerDownPlayer(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: Type /"+this.GetCommandPath()+" to disable your g-power"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "gpower powerdown";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package buttondevteam.alipresents.components.gpower.powerstate;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.PlayerCommand;
|
||||||
|
import buttondevteam.alipresents.components.gpower.api.GPowerAPI;
|
||||||
|
|
||||||
|
public class PowerUp extends PlayerCommand {
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String label, String[] args) {
|
||||||
|
GPowerAPI.PowerUpPlayer(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: Type /"+this.GetCommandPath()+" to activate your registered G-Power"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "gpower powerup";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package buttondevteam.alipresents.components.hotfix;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Essentials;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.Component;
|
||||||
|
import buttondevteam.alipresents.components.hotfix.hotfixes.CowSpawnLoop;
|
||||||
|
import buttondevteam.alipresents.components.hotfix.hotfixes.CreativeKillLoop;
|
||||||
|
import buttondevteam.alipresents.components.hotfix.hotfixes.GrassBreakListener;
|
||||||
|
import buttondevteam.alipresents.components.hotfix.hotfixes.MobKillListener;
|
||||||
|
import buttondevteam.alipresents.components.hotfix.hotfixes.NetherDisableListener;
|
||||||
|
|
||||||
|
public class HotfixComponent extends Component {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
registerListener(plugin, new NetherDisableListener());
|
||||||
|
registerListener(plugin, new CowSpawnLoop(plugin));
|
||||||
|
registerListener(plugin, new MobKillListener((Essentials) Bukkit.getPluginManager().getPlugin("Essentials")));
|
||||||
|
registerListener(plugin, new GrassBreakListener());
|
||||||
|
registerListener(plugin, new CreativeKillLoop(plugin));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package buttondevteam.alipresents.components.hotfix.hotfixes;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Cow;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class CowSpawnLoop extends BukkitRunnable implements Listener{
|
||||||
|
|
||||||
|
private JavaPlugin plugin;
|
||||||
|
|
||||||
|
public CowSpawnLoop(JavaPlugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.runTaskTimer(plugin, 30200, 30200);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
boolean foodTrue;
|
||||||
|
for (Player player : plugin.getServer().getOnlinePlayers()){
|
||||||
|
foodTrue = false;
|
||||||
|
for (Entity entity : player.getNearbyEntities(128, 128, 128)){
|
||||||
|
if (entity instanceof Cow){
|
||||||
|
foodTrue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (foodTrue){
|
||||||
|
Location location = player.getLocation().add(new Vector(Math.random()*20, 0, Math.random()*20).normalize().multiply(30));
|
||||||
|
Block attemptedCowSpawn = player.getWorld().getHighestBlockAt(location);
|
||||||
|
if (attemptedCowSpawn.getType().equals(Material.GRASS)){
|
||||||
|
player.getWorld().spawnEntity(attemptedCowSpawn.getLocation().add(new Vector (0,1,0)), EntityType.COW);
|
||||||
|
player.getWorld().spawnEntity(attemptedCowSpawn.getLocation().add(new Vector (0,1,0)), EntityType.COW);
|
||||||
|
player.getWorld().spawnEntity(attemptedCowSpawn.getLocation().add(new Vector (0,1,0)), EntityType.COW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package buttondevteam.alipresents.components.hotfix.hotfixes;
|
||||||
|
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class CreativeKillLoop extends BukkitRunnable implements Listener {
|
||||||
|
private JavaPlugin plugin;
|
||||||
|
|
||||||
|
public CreativeKillLoop(JavaPlugin plugin){
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.runTaskTimer(plugin, 40, 40);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Location location;
|
||||||
|
for (Player player : plugin.getServer().getOnlinePlayers()){
|
||||||
|
if (player.getGameMode() == GameMode.SURVIVAL) continue;
|
||||||
|
if (!player.getWorld().getName().equalsIgnoreCase("world")) continue;
|
||||||
|
if (player.isOp()) continue;
|
||||||
|
|
||||||
|
player.sendMessage("[Hotfix] Every Gamemode other than survival is disabled in the new world");
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
|
||||||
|
location = player.getLocation();
|
||||||
|
if (location.getBlockX() < 250 && location.getBlockX() > -250) continue;
|
||||||
|
if (location.getBlockZ() < 250 && location.getBlockZ() > -250) continue;
|
||||||
|
|
||||||
|
player.sendMessage("[Hotfix] Unless you are in Spawn Island!");
|
||||||
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package buttondevteam.alipresents.components.hotfix.hotfixes;
|
||||||
|
|
||||||
|
import org.bukkit.FireworkEffect;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.FireworkMeta;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
public class ElytraFireworks implements Listener {
|
||||||
|
JavaPlugin plugin;
|
||||||
|
public ElytraFireworks(JavaPlugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
public void onRightClick(PlayerInteractEvent event){
|
||||||
|
//ACTION SANITATION
|
||||||
|
if(!(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
|
||||||
|
if(!(event.getPlayer().isGliding())) return;
|
||||||
|
if(!(event.getMaterial() == Material.FIREWORK)) return;
|
||||||
|
|
||||||
|
//BOW SANITATION
|
||||||
|
ItemStack firework = event.getItem();
|
||||||
|
FireworkMeta fireworkMeta= (FireworkMeta) firework.getItemMeta();
|
||||||
|
for (FireworkEffect effect : fireworkMeta.getEffects()){
|
||||||
|
event.getPlayer().sendMessage(effect.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//PLAYER SANITATION
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if(player.getGameMode().equals(GameMode.SPECTATOR))return;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,179 @@
|
||||||
|
package buttondevteam.alipresents.components.hotfix.hotfixes;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class GrassBreakListener implements Listener {
|
||||||
|
/*public enum fruit {
|
||||||
|
Material.POTATO_ITEM,
|
||||||
|
Material.MELON_SEEDS,
|
||||||
|
Material.PUMPKIN_SEEDS,
|
||||||
|
Material.COCOA,
|
||||||
|
Material.BEETROOT_SEEDS,
|
||||||
|
Material.NETHER_WARTS,
|
||||||
|
Material.SEEDS
|
||||||
|
};*/
|
||||||
|
@EventHandler
|
||||||
|
public void onGrassBreak(BlockBreakEvent event){
|
||||||
|
|
||||||
|
|
||||||
|
if (event.getBlock().getType().equals(Material.LONG_GRASS)){
|
||||||
|
|
||||||
|
Location location = event.getBlock().getLocation();
|
||||||
|
World world = event.getBlock().getWorld();
|
||||||
|
/*
|
||||||
|
switch(world.getBiome(location.getBlockX(), location.getBlockZ())){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//JUNGLES
|
||||||
|
case JUNGLE:
|
||||||
|
case JUNGLE_EDGE:
|
||||||
|
case JUNGLE_HILLS:
|
||||||
|
case MUTATED_JUNGLE:
|
||||||
|
case MUTATED_JUNGLE_EDGE:
|
||||||
|
world.dropItem(location, new ItemStack(Material.COCOA));
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
//ROOFED FOREST
|
||||||
|
case ROOFED_FOREST:
|
||||||
|
case MUTATED_ROOFED_FOREST:
|
||||||
|
world.dropItem(location, new ItemStack(Material.CARROT_ITEM));
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
//GENERAL FOREST
|
||||||
|
case FOREST:
|
||||||
|
case FOREST_HILLS:
|
||||||
|
case MUTATED_FOREST:
|
||||||
|
case BIRCH_FOREST:
|
||||||
|
case BIRCH_FOREST_HILLS:
|
||||||
|
case MUTATED_BIRCH_FOREST:
|
||||||
|
case MUTATED_BIRCH_FOREST_HILLS:
|
||||||
|
world.dropItem(location, new ItemStack(Material.SEEDS));
|
||||||
|
break;
|
||||||
|
case PLAINS:
|
||||||
|
case MUTATED_PLAINS:
|
||||||
|
world.dropItem(location, new ItemStack(Material.SEEDS));
|
||||||
|
//DROP GRASS
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
//SWAMPS
|
||||||
|
case SWAMPLAND:
|
||||||
|
case MUTATED_SWAMPLAND:
|
||||||
|
world.dropItem(location, new ItemStack(Material.POTATO));
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
//DESERT, DRY SHIT
|
||||||
|
case DESERT:
|
||||||
|
case DESERT_HILLS:
|
||||||
|
case MUTATED_DESERT:
|
||||||
|
case MESA:
|
||||||
|
case MESA_CLEAR_ROCK:
|
||||||
|
case MESA_ROCK:
|
||||||
|
case MUTATED_MESA:
|
||||||
|
case MUTATED_MESA_CLEAR_ROCK:
|
||||||
|
case MUTATED_MESA_ROCK:
|
||||||
|
case SAVANNA:
|
||||||
|
case SAVANNA_ROCK:
|
||||||
|
case MUTATED_SAVANNA:
|
||||||
|
case MUTATED_SAVANNA_ROCK:
|
||||||
|
world.dropItem(location, new ItemStack(Material.DEAD_BUSH));
|
||||||
|
//DROP... dead shrub
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
//Mountain Shit
|
||||||
|
case EXTREME_HILLS:
|
||||||
|
case EXTREME_HILLS_WITH_TREES:
|
||||||
|
case MUTATED_EXTREME_HILLS:
|
||||||
|
case MUTATED_EXTREME_HILLS_WITH_TREES:
|
||||||
|
case SMALLER_EXTREME_HILLS:
|
||||||
|
case STONE_BEACH:
|
||||||
|
//What the fuck grows in mountains? Rocks?
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
//COLLLLLLLD FUCKERS
|
||||||
|
case TAIGA:
|
||||||
|
case TAIGA_COLD:
|
||||||
|
case TAIGA_COLD_HILLS:
|
||||||
|
case TAIGA_HILLS:
|
||||||
|
case COLD_BEACH:
|
||||||
|
case ICE_FLATS:
|
||||||
|
case ICE_MOUNTAINS:
|
||||||
|
case MUTATED_ICE_FLATS:
|
||||||
|
case FROZEN_OCEAN:
|
||||||
|
case FROZEN_RIVER:
|
||||||
|
case MUTATED_TAIGA:
|
||||||
|
case MUTATED_TAIGA_COLD:
|
||||||
|
case REDWOOD_TAIGA:
|
||||||
|
case REDWOOD_TAIGA_HILLS:
|
||||||
|
case MUTATED_REDWOOD_TAIGA:
|
||||||
|
case MUTATED_REDWOOD_TAIGA_HILLS:
|
||||||
|
world.dropItem(location, new ItemStack(Material.DIRT));
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
//OCEAN
|
||||||
|
case DEEP_OCEAN:
|
||||||
|
case OCEAN:
|
||||||
|
//DROP... why the fuck is there grass in deep ocean?
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
//BEACHES
|
||||||
|
case BEACHES:
|
||||||
|
case RIVER:
|
||||||
|
//DROP A SEASHELL
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
//MUSHROOM ISLANDS
|
||||||
|
case MUSHROOM_ISLAND:
|
||||||
|
case MUSHROOM_ISLAND_SHORE:
|
||||||
|
world.dropItem(location, new ItemStack(Material.BROWN_MUSHROOM));
|
||||||
|
break;
|
||||||
|
|
||||||
|
//WEIRD SHIT
|
||||||
|
case HELL:
|
||||||
|
case SKY:
|
||||||
|
case VOID:
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
switch((int) (Math.random()* 50)){
|
||||||
|
case 1:
|
||||||
|
world.dropItem(location, new ItemStack(Material.CARROT_ITEM));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
world.dropItem(location, new ItemStack(Material.BEETROOT_SEEDS));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
world.dropItem(location, new ItemStack(Material.POTATO_ITEM));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
world.dropItem(location, new ItemStack(Material.FEATHER));
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
world.dropItem(location, new ItemStack(Material.YELLOW_FLOWER));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package buttondevteam.alipresents.components.hotfix.hotfixes;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Essentials;
|
||||||
|
import com.earth2me.essentials.User;
|
||||||
|
|
||||||
|
import net.ess3.api.MaxMoneyException;
|
||||||
|
|
||||||
|
public class MobKillListener implements Listener {
|
||||||
|
private Essentials essentials;
|
||||||
|
|
||||||
|
public MobKillListener(Essentials essentials) {
|
||||||
|
this.essentials = essentials;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onMobKill(EntityDeathEvent event){
|
||||||
|
Player killer;
|
||||||
|
if ((killer = event.getEntity().getKiller()) == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
User user = essentials.getUser(killer);
|
||||||
|
switch(event.getEntity().getType()){
|
||||||
|
case ZOMBIE:
|
||||||
|
try {
|
||||||
|
user.giveMoney(BigDecimal.ONE);
|
||||||
|
} catch (MaxMoneyException e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package buttondevteam.alipresents.components.hotfix.hotfixes;
|
||||||
|
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerPortalEvent;
|
||||||
|
|
||||||
|
public class NetherDisableListener implements Listener{
|
||||||
|
@EventHandler
|
||||||
|
public void onPortalEnter(PlayerPortalEvent event){
|
||||||
|
event.getPlayer().sendMessage("[HOTFIX] This portal is disabled!");
|
||||||
|
event.getPlayer().sendMessage("[HOTFIX] Going to the Nether is disabled on the server");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
package buttondevteam.alipresents.components.insurance;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import buttondevteam.lib.DebugPotato;
|
||||||
|
|
||||||
|
public abstract class Insurance {
|
||||||
|
public static enum InsuranceType{
|
||||||
|
nugget, ingot, block
|
||||||
|
};
|
||||||
|
public static ItemStack getInsurance(InsuranceType insuranceType){
|
||||||
|
ItemStack insuranceItem;
|
||||||
|
List<String> lore;
|
||||||
|
switch(insuranceType){
|
||||||
|
case nugget:
|
||||||
|
insuranceItem = new ItemStack(Material.GOLD_NUGGET);
|
||||||
|
lore = Arrays.asList(
|
||||||
|
"This insurance nugget will protect ",
|
||||||
|
"one inventory slot from death! Be careful",
|
||||||
|
"though, insurance is removed whenever ",
|
||||||
|
"you die, with each itemslot costing",
|
||||||
|
"one nugget."
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case ingot:
|
||||||
|
insuranceItem = new ItemStack(Material.GOLD_INGOT);
|
||||||
|
lore = Arrays.asList(
|
||||||
|
"This insurance ingot will protect ",
|
||||||
|
"nine inventory slots from death! Be ",
|
||||||
|
"careful though, insurance is removed ",
|
||||||
|
"whenever you die, with each inventory ",
|
||||||
|
"row costing one ingot."
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case block:
|
||||||
|
insuranceItem = new ItemStack(Material.GOLD_BLOCK);
|
||||||
|
lore = Arrays.asList(
|
||||||
|
"This insurance block will give your ",
|
||||||
|
"inventory full protection against death! ",
|
||||||
|
"Be careful though, this block will split ",
|
||||||
|
"into ingots, and you'll lose 3 upon ",
|
||||||
|
"death."
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
|
||||||
|
lore = Arrays.asList(
|
||||||
|
"The InsuranceType " + insuranceType.toString() + " ",
|
||||||
|
"is not handled by the Insurance Class in: ",
|
||||||
|
Insurance.class.getPackage().getName() + ".",
|
||||||
|
"Contact a developer with a screenshot of this message"
|
||||||
|
);
|
||||||
|
DebugPotato potato = new DebugPotato();
|
||||||
|
potato.setMessage(lore);
|
||||||
|
insuranceItem = potato.toItemStack();
|
||||||
|
}
|
||||||
|
insuranceItem.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
||||||
|
ItemMeta meta = insuranceItem.getItemMeta();
|
||||||
|
meta.setLore(lore);
|
||||||
|
meta.setDisplayName("Insurance " + insuranceType.toString());
|
||||||
|
insuranceItem.setItemMeta(meta);
|
||||||
|
return insuranceItem;
|
||||||
|
}
|
||||||
|
public static ItemStack getInsurance(InsuranceType insuranceType, int amount){
|
||||||
|
ItemStack insurance = Insurance.getInsurance(insuranceType);
|
||||||
|
insurance.setAmount(amount);
|
||||||
|
return insurance;
|
||||||
|
}
|
||||||
|
public static boolean isInsuranceType(String string){
|
||||||
|
for (InsuranceType insuranceType : Insurance.InsuranceType.values()){
|
||||||
|
if (string.equals(insuranceType.toString())){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package buttondevteam.alipresents.components.insurance;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.Component;
|
||||||
|
|
||||||
|
public class InsuranceComponent extends Component {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
registerCommand(plugin, new getInsurance());
|
||||||
|
registerCommand(plugin, new getInsuranceNugget());
|
||||||
|
registerCommand(plugin, new getInsuranceIngot());
|
||||||
|
registerCommand(plugin, new getInsuranceBlock());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package buttondevteam.alipresents.components.insurance;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.insurance.Insurance.InsuranceType;
|
||||||
|
|
||||||
|
public class getInsurance extends ModCommand {
|
||||||
|
private final int defaultAmount = 1;
|
||||||
|
private final InsuranceType defaultInsuranceType = InsuranceType.block;
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
int amount = defaultAmount;
|
||||||
|
InsuranceType insuranceType = defaultInsuranceType;
|
||||||
|
|
||||||
|
switch(args.length){
|
||||||
|
case 0: // no arguments
|
||||||
|
break;
|
||||||
|
case 1: // <amount> or <type> argument
|
||||||
|
if (StringUtils.isNumeric(args[0])){
|
||||||
|
amount = Integer.parseInt(args[0]);
|
||||||
|
break;
|
||||||
|
}else if (Insurance.isInsuranceType(args[0])){
|
||||||
|
insuranceType = InsuranceType.valueOf(args[0]);
|
||||||
|
break;
|
||||||
|
}else{
|
||||||
|
player.sendMessage("Invalid Argument " + args[0]);
|
||||||
|
player.sendMessage("Enter a type of insurance or a number as an argument");
|
||||||
|
player.sendMessage(Insurance.InsuranceType.values().toString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// <amount> <type> argument
|
||||||
|
if (StringUtils.isNumeric(args[0]) && Insurance.isInsuranceType(args[1])){
|
||||||
|
amount = Integer.parseInt(args[0]);
|
||||||
|
insuranceType = InsuranceType.valueOf(args[1]);
|
||||||
|
break;
|
||||||
|
}else if (StringUtils.isNumeric(args[1]) && Insurance.isInsuranceType(args[0])){
|
||||||
|
amount = Integer.parseInt(args[1]);
|
||||||
|
insuranceType = InsuranceType.valueOf(args[0]);
|
||||||
|
break;
|
||||||
|
}else{
|
||||||
|
player.sendMessage("Invalid Argument " + args[0] + "|" + args[1]);
|
||||||
|
player.sendMessage("Usage /" + this.GetCommandPath()
|
||||||
|
+ " <amount>"
|
||||||
|
+ " <" + Insurance.InsuranceType.values().toString() + ">");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player.getInventory().addItem(Insurance.getInsurance(insuranceType, amount));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: /"+this.GetCommandPath()+" [amount] [type:nugget/bar/block/compound]",
|
||||||
|
"Use this command to get gold-standard inventory insurance, that saves ",
|
||||||
|
"items in an inventory upon death. One nugget saves one ItemStack, a bar",
|
||||||
|
"saves nine, a block saves 54. Compound converts amount (in nuggets) to a",
|
||||||
|
"mix of both nuggets, bars and blocks"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "insurance get";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package buttondevteam.alipresents.components.insurance;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.insurance.Insurance.InsuranceType;
|
||||||
|
|
||||||
|
public class getInsuranceBlock extends ModCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
if (args.length > 0 && StringUtils.isNumeric(args[0])){
|
||||||
|
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.block, Integer.parseInt(args[0])));
|
||||||
|
}else{
|
||||||
|
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.block));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "insurance getblock";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: /"+this.GetCommandPath()+" [amount]",
|
||||||
|
"This command returns an insurance block, which on death,",
|
||||||
|
"splits into 9 insurance ingot which each saves 1 row of",
|
||||||
|
"inventory per ingot"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package buttondevteam.alipresents.components.insurance;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.insurance.Insurance.InsuranceType;
|
||||||
|
|
||||||
|
public class getInsuranceIngot extends ModCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
if (args.length > 0 && StringUtils.isNumeric(args[0])){
|
||||||
|
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.ingot, Integer.parseInt(args[0])));
|
||||||
|
}else{
|
||||||
|
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.ingot));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "insurance getingot";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: /"+this.GetCommandPath()+" [amount]",
|
||||||
|
"This command returns an insurance ingot, which on death,",
|
||||||
|
"saves one row of inventory"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package buttondevteam.alipresents.components.insurance;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.insurance.Insurance.InsuranceType;
|
||||||
|
|
||||||
|
public class getInsuranceNugget extends ModCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
if (args.length > 0 && StringUtils.isNumeric(args[0])){
|
||||||
|
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.nugget, Integer.parseInt(args[0])));
|
||||||
|
}else{
|
||||||
|
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.nugget));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "insurance getnugget";
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: /"+this.GetCommandPath()+" [amount]",
|
||||||
|
"This command returns an insurance nugget, which on death,",
|
||||||
|
"saves one itemslot in the inventory"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package buttondevteam.alipresents.components.magic;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.Component;
|
||||||
|
import buttondevteam.alipresents.components.magic.tricks.AliArrowListener;
|
||||||
|
import buttondevteam.alipresents.components.magic.tricks.BoomBowDeathListener;
|
||||||
|
import buttondevteam.alipresents.components.magic.tricks.BoomBowListener;
|
||||||
|
import buttondevteam.alipresents.components.magic.tricks.CannonBowListener;
|
||||||
|
import buttondevteam.alipresents.components.magic.tricks.CannonBowSettings;
|
||||||
|
|
||||||
|
public class MagicComponent extends Component{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
registerCommand(plugin, new CannonBowSettings());
|
||||||
|
|
||||||
|
registerListener(plugin, new AliArrowListener(plugin));
|
||||||
|
registerListener(plugin, new BoomBowDeathListener());
|
||||||
|
registerListener(plugin, new BoomBowListener(plugin));
|
||||||
|
registerListener(plugin, new CannonBowListener(plugin));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package buttondevteam.alipresents.components.magic.tricks;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
public class AliArrowListener implements Listener {
|
||||||
|
private final JavaPlugin plugin;
|
||||||
|
|
||||||
|
public AliArrowListener(JavaPlugin plugin){
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onProjectileLaunch(ProjectileLaunchEvent event){
|
||||||
|
if(event.getEntity().getType() != EntityType.ARROW){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Arrow arrow = (Arrow) event.getEntity();
|
||||||
|
if (!(arrow.isCritical()) || !(arrow.getShooter() instanceof Player)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player player = (Player) arrow.getShooter();
|
||||||
|
String username = player.getName();
|
||||||
|
|
||||||
|
for (String permittedUsername : AliArrowTask.permittedUsers){
|
||||||
|
if(permittedUsername.equalsIgnoreCase(username)){
|
||||||
|
new AliArrowTask(arrow,username).runTaskTimer(plugin, 2, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package buttondevteam.alipresents.components.magic.tricks;
|
||||||
|
|
||||||
|
import org.bukkit.Particle;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class AliArrowTask extends BukkitRunnable {
|
||||||
|
static String[] permittedUsers = {"alisolarflare", "Zanthr", "NorbiPeti"};
|
||||||
|
String name;
|
||||||
|
Arrow arrow;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
public AliArrowTask(Arrow arrow, String name) {
|
||||||
|
this.name = name;
|
||||||
|
this.arrow = arrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
count++;
|
||||||
|
if (count > 400 ||arrow.isOnGround() || arrow.isDead()) {
|
||||||
|
this.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(name.toLowerCase()){
|
||||||
|
case "alisolarflare":
|
||||||
|
arrow.getWorld().spawnParticle(Particle.VILLAGER_HAPPY, arrow.getLocation(), 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "zanthr":
|
||||||
|
arrow.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, arrow.getLocation(), 1);
|
||||||
|
arrow.getWorld().spawnParticle(Particle.FLAME, arrow.getLocation(), 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "norbipeti":
|
||||||
|
arrow.getWorld().spawnParticle(Particle.LAVA, arrow.getLocation(), 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "mayskam1995":
|
||||||
|
arrow.getWorld().spawnParticle(Particle.DRIP_WATER, arrow.getLocation(), 2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package buttondevteam.alipresents.components.magic.tricks;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
|
||||||
|
public class BoomBowDeathListener implements Listener{
|
||||||
|
@EventHandler
|
||||||
|
public void onBoomBowDeath(PlayerDeathEvent event){
|
||||||
|
Player player = event.getEntity();
|
||||||
|
if (player.getLastDamage() > 7.42420 && player.getLastDamage() < 7.42429){
|
||||||
|
event.setDeathMessage(player.getName() + " got trigger happy with the [Boom Bow]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
package buttondevteam.alipresents.components.magic.tricks;
|
||||||
|
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Particle;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
public class BoomBowListener implements Listener {
|
||||||
|
JavaPlugin plugin;
|
||||||
|
public BoomBowListener(JavaPlugin plugin){
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void ClickEvent(PlayerInteractEvent event){
|
||||||
|
FlyBowBoost(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
public void FlyBowBoost(PlayerInteractEvent event){
|
||||||
|
|
||||||
|
//ACTION SANITATION
|
||||||
|
if(!(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)) return;
|
||||||
|
if(!(event.getPlayer().isGliding())) return;
|
||||||
|
if(!(event.getMaterial() == Material.BOW)) return;
|
||||||
|
|
||||||
|
//BOW SANITATION
|
||||||
|
ItemStack bow = event.getItem();
|
||||||
|
if(!(bow.containsEnchantment(Enchantment.ARROW_KNOCKBACK))) return;
|
||||||
|
if(!(bow.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK) == 3)) return;
|
||||||
|
if(!(bow.getItemMeta().getDisplayName().contains("BOOM BOW"))) return;
|
||||||
|
|
||||||
|
//PLAYER SANITATION
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
PlayerInventory inventory = player.getInventory();
|
||||||
|
if(player.getGameMode().equals(GameMode.SPECTATOR))return;
|
||||||
|
|
||||||
|
if(bow.containsEnchantment(Enchantment.ARROW_INFINITE)){
|
||||||
|
//HAS INIFINITY
|
||||||
|
Activate(event);
|
||||||
|
|
||||||
|
}else if((inventory.contains(Material.TNT))){
|
||||||
|
//HAS TNT
|
||||||
|
Activate(event);
|
||||||
|
|
||||||
|
//Reduce TNT
|
||||||
|
ItemStack tnt = inventory.getItem(inventory.first(Material.TNT));
|
||||||
|
|
||||||
|
if(tnt.getAmount() > 3){
|
||||||
|
tnt.setAmount(tnt.getAmount()-3);
|
||||||
|
}else{
|
||||||
|
inventory.remove(tnt);
|
||||||
|
}
|
||||||
|
if (bow.getDurability() < 0){
|
||||||
|
inventory.clear(inventory.getHeldItemSlot());
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void Activate(PlayerInteractEvent event){
|
||||||
|
//INIT - Player variables
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
Location playerLocation = player.getLocation();
|
||||||
|
ItemStack boomBow = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
|
//TODO: NERF - boomDecay
|
||||||
|
//TODO: NERF - endCrystal
|
||||||
|
//TODO: NERF - healthReduction
|
||||||
|
//TODO: NERF - localized
|
||||||
|
|
||||||
|
if(BoomBowRule.boomDecay)
|
||||||
|
new BoomDecayTask(player).runTaskTimer(plugin, 1, 1);
|
||||||
|
if(BoomBowRule.endCrystal){
|
||||||
|
//BoomBowCyrstalSpawn
|
||||||
|
}
|
||||||
|
if(BoomBowRule.healthReduction){
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 400, -1));
|
||||||
|
}
|
||||||
|
if(BoomBowRule.localized);
|
||||||
|
|
||||||
|
|
||||||
|
//SET - Player Velocity
|
||||||
|
player.setVelocity(playerLocation.getDirection().normalize().multiply(3.0));
|
||||||
|
|
||||||
|
//CREATE - Explosion + damage
|
||||||
|
player.getWorld().playSound(playerLocation, Sound.ENTITY_GENERIC_EXPLODE, 10, -20);
|
||||||
|
player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, playerLocation, 2);
|
||||||
|
player.damage(7.42425, player);
|
||||||
|
boomBow.setDurability((short) (boomBow.getDurability() + 3));
|
||||||
|
if(boomBow.getDurability() > 385){
|
||||||
|
player.getInventory().setItemInMainHand(null);
|
||||||
|
player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package buttondevteam.alipresents.components.magic.tricks;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
//HEHEHHEHEH EAASSSTER EGGS
|
||||||
|
public class BoomBowRule extends ModCommand{
|
||||||
|
public static boolean boomDecay;
|
||||||
|
public static boolean healthReduction;
|
||||||
|
public static boolean endCrystal;
|
||||||
|
public static boolean localized;;
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String label, String[] args) {
|
||||||
|
if (player.getName().equals("alisolarflare") == false){
|
||||||
|
player.sendMessage("You must be alisolarflare to use this command");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (args.length < 2){
|
||||||
|
player.sendMessage("Rules:");
|
||||||
|
player.sendMessage("boomDecay" + boomDecay);
|
||||||
|
player.sendMessage("healthReduction" + healthReduction);
|
||||||
|
player.sendMessage("endCrystal" + endCrystal);
|
||||||
|
player.sendMessage("localized" + localized);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!(args[1].startsWith("t")|| args[1].startsWith("f"))){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean gameRule = false;
|
||||||
|
if(args[1].startsWith("t") || args[1].startsWith("T")){
|
||||||
|
gameRule = true;
|
||||||
|
}
|
||||||
|
switch(args[0]){
|
||||||
|
case "boomDecay":
|
||||||
|
boomDecay = gameRule;
|
||||||
|
break;
|
||||||
|
case "healthReduction":
|
||||||
|
healthReduction = gameRule;
|
||||||
|
break;
|
||||||
|
case "endCrystal":
|
||||||
|
endCrystal = gameRule;
|
||||||
|
break;
|
||||||
|
case "localized":
|
||||||
|
localized = gameRule;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
player.sendMessage("Error: "+args[0]+" not defined as a rule");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias) {
|
||||||
|
return new String[]{
|
||||||
|
"Usage: /boomBowRule [rulename] [true/false]",
|
||||||
|
"Rule settings: boomDecay, healthReduction, endCrystal, localized"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package buttondevteam.alipresents.components.magic.tricks;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
public class BoomDecayTask extends BukkitRunnable{
|
||||||
|
Player player;
|
||||||
|
private int ticksSinceStart = 0;
|
||||||
|
private final int effectLength = 20;
|
||||||
|
public BoomDecayTask(Player player){
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
//runs every tick
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (ticksSinceStart > effectLength){
|
||||||
|
this.cancel();
|
||||||
|
}
|
||||||
|
player.sendMessage(player.getVelocity().toString());
|
||||||
|
|
||||||
|
ticksSinceStart++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,250 @@
|
||||||
|
package buttondevteam.alipresents.components.magic.tricks;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Particle;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class CannonBowListener implements Listener {
|
||||||
|
private static String savePath = "magic.cannonbow";
|
||||||
|
|
||||||
|
private static double maxSpeedMultiplier = 4;
|
||||||
|
private static double minSpeedMultiplier = 0;
|
||||||
|
private static double defaultSpeedMultiplier = 1;
|
||||||
|
private static String speedMultiplierPath = savePath + ".speedmultiplier";
|
||||||
|
|
||||||
|
private static int maxFuseTicks = 400;
|
||||||
|
private static int minFuseTicks = 0;
|
||||||
|
private static int defaultFuseTicks = 30;
|
||||||
|
private static String fuseTicksPath = savePath + ".fuseticks";
|
||||||
|
|
||||||
|
private static double maxMinForce = 1;
|
||||||
|
private static double minMinForce = 0;
|
||||||
|
private static double defaultMinForce = 0.2;
|
||||||
|
private static String minForcePath = savePath + ".minforce";
|
||||||
|
|
||||||
|
private static double maxRecoil = 20;
|
||||||
|
private static double minRecoil = -5;
|
||||||
|
private static double defaultRecoil = 1;
|
||||||
|
private static String recoilPath = savePath + ".recoil";
|
||||||
|
|
||||||
|
private static boolean defaultIsDestructive = false;
|
||||||
|
private static String isDestructivePath = savePath + ".isdestructive";
|
||||||
|
|
||||||
|
private static double speedMultiplier = defaultSpeedMultiplier;
|
||||||
|
private static double minForce = defaultMinForce;
|
||||||
|
private static int fuseTicks = defaultFuseTicks;
|
||||||
|
private static double recoil = defaultRecoil;
|
||||||
|
private static boolean isDestructive = defaultIsDestructive;
|
||||||
|
|
||||||
|
public final static String launchedTNTName = "CANNON BOW TNT:42170";
|
||||||
|
|
||||||
|
static FileConfiguration config;
|
||||||
|
public CannonBowListener(JavaPlugin plugin){
|
||||||
|
config = plugin.getConfig();
|
||||||
|
|
||||||
|
if (config.isDouble(speedMultiplierPath))
|
||||||
|
setSpeedMultiplier(config.getDouble(speedMultiplierPath));
|
||||||
|
|
||||||
|
if (config.isDouble(minForcePath))
|
||||||
|
setMinforce(config.getDouble(minForcePath));
|
||||||
|
|
||||||
|
if (config.isInt(fuseTicksPath))
|
||||||
|
setFuseticks(config.getInt(fuseTicksPath));
|
||||||
|
|
||||||
|
if (config.isDouble(recoilPath))
|
||||||
|
setRecoil(config.getDouble(recoilPath));
|
||||||
|
|
||||||
|
if (config.isBoolean(isDestructivePath))
|
||||||
|
setIsDestructive(config.getBoolean(isDestructivePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onProjectileLaunch(EntityShootBowEvent event){
|
||||||
|
//Entity Sanitation
|
||||||
|
if(event.getProjectile().getType() != EntityType.ARROW)return;
|
||||||
|
|
||||||
|
//Arrow Sanitation
|
||||||
|
Arrow arrow = (Arrow) event.getProjectile();
|
||||||
|
if (!(arrow.getShooter() instanceof Player))return;
|
||||||
|
|
||||||
|
//Player Sanitation
|
||||||
|
Player player = (Player) arrow.getShooter();
|
||||||
|
if (!player.getInventory().contains(Material.TNT))return;
|
||||||
|
|
||||||
|
//Bow Sanitation
|
||||||
|
ItemStack bow;
|
||||||
|
if (!((bow = player.getInventory().getItemInMainHand()).getType() == Material.BOW))return;
|
||||||
|
if (!(bow.containsEnchantment(Enchantment.PROTECTION_EXPLOSIONS)))return;
|
||||||
|
if (!(bow.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS) == 10))return;
|
||||||
|
if (!(bow.getItemMeta().getDisplayName().toUpperCase().contains("CANNON BOW")))return;
|
||||||
|
|
||||||
|
//TNT Spawning
|
||||||
|
Vector playerVector = player.getEyeLocation().getDirection().normalize();
|
||||||
|
Location playerLocation = player.getLocation();
|
||||||
|
if (event.getForce() < getMinforce()){
|
||||||
|
|
||||||
|
//Smoke cloud if draw is too low
|
||||||
|
arrow.getWorld().spawnParticle(Particle.SMOKE_NORMAL, playerLocation, 30);
|
||||||
|
arrow.getWorld().playSound(playerLocation, Sound.BLOCK_LADDER_BREAK, 1.0F, -7);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//Spawn TNT
|
||||||
|
TNTPrimed tnt = (TNTPrimed) arrow.getWorld().spawnEntity(arrow.getLocation(), EntityType.PRIMED_TNT);
|
||||||
|
/*
|
||||||
|
// Change via NMS the source of the TNT by the player
|
||||||
|
EntityLiving nmsPlayer = (EntityLiving) (((CraftLivingEntity) player).getHandle());
|
||||||
|
EntityTNTPrimed nmsTNT = (EntityTNTPrimed) (((CraftTNTPrimed) tnt).getHandle());
|
||||||
|
try {
|
||||||
|
Field sourceField = EntityTNTPrimed.class.getDeclaredField("source");
|
||||||
|
sourceField.setAccessible(true);
|
||||||
|
sourceField.set(nmsTNT, nmsPlayer);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//
|
||||||
|
tnt.setVelocity(playerVector.multiply(getSpeedMultiplier()).multiply(event.getForce()));
|
||||||
|
tnt.setCustomName(launchedTNTName);
|
||||||
|
tnt.setFuseTicks(getFuseticks());
|
||||||
|
|
||||||
|
//Player Recoil
|
||||||
|
player.setVelocity(playerVector.multiply(-1).multiply(getRecoil()));
|
||||||
|
player.getWorld().playSound(playerLocation, Sound.ENTITY_GENERIC_EXPLODE, 1.0F, 0);
|
||||||
|
player.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, playerLocation, 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
arrow.remove();
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onTnTExplode(EntityExplodeEvent event) {
|
||||||
|
if (event.getEntityType() != EntityType.PRIMED_TNT) return;
|
||||||
|
if (event.getEntity().getCustomName() != "CANNON BOW TNT:42170") return;
|
||||||
|
|
||||||
|
if (isDestructive == true){
|
||||||
|
Location loc = event.getEntity().getLocation();
|
||||||
|
event.getEntity().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 3, false, false);
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static double getSpeedMultiplier() {
|
||||||
|
return speedMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setSpeedMultiplier(double multiplier, CommandSender sender){
|
||||||
|
|
||||||
|
if (multiplier > maxSpeedMultiplier) sender.sendMessage("SpeedMultiplier is too Large! Setting multiplier to "+ maxSpeedMultiplier);
|
||||||
|
if (multiplier < maxSpeedMultiplier) sender.sendMessage("SpeedMultiplier is too Small! Setting multiplier to "+ minSpeedMultiplier);
|
||||||
|
|
||||||
|
setSpeedMultiplier(multiplier, sender);
|
||||||
|
sender.sendMessage("SpeedMultiplier set to " + getSpeedMultiplier());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setSpeedMultiplier(double multiplier) {
|
||||||
|
|
||||||
|
if (multiplier > maxSpeedMultiplier) multiplier = maxSpeedMultiplier;
|
||||||
|
if (multiplier < minSpeedMultiplier) multiplier = minSpeedMultiplier;
|
||||||
|
config.set(speedMultiplierPath, multiplier);
|
||||||
|
speedMultiplier = multiplier;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static double getMinforce() {
|
||||||
|
return minForce;
|
||||||
|
}
|
||||||
|
public static void setMinForce(double minforce, CommandSender sender){
|
||||||
|
|
||||||
|
if (minforce > maxMinForce) sender.sendMessage("MinForce is too large! Setting it to " + maxMinForce);
|
||||||
|
if (minforce < minMinForce) sender.sendMessage("MinForce is too small! Setting it to " + minMinForce);
|
||||||
|
setMinforce(minforce);
|
||||||
|
sender.sendMessage("MinForce set to " + getMinforce());
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void setMinforce(double minforce) {
|
||||||
|
|
||||||
|
if (minforce > maxMinForce) minforce = maxMinForce;
|
||||||
|
if (minforce < minMinForce) minforce = minMinForce;
|
||||||
|
config.set(minForcePath, minforce);
|
||||||
|
CannonBowListener.minForce = minforce;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static int getFuseticks() {
|
||||||
|
return fuseTicks;
|
||||||
|
}
|
||||||
|
public static void setFuseticks(int fuseticks, CommandSender sender){
|
||||||
|
|
||||||
|
if (fuseticks > maxFuseTicks) sender.sendMessage("Fuseticks is too large! Setting it to " + maxFuseTicks);
|
||||||
|
if (fuseticks < minFuseTicks) sender.sendMessage("Fuseticks is too small! Setting it to " + minFuseTicks);
|
||||||
|
setFuseticks(fuseticks);
|
||||||
|
sender.sendMessage("FuseTicks set to " + getFuseticks());
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void setFuseticks(int fuseticks) {
|
||||||
|
|
||||||
|
if (fuseticks > maxFuseTicks) fuseticks = maxFuseTicks;
|
||||||
|
if (fuseticks < minFuseTicks) fuseticks = minFuseTicks;
|
||||||
|
config.set(fuseTicksPath, fuseticks);
|
||||||
|
CannonBowListener.fuseTicks = fuseticks;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static double getRecoil() {
|
||||||
|
return recoil;
|
||||||
|
}
|
||||||
|
public static void setRecoil(double recoil, CommandSender sender){
|
||||||
|
|
||||||
|
if (recoil > maxRecoil) sender.sendMessage("Recoil is too large! Setting it to " + maxRecoil);
|
||||||
|
if (recoil < maxRecoil) sender.sendMessage("Recoil is too small! Setting it to " + minRecoil);
|
||||||
|
setRecoil(recoil);
|
||||||
|
sender.sendMessage("Recoil set to " + getRecoil());
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void setRecoil(double recoil) {
|
||||||
|
|
||||||
|
if (recoil > maxRecoil) recoil = maxRecoil;
|
||||||
|
if (recoil < minRecoil) recoil = minRecoil;
|
||||||
|
config.set(recoilPath, recoil);
|
||||||
|
CannonBowListener.recoil = recoil;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean getIsDestructive(){
|
||||||
|
return isDestructive;
|
||||||
|
}
|
||||||
|
public static void setIsDestructive(String input){
|
||||||
|
if(input.startsWith("T") || input.startsWith("t")) setIsDestructive(true);
|
||||||
|
if(input.startsWith("F") || input.startsWith("f")) setIsDestructive(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void setIsDestructive(boolean isDestructive){
|
||||||
|
CannonBowListener.isDestructive = isDestructive;
|
||||||
|
config.set(speedMultiplierPath, isDestructive);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package buttondevteam.alipresents.components.magic.tricks;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.math.NumberUtils;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
|
||||||
|
public class CannonBowSettings extends ModCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
if (args.length > 1 && args[0] == "display"){
|
||||||
|
switch(args[0].toLowerCase()){
|
||||||
|
case "force":
|
||||||
|
case "speedmultiplier":
|
||||||
|
CannonBowListener.setSpeedMultiplier(NumberUtils.toDouble(args[1], CannonBowListener.getSpeedMultiplier()));
|
||||||
|
break;
|
||||||
|
case "minimumforce":
|
||||||
|
case "minforce":
|
||||||
|
case "minimumdraw":
|
||||||
|
case "mindraw":
|
||||||
|
CannonBowListener.setMinforce(NumberUtils.toDouble(args[1], CannonBowListener.getMinforce()));
|
||||||
|
break;
|
||||||
|
case "fuse":
|
||||||
|
case "fusetick":
|
||||||
|
case "fuseticks":
|
||||||
|
CannonBowListener.setFuseticks(NumberUtils.toInt(args[1], CannonBowListener.getFuseticks()));
|
||||||
|
break;
|
||||||
|
case "recoil":
|
||||||
|
CannonBowListener.setRecoil(NumberUtils.toDouble((args[1]), CannonBowListener.getRecoil()));
|
||||||
|
break;
|
||||||
|
case "isDestructive":
|
||||||
|
CannonBowListener.setIsDestructive(args[1]);
|
||||||
|
case "display":
|
||||||
|
player.sendMessage("Speed Multiplier: "+CannonBowListener.getSpeedMultiplier());
|
||||||
|
player.sendMessage("Minimum Force: "+CannonBowListener.getMinforce());
|
||||||
|
player.sendMessage("Fuseticks: " + CannonBowListener.getFuseticks());
|
||||||
|
player.sendMessage("Recoil: " + CannonBowListener.getRecoil());
|
||||||
|
player.sendMessage("isDestructive: " + CannonBowListener.getIsDestructive());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
player.sendMessage("That isn't a valid setting!");
|
||||||
|
player.sendMessage("Valid Settings are: speedmultiplier, minforce, fuseticks, recoil");
|
||||||
|
player.sendMessage("Use argument 'display' to disply current settings");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath(){
|
||||||
|
return "magic cannonbow settings";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package buttondevteam.alipresents.components.metrics;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.Component;
|
||||||
|
import buttondevteam.alipresents.components.metrics.collection.PlayerJoinListener;
|
||||||
|
import buttondevteam.alipresents.components.metrics.files.MetricsFile;
|
||||||
|
import buttondevteam.alipresents.components.metrics.output.GetLoginMetrics;
|
||||||
|
|
||||||
|
public class MetricsComponent extends Component{
|
||||||
|
String defaultPath;
|
||||||
|
String defaultFilePath;
|
||||||
|
String playerLoginsFilePath;
|
||||||
|
|
||||||
|
public MetricsFile playerLoginsFile; // DATA - STRING
|
||||||
|
public List<String> metricsList;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin){
|
||||||
|
|
||||||
|
defaultPath = plugin.getDataFolder().getAbsolutePath();
|
||||||
|
defaultFilePath = defaultPath + "/metrics.txt";
|
||||||
|
playerLoginsFilePath = defaultPath + "/playerLogins.txt";
|
||||||
|
|
||||||
|
playerLoginsFile = new MetricsFile(playerLoginsFilePath);
|
||||||
|
registerCommand(plugin, new GetLoginMetrics(this));
|
||||||
|
registerListener(plugin, new PlayerJoinListener(this, playerLoginsFile));
|
||||||
|
|
||||||
|
metricsList = new ArrayList<String>();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package buttondevteam.alipresents.components.metrics.collection;
|
||||||
|
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.components.metrics.MetricsComponent;
|
||||||
|
import buttondevteam.alipresents.components.metrics.files.MetricsFile;
|
||||||
|
|
||||||
|
public class PlayerJoinListener implements Listener{
|
||||||
|
|
||||||
|
private MetricsComponent module;
|
||||||
|
private MetricsFile playerLoginsFile;
|
||||||
|
public PlayerJoinListener(MetricsComponent module, MetricsFile playerLoginsFile){
|
||||||
|
this.module = module;
|
||||||
|
this.playerLoginsFile = playerLoginsFile;
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event){
|
||||||
|
playerLoginsFile.AddLine("loginlog."+System.currentTimeMillis()+event.getPlayer().getName());
|
||||||
|
module.metricsList.add("loginlog."+System.currentTimeMillis()+event.getPlayer().getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package buttondevteam.alipresents.components.metrics.files;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
|
||||||
|
public class MetricsFile {
|
||||||
|
private String fileName = "src/alisolarflare/resources/metrics/playerLogins.txt";
|
||||||
|
public MetricsFile(String filePath){
|
||||||
|
this.fileName = filePath;
|
||||||
|
}
|
||||||
|
public void AddLine(String string){
|
||||||
|
BufferedWriter inputStream = null;
|
||||||
|
try {
|
||||||
|
TBMCCoreAPI.sendDebugMessage("Trying to Open File: "+fileName+"...");
|
||||||
|
File file = new File(fileName);
|
||||||
|
TBMCCoreAPI.sendDebugMessage("File Exists: " + file.exists());
|
||||||
|
inputStream = new BufferedWriter(new FileWriter(fileName, true));
|
||||||
|
TBMCCoreAPI.sendDebugMessage("Input Stream Created!");
|
||||||
|
TBMCCoreAPI.sendDebugMessage("Trying to write to file...");
|
||||||
|
inputStream.write(string);
|
||||||
|
TBMCCoreAPI.sendDebugMessage("Ending with newLine...");
|
||||||
|
inputStream.newLine();
|
||||||
|
TBMCCoreAPI.sendDebugMessage("Closing File...");
|
||||||
|
inputStream.close();
|
||||||
|
TBMCCoreAPI.sendDebugMessage("File Closed!");
|
||||||
|
} catch (IOException e) {
|
||||||
|
TBMCCoreAPI.sendDebugMessage(fileName +" Input Stream could not be created! ");
|
||||||
|
TBMCCoreAPI.sendDebugMessage(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public List<String> toArrayList(){
|
||||||
|
BufferedReader outputStream = null;
|
||||||
|
try {
|
||||||
|
TBMCCoreAPI.sendDebugMessage("Creating FileReader: "+fileName);
|
||||||
|
FileReader reader = new FileReader(fileName);
|
||||||
|
TBMCCoreAPI.sendDebugMessage("Creating BufferedReader...");
|
||||||
|
outputStream = new BufferedReader(reader);
|
||||||
|
|
||||||
|
List<String> outputList = new ArrayList<String>();
|
||||||
|
String currentLine;
|
||||||
|
while ((currentLine = outputStream.readLine()) != null){
|
||||||
|
outputList.add(currentLine);
|
||||||
|
}
|
||||||
|
TBMCCoreAPI.sendDebugMessage("Message! "+outputList.toString());
|
||||||
|
outputStream.close();
|
||||||
|
return outputList;
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
TBMCCoreAPI.sendDebugMessage(fileName + " could not be found");
|
||||||
|
TBMCCoreAPI.sendDebugMessage(e.toString());
|
||||||
|
} catch (IOException e1) {
|
||||||
|
TBMCCoreAPI.SendException(fileName + "encountered an I/O Exception!", e1);
|
||||||
|
TBMCCoreAPI.sendDebugMessage(e1.toString());
|
||||||
|
}
|
||||||
|
return new ArrayList<String>();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package buttondevteam.alipresents.components.metrics.output;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||||
|
import buttondevteam.alipresents.components.metrics.MetricsComponent;
|
||||||
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
|
||||||
|
public class GetLoginMetrics extends ModCommand{
|
||||||
|
|
||||||
|
private MetricsComponent module;
|
||||||
|
|
||||||
|
public GetLoginMetrics(MetricsComponent metricsModule) {
|
||||||
|
this.module = metricsModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||||
|
player.sendMessage("FIRED");
|
||||||
|
if (args.length == 1){
|
||||||
|
BufferedReader outputStream = null;
|
||||||
|
try {
|
||||||
|
outputStream = new BufferedReader(new FileReader(args[0]));
|
||||||
|
|
||||||
|
List<String> outputList = new ArrayList<String>();
|
||||||
|
String currentLine;
|
||||||
|
|
||||||
|
while ((currentLine = outputStream.readLine()) != null){
|
||||||
|
outputList.add(currentLine);
|
||||||
|
}
|
||||||
|
outputStream.close();
|
||||||
|
for (String metric: outputList){
|
||||||
|
player.sendMessage(metric);
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
TBMCCoreAPI.SendException(args[0] + " could not be found", e);
|
||||||
|
if (outputStream != null){
|
||||||
|
try {
|
||||||
|
outputStream.close();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e1) {
|
||||||
|
TBMCCoreAPI.SendException(args[0] + "encountered an I/O Exception!", e1);
|
||||||
|
if (outputStream != null){
|
||||||
|
try {
|
||||||
|
outputStream.close();
|
||||||
|
} catch (IOException e2) {
|
||||||
|
e2.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
for (String metric : module.playerLoginsFile.toArrayList()){
|
||||||
|
player.sendMessage(metric);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String GetCommandPath() {
|
||||||
|
return "metrics get logins";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc;
|
||||||
|
//package graveyard.autouhc;
|
||||||
|
//import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
//
|
||||||
|
//import alisolarflare.components.Component;
|
||||||
|
//import graveyard.autouhc.memory.MatchState;
|
||||||
|
//import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
//
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class UHCModule extends Component {
|
||||||
|
// public UHCMatch match;
|
||||||
|
//
|
||||||
|
// public void register(JavaPlugin plugin) {
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if (plugin.getConfig().contains("UHCMatchState")){
|
||||||
|
// match = new UHCMatch(plugin.getConfig(), MatchState.valueOf(plugin.getConfig().getString("UHCMatchState")));
|
||||||
|
// }else{
|
||||||
|
// match = new UHCMatch(plugin.getConfig(), MatchState.IDLE);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //registerCommand(plugin, new SetMatchState(match));
|
||||||
|
// //registerCommand(plugin, new AddToUHC(match));
|
||||||
|
// //registerCommand(plugin, new JoinUHC(match));
|
||||||
|
// //registerCommand(plugin, new StartMatch(match));
|
||||||
|
// //registerCommand(plugin, new ConfigureMatch(match));
|
||||||
|
// //registerCommand(plugin, new ScheduleMatch(match));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.controller;
|
||||||
|
//package graveyard.autouhc.controller;
|
||||||
|
//
|
||||||
|
//import org.bukkit.command.CommandSender;
|
||||||
|
//import org.bukkit.entity.Player;
|
||||||
|
//
|
||||||
|
//import alisolarflare.components.ModCommand;
|
||||||
|
//import graveyard.autouhc.memory.MatchState;
|
||||||
|
//import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class SetMatchState extends ModCommand{
|
||||||
|
//
|
||||||
|
// UHCMatch match;
|
||||||
|
// public SetMatchState(UHCMatch match) {
|
||||||
|
// this.match = match;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
|
// if (!(sender instanceof Player)){
|
||||||
|
// sender.sendMessage("You must be a player to use this command!");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Player player = (Player) sender;
|
||||||
|
//
|
||||||
|
// if (player.getName().equalsIgnoreCase("alisolarflare") && player.getName().equalsIgnoreCase("Arsen_Derby_FTW")){
|
||||||
|
// sender.sendMessage("You must be either Ali or Arsen to use this command!");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if(args.length < 1 ){
|
||||||
|
// player.sendMessage("Usage: /setMatchState [stateToBeSet]");
|
||||||
|
// player.sendMessage("States: IDLE, WAITING, SETUP, INTRO, PEACE, POWER, TENSION, END");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String inputState = args[0];
|
||||||
|
// boolean inputIsValidState = false;
|
||||||
|
// for (MatchState defaultMatchState : MatchState.values()){
|
||||||
|
// if(inputState.equalsIgnoreCase(defaultMatchState.toString())){
|
||||||
|
// inputIsValidState = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (inputIsValidState){
|
||||||
|
// match.setMatchState(MatchState.valueOf(inputState));
|
||||||
|
// player.sendMessage("Match State set to: " + match.getMatchState().toString() + "!");
|
||||||
|
// }else{
|
||||||
|
// player.sendMessage("Error, could not parse state.");
|
||||||
|
// player.sendMessage("Valid States: IDLE, WAITING, SETUP, INTRO, PEACE, POWER, TENSION, END");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean GetPlayerOnly() {
|
||||||
|
// // TODO Auto-generated method stub
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean GetModOnly() {
|
||||||
|
// // TODO Auto-generated method stub
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.idle;
|
||||||
|
//package graveyard.autouhc.idle;
|
||||||
|
//
|
||||||
|
//import org.bukkit.command.CommandSender;
|
||||||
|
//import org.bukkit.entity.Player;
|
||||||
|
//
|
||||||
|
//import alisolarflare.components.ModCommand;
|
||||||
|
//import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * This class handles the specific command /addToUHC which, in-game, adds a player to a specific UltraHardcore match, that is defined by the constructor: {@linkplain #AddToUHC(UHCMatch)}
|
||||||
|
// *
|
||||||
|
// * @author Alisolarflare
|
||||||
|
// */
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class AddToUHC extends ModCommand {
|
||||||
|
// private UHCMatch match;
|
||||||
|
//
|
||||||
|
// public AddToUHC(UHCMatch match) {
|
||||||
|
// this.match = match;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
|
// // INPUT SANITATION
|
||||||
|
// Player player = (Player) sender;
|
||||||
|
// if (!player.getName().equalsIgnoreCase("alisolarflare") && !player.getName().equalsIgnoreCase("Arsen_Derby_FTW")) {
|
||||||
|
// sender.sendMessage("You must be Ali to add someone else to a UHC, send her a message to change the permissions");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// if (args.length <= 1) {
|
||||||
|
// sender.sendMessage("You must supply at least one playername");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// switch(match.getMatchState()){
|
||||||
|
// case IDLE:
|
||||||
|
// case WAITING:
|
||||||
|
// case SETUP:
|
||||||
|
// case INTRO:
|
||||||
|
// // Adds players to memory
|
||||||
|
// sender.sendMessage("Adding Players to matchList!");
|
||||||
|
// for (int i = 0; i > args.length; i++) {
|
||||||
|
// match.getPlayerList().add(args[i]);
|
||||||
|
// }sender.sendMessage("Finished!");
|
||||||
|
// case PEACE:
|
||||||
|
// case TENSION:
|
||||||
|
// case POWER:
|
||||||
|
// case END:
|
||||||
|
// sender.sendMessage("There is already a match going on!");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.idle;
|
||||||
|
//package graveyard.autouhc.idle;
|
||||||
|
//
|
||||||
|
//import org.bukkit.command.CommandSender;
|
||||||
|
//import org.bukkit.entity.Player;
|
||||||
|
//
|
||||||
|
//import alisolarflare.components.ModCommand;
|
||||||
|
//import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class JoinUHC extends ModCommand{
|
||||||
|
//
|
||||||
|
// private UHCMatch match;
|
||||||
|
//
|
||||||
|
// public JoinUHC(UHCMatch match) {
|
||||||
|
// this.match = match;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
|
// if (!(sender instanceof Player))
|
||||||
|
// return false;
|
||||||
|
// Player player = (Player) sender;
|
||||||
|
// player.sendMessage("Adding you to the UltraHardcore match!");
|
||||||
|
// switch(match.getMatchState()){
|
||||||
|
//
|
||||||
|
// //Before the game
|
||||||
|
// case IDLE:
|
||||||
|
// case WAITING:
|
||||||
|
// case SETUP:
|
||||||
|
// case INTRO:
|
||||||
|
// player.sendMessage("Adding you to the UltraHardcore match!");
|
||||||
|
// match.getPlayerList().add(player.getName());
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// //During the game
|
||||||
|
// case PEACE:
|
||||||
|
// case TENSION:
|
||||||
|
// case POWER:
|
||||||
|
// player.sendMessage("There is currently an UltraHardcore match going on! #POINTTOSPECTATORMODE, tell Ali asap if you see this");
|
||||||
|
//
|
||||||
|
// //After the game
|
||||||
|
// case END:
|
||||||
|
// player.sendMessage("There is currently an ending ceremony going on! #POINTTOCEREMONY, tell Ali ASAP if you see this");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.intro;
|
||||||
|
//package graveyard.autouhc.intro;
|
||||||
|
//
|
||||||
|
//import org.bukkit.command.CommandSender;
|
||||||
|
//
|
||||||
|
//import alisolarflare.components.ModCommand;
|
||||||
|
//import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class ConfigureMatch extends ModCommand{
|
||||||
|
//
|
||||||
|
// public ConfigureMatch(UHCMatch match) {
|
||||||
|
// // TODO Auto-generated constructor stub
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
|
// // TODO Auto-generated method stub
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.intro;
|
||||||
|
//package graveyard.autouhc.intro;
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class IntroductionCutscene {
|
||||||
|
// //TODO: Teleport all players to the area.
|
||||||
|
//}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.intro;
|
||||||
|
//package graveyard.autouhc.intro;
|
||||||
|
//
|
||||||
|
//import org.bukkit.command.CommandSender;
|
||||||
|
//
|
||||||
|
//import alisolarflare.components.ModCommand;
|
||||||
|
//import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class ScheduleMatch extends ModCommand{
|
||||||
|
//
|
||||||
|
// public ScheduleMatch(UHCMatch match) {
|
||||||
|
// // TODO Auto-generated constructor stub
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
||||||
|
// // TODO Auto-generated method stub
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.intro;
|
||||||
|
//package graveyard.autouhc.intro;
|
||||||
|
//
|
||||||
|
//import org.bukkit.command.CommandSender;
|
||||||
|
//
|
||||||
|
//import alisolarflare.components.ModCommand;
|
||||||
|
//import graveyard.autouhc.memory.MatchState;
|
||||||
|
//import graveyard.autouhc.memory.UHCMatch;
|
||||||
|
//
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class StartMatch extends ModCommand {
|
||||||
|
// private UHCMatch match;
|
||||||
|
// /**@deprecated*/
|
||||||
|
// public StartMatch(UHCMatch match) {
|
||||||
|
// this.match = match;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean OnCommand(CommandSender sender, String label, String[] args) {
|
||||||
|
//
|
||||||
|
// if (!sender.hasPermission("moderator") && !(sender.getName() == ""))
|
||||||
|
// sender.sendMessage("You must be a moderator or Arsenalis to use this command! "
|
||||||
|
// + "Contact a TBMC dev if you think this is wrong");
|
||||||
|
//
|
||||||
|
// //ACTIVATES MATCH
|
||||||
|
// switch(match.getMatchState()){
|
||||||
|
// case IDLE:
|
||||||
|
// sender.sendMessage("There is currently a match ready... Activating...");
|
||||||
|
// match.setMatchState(MatchState.INTRO);
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case WAITING:
|
||||||
|
// sender.sendMessage("There currently a match planned for: TIME:TIME:TIME");
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// case END:
|
||||||
|
// sender.sendMessage("The match has ended! Would you like to restart using current settings?");
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// default:
|
||||||
|
// sender.sendMessage("You cannot start a match now, one is already in progress!");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return false;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public String GetCommandPath() {
|
||||||
|
// return "startmatch";
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.listeners;
|
||||||
|
//package graveyard.autouhc.listeners;
|
||||||
|
//
|
||||||
|
//import org.bukkit.event.Listener;
|
||||||
|
//import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
//import org.bukkit.scheduler.BukkitTask;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * Main launcher for the repeating task that activates the
|
||||||
|
// * ghostie powers if an Ultrahardcore Match is going on,
|
||||||
|
// * and it's time for powers to activate
|
||||||
|
// */
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class MatchCyclingListener implements Listener {
|
||||||
|
// public BukkitTask PowerCyclingTask;
|
||||||
|
//
|
||||||
|
// public MatchCyclingListener(JavaPlugin plugin){
|
||||||
|
// PowerCyclingTask = (new MatchMainLoop()).runTaskTimer(plugin, 20, 20);
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.listeners;
|
||||||
|
//package graveyard.autouhc.listeners;
|
||||||
|
//
|
||||||
|
//import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class MatchMainLoop extends BukkitRunnable{
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.memory;
|
||||||
|
//package graveyard.autouhc.memory;
|
||||||
|
///**@deprecated*/
|
||||||
|
//public enum MatchState {
|
||||||
|
// IDLE, //Idle: Configure Match, Wait: Schedule Match, Intro: Start Match
|
||||||
|
// WAITING, //SETUP: Scheduled Time, INTRO: No Setup
|
||||||
|
// SETUP, //INTRO: Done
|
||||||
|
// INTRO, //Peace: Done, and players ready
|
||||||
|
// PEACE, //Tension: Timer, End: All dead
|
||||||
|
// TENSION, //Power: Timer, End: All dead
|
||||||
|
// POWER, //End: All dead
|
||||||
|
// END//IDLE: Ceremony over
|
||||||
|
//}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.autouhc.memory;
|
||||||
|
//package graveyard.autouhc.memory;
|
||||||
|
//
|
||||||
|
//import java.util.ArrayList;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
//import org.bukkit.Location;
|
||||||
|
//import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
//
|
||||||
|
///**@deprecated*/
|
||||||
|
//public class UHCMatch {
|
||||||
|
// private FileConfiguration config;
|
||||||
|
// private MatchState matchState = MatchState.IDLE;
|
||||||
|
// private List<String> playerList = new ArrayList<String>();
|
||||||
|
//
|
||||||
|
// private Location lobbyLocation;
|
||||||
|
// public UHCMatch(FileConfiguration fileConfiguration, MatchState state) {
|
||||||
|
// this.config = fileConfiguration;
|
||||||
|
// this.matchState = state;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public MatchState getMatchState(){
|
||||||
|
// return matchState;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setMatchState(MatchState newMS){
|
||||||
|
// matchState = newMS;
|
||||||
|
// config.set("UHCMatchState", newMS.toString());
|
||||||
|
// switch(newMS){
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public List<String> getPlayerList() {
|
||||||
|
// return playerList;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setPlayerList(List<String> playerList) {
|
||||||
|
// this.playerList = playerList;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Location getLobbyLocation() {
|
||||||
|
//
|
||||||
|
// return lobbyLocation;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setLobbyLocation(Location lobbyLocation) {
|
||||||
|
// this.lobbyLocation = lobbyLocation;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.minigames;
|
||||||
|
/*package graveyard.minigames;
|
||||||
|
|
||||||
|
public enum GameState {
|
||||||
|
Idle, FreeForAll, Heroes;
|
||||||
|
}
|
||||||
|
*/
|
|
@ -0,0 +1,38 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.minigames;
|
||||||
|
/*package graveyard.minigames;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import alisolarflare.architecture.Component;
|
||||||
|
import graveyard.minigames.commands.JoinMinigame;
|
||||||
|
import graveyard.minigames.commands.LeaveMinigame;
|
||||||
|
import graveyard.minigames.commands.ListFighters;
|
||||||
|
import graveyard.minigames.commands.SetColourSpawn;
|
||||||
|
import graveyard.minigames.data.SpawnSet;
|
||||||
|
|
||||||
|
public class MinigameComponent extends Component{
|
||||||
|
public SpawnSet spawnSet;
|
||||||
|
public List<String> fighters;
|
||||||
|
public GameState gameState;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(JavaPlugin plugin) {
|
||||||
|
this.spawnSet = new SpawnSet();
|
||||||
|
registerCommand(plugin, new SetColourSpawn(spawnSet));
|
||||||
|
registerCommand(plugin, new JoinMinigame(this));
|
||||||
|
registerCommand(plugin, new LeaveMinigame(this));
|
||||||
|
registerCommand(plugin, new ListFighters(this));
|
||||||
|
|
||||||
|
}
|
||||||
|
public class Fighter {
|
||||||
|
public Player player;
|
||||||
|
public String colour;
|
||||||
|
public Fighter(Player player, String colour){
|
||||||
|
this.colour = colour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
|
@ -0,0 +1,35 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.minigames.commands;
|
||||||
|
/*package graveyard.minigames.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import alisolarflare.architecture.commands.PlayerCommand;
|
||||||
|
import graveyard.minigames.MinigameComponent;
|
||||||
|
|
||||||
|
public class JoinMinigame extends PlayerCommand {
|
||||||
|
private List<String> fighterList;
|
||||||
|
|
||||||
|
public JoinMinigame(MinigameComponent component) {
|
||||||
|
this.fighterList = component.fighters;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String arg2, String[] arg3) {
|
||||||
|
if (fighterList.contains(player.getName())) {
|
||||||
|
player.sendMessage("You are already in the minigame!");
|
||||||
|
}else{
|
||||||
|
fighterList.add(player.getName());
|
||||||
|
player.sendMessage("You have joined the minigame!");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: Type /JoinMinigame to join a current button minigame!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
|
@ -0,0 +1,43 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.minigames.commands;
|
||||||
|
/*package graveyard.minigames.commands;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import alisolarflare.architecture.commands.PlayerCommand;
|
||||||
|
import graveyard.minigames.MinigameComponent;
|
||||||
|
|
||||||
|
public class LeaveMinigame extends PlayerCommand {
|
||||||
|
private List<String> fighters;
|
||||||
|
|
||||||
|
public LeaveMinigame(MinigameComponent components) {
|
||||||
|
this.fighters = components.fighters;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String arg2, String[] arg3) {
|
||||||
|
if(!(player instanceof Player))
|
||||||
|
player.sendMessage("You must be a player to use this command!");
|
||||||
|
|
||||||
|
String name = player.getName();
|
||||||
|
if (!(fighters.contains(name))) {
|
||||||
|
player.sendMessage("You are not fighting!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(fighters.contains(name)){
|
||||||
|
fighters.remove(name);
|
||||||
|
}
|
||||||
|
player.sendMessage("You have left the fighters category!");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: Type /LeaveMinigame to leave the current minigame!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
|
@ -0,0 +1,28 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.minigames.commands;
|
||||||
|
/*package graveyard.minigames.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import alisolarflare.architecture.commands.PlayerCommand;
|
||||||
|
import graveyard.minigames.MinigameComponent;
|
||||||
|
|
||||||
|
public class ListFighters extends PlayerCommand {
|
||||||
|
private MinigameComponent component;
|
||||||
|
|
||||||
|
public ListFighters(MinigameComponent component) {
|
||||||
|
this.component = component;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String arg2, String[] arg3) {
|
||||||
|
player.sendMessage(component.fighters.toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[]{
|
||||||
|
"Usage: Type /ListFighters to get the list of fighters in the current minigame"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
|
@ -0,0 +1,66 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.minigames.commands;
|
||||||
|
/*package graveyard.minigames.commands;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import alisolarflare.architecture.commands.ModCommand;
|
||||||
|
import graveyard.minigames.data.SpawnSet;
|
||||||
|
|
||||||
|
public class SetColourSpawn extends ModCommand{
|
||||||
|
private SpawnSet spawnSet;
|
||||||
|
|
||||||
|
public SetColourSpawn(SpawnSet spawnSet){
|
||||||
|
this.spawnSet = spawnSet;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean OnCommand(Player player, String label, String[] args) {
|
||||||
|
if(args.length == 0){
|
||||||
|
player.sendMessage("ERROR: Arguments required.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String input = args[0];
|
||||||
|
|
||||||
|
input.toLowerCase();
|
||||||
|
switch(input){
|
||||||
|
case ("r"):
|
||||||
|
player.sendMessage("Setting Red Spawn...");
|
||||||
|
spawnSet.RSpawn = player.getLocation();
|
||||||
|
player.sendMessage("Red Spawn Set!");
|
||||||
|
break;
|
||||||
|
case ("o"):
|
||||||
|
player.sendMessage("Setting Orange Spawn...");
|
||||||
|
spawnSet.OSpawn = player.getLocation();
|
||||||
|
player.sendMessage("Orange Spawn Set!");
|
||||||
|
break;
|
||||||
|
case ("y"):
|
||||||
|
player.sendMessage("Setting Yellow Spawn...");
|
||||||
|
spawnSet.YSpawn = player.getLocation();
|
||||||
|
player.sendMessage("Yellow Spawn Set!");
|
||||||
|
break;
|
||||||
|
case ("g"):
|
||||||
|
player.sendMessage("Setting Green Spawn...");
|
||||||
|
spawnSet.GSpawn = player.getLocation();
|
||||||
|
player.sendMessage("Green Spawn Set!");
|
||||||
|
break;
|
||||||
|
case ("b"):
|
||||||
|
player.sendMessage("Setting Blue Spawn...");
|
||||||
|
spawnSet.BSpawn = player.getLocation();
|
||||||
|
player.sendMessage("Blue Spawn Set!");
|
||||||
|
break;
|
||||||
|
case ("p"):
|
||||||
|
player.sendMessage("Setting Purple Spawn...");
|
||||||
|
spawnSet.PSpawn = player.getLocation();
|
||||||
|
player.sendMessage("Purple Spawn Set!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public String[] GetHelpText(String alias){
|
||||||
|
return new String[] {
|
||||||
|
"Usage: /SetColourSpawn <colour>",
|
||||||
|
"Colours: red, orange, yellow, green, blue, purple"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
|
@ -0,0 +1,15 @@
|
||||||
|
package buttondevteam.alipresents.graveyard.minigames.data;
|
||||||
|
/*package graveyard.minigames.data;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class SpawnSet {
|
||||||
|
public Location RSpawn;
|
||||||
|
public Location OSpawn;
|
||||||
|
public Location YSpawn;
|
||||||
|
public Location GSpawn;
|
||||||
|
public Location BSpawn;
|
||||||
|
public Location PSpawn;
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue