mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-23 16:08:18 -05:00
Minecraft 1.13.2 compatibility and optimizations
This commit is contained in:
parent
ce372d2200
commit
93b968be5d
6 changed files with 1146 additions and 690 deletions
521
checkstyle.xml
Normal file
521
checkstyle.xml
Normal file
|
@ -0,0 +1,521 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE module PUBLIC
|
||||||
|
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||||
|
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||||
|
|
||||||
|
<module name="Checker">
|
||||||
|
<!--
|
||||||
|
If you set the basedir property below, then all reported file
|
||||||
|
names will be relative to the specified directory. See
|
||||||
|
https://checkstyle.org/config.html#Checker
|
||||||
|
|
||||||
|
<property name="basedir" value="${basedir}"/>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<metadata name="org.checkstyle.principle" value="Practice What You Preach"/>
|
||||||
|
<metadata name="org.checkstyle.principle.description"
|
||||||
|
value="In our config we should use all Checks that Checkstyle has"/>
|
||||||
|
|
||||||
|
<property name="cacheFile" value="${checkstyle.cache.file}"/>
|
||||||
|
|
||||||
|
<property name="severity" value="error"/>
|
||||||
|
|
||||||
|
<property name="fileExtensions" value="java, properties, xml, vm, g, g4, dtd"/>
|
||||||
|
|
||||||
|
<!-- BeforeExecutionFileFilters is required for sources that are based on java9 -->
|
||||||
|
<module name="BeforeExecutionExclusionFileFilter">
|
||||||
|
<property name="fileNamePattern" value="module\-info\.java$" />
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Filters -->
|
||||||
|
<module name="SeverityMatchFilter">
|
||||||
|
<!-- report all violations except ignore -->
|
||||||
|
<property name="severity" value="ignore"/>
|
||||||
|
<property name="acceptOnMatch" value="false"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressWithPlainTextCommentFilter">
|
||||||
|
<!--
|
||||||
|
Use suppressions.xml for suppressions, this is only example.
|
||||||
|
checkFormat will prevent suppression comments from being valid.
|
||||||
|
-->
|
||||||
|
<property name="checkFormat" value="IGNORETHIS"/>
|
||||||
|
<property name="offCommentFormat" value="CSOFF\: .*"/>
|
||||||
|
<property name="onCommentFormat" value="CSON\: .*"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Miscellaneous -->
|
||||||
|
<module name="NewlineAtEndOfFile"/>
|
||||||
|
<module name="Translation">
|
||||||
|
<property name="requiredTranslations" value="de, fr, fi, es, pt, ja, tr, zh"/>
|
||||||
|
</module>
|
||||||
|
<module name="UniqueProperties"/>
|
||||||
|
|
||||||
|
<!-- Regexp -->
|
||||||
|
<module name="RegexpMultiline"/>
|
||||||
|
<module name="RegexpMultiline">
|
||||||
|
<property name="format" value="\r?\n[\t ]*\r?\n[\t ]*\r?\n"/>
|
||||||
|
<property name="fileExtensions" value="java,xml,properties"/>
|
||||||
|
<property name="message" value="Unnecessary consecutive lines"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpMultiline">
|
||||||
|
<property name="format" value="/\*\*\W+\* +\p{javaLowerCase}"/>
|
||||||
|
<property name="fileExtensions" value="java"/>
|
||||||
|
<property name="message"
|
||||||
|
value="First sentence in a comment should start with a capital letter"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<property name="format" value="\s+$"/>
|
||||||
|
<property name="minimum" value="0"/>
|
||||||
|
<property name="maximum" value="0"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<property name="format" value="/\*\* +\p{javaLowerCase}"/>
|
||||||
|
<property name="fileExtensions" value="java"/>
|
||||||
|
<property name="message"
|
||||||
|
value="First sentence in a comment should start with a capital letter"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<property name="format" value="^(?!(.*http|import)).{101,}$"/>
|
||||||
|
<property name="fileExtensions" value="g, g4"/>
|
||||||
|
<property name="message" value="Line should not be longer than 100 symbols"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<property name="format" value="^(?!(\s*<a href="[^"]+">|.*http)).{101,}$"/>
|
||||||
|
<property name="fileExtensions" value="xml, vm"/>
|
||||||
|
<property name="message" value="Line should not be longer than 100 symbols"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<property name="id" value="noSourceforgeNetLinks"/>
|
||||||
|
<property name="format" value="checkstyle\.sourceforge\.net"/>
|
||||||
|
<property name="message"
|
||||||
|
value="Old site links should not be used, please use https://checkstyle.org"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<property name="id" value="noSourceforgeIoLinks"/>
|
||||||
|
<property name="format" value="checkstyle\.sourceforge\.io"/>
|
||||||
|
<property name="message"
|
||||||
|
value="Old site links should not be used, please use https://checkstyle.org"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpOnFilename" />
|
||||||
|
<module name="RegexpOnFilename">
|
||||||
|
<property name="folderPattern" value="[\\/]src[\\/]\w+[\\/]java[\\/]"/>
|
||||||
|
<property name="fileNamePattern" value="\.java$"/>
|
||||||
|
<property name="match" value="false"/>
|
||||||
|
<message key="regexp.filepath.mismatch"
|
||||||
|
value="Only java files should be located in the ''src/*/java'' folders."/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpOnFilename">
|
||||||
|
<property name="folderPattern" value="[\\/]src[\\/]xdocs[\\/]"/>
|
||||||
|
<property name="fileNamePattern" value="\.(xml)|(vm)$"/>
|
||||||
|
<property name="match" value="false"/>
|
||||||
|
<message key="regexp.filepath.mismatch"
|
||||||
|
value="All files in the ''src/xdocs'' folder should have the ''xml'' or ''vm'' extension."/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpOnFilename">
|
||||||
|
<property name="folderPattern" value="[\\/]src[\\/]it[\\/]java[\\/]"/>
|
||||||
|
<property name="fileNamePattern" value="^((\w+Test)|(\w+TestSupport)|(Abstract\w+))\.java$"/>
|
||||||
|
<property name="match" value="false"/>
|
||||||
|
<message key="regexp.filepath.mismatch"
|
||||||
|
value="All files in the ''src/it/java'' folder
|
||||||
|
should be named ''*Test.java'' or ''Abstract*.java''."/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Size Violations -->
|
||||||
|
<module name="FileLength">
|
||||||
|
<property name="fileExtensions" value="java"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Whitespace -->
|
||||||
|
<module name="TreeWalker">
|
||||||
|
<property name="tabWidth" value="4"/>
|
||||||
|
|
||||||
|
<!-- Annotations -->
|
||||||
|
<module name="AnnotationLocation">
|
||||||
|
<property name="tokens" value="ANNOTATION_DEF"/>
|
||||||
|
<property name="tokens" value="ANNOTATION_FIELD_DEF"/>
|
||||||
|
<property name="tokens" value="PACKAGE_DEF"/>
|
||||||
|
<property name="tokens" value="ENUM_CONSTANT_DEF"/>
|
||||||
|
<property name="tokens" value="VARIABLE_DEF"/>
|
||||||
|
<property name="allowSamelineSingleParameterlessAnnotation" value="false"/>
|
||||||
|
</module>
|
||||||
|
<module name="AnnotationOnSameLine">
|
||||||
|
<!-- we can not use it as it conflicts with AnnotationLocation -->
|
||||||
|
<property name="severity" value="ignore"/>
|
||||||
|
<property name="tokens" value="METHOD_DEF"/>
|
||||||
|
<property name="tokens" value="CTOR_DEF"/>
|
||||||
|
<property name="tokens" value="TYPECAST"/>
|
||||||
|
<property name="tokens" value="DOT"/>
|
||||||
|
<property name="tokens" value="CLASS_DEF"/>
|
||||||
|
<property name="tokens" value="ENUM_DEF"/>
|
||||||
|
<property name="tokens" value="INTERFACE_DEF"/>
|
||||||
|
<property name="tokens" value="TYPE_ARGUMENT"/>
|
||||||
|
<property name="tokens" value="ANNOTATION_DEF"/>
|
||||||
|
<property name="tokens" value="LITERAL_NEW"/>
|
||||||
|
<property name="tokens" value="LITERAL_THROWS"/>
|
||||||
|
<property name="tokens" value="VARIABLE_DEF"/>
|
||||||
|
<property name="tokens" value="PARAMETER_DEF"/>
|
||||||
|
<property name="tokens" value="IMPLEMENTS_CLAUSE"/>
|
||||||
|
<property name="tokens" value="ANNOTATION_FIELD_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="AnnotationUseStyle"/>
|
||||||
|
<module name="MissingDeprecated"/>
|
||||||
|
<module name="MissingOverride"/>
|
||||||
|
<module name="PackageAnnotation"/>
|
||||||
|
<module name="SuppressWarnings">
|
||||||
|
<property name="format" value="^((?!unchecked|deprecation|rawtypes|resource).)*$"/>
|
||||||
|
<message key="suppressed.warning.not.allowed"
|
||||||
|
value="The warning ''{0}'' cannot be suppressed at this location.
|
||||||
|
Only few javac warnings are allowed to suppress.
|
||||||
|
If try to suppress checkstyle/pmd/..... violation please do this in their config file.
|
||||||
|
If you try to suppress IntelliJ IDEA inspection,
|
||||||
|
please use javadoc block tag @noinspection"
|
||||||
|
/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressWarningsHolder"/>
|
||||||
|
|
||||||
|
<!-- Block Checks -->
|
||||||
|
<module name="AvoidNestedBlocks">
|
||||||
|
<property name="allowInSwitchCase" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="NeedBraces"/>
|
||||||
|
<module name="NeedBraces">
|
||||||
|
<property name="tokens" value="LAMBDA"/>
|
||||||
|
<property name="allowSingleLineStatement" value="true"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Class Design -->
|
||||||
|
<module name="DesignForExtension">
|
||||||
|
<property name="ignoredAnnotations"
|
||||||
|
value="Override, Test, Before, After, BeforeClass, AfterClass"/>
|
||||||
|
</module>
|
||||||
|
<module name="FinalClass"/>
|
||||||
|
<module name="HideUtilityClassConstructor"/>
|
||||||
|
<module name="InnerTypeLast"/>
|
||||||
|
<module name="InterfaceIsType"/>
|
||||||
|
<module name="MutableException"/>
|
||||||
|
<module name="OneTopLevelClass"/>
|
||||||
|
<module name="ThrowsCount">
|
||||||
|
<property name="max" value="2"/>
|
||||||
|
</module>
|
||||||
|
<module name="VisibilityModifier"/>
|
||||||
|
|
||||||
|
<!-- Coding -->
|
||||||
|
<module name="ArrayTrailingComma"/>
|
||||||
|
<module name="AvoidInlineConditionals"/>
|
||||||
|
<module name="CovariantEquals"/>
|
||||||
|
<module name="DeclarationOrder"/>
|
||||||
|
<module name="DefaultComesLast"/>
|
||||||
|
<module name="EmptyStatement"/>
|
||||||
|
<module name="EqualsAvoidNull"/>
|
||||||
|
<module name="EqualsHashCode"/>
|
||||||
|
<module name="ExplicitInitialization"/>
|
||||||
|
<module name="FallThrough"/>
|
||||||
|
<module name="FinalLocalVariable"/>
|
||||||
|
<module name="HiddenField">
|
||||||
|
<property name="ignoreConstructorParameter" value="true"/>
|
||||||
|
<property name="ignoreSetter" value="true"/>
|
||||||
|
<property name="setterCanReturnItsClass" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="IllegalInstantiation">
|
||||||
|
<property name="classes"
|
||||||
|
value="org.xml.sax.SAXException, org.xml.sax.SAXParseException,
|
||||||
|
org.apache.commons.beanutils.ConversionException,
|
||||||
|
org.antlr.v4.runtime.misc.ParseCancellationException,
|
||||||
|
antlr.RecognitionException, antlr.TokenStreamException,
|
||||||
|
antlr.TokenStreamRecognitionException, antlr.ANTLRException,
|
||||||
|
java.lang.StringBuffer"/>
|
||||||
|
</module>
|
||||||
|
<module name="IllegalThrows"/>
|
||||||
|
<module name="IllegalToken">
|
||||||
|
<property name="tokens" value="LABELED_STAT"/>
|
||||||
|
<property name="tokens" value="LITERAL_NATIVE"/>
|
||||||
|
<property name="tokens" value="LITERAL_VOLATILE"/>
|
||||||
|
<property name="tokens" value="LITERAL_ASSERT"/>
|
||||||
|
</module>
|
||||||
|
<module name="IllegalTokenText">
|
||||||
|
<property name="tokens" value="STRING_LITERAL"/>
|
||||||
|
<property name="format" value="^(US-ASCII|ISO-8859-1|UTF-8|UTF-16BE|UTF-16LE|UTF-16)$"/>
|
||||||
|
<property name="ignoreCase" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="IllegalType">
|
||||||
|
<property name="illegalClassNames"
|
||||||
|
value="java.util.HashSet, HashSet, java.util.LinkedHashMap, LinkedHashMap,
|
||||||
|
java.util.TreeMap, TreeMap, java.util.HashMap, HashMap,
|
||||||
|
java.util.LinkedHashSet, LinkedHashSet, java.util.TreeSet, TreeSet,
|
||||||
|
java.lang.StringBuffer, StringBuffer"/>
|
||||||
|
</module>
|
||||||
|
<module name="InnerAssignment"/>
|
||||||
|
<module name="MissingCtor">
|
||||||
|
<!--
|
||||||
|
we will not use that fanatic validation, extra code is not good
|
||||||
|
But this Check will exists as it was created by community demand.
|
||||||
|
-->
|
||||||
|
<property name="severity" value="ignore"/>
|
||||||
|
</module>
|
||||||
|
<module name="MissingSwitchDefault"/>
|
||||||
|
<module name="ModifiedControlVariable"/>
|
||||||
|
<module name="MultipleVariableDeclarations"/>
|
||||||
|
<module name="NestedForDepth">
|
||||||
|
<property name="max" value="2"/>
|
||||||
|
</module>
|
||||||
|
<module name="NestedIfDepth">
|
||||||
|
<property name="max" value="3"/>
|
||||||
|
</module>
|
||||||
|
<module name="NestedTryDepth"/>
|
||||||
|
<module name="NoClone"/>
|
||||||
|
<module name="NoFinalizer"/>
|
||||||
|
<module name="OneStatementPerLine"/>
|
||||||
|
<module name="OverloadMethodsDeclarationOrder"/>
|
||||||
|
<module name="PackageDeclaration"/>
|
||||||
|
<module name="ParameterAssignment"/>
|
||||||
|
<module name="RequireThis"/>
|
||||||
|
<module name="ReturnCount">
|
||||||
|
<property name="max" value="1"/>
|
||||||
|
<property name="maxForVoid" value="0"/>
|
||||||
|
</module>
|
||||||
|
<module name="SimplifyBooleanExpression"/>
|
||||||
|
<module name="SimplifyBooleanReturn"/>
|
||||||
|
<module name="StringLiteralEquality"/>
|
||||||
|
<module name="SuperClone"/>
|
||||||
|
<module name="SuperFinalize"/>
|
||||||
|
<module name="UnnecessaryParentheses"/>
|
||||||
|
<module name="VariableDeclarationUsageDistance"/>
|
||||||
|
|
||||||
|
<!-- Filters-->
|
||||||
|
<module name="SuppressionCommentFilter">
|
||||||
|
<!--
|
||||||
|
Use suppressions.xml for suppressions, this is only example.
|
||||||
|
checkFormat will prevent suppression comments from being valid.
|
||||||
|
-->
|
||||||
|
<property name="checkFormat" value="IGNORETHIS"/>
|
||||||
|
<property name="offCommentFormat" value="CSOFF\: .*"/>
|
||||||
|
<property name="onCommentFormat" value="CSON\: .*"/>
|
||||||
|
</module>
|
||||||
|
<!-- Tone down the checking for test code -->
|
||||||
|
<module name="SuppressionXpathSingleFilter">
|
||||||
|
<property name="files" value="[\\/]internal[\\/].*[\\/]\w+Util\.java"/>
|
||||||
|
<property name="checks" value="IllegalCatch"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressionXpathSingleFilter">
|
||||||
|
<property name="files" value=".*[\\/]src[\\/]test[\\/]"/>
|
||||||
|
<property name="checks" value="EmptyBlock"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressionXpathSingleFilter">
|
||||||
|
<property name="files" value=".*[\\/]src[\\/](test|it)[\\/]"/>
|
||||||
|
<property name="checks" value="JavadocVariable"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressionXpathSingleFilter">
|
||||||
|
<property name="files" value=".*[\\/]src[\\/](test|it)[\\/]"/>
|
||||||
|
<property name="checks" value="JavadocType"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressionXpathSingleFilter">
|
||||||
|
<property name="files" value=".*[\\/]src[\\/](test|it)[\\/]"/>
|
||||||
|
<property name="checks" value="MagicNumber"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressionXpathSingleFilter">
|
||||||
|
<property name="files" value=".*[\\/]src[\\/](test|it)[\\/]"/>
|
||||||
|
<property name="checks" value="AvoidStaticImport"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressionXpathSingleFilter">
|
||||||
|
<property name="files" value=".*[\\/]src[\\/](test|it)[\\/]"/>
|
||||||
|
<property name="checks" value="WriteTag"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressionXpathSingleFilter">
|
||||||
|
<property name="files" value=".*[\\/]src[\\/](test|it)[\\/]"/>
|
||||||
|
<property name="checks" value="MethodCount"/>
|
||||||
|
</module>
|
||||||
|
<!-- Fixing these cases will decrease code readability -->
|
||||||
|
<module name="SuppressionXpathSingleFilter">
|
||||||
|
<property name="files" value=".*[\\/]src[\\/](test|it)[\\/]"/>
|
||||||
|
<property name="checks" value="MultipleStringLiterals"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressWithNearbyCommentFilter">
|
||||||
|
<property name="commentFormat"
|
||||||
|
value="-@cs\[(\w{8,}(\|\w{8,})*)\] \w[\(\)\-\.\'\`\,\:\;\w ]{10,}"/>
|
||||||
|
<property name="checkFormat" value="$1"/>
|
||||||
|
<property name="influenceFormat" value="3"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Imports -->
|
||||||
|
<module name="AvoidStarImport"/>
|
||||||
|
<module name="AvoidStaticImport"/>
|
||||||
|
<module name="CustomImportOrder">
|
||||||
|
<property name="customImportOrderRules"
|
||||||
|
value="STATIC###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS"/>
|
||||||
|
<property name="specialImportsRegExp" value="^org\."/>
|
||||||
|
<property name="sortImportsInGroupAlphabetically" value="true"/>
|
||||||
|
<property name="separateLineBetweenGroups" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="IllegalImport"/>
|
||||||
|
<module name="ImportOrder">
|
||||||
|
<property name="groups" value="/^java\./,javax,org"/>
|
||||||
|
<property name="ordered" value="true"/>
|
||||||
|
<property name="separated" value="true"/>
|
||||||
|
<property name="option" value="top"/>
|
||||||
|
<property name="sortStaticImportsAlphabetically" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="RedundantImport"/>
|
||||||
|
<module name="UnusedImports"/>
|
||||||
|
|
||||||
|
<!-- Metrics -->
|
||||||
|
<module name="BooleanExpressionComplexity">
|
||||||
|
<property name="max" value="7"/>
|
||||||
|
</module>
|
||||||
|
<module name="ClassDataAbstractionCoupling">
|
||||||
|
<!-- Default classes are also listed-->
|
||||||
|
<property name="excludedClasses"
|
||||||
|
value="boolean, byte, char, double, float, int, long, short, void,
|
||||||
|
Boolean, Byte, Character, Double, Float, Integer, Long, Short, Void,
|
||||||
|
Object, Class, String, StringBuffer, StringBuilder,
|
||||||
|
ArrayIndexOutOfBoundsException, Exception, RuntimeException,
|
||||||
|
IllegalArgumentException, IllegalStateException,
|
||||||
|
IndexOutOfBoundsException, NullPointerException, Throwable,
|
||||||
|
SecurityException, UnsupportedOperationException, List, ArrayList,
|
||||||
|
Deque, Queue, LinkedList, Set, HashSet, SortedSet, TreeSet, Map,
|
||||||
|
HashMap, SortedMap, TreeMap, DetailsAST,
|
||||||
|
UnsupportedEncodingException, BuildException, ConversionException,
|
||||||
|
FileNotFoundException, TestException"/>
|
||||||
|
</module>
|
||||||
|
<module name="NPathComplexity"/>
|
||||||
|
|
||||||
|
<!-- Misc -->
|
||||||
|
<module name="ArrayTypeStyle"/>
|
||||||
|
<module name="AvoidEscapedUnicodeCharacters">
|
||||||
|
<property name="allowIfAllCharactersEscaped" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="CommentsIndentation"/>
|
||||||
|
<module name="DescendantToken"/>
|
||||||
|
<module name="FinalParameters">
|
||||||
|
<!--
|
||||||
|
we will not use that fanatic validation, extra modifiers pollute a code
|
||||||
|
it is better to use extra validation(Check) that argument is reassigned
|
||||||
|
But this Check will exists as it was created by community demand.
|
||||||
|
-->
|
||||||
|
<property name="severity" value="ignore"/>
|
||||||
|
</module>
|
||||||
|
<module name="Indentation">
|
||||||
|
<property name="basicOffset" value="4"/>
|
||||||
|
<property name="braceAdjustment" value="0"/>
|
||||||
|
<property name="caseIndent" value="4"/>
|
||||||
|
<property name="throwsIndent" value="8"/>
|
||||||
|
</module>
|
||||||
|
<module name="OuterTypeFilename"/>
|
||||||
|
<module name="TodoComment">
|
||||||
|
<property name="format" value="(TODO)|(FIXME)" />
|
||||||
|
</module>
|
||||||
|
<module name="TrailingComment"/>
|
||||||
|
<module name="UncommentedMain">
|
||||||
|
<property name="excludedClasses" value="\.(Main|JavadocPropertiesGenerator)$"/>
|
||||||
|
</module>
|
||||||
|
<module name="UpperEll"/>
|
||||||
|
|
||||||
|
<!-- Modifiers -->
|
||||||
|
<module name="ClassMemberImpliedModifier">
|
||||||
|
<!-- effectively the opposite of RedundantModifier, so output must be ignored -->
|
||||||
|
<property name="severity" value="ignore"/>
|
||||||
|
</module>
|
||||||
|
<module name="InterfaceMemberImpliedModifier">
|
||||||
|
<!-- effectively the opposite of RedundantModifier, so output must be ignored -->
|
||||||
|
<property name="severity" value="ignore"/>
|
||||||
|
</module>
|
||||||
|
<module name="ModifierOrder"/>
|
||||||
|
<module name="RedundantModifier"/>
|
||||||
|
|
||||||
|
<!-- Naming Conventions -->
|
||||||
|
<module name="AbstractClassName"/>
|
||||||
|
<module name="ClassTypeParameterName"/>
|
||||||
|
<module name="ConstantName"/>
|
||||||
|
<module name="InterfaceTypeParameterName"/>
|
||||||
|
<module name="LocalFinalVariableName"/>
|
||||||
|
<module name="LocalVariableName">
|
||||||
|
<property name="format" value="^(id)|([a-z][a-z0-9][a-zA-Z0-9]+)$"/>
|
||||||
|
<property name="allowOneCharVarInForLoop" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="MemberName">
|
||||||
|
<property name="format" value="^(id)|([a-z][a-z0-9][a-zA-Z0-9]+)$"/>
|
||||||
|
</module>
|
||||||
|
<module name="MethodName"/>
|
||||||
|
<module name="MethodTypeParameterName"/>
|
||||||
|
<module name="PackageName"/>
|
||||||
|
<module name="ParameterName">
|
||||||
|
<property name="format" value="^(id)|([a-z][a-z0-9][a-zA-Z0-9]+)$"/>
|
||||||
|
<property name="ignoreOverridden" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="LambdaParameterName">
|
||||||
|
<property name="format" value="^(id)|([a-z][a-z0-9][a-zA-Z0-9]+)$"/>
|
||||||
|
</module>
|
||||||
|
<module name="CatchParameterName">
|
||||||
|
<property name="format" value="^(ex|[a-z][a-z][a-zA-Z]+)$"/>
|
||||||
|
</module>
|
||||||
|
<module name="StaticVariableName">
|
||||||
|
<property name="format" value="^(id)|([a-z][a-z0-9][a-zA-Z0-9]+)$"/>
|
||||||
|
</module>
|
||||||
|
<module name="TypeName"/>
|
||||||
|
|
||||||
|
<!-- Regexp -->
|
||||||
|
<module name="Regexp"/>
|
||||||
|
<module name="RegexpSinglelineJava"/>
|
||||||
|
<module name="RegexpSinglelineJava">
|
||||||
|
<property name="format" value="[^\p{ASCII}]"/>
|
||||||
|
<property name="ignoreComments" value="true"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Size Violations -->
|
||||||
|
<module name="AnonInnerLength"/>
|
||||||
|
<module name="ExecutableStatementCount">
|
||||||
|
<property name="max" value="30"/>
|
||||||
|
</module>
|
||||||
|
<module name="MethodCount">
|
||||||
|
<property name="maxTotal" value="34"/>
|
||||||
|
</module>
|
||||||
|
<module name="MethodLength"/>
|
||||||
|
<module name="OuterTypeNumber"/>
|
||||||
|
<module name="ParameterNumber"/>
|
||||||
|
|
||||||
|
<!-- Whitespace -->
|
||||||
|
<module name="EmptyForInitializerPad"/>
|
||||||
|
<module name="EmptyForIteratorPad"/>
|
||||||
|
<module name="EmptyLineSeparator">
|
||||||
|
<property name="allowNoEmptyLineBetweenFields" value="true"/>
|
||||||
|
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
|
||||||
|
</module>
|
||||||
|
<module name="GenericWhitespace"/>
|
||||||
|
<module name="MethodParamPad"/>
|
||||||
|
<module name="NoLineWrap"/>
|
||||||
|
<module name="NoWhitespaceAfter">
|
||||||
|
<property name="tokens" value="ARRAY_INIT"/>
|
||||||
|
<property name="tokens" value="AT"/>
|
||||||
|
<property name="tokens" value="BNOT"/>
|
||||||
|
<property name="tokens" value="DEC"/>
|
||||||
|
<property name="tokens" value="DOT"/>
|
||||||
|
<property name="tokens" value="INC"/>
|
||||||
|
<property name="tokens" value="LNOT"/>
|
||||||
|
<property name="tokens" value="UNARY_MINUS"/>
|
||||||
|
<property name="tokens" value="UNARY_PLUS"/>
|
||||||
|
<property name="tokens" value="ARRAY_DECLARATOR"/>
|
||||||
|
<property name="tokens" value="INDEX_OP"/>
|
||||||
|
<property name="tokens" value="METHOD_REF"/>
|
||||||
|
</module>
|
||||||
|
<module name="NoWhitespaceBefore"/>
|
||||||
|
<module name="NoWhitespaceBefore">
|
||||||
|
<property name="tokens" value="DOT"/>
|
||||||
|
<property name="tokens" value="METHOD_REF"/>
|
||||||
|
<property name="allowLineBreaks" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="ParenPad"/>
|
||||||
|
<module name="SeparatorWrap">
|
||||||
|
<property name="tokens" value="DOT"/>
|
||||||
|
<property name="tokens" value="AT"/>
|
||||||
|
<property name="tokens" value="METHOD_REF"/>
|
||||||
|
<property name="option" value="nl"/>
|
||||||
|
</module>
|
||||||
|
<module name="SingleSpaceSeparator">
|
||||||
|
<property name="validateComments" value="false"/>
|
||||||
|
</module>
|
||||||
|
<module name="TypecastParenPad"/>
|
||||||
|
<module name="WhitespaceAfter"/>
|
||||||
|
<module name="WhitespaceAround"/>
|
||||||
|
|
||||||
|
</module>
|
||||||
|
|
||||||
|
</module>
|
16
pom.xml
16
pom.xml
|
@ -4,8 +4,8 @@
|
||||||
<artifactId>Extras</artifactId>
|
<artifactId>Extras</artifactId>
|
||||||
<version>master</version>
|
<version>master</version>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.7</maven.compiler.target>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.destroystokyo.paper</groupId>
|
<groupId>com.destroystokyo.paper</groupId>
|
||||||
<artifactId>paper-api</artifactId>
|
<artifactId>paper-api</artifactId>
|
||||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -27,6 +27,16 @@
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<configuration>
|
||||||
|
<configLocation>${basedir}/checkstyle.xml</configLocation>
|
||||||
|
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||||
|
<enableRulesSummary>false</enableRulesSummary>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
|
|
@ -2,14 +2,9 @@ package pw.kaboom.extras;
|
||||||
|
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
import com.destroystokyo.paper.profile.PlayerProfile;
|
|
||||||
import com.destroystokyo.paper.profile.ProfileProperty;
|
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
@ -30,16 +25,19 @@ import org.bukkit.enchantments.Enchantment;
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.HumanEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import org.bukkit.util.BlockIterator;
|
import org.bukkit.util.BlockIterator;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import com.destroystokyo.paper.profile.PlayerProfile;
|
||||||
|
import com.destroystokyo.paper.profile.ProfileProperty;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
class CommandClearChat implements CommandExecutor {
|
class CommandClearChat implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||||
|
@ -54,7 +52,7 @@ class CommandClearChat implements CommandExecutor {
|
||||||
|
|
||||||
class CommandConsole implements CommandExecutor {
|
class CommandConsole implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <message ..>");
|
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <message ..>");
|
||||||
|
@ -67,7 +65,7 @@ class CommandConsole implements CommandExecutor {
|
||||||
|
|
||||||
class CommandDestroyEntities implements CommandExecutor {
|
class CommandDestroyEntities implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
|
|
||||||
for (World world : Bukkit.getServer().getWorlds()) {
|
for (World world : Bukkit.getServer().getWorlds()) {
|
||||||
for (Entity entity : world.getEntities()) {
|
for (Entity entity : world.getEntities()) {
|
||||||
|
@ -83,8 +81,8 @@ class CommandDestroyEntities implements CommandExecutor {
|
||||||
|
|
||||||
class CommandEnchantAll implements CommandExecutor {
|
class CommandEnchantAll implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
ItemStack item = player.getInventory().getItemInMainHand();
|
final ItemStack item = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
if (item.getType() == Material.AIR) {
|
if (item.getType() == Material.AIR) {
|
||||||
player.sendMessage("Please hold an item in your hand to enchant it");
|
player.sendMessage("Please hold an item in your hand to enchant it");
|
||||||
|
@ -132,25 +130,23 @@ class CommandHerobrine implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnHerobrine(Player player) {
|
private void spawnHerobrine(Player player) {
|
||||||
Location location = player.getLocation();
|
final Location location = player.getLocation();
|
||||||
|
|
||||||
Player herobrine = (Player) location.getWorld().spawnEntity(
|
final Player herobrine = (Player) location.getWorld().spawnEntity(
|
||||||
location.add(location.getDirection().multiply(6)),
|
location.add(location.getDirection().multiply(6)),
|
||||||
EntityType.PLAYER
|
EntityType.PLAYER
|
||||||
);
|
);
|
||||||
main.getSkin("Herobrine", herobrine);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
Location location = player.getLocation();
|
final Location location = player.getLocation();
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
Player herobrine = (Player) location.getWorld().spawnEntity(
|
final Player herobrine = (Player) location.getWorld().spawnEntity(
|
||||||
location,
|
location,
|
||||||
EntityType.PLAYER
|
EntityType.PLAYER
|
||||||
);
|
);
|
||||||
main.getSkin("Herobrine", herobrine);
|
|
||||||
} else {
|
} else {
|
||||||
if (args[0].equals("*") || args[0].equals("**")) {
|
if (args[0].equals("*") || args[0].equals("**")) {
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
@ -158,7 +154,8 @@ class CommandHerobrine implements CommandExecutor {
|
||||||
}
|
}
|
||||||
player.sendMessage("Successfully spawned Herobrine behind every player");
|
player.sendMessage("Successfully spawned Herobrine behind every player");
|
||||||
} else {
|
} else {
|
||||||
Player target = Bukkit.getPlayer(args[0]);
|
final Player target = Bukkit.getPlayer(args[0]);
|
||||||
|
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
spawnHerobrine(target);
|
spawnHerobrine(target);
|
||||||
player.sendMessage("Successfully spawned Herobrine behind player \"" + target.getName() + "\"");
|
player.sendMessage("Successfully spawned Herobrine behind player \"" + target.getName() + "\"");
|
||||||
|
@ -175,12 +172,12 @@ class CommandJumpscare implements CommandExecutor {
|
||||||
private void createJumpscare(Player player) {
|
private void createJumpscare(Player player) {
|
||||||
player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4);
|
player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4);
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMEN_SCREAM, 1, 0);
|
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_SCREAM, 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <player>");
|
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <player>");
|
||||||
|
@ -191,7 +188,7 @@ class CommandJumpscare implements CommandExecutor {
|
||||||
}
|
}
|
||||||
player.sendMessage("Successfully created jumpscare for every player");
|
player.sendMessage("Successfully created jumpscare for every player");
|
||||||
} else {
|
} else {
|
||||||
Player target = Bukkit.getPlayer(args[0]);
|
final Player target = Bukkit.getPlayer(args[0]);
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
createJumpscare(target);
|
createJumpscare(target);
|
||||||
player.sendMessage("Successfully created jumpscare for player \"" + target.getName() + "\"");
|
player.sendMessage("Successfully created jumpscare for player \"" + target.getName() + "\"");
|
||||||
|
@ -211,7 +208,7 @@ class CommandPrefix implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <prefix|off>");
|
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <prefix|off>");
|
||||||
|
@ -230,11 +227,11 @@ class CommandPrefix implements CommandExecutor {
|
||||||
|
|
||||||
class CommandPumpkin implements CommandExecutor {
|
class CommandPumpkin implements CommandExecutor {
|
||||||
private void placePumpkin(Player player) {
|
private void placePumpkin(Player player) {
|
||||||
player.getInventory().setHelmet(new ItemStack(Material.PUMPKIN));
|
player.getInventory().setHelmet(new ItemStack(Material.CARVED_PUMPKIN));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <player>");
|
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <player>");
|
||||||
|
@ -245,7 +242,7 @@ class CommandPumpkin implements CommandExecutor {
|
||||||
}
|
}
|
||||||
player.sendMessage("Everyone is now a pumpkin");
|
player.sendMessage("Everyone is now a pumpkin");
|
||||||
} else {
|
} else {
|
||||||
Player target = Bukkit.getPlayer(args[0]);
|
final Player target = Bukkit.getPlayer(args[0]);
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
placePumpkin(target);
|
placePumpkin(target);
|
||||||
player.sendMessage("Player \"" + target.getName() + "\" is now a pumpkin");
|
player.sendMessage("Player \"" + target.getName() + "\" is now a pumpkin");
|
||||||
|
@ -274,21 +271,21 @@ class CommandSkin implements CommandExecutor {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final String name = args[0];
|
final String name = args[0];
|
||||||
URL nameUrl = new URL("https://api.mojang.com/users/profiles/minecraft/" + name);
|
final URL nameUrl = new URL("https://api.mojang.com/users/profiles/minecraft/" + name);
|
||||||
HttpsURLConnection nameConnection = (HttpsURLConnection) nameUrl.openConnection();
|
final HttpsURLConnection nameConnection = (HttpsURLConnection) nameUrl.openConnection();
|
||||||
|
|
||||||
if (nameConnection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
|
if (nameConnection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
|
||||||
InputStreamReader nameStream = new InputStreamReader(nameConnection.getInputStream());
|
final InputStreamReader nameStream = new InputStreamReader(nameConnection.getInputStream());
|
||||||
String uuid = new JsonParser().parse(nameStream).getAsJsonObject().get("id").getAsString();
|
final String uuid = new JsonParser().parse(nameStream).getAsJsonObject().get("id").getAsString();
|
||||||
nameStream.close();
|
nameStream.close();
|
||||||
nameConnection.disconnect();
|
nameConnection.disconnect();
|
||||||
|
|
||||||
URL uuidUrl = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
final URL uuidUrl = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||||
HttpsURLConnection uuidConnection = (HttpsURLConnection) uuidUrl.openConnection();
|
final HttpsURLConnection uuidConnection = (HttpsURLConnection) uuidUrl.openConnection();
|
||||||
|
|
||||||
if (uuidConnection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
|
if (uuidConnection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
|
||||||
InputStreamReader uuidStream = new InputStreamReader(uuidConnection.getInputStream());
|
final InputStreamReader uuidStream = new InputStreamReader(uuidConnection.getInputStream());
|
||||||
JsonObject response = new JsonParser().parse(uuidStream).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
final JsonObject response = new JsonParser().parse(uuidStream).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||||
final String texture = response.get("value").getAsString();
|
final String texture = response.get("value").getAsString();
|
||||||
final String signature = response.get("signature").getAsString();
|
final String signature = response.get("signature").getAsString();
|
||||||
uuidStream.close();
|
uuidStream.close();
|
||||||
|
@ -334,17 +331,17 @@ class CommandSkin implements CommandExecutor {
|
||||||
|
|
||||||
class CommandSpawn implements CommandExecutor {
|
class CommandSpawn implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
World world = Bukkit.getWorld("world");
|
final World world = Bukkit.getWorld("world");
|
||||||
Location spawnLoc = world.getSpawnLocation();
|
final Location spawnLocation = world.getSpawnLocation();
|
||||||
|
|
||||||
for (double y = spawnLoc.getY(); y <= 256; y++) {
|
for (double y = spawnLocation.getY(); y <= 256; y++) {
|
||||||
Location yLoc = new Location(world, spawnLoc.getX(), y, spawnLoc.getZ());
|
final Location yLocation = new Location(world, spawnLocation.getX(), y, spawnLocation.getZ());
|
||||||
Block coordBlock = world.getBlockAt(yLoc);
|
final Block coordBlock = world.getBlockAt(yLocation);
|
||||||
|
|
||||||
if (coordBlock.getType().isTransparent() &&
|
if (!coordBlock.getType().isSolid() &&
|
||||||
coordBlock.getRelative(BlockFace.UP).getType().isTransparent()) {
|
!coordBlock.getRelative(BlockFace.UP).getType().isSolid()) {
|
||||||
player.teleport(yLoc);
|
player.teleport(yLocation);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,20 +353,20 @@ class CommandSpawn implements CommandExecutor {
|
||||||
|
|
||||||
class CommandSpidey implements CommandExecutor {
|
class CommandSpidey implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
Location eyePos = player.getEyeLocation();
|
final Location eyePos = player.getEyeLocation();
|
||||||
Vector playerPos = new Vector(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());
|
final Vector playerPos = new Vector(eyePos.getX(), eyePos.getY(), eyePos.getZ());
|
||||||
Vector direction = eyePos.getDirection();
|
final Vector direction = eyePos.getDirection();
|
||||||
int distance = 50;
|
final int distance = 50;
|
||||||
|
|
||||||
BlockIterator blockIterator = new BlockIterator(player.getWorld(), playerPos, direction, 0, distance);
|
final BlockIterator blockIterator = new BlockIterator(player.getWorld(), playerPos, direction, 0, distance);
|
||||||
|
|
||||||
while (blockIterator.hasNext()) {
|
while (blockIterator.hasNext()) {
|
||||||
if (blockIterator.next().getType() != Material.AIR) {
|
if (blockIterator.next().getType() != Material.AIR) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockIterator.next().setType(Material.WEB);
|
blockIterator.next().setType(Material.COBWEB);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -377,7 +374,7 @@ class CommandSpidey implements CommandExecutor {
|
||||||
|
|
||||||
class CommandTellraw implements CommandExecutor {
|
class CommandTellraw implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <message ..>");
|
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <message ..>");
|
||||||
|
@ -392,13 +389,14 @@ class CommandTellraw implements CommandExecutor {
|
||||||
|
|
||||||
class CommandUnloadChunks implements CommandExecutor {
|
class CommandUnloadChunks implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
|
|
||||||
for (World world : Bukkit.getServer().getWorlds()) {
|
for (World world : Bukkit.getServer().getWorlds()) {
|
||||||
for (Chunk chunk : world.getLoadedChunks()) {
|
for (Chunk chunk : world.getLoadedChunks()) {
|
||||||
chunk.unload(true);
|
chunk.unload(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendMessage("Successfully unloaded unused chunks");
|
player.sendMessage("Successfully unloaded unused chunks");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -410,21 +408,66 @@ class CommandUsername implements CommandExecutor {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, final String[] args) {
|
||||||
Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <username>");
|
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <username>");
|
||||||
} else {
|
} else {
|
||||||
String namelong = ChatColor.translateAlternateColorCodes('&', String.join(" ", args));
|
Bukkit.getScheduler().runTaskAsynchronously(main, new Runnable() {
|
||||||
String name = namelong.substring(0, Math.min(16, namelong.length()));
|
public void run() {
|
||||||
|
try {
|
||||||
|
String texture = "";
|
||||||
|
String signature = "";
|
||||||
|
|
||||||
PlayerProfile profile = player.getPlayerProfile();
|
final String namelong = ChatColor.translateAlternateColorCodes('&', String.join(" ", args));
|
||||||
|
final String name = namelong.substring(0, Math.min(16, namelong.length()));
|
||||||
|
|
||||||
|
final URL nameUrl = new URL("https://api.mojang.com/users/profiles/minecraft/" + name);
|
||||||
|
final HttpsURLConnection nameConnection = (HttpsURLConnection) nameUrl.openConnection();
|
||||||
|
|
||||||
|
if (nameConnection != null &&
|
||||||
|
nameConnection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
|
||||||
|
final InputStreamReader nameStream = new InputStreamReader(nameConnection.getInputStream());
|
||||||
|
final String uuid = new JsonParser().parse(nameStream).getAsJsonObject().get("id").getAsString();
|
||||||
|
nameStream.close();
|
||||||
|
nameConnection.disconnect();
|
||||||
|
|
||||||
|
final URL uuidUrl = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
||||||
|
final HttpsURLConnection uuidConnection = (HttpsURLConnection) uuidUrl.openConnection();
|
||||||
|
|
||||||
|
if (uuidConnection != null &&
|
||||||
|
uuidConnection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
|
||||||
|
final InputStreamReader uuidStream = new InputStreamReader(uuidConnection.getInputStream());
|
||||||
|
final JsonObject response = new JsonParser().parse(uuidStream).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
||||||
|
texture = response.get("value").getAsString();
|
||||||
|
signature = response.get("signature").getAsString();
|
||||||
|
|
||||||
|
uuidStream.close();
|
||||||
|
uuidConnection.disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final PlayerProfile profile = player.getPlayerProfile();
|
||||||
|
profile.clearProperties();
|
||||||
profile.setName(name);
|
profile.setName(name);
|
||||||
|
|
||||||
|
if (!("".equals(texture)) &&
|
||||||
|
!("".equals(signature))) {
|
||||||
|
profile.setProperty(new ProfileProperty("textures", texture, signature));
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTask(main, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
player.setPlayerProfile(profile);
|
player.setPlayerProfile(profile);
|
||||||
player.sendMessage("Successfully set your username to \"" + name + "\"");
|
player.sendMessage("Successfully set your username to \"" + name + "\"");
|
||||||
|
}
|
||||||
main.getSkin(name, player);
|
});
|
||||||
|
} catch (Exception exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,34 +1,20 @@
|
||||||
package pw.kaboom.extras;
|
package pw.kaboom.extras;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
|
|
||||||
import com.destroystokyo.paper.profile.PlayerProfile;
|
|
||||||
import com.destroystokyo.paper.profile.ProfileProperty;
|
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Color;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.destroystokyo.paper.profile.PlayerProfile;
|
||||||
|
|
||||||
public class Main extends JavaPlugin {
|
public class Main extends JavaPlugin {
|
||||||
int onlineCount = 0;
|
int fallingBlockCount;
|
||||||
int fallingBlockCount = 0;
|
|
||||||
HashMap<UUID, Long> commandMillisList = new HashMap<UUID, Long>();
|
HashMap<UUID, Long> commandMillisList = new HashMap<UUID, Long>();
|
||||||
HashMap<UUID, Long> interactMillisList = new HashMap<UUID, Long>();
|
HashMap<UUID, Long> interactMillisList = new HashMap<UUID, Long>();
|
||||||
HashMap<String, String> playerPremiumUUID = new HashMap<String, String>();
|
HashMap<String, PlayerProfile> playerProfile = new HashMap<String, PlayerProfile>();
|
||||||
HashSet<String> consoleCommandBlacklist = new HashSet<String>(Arrays.asList(new String[] {
|
HashSet<String> consoleCommandBlacklist = new HashSet<String>(Arrays.asList(new String[] {
|
||||||
"essentials:action",
|
"essentials:action",
|
||||||
"essentials:adventure",
|
"essentials:adventure",
|
||||||
|
@ -361,75 +347,202 @@ public class Main extends JavaPlugin {
|
||||||
Material.SAND,
|
Material.SAND,
|
||||||
}));
|
}));
|
||||||
HashSet<Material> nonSolidDoubleBlockList = new HashSet<Material>(Arrays.asList(new Material[] {
|
HashSet<Material> nonSolidDoubleBlockList = new HashSet<Material>(Arrays.asList(new Material[] {
|
||||||
Material.LONG_GRASS,
|
Material.GRASS,
|
||||||
Material.SIGN_POST,
|
Material.SIGN,
|
||||||
Material.WOODEN_DOOR,
|
Material.OAK_DOOR,
|
||||||
Material.IRON_DOOR_BLOCK,
|
Material.IRON_DOOR,
|
||||||
Material.CACTUS,
|
Material.CACTUS,
|
||||||
Material.SUGAR_CANE_BLOCK,
|
Material.SUGAR_CANE,
|
||||||
Material.CAKE_BLOCK,
|
Material.CAKE,
|
||||||
Material.DAYLIGHT_DETECTOR,
|
Material.DAYLIGHT_DETECTOR,
|
||||||
Material.CARPET,
|
Material.BLACK_CARPET,
|
||||||
Material.DOUBLE_PLANT,
|
Material.BLUE_CARPET,
|
||||||
Material.STANDING_BANNER,
|
Material.BROWN_CARPET,
|
||||||
Material.DAYLIGHT_DETECTOR_INVERTED,
|
Material.CYAN_CARPET,
|
||||||
|
Material.GRAY_CARPET,
|
||||||
|
Material.GREEN_CARPET,
|
||||||
|
Material.LIGHT_BLUE_CARPET,
|
||||||
|
Material.LIGHT_GRAY_CARPET,
|
||||||
|
Material.LIME_CARPET,
|
||||||
|
Material.MAGENTA_CARPET,
|
||||||
|
Material.ORANGE_CARPET,
|
||||||
|
Material.PINK_CARPET,
|
||||||
|
Material.PURPLE_CARPET,
|
||||||
|
Material.RED_CARPET,
|
||||||
|
Material.WHITE_CARPET,
|
||||||
|
Material.YELLOW_CARPET,
|
||||||
|
Material.BLACK_BANNER,
|
||||||
|
Material.BLUE_BANNER,
|
||||||
|
Material.BROWN_BANNER,
|
||||||
|
Material.CYAN_BANNER,
|
||||||
|
Material.GRAY_BANNER,
|
||||||
|
Material.GREEN_BANNER,
|
||||||
|
Material.LIGHT_BLUE_BANNER,
|
||||||
|
Material.LIGHT_GRAY_BANNER,
|
||||||
|
Material.LIME_BANNER,
|
||||||
|
Material.MAGENTA_BANNER,
|
||||||
|
Material.ORANGE_BANNER,
|
||||||
|
Material.PINK_BANNER,
|
||||||
|
Material.PURPLE_BANNER,
|
||||||
|
Material.RED_BANNER,
|
||||||
|
Material.WHITE_BANNER,
|
||||||
|
Material.YELLOW_BANNER,
|
||||||
Material.SPRUCE_DOOR,
|
Material.SPRUCE_DOOR,
|
||||||
Material.BIRCH_DOOR,
|
Material.BIRCH_DOOR,
|
||||||
Material.JUNGLE_DOOR,
|
Material.JUNGLE_DOOR,
|
||||||
Material.ACACIA_DOOR,
|
Material.ACACIA_DOOR,
|
||||||
Material.DARK_OAK_DOOR,
|
Material.DARK_OAK_DOOR,
|
||||||
|
Material.KELP,
|
||||||
|
Material.TALL_SEAGRASS,
|
||||||
|
Material.TALL_GRASS,
|
||||||
|
Material.SUNFLOWER,
|
||||||
|
Material.LARGE_FERN,
|
||||||
|
Material.LILAC,
|
||||||
|
Material.ROSE_BUSH,
|
||||||
|
Material.PEONY,
|
||||||
}));
|
}));
|
||||||
HashSet<Material> nonSolidSingularBlockList = new HashSet<Material>(Arrays.asList(new Material[] {
|
HashSet<Material> nonSolidSingularBlockList = new HashSet<Material>(Arrays.asList(new Material[] {
|
||||||
Material.SAPLING,
|
Material.ACACIA_SAPLING,
|
||||||
Material.BED_BLOCK,
|
Material.BIRCH_SAPLING,
|
||||||
|
Material.DARK_OAK_SAPLING,
|
||||||
|
Material.JUNGLE_SAPLING,
|
||||||
|
Material.OAK_SAPLING,
|
||||||
|
Material.SPRUCE_SAPLING,
|
||||||
|
Material.BLACK_BED,
|
||||||
|
Material.BLUE_BED,
|
||||||
|
Material.BROWN_BED,
|
||||||
|
Material.CYAN_BED,
|
||||||
|
Material.GRAY_BED,
|
||||||
|
Material.GREEN_BED,
|
||||||
|
Material.LIGHT_BLUE_BED,
|
||||||
|
Material.LIGHT_GRAY_BED,
|
||||||
|
Material.LIME_BED,
|
||||||
|
Material.MAGENTA_BED,
|
||||||
|
Material.ORANGE_BED,
|
||||||
|
Material.PINK_BED,
|
||||||
|
Material.PURPLE_BED,
|
||||||
|
Material.RED_BED,
|
||||||
|
Material.WHITE_BED,
|
||||||
|
Material.YELLOW_BED,
|
||||||
Material.POWERED_RAIL,
|
Material.POWERED_RAIL,
|
||||||
Material.DETECTOR_RAIL,
|
Material.DETECTOR_RAIL,
|
||||||
Material.DEAD_BUSH,
|
Material.DEAD_BUSH,
|
||||||
Material.YELLOW_FLOWER,
|
Material.AZURE_BLUET,
|
||||||
Material.RED_ROSE,
|
Material.ALLIUM,
|
||||||
|
Material.BLUE_ORCHID,
|
||||||
|
Material.DANDELION,
|
||||||
|
Material.FERN,
|
||||||
|
Material.ORANGE_TULIP,
|
||||||
|
Material.PINK_TULIP,
|
||||||
|
Material.POPPY,
|
||||||
|
Material.RED_TULIP,
|
||||||
|
Material.WHITE_TULIP,
|
||||||
|
Material.OXEYE_DAISY,
|
||||||
Material.BROWN_MUSHROOM,
|
Material.BROWN_MUSHROOM,
|
||||||
Material.RED_MUSHROOM,
|
Material.RED_MUSHROOM,
|
||||||
Material.FIRE,
|
Material.FIRE,
|
||||||
Material.CROPS,
|
Material.WHEAT,
|
||||||
Material.RAILS,
|
Material.RAIL,
|
||||||
Material.STONE_PLATE,
|
Material.STONE_PRESSURE_PLATE,
|
||||||
Material.WOOD_PLATE,
|
Material.ACACIA_PRESSURE_PLATE,
|
||||||
|
Material.BIRCH_PRESSURE_PLATE,
|
||||||
|
Material.DARK_OAK_PRESSURE_PLATE,
|
||||||
|
Material.JUNGLE_PRESSURE_PLATE,
|
||||||
|
Material.OAK_PRESSURE_PLATE,
|
||||||
|
Material.SPRUCE_PRESSURE_PLATE,
|
||||||
Material.SNOW,
|
Material.SNOW,
|
||||||
Material.DIODE_BLOCK_OFF,
|
Material.REPEATER,
|
||||||
Material.DIODE_BLOCK_ON,
|
|
||||||
Material.PUMPKIN_STEM,
|
Material.PUMPKIN_STEM,
|
||||||
Material.MELON_STEM,
|
Material.MELON_STEM,
|
||||||
Material.WATER_LILY,
|
Material.LILY_PAD,
|
||||||
Material.FLOWER_POT,
|
Material.FLOWER_POT,
|
||||||
Material.CARROT,
|
Material.CARROT,
|
||||||
Material.POTATO,
|
Material.POTATO,
|
||||||
Material.GOLD_PLATE,
|
Material.HEAVY_WEIGHTED_PRESSURE_PLATE,
|
||||||
Material.IRON_PLATE,
|
Material.LIGHT_WEIGHTED_PRESSURE_PLATE,
|
||||||
Material.REDSTONE_COMPARATOR_OFF,
|
Material.COMPARATOR,
|
||||||
Material.REDSTONE_COMPARATOR_ON,
|
|
||||||
Material.ACTIVATOR_RAIL,
|
Material.ACTIVATOR_RAIL,
|
||||||
Material.BEETROOT_BLOCK,
|
Material.BEETROOTS,
|
||||||
Material.NETHER_WART_BLOCK,
|
Material.NETHER_WART_BLOCK,
|
||||||
|
Material.SEAGRASS,
|
||||||
|
Material.BRAIN_CORAL,
|
||||||
|
Material.BUBBLE_CORAL,
|
||||||
|
Material.DEAD_BRAIN_CORAL,
|
||||||
|
Material.DEAD_BUBBLE_CORAL,
|
||||||
|
Material.DEAD_FIRE_CORAL,
|
||||||
|
Material.DEAD_HORN_CORAL,
|
||||||
|
Material.DEAD_TUBE_CORAL,
|
||||||
|
Material.FIRE_CORAL,
|
||||||
|
Material.HORN_CORAL,
|
||||||
|
Material.TUBE_CORAL,
|
||||||
|
Material.SEA_PICKLE,
|
||||||
}));
|
}));
|
||||||
HashSet<Material> nonSolidWallMountedBlockList = new HashSet<Material>(Arrays.asList(new Material[] {
|
HashSet<Material> nonSolidWallMountedBlockList = new HashSet<Material>(Arrays.asList(new Material[] {
|
||||||
Material.TORCH,
|
Material.TORCH,
|
||||||
|
Material.WALL_TORCH,
|
||||||
Material.LADDER,
|
Material.LADDER,
|
||||||
Material.WALL_SIGN,
|
Material.WALL_SIGN,
|
||||||
Material.LEVER,
|
Material.LEVER,
|
||||||
Material.REDSTONE_WIRE,
|
Material.REDSTONE_WIRE,
|
||||||
Material.REDSTONE_TORCH_OFF,
|
Material.REDSTONE_TORCH,
|
||||||
Material.REDSTONE_TORCH_ON,
|
Material.REDSTONE_WALL_TORCH,
|
||||||
Material.STONE_BUTTON,
|
Material.STONE_BUTTON,
|
||||||
Material.TRAP_DOOR,
|
Material.ACACIA_TRAPDOOR,
|
||||||
|
Material.BIRCH_TRAPDOOR,
|
||||||
|
Material.DARK_OAK_TRAPDOOR,
|
||||||
|
Material.JUNGLE_TRAPDOOR,
|
||||||
|
Material.OAK_TRAPDOOR,
|
||||||
|
Material.SPRUCE_TRAPDOOR,
|
||||||
Material.VINE,
|
Material.VINE,
|
||||||
Material.COCOA,
|
Material.COCOA,
|
||||||
Material.TRIPWIRE_HOOK,
|
Material.TRIPWIRE_HOOK,
|
||||||
Material.WOOD_BUTTON,
|
Material.ACACIA_BUTTON,
|
||||||
|
Material.BIRCH_BUTTON,
|
||||||
|
Material.DARK_OAK_BUTTON,
|
||||||
|
Material.JUNGLE_BUTTON,
|
||||||
|
Material.OAK_BUTTON,
|
||||||
|
Material.SPRUCE_BUTTON,
|
||||||
Material.IRON_TRAPDOOR,
|
Material.IRON_TRAPDOOR,
|
||||||
Material.WALL_BANNER,
|
Material.BLACK_WALL_BANNER,
|
||||||
Material.PORTAL,
|
Material.BLUE_WALL_BANNER,
|
||||||
Material.ENDER_PORTAL,
|
Material.BROWN_WALL_BANNER,
|
||||||
|
Material.CYAN_WALL_BANNER,
|
||||||
|
Material.GRAY_WALL_BANNER,
|
||||||
|
Material.GREEN_WALL_BANNER,
|
||||||
|
Material.LIGHT_BLUE_WALL_BANNER,
|
||||||
|
Material.LIGHT_GRAY_WALL_BANNER,
|
||||||
|
Material.LIME_WALL_BANNER,
|
||||||
|
Material.MAGENTA_WALL_BANNER,
|
||||||
|
Material.ORANGE_WALL_BANNER,
|
||||||
|
Material.PINK_WALL_BANNER,
|
||||||
|
Material.PURPLE_WALL_BANNER,
|
||||||
|
Material.RED_WALL_BANNER,
|
||||||
|
Material.WHITE_WALL_BANNER,
|
||||||
|
Material.YELLOW_WALL_BANNER,
|
||||||
|
Material.NETHER_PORTAL,
|
||||||
|
Material.END_PORTAL,
|
||||||
|
Material.BRAIN_CORAL_FAN,
|
||||||
|
Material.BRAIN_CORAL_WALL_FAN,
|
||||||
|
Material.BUBBLE_CORAL_FAN,
|
||||||
|
Material.BUBBLE_CORAL_WALL_FAN,
|
||||||
|
Material.DEAD_BRAIN_CORAL_FAN,
|
||||||
|
Material.DEAD_BRAIN_CORAL_WALL_FAN,
|
||||||
|
Material.DEAD_BUBBLE_CORAL_FAN,
|
||||||
|
Material.DEAD_BUBBLE_CORAL_WALL_FAN,
|
||||||
|
Material.DEAD_FIRE_CORAL_FAN,
|
||||||
|
Material.DEAD_FIRE_CORAL_WALL_FAN,
|
||||||
|
Material.DEAD_HORN_CORAL_FAN,
|
||||||
|
Material.DEAD_HORN_CORAL_WALL_FAN,
|
||||||
|
Material.DEAD_TUBE_CORAL_FAN,
|
||||||
|
Material.DEAD_TUBE_CORAL_WALL_FAN,
|
||||||
|
Material.FIRE_CORAL_FAN,
|
||||||
|
Material.FIRE_CORAL_WALL_FAN,
|
||||||
|
Material.HORN_CORAL_FAN,
|
||||||
|
Material.HORN_CORAL_WALL_FAN,
|
||||||
|
Material.TUBE_CORAL_FAN,
|
||||||
|
Material.TUBE_CORAL_WALL_FAN,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
HashSet<Material> nonSolidBlockList = new HashSet<Material>();
|
HashSet<Material> nonSolidBlockList = new HashSet<Material>();
|
||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
@ -452,49 +565,8 @@ public class Main extends JavaPlugin {
|
||||||
this.getCommand("unloadchunks").setExecutor(new CommandUnloadChunks());
|
this.getCommand("unloadchunks").setExecutor(new CommandUnloadChunks());
|
||||||
this.getCommand("username").setExecutor(new CommandUsername(this));
|
this.getCommand("username").setExecutor(new CommandUsername(this));
|
||||||
|
|
||||||
new Tick(this).runTaskTimer(this, 0, 1);
|
new AutosaveCheck().runTaskTimerAsynchronously(this, 0, 20);
|
||||||
new TickAsync(this).runTaskTimerAsynchronously(this, 0, 1);
|
/*new TileEntityCheckAsync(this).runTaskTimerAsynchronously(this, 0, 400);*/
|
||||||
new TileEntityCheckAsync(this).runTaskTimerAsynchronously(this, 0, 400);
|
|
||||||
this.getServer().getPluginManager().registerEvents(new Events(this), this);
|
this.getServer().getPluginManager().registerEvents(new Events(this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getSkin(String name, final Player player) {
|
|
||||||
try {
|
|
||||||
URL nameUrl = new URL("https://api.mojang.com/users/profiles/minecraft/" + name);
|
|
||||||
HttpsURLConnection nameConnection = (HttpsURLConnection) nameUrl.openConnection();
|
|
||||||
|
|
||||||
if (nameConnection != null &&
|
|
||||||
nameConnection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
|
|
||||||
InputStreamReader nameStream = new InputStreamReader(nameConnection.getInputStream());
|
|
||||||
String uuid = new JsonParser().parse(nameStream).getAsJsonObject().get("id").getAsString();
|
|
||||||
nameStream.close();
|
|
||||||
nameConnection.disconnect();
|
|
||||||
|
|
||||||
URL uuidUrl = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid + "?unsigned=false");
|
|
||||||
HttpsURLConnection uuidConnection = (HttpsURLConnection) uuidUrl.openConnection();
|
|
||||||
|
|
||||||
if (uuidConnection != null &&
|
|
||||||
uuidConnection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
|
|
||||||
InputStreamReader uuidStream = new InputStreamReader(uuidConnection.getInputStream());
|
|
||||||
JsonObject response = new JsonParser().parse(uuidStream).getAsJsonObject().get("properties").getAsJsonArray().get(0).getAsJsonObject();
|
|
||||||
final String texture = response.get("value").getAsString();
|
|
||||||
final String signature = response.get("signature").getAsString();
|
|
||||||
uuidStream.close();
|
|
||||||
uuidConnection.disconnect();
|
|
||||||
|
|
||||||
final PlayerProfile textureProfile = player.getPlayerProfile();
|
|
||||||
textureProfile.clearProperties();
|
|
||||||
textureProfile.setProperty(new ProfileProperty("textures", texture, signature));
|
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(this, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
player.setPlayerProfile(textureProfile);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception exception) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
name: Extras
|
name: Extras
|
||||||
main: pw.kaboom.extras.Main
|
main: pw.kaboom.extras.Main
|
||||||
description: Plugin that adds extra functionality to the Kaboom.pw server.
|
description: Plugin that adds extra functionality to the Kaboom.pw server.
|
||||||
|
api-version: 1.13
|
||||||
version: master
|
version: master
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
|
Loading…
Reference in a new issue