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
2 changes: 1 addition & 1 deletion addon/reremake-migrator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>1.3.2</version>
<version>2.4.9</version>
<scope>compile</scope>
</dependency>
<!-- <dependency>-->
Expand Down
113 changes: 113 additions & 0 deletions compatibility/oraxen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# User-specific stuff
.idea/

*.iml
*.ipr
*.iws

# IntelliJ
out/

# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

target/

pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next

release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml

# Common working directory
run/
94 changes: 94 additions & 0 deletions compatibility/oraxen/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?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"
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>
<groupId>com.ghostchu</groupId>
<artifactId>quickshop-hikari</artifactId>
<version>6.2.0.7</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>com.ghostchu.quickshop.compatibility</groupId>
<artifactId>oraxen</artifactId>
<packaging>takari-jar</packaging>

<name>Compat-Oraxen</name>

<description>Compatibility module for Oraxen</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
</plugin>

</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>oraxen-releases</id>
<url>https://repo.oraxen.com/releases</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
</dependency>
<dependency>
<groupId>com.ghostchu.quickshop.compatibility</groupId>
<artifactId>common</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.ghostchu</groupId>
<artifactId>quickshop-bukkit</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.th0rgal</groupId>
<artifactId>oraxen</artifactId>
<version>1.182.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>oraxen</groupId>
<artifactId>v1_20_R2</artifactId>
</exclusion>
<exclusion>
<groupId>oraxen</groupId>
<artifactId>v1_20_R3</artifactId>
</exclusion>
<exclusion>
<groupId>oraxen</groupId>
<artifactId>v1_20_R4</artifactId>
</exclusion>
<exclusion>
<groupId>oraxen</groupId>
<artifactId>v1_21_R1</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.Euphillya</groupId>
<artifactId>Energie</artifactId>
</exclusion>
<exclusion>
<groupId>me.gabytm.util</groupId>
<artifactId>actions-spigot</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.ghostchu.quickshop.compatibility.oraxen;

import com.ghostchu.quickshop.QuickShop;
import com.ghostchu.quickshop.api.registry.BuiltInRegistry;
import com.ghostchu.quickshop.api.registry.Registry;
import com.ghostchu.quickshop.api.registry.builtin.itemexpression.ItemExpressionHandler;
import com.ghostchu.quickshop.api.registry.builtin.itemexpression.ItemExpressionRegistry;
import com.ghostchu.quickshop.compatibility.CompatibilityModule;
import io.th0rgal.oraxen.api.OraxenItems;
import io.th0rgal.oraxen.items.ItemBuilder;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class Main extends CompatibilityModule implements ItemExpressionHandler {

@Override
public void init() {
final Registry registry = QuickShop.getInstance().getRegistry().getRegistry(BuiltInRegistry.ITEM_EXPRESSION);
if(registry instanceof ItemExpressionRegistry itemExpressionRegistry) {
if(itemExpressionRegistry.registerHandlerSafely(this)) {
getLogger().info("Register Oraxen ItemExpressionHandler successfully!");
}
}
}

@Override
public @NotNull Plugin getPlugin() {
return this;
}

@Override
public String getPrefix() {
return "oraxen";
}

@Override
public boolean match(final ItemStack stack, final String expression) {
return expression.equals(OraxenItems.getIdByItem(stack));
}

@Override
public @Nullable Component displayName(@NotNull ItemStack stack) {
final ItemBuilder builder = OraxenItems.getBuilderByItem(stack);
if (builder == null) {
return ItemExpressionHandler.super.displayName(stack);
}

final String displayName = builder.getItemName();
return displayName != null ? MiniMessage.miniMessage().deserialize(displayName) : ItemExpressionHandler.super.displayName(stack);
}
}
9 changes: 9 additions & 0 deletions compatibility/oraxen/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: qscompat-${project.artifactId}
version: '${project.version}'
main: com.ghostchu.quickshop.compatibility.${project.artifactId}.Main
api-version: 1.18
depend:
- Oraxen
- QuickShop-Hikari
authors: [ NahuLD ]
description: Compatibility module for Oraxen
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@
<module>compatibility/slimefun</module>
<module>compatibility/itemsadder</module>
<module>compatibility/voidchest</module>
<module>compatibility/oraxen</module>
<module>addon/discordsrv</module>
<module>addon/plan</module>
<module>addon/discount</module>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.ghostchu.quickshop.api.registry.builtin.itemexpression;

import net.kyori.adventure.text.Component;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public interface ItemExpressionHandler extends Comparable<ItemExpressionHandler> {

Expand All @@ -18,6 +20,11 @@ default String getInternalPrefix0() {

boolean match(ItemStack stack, String expression);

@Nullable
default Component displayName(@NotNull ItemStack stack) {
return null;
}

@Override
int hashCode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import com.ghostchu.quickshop.api.registry.PrefixAlreadyRegisteredException;
import com.ghostchu.quickshop.api.registry.Registry;
import net.kyori.adventure.text.Component;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.Nullable;

import java.util.Set;

Expand All @@ -13,6 +15,9 @@ public interface ItemExpressionRegistry extends Registry {

boolean match(ItemStack stack, String expression);

@Nullable
Component displayName(ItemStack stack);

void registerHandler(ItemExpressionHandler handler) throws PrefixAlreadyRegisteredException;

boolean registerHandlerSafely(ItemExpressionHandler handler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.ghostchu.quickshop.api.economy.AbstractEconomy;
import com.ghostchu.quickshop.api.obj.QUser;
import com.ghostchu.quickshop.api.shop.Shop;
import com.ghostchu.quickshop.util.Util;
import net.kyori.adventure.text.Component;
import net.tnemc.item.AbstractItemStack;
import net.tnemc.item.bukkit.BukkitItemStack;
Expand Down Expand Up @@ -150,6 +151,7 @@ public void handle(final PageOpenCallback callback) {

final AbstractEconomy eco = QuickShop.getInstance().getEconomy();
final AbstractItemStack<ItemStack> stack = new BukkitItemStack().of(shop.getItem().getType().getKey().toString(), shop.getShopStackingAmount())
.display(Util.getItemStackName(shop.getItem()))
.lore(getList(id, iconLore,
shop.getOwner().getDisplay(),
location,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void handle(final PageOpenCallback open) {
final int stock = (shop.get().isBuying())? -1 : shop.get().getRemainingStock();
final String stockString = (shop.get().isUnlimited())? "Unlimited" : stock + "";

open.getPage().addIcon(new IconBuilder(new BukkitItemStack().of(shopItem)).withSlot(13).build());
open.getPage().addIcon(new IconBuilder(new BukkitItemStack().of(shopItem).display(Util.getItemStackName(shopItem))).withSlot(13).build());

final String lore = (shop.get().isSelling())? "gui.trade.custom.lore-buy" : "gui.trade.custom.lore-sell";
final String enter = (shop.get().isSelling())? "gui.trade.custom.enter-buy" : "gui.trade.custom.enter-sell";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import com.ghostchu.quickshop.api.registry.builtin.itemexpression.ItemExpressionHandler;
import com.ghostchu.quickshop.api.registry.builtin.itemexpression.ItemExpressionRegistry;
import com.google.common.collect.ImmutableSet;
import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.Nullable;

import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;
Expand Down Expand Up @@ -41,6 +43,17 @@ public boolean match(final ItemStack stack, final String expression) {
return false;
}

@Override
public @Nullable Component displayName(ItemStack stack) {
for (ItemExpressionHandler handler : handlers) {
final Component component = handler.displayName(stack);
if (component != null) {
return component;
}
}
return null;
}

@Override
public void registerHandler(final ItemExpressionHandler handler) throws PrefixAlreadyRegisteredException {

Expand Down
Loading