Make some small changes to the latest merge request
This commit is contained in:
parent
76912d7c01
commit
584b26c7ec
|
@ -5,9 +5,14 @@
|
||||||
<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$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/java/net/seanomik/tamablefoxes/EntityTamableFox.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/net/seanomik/tamablefoxes/EntityTamableFox.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/net/seanomik/tamablefoxes/EntityTamableFox.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/net/seanomik/tamablefoxes/EntityTamableFox.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/java/net/seanomik/tamablefoxes/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/net/seanomik/tamablefoxes/Utils.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/net/seanomik/tamablefoxes/io/LanguageConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/net/seanomik/tamablefoxes/io/LanguageConfig.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/resources/config.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/config.yml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/resources/language.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/language.yml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/target/classes/config.yml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/config.yml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/target/classes/plugin.yml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/plugin.yml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/target/maven-archiver/pom.properties" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-archiver/pom.properties" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" beforeDir="false" afterPath="$PROJECT_DIR$/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst" 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" />
|
||||||
|
@ -153,10 +158,10 @@
|
||||||
</state>
|
</state>
|
||||||
<state x="414" y="174" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580081956712" />
|
<state x="414" y="174" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580081956712" />
|
||||||
<state x="414" y="174" key="#com.intellij.execution.impl.EditConfigurationsDialog/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1579710781130" />
|
<state x="414" y="174" key="#com.intellij.execution.impl.EditConfigurationsDialog/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1579710781130" />
|
||||||
<state x="765" y="230" key="#com.intellij.ide.util.MemberChooser" timestamp="1580081253579">
|
<state x="765" y="230" key="#com.intellij.ide.util.MemberChooser" timestamp="1580580882620">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="765" y="230" key="#com.intellij.ide.util.MemberChooser/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580081253579" />
|
<state x="765" y="230" key="#com.intellij.ide.util.MemberChooser/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580580882620" />
|
||||||
<state x="765" y="230" key="#com.intellij.ide.util.MemberChooser/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1579708181770" />
|
<state x="765" y="230" key="#com.intellij.ide.util.MemberChooser/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1579708181770" />
|
||||||
<state x="740" y="274" key="FileChooserDialogImpl" timestamp="1580081289890">
|
<state x="740" y="274" key="FileChooserDialogImpl" timestamp="1580081289890">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
|
@ -166,51 +171,51 @@
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="794" y="418" width="356" height="203" key="Github.CreateGistDialog/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580081718270" />
|
<state x="794" y="418" width="356" height="203" key="Github.CreateGistDialog/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580081718270" />
|
||||||
<state width="1877" height="221" key="GridCell.Tab.0.bottom" timestamp="1580171814347">
|
<state width="1877" height="221" key="GridCell.Tab.0.bottom" timestamp="1580583328931">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="221" key="GridCell.Tab.0.bottom/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580171814347" />
|
<state width="1877" height="221" key="GridCell.Tab.0.bottom/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580583328931" />
|
||||||
<state width="1877" height="199" key="GridCell.Tab.0.bottom/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1580134668965" />
|
<state width="1877" height="199" key="GridCell.Tab.0.bottom/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1580134668965" />
|
||||||
<state width="1877" height="221" key="GridCell.Tab.0.center" timestamp="1580171814347">
|
<state width="1877" height="221" key="GridCell.Tab.0.center" timestamp="1580583328930">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="221" key="GridCell.Tab.0.center/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580171814347" />
|
<state width="1877" height="221" key="GridCell.Tab.0.center/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580583328930" />
|
||||||
<state width="1877" height="199" key="GridCell.Tab.0.center/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1580134668964" />
|
<state width="1877" height="199" key="GridCell.Tab.0.center/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1580134668964" />
|
||||||
<state width="1877" height="221" key="GridCell.Tab.0.left" timestamp="1580171814347">
|
<state width="1877" height="221" key="GridCell.Tab.0.left" timestamp="1580583328930">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="221" key="GridCell.Tab.0.left/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580171814347" />
|
<state width="1877" height="221" key="GridCell.Tab.0.left/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580583328930" />
|
||||||
<state width="1877" height="199" key="GridCell.Tab.0.left/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1580134668964" />
|
<state width="1877" height="199" key="GridCell.Tab.0.left/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1580134668964" />
|
||||||
<state width="1877" height="221" key="GridCell.Tab.0.right" timestamp="1580171814347">
|
<state width="1877" height="221" key="GridCell.Tab.0.right" timestamp="1580583328931">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="221" key="GridCell.Tab.0.right/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580171814347" />
|
<state width="1877" height="221" key="GridCell.Tab.0.right/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580583328931" />
|
||||||
<state width="1877" height="199" key="GridCell.Tab.0.right/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1580134668964" />
|
<state width="1877" height="199" key="GridCell.Tab.0.right/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1580134668964" />
|
||||||
<state width="1877" height="221" key="GridCell.Tab.1.bottom" timestamp="1580171814249">
|
<state width="1877" height="221" key="GridCell.Tab.1.bottom" timestamp="1580583328827">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="221" key="GridCell.Tab.1.bottom/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580171814249" />
|
<state width="1877" height="221" key="GridCell.Tab.1.bottom/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580583328827" />
|
||||||
<state width="1877" height="221" key="GridCell.Tab.1.center" timestamp="1580171814249">
|
<state width="1877" height="221" key="GridCell.Tab.1.center" timestamp="1580583328827">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="221" key="GridCell.Tab.1.center/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580171814249" />
|
<state width="1877" height="221" key="GridCell.Tab.1.center/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580583328827" />
|
||||||
<state width="1877" height="221" key="GridCell.Tab.1.left" timestamp="1580171814249">
|
<state width="1877" height="221" key="GridCell.Tab.1.left" timestamp="1580583328827">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="221" key="GridCell.Tab.1.left/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580171814249" />
|
<state width="1877" height="221" key="GridCell.Tab.1.left/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580583328827" />
|
||||||
<state width="1877" height="221" key="GridCell.Tab.1.right" timestamp="1580171814249">
|
<state width="1877" height="221" key="GridCell.Tab.1.right" timestamp="1580583328827">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="221" key="GridCell.Tab.1.right/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580171814249" />
|
<state width="1877" height="221" key="GridCell.Tab.1.right/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580583328827" />
|
||||||
<state x="490" y="174" key="Maven.ArtifactSearchDialog" timestamp="1579373377880">
|
<state x="490" y="174" key="Maven.ArtifactSearchDialog" timestamp="1579373377880">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="498" height="446" key="SwitcherDM/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1579469022098" />
|
<state width="498" height="446" key="SwitcherDM/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1579469022098" />
|
||||||
<state width="498" height="446" key="SwitcherDM/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1579705820492" />
|
<state width="498" height="446" key="SwitcherDM/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1579705820492" />
|
||||||
<state x="656" y="343" key="com.intellij.ide.util.TipDialog" timestamp="1580171129088">
|
<state x="656" y="343" key="com.intellij.ide.util.TipDialog" timestamp="1580582504511">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="656" y="343" key="com.intellij.ide.util.TipDialog/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580171129088" />
|
<state x="656" y="343" key="com.intellij.ide.util.TipDialog/0.0.1920.1040/-1920.0.1920.1040@0.0.1920.1040" timestamp="1580582504511" />
|
||||||
<state x="656" y="343" key="com.intellij.ide.util.TipDialog/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1580132930429" />
|
<state x="656" y="343" key="com.intellij.ide.util.TipDialog/1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1580132930429" />
|
||||||
<state x="-781" y="188" width="1359" height="1028" key="dock-window-1" timestamp="1580017524734">
|
<state x="-781" y="188" width="1359" height="1028" key="dock-window-1" timestamp="1580017524734">
|
||||||
<screen x="-1920" y="0" width="1920" height="1040" />
|
<screen x="-1920" y="0" width="1920" height="1040" />
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<groupId>net.seanomik</groupId>
|
<groupId>net.seanomik</groupId>
|
||||||
<artifactId>tamablefoxes</artifactId>
|
<artifactId>tamablefoxes</artifactId>
|
||||||
<version>1.5.2-SNAPSHOT</version>
|
<version>1.5.4-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Tamablefoxes</name>
|
<name>Tamablefoxes</name>
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class EntityTamableFox extends EntityFox {
|
||||||
private EntityLiving owner;
|
private EntityLiving owner;
|
||||||
private UUID ownerUUID;
|
private UUID ownerUUID;
|
||||||
private FoxPathfinderGoalSit goalSit;
|
private FoxPathfinderGoalSit goalSit;
|
||||||
|
private String customName = "";
|
||||||
|
|
||||||
public EntityTamableFox(EntityTypes<? extends EntityFox> entitytypes, World world) {
|
public EntityTamableFox(EntityTypes<? extends EntityFox> entitytypes, World world) {
|
||||||
super(entitytypes, world);
|
super(entitytypes, world);
|
||||||
|
@ -178,7 +179,9 @@ public class EntityTamableFox extends EntityFox {
|
||||||
this.tamed = tamed;
|
this.tamed = tamed;
|
||||||
|
|
||||||
// Remove goals that are not needed when named, or defeats the purpose of taming
|
// Remove goals that are not needed when named, or defeats the purpose of taming
|
||||||
untamedGoals.forEach(goal -> goalSelector.a(goal));
|
try {
|
||||||
|
untamedGoals.forEach(goal -> goalSelector.a(goal));
|
||||||
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityLiving getOwner() {
|
public EntityLiving getOwner() {
|
||||||
|
@ -210,14 +213,24 @@ public class EntityTamableFox extends EntityFox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is needed for the updateFoxVisual runnable to set the foxes name.
|
||||||
|
void setCustomName(String customName) {
|
||||||
|
this.customName = customName;
|
||||||
|
updateFoxVisual();
|
||||||
|
}
|
||||||
|
|
||||||
public void updateFoxVisual() {
|
public void updateFoxVisual() {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
goalSit.setSitting(sitting);
|
goalSit.setSitting(sitting);
|
||||||
|
|
||||||
if (tamed && owner != null && !hasCustomName() && Config.doesShowOwnerFoxName()) {
|
if (tamed && owner != null && !customName.isEmpty()) {
|
||||||
getBukkitEntity().setCustomName(LanguageConfig.getOwnerInFoxNameFormat().replaceAll("%player%", owner.getName()));
|
if (Config.doesShowOwnerFoxName()) {
|
||||||
|
getBukkitEntity().setCustomName(LanguageConfig.getFoxNameFormat().replaceAll("%OWNER%", owner.getName()).replaceAll("%FOX_NAME%", customName));
|
||||||
|
} else {
|
||||||
|
getBukkitEntity().setCustomName(LanguageConfig.getFoxNameFormat().replaceAll("%FOX_NAME%", customName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTask(TamableFoxes.getPlugin());
|
}.runTask(TamableFoxes.getPlugin());
|
||||||
|
|
|
@ -37,7 +37,10 @@ import java.util.stream.Collectors;
|
||||||
// @TODO:
|
// @TODO:
|
||||||
|
|
||||||
/* @CHANGELOG (1.5.2):
|
/* @CHANGELOG (1.5.2):
|
||||||
* Removed debug messages
|
* Code cleanup
|
||||||
|
* Updated old path finding goals
|
||||||
|
* Added a section in language.yml to customize how a foxes owner's name is displayed.
|
||||||
|
* Added a choice in the config.yml to disable the Anvil naming GUI so all foxes would have to be named by name tags.
|
||||||
*/
|
*/
|
||||||
public final class TamableFoxes extends JavaPlugin implements Listener {
|
public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
private static TamableFoxes plugin;
|
private static TamableFoxes plugin;
|
||||||
|
@ -62,11 +65,13 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
Field field = EntityTypes.FOX.getClass().getDeclaredField("ba");
|
Field field = EntityTypes.FOX.getClass().getDeclaredField("ba");
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
|
|
||||||
// Remove the final modifier from the "ba" variable
|
// If the field is final, then make it non final
|
||||||
Field fieldMutable = field.getClass().getDeclaredField("modifiers");
|
if ((field.getModifiers() & Modifier.FINAL) == Modifier.FINAL) {
|
||||||
fieldMutable.setAccessible(true);
|
Field fieldMutable = field.getClass().getDeclaredField("modifiers");
|
||||||
fieldMutable.set(field, fieldMutable.getInt(field) & ~Modifier.FINAL);
|
fieldMutable.setAccessible(true);
|
||||||
fieldMutable.setAccessible(false);
|
fieldMutable.set(field, fieldMutable.getInt(field) & ~Modifier.FINAL);
|
||||||
|
fieldMutable.setAccessible(false);
|
||||||
|
}
|
||||||
|
|
||||||
field.set(EntityTypes.FOX, (EntityTypes.b<EntityFox>) (type, world) -> new EntityTamableFox(type, world));
|
field.set(EntityTypes.FOX, (EntityTypes.b<EntityFox>) (type, world) -> new EntityTamableFox(type, world));
|
||||||
|
|
||||||
|
@ -74,7 +79,7 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getSuccessReplaced());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
//e.printStackTrace();
|
||||||
getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getFailureReplace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +113,7 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChunkLoad(ChunkLoadEvent event) {
|
public void onChunkLoad(ChunkLoadEvent event) { // Wait for all the entities to load.
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(this, ()-> {
|
Bukkit.getScheduler().runTaskLaterAsynchronously(this, ()-> {
|
||||||
spawnedFoxes.addAll(Utils.loadFoxesInChunk(event.getChunk()));
|
spawnedFoxes.addAll(Utils.loadFoxesInChunk(event.getChunk()));
|
||||||
}, 5L);
|
}, 5L);
|
||||||
|
@ -149,7 +154,7 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
EntityTamableFox tamableFox = (EntityTamableFox) ((CraftEntity) entity).getHandle();
|
EntityTamableFox tamableFox = (EntityTamableFox) ((CraftEntity) entity).getHandle();
|
||||||
|
|
||||||
// Check if its tamed but ignore it if the player is holding sweet berries for breeding or nametag for renaming
|
// Check if its tamed but ignore it if the player is holding sweet berries for breeding or nametag for renaming
|
||||||
if (tamableFox.isTamed() && tamableFox.getOwner() != null && itemHand.getType() != Material.SWEET_BERRIES && itemHand.getType() != Material.NAME_TAG) {
|
if (tamableFox.isTamed() && tamableFox.getOwner() != null && itemHand.getType() != Material.SWEET_BERRIES) {
|
||||||
if (tamableFox.getOwner().getUniqueID() == player.getUniqueId()) {
|
if (tamableFox.getOwner().getUniqueID() == player.getUniqueId()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
|
@ -160,6 +165,13 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
if (itemHand.getAmount() == 1) player.getInventory().removeItem(itemHand);
|
if (itemHand.getAmount() == 1) player.getInventory().removeItem(itemHand);
|
||||||
else itemHand.setAmount(itemHand.getAmount() - 1);
|
else itemHand.setAmount(itemHand.getAmount() - 1);
|
||||||
}
|
}
|
||||||
|
} else if (itemHand.getType() == Material.NAME_TAG) {
|
||||||
|
if (itemHand.getAmount() == 1) player.getInventory().removeItem(itemHand);
|
||||||
|
else itemHand.setAmount(itemHand.getAmount() - 1);
|
||||||
|
|
||||||
|
tamableFox.setCustomName(handMeta.getDisplayName());
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
} else {
|
} else {
|
||||||
tamableFox.toggleSitting();
|
tamableFox.toggleSitting();
|
||||||
}
|
}
|
||||||
|
@ -179,7 +191,7 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
new AnvilGUI.Builder()
|
new AnvilGUI.Builder()
|
||||||
.onComplete((plr, text) -> { // Called when the inventory output slot is clicked
|
.onComplete((plr, text) -> { // Called when the inventory output slot is clicked
|
||||||
if (!text.equals("")) {
|
if (!text.equals("")) {
|
||||||
tamableFox.getBukkitEntity().setCustomName(text);
|
tamableFox.setCustomName(text);
|
||||||
tamableFox.setCustomNameVisible(true);
|
tamableFox.setCustomNameVisible(true);
|
||||||
plr.sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(text));
|
plr.sendMessage(Utils.getPrefix() + ChatColor.GREEN + LanguageConfig.getTamingChosenPerfect(text));
|
||||||
tamableFox.saveNbt();
|
tamableFox.saveNbt();
|
||||||
|
@ -187,7 +199,6 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
return AnvilGUI.Response.close();
|
return AnvilGUI.Response.close();
|
||||||
})
|
})
|
||||||
//.preventClose() // Prevents the inventory from being closed
|
|
||||||
.text("Fox name") // Sets the text the GUI should start with
|
.text("Fox name") // Sets the text the GUI should start with
|
||||||
.plugin(this) // Set the plugin instance
|
.plugin(this) // Set the plugin instance
|
||||||
.open(player); // Opens the GUI for the player provided
|
.open(player); // Opens the GUI for the player provided
|
||||||
|
|
|
@ -107,8 +107,8 @@ public class LanguageConfig extends YamlConfiguration {
|
||||||
return getConfig().getString("taming-chosen-name-perfect").replaceAll("%NAME%", chosen);
|
return getConfig().getString("taming-chosen-name-perfect").replaceAll("%NAME%", chosen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getOwnerInFoxNameFormat() {
|
public static String getFoxNameFormat() {
|
||||||
return getConfig().getString("owner-in-fox-name-format");
|
return getConfig().getString("fox-name-format");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getNoPermMessage() {
|
public static String getNoPermMessage() {
|
||||||
|
@ -131,10 +131,6 @@ public class LanguageConfig extends YamlConfiguration {
|
||||||
public static String getReloadMessage() {
|
public static String getReloadMessage() {
|
||||||
return getConfig().getString("reloaded-message");
|
return getConfig().getString("reloaded-message");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCreatedSQLDatabase() {
|
|
||||||
return getConfig().getString("created-sql-foxes-database");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Config for Tamable Foxes
|
# Config for Tamable Foxes
|
||||||
show-owner-in-fox-name: true
|
show-owner-in-fox-name: true
|
||||||
enable-taming-permission: true
|
enable-taming-permission: true
|
||||||
ask-for-name-after-taming: false
|
ask-for-name-after-taming: true
|
||||||
|
|
||||||
tamed-behavior:
|
tamed-behavior:
|
||||||
attack-wild-animals: true
|
attack-wild-animals: true
|
|
@ -7,7 +7,7 @@ saving-foxes-message: "Saving foxes."
|
||||||
taming-tamed-message: "You just tamed a wild fox!"
|
taming-tamed-message: "You just tamed a wild fox!"
|
||||||
taming-asking-for-name-message: "What do you want to call it?"
|
taming-asking-for-name-message: "What do you want to call it?"
|
||||||
taming-chosen-name-perfect: "%NAME% is perfect!"
|
taming-chosen-name-perfect: "%NAME% is perfect!"
|
||||||
owner-in-fox-name-format: "%player%'s Fox"
|
fox-name-format: "%FOX_NAME% (%OWNER%'s Fox)"
|
||||||
|
|
||||||
no-permission: "You do not have the permission for this command."
|
no-permission: "You do not have the permission for this command."
|
||||||
only-run-by-player: "Command can only be run from player state!"
|
only-run-by-player: "Command can only be run from player state!"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Config for Tamable Foxes
|
# Config for Tamable Foxes
|
||||||
show-owner-in-fox-name: true
|
show-owner-in-fox-name: true
|
||||||
show-nametags: true
|
|
||||||
enable-taming-permission: true
|
enable-taming-permission: true
|
||||||
|
ask-for-name-after-taming: true
|
||||||
|
|
||||||
tamed-behavior:
|
tamed-behavior:
|
||||||
attack-wild-animals: true
|
attack-wild-animals: true
|
|
@ -1,5 +1,5 @@
|
||||||
name: Tamablefoxes
|
name: Tamablefoxes
|
||||||
version: 1.5.2-SNAPSHOT
|
version: 1.5.4-SNAPSHOT
|
||||||
main: net.seanomik.tamablefoxes.TamableFoxes
|
main: net.seanomik.tamablefoxes.TamableFoxes
|
||||||
api-version: 1.15
|
api-version: 1.15
|
||||||
load: POSTWORLD
|
load: POSTWORLD
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#Generated by Maven
|
#Generated by Maven
|
||||||
#Mon Jan 27 07:55:13 CST 2020
|
#Sat Feb 01 12:07:47 CST 2020
|
||||||
version=1.5.2-SNAPSHOT
|
version=1.5.4-SNAPSHOT
|
||||||
groupId=net.seanomik
|
groupId=net.seanomik
|
||||||
artifactId=tamablefoxes
|
artifactId=tamablefoxes
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
net\seanomik\tamablefoxes\EntityTamableFox.class
|
net\seanomik\tamablefoxes\EntityTamableFox.class
|
||||||
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalMeleeAttack.class
|
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalMeleeAttack.class
|
||||||
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalPanic.class
|
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalPanic.class
|
||||||
|
net\seanomik\tamablefoxes\EntityTamableFox$1.class
|
||||||
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalHurtByTarget.class
|
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalHurtByTarget.class
|
||||||
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalFollowOwner.class
|
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalFollowOwner.class
|
||||||
net\seanomik\tamablefoxes\TamableFoxes.class
|
net\seanomik\tamablefoxes\TamableFoxes.class
|
||||||
net\seanomik\tamablefoxes\EntityTamableFox$UpdateFoxRunnable.class
|
|
||||||
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalSit.class
|
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalSit.class
|
||||||
net\seanomik\tamablefoxes\versions\version_1_15\command\CommandSpawnTamableFox.class
|
net\seanomik\tamablefoxes\versions\version_1_15\command\CommandSpawnTamableFox.class
|
||||||
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalOwnerHurtByTarget.class
|
net\seanomik\tamablefoxes\versions\version_1_15\pathfinding\FoxPathfinderGoalOwnerHurtByTarget.class
|
||||||
|
|
Loading…
Reference in New Issue