Skip to content

Commit ef63c5e

Browse files
committed
WIP: More progress towards fixing tons of errors [ci skip]
1 parent 3336df9 commit ef63c5e

File tree

11 files changed

+567
-142
lines changed

11 files changed

+567
-142
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ All code credits go towards LOOHP, who has given permission for this fork to be
1818
> If you encounter bugs while using this fork, **do not report this to the original author!**\
1919
> You should create an issue for [this fork](https://github.com/TerraByteDev/MultiChat-DIscordSRV-Addon/issues).
2020
21+
## Missing Features
22+
Right now, this fork does not support the following features (that the original plugin *does* support):
23+
- [ ] Proxy support
24+
- [ ] Image file previews from discord
25+
2126
## Built against Spigot
2227
Built against [Spigot's API](https://www.spigotmc.org/wiki/buildtools/) (required mc versions are listed on the spigot page above).
2328
Plugins built against Spigot usually also work with [Paper](https://papermc.io/).

common/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,12 @@
524524
<version>${project.version}</version>
525525
<scope>compile</scope>
526526
</dependency>
527+
<dependency>
528+
<groupId>org.projectlombok</groupId>
529+
<artifactId>lombok</artifactId>
530+
<version>1.18.36</version>
531+
<scope>provided</scope>
532+
</dependency>
527533
<dependency>
528534
<groupId>com.github.cryptomorin</groupId>
529535
<artifactId>XSeries</artifactId>

common/src/main/java/com/loohp/multichatdiscordsrvaddon/InteractiveChatDiscordSrvAddon.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222

2323
import com.google.common.util.concurrent.ThreadFactoryBuilder;
2424
import com.loohp.multichatdiscordsrvaddon.config.Config;
25-
import com.loohp.multichatdiscordsrvaddon.objectholders.BuiltInPlaceholder;
26-
import com.loohp.multichatdiscordsrvaddon.objectholders.ICMaterial;
27-
import com.loohp.multichatdiscordsrvaddon.objectholders.ICPlaceholder;
28-
import com.loohp.multichatdiscordsrvaddon.objectholders.ValuePairs;
25+
import com.loohp.multichatdiscordsrvaddon.objectholders.*;
2926
import com.loohp.multichatdiscordsrvaddon.utils.MCVersion;
3027
import com.loohp.multichatdiscordsrvaddon.utils.VersionManager;
3128
import com.loohp.multichatdiscordsrvaddon.utils.*;
@@ -34,6 +31,7 @@
3431
import net.kyori.adventure.text.minimessage.MiniMessage;
3532
import org.bukkit.Material;
3633
import org.bukkit.OfflinePlayer;
34+
import org.bukkit.inventory.Inventory;
3735
import org.bukkit.inventory.ItemStack;
3836
import org.bukkit.inventory.meta.ItemMeta;
3937
import org.bukkit.plugin.Plugin;
@@ -280,13 +278,22 @@ public class InteractiveChatDiscordSrvAddon extends JavaPlugin implements Listen
280278
public boolean useTooltipOnTab = true;
281279
public String tabTooltip = "";
282280
public long universalCooldown = 0;
283-
284281
public static ICPlaceholder itemPlaceholder = null;
285282
public static ICPlaceholder inventoryPlaceholder = null;
286283
public static ICPlaceholder enderChestPlaceholder = null;
287-
284+
public ItemStack invFrame1 = null;
285+
public ItemStack invFrame2 = null;
288286
public static Map<UUID, ICPlaceholder> placeholderList = new LinkedHashMap<>();
289287

288+
public ConcurrentCacheHashMap<String, Inventory> itemDisplay = new ConcurrentCacheHashMap<>(itemDisplayTimeout, 60000);
289+
public ConcurrentCacheHashMap<String, Inventory> inventoryDisplay = new ConcurrentCacheHashMap<>(itemDisplayTimeout, 60000);
290+
public ConcurrentCacheHashMap<String, Inventory> inventoryDisplay1Upper = new ConcurrentCacheHashMap<>(itemDisplayTimeout, 60000);
291+
public ConcurrentCacheHashMap<String, Inventory> inventoryDisplay1Lower = new ConcurrentCacheHashMap<>(itemDisplayTimeout, 60000);
292+
public ConcurrentCacheHashMap<String, Inventory> enderDisplay = new ConcurrentCacheHashMap<>(itemDisplayTimeout, 60000);
293+
public ConcurrentCacheHashMap<String, ItemStack> mapDisplay = new ConcurrentCacheHashMap<>(itemDisplayTimeout, 60000);
294+
public Set<Inventory> upperSharedInventory = Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<>()));
295+
public Set<Inventory> lowerSharedInventory = Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<>()));
296+
290297
private ResourceManager resourceManager;
291298
public ModelRenderer modelRenderer;
292299
public ExecutorService mediaReadingService;
@@ -684,6 +691,9 @@ public void reloadConfig() {
684691
placeholderList.put(enderChestPlaceholder.getInternalId(), enderChestPlaceholder);
685692
}
686693

694+
invFrame1 = new ItemStack(Material.valueOf(getConfig().getString("InventoryImage.Inventory.Frame.Primary")), 1);
695+
invFrame2 = new ItemStack(Material.valueOf(getConfig().getString("InventoryImage.Inventory.Frame.Secondary")), 1);
696+
687697
universalCooldown = config.getConfiguration().getLong("Settings.UniversalCooldown") * 1000;
688698

689699
FontTextureResource.setCacheTime(cacheTimeout);

common/src/main/java/com/loohp/multichatdiscordsrvaddon/api/InteractiveChatDiscordSrvAddonAPI.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.loohp.multichatdiscordsrvaddon.resources.ResourceManager;
3030
import com.loohp.multichatdiscordsrvaddon.wrappers.GraphicsToPacketMapWrapper;
3131
import org.bukkit.entity.Player;
32+
import org.bukkit.inventory.Inventory;
3233
import org.bukkit.inventory.ItemStack;
3334

3435
import java.util.*;
@@ -131,6 +132,41 @@ public int getValue() {
131132

132133
}
133134

135+
/**
136+
* Add an inventory to the shared inventory list
137+
*
138+
* @param type
139+
* @param hash key
140+
* @param inventory
141+
* @return The hashed key which can be used to retrieve the inventory
142+
* @throws Exception
143+
*/
144+
public static String addInventoryToItemShareList(SharedType type, String hash, Inventory inventory) throws Exception {
145+
switch (type) {
146+
case ITEM:
147+
InteractiveChatDiscordSrvAddon.plugin.itemDisplay.put(hash, inventory);
148+
InteractiveChatDiscordSrvAddon.plugin.upperSharedInventory.add(inventory);
149+
break;
150+
case INVENTORY:
151+
InteractiveChatDiscordSrvAddon.plugin.inventoryDisplay.put(hash, inventory);
152+
InteractiveChatDiscordSrvAddon.plugin.upperSharedInventory.add(inventory);
153+
break;
154+
case INVENTORY1_UPPER:
155+
InteractiveChatDiscordSrvAddon.plugin.inventoryDisplay1Upper.put(hash, inventory);
156+
InteractiveChatDiscordSrvAddon.plugin.upperSharedInventory.add(inventory);
157+
break;
158+
case INVENTORY1_LOWER:
159+
InteractiveChatDiscordSrvAddon.plugin.inventoryDisplay1Lower.put(hash, inventory);
160+
InteractiveChatDiscordSrvAddon.plugin.lowerSharedInventory.add(inventory);
161+
break;
162+
case ENDERCHEST:
163+
InteractiveChatDiscordSrvAddon.plugin.enderDisplay.put(hash, inventory);
164+
InteractiveChatDiscordSrvAddon.plugin.upperSharedInventory.add(inventory);
165+
break;
166+
}
167+
return hash;
168+
}
169+
134170
/**
135171
* Get the placeholder list.
136172
*

0 commit comments

Comments
 (0)