1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-30 09:49:51 +02:00

Update the build system slightly to use embedded libraries.

This commit is contained in:
md_5
2013-01-13 09:51:23 +11:00
parent 2a26e46034
commit 4818bec0d8
25 changed files with 289 additions and 20780 deletions

4
.gitignore vendored
View File

@@ -12,6 +12,7 @@ build.xml
# maven
target
jars
dependency-reduced-pom.xml
# vim
.*.sw[a-p]
@@ -30,6 +31,3 @@ manifest.mf
*.ipr
*.iws
.idea/
EssentialsRelease/
/Essentials/dependency-reduced-pom.xml

View File

@@ -16,5 +16,27 @@
<artifactId>Essentials</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>geoip</artifactId>
<version>1.2.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
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 this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey 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 library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -1,61 +0,0 @@
/**
* Country.java
*
* Copyright (C) 2003 MaxMind LLC. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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 Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.maxmind.geoip;
/**
* Represents a country.
*
* @author Matt Tucker
*/
public class Country {
private String code;
private String name;
/**
* Creates a new Country.
*
* @param code the country code.
* @param name the country name.
*/
public Country(String code, String name) {
this.code = code;
this.name = name;
}
/**
* Returns the ISO two-letter country code of this country.
*
* @return the country code.
*/
public String getCode() {
return code;
}
/**
* Returns the name of this country.
*
* @return the country name.
*/
public String getName() {
return name;
}
}

View File

@@ -1,117 +0,0 @@
/**
* DatabaseInfo.java
*
* Copyright (C) 2003 MaxMind LLC. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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 Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.maxmind.geoip;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Encapsulates metadata about the GeoIP database. The database has a date, is a premium or
* standard version, and is one of the following types:
*
* <ul>
* <li>Country edition -- this is the most common version of the database. It includes
* the name of the country and it's ISO country code given an IP address.
* <li>Region edition -- includes the country information as well as
* what U.S. state or Canadian province the IP address is from if the IP address
* is from the U.S. or Canada.
* <li>City edition -- includes country, region, city, postal code, latitude, and
* longitude information.
* <li>Org edition -- includes netblock owner.
* <li>ISP edition -- ISP information.
* </ul>
*
* @see com.maxmind.geoip.LookupService#getDatabaseInfo()
* @author Matt Tucker
*/
public class DatabaseInfo {
public final static int COUNTRY_EDITION = 1;
public final static int REGION_EDITION_REV0 = 7;
public final static int REGION_EDITION_REV1 = 3;
public final static int CITY_EDITION_REV0 = 6;
public final static int CITY_EDITION_REV1 = 2;
public final static int ORG_EDITION = 5;
public final static int ISP_EDITION = 4;
public final static int PROXY_EDITION = 8;
public final static int ASNUM_EDITION = 9;
public final static int NETSPEED_EDITION = 10;
public final static int COUNTRY_EDITION_V6 = 12;
private static SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
private String info;
/**
* Creates a new DatabaseInfo object given the database info String.
* @param info
*/
public DatabaseInfo(String info) {
this.info = info;
}
public int getType() {
if (info == null || info.isEmpty()) {
return COUNTRY_EDITION;
}
else {
// Get the type code from the database info string and then
// subtract 105 from the value to preserve compatability with
// databases from April 2003 and earlier.
return Integer.parseInt(info.substring(4, 7)) - 105;
}
}
/**
* Returns true if the database is the premium version.
*
* @return true if the premium version of the database.
*/
public boolean isPremium() {
return info.indexOf("FREE") < 0;
}
/**
* Returns the date of the database.
*
* @return the date of the database.
*/
public Date getDate() {
for (int i=0; i<info.length()-9; i++) {
if (Character.isWhitespace(info.charAt(i))) {
String dateString = info.substring(i+1, i+9);
try {
synchronized (formatter) {
return formatter.parse(dateString);
}
}
catch (ParseException pe) { }
break;
}
}
return null;
}
public String toString() {
return info;
}
}

View File

@@ -1,60 +0,0 @@
/**
* Location.java
*
* Copyright (C) 2004 MaxMind LLC. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Lesser Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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 Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.maxmind.geoip;
public class Location {
public String countryCode;
public String countryName;
public String region;
public String city;
public String postalCode;
public float latitude;
public float longitude;
public int dma_code;
public int area_code;
public int metro_code;
private final static double EARTH_DIAMETER = 2 * 6378.2;
private final static double PI = 3.14159265;
private final static double RAD_CONVERT = PI / 180;
public double distance (Location loc) {
double delta_lat, delta_lon;
double temp;
float lat1 = latitude;
float lon1 = longitude;
float lat2 = loc.latitude;
float lon2 = loc.longitude;
// convert degrees to radians
lat1 *= RAD_CONVERT;
lat2 *= RAD_CONVERT;
// find the deltas
delta_lat = lat2 - lat1;
delta_lon = (lon2 - lon1) * RAD_CONVERT;
// Find the great circle distance
temp = Math.pow(Math.sin(delta_lat/2),2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(delta_lon/2),2);
return EARTH_DIAMETER * Math.atan2(Math.sqrt(temp),Math.sqrt(1-temp));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +0,0 @@
package com.maxmind.geoip;
public class Region{
public String countryCode;
public String countryName;
public String region;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -17,5 +17,4 @@
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -11,6 +11,11 @@
<artifactId>EssentialsUpdate</artifactId>
<dependencies>
<dependency>
<groupId>pircbot</groupId>
<artifactId>pircbot</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -18,4 +23,21 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,293 +0,0 @@
/*
Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/
This file is part of PircBot.
This software is dual-licensed, allowing you to choose between the GNU
General Public License (GPL) and the www.jibble.org Commercial License.
Since the GPL may be too restrictive for use in a proprietary application,
a commercial license is also provided. Full license information can be
found at http://www.jibble.org/licenses/
*/
package org.jibble.pircbot;
/**
* The Colors class provides several static fields and methods that you may
* find useful when writing an IRC Bot.
* <p>
* This class contains constants that are useful for formatting lines
* sent to IRC servers. These constants allow you to apply various
* formatting to the lines, such as colours, boldness, underlining
* and reverse text.
* <p>
* The class contains static methods to remove colours and formatting
* from lines of IRC text.
* <p>
* Here are some examples of how to use the contants from within a
* class that extends PircBot and imports org.jibble.pircbot.*;
*
* <pre> sendMessage("#cs", Colors.BOLD + "A bold hello!");
* <b>A bold hello!</b>
* sendMessage("#cs", Colors.RED + "Red" + Colors.NORMAL + " text");
* <font color="red">Red</font> text
* sendMessage("#cs", Colors.BOLD + Colors.RED + "Bold and red");
* <b><font color="red">Bold and red</font></b></pre>
*
* Please note that some IRC channels may be configured to reject any
* messages that use colours. Also note that older IRC clients may be
* unable to correctly display lines that contain colours and other
* control characters.
* <p>
* Note that this class name has been spelt in the American style in
* order to remain consistent with the rest of the Java API.
*
*
* @since 0.9.12
* @author Paul James Mutton,
* <a href="http://www.jibble.org/">http://www.jibble.org/</a>
* @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
*/
public class Colors {
/**
* Removes all previously applied color and formatting attributes.
*/
public static final String NORMAL = "\u000f";
/**
* Bold text.
*/
public static final String BOLD = "\u0002";
/**
* Underlined text.
*/
public static final String UNDERLINE = "\u001f";
/**
* Reversed text (may be rendered as italic text in some clients).
*/
public static final String REVERSE = "\u0016";
/**
* White coloured text.
*/
public static final String WHITE = "\u000300";
/**
* Black coloured text.
*/
public static final String BLACK = "\u000301";
/**
* Dark blue coloured text.
*/
public static final String DARK_BLUE = "\u000302";
/**
* Dark green coloured text.
*/
public static final String DARK_GREEN = "\u000303";
/**
* Red coloured text.
*/
public static final String RED = "\u000304";
/**
* Brown coloured text.
*/
public static final String BROWN = "\u000305";
/**
* Purple coloured text.
*/
public static final String PURPLE = "\u000306";
/**
* Olive coloured text.
*/
public static final String OLIVE = "\u000307";
/**
* Yellow coloured text.
*/
public static final String YELLOW = "\u000308";
/**
* Green coloured text.
*/
public static final String GREEN = "\u000309";
/**
* Teal coloured text.
*/
public static final String TEAL = "\u000310";
/**
* Cyan coloured text.
*/
public static final String CYAN = "\u000311";
/**
* Blue coloured text.
*/
public static final String BLUE = "\u000312";
/**
* Magenta coloured text.
*/
public static final String MAGENTA = "\u000313";
/**
* Dark gray coloured text.
*/
public static final String DARK_GRAY = "\u000314";
/**
* Light gray coloured text.
*/
public static final String LIGHT_GRAY = "\u000315";
/**
* This class should not be constructed.
*/
private Colors() {
}
/**
* Removes all colours from a line of IRC text.
*
* @since PircBot 1.2.0
*
* @param line the input text.
*
* @return the same text, but with all colours removed.
*/
public static String removeColors(String line) {
int length = line.length();
StringBuffer buffer = new StringBuffer();
int i = 0;
while (i < length) {
char ch = line.charAt(i);
if (ch == '\u0003') {
i++;
// Skip "x" or "xy" (foreground color).
if (i < length) {
ch = line.charAt(i);
if (Character.isDigit(ch)) {
i++;
if (i < length) {
ch = line.charAt(i);
if (Character.isDigit(ch)) {
i++;
}
}
// Now skip ",x" or ",xy" (background color).
if (i < length) {
ch = line.charAt(i);
if (ch == ',') {
i++;
if (i < length) {
ch = line.charAt(i);
if (Character.isDigit(ch)) {
i++;
if (i < length) {
ch = line.charAt(i);
if (Character.isDigit(ch)) {
i++;
}
}
}
else {
// Keep the comma.
i--;
}
}
else {
// Keep the comma.
i--;
}
}
}
}
}
}
else if (ch == '\u000f') {
i++;
}
else {
buffer.append(ch);
i++;
}
}
return buffer.toString();
}
/**
* Remove formatting from a line of IRC text.
*
* @since PircBot 1.2.0
*
* @param line the input text.
*
* @return the same text, but without any bold, underlining, reverse, etc.
*/
public static String removeFormatting(String line) {
int length = line.length();
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < length; i++) {
char ch = line.charAt(i);
if (ch == '\u000f' || ch == '\u0002' || ch == '\u001f' || ch == '\u0016') {
// Don't add this character.
}
else {
buffer.append(ch);
}
}
return buffer.toString();
}
/**
* Removes all formatting and colours from a line of IRC text.
*
* @since PircBot 1.2.0
*
* @param line the input text.
*
* @return the same text, but without formatting and colour characters.
*
*/
public static String removeFormattingAndColors(String line) {
return removeFormatting(removeColors(line));
}
}

View File

@@ -1,169 +0,0 @@
/*
Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/
This file is part of PircBot.
This software is dual-licensed, allowing you to choose between the GNU
General Public License (GPL) and the www.jibble.org Commercial License.
Since the GPL may be too restrictive for use in a proprietary application,
a commercial license is also provided. Full license information can be
found at http://www.jibble.org/licenses/
*/
package org.jibble.pircbot;
import java.io.*;
import java.net.Socket;
import java.util.StringTokenizer;
/**
* A Thread which reads lines from the IRC server. It then
* passes these lines to the PircBot without changing them.
* This running Thread also detects disconnection from the server
* and is thus used by the OutputThread to send lines to the server.
*
* @author Paul James Mutton,
* <a href="http://www.jibble.org/">http://www.jibble.org/</a>
* @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
*/
public class InputThread extends Thread {
/**
* The InputThread reads lines from the IRC server and allows the
* PircBot to handle them.
*
* @param bot An instance of the underlying PircBot.
* @param breader The BufferedReader that reads lines from the server.
* @param bwriter The BufferedWriter that sends lines to the server.
*/
InputThread(PircBot bot, Socket socket, BufferedReader breader, BufferedWriter bwriter) {
_bot = bot;
_socket = socket;
_breader = breader;
_bwriter = bwriter;
this.setName(this.getClass() + "-Thread");
}
/**
* Sends a raw line to the IRC server as soon as possible, bypassing the
* outgoing message queue.
*
* @param line The raw line to send to the IRC server.
*/
void sendRawLine(String line) {
OutputThread.sendRawLine(_bot, _bwriter, line);
}
/**
* Returns true if this InputThread is connected to an IRC server.
* The result of this method should only act as a rough guide,
* as the result may not be valid by the time you act upon it.
*
* @return True if still connected.
*/
boolean isConnected() {
return _isConnected;
}
/**
* Called to start this Thread reading lines from the IRC server.
* When a line is read, this method calls the handleLine method
* in the PircBot, which may subsequently call an 'onXxx' method
* in the PircBot subclass. If any subclass of Throwable (i.e.
* any Exception or Error) is thrown by your method, then this
* method will print the stack trace to the standard output. It
* is probable that the PircBot may still be functioning normally
* after such a problem, but the existance of any uncaught exceptions
* in your code is something you should really fix.
*/
public void run() {
try {
boolean running = true;
while (running) {
try {
String line = null;
while ((line = _breader.readLine()) != null) {
try {
_bot.handleLine(line);
}
catch (Throwable t) {
// Stick the whole stack trace into a String so we can output it nicely.
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
pw.flush();
StringTokenizer tokenizer = new StringTokenizer(sw.toString(), "\r\n");
synchronized (_bot) {
_bot.log("### Your implementation of PircBot is faulty and you have");
_bot.log("### allowed an uncaught Exception or Error to propagate in your");
_bot.log("### code. It may be possible for PircBot to continue operating");
_bot.log("### normally. Here is the stack trace that was produced: -");
_bot.log("### ");
while (tokenizer.hasMoreTokens()) {
_bot.log("### " + tokenizer.nextToken());
}
}
}
}
if (line == null) {
// The server must have disconnected us.
running = false;
}
}
catch (InterruptedIOException iioe) {
// This will happen if we haven't received anything from the server for a while.
// So we shall send it a ping to check that we are still connected.
this.sendRawLine("PING " + (System.currentTimeMillis() / 1000));
// Now we go back to listening for stuff from the server...
}
}
}
catch (Exception e) {
// Do nothing.
}
// If we reach this point, then we must have disconnected.
try {
_socket.close();
}
catch (Exception e) {
// Just assume the socket was already closed.
}
if (!_disposed) {
_bot.log("*** Disconnected.");
_isConnected = false;
_bot.onDisconnect();
}
}
/**
* Closes the socket without onDisconnect being called subsequently.
*/
public void dispose () {
try {
_disposed = true;
_socket.close();
}
catch (Exception e) {
// Do nothing.
}
}
private PircBot _bot = null;
private Socket _socket = null;
private BufferedReader _breader = null;
private BufferedWriter _bwriter = null;
private boolean _isConnected = true;
private boolean _disposed = false;
public static final int MAX_LINE_LENGTH = 512;
}

View File

@@ -1,35 +0,0 @@
/*
Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/
This file is part of PircBot.
This software is dual-licensed, allowing you to choose between the GNU
General Public License (GPL) and the www.jibble.org Commercial License.
Since the GPL may be too restrictive for use in a proprietary application,
a commercial license is also provided. Full license information can be
found at http://www.jibble.org/licenses/
*/
package org.jibble.pircbot;
/**
* An IrcException class.
*
* @since 0.9
* @author Paul James Mutton,
* <a href="http://www.jibble.org/">http://www.jibble.org/</a>
* @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
*/
public class IrcException extends Exception {
/**
* Constructs a new IrcException.
*
* @param e The error message to report.
*/
public IrcException(String e) {
super(e);
}
}

View File

@@ -1,38 +0,0 @@
/*
Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/
This file is part of PircBot.
This software is dual-licensed, allowing you to choose between the GNU
General Public License (GPL) and the www.jibble.org Commercial License.
Since the GPL may be too restrictive for use in a proprietary application,
a commercial license is also provided. Full license information can be
found at http://www.jibble.org/licenses/
*/
package org.jibble.pircbot;
/**
* A NickAlreadyInUseException class. This exception is
* thrown when the PircBot attempts to join an IRC server
* with a user name that is already in use.
*
* @since 0.9
* @author Paul James Mutton,
* <a href="http://www.jibble.org/">http://www.jibble.org/</a>
* @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
*/
public class NickAlreadyInUseException extends IrcException {
/**
* Constructs a new IrcException.
*
* @param e The error message to report.
*/
public NickAlreadyInUseException(String e) {
super(e);
}
}

View File

@@ -1,104 +0,0 @@
/*
Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/
This file is part of PircBot.
This software is dual-licensed, allowing you to choose between the GNU
General Public License (GPL) and the www.jibble.org Commercial License.
Since the GPL may be too restrictive for use in a proprietary application,
a commercial license is also provided. Full license information can be
found at http://www.jibble.org/licenses/
*/
package org.jibble.pircbot;
import java.io.BufferedWriter;
/**
* A Thread which is responsible for sending messages to the IRC server.
* Messages are obtained from the outgoing message queue and sent
* immediately if possible. If there is a flood of messages, then to
* avoid getting kicked from a channel, we put a small delay between
* each one.
*
* @author Paul James Mutton,
* <a href="http://www.jibble.org/">http://www.jibble.org/</a>
* @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
*/
public class OutputThread extends Thread {
/**
* Constructs an OutputThread for the underlying PircBot. All messages
* sent to the IRC server are sent by this OutputThread to avoid hammering
* the server. Messages are sent immediately if possible. If there are
* multiple messages queued, then there is a delay imposed.
*
* @param bot The underlying PircBot instance.
* @param outQueue The Queue from which we will obtain our messages.
*/
OutputThread(PircBot bot, Queue outQueue) {
_bot = bot;
_outQueue = outQueue;
this.setName(this.getClass() + "-Thread");
}
/**
* A static method to write a line to a BufferedOutputStream and then pass
* the line to the log method of the supplied PircBot instance.
*
* @param bot The underlying PircBot instance.
* @param out The BufferedOutputStream to write to.
* @param line The line to be written. "\r\n" is appended to the end.
* @param encoding The charset to use when encoing this string into a
* byte array.
*/
static void sendRawLine(PircBot bot, BufferedWriter bwriter, String line) {
if (line.length() > bot.getMaxLineLength() - 2) {
line = line.substring(0, bot.getMaxLineLength() - 2);
}
synchronized(bwriter) {
try {
bwriter.write(line + "\r\n");
bwriter.flush();
bot.log(">>>" + line);
}
catch (Exception e) {
// Silent response - just lose the line.
}
}
}
/**
* This method starts the Thread consuming from the outgoing message
* Queue and sending lines to the server.
*/
public void run() {
try {
boolean running = true;
while (running) {
// Small delay to prevent spamming of the channel
Thread.sleep(_bot.getMessageDelay());
String line = (String) _outQueue.next();
if (line != null) {
_bot.sendRawLine(line);
}
else {
running = false;
}
}
}
catch (InterruptedException e) {
// Just let the method return naturally...
}
}
private PircBot _bot = null;
private Queue _outQueue = null;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,146 +0,0 @@
/*
Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/
This file is part of PircBot.
This software is dual-licensed, allowing you to choose between the GNU
General Public License (GPL) and the www.jibble.org Commercial License.
Since the GPL may be too restrictive for use in a proprietary application,
a commercial license is also provided. Full license information can be
found at http://www.jibble.org/licenses/
*/
package org.jibble.pircbot;
import java.util.Vector;
/**
* Queue is a definition of a data structure that may
* act as a queue - that is, data can be added to one end of the
* queue and data can be requested from the head end of the queue.
* This class is thread safe for multiple producers and a single
* consumer. The next() method will block until there is data in
* the queue.
*
* This has now been modified so that it is compatible with
* the earlier JDK1.1 in order to be suitable for running on
* mobile appliances. This means replacing the LinkedList with
* a Vector, which is hardly ideal, but this Queue is typically
* only polled every second before dispatching messages.
*
* @author Paul James Mutton,
* <a href="http://www.jibble.org/">http://www.jibble.org/</a>
* @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
*/
public class Queue {
/**
* Constructs a Queue object of unlimited size.
*/
public Queue() {
}
/**
* Adds an Object to the end of the Queue.
*
* @param o The Object to be added to the Queue.
*/
public void add(Object o) {
synchronized(_queue) {
_queue.addElement(o);
_queue.notify();
}
}
/**
* Adds an Object to the front of the Queue.
*
* @param o The Object to be added to the Queue.
*/
public void addFront(Object o) {
synchronized(_queue) {
_queue.insertElementAt(o, 0);
_queue.notify();
}
}
/**
* Returns the Object at the front of the Queue. This
* Object is then removed from the Queue. If the Queue
* is empty, then this method shall block until there
* is an Object in the Queue to return.
*
* @return The next item from the front of the queue.
*/
public Object next() {
Object o = null;
// Block if the Queue is empty.
synchronized(_queue) {
if (_queue.size() == 0) {
try {
_queue.wait();
}
catch (InterruptedException e) {
return null;
}
}
// Return the Object.
try {
o = _queue.firstElement();
_queue.removeElementAt(0);
}
catch (ArrayIndexOutOfBoundsException e) {
throw new InternalError("Race hazard in Queue object.");
}
}
return o;
}
/**
* Returns true if the Queue is not empty. If another
* Thread empties the Queue before <b>next()</b> is
* called, then the call to <b>next()</b> shall block
* until the Queue has been populated again.
*
* @return True only if the Queue not empty.
*/
public boolean hasNext() {
return (this.size() != 0);
}
/**
* Clears the contents of the Queue.
*/
public void clear() {
synchronized(_queue) {
_queue.removeAllElements();
}
}
/**
* Returns the size of the Queue.
*
* @return The current size of the queue.
*/
public int size() {
return _queue.size();
}
private Vector _queue = new Vector();
}

View File

@@ -1,176 +0,0 @@
/*
Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/
This file is part of PircBot.
This software is dual-licensed, allowing you to choose between the GNU
General Public License (GPL) and the www.jibble.org Commercial License.
Since the GPL may be too restrictive for use in a proprietary application,
a commercial license is also provided. Full license information can be
found at http://www.jibble.org/licenses/
*/
package org.jibble.pircbot;
/**
* This interface contains the values of all numeric replies specified
* in section 6 of RFC 1459. Refer to RFC 1459 for further information.
* <p>
* If you override the onServerResponse method in the PircBot class,
* you may find these constants useful when comparing the numeric
* value of a given code.
*
* @since 1.0.0
* @author Paul James Mutton,
* <a href="http://www.jibble.org/">http://www.jibble.org/</a>
* @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
*/
public interface ReplyConstants {
// Error Replies.
public static final int ERR_NOSUCHNICK = 401;
public static final int ERR_NOSUCHSERVER = 402;
public static final int ERR_NOSUCHCHANNEL = 403;
public static final int ERR_CANNOTSENDTOCHAN = 404;
public static final int ERR_TOOMANYCHANNELS = 405;
public static final int ERR_WASNOSUCHNICK = 406;
public static final int ERR_TOOMANYTARGETS = 407;
public static final int ERR_NOORIGIN = 409;
public static final int ERR_NORECIPIENT = 411;
public static final int ERR_NOTEXTTOSEND = 412;
public static final int ERR_NOTOPLEVEL = 413;
public static final int ERR_WILDTOPLEVEL = 414;
public static final int ERR_UNKNOWNCOMMAND = 421;
public static final int ERR_NOMOTD = 422;
public static final int ERR_NOADMININFO = 423;
public static final int ERR_FILEERROR = 424;
public static final int ERR_NONICKNAMEGIVEN = 431;
public static final int ERR_ERRONEUSNICKNAME = 432;
public static final int ERR_NICKNAMEINUSE = 433;
public static final int ERR_NICKCOLLISION = 436;
public static final int ERR_USERNOTINCHANNEL = 441;
public static final int ERR_NOTONCHANNEL = 442;
public static final int ERR_USERONCHANNEL = 443;
public static final int ERR_NOLOGIN = 444;
public static final int ERR_SUMMONDISABLED = 445;
public static final int ERR_USERSDISABLED = 446;
public static final int ERR_NOTREGISTERED = 451;
public static final int ERR_NEEDMOREPARAMS = 461;
public static final int ERR_ALREADYREGISTRED = 462;
public static final int ERR_NOPERMFORHOST = 463;
public static final int ERR_PASSWDMISMATCH = 464;
public static final int ERR_YOUREBANNEDCREEP = 465;
public static final int ERR_KEYSET = 467;
public static final int ERR_CHANNELISFULL = 471;
public static final int ERR_UNKNOWNMODE = 472;
public static final int ERR_INVITEONLYCHAN = 473;
public static final int ERR_BANNEDFROMCHAN = 474;
public static final int ERR_BADCHANNELKEY = 475;
public static final int ERR_NOPRIVILEGES = 481;
public static final int ERR_CHANOPRIVSNEEDED = 482;
public static final int ERR_CANTKILLSERVER = 483;
public static final int ERR_NOOPERHOST = 491;
public static final int ERR_UMODEUNKNOWNFLAG = 501;
public static final int ERR_USERSDONTMATCH = 502;
// Command Responses.
public static final int RPL_TRACELINK = 200;
public static final int RPL_TRACECONNECTING = 201;
public static final int RPL_TRACEHANDSHAKE = 202;
public static final int RPL_TRACEUNKNOWN = 203;
public static final int RPL_TRACEOPERATOR = 204;
public static final int RPL_TRACEUSER = 205;
public static final int RPL_TRACESERVER = 206;
public static final int RPL_TRACENEWTYPE = 208;
public static final int RPL_STATSLINKINFO = 211;
public static final int RPL_STATSCOMMANDS = 212;
public static final int RPL_STATSCLINE = 213;
public static final int RPL_STATSNLINE = 214;
public static final int RPL_STATSILINE = 215;
public static final int RPL_STATSKLINE = 216;
public static final int RPL_STATSYLINE = 218;
public static final int RPL_ENDOFSTATS = 219;
public static final int RPL_UMODEIS = 221;
public static final int RPL_STATSLLINE = 241;
public static final int RPL_STATSUPTIME = 242;
public static final int RPL_STATSOLINE = 243;
public static final int RPL_STATSHLINE = 244;
public static final int RPL_LUSERCLIENT = 251;
public static final int RPL_LUSEROP = 252;
public static final int RPL_LUSERUNKNOWN = 253;
public static final int RPL_LUSERCHANNELS = 254;
public static final int RPL_LUSERME = 255;
public static final int RPL_ADMINME = 256;
public static final int RPL_ADMINLOC1 = 257;
public static final int RPL_ADMINLOC2 = 258;
public static final int RPL_ADMINEMAIL = 259;
public static final int RPL_TRACELOG = 261;
public static final int RPL_NONE = 300;
public static final int RPL_AWAY = 301;
public static final int RPL_USERHOST = 302;
public static final int RPL_ISON = 303;
public static final int RPL_UNAWAY = 305;
public static final int RPL_NOWAWAY = 306;
public static final int RPL_WHOISUSER = 311;
public static final int RPL_WHOISSERVER = 312;
public static final int RPL_WHOISOPERATOR = 313;
public static final int RPL_WHOWASUSER = 314;
public static final int RPL_ENDOFWHO = 315;
public static final int RPL_WHOISIDLE = 317;
public static final int RPL_ENDOFWHOIS = 318;
public static final int RPL_WHOISCHANNELS = 319;
public static final int RPL_LISTSTART = 321;
public static final int RPL_LIST = 322;
public static final int RPL_LISTEND = 323;
public static final int RPL_CHANNELMODEIS = 324;
public static final int RPL_NOTOPIC = 331;
public static final int RPL_TOPIC = 332;
public static final int RPL_TOPICINFO = 333;
public static final int RPL_INVITING = 341;
public static final int RPL_SUMMONING = 342;
public static final int RPL_VERSION = 351;
public static final int RPL_WHOREPLY = 352;
public static final int RPL_NAMREPLY = 353;
public static final int RPL_LINKS = 364;
public static final int RPL_ENDOFLINKS = 365;
public static final int RPL_ENDOFNAMES = 366;
public static final int RPL_BANLIST = 367;
public static final int RPL_ENDOFBANLIST = 368;
public static final int RPL_ENDOFWHOWAS = 369;
public static final int RPL_INFO = 371;
public static final int RPL_MOTD = 372;
public static final int RPL_ENDOFINFO = 374;
public static final int RPL_MOTDSTART = 375;
public static final int RPL_ENDOFMOTD = 376;
public static final int RPL_YOUREOPER = 381;
public static final int RPL_REHASHING = 382;
public static final int RPL_TIME = 391;
public static final int RPL_USERSSTART = 392;
public static final int RPL_USERS = 393;
public static final int RPL_ENDOFUSERS = 394;
public static final int RPL_NOUSERS = 395;
// Reserved Numerics.
public static final int RPL_TRACECLASS = 209;
public static final int RPL_STATSQLINE = 217;
public static final int RPL_SERVICEINFO = 231;
public static final int RPL_ENDOFSERVICES = 232;
public static final int RPL_SERVICE = 233;
public static final int RPL_SERVLIST = 234;
public static final int RPL_SERVLISTEND = 235;
public static final int RPL_WHOISCHANOP = 316;
public static final int RPL_KILLDONE = 361;
public static final int RPL_CLOSING = 362;
public static final int RPL_CLOSEEND = 363;
public static final int RPL_INFOSTART = 373;
public static final int RPL_MYPORTIS = 384;
public static final int ERR_YOUWILLBEBANNED = 466;
public static final int ERR_BADCHANMASK = 476;
public static final int ERR_NOSERVICEHOST = 492;
}

View File

@@ -1,163 +0,0 @@
/*
Copyright Paul James Mutton, 2001-2009, http://www.jibble.org/
This file is part of PircBot.
This software is dual-licensed, allowing you to choose between the GNU
General Public License (GPL) and the www.jibble.org Commercial License.
Since the GPL may be too restrictive for use in a proprietary application,
a commercial license is also provided. Full license information can be
found at http://www.jibble.org/licenses/
*/
package org.jibble.pircbot;
import java.util.Locale;
/**
* This class is used to represent a user on an IRC server.
* Instances of this class are returned by the getUsers method
* in the PircBot class.
* <p>
* Note that this class no longer implements the Comparable interface
* for Java 1.1 compatibility reasons.
*
* @since 1.0.0
* @author Paul James Mutton,
* <a href="http://www.jibble.org/">http://www.jibble.org/</a>
* @version 1.5.0 (Build time: Mon Dec 14 20:07:17 2009)
*/
public class User {
/**
* Constructs a User object with a known prefix and nick.
*
* @param prefix The status of the user, for example, "@".
* @param nick The nick of the user.
*/
User(String prefix, String nick) {
_prefix = prefix;
_nick = nick;
_lowerNick = nick.toLowerCase(Locale.ENGLISH);
}
/**
* Returns the prefix of the user. If the User object has been obtained
* from a list of users in a channel, then this will reflect the user's
* status in that channel.
*
* @return The prefix of the user. If there is no prefix, then an empty
* String is returned.
*/
public String getPrefix() {
return _prefix;
}
/**
* Returns whether or not the user represented by this object is an
* operator. If the User object has been obtained from a list of users
* in a channel, then this will reflect the user's operator status in
* that channel.
*
* @return true if the user is an operator in the channel.
*/
public boolean isOp() {
return _prefix.indexOf('@') >= 0;
}
/**
* Returns whether or not the user represented by this object has
* voice. If the User object has been obtained from a list of users
* in a channel, then this will reflect the user's voice status in
* that channel.
*
* @return true if the user has voice in the channel.
*/
public boolean hasVoice() {
return _prefix.indexOf('+') >= 0;
}
/**
* Returns the nick of the user.
*
* @return The user's nick.
*/
public String getNick() {
return _nick;
}
/**
* Returns the nick of the user complete with their prefix if they
* have one, e.g. "@Dave".
*
* @return The user's prefix and nick.
*/
public String toString() {
return this.getPrefix() + this.getNick();
}
/**
* Returns true if the nick represented by this User object is the same
* as the argument. A case insensitive comparison is made.
*
* @return true if the nicks are identical (case insensitive).
*/
public boolean equals(String nick) {
return nick.toLowerCase(Locale.ENGLISH).equals(_lowerNick);
}
/**
* Returns true if the nick represented by this User object is the same
* as the nick of the User object given as an argument.
* A case insensitive comparison is made.
*
* @return true if o is a User object with a matching lowercase nick.
*/
public boolean equals(Object o) {
if (o instanceof User) {
User other = (User) o;
return other._lowerNick.equals(_lowerNick);
}
return false;
}
/**
* Returns the hash code of this User object.
*
* @return the hash code of the User object.
*/
public int hashCode() {
return _lowerNick.hashCode();
}
/**
* Returns the result of calling the compareTo method on lowercased
* nicks. This is useful for sorting lists of User objects.
*
* @return the result of calling compareTo on lowercased nicks.
*/
public int compareTo(Object o) {
if (o instanceof User) {
User other = (User) o;
return other._lowerNick.compareTo(_lowerNick);
}
return -1;
}
private String _prefix;
private String _nick;
private String _lowerNick;
}

View File

@@ -28,7 +28,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.7</version>
<version>2.0</version>
<executions>
<execution>
<goals>