Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions compatibility/ecoenchants/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
Expand All @@ -15,16 +14,30 @@
<packaging>takari-jar</packaging>

<name>Compat-EcoEnchants</name>

<description>Compatibility module for EcoEnchants</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>kotlin</pattern>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required? Are you saying that ecoenchants isn't shading their kotlin dependency?

<shadedPattern>com.willfp.eco.libs.kotlin</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
<resources>
<resource>
Expand Down Expand Up @@ -62,42 +75,48 @@
<dependency>
<groupId>com.willfp</groupId>
<artifactId>EcoEnchants</artifactId>
<version>${compat.ecoenchants}</version>
<version>13.6.0</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did the version properties get removed instead of updating them in the main pom?

<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.willfp</groupId>
<artifactId>libreforge-loader</artifactId>
<version>5.4.2</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a property added to the main project pom.

<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.willfp</groupId>
<artifactId>eco</artifactId>
<version>${compat.eco}</version>
<version>7.6.1</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did the version properties get removed instead of updating them in the main pom?

<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>maven-artifact</artifactId>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
</exclusion>
<exclusion>
<artifactId>caffeine</artifactId>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</exclusion>
<exclusion>
<artifactId>adventure-api</artifactId>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
</exclusion>
<exclusion>
<artifactId>adventure-text-serializer-gson</artifactId>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId>
</exclusion>
<exclusion>
<artifactId>adventure-text-serializer-legacy</artifactId>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-legacy</artifactId>
</exclusion>
<exclusion>
<artifactId>kotlin-stdlib</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</exclusion>
<exclusion>
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.ghostchu.quickshop.compatibility.CompatibilityModule;
import com.ghostchu.quickshop.util.logger.Log;
import com.willfp.eco.core.display.DisplayProperties;
import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.display.EnchantDisplay;
import com.willfp.ecoenchants.enchant.EcoEnchant;
import com.willfp.ecoenchants.enchant.EcoEnchants;
Expand All @@ -15,56 +14,48 @@
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.inventory.ItemStack;

import java.util.Set;
import java.util.Collection;

public final class Main extends CompatibilityModule implements Listener {

private EnchantDisplay display;

@Override
public void init() {
// There no init stuffs need to do
this.display = new EnchantDisplay(EcoEnchantsPlugin.getPlugin(EcoEnchantsPlugin.class));
initEcoEnchantEnchantmentTranslationKeys();
}

@EventHandler(ignoreCancelled = true)
public void onPluginLoad(final PluginEnableEvent event) {

if("EcoEnchants".equalsIgnoreCase(event.getPlugin().getName())
|| "libreforge".equalsIgnoreCase(event.getPlugin().getName())
|| "eco".equalsIgnoreCase(event.getPlugin().getName())) {
QuickShop.folia().getScheduler().runLater(this::initEcoEnchantEnchantmentTranslationKeys, 1);
@Override
public void init() {
initEcoEnchantEnchantmentTranslationKeys();
}
}

@Override
public void onQuickShopReload(final QSConfigurationReloadEvent event) {

initEcoEnchantEnchantmentTranslationKeys();
}

private void initEcoEnchantEnchantmentTranslationKeys() {
@EventHandler(ignoreCancelled = true)
public void onPluginLoad(final PluginEnableEvent event) {
if ("EcoEnchants".equalsIgnoreCase(event.getPlugin().getName())
|| "libreforge".equalsIgnoreCase(event.getPlugin().getName())
|| "eco".equalsIgnoreCase(event.getPlugin().getName())) {
QuickShop.folia().getScheduler().runLater(this::initEcoEnchantEnchantmentTranslationKeys, 1);
}
}

final Set<EcoEnchant> enchantSet = EcoEnchants.INSTANCE.values();
getLogger().info("Found " + enchantSet.size() + " enchantments from EcoEnchants");
for(final EcoEnchant value : enchantSet) {
final String key = "ecoenchants:enchantment." + value.getId();
getApi().registerLocalizedTranslationKeyMapping(key, value.getRawDisplayName());
Log.debug("Registered EcoEnchant " + value.getId() + " with translation key override mapping: " + key + " -> " + value.getRawDisplayName());
@Override
public void onQuickShopReload(final QSConfigurationReloadEvent event) {
initEcoEnchantEnchantmentTranslationKeys();
}
getLogger().info("Initialized " + enchantSet.size() + " EcoEnchants translation keys");
}

@EventHandler(ignoreCancelled = true)
public void onItemPreviewPreparing(final ItemPreviewComponentPrePopulateEvent event) {
private void initEcoEnchantEnchantmentTranslationKeys() {
final Collection<EcoEnchant> enchantSet = EcoEnchants.INSTANCE.values();
getLogger().info("Found " + enchantSet.size() + " enchantments from EcoEnchants");
for (final EcoEnchant value : enchantSet) {
final String key = "ecoenchants:enchantment." + value.getId();
getApi().registerLocalizedTranslationKeyMapping(key, value.getRawDisplayName());
Log.debug("Registered EcoEnchant " + value.getId() + " with translation key override mapping: " + key + " -> " + value.getRawDisplayName());
}
getLogger().info("Initialized " + enchantSet.size() + " EcoEnchants translation keys");
}

if(event.getPlayer() == null) {
return;
@EventHandler(ignoreCancelled = true)
public void onItemPreviewPreparing(final ItemPreviewComponentPrePopulateEvent event) {
if (event.getPlayer() == null) {
return;
}
final ItemStack stack = event.getItemStack().clone();
final Object[] varArgs = EnchantDisplay.INSTANCE.generateVarArgs(stack);
EnchantDisplay.INSTANCE.display(stack, event.getPlayer(), new DisplayProperties(false, false, stack), varArgs);
event.setItemStack(stack);
}
final ItemStack stack = event.getItemStack().clone();
display.display(stack, event.getPlayer(), display.generateVarArgs(stack));
display.display(stack, event.getPlayer(), new DisplayProperties(false, false, stack), display.generateVarArgs(stack));
event.setItemStack(stack);
}
}
63 changes: 56 additions & 7 deletions compatibility/reforges/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
Expand All @@ -15,16 +14,30 @@
<packaging>takari-jar</packaging>

<name>Compat-Reforges</name>

<description>Compatibility module for Reforges</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>kotlin</pattern>
<shadedPattern>com.willfp.eco.libs.kotlin</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
<resources>
<resource>
Expand Down Expand Up @@ -62,13 +75,49 @@
<dependency>
<groupId>com.willfp</groupId>
<artifactId>Reforges</artifactId>
<version>${compat.reforges}</version>
<version>7.5.0</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did the version properties get removed instead of updating them in the main pom?

<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.willfp</groupId>
<artifactId>eco</artifactId>
<version>${compat.eco}</version>
<version>7.6.1</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did the version properties get removed instead of updating them in the main pom?

<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</exclusion>
<exclusion>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
</exclusion>
<exclusion>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId>
</exclusion>
<exclusion>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-legacy</artifactId>
</exclusion>
<exclusion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</exclusion>
<exclusion>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.willfp</groupId>
<artifactId>libreforge-loader</artifactId>
<version>5.4.2</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a property added to the main project pom.

<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,25 @@
import com.ghostchu.quickshop.api.event.display.ItemPreviewComponentPrePopulateEvent;
import com.ghostchu.quickshop.compatibility.CompatibilityModule;
import com.willfp.eco.core.display.DisplayProperties;
import com.willfp.reforges.ReforgesPlugin;
import com.willfp.reforges.display.ReforgesDisplay;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;

public final class Main extends CompatibilityModule implements Listener {

private ReforgesDisplay display;

@Override
public void init() {
// There no init stuffs need to do
this.display = new ReforgesDisplay(ReforgesPlugin.getInstance());
}

@EventHandler(ignoreCancelled = true)
public void onItemPreviewPreparing(final ItemPreviewComponentPrePopulateEvent event) {
@Override
public void init() {
// No init needed
}

if(event.getPlayer() == null) {
return;
@EventHandler(ignoreCancelled = true)
public void onItemPreviewPreparing(final ItemPreviewComponentPrePopulateEvent event) {
if (event.getPlayer() == null) {
return;
}
final ItemStack stack = event.getItemStack().clone();
ReforgesDisplay.INSTANCE.display(stack, event.getPlayer(), new DisplayProperties(false, false, stack));
event.setItemStack(stack);
}
final ItemStack stack = event.getItemStack().clone();
display.display(stack, event.getPlayer(), display.generateVarArgs(stack));
display.display(stack, event.getPlayer(), new DisplayProperties(false, false, stack), display.generateVarArgs(stack));
event.setItemStack(stack);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ public void sendShopInfo(@NotNull final Player p, @NotNull final Shop shop) {
previewComponentPrePopulateEvent.callEvent();
previewItemStack = previewComponentPrePopulateEvent.getItemStack();
Component previewComponent = plugin.text().of(p, "menu.preview", Component.text(previewItemStack.getAmount())).forLocale().clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, MsgUtil.fillArgs("/{0} {1} {2}", plugin.getMainCommand(), plugin.getCommandPrefix("silentpreview"), shop.getRuntimeRandomUniqueId().toString())));
previewComponent = plugin.platform().setItemStackHoverEvent(previewComponent, shop.getItem());
previewComponent = plugin.platform().setItemStackHoverEvent(previewComponent, previewItemStack);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this replacement been tested? I noticed your note stating you weren't sure if it's going to mess anything up or not...

final ItemPreviewComponentPopulateEvent itemPreviewComponentPopulateEvent = new ItemPreviewComponentPopulateEvent(previewComponent, p);
itemPreviewComponentPopulateEvent.callEvent();
previewComponent = itemPreviewComponentPopulateEvent.getComponent();
Expand Down