Compare commits

..

26 Commits
master ... 2.1

Author SHA1 Message Date
Govindass
450c38e87e Merge branch 'master' of https://github.com/Govindass/SkStuff 2020-07-28 11:33:18 +03:00
Govindass
4a451c0ae2 remove old 1.9.2 2020-07-28 11:33:14 +03:00
Govindas
4eeb792318
Update README.md 2020-07-21 15:23:27 +03:00
Govindass
af60b96e4a Add 1.16 support & Add more syntaxes & Add 1.8-1.12 support back & Remove some syntaxes that are already in vanilla Skript 2020-07-21 15:16:57 +03:00
Govindas
f279742068
Update README.md 2020-01-13 14:49:34 +02:00
Govindas
10a25abe5b
Update README.md 2020-01-13 14:49:16 +02:00
Govindas
0ca413c58f
Update .gitignore 2020-01-13 13:11:45 +02:00
Govindas
8594b46b2b
Delete SkStuff.jar 2020-01-13 13:04:09 +02:00
Govindas
2e4900e509
Update README.md 2020-01-13 13:03:17 +02:00
Govindass
bb8710e9dc test 2020-01-13 13:00:44 +02:00
Govindass
6151a9ec09 1.15 2020-01-13 12:58:19 +02:00
Govindass
5de16a75e3 Update plugin.yml 2020-01-13 12:40:52 +02:00
Govindass
fc48cdc060 Create .gitignore 2020-01-13 12:40:18 +02:00
Govindass
d8209feb28 1.15 support 2020-01-13 12:37:12 +02:00
Govindas
3f42acfc54
Merge pull request #1 from ham1255/master
change softdepend to depend Plugin.yml
2019-11-19 08:19:37 +02:00
mohammed jassim alajel
e08eedd121
change softdepend to depend Plugin.yml 2019-11-18 21:24:02 +04:00
Govindass
627733ab2c
Update README.md 2019-11-18 15:04:09 +02:00
Govindass
0d33ad8a66
Update plugin.yml 2019-11-18 14:59:56 +02:00
Govindass
f8861cf6f1
Update README.md 2019-11-18 14:57:56 +02:00
Govindass
9bfbcd9639
Update README.md 2019-11-18 14:55:58 +02:00
Govindass
210bb8c315
Update README.md 2019-11-18 14:55:17 +02:00
Govindass
a3e52580c2 Update plugin.yml 2019-11-18 14:53:11 +02:00
Govindass
bf9514c322 1.13 & 1.14 Update, removal of old stuff
1.13 & 1.14 Update, removed worldedit, nbt, vanishnopacket stuff and old version stuff
2019-11-18 14:51:31 +02:00
Govindass
bf5e005a80
Delete ExprEditSessionLimit.java 2019-11-18 12:21:32 +02:00
Govindass
98ed997070
Add files via upload
1.13 & 1.14 update
2019-11-18 12:20:09 +02:00
Govindass
a943eb6882
Update README.md 2019-11-18 12:06:51 +02:00
51 changed files with 273 additions and 322 deletions

13
.gitignore vendored
View File

@ -1,7 +1,6 @@
out /out
bin /bin
target /target
META-INF /META-INF
.settings /.settings
.idea /.idea
SkStuff.iml

View File

@ -3,6 +3,7 @@
<output-path>$PROJECT_DIR$/out/artifacts/SkStuff_jar</output-path> <output-path>$PROJECT_DIR$/out/artifacts/SkStuff_jar</output-path>
<root id="archive" name="SkStuff.jar"> <root id="archive" name="SkStuff.jar">
<element id="module-output" name="SkStuff" /> <element id="module-output" name="SkStuff" />
<element id="module-source" name="SkStuff" />
<element id="file-copy" path="$PROJECT_DIR$/plugin.yml" /> <element id="file-copy" path="$PROJECT_DIR$/plugin.yml" />
</root> </root>
</artifact> </artifact>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="DiscordProjectSettings"> <component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" /> <option name="show" value="true" />
</component> </component>
<component name="ProjectNotificationSettings"> <component name="ProjectNotificationSettings">
<option name="askShowProject" value="false" /> <option name="askShowProject" value="false" />

View File

@ -3,9 +3,8 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="72e0643a-ea45-4e93-b5a5-734a94c41ff5" name="Default Changelist" comment=""> <list default="true" id="72e0643a-ea45-4e93-b5a5-734a94c41ff5" 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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/SkStuff.class" beforeDir="false" afterPath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/SkStuff.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/SkStuff.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/SkStuff.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/effects/EffSetPathGoal.class" beforeDir="false" afterPath="$PROJECT_DIR$/bin/me/TheBukor/SkStuff/effects/EffSetPathGoal.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/me/TheBukor/SkStuff/util/NMS_v1_9_R1.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/plugin.yml" beforeDir="false" afterPath="$PROJECT_DIR$/plugin.yml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -24,13 +23,14 @@
</component> </component>
<component name="ProjectId" id="1dDc5mH6vdHCfDtdCWF3TtPitSZ" /> <component name="ProjectId" id="1dDc5mH6vdHCfDtdCWF3TtPitSZ" />
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" /> <property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../import/craftbukkit-1.16.4.jar" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/plugin.yml" />
<property name="project.structure.last.edited" value="Modules" /> <property name="project.structure.last.edited" value="Artifacts" />
<property name="project.structure.proportion" value="0.15" /> <property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" /> <property name="project.structure.side.proportion" value="0.2" />
</component> </component>
@ -43,7 +43,18 @@
<component name="SQLPlugin.ProjectConfiguration"> <component name="SQLPlugin.ProjectConfiguration">
<queries /> <queries />
</component> </component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="project-level" UseSingleDictionary="true" transferred="true" /> <component name="ServiceViewManager">
<option name="viewStates">
<list>
<serviceView>
<treeState>
<expand />
<select />
</treeState>
</serviceView>
</list>
</option>
</component>
<component name="SvnConfiguration"> <component name="SvnConfiguration">
<configuration /> <configuration />
</component> </component>
@ -58,18 +69,22 @@
<servers /> <servers />
</component> </component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state x="488" y="70" key="#com.intellij.ide.util.MemberChooser" timestamp="1603963583320"> <state x="79" y="101" key="FileChooserDialogImpl" timestamp="1595328182010">
<screen x="0" y="0" width="1366" height="728" /> <screen x="0" y="0" width="1366" height="728" />
</state> </state>
<state x="488" y="70" key="#com.intellij.ide.util.MemberChooser/0.0.1366.728@0.0.1366.728" timestamp="1603963583320" /> <state x="79" y="101" key="FileChooserDialogImpl/0.0.1366.728@0.0.1366.728" timestamp="1595328182010" />
<state x="79" y="101" key="FileChooserDialogImpl" timestamp="1604401015065"> <state x="348" y="62" key="NewModule_or_Project.wizard" timestamp="1592831160031">
<screen x="0" y="0" width="1366" height="728" /> <screen x="0" y="0" width="1366" height="728" />
</state> </state>
<state x="79" y="101" key="FileChooserDialogImpl/0.0.1366.728@0.0.1366.728" timestamp="1604401015065" /> <state x="348" y="62" key="NewModule_or_Project.wizard/0.0.1366.728@0.0.1366.728" timestamp="1592831160031" />
<state x="163" y="0" key="SettingsEditor" timestamp="1604401021463"> <state x="163" y="0" key="SettingsEditor" timestamp="1595328184010">
<screen x="0" y="0" width="1366" height="728" /> <screen x="0" y="0" width="1366" height="728" />
</state> </state>
<state x="163" y="0" key="SettingsEditor/0.0.1366.728@0.0.1366.728" timestamp="1604401021463" /> <state x="163" y="0" key="SettingsEditor/0.0.1366.728@0.0.1366.728" timestamp="1595328184010" />
<state x="0" y="0" key="com.intellij.ide.util.TipDialog" timestamp="1595662947316">
<screen x="0" y="0" width="1366" height="728" />
</state>
<state x="0" y="0" key="com.intellij.ide.util.TipDialog/0.0.1366.728@0.0.1366.728" timestamp="1595662947316" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

0
META-INF/MANIFEST.MF Executable file → Normal file
View File

3
README.md Executable file → Normal file
View File

@ -5,6 +5,8 @@
This fork adds 1.8 - 1.16 support and removes a lot of stuff, focusing on entity related stuff as they're unique to SkStuff. No support given for versions like 1.9.2 while there's 1.9.4. only latest third digit versions. This fork adds 1.8 - 1.16 support and removes a lot of stuff, focusing on entity related stuff as they're unique to SkStuff. No support given for versions like 1.9.2 while there's 1.9.4. only latest third digit versions.
**Download it [here](https://github.com/Govindass/SkStuff/releases)**
##List of pathfinder goals ##List of pathfinder goals
``` ```
(avoid|run away from) %entitytype%[, radius %number%[, speed %number%[, speed (if|when) (close|near) %number%]]] (avoid|run away from) %entitytype%[, radius %number%[, speed %number%[, speed (if|when) (close|near) %number%]]]
@ -58,4 +60,3 @@ Notes:
6 - If this goal is missing on the entity, it will not be able to attack. 6 - If this goal is missing on the entity, it will not be able to attack.
7 - Can only be applied on Ghasts or Blazes. 7 - Can only be applied on Ghasts or Blazes.
``` ```

View File

@ -18,30 +18,43 @@
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" /> <src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
</src_description> </src_description>
</component> </component>
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/bin" /> <output url="file://$MODULE_DIR$/bin" />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content> </content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="module-library"> <orderEntry type="module-library">
<library> <library>
<CLASSES> <CLASSES>
<root url="jar://$MODULE_DIR$/../../import/Paper-1.16.3-latest.jar!/" /> <root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.14.4-R0.1-SNAPSHOT.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$MODULE_DIR$/../../import/Paper-1.16.3-latest.jar!/" /> <root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.14.4-R0.1-SNAPSHOT.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.15.1-R0.1-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.15.1-R0.1-SNAPSHOT.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.13.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.13.2.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</orderEntry> </orderEntry>
@ -57,11 +70,11 @@
<orderEntry type="module-library"> <orderEntry type="module-library">
<library> <library>
<CLASSES> <CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.10.2-R0.1-SNAPSHOT-latest.jar!/" /> <root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.12.2.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.10.2-R0.1-SNAPSHOT-latest.jar!/" /> <root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.12.2.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</orderEntry> </orderEntry>
@ -79,66 +92,11 @@
<orderEntry type="module-library"> <orderEntry type="module-library">
<library> <library>
<CLASSES> <CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.12.2.jar!/" /> <root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.10.2-R0.1-SNAPSHOT-latest.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.12.2.jar!/" /> <root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.10.2-R0.1-SNAPSHOT-latest.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.13.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.13.2.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.14.4-R0.1-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.14.4-R0.1-SNAPSHOT.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.15.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.15.2.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.16.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.16.2.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.8.8-R0.1-SNAPSHOT-latest.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.8.8-R0.1-SNAPSHOT-latest.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</orderEntry> </orderEntry>
@ -156,14 +114,46 @@
<orderEntry type="module-library"> <orderEntry type="module-library">
<library> <library>
<CLASSES> <CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.16.4.jar!/" /> <root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.8.8-R0.1-SNAPSHOT-latest.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.16.4.jar!/" /> <root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.8.8-R0.1-SNAPSHOT-latest.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.9.2-R0.1-SNAPSHOT-latest.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.9.2-R0.1-SNAPSHOT-latest.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.15.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.15.2.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.16.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../../import/craftbukkit-1.16.1.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
</orderEntry> </orderEntry>
<orderEntry type="library" name="Skript-2.6" level="project" />
</component> </component>
</module> </module>

0
bin/META-INF/MANIFEST.MF Executable file → Normal file
View File

0
bin/META-INF/SkStuff.kotlin_module Executable file → Normal file
View File

0
bin/me/TheBukor/SkStuff/effects/EffGZipFile.class Executable file → Normal file
View File

View File

View File

View File

View File

View File

View File

View File

7
plugin.yml Executable file → Normal file
View File

@ -1,7 +1,6 @@
name: SkStuff name: SkPathfinderGoals
authors: [TheBukor, Govindas] authors: [TheBukor, Govindas]
description: A Skript addon which adds extra functionalities such as pathfinder goals. description: A Skript addon which adds extra functionalities such as pathfinder goals.
version: "2.2.1" version: "2.0"
main: me.TheBukor.SkStuff.SkStuff main: me.TheBukor.SkStuff.SkStuff
depend: [Skript] softdepend: [Skript]
api-version: 1.13

0
src/META-INF/MANIFEST.MF Executable file → Normal file
View File

57
src/me/TheBukor/SkStuff/SkStuff.java Executable file → Normal file
View File

@ -2,16 +2,28 @@ package me.TheBukor.SkStuff;
import ch.njol.skript.Skript; import ch.njol.skript.Skript;
import ch.njol.skript.lang.ExpressionType; import ch.njol.skript.lang.ExpressionType;
import ch.njol.skript.lang.util.SimpleEvent;
import ch.njol.skript.registrations.EventValues;
import ch.njol.skript.util.Getter;
import me.TheBukor.SkStuff.bstats.Metrics; import me.TheBukor.SkStuff.bstats.Metrics;
import me.TheBukor.SkStuff.effects.*; import me.TheBukor.SkStuff.effects.*;
import me.TheBukor.SkStuff.expressions.ExprFireProof; import me.TheBukor.SkStuff.expressions.*;
import me.TheBukor.SkStuff.expressions.ExprNoClip;
import me.TheBukor.SkStuff.expressions.ExprStepLength;
import me.TheBukor.SkStuff.util.*; import me.TheBukor.SkStuff.util.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityToggleGlideEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import javax.annotation.Nullable;
import java.io.IOException;
public class SkStuff extends JavaPlugin { public class SkStuff extends JavaPlugin {
private int condAmount = 0;
private int effAmount = 0;
private int evtAmount = 0;
private int exprAmount = 0;
private int typeAmount = 0;
private static NMSInterface nmsMethods; private static NMSInterface nmsMethods;
@ -19,7 +31,7 @@ public class SkStuff extends JavaPlugin {
public void onEnable() { public void onEnable() {
if (Bukkit.getPluginManager().getPlugin("Skript") != null && Skript.isAcceptRegistrations()) { if (Bukkit.getPluginManager().getPlugin("Skript") != null && Skript.isAcceptRegistrations()) {
Skript.registerAddon(this); Skript.registerAddon(this);
getLogger().info("SkStuff " + this.getDescription().getVersion() + " has been successfully enabled!"); getLogger().info("SkPathfinderGoals " + this.getDescription().getVersion() + " has been successfully enabled!");
getLogger().info("Registering general non version specific stuff..."); getLogger().info("Registering general non version specific stuff...");
Skript.registerEffect(EffShowEntityEffect.class, "(display|play|show) entity effect (0¦firework[s] explo(de|sion)|1¦hurt|2¦[[iron] golem] (give|offer) (rose|poppy)|3¦[sheep] eat grass|4¦wolf shake|5¦squid rotate|6¦totem resurrect|7¦rabbit jump) (at|on) %entity%"); Skript.registerEffect(EffShowEntityEffect.class, "(display|play|show) entity effect (0¦firework[s] explo(de|sion)|1¦hurt|2¦[[iron] golem] (give|offer) (rose|poppy)|3¦[sheep] eat grass|4¦wolf shake|5¦squid rotate|6¦totem resurrect|7¦rabbit jump) (at|on) %entity%");
if (setupNMSVersion()) { if (setupNMSVersion()) {
@ -27,15 +39,15 @@ public class SkStuff extends JavaPlugin {
Skript.registerExpression(ExprStepLength.class, Number.class, ExpressionType.PROPERTY, "[the] step length of %entity%", "%entity%'s step length"); Skript.registerExpression(ExprStepLength.class, Number.class, ExpressionType.PROPERTY, "[the] step length of %entity%", "%entity%'s step length");
Skript.registerEffect(EffClearPathGoals.class, "(clear|delete) [all] pathfind[er] goals (of|from) %livingentities%"); Skript.registerEffect(EffClearPathGoals.class, "(clear|delete) [all] pathfind[er] goals (of|from) %livingentities%");
Skript.registerEffect(EffRemovePathGoal.class, "remove pathfind[er] goal (0¦(avoid|run away from) entit(y|ies)|1¦break door[s]|2¦breed|3¦eat grass|4¦(flee from the sun|seek shad(e|ow))|5¦float (in[side]|on) water|6¦follow (owner|tamer)|7¦follow (adult|parent)[s]|8¦(fight back|react to|target) (damager|attacker)|9¦o(c|z)elot jump on blocks|10¦leap at target|11¦look at entit(y|ies)|12¦melee attack entit(y|ies)|13¦move to[wards] target|14¦target nearest entity|15¦o(c|z)elot attack [chicken[s]]|16¦open door[s]|17¦(panic|flee)|18¦look around randomly|19¦(walk around randomly|wander)|20¦sit|21¦[creeper] (explode|inflate|swell)|22¦squid (swim|wander)|23¦shoot fireball[s]|24¦[silverfish] hide (in[side]|on) block[s]|25¦(wake other silverfish[es]|[silverfish] call (help|reinforcement|other [hidden] silverfish[es]))|26¦[enderm(a|e)n] pick[[ ]up] block[s]|27¦[enderm(a|e)n] place block[s]|28¦[enderman] attack player (staring|looking) [at eye[s]]|29¦ghast move to[wards] target|30¦ghast (idle move[ment]|wander|random fl(ight|y[ing]))|31¦(tempt to|follow players (holding|with)) [a[n]] item|32¦target [random] entity (if|when) (not tamed|untamed)|33¦guardian attack [entity]|34¦[z[ombie[ ]]pig[man]] attack [player[s]] (if|when) angry|35¦[z[ombie[ ]]pig[man]] (react to|fight back|target) (attacker|damager) (if|when) angry|36¦[rabbit] eat carrot crops|37¦[killer] rabbit [melee] attack|38¦slime [random] jump|39¦slime change (direction|facing) randomly|40¦slime (idle move[ment]|wander)|41¦follow [entity]|42¦bow shoot) from %livingentities%"); Skript.registerEffect(EffRemovePathGoal.class, "remove pathfind[er] goal (0¦(avoid|run away from) entit(y|ies)|1¦break door[s]|2¦breed|3¦eat grass|4¦(flee from the sun|seek shad(e|ow))|5¦float (in[side]|on) water|6¦follow (owner|tamer)|7¦follow (adult|parent)[s]|8¦(fight back|react to|target) (damager|attacker)|9¦o(c|z)elot jump on blocks|10¦leap at target|11¦look at entit(y|ies)|12¦melee attack entit(y|ies)|13¦move to[wards] target|14¦target nearest entity|15¦o(c|z)elot attack [chicken[s]]|16¦open door[s]|17¦(panic|flee)|18¦look around randomly|19¦(walk around randomly|wander)|20¦sit|21¦[creeper] (explode|inflate|swell)|22¦squid (swim|wander)|23¦shoot fireball[s]|24¦[silverfish] hide (in[side]|on) block[s]|25¦(wake other silverfish[es]|[silverfish] call (help|reinforcement|other [hidden] silverfish[es]))|26¦[enderm(a|e)n] pick[[ ]up] block[s]|27¦[enderm(a|e)n] place block[s]|28¦[enderman] attack player (staring|looking) [at eye[s]]|29¦ghast move to[wards] target|30¦ghast (idle move[ment]|wander|random fl(ight|y[ing]))|31¦(tempt to|follow players (holding|with)) [a[n]] item|32¦target [random] entity (if|when) (not tamed|untamed)|33¦guardian attack [entity]|34¦[z[ombie[ ]]pig[man]] attack [player[s]] (if|when) angry|35¦[z[ombie[ ]]pig[man]] (react to|fight back|target) (attacker|damager) (if|when) angry|36¦[rabbit] eat carrot crops|37¦[killer] rabbit [melee] attack|38¦slime [random] jump|39¦slime change (direction|facing) randomly|40¦slime (idle move[ment]|wander)|41¦follow [entity]|42¦bow shoot) from %livingentities%");
// Note to self: whenever adding a new pathfinder goal, increase the expression index for 'entities' in EffSetPathGoal
Skript.registerEffect(EffSetPathGoal.class, "add pathfind[er] goal [[with] priority %-integer%] (0¦(avoid|run away from) %*entitydatas%[, radius %-number%[, speed %-number%[, speed (if|when) (close|near) %-number%]]]|1¦break door[s]|2¦breed[,[move[ment]] speed %-number%]|3¦eat grass|4¦(flee from the sun|seek shad(e|ow))[, [move[ment]] speed %-number%]|5¦(float (in[side]|on) water|swim)|6¦follow (owner|tamer)[, speed %-number%[, min[imum] distance %-number%[, max[imum] distance %-number%]]]|7¦follow (adult|parent)[s][, [move[ment]] speed %-number%]|8¦(fight back|react to|target) (damager|attacker) [[of] type] %*entitydatas%[, call ([for] help|reinforcement) %-boolean%]|9¦o(c|z)elot jump on blocks[, [move[ment]] speed %-number%]|10¦leap at target[, [leap] height %-number%]|11¦look at %*entitydatas%[, (radius|max[imum] distance) %-number%]|12¦melee attack %*entitydatas%[, [move[ment]] speed %-number%[, (memorize|do('nt| not) forget) target [for [a] long[er] time] %-boolean%]]|13¦move to[wards] target[, [move[ment]] speed %-number%[, (radius|max[imum] distance) %-number%]]|14¦target nearest [entity [of] type] %*entitydatas%[, check sight %-boolean%]|15¦o(c|z)elot attack|16¦open door[s]|17¦(panic|flee)[, [move[ment]] speed %-number%]|18¦look around randomly|19¦(walk around randomly|wander)[, [move[ment]] speed %-number%[, min[imum] [of] %-timespan% between mov(e[ment][s]|ing)]]|20¦sit|21¦[creeper] (explode|inflate|swell)|22¦squid (swim around|wander)|23¦shoot fireball[s]|24¦[silverfish] hide (in[side]|on) block[s]|25¦((call|summon|wake) [other] [hidden] silverfish[es])|26¦[enderman] pick[[ ]up] block[s]|27¦[enderman] place block[s]|28¦[enderman] attack player (staring|looking) at [their] eye[s]]|29¦ghast move to[wards] target|30¦ghast (idle move[ment]|wander|random fl(ight|y[ing]))|31¦(tempt to|follow players (holding|with)) %-itemstack%[, [move[ment]] speed %number%[, scared of player movement %-boolean%]]|32¦target [random] %*entitydatas% (if|when) (not |un)tamed|33¦guardian attack [entities]|34¦[z[ombie[ ]]pig[man]] attack [player[s]] (if|when) angry|35¦[z[ombie[ ]]pig[man]] (react to|fight back|target) (attacker|damager) (if|when) angry|36¦[rabbit] eat carrot crops|37¦[killer] rabbit [melee] attack|38¦slime [random] jump|39¦slime change (direction|facing) randomly|40¦slime (idle move[ment]|wander)|41¦follow %*entitydatas%[, radius %-number%[, speed %-number%[, [custom[ ]]name[d] %-string%]]]|42¦bow shoot[, [move[ment]] speed %-number%[, unk[nown] param[eter] %-number%[, follow range %-number%]]]) to %livingentities%"); Skript.registerEffect(EffSetPathGoal.class, "add pathfind[er] goal [[with] priority %-integer%] (0¦(avoid|run away from) %*entitydatas%[, radius %-number%[, speed %-number%[, speed (if|when) (close|near) %-number%]]]|1¦break door[s]|2¦breed[,[move[ment]] speed %-number%]|3¦eat grass|4¦(flee from the sun|seek shad(e|ow))[, [move[ment]] speed %-number%]|5¦(float (in[side]|on) water|swim)|6¦follow (owner|tamer)[, speed %-number%[, min[imum] distance %-number%[, max[imum] distance %-number%]]]|7¦follow (adult|parent)[s][, [move[ment]] speed %-number%]|8¦(fight back|react to|target) (damager|attacker) [[of] type] %*entitydatas%[, call ([for] help|reinforcement) %-boolean%]|9¦o(c|z)elot jump on blocks[, [move[ment]] speed %-number%]|10¦leap at target[, [leap] height %-number%]|11¦look at %*entitydatas%[, (radius|max[imum] distance) %-number%]|12¦melee attack %*entitydatas%[, [move[ment]] speed %-number%[, (memorize|do('nt| not) forget) target [for [a] long[er] time] %-boolean%]]|13¦move to[wards] target[, [move[ment]] speed %-number%[, (radius|max[imum] distance) %-number%]]|14¦target nearest [entity [of] type] %*entitydatas%[, check sight %-boolean%]|15¦o(c|z)elot attack|16¦open door[s]|17¦(panic|flee)[, [move[ment]] speed %-number%]|18¦look around randomly|19¦(walk around randomly|wander)[, [move[ment]] speed %-number%[, min[imum] [of] %-timespan% between mov(e[ment][s]|ing)]]|20¦sit|21¦[creeper] (explode|inflate|swell)|22¦squid (swim around|wander)|23¦shoot fireball[s]|24¦[silverfish] hide (in[side]|on) block[s]|25¦((call|summon|wake) [other] [hidden] silverfish[es])|26¦[enderman] pick[[ ]up] block[s]|27¦[enderman] place block[s]|28¦[enderman] attack player (staring|looking) at [their] eye[s]]|29¦ghast move to[wards] target|30¦ghast (idle move[ment]|wander|random fl(ight|y[ing]))|31¦(tempt to|follow players (holding|with)) %-itemstack%[, [move[ment]] speed %number%[, scared of player movement %-boolean%]]|32¦target [random] %*entitydatas% (if|when) (not |un)tamed|33¦guardian attack [entities]|34¦[z[ombie[ ]]pig[man]] attack [player[s]] (if|when) angry|35¦[z[ombie[ ]]pig[man]] (react to|fight back|target) (attacker|damager) (if|when) angry|36¦[rabbit] eat carrot crops|37¦[killer] rabbit [melee] attack|38¦slime [random] jump|39¦slime change (direction|facing) randomly|40¦slime (idle move[ment]|wander)|41¦follow %*entitydatas%[, radius %-number%[, speed %-number%[, [custom[ ]]name[d] %-string%]]]|42¦bow shoot[, [move[ment]] speed %-number%[, unk[nown] param[eter] %-number%[, follow range %-number%]]])) to %livingentities%");
Skript.registerEffect(EffMakeJump.class, "make %livingentities% jump", "force %livingentities% to jump"); Skript.registerEffect(EffMakeJump.class, "make %livingentities% jump", "force %livingentities% to jump");
Skript.registerExpression(ExprNoClip.class, Boolean.class, ExpressionType.PROPERTY, "no[( |-)]clip (state|mode) of %entities%", "%entities%'s no[( |-)]clip (state|mode)"); Skript.registerExpression(ExprNoClip.class, Boolean.class, ExpressionType.PROPERTY, "no[( |-)]clip (state|mode) of %entities%", "%entities%'s no[( |-)]clip (state|mode)");
Skript.registerExpression(ExprFireProof.class, Boolean.class, ExpressionType.PROPERTY, "fire[ ]proof (state|mode) of %entities%", "%entities%'s fire[ ]proof (state|mode)"); Skript.registerExpression(ExprFireProof.class, Boolean.class, ExpressionType.PROPERTY, "fire[ ]proof (state|mode) of %entities%", "%entities%'s fire[ ]proof (state|mode)");
} }
//Metrics metrics = new Metrics(this, 1); Metrics metrics = new Metrics(this, 1);
//metrics.startSubmitting(); metrics.startSubmitting();
//getLogger().info("Hooked into Metrics! Woohoo!!"); getLogger().info("Hooked into Metrics! Woohoo!!");
getLogger().info("Everything's ready!"); getLogger().info("Everything's ready!");
} else { } else {
getLogger().info("Unable to find Skript or Skript isn't accepting registrations, disabling SkStuff..."); getLogger().info("Unable to find Skript or Skript isn't accepting registrations, disabling SkStuff...");
@ -43,49 +55,44 @@ public class SkStuff extends JavaPlugin {
} }
} }
public static boolean setupNMSVersion() { private boolean setupNMSVersion() {
String version = ReflectionUtils.getVersion(); String version = ReflectionUtils.getVersion();
switch (version) { switch (version) {
case "v1_8_R3.": case "v1_8_R3.":
nmsMethods = new NMS_v1_8_R3(); nmsMethods = new NMS_v1_8_R3();
Bukkit.getLogger().info("It looks like you're running 1.8.8!"); getLogger().info("It looks like you're running 1.8.8!");
break; break;
case "v1_9_R2.": case "v1_9_R2.":
nmsMethods = new NMS_v1_9_R2(); nmsMethods = new NMS_v1_9_R2();
Bukkit.getLogger().info("It looks like you're running 1.9.4!"); getLogger().info("It looks like you're running 1.9.4!");
break; break;
case "v1_10_R1.": case "v1_10_R1.":
nmsMethods = new NMS_v1_10_R1(); nmsMethods = new NMS_v1_10_R1();
Bukkit.getLogger().info("It looks like you're running 1.10.2!"); getLogger().info("It looks like you're running 1.10.2!");
break; break;
case "v1_11_R1.": case "v1_11_R1.":
nmsMethods = new NMS_v1_11_R1(); nmsMethods = new NMS_v1_11_R1();
Bukkit.getLogger().info("It looks like you're running 1.11.2!"); getLogger().info("It looks like you're running 1.11.2!");
break; break;
case "v1_12_R1.": case "v1_12_R1.":
nmsMethods = new NMS_v1_12_R1(); nmsMethods = new NMS_v1_12_R1();
Bukkit.getLogger().info("It looks like you're running 1.12.2!"); getLogger().info("It looks like you're running 1.12.2!");
break; break;
case "v1_13_R2.": case "v1_13_R2.":
nmsMethods = new NMS_v1_13_R2(); nmsMethods = new NMS_v1_13_R2();
Bukkit.getLogger().info("It looks like you're running 1.13.2!"); getLogger().info("It looks like you're running 1.13.2!");
break; break;
case "v1_14_R1.": case "v1_14_R1.":
nmsMethods = new NMS_v1_14_R1(); nmsMethods = new NMS_v1_14_R1();
Bukkit.getLogger().info("It looks like you're running 1.14.4!"); getLogger().info("It looks like you're running 1.14.2!");
break; break;
case "v1_15_R1.": case "v1_15_R1.":
nmsMethods = new NMS_v1_15_R1(); nmsMethods = new NMS_v1_15_R1();
Bukkit.getLogger().info("It looks like you're running 1.15.2!"); getLogger().info("It looks like you're running 1.15.1!");
break;
case "v1_16_R3.":
nmsMethods = new NMS_v1_16_R3();
Bukkit.getLogger().info("It looks like you're running 1.16.4!");
break; break;
default: default:
Bukkit.getLogger().warning("It looks like you're running an unsupported server version, some features will not be available :("); getLogger().warning("It looks like you're running an unsupported server version, some features will not be available :(");
break; break;
} }
return nmsMethods != null; return nmsMethods != null;
@ -96,6 +103,6 @@ public class SkStuff extends JavaPlugin {
} }
public void onDisable() { public void onDisable() {
getLogger().info("SkStuff " + this.getDescription().getVersion() + " has been successfully disabled."); getLogger().info("SkPathfinderGoals " + this.getDescription().getVersion() + " has been successfully disabled.");
} }
} }

0
src/me/TheBukor/SkStuff/bstats/Metrics.java Executable file → Normal file
View File

5
src/me/TheBukor/SkStuff/effects/EffClearPathGoals.java Executable file → Normal file
View File

@ -2,7 +2,6 @@ package me.TheBukor.SkStuff.effects;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.bukkit.Bukkit;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -34,11 +33,7 @@ public class EffClearPathGoals extends Effect {
LivingEntity[] ents = entities.getAll(e); LivingEntity[] ents = entities.getAll(e);
for (LivingEntity ent : ents) { for (LivingEntity ent : ents) {
if (!(ent instanceof Player || ent instanceof ArmorStand || ent == null)) { if (!(ent instanceof Player || ent instanceof ArmorStand || ent == null)) {
if (SkStuff.setupNMSVersion()) {
SkStuff.getNMSMethods().clearPathfinderGoals(ent); SkStuff.getNMSMethods().clearPathfinderGoals(ent);
} else {
//Bukkit.getMobGoals().removeAllGoals(ent);
}
} }
} }
} }

0
src/me/TheBukor/SkStuff/effects/EffMakeJump.java Executable file → Normal file
View File

0
src/me/TheBukor/SkStuff/effects/EffRemovePathGoal.java Executable file → Normal file
View File

26
src/me/TheBukor/SkStuff/effects/EffSetPathGoal.java Executable file → Normal file
View File

@ -7,7 +7,6 @@ import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import me.TheBukor.SkStuff.pathfinders.*;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Animals; import org.bukkit.entity.Animals;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
@ -41,6 +40,8 @@ import ch.njol.skript.lang.SkriptParser.ParseResult;
import ch.njol.skript.util.Timespan; import ch.njol.skript.util.Timespan;
import ch.njol.util.Kleenean; import ch.njol.util.Kleenean;
import me.TheBukor.SkStuff.SkStuff; import me.TheBukor.SkStuff.SkStuff;
import me.TheBukor.SkStuff.pathfinders.PathfinderGoalFollow_v1_13_R2;
import me.TheBukor.SkStuff.pathfinders.PathfinderGoalFollow_v1_14_R1;
import me.TheBukor.SkStuff.util.ReflectionUtils; import me.TheBukor.SkStuff.util.ReflectionUtils;
public final class EffSetPathGoal extends Effect { public final class EffSetPathGoal extends Effect {
@ -96,7 +97,7 @@ public final class EffSetPathGoal extends Effect {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean arg2, ParseResult result) { public final boolean init(Expression<?>[] expr, int matchedPattern, Kleenean arg2, ParseResult result) {
goalPriority = (Expression<Integer>) expr[0]; goalPriority = (Expression<Integer>) expr[0];
mark = result.mark; mark = result.mark;
if (mark == 0) { if (mark == 0) {
@ -155,7 +156,7 @@ public final class EffSetPathGoal extends Effect {
bowShootUnkParam = (Expression<Number>) expr[36]; bowShootUnkParam = (Expression<Number>) expr[36];
bowShootFollowRange = (Expression<Number>) expr[37]; bowShootFollowRange = (Expression<Number>) expr[37];
} }
entities = (Expression<LivingEntity>) expr[expr.length - 1]; entities = (Expression<LivingEntity>) expr[38];
/* Debug stuff, just in case I need it /* Debug stuff, just in case I need it
int i = 0; int i = 0;
for (Expression<?> expression : expr) { for (Expression<?> expression : expr) {
@ -264,7 +265,7 @@ public final class EffSetPathGoal extends Effect {
newGoals.add(goalFollowAdults.getConstructor(entAnimal, double.class).newInstance(nmsEnt, spd)); newGoals.add(goalFollowAdults.getConstructor(entAnimal, double.class).newInstance(nmsEnt, spd));
} else if (mark == 8) { } else if (mark == 8) {
target = true; target = true;
boolean callHelp = (callForHelp != null && callForHelp.getSingle(e)); boolean callHelp = (callForHelp == null ? false : callForHelp.getSingle(e));
EntityData<?>[] types = typesToFightBack.getAll(e); EntityData<?>[] types = typesToFightBack.getAll(e);
List<Class<?>> typesClasses = new ArrayList<Class<?>>(); List<Class<?>> typesClasses = new ArrayList<Class<?>>();
for (EntityData<?> entData : types) { for (EntityData<?> entData : types) {
@ -326,7 +327,7 @@ public final class EffSetPathGoal extends Effect {
} }
} else { } else {
double spd = (meleeSpeed == null ? 1.0D : meleeSpeed.getSingle(e).doubleValue()); double spd = (meleeSpeed == null ? 1.0D : meleeSpeed.getSingle(e).doubleValue());
boolean memorize = (meleeMemorize != null && meleeMemorize.getSingle(e)); boolean memorize = (meleeMemorize == null ? false : meleeMemorize.getSingle(e));
Class<?> goalMeleeAttack = ReflectionUtils.getNMSClass("PathfinderGoalMeleeAttack"); Class<?> goalMeleeAttack = ReflectionUtils.getNMSClass("PathfinderGoalMeleeAttack");
newGoals.add(goalMeleeAttack.getConstructor(entCreature, double.class, boolean.class).newInstance(nmsEnt, spd, memorize)); newGoals.add(goalMeleeAttack.getConstructor(entCreature, double.class, boolean.class).newInstance(nmsEnt, spd, memorize));
} }
@ -353,7 +354,7 @@ public final class EffSetPathGoal extends Effect {
newGoals.add(ReflectionUtils.getConstructor(goalSpiderNearTarget, nmsEnt.getClass(), Class.class).newInstance(nmsEnt, nmsClass)); newGoals.add(ReflectionUtils.getConstructor(goalSpiderNearTarget, nmsEnt.getClass(), Class.class).newInstance(nmsEnt, nmsClass));
} }
} else { } else {
boolean checkView = (checkSight == null || checkSight.getSingle(e)); boolean checkView = (checkSight == null ? true : checkSight.getSingle(e));
Class<?> goalNearTarget = ReflectionUtils.getNMSClass("PathfinderGoalNearestAttackableTarget"); Class<?> goalNearTarget = ReflectionUtils.getNMSClass("PathfinderGoalNearestAttackableTarget");
for (EntityData<?> entData : types) { for (EntityData<?> entData : types) {
if (!LivingEntity.class.isAssignableFrom(entData.getType())) if (!LivingEntity.class.isAssignableFrom(entData.getType()))
@ -538,21 +539,16 @@ public final class EffSetPathGoal extends Effect {
} }
Class<?> nmsClass = ReflectionUtils.getNMSClass("Entity" + className); Class<?> nmsClass = ReflectionUtils.getNMSClass("Entity" + className);
switch (version) { switch (version) {
//case "v1.12_R1.": case "v1.12_R1.":
// newGoals.add(new PathfinderGoalFollow_v1_12_R1((net.minecraft.server.v1_12_R1.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName)); newGoals.add(new PathfinderGoalFollow_v1_12_R1((net.minecraft.server.v1_12_R1.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName));
// break; break;
case "v1.13_R2.": case "v1.13_R2.":
newGoals.add(new PathfinderGoalFollow_v1_13_R2((net.minecraft.server.v1_13_R2.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName)); newGoals.add(new PathfinderGoalFollow_v1_13_R2((net.minecraft.server.v1_13_R2.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName));
break; break;
case "v1.14_R1.": case "v1.14_R1.":
newGoals.add(new PathfinderGoalFollow_v1_14_R1((net.minecraft.server.v1_14_R1.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName)); newGoals.add(new PathfinderGoalFollow_v1_14_R1((net.minecraft.server.v1_14_R1.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName));
break; break;
case "v1.15_R1.": }
newGoals.add(new PathfinderGoalFollow_v1_15_R1((net.minecraft.server.v1_15_R1.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName));
break;
case "v1.16_R3.":
newGoals.add(new PathfinderGoalFollow_v1_16_R3((net.minecraft.server.v1_16_R3.EntityCreature) nmsEnt, nmsClass, radius, spd, usesName, customName));
break;
} }
} }
} else if (mark == 42) { } else if (mark == 42) {

View File

0
src/me/TheBukor/SkStuff/expressions/ExprFireProof.java Executable file → Normal file
View File

0
src/me/TheBukor/SkStuff/expressions/ExprNoClip.java Executable file → Normal file
View File

View File

View File

@ -1,5 +1,10 @@
package me.TheBukor.SkStuff.pathfinders; package me.TheBukor.SkStuff.pathfinders;
import me.TheBukor.SkStuff.util.ReflectionUtils;
import net.minecraft.server.v1_13_R2.*; import net.minecraft.server.v1_13_R2.*;
import java.lang.reflect.Field;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
public class PathfinderGoalFollow_v1_13_R2 extends PathfinderGoal { public class PathfinderGoalFollow_v1_13_R2 extends PathfinderGoal {

View File

View File

View File

@ -1,22 +1,22 @@
package me.TheBukor.SkStuff.pathfinders; package me.TheBukor.SkStuff.pathfinders;
import net.minecraft.server.v1_16_R3.Entity; import net.minecraft.server.v1_16_R1.Entity;
import net.minecraft.server.v1_16_R3.EntityCreature; import net.minecraft.server.v1_16_R1.EntityCreature;
import net.minecraft.server.v1_16_R3.EntityLiving; import net.minecraft.server.v1_16_R1.EntityLiving;
import net.minecraft.server.v1_16_R3.PathfinderGoal; import net.minecraft.server.v1_16_R1.PathfinderGoal;
import java.util.List; import java.util.List;
public class PathfinderGoalFollow_v1_16_R3 extends PathfinderGoal { public class PathfinderGoalFollow_v1_16_R1 extends PathfinderGoal {
private final EntityCreature follower; private EntityCreature follower;
private EntityLiving followed; private EntityLiving followed;
private final Class<?> followedClass; private Class<?> followedClass;
private final float radius; private float radius;
private final double speed; private double speed;
private final boolean isByName; private boolean isByName;
private final String customName; private String customName;
public PathfinderGoalFollow_v1_16_R3(EntityCreature follower, Class<?> followedClass, float radius, double speed, boolean isByName, String customName) { public PathfinderGoalFollow_v1_16_R1(EntityCreature follower, Class<?> followedClass, float radius, double speed, boolean isByName, String customName) {
this.follower = follower; this.follower = follower;
this.followedClass = followedClass; this.followedClass = followedClass;
this.radius = radius; this.radius = radius;

0
src/me/TheBukor/SkStuff/util/NMSInterface.java Executable file → Normal file
View File

0
src/me/TheBukor/SkStuff/util/NMS_v1_10_R1.java Executable file → Normal file
View File

0
src/me/TheBukor/SkStuff/util/NMS_v1_11_R1.java Executable file → Normal file
View File

0
src/me/TheBukor/SkStuff/util/NMS_v1_12_R1.java Executable file → Normal file
View File

0
src/me/TheBukor/SkStuff/util/NMS_v1_13_R2.java Executable file → Normal file
View File

50
src/me/TheBukor/SkStuff/util/NMS_v1_14_R1.java Executable file → Normal file
View File

@ -2,14 +2,13 @@ package me.TheBukor.SkStuff.util;
import net.minecraft.server.v1_14_R1.EntityInsentient; import net.minecraft.server.v1_14_R1.EntityInsentient;
import net.minecraft.server.v1_14_R1.BehaviorController;
import net.minecraft.server.v1_14_R1.PathfinderGoal; import net.minecraft.server.v1_14_R1.PathfinderGoal;
import net.minecraft.server.v1_14_R1.PathfinderGoalSelector; import net.minecraft.server.v1_14_R1.PathfinderGoalSelector;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import java.lang.reflect.Field; import java.util.Iterator;
import java.util.*; import java.util.LinkedHashSet;
public class NMS_v1_14_R1 implements NMSInterface { public class NMS_v1_14_R1 implements NMSInterface {
@ -17,46 +16,11 @@ public class NMS_v1_14_R1 implements NMSInterface {
@Override @Override
public void clearPathfinderGoals(Entity entity) { public void clearPathfinderGoals(Entity entity) {
EntityInsentient nmsEntity = (EntityInsentient) ((CraftEntity) entity).getHandle(); EntityInsentient nmsEnt = (EntityInsentient) ((CraftEntity) entity).getHandle();
PathfinderGoalSelector goalSelector = nmsEntity.goalSelector; ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, nmsEnt.goalSelector)).clear();
PathfinderGoalSelector targetSelector = nmsEntity.targetSelector; ((LinkedHashSet<?>) ReflectionUtils.getField("c", PathfinderGoalSelector.class, nmsEnt.goalSelector)).clear();
try { ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, nmsEnt.targetSelector)).clear();
BehaviorController<?> controller = nmsEntity.getBehaviorController(); ((LinkedHashSet<?>) ReflectionUtils.getField("c", PathfinderGoalSelector.class, nmsEnt.targetSelector)).clear();
Field memoriesField = BehaviorController.class.getDeclaredField("memories");
memoriesField.setAccessible(true);
memoriesField.set(controller, new HashMap<>());
Field sensorsField = BehaviorController.class.getDeclaredField("sensors");
sensorsField.setAccessible(true);
sensorsField.set(controller, new LinkedHashMap<>());
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
try {
Field dField;
dField = PathfinderGoalSelector.class.getDeclaredField("d");
dField.setAccessible(true);
dField.set(goalSelector, new LinkedHashSet<>());
dField.set(targetSelector, new LinkedHashSet<>());
Field cField;
cField = PathfinderGoalSelector.class.getDeclaredField("c");
cField.setAccessible(true);
dField.set(goalSelector, new LinkedHashSet<>());
cField.set(targetSelector, new EnumMap<>(net.minecraft.server.v1_14_R1.PathfinderGoal.Type.class));
Field fField;
fField = PathfinderGoalSelector.class.getDeclaredField("f");
fField.setAccessible(true);
dField.set(goalSelector, new LinkedHashSet<>());
fField.set(targetSelector, EnumSet.noneOf(PathfinderGoal.Type.class));
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
} }
@Override @Override

50
src/me/TheBukor/SkStuff/util/NMS_v1_15_R1.java Executable file → Normal file
View File

@ -1,15 +1,14 @@
package me.TheBukor.SkStuff.util; package me.TheBukor.SkStuff.util;
import net.minecraft.server.v1_15_R1.BehaviorController;
import net.minecraft.server.v1_15_R1.EntityInsentient; import net.minecraft.server.v1_15_R1.EntityInsentient;
import net.minecraft.server.v1_15_R1.PathfinderGoal; import net.minecraft.server.v1_15_R1.PathfinderGoal;
import net.minecraft.server.v1_15_R1.PathfinderGoalSelector; import net.minecraft.server.v1_15_R1.PathfinderGoalSelector;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import java.lang.reflect.Field; import java.util.Iterator;
import java.util.*; import java.util.LinkedHashSet;
public class NMS_v1_15_R1 implements NMSInterface { public class NMS_v1_15_R1 implements NMSInterface {
@ -17,46 +16,11 @@ public class NMS_v1_15_R1 implements NMSInterface {
@Override @Override
public void clearPathfinderGoals(Entity entity) { public void clearPathfinderGoals(Entity entity) {
EntityInsentient nmsEntity = (EntityInsentient) ((CraftEntity) entity).getHandle(); EntityInsentient nmsEnt = (EntityInsentient) ((CraftEntity) entity).getHandle();
PathfinderGoalSelector goalSelector = nmsEntity.goalSelector; ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, nmsEnt.goalSelector)).clear();
PathfinderGoalSelector targetSelector = nmsEntity.targetSelector; ((LinkedHashSet<?>) ReflectionUtils.getField("c", PathfinderGoalSelector.class, nmsEnt.goalSelector)).clear();
try { ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, nmsEnt.targetSelector)).clear();
BehaviorController<?> controller = nmsEntity.getBehaviorController(); ((LinkedHashSet<?>) ReflectionUtils.getField("c", PathfinderGoalSelector.class, nmsEnt.targetSelector)).clear();
Field memoriesField = BehaviorController.class.getDeclaredField("memories");
memoriesField.setAccessible(true);
memoriesField.set(controller, new HashMap<>());
Field sensorsField = BehaviorController.class.getDeclaredField("sensors");
sensorsField.setAccessible(true);
sensorsField.set(controller, new LinkedHashMap<>());
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
try {
Field dField;
dField = PathfinderGoalSelector.class.getDeclaredField("d");
dField.setAccessible(true);
dField.set(goalSelector, new LinkedHashSet<>());
dField.set(targetSelector, new LinkedHashSet<>());
Field cField;
cField = PathfinderGoalSelector.class.getDeclaredField("c");
cField.setAccessible(true);
dField.set(goalSelector, new LinkedHashSet<>());
cField.set(targetSelector, new EnumMap<>(PathfinderGoal.Type.class));
Field fField;
fField = PathfinderGoalSelector.class.getDeclaredField("f");
fField.setAccessible(true);
dField.set(goalSelector, new LinkedHashSet<>());
fField.set(targetSelector, EnumSet.noneOf(PathfinderGoal.Type.class));
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
} }
@Override @Override

View File

@ -0,0 +1,94 @@
package me.TheBukor.SkStuff.util;
import net.minecraft.server.v1_16_R1.EntityInsentient;
import net.minecraft.server.v1_16_R1.PathfinderGoal;
import net.minecraft.server.v1_16_R1.PathfinderGoalSelector;
import org.bukkit.craftbukkit.v1_16_R1.entity.CraftEntity;
import org.bukkit.entity.Entity;
import java.util.Iterator;
import java.util.LinkedHashSet;
public class NMS_v1_16_R1 implements NMSInterface {
@Override
public void clearPathfinderGoals(Entity entity) {
EntityInsentient nmsEnt = (EntityInsentient) ((CraftEntity) entity).getHandle();
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, nmsEnt.goalSelector)).clear();
((LinkedHashSet<?>) ReflectionUtils.getField("c", PathfinderGoalSelector.class, nmsEnt.goalSelector)).clear();
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, nmsEnt.targetSelector)).clear();
((LinkedHashSet<?>) ReflectionUtils.getField("c", PathfinderGoalSelector.class, nmsEnt.targetSelector)).clear();
}
@Override
public void removePathfinderGoal(Object entity, Class<?> goalClass, boolean isTargetSelector) {
if (entity instanceof EntityInsentient) {
((EntityInsentient) entity).setGoalTarget(null);
if (isTargetSelector) {
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).iterator();
while (goals.hasNext()) {
Object goal = goals.next();
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
goals.remove();
}
}
} else {
Iterator<?> goals = ((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).iterator();
while (goals.hasNext()) {
Object goal = goals.next();
if (ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass) {
goals.remove();
}
}
}
}
}
@Override
public void addPathfinderGoal(Object entity, int priority, Object goal, boolean isTargetSelector) {
if (entity instanceof EntityInsentient && goal instanceof PathfinderGoal) {
if (isTargetSelector)
((EntityInsentient) entity).targetSelector.a(priority, (PathfinderGoal) goal);
else
((EntityInsentient) entity).goalSelector.a(priority, (PathfinderGoal) goal);
}
}
@Override
public boolean getNoClip(Entity entity) {
net.minecraft.server.v1_16_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
return nmsEntity.noclip;
}
@Override
public void setNoClip(Entity entity, boolean noclip) {
net.minecraft.server.v1_16_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
nmsEntity.noclip = noclip;
}
@Override
public boolean getFireProof(Entity entity) {
net.minecraft.server.v1_16_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
return nmsEntity.isFireProof();
}
@Override
public void setFireProof(Entity entity, boolean fireProof) {
net.minecraft.server.v1_16_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
ReflectionUtils.setField("fireProof", nmsEntity.getClass(), nmsEntity, fireProof);
}
public float getEntityStepLength(Entity entity) {
net.minecraft.server.v1_16_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
return nmsEntity.G;
}
@Override
public void setEntityStepLength(Entity entity, float length) {
net.minecraft.server.v1_16_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
nmsEntity.G = length;
}
}

View File

@ -1,79 +0,0 @@
package me.TheBukor.SkStuff.util;
import net.minecraft.server.v1_16_R3.EntityInsentient;
import net.minecraft.server.v1_16_R3.PathfinderGoal;
import net.minecraft.server.v1_16_R3.PathfinderGoalSelector;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Mob;
import java.util.LinkedHashSet;
public class NMS_v1_16_R3 implements NMSInterface {
@Override
public void clearPathfinderGoals(Entity entity) {
Mob e = (Mob) entity;
//Bukkit.getMobGoals().removeAllGoals(e);
}
@Override
public void removePathfinderGoal(Object entity, Class<?> goalClass, boolean isTargetSelector) {
if (entity instanceof EntityInsentient) {
((EntityInsentient) entity).setGoalTarget(null);
if (isTargetSelector) {
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).targetSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
} else {
((LinkedHashSet<?>) ReflectionUtils.getField("b", PathfinderGoalSelector.class, ((EntityInsentient) entity).goalSelector)).removeIf(goal -> ReflectionUtils.getField("a", goal.getClass(), goal).getClass() == goalClass);
}
}
}
@Override
public void addPathfinderGoal(Object entity, int priority, Object goal, boolean isTargetSelector) {
if (entity instanceof EntityInsentient && goal instanceof PathfinderGoal) {
if (isTargetSelector)
((EntityInsentient) entity).targetSelector.a(priority, (PathfinderGoal) goal);
else
((EntityInsentient) entity).goalSelector.a(priority, (PathfinderGoal) goal);
}
}
@Override
public boolean getNoClip(Entity entity) {
net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
return nmsEntity.noclip;
}
@Override
public void setNoClip(Entity entity, boolean noclip) {
net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
nmsEntity.noclip = noclip;
}
@Override
public boolean getFireProof(Entity entity) {
net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
return nmsEntity.isFireProof();
}
@Override
public void setFireProof(Entity entity, boolean fireProof) {
net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
ReflectionUtils.setField("fireProof", nmsEntity.getClass(), nmsEntity, fireProof);
}
public float getEntityStepLength(Entity entity) {
net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
return nmsEntity.G;
}
@Override
public void setEntityStepLength(Entity entity, float length) {
net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
nmsEntity.G = length;
}
}

0
src/me/TheBukor/SkStuff/util/NMS_v1_8_R3.java Executable file → Normal file
View File

0
src/me/TheBukor/SkStuff/util/NMS_v1_9_R2.java Executable file → Normal file
View File

0
src/me/TheBukor/SkStuff/util/ReflectionUtils.java Executable file → Normal file
View File