Commit v0.1.1

This commit is contained in:
BuildTools 2019-01-20 01:33:46 +01:00
commit a5a62e424d
65 changed files with 2813 additions and 0 deletions

30
.classpath Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="bin/main" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/main" path="src/main/resources">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/java">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/resources">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/.gradle/
/build/

4
.idea/encodings.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

19
.idea/gradle.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:/Gradle/gradle-5.0" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="useAutoImport" value="true" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>
</project>

12
.idea/misc.xml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>

124
.idea/uiDesigner.xml Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

388
.idea/workspace.xml Normal file
View File

@ -0,0 +1,388 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1f395f0b-1a62-4de7-8311-18be358f8f46" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gradle.properties" beforeDir="false" afterPath="$PROJECT_DIR$/gradle.properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/SMG.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/SMG.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/VulnerabilityPatcher.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/VulnerabilityPatcher.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/commands/CommandGetNBT.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/commands/CommandGetNBT.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Books.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Books.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Crash_Items.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Crash_Items.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Patches.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Patches.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Rouge_Entity.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Rouge_Entity.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/plugin.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/plugin.yml" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<ignored path="$PROJECT_DIR$/.gradle/" />
<ignored path="$PROJECT_DIR$/build/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ExternalProjectsData">
<projectState path="$PROJECT_DIR$">
<ProjectState />
</projectState>
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/VulnerabilityPatcher.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-153">
<caret line="54" column="77" lean-forward="true" selection-start-line="54" selection-start-column="77" selection-end-line="54" selection-end-column="77" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Books.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="705">
<caret line="106" column="65" lean-forward="true" selection-start-line="106" selection-start-column="65" selection-end-line="106" selection-end-column="65" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Trident_Riptide.java" />
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Follow_Range.java" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/SMG.java" />
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Entity_IDs.java" />
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Crash_Egg.java" />
<option value="$PROJECT_DIR$/src/main/resources/config.yml" />
<option value="$PROJECT_DIR$/src/main/resources/plugin.yml" />
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Patches.java" />
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Crash_Items.java" />
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/commands/CommandGetNBT.java" />
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Rouge_Entity.java" />
<option value="$PROJECT_DIR$/gradle.properties" />
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/VulnerabilityPatcher.java" />
<option value="$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Books.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="235" />
<option name="y" value="75" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="VulnerabilityPatcher" type="b2602c69:ProjectViewProjectNode" />
<item name="VulnerabilityPatcher" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
</path>
<path>
<item name="VulnerabilityPatcher" type="b2602c69:ProjectViewProjectNode" />
<item name="VulnerabilityPatcher" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="VulnerabilityPatcher" type="b2602c69:ProjectViewProjectNode" />
<item name="VulnerabilityPatcher" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
</path>
<path>
<item name="VulnerabilityPatcher" type="b2602c69:ProjectViewProjectNode" />
<item name="VulnerabilityPatcher" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="VulnerabilityPatcher" type="b2602c69:ProjectViewProjectNode" />
<item name="VulnerabilityPatcher" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="vulnerabilitypatcher" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="VulnerabilityPatcher" type="b2602c69:ProjectViewProjectNode" />
<item name="VulnerabilityPatcher" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="vulnerabilitypatcher" type="462c0819:PsiDirectoryNode" />
<item name="commands" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="VulnerabilityPatcher" type="b2602c69:ProjectViewProjectNode" />
<item name="VulnerabilityPatcher" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="java" type="462c0819:PsiDirectoryNode" />
<item name="vulnerabilitypatcher" type="462c0819:PsiDirectoryNode" />
<item name="patches" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="VulnerabilityPatcher" type="b2602c69:ProjectViewProjectNode" />
<item name="VulnerabilityPatcher" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="8a07ba80:GradleTreeStructureProvider$GradleModuleDirectoryNode" />
<item name="resources" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1547941302342" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="1f395f0b-1a62-4de7-8311-18be358f8f46" name="Default Changelist" comment="" />
<created>1547829118400</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1547829118400</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2771855" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Image Layers" order="2" />
<window_info id="Designer" order="3" />
<window_info id="Capture Tool" order="4" />
<window_info id="UI Designer" order="5" />
<window_info id="Favorites" order="6" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Terminal" order="7" />
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="9" />
<window_info anchor="bottom" id="Build" order="10" weight="0.32936078" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Maven" order="4" />
<window_info anchor="right" id="Gradle" order="5" />
<window_info anchor="right" id="Theme Preview" order="6" />
<window_info anchor="right" id="Capture Analysis" order="7" />
<window_info anchor="right" id="Palette&#9;" order="8" />
</layout>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/LICENSE.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-663" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gradlew">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2397" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Death_Potions.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-720">
<caret line="40" column="13" selection-start-line="40" selection-start-column="13" selection-end-line="40" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Disconnect_Items.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1179">
<caret line="43" column="13" selection-start-line="43" selection-start-column="13" selection-end-line="43" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Trident_Riptide.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="435">
<caret line="66" column="85" selection-start-line="66" selection-start-column="85" selection-end-line="66" selection-end-column="85" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.gradle">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="11" column="76" lean-forward="true" selection-start-line="11" selection-start-column="76" selection-end-line="11" selection-end-column="76" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/commands/CommandVulnerabilityPatcher.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="130">
<caret line="30" column="13" selection-start-line="30" selection-start-column="13" selection-end-line="30" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/resources/config.yml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="29" column="14" selection-start-line="29" selection-start-column="14" selection-end-line="29" selection-end-column="14" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Crash_Egg.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="42" column="26" lean-forward="true" selection-start-line="42" selection-start-column="26" selection-end-line="42" selection-end-column="26" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Follow_Range.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-94">
<caret line="2" column="7" selection-start-line="2" selection-start-column="7" selection-end-line="2" selection-end-column="7" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Death_Items.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-544">
<caret line="44" column="13" selection-start-line="44" selection-start-column="13" selection-end-line="44" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Crash_Items.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1071">
<caret line="96" column="50" selection-start-line="96" selection-start-column="50" selection-end-line="96" selection-end-column="50" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/SMG.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="561">
<caret line="33" column="71" lean-forward="true" selection-start-line="33" selection-start-column="71" selection-end-line="33" selection-end-column="71" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Rouge_Entity.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="765">
<caret line="63" column="5" selection-start-line="63" selection-start-column="5" selection-end-line="63" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/commands/CommandGetNBT.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="43" column="105" lean-forward="true" selection-start-line="43" selection-start-column="105" selection-end-line="43" selection-end-column="105" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Player_Knockback.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="354">
<caret line="33" column="67" lean-forward="true" selection-start-line="33" selection-start-column="67" selection-end-line="33" selection-end-column="67" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Patches.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="810">
<caret line="103" column="11" lean-forward="true" selection-start-line="103" selection-start-column="11" selection-end-line="103" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/VulnerabilityPatcher.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-153">
<caret line="54" column="77" lean-forward="true" selection-start-line="54" selection-start-column="77" selection-end-line="54" selection-end-column="77" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/gradle.properties">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="15" selection-start-line="1" selection-start-column="15" selection-end-line="1" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/resources/plugin.yml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="14" selection-start-line="1" selection-start-column="14" selection-end-line="1" selection-end-column="14" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/me/cooljwb/vulnerabilitypatcher/patches/Books.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="705">
<caret line="106" column="65" lean-forward="true" selection-start-line="106" selection-start-column="65" selection-end-line="106" selection-end-column="65" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

23
.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>VulnerabilityPatcher</name>
<comment>Project VulnerabilityPatcher created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,2 @@
connection.project.dir=
eclipse.preferences.version=1

201
LICENSE.md Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2019 CoolJWB
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

12
README.md Normal file
View File

@ -0,0 +1,12 @@
# VulnerabilityPatcher
**Info:**
VulnerabilityPatcher is a light weight Spigot plugin that runs on 1.13.2 servers.
Its task is to prevent bugs in Spigot to cause issues for both the server and the players.
**Patches:**
It currently prevents 4 server crash bugs, 2 client crash bugs, 2 disconnect bugs,
2 bugs that kills creative users and 1 that causes commands to run when clicking in books.
**Planned:**
- More security patches.
- A safe mode feature in emergencies when the plugin isn't working properly.

1
bin/main/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/me/

30
bin/main/config.yml Normal file
View File

@ -0,0 +1,30 @@
# VulnerabilityPatcher by CoolJWB
# Patches:
# DeathPotions, DeathItems, CrashSigns, Books, RougeEntity, Knockback, Riptide, FollowRange, DisconnectItems, CrashEgg.
Patches:
- DeathPotions
- DeathItems
- CrashSigns
- Books
- RougeEntity
- Knockback
- Riptide
- FollowRange
- DisconnectItems
- CrashEgg
Commands:
Help:
Permission: vulnerability.help
Version:
Permission: vulnerability.version
Reload:
Permission: vulnerability.reload
Notify:
Enabled: false
Permission: vulnerability.notify
# DevMode should be set to false, unless you're a developer of this plugin.
DevMode: false

12
bin/main/plugin.yml Normal file
View File

@ -0,0 +1,12 @@
name: VulnerabilityPatcher
version: BETA
main: me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher
api-version: 1.13
authors: [CoolJWB]
description: Patches the server vulnerabilities.
commands:
vulnerabilitypatcher:
aliases: [vp]
description: The main command for VulnerabilityPatcher.
getnbt:
description: Reveals an items NBT data.

33
build.gradle Normal file
View File

@ -0,0 +1,33 @@
apply plugin: 'java'
group = pluginGroup
version = pluginVersion
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/groups/public/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile 'org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT'
compile files('libs/spigot-1.13.2.jar')
}
import org.apache.tools.ant.filters.ReplaceTokens
processResources {
from(sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [version: version]
}
}

2
gradle.properties Normal file
View File

@ -0,0 +1,2 @@
pluginGroup=me.CoolJWB.VulnerabilityPatcher
pluginVersion=v0.1.1

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip

172
gradlew vendored Normal file
View File

@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
gradlew.bat vendored Normal file
View File

@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

BIN
libs/spigot-1.13.2.jar Normal file

Binary file not shown.

View File

@ -0,0 +1,30 @@
# VulnerabilityPatcher by CoolJWB
# Patches:
# DeathPotions, DeathItems, CrashSigns, Books, RougeEntity, Knockback, Riptide, FollowRange, DisconnectItems, CrashEgg.
Patches:
- DeathPotions
- DeathItems
- CrashSigns
- Books
- RougeEntity
- Knockback
- Riptide
- FollowRange
- DisconnectItems
- CrashEgg
Commands:
Help:
Permission: vulnerability.help
Version:
Permission: vulnerability.version
Reload:
Permission: vulnerability.reload
Notify:
Enabled: false
Permission: vulnerability.notify
# Should be set to false, unless you're a developer of this plugin.
DevMode: false

View File

@ -0,0 +1,10 @@
name: VulnerabilityPatcher
version: @version@
main: me.cooljwb.vulnerabilitypatcher.vulnerabilitypatcher.VulnerabilityPatcher
api-version: 1.13
authors: [CoolJWB]
description: Patches the server vulnerabilities.
commands:
vulnerabilitypatcher:
aliases: [vp]
description: The main command for VulnerabilityPatcher.

View File

@ -0,0 +1,47 @@
package me.cooljwb.vulnerabilitypatcher;
import org.bukkit.ChatColor;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public enum SMG {
VULNERABILITYPATCHER("&8[&3V&bP&8] "),
VULNERABILITYPATCHER_HELP("&8&l&m-------------&r &8[&3V&bP&8] &8&l&m-------------&r\n" +
"&8 - &7/vp help &aShow the plugin commands.\n" +
"&8 - &7/vp version &aGet the plugin version.\n" +
"&8 - &7/vp reload &aReload the plugin.\n" +
"&8 - &7/getnbt &aPrint the item in hands NBT."),
ITEM(SMG.VULNERABILITYPATCHER.msg + "&cThis item is not allowed."),
ITEM_IN_CONTAINER(SMG.VULNERABILITYPATCHER.msg + "&cAn item in this container is not allowed."),
ITEM_NOTIFY(SMG.VULNERABILITYPATCHER.msg + "&c%s tried to %s a %s at x:%s y:%s z:%s"),
NO_PERMISSION(SMG.VULNERABILITYPATCHER.msg + "&cYou do not have permission to do this."),
NOT_PLAYER(SMG.VULNERABILITYPATCHER.msg + "&cThis command can only be done in game."),
UNKNOWN_ARGUMENT(SMG.VULNERABILITYPATCHER.msg + "&cUnknown argument.");
public String msg;
SMG(String message) {
this.msg = ChatColor.translateAlternateColorCodes('&', message);
}
}

View File

@ -0,0 +1,109 @@
package me.cooljwb.vulnerabilitypatcher;
import me.cooljwb.vulnerabilitypatcher.commands.CommandGetNBT;
import me.cooljwb.vulnerabilitypatcher.commands.CommandVulnerabilityPatcher;
import me.cooljwb.vulnerabilitypatcher.patches.*;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public final class VulnerabilityPatcher extends JavaPlugin {
/*
* Patches: Books with commands, Invalid translations (crashes both client and server), Death Items, Death Potions, Rouge Entities, Arrow knockback, Trident speed,
* Large follow range, Disconnect Items, Crash Eggs, Knowledge Books.
*/
public static VulnerabilityPatcher main;
private Logger log = Logger.getLogger("Minecraft");
public static String pluginName, pluginVersion;
private List<String> pluginAuthors;
private ArrayList<Listener> listeners = new ArrayList<>();
private Patches patches;
private CommandVulnerabilityPatcher commandvulnerabilitypatcher = new CommandVulnerabilityPatcher(this);
private CommandGetNBT commandgetnbt = new CommandGetNBT(this);
public static Death_Items death_items = new Death_Items();
public static Disconnect_Items disconnect_items = new Disconnect_Items();
public static Crash_Items crash_items = new Crash_Items();
@Override
public void onEnable() {
initialize();
patches.initialize();
registerConfig();
registerEvents();
Bukkit.getServer().getPluginCommand(commandvulnerabilitypatcher.vulnerabilitypatcher).setExecutor(commandvulnerabilitypatcher);
Bukkit.getServer().getPluginCommand(commandgetnbt.getnbt).setExecutor(commandgetnbt);
log.log(Level.INFO, String.format("[%s] %s v%s was enabled.", pluginName, pluginName, pluginVersion));
log.log(Level.INFO, String.format("[%s] %s patches were loaded.", pluginName, listeners.size()));
}
public void initialize() {
this.pluginName = this.getName();
this.pluginVersion = this.getDescription().getVersion();
this.pluginAuthors = this.getDescription().getAuthors();
this.patches = new Patches(this);
this.main = this;
}
public void registerConfig() {
getConfig().options().copyDefaults(true);
saveDefaultConfig();
}
public void reloadPlugin() {
reloadConfig();
initialize();
patches.initialize();
}
public void registerEvents() {
for(String patch : getConfig().getStringList("Patches")) {
switch(patch) {
case "DeathPotions": listeners.add(new Death_Potions()); break;
case "DeathItems": listeners.add(new Death_Items()); break;
case "CrashItems": listeners.add(new Crash_Items()); break;
case "Books": listeners.add(new Books()); break;
case "RougeEntity": listeners.add(new Rouge_Entity()); break;
case "Knockback": listeners.add(new Player_Knockback()); break;
case "Riptide": listeners.add(new Trident_Riptide()); break;
case "FollowRange": listeners.add(new Follow_Range()); break;
case "DisconnectItems": listeners.add(new Disconnect_Items()); break;
case "CrashEgg": listeners.add(new Crash_Egg()); break;
}
}
listeners.forEach(listener -> Bukkit.getPluginManager().registerEvents(listener, this));
}
}

View File

@ -0,0 +1,48 @@
package me.cooljwb.vulnerabilitypatcher.commands;
import me.cooljwb.vulnerabilitypatcher.SMG;
import me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher;
import me.cooljwb.vulnerabilitypatcher.patches.Patches;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class CommandGetNBT extends Patches implements CommandExecutor {
public static String getnbt = "getnbt";
private VulnerabilityPatcher main;
public CommandGetNBT(VulnerabilityPatcher main) {
this.main = main;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(cmd.getName().equalsIgnoreCase(getnbt)) {
if(!(sender instanceof Player)) {
msg(sender, SMG.NOT_PLAYER.msg);
return true;
}
Player player = Bukkit.getPlayer(((Player) sender).getUniqueId());
ItemStack item = player.getInventory().getItemInMainHand();
net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
NBTTagCompound tag = nmsItemStack.getTag();
if(item != null && tag != null)
msg(sender, SMG.VULNERABILITYPATCHER.msg + ChatColor.GRAY + "Item data of item: " + ChatColor.GREEN + ChatColor.stripColor(tag.toString()));
else if(item.getType() == Material.AIR)
msg(sender, SMG.VULNERABILITYPATCHER.msg + ChatColor.RED + "Get an item in your main hand!");
else if(tag == null)
msg(sender, SMG.VULNERABILITYPATCHER.msg + ChatColor.RED + "This item has no item tag.");
}
return true;
}
}

View File

@ -0,0 +1,72 @@
package me.cooljwb.vulnerabilitypatcher.commands;
import me.cooljwb.vulnerabilitypatcher.SMG;
import me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher;
import me.cooljwb.vulnerabilitypatcher.patches.Patches;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class CommandVulnerabilityPatcher extends Patches implements CommandExecutor {
public static String vulnerabilitypatcher = "vulnerabilitypatcher";
private VulnerabilityPatcher main;
public CommandVulnerabilityPatcher(VulnerabilityPatcher main) {
this.main = main;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(cmd.getName().equalsIgnoreCase(vulnerabilitypatcher)) {
if(args.length == 0 || args[0].equalsIgnoreCase("help")) {
if(sender.hasPermission(main.getConfig().getString("Commands.Help.Permission")))
msg(sender, SMG.VULNERABILITYPATCHER_HELP.msg);
else
msg(sender, SMG.NO_PERMISSION.msg);
}
else if(args[0].equalsIgnoreCase("version")) {
if(sender.hasPermission(main.getConfig().getString("Commands.Version.Permission")))
msg(sender, SMG.VULNERABILITYPATCHER.msg + ChatColor.GRAY + String.format("Server is running " + ChatColor.GREEN + main.getName() + "-" + main.getDescription().getVersion()));
else
msg(sender, SMG.NO_PERMISSION.msg);
}
else if(args[0].equalsIgnoreCase("reload") || args[0].equalsIgnoreCase("rl")) {
if(sender.hasPermission(main.getConfig().getString("Commands.Reload.Permission"))) {
main.reloadPlugin();
msg(sender, SMG.VULNERABILITYPATCHER.msg + ChatColor.GREEN + "Reloaded the config.");
}
else
msg(sender, SMG.NO_PERMISSION.msg);
}
else
msg(sender, SMG.UNKNOWN_ARGUMENT.msg);
}
return true;
}
}

View File

@ -0,0 +1,111 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import me.cooljwb.vulnerabilitypatcher.SMG;
import net.minecraft.server.v1_13_R2.ChatMessageException;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Books extends Patches implements Listener {
private Logger log = Logger.getLogger("Minecraft");
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteractEvent(PlayerInteractEvent event) {
if (event.getItem() != null && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
Player player = event.getPlayer();
ItemStack item = event.getItem();
EquipmentSlot hand = event.getHand();
switch (item.getType().toString()) {
case "WRITTEN_BOOK":
writtenBook(player, hand);
break;
case "KNOWLEDGE_BOOK":
knowledgeBook(player, hand);
break;
}
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
public void writtenBook(Player player, EquipmentSlot hand) {
if(hand.name().equals("OFF_HAND")) {
ItemStack hand_item = player.getInventory().getItemInOffHand();
resetMeta(player, hand_item, false);
}
else if(hand.name().equals("HAND")) {
ItemStack hand_item = player.getInventory().getItemInMainHand();
resetMeta(player, hand_item, true);
}
}
public void knowledgeBook(Player player, EquipmentSlot hand) {
if(hand.name().equals("OFF_HAND")) {
ItemStack hand_item = player.getInventory().getItemInOffHand();
hand_item.setAmount(-1);
msg(player, SMG.ITEM.msg);
}
else if(hand.name().equals("HAND")) {
ItemStack hand_item = player.getInventory().getItemInMainHand();
hand_item.setAmount(-1);
msg(player, SMG.ITEM.msg);
}
}
public void resetMeta(Player player, ItemStack hand_item, boolean mainhand) {
net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(hand_item);
if(nmsItemStack.hasTag() && nmsItemStack.getTag().hasKey("pages")) {
if (nmsItemStack.getTag().getList("pages", 8).toString().contains("run_command")) {
BookMeta meta = (BookMeta) hand_item.getItemMeta();
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
meta.setPages(meta.getPages());
book.setItemMeta(meta);
if (mainhand)
player.getInventory().setItemInMainHand(book);
else
player.getInventory().setItemInOffHand(book);
}
}
}
}

View File

@ -0,0 +1,74 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.bukkit.block.Container;
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.inventory.ItemStack;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Crash_Egg extends Patches implements Listener {
private Logger log = Logger.getLogger("Minecraft");
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockDispenseEvent(BlockDispenseEvent event) {
ItemStack item = event.getItem();
if(item != null) {
if (isCrashEgg(item)) {
event.setCancelled(true);
Container container = (Container) event.getBlock().getState();
for(int c = 0; c < container.getInventory().getSize(); c++) {
if(container.getInventory().getItem(c) != null) {
if (container.getInventory().getItem(c).isSimilar(event.getItem()))
container.getInventory().getItem(c).setItemMeta(null);
}
}
notifyViolation(event.getBlock().getType().name(), "drop", "crash egg", event.getBlock().getLocation());
}
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
public boolean isCrashEgg(ItemStack item) {
if(item != null) {
net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if(nmsItemStack != null && nmsItemStack.getTag() != null) {
if(nmsItemStack.getTag().getCompound("EntityTag").getString("id").equalsIgnoreCase("minecraft:lightning_bolt"))
return true;
}
}
return false;
}
}

View File

@ -0,0 +1,200 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import me.cooljwb.vulnerabilitypatcher.SMG;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.NBTTagList;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.bukkit.Bukkit;
import org.bukkit.block.Container;
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitScheduler;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Crash_Items extends Patches implements Listener {
private Logger log = Logger.getLogger("Minecraft");
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockDispenseEvent(BlockDispenseEvent event) {
ItemStack item = event.getItem();
if(isCrashItem(item)) {
event.setCancelled(true);
Container container = (Container) event.getBlock().getState();
for(int c = 0; c < container.getInventory().getSize(); c++) {
if(container.getInventory().getItem(c) != null) {
if (container.getInventory().getItem(c).isSimilar(event.getItem()))
container.getInventory().getItem(c).setItemMeta(null);
}
}
notifyViolation(event.getBlock().getType().toString(), "drop", "crash item", event.getBlock().getLocation());
}
else if(containsCrashItem(item)) {
event.setCancelled(true);
Container container = (Container) event.getBlock().getState();
for(int c = 0; c < container.getInventory().getSize(); c++) {
if(container.getInventory().getItem(c) != null) {
if (container.getInventory().getItem(c).isSimilar(event.getItem()))
container.getInventory().getItem(c).setItemMeta(null);
}
}
notifyViolation(event.getBlock().getType().toString(), "drop", event.getItem().getType() + " with crash item in it", event.getBlock().getLocation());
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteractEvent(PlayerInteractEvent event) {
ItemStack item = event.getItem();
if(isCrashItem(item)) {
event.setCancelled(true);
clearItemMeta(event.getItem());
Player player = event.getPlayer();
msg(player, SMG.ITEM.msg);
notifyViolation(player, "interact with", "crash item", player.getLocation());
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPlaceEvent(BlockPlaceEvent event) {
if(event.getBlockPlaced().getState() instanceof Container) {
Container container = (Container) event.getBlockPlaced().getState();
for(ItemStack item : container.getInventory()) {
if(isCrashItem(item)) {
container.getInventory().remove(item);
event.setCancelled(true);
Player player = event.getPlayer();
msg(player, SMG.ITEM_IN_CONTAINER.msg);
notifyViolation(player, "place", event.getBlock().getType() + " crash item", event.getPlayer().getLocation());
}
}
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryClickEvent(InventoryClickEvent event) {
if(isCrashItem(event.getCursor()) || containsCrashItem(event.getCursor())) {
Player player = null;
if(event.getWhoClicked() instanceof Player) {
player = Bukkit.getPlayer(event.getWhoClicked().getUniqueId());
if(!event.getEventName().equals("InventoryCreativeEvent"))
msg(player, SMG.ITEM.msg);
}
if(!event.getEventName().equals("InventoryCreativeEvent"))
notifyViolation(player, "acquire", "crash item", player.getLocation());
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(main, new Runnable() {
@Override
public void run() {
if(!event.getSlotType().equals(InventoryType.SlotType.OUTSIDE))
event.getWhoClicked().getInventory().getItem(event.getSlot()).setItemMeta(null);
}
}, 0L);
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerDropEvent(PlayerDropItemEvent event) {
ItemStack item = event.getItemDrop().getItemStack();
if(isCrashItem(item)) {
event.setCancelled(true);
clearItemMeta(event.getItemDrop().getItemStack());
Player player = event.getPlayer();
msg(player, SMG.ITEM.msg);
notifyViolation(player, "drop", "crash item", player.getLocation());
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
public static boolean isCrashItem(ItemStack item) {
if(item != null) {
net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if(nmsItemStack.getTag() != null) {
NBTTagCompound itemtag = nmsItemStack.getTag();
if(itemtag.toString().contains("translation.test.invalid"))
return true;
}
}
return false;
}
public static boolean containsCrashItem(ItemStack item) {
if(item != null) {
net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if(nmsItemStack.getTag() != null) {
NBTTagCompound blockentitytag = nmsItemStack.getTag().getCompound("BlockEntityTag");
NBTTagList itemlist = blockentitytag.getList("Items", 10);
for(int a = 0; a <= itemlist.size(); a++) {
NBTTagCompound itemtag = itemlist.getCompound(a).getCompound("tag");
if(itemtag.toString().contains("translation.test.invalid"))
return true;
}
}
}
return false;
}
}

View File

@ -0,0 +1,177 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import me.cooljwb.vulnerabilitypatcher.SMG;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import net.minecraft.server.v1_13_R2.NBTTagList;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.bukkit.Bukkit;
import org.bukkit.block.Container;
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitScheduler;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Death_Items extends Patches implements Listener {
private Logger log = Logger.getLogger("Minecraft");
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockDispenseEvent(BlockDispenseEvent event) {
if(containsDeathItem(event.getItem())) {
event.setCancelled(true);
Container container = (Container) event.getBlock().getState();
for(int c = 0; c < container.getInventory().getSize(); c++) {
if(container.getInventory().getItem(c) != null) {
if (container.getInventory().getItem(c).isSimilar(event.getItem()))
container.getInventory().getItem(c).setItemMeta(null);
}
}
notifyViolation("Dispenser", "place", event.getItem().getType() + " with death item in it", event.getBlock().getLocation());
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPlaceEvent(BlockPlaceEvent event) {
if(event.getBlockPlaced().getState() instanceof Container) {
Container container = (Container) event.getBlockPlaced().getState();
for(ItemStack item : container.getInventory()) {
if(isDeathItem(item) || containsDeathItem(item)) {
container.getInventory().remove(item);
event.setCancelled(true);
Player player = event.getPlayer();
msg(player, SMG.ITEM_IN_CONTAINER.msg);
notifyViolation(player, "place", event.getBlock().getType() + " with death item in it", event.getPlayer().getLocation());
}
}
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryClickEvent(InventoryClickEvent event) {
if(isDeathItem(event.getCursor()) || containsDeathItem(event.getCursor())) {
Player player = null;
if(event.getWhoClicked() instanceof Player) {
player = Bukkit.getPlayer(event.getWhoClicked().getUniqueId());
if(!event.getEventName().equals("InventoryCreativeEvent"))
msg(player, SMG.ITEM.msg);
}
if(!event.getEventName().equals("InventoryCreativeEvent"))
notifyViolation(player, "acquire", "death item", player.getLocation());
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(main, new Runnable() {
@Override
public void run() {
if(!event.getSlotType().equals(InventoryType.SlotType.OUTSIDE))
event.getWhoClicked().getInventory().getItem(event.getSlot()).setItemMeta(null);
}
}, 0L);
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerDropEvent(PlayerDropItemEvent event) {
ItemStack item = event.getItemDrop().getItemStack();
if(isDeathItem(item) || containsDeathItem(item)) {
event.setCancelled(true);
clearItemMeta(event.getItemDrop().getItemStack());
Player player = event.getPlayer();
msg(player, SMG.ITEM.msg);
notifyViolation(player, "drop", "death item", player.getLocation());
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
public static boolean isDeathItem(ItemStack item) {
if(item != null) {
net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if(nmsItemStack.getTag() != null) {
NBTTagList attrlist = nmsItemStack.getTag().getList("AttributeModifiers", 10);
if(attrlist != null) {
for(int i = 0; i < attrlist.size(); i++) {
NBTTagCompound compound = (NBTTagCompound)attrlist.get(i);
if((compound.getString("Name").equalsIgnoreCase("MAX_HEALTH") || compound.getString("AttributeName").equalsIgnoreCase("generic.maxHealth")) && compound.getDouble("Amount") <= 0)
return true;
}
}
}
}
return false;
}
public static boolean containsDeathItem(ItemStack item) {
if(item != null) {
net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if(nmsItemStack.getTag() != null) {
NBTTagCompound blockentitytag = nmsItemStack.getTag().getCompound("BlockEntityTag");
NBTTagList itemlist = blockentitytag.getList("Items", 10);
for(int a = 0; a <= itemlist.size(); a++) {
NBTTagList attrlist = itemlist.getCompound(a).getCompound("tag").getList("AttributeModifiers", 10);
for(int b = 0; b <= attrlist.size(); b++) {
String attribute_name = attrlist.getCompound(b).getString("AttributeName");
String name = attrlist.getCompound(b).getString("Name");
Double amount = attrlist.getCompound(b).getDouble("Amount");
if((name.equalsIgnoreCase("MAX_HEALTH") || attribute_name.equalsIgnoreCase("generic.maxHealth")) && amount <= 0)
return true;
}
}
}
}
return false;
}
}

View File

@ -0,0 +1,115 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import me.cooljwb.vulnerabilitypatcher.SMG;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.LingeringPotionSplashEvent;
import org.bukkit.event.entity.PotionSplashEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Death_Potions extends Patches implements Listener {
private Logger log = Logger.getLogger("Minecraft");
public Death_Potions() {}
@EventHandler(priority = EventPriority.HIGHEST)
public void consumePotionEvent(PlayerItemConsumeEvent event) {
if(event.getItem().getType().name().equalsIgnoreCase("POTION")) {
PotionMeta meta = (PotionMeta) event.getItem().getItemMeta();
if(isDeathPotion(meta.getCustomEffects())) {
event.setCancelled(true);
Player player = event.getPlayer();
msg(player, SMG.ITEM.msg);
notifyViolation(event.getPlayer(), "drink", "death potion", event.getPlayer().getLocation());
}
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void splashEvent(PotionSplashEvent event) {
if(isDeathPotion(event.getPotion().getEffects())) {
event.setCancelled(true);
Player player = null;
if(event.getPotion().getShooter() instanceof CraftPlayer) {
player = (Player) event.getEntity().getShooter();
msg(player, SMG.ITEM.msg);
}
notifyViolation(player, "splash", "death potion", player.getLocation());
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void lingeringSplashEvent(LingeringPotionSplashEvent event) {
if(isDeathPotion(event.getAreaEffectCloud().getCustomEffects())) {
event.setCancelled(true);
Player player = null;
if(event.getEntity().getShooter() instanceof CraftPlayer) {
player = (Player) event.getEntity().getShooter();
msg(player, SMG.ITEM.msg);
}
notifyViolation(player, "splash", "death potion", player.getLocation());
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
public static boolean isDeathPotion(List<PotionEffect> effects) {
for(PotionEffect effect : effects) {
if(effect.getType().getName().equalsIgnoreCase("HEAL") && (effect.getAmplifier() == 125 || effect.getAmplifier() == 93 || effect.getAmplifier() == 61 || effect.getAmplifier() == 29))
return true;
}
return false;
}
public static boolean isDeathPotion(Collection<PotionEffect> effects) {
for(PotionEffect effect : effects) {
if(effect.getType().getName().equalsIgnoreCase("HEAL") && (effect.getAmplifier() >= 125 || effect.getAmplifier() == 93 || effect.getAmplifier() == 61 || effect.getAmplifier() == 29))
return true;
}
return false;
}
}

View File

@ -0,0 +1,162 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import me.cooljwb.vulnerabilitypatcher.SMG;
import net.minecraft.server.v1_13_R2.NBTTagList;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.bukkit.Bukkit;
import org.bukkit.block.Container;
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitScheduler;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Disconnect_Items extends Patches implements Listener {
private Logger log = Logger.getLogger("Minecraft");
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockDispenseEvent(BlockDispenseEvent event) {
if(containsDisconnectItem(event.getItem())) {
event.setCancelled(true);
Container container = (Container) event.getBlock().getState();
for(int c = 0; c < container.getInventory().getSize(); c++) {
if(container.getInventory().getItem(c) != null) {
if (container.getInventory().getItem(c).isSimilar(event.getItem()))
container.getInventory().getItem(c).setItemMeta(null);
}
}
notifyViolation("Dispenser", "place", event.getItem().getType() + " with disconnect item in it", event.getBlock().getLocation());
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPlaceEvent(BlockPlaceEvent event) {
if(event.getBlockPlaced().getState() instanceof Container) {
Container container = (Container) event.getBlockPlaced().getState();
for(ItemStack item : container.getInventory()) {
if(isDisconnectItem(item) || containsDisconnectItem(item)) {
container.getInventory().remove(item);
event.setCancelled(true);
Player player = event.getPlayer();
msg(player, SMG.ITEM_IN_CONTAINER.msg);
notifyViolation(player, "place", event.getBlock().getType() + " with disconnect item in it", event.getPlayer().getLocation());
}
}
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryClickEvent(InventoryClickEvent event) {
if(isDisconnectItem(event.getCursor()) || containsDisconnectItem(event.getCursor())) {
Player player = null;
if(event.getWhoClicked() instanceof Player) {
player = Bukkit.getPlayer(event.getWhoClicked().getUniqueId());
if(!event.getEventName().equals("InventoryCreativeEvent"))
msg(player, SMG.ITEM.msg);
}
if(!event.getEventName().equals("InventoryCreativeEvent"))
notifyViolation(player, "acquire", "disconnect item", player.getLocation());
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(main, new Runnable() {
@Override
public void run() {
if(!event.getSlotType().equals(InventoryType.SlotType.OUTSIDE))
event.getWhoClicked().getInventory().getItem(event.getSlot()).setItemMeta(null);
}
}, 0L);
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerDropEvent(PlayerDropItemEvent event) {
ItemStack item = event.getItemDrop().getItemStack();
if(isDisconnectItem(item) || containsDisconnectItem(item)) {
event.setCancelled(true);
clearItemMeta(event.getItemDrop().getItemStack());
Player player = event.getPlayer();
msg(player, SMG.ITEM.msg);
notifyViolation(player, "drop", "disconnect item", player.getLocation());
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
public boolean isDisconnectItem(ItemStack item) {
if(item != null) {
net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if(nmsItemStack != null && nmsItemStack.getTag() != null) {
if((nmsItemStack.getTag().getInt("CustomPotionColor") < 0) || (nmsItemStack.getTag().getCompound("display").getInt("color") < 0) || (nmsItemStack.getTag().toString().length() > 50000))
return true;
}
}
return false;
}
public boolean containsDisconnectItem(ItemStack item) {
if(item != null) {
net.minecraft.server.v1_13_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item);
if(nmsItemStack != null && nmsItemStack.getTag() != null) {
NBTTagList items = nmsItemStack.getTag().getCompound("BlockEntityTag").getList("Items", 10);
if(items != null) {
for (int a = 0; a <= items.size(); a++) {
if((nmsItemStack.getTag().getInt("CustomPotionColor") < 0) || (nmsItemStack.getTag().getCompound("display").getInt("color") < 0) || (nmsItemStack.getTag().toString().length() > 50000))
return true;
}
}
}
}
return false;
}
}

View File

@ -0,0 +1,53 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntitySpawnEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Follow_Range extends Patches implements Listener {
private Logger log = Logger.getLogger("Minecraft");
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntitySpawnEvent(EntitySpawnEvent event) {
if (event.getEntity() != null && event.getEntity() instanceof LivingEntity) {
LivingEntity entity = (LivingEntity) event.getEntity();
if (entity.getAttribute(Attribute.GENERIC_FOLLOW_RANGE) != null) {
double followrange = entity.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).getBaseValue();
if (followrange >= 128)
entity.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(entity.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).getDefaultValue());
}
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
}

View File

@ -0,0 +1,183 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher;
import me.cooljwb.vulnerabilitypatcher.SMG;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.*;
import net.minecraft.server.v1_13_R2.NBTTagCompound;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitScheduler;
import java.util.ArrayList;
import java.util.List;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Patches implements Listener {
public static VulnerabilityPatcher main;
public static String pluginName, pluginVersion;
public static boolean notify, devmode;
public List<String> listeners;
private Death_Items death_items;
private Disconnect_Items disconnect_items;
private Crash_Items crash_items;
public Patches() {}
public Patches(VulnerabilityPatcher main) {
this.main = main;
listeners = main.getConfig().getStringList("Patches");
runnable();
}
public void initialize() {
this.pluginName = main.getName();
this.pluginVersion = main.getDescription().getVersion();
this.notify = main.getConfig().getBoolean("Notify.Enabled");
this.devmode = main.getConfig().getBoolean("DevMode");
this.death_items = main.death_items;
this.disconnect_items = main.disconnect_items;
this.crash_items = main.crash_items;
}
public void runnable() {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncRepeatingTask(main, new Runnable() {
@Override
public void run() {
for(Player player : Bukkit.getOnlinePlayers()) {
for(ItemStack item : player.getInventory()) {
for(String listener : listeners) {
switch(listener) {
case "DeathItems":
if(death_items.isDeathItem(item) || death_items.containsDeathItem(item)) {
clearItemMeta(item);
notifyViolation(player, "acquire", "death item", player.getLocation());
msg(player, SMG.ITEM.msg);
} break;
case "DisconnectItems":
if(disconnect_items.isDisconnectItem(item) || disconnect_items.containsDisconnectItem(item)) {
clearItemMeta(item);
notifyViolation(player, "acquire", "disconnect item", player.getLocation());
msg(player, SMG.ITEM.msg);
} break;
case "CrashItems":
if(crash_items.isCrashItem(item) || crash_items.containsCrashItem(item)) {
clearItemMeta(item);
notifyViolation(player.getName(), "acquire", "crash item", player.getLocation());
msg(player, SMG.ITEM.msg);
} break;
}
}
}
}
}
}, 0L, 0);
}
public void msg(Player player, String msg) {
player.sendMessage(msg);
}
public void msg(CommandSender sender, String msg) {
sender.sendMessage(msg);
}
public void notify(String msg) {
if(notify) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.hasPermission(main.getConfig().getString("Notify.Permission")))
player.sendMessage(msg);
}
}
}
public void notify(BaseComponent msg) {
if(notify) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.hasPermission(main.getConfig().getString("Notify.Permission")))
player.spigot().sendMessage(msg);
}
}
}
public void notifyViolation(Player player, String violation_form, String violation_name, Location loc) {
if(player != null) {
TextComponent notification = new TextComponent(String.format(SMG.ITEM_NOTIFY.msg, player.getName(), violation_form, violation_name, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.GOLD + "Teleport" + ChatColor.DARK_GRAY + "]").create()));
notification.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tp " + loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ()));
notification.setColor(ChatColor.RED);
notify(notification);
}
else {
TextComponent notification = new TextComponent(String.format(SMG.ITEM_NOTIFY.msg, "Unknown", violation_form, violation_name, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.GOLD + "Teleport" + ChatColor.DARK_GRAY + "]").create()));
notification.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tp " + loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ()));
notification.setColor(ChatColor.RED);
notify(notification);
}
}
public void notifyViolation(String violator, String violation_form, String violation_name, Location loc) {
TextComponent notification = new TextComponent(String.format(SMG.ITEM_NOTIFY.msg, violator, violation_form, violation_name, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
notification.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(ChatColor.DARK_GRAY + "[" + ChatColor.GOLD + "Teleport" + ChatColor.DARK_GRAY + "]").create()));
notification.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tp " + loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ()));
notification.setColor(ChatColor.RED);
notify(notification);
}
public void clearItemMeta(ItemStack item) {
item.setItemMeta(null);
}
public void clearItemMeta(ItemStack[] items) {
for(ItemStack item : items) {
if(item != null)
item.setItemMeta(null);
}
}
public NBTTagCompound getEntityNMS(Entity entity) {
net.minecraft.server.v1_13_R2.Entity nmsEntity = ((CraftEntity)entity).getHandle();
NBTTagCompound tag = new NBTTagCompound();
nmsEntity.save(tag);
return tag;
}
}

View File

@ -0,0 +1,59 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Player_Knockback extends Patches implements Listener {
private Logger log = Logger.getLogger("Minecraft");
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerVelocityEvent(PlayerVelocityEvent event) {
if(event.getVelocity().getX() > 10 || event.getVelocity().getY() > 10 || event.getVelocity().getZ() > 10)
event.setCancelled(true);
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onProjectileLaunchEvent(ProjectileLaunchEvent event) {
if(event.getEntity().getType() == EntityType.ARROW) {
Arrow arrow = (Arrow) event.getEntity();
if (arrow.getKnockbackStrength() > 10)
arrow.setKnockbackStrength(10);
}
if(devmode)
log.log(Level.INFO, String.format("[%s] Event: %s", pluginName, ReflectionToStringBuilder.toString(event)));
}
}

View File

@ -0,0 +1,65 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Rouge_Entity extends Patches implements Listener {
private Logger log = Logger.getLogger("Minecraft");
public Rouge_Entity() {
runnable();
}
public void runnable() {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncRepeatingTask(main, new Runnable() {
@Override
public void run() {
for(World world : Bukkit.getWorlds()) {
if(world.getEntities() != null) {
for(Entity entity : world.getEntities()) {
if(entity != null && (entity.getVelocity().getX() > 10.0D || entity.getVelocity().getY() > 10.0D || entity.getVelocity().getZ() > 10.0D || entity.getVelocity().getX() < -6.0D || entity.getVelocity().getY() < -6.0D || entity.getVelocity().getZ() < -6.0D)) {
if(entity.getName().equals("Firework Rocket"))
entity.remove();
else
entity.setVelocity(new Vector(0,0,0));
}
}
}
}
}
}, 0L, 0);
}
}

View File

@ -0,0 +1,70 @@
package me.cooljwb.vulnerabilitypatcher.patches;
import me.cooljwb.vulnerabilitypatcher.SMG;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerRiptideEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitScheduler;
import java.util.HashMap;
/*
* Copyright 2019 CoolJWB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author CoolJWB
*/
public class Trident_Riptide extends Patches implements Listener {
private HashMap<Player, Integer> enchantlevel = new HashMap<>();
@EventHandler
public void onPlayerInteractEvent(PlayerInteractEvent event) {
Player player = event.getPlayer();
ItemStack item = event.getItem();
if(item != null) {
if(item.getType() == Material.TRIDENT) {
if(item.getEnchantmentLevel(Enchantment.RIPTIDE) > 10) {
enchantlevel.put(player, item.getEnchantmentLevel(Enchantment.RIPTIDE));
item.removeEnchantment(Enchantment.RIPTIDE);
item.addUnsafeEnchantment(Enchantment.RIPTIDE, 10);
}
}
}
}
@EventHandler
public void onPlayerRiptideEvent(PlayerRiptideEvent event) {
Player player = event.getPlayer();
ItemStack item = event.getItem();
if(enchantlevel.containsKey(player)) {
item.removeEnchantment(Enchantment.RIPTIDE);
item.addUnsafeEnchantment(Enchantment.RIPTIDE, enchantlevel.get(player));
}
}
}

View File

@ -0,0 +1,30 @@
# VulnerabilityPatcher by CoolJWB
# Patches:
# DeathPotions, DeathItems, CrashSigns, Books, RougeEntity, Knockback, Riptide, FollowRange, DisconnectItems, CrashEgg.
Patches:
- DeathPotions
- DeathItems
- CrashSigns
- Books
- RougeEntity
- Knockback
- Riptide
- FollowRange
- DisconnectItems
- CrashEgg
Commands:
Help:
Permission: vulnerability.help
Version:
Permission: vulnerability.version
Reload:
Permission: vulnerability.reload
Notify:
Enabled: false
Permission: vulnerability.notify
# DevMode should be set to false, unless you're a developer of this plugin.
DevMode: false

View File

@ -0,0 +1,12 @@
name: VulnerabilityPatcher
version: 0.1.1
main: me.cooljwb.vulnerabilitypatcher.VulnerabilityPatcher
api-version: 1.13
authors: [CoolJWB]
description: Patches the server vulnerabilities.
commands:
vulnerabilitypatcher:
aliases: [vp]
description: The main command for VulnerabilityPatcher.
getnbt:
description: Reveals an items NBT data.