Skip to content

Commit

Permalink
A couple of tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mchorse committed Dec 10, 2022
1 parent dc4f911 commit 0c5f3d2
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 38 deletions.
11 changes: 0 additions & 11 deletions src/main/java/mchorse/mappet/EventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import mchorse.mappet.network.common.quests.PacketQuest;
import mchorse.mappet.network.common.quests.PacketQuests;
import mchorse.mappet.network.common.scripts.PacketClick;
import mchorse.mappet.utils.ScriptUtils;
import mchorse.mclib.utils.ReflectionUtils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
Expand All @@ -40,7 +39,6 @@
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.ServerChatEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
Expand Down Expand Up @@ -443,15 +441,6 @@ public void onPlayerLogsIn(PlayerEvent.PlayerLoggedInEvent event)
Mappet.settings.playerLogIn.trigger(context);
}

if (ScriptUtils.copiedNashorn)
{
player.sendMessage(new TextComponentTranslation("mappet.nashorn_copied"));
}
else if (ScriptUtils.errorScriptEngine)
{
player.sendMessage(new TextComponentTranslation("mappet.nashorn_error"));
}

this.loggedInPlayers.add(player.getUniqueID());
}

Expand Down
10 changes: 3 additions & 7 deletions src/main/java/mchorse/mappet/utils/ScriptUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@

public class ScriptUtils
{
public static boolean copiedNashorn;
public static boolean errorScriptEngine;

private static List<ScriptEngine> engines;
private static ScriptEngineManager manager;

public static List<ScriptEngine> getAllEngines()
{
return getManager().getEngineFactories().stream()
.filter(factory -> !factory.getExtensions().contains("scala"))
.map(ScriptEngineFactory::getScriptEngine)
.collect(Collectors.toList());
.filter(factory -> !factory.getExtensions().contains("scala"))
.map(ScriptEngineFactory::getScriptEngine)
.collect(Collectors.toList());
}

public static ScriptEngine getEngineByExtension(String extension)
Expand Down
5 changes: 1 addition & 4 deletions src/main/resources/assets/mappet/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,4 @@ mappet.translation.wiki=Wiki
mappet.translation.wiki_url=https://github.com/mchorse/mappet/wiki
mappet.translation.community=Discord
mappet.translation.community_url=https://discord.gg/QhvbgSWpYn
mappet.translation.sounds=Open sounds folder

mappet.nashorn_copied=If you're planning on using Mappet's scripts, please §lrestart the client/server§r! Nashorn wasn't loaded by default, but it was copied from JRE's path and it should be available.
mappet.nashorn_error=Nashorn script engine couldn't be loaded or §lwasn't found§r! Try manually getting nashorn.jar from JRE's §7lib/ext/nashorn.jar§r!
mappet.translation.sounds=Open sounds folder
5 changes: 1 addition & 4 deletions src/main/resources/assets/mappet/lang/ru_RU.lang
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,4 @@ mappet.translation.wiki=Вики
mappet.translation.wiki_url=https://github.com/Andruxioid/mappet_ru/wiki
mappet.translation.community=Дискорд
mappet.translation.community_url=https://discord.gg/QhvbgSWpYn
mappet.translation.sounds=Открыть папку со звуками

mappet.nashorn_copied=Если вы планируете использовать скрипты Маппета, то тогда, пожалуйста, §lперезапустите клиент/сервер§r! Скриптовый движок Nashorn не был загружен по умолчанию, но был скопирован из директории JRE и должен быть доступен.
mappet.nashorn_error=Невозможно загрузить или §lобнаружить§r скриптовый движок Nashorn! Попробуйте скачать nashorn.jar вручную с JRE §7lib/ext/nashorn.jar§r!
mappet.translation.sounds=Открыть папку со звуками
5 changes: 1 addition & 4 deletions src/main/resources/assets/mappet/lang/uk_UA.lang
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,4 @@ mappet.translation.wiki=Вікі (англійською)
mappet.translation.wiki_url=https://github.com/mchorse/mappet/wiki
mappet.translation.community=Дискорд
mappet.translation.community_url=https://discord.gg/QhvbgSWpYn
mappet.translation.sounds=Відкрити теку з аудіо

mappet.nashorn_copied=Якщо ви плануєте використовувати скрипти Маппету, то тоді, будь-ласка, §lперезапустить клієнт/сервер§r! Скриптовий двигун Nashorn не був завантажений за замовчуванням, но був скопійован з директории JRE та повинен бути доступним.
mappet.nashorn_error=Неможливо завантажити чи §lзнайти§r скриптовий двигун Nashorn! Спробуйте завантажити nashorn.jar власноруч з JRE §7lib/ext/nashorn.jar§r!
mappet.translation.sounds=Відкрити теку з аудіо
5 changes: 1 addition & 4 deletions src/main/resources/assets/mappet/lang/zh_CN.lang
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,4 @@ mappet.translation.wiki=Wiki
mappet.translation.wiki_url=https://github.com/mchorse/mappet/wiki
mappet.translation.community=Discord
mappet.translation.community_url=https://discord.gg/QhvbgSWpYn
mappet.translation.sounds=Open sounds folder

mappet.nashorn_copied=If you're planning on using Mappet's scripts, please §lrestart the client/server§r! Nashorn wasn't loaded by default, but it was copied from JRE's path and it should be available.
mappet.nashorn_error=Nashorn script engine couldn't be loaded or §lwasn't found§r! Try manually getting nashorn.jar from JRE's §7lib/ext/nashorn.jar§r!
mappet.translation.sounds=Open sounds folder
5 changes: 1 addition & 4 deletions src/main/resources/assets/mappet/lang/zh_TW.lang
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,4 @@ mappet.translation.wiki=Wiki
mappet.translation.wiki_url=https://github.com/mchorse/mappet/wiki
mappet.translation.community=Discord
mappet.translation.community_url=https://discord.gg/QhvbgSWpYn
mappet.translation.sounds=Open sounds folder

mappet.nashorn_copied=If you're planning on using Mappet's scripts, please §lrestart the client/server§r! Nashorn wasn't loaded by default, but it was copied from JRE's path and it should be available.
mappet.nashorn_error=Nashorn script engine couldn't be loaded or §lwasn't found§r! Try manually getting nashorn.jar from JRE's §7lib/ext/nashorn.jar§r!
mappet.translation.sounds=Open sounds folder

0 comments on commit 0c5f3d2

Please sign in to comment.