Skip to content

Commit

Permalink
Tinker gear, command revamp, better discord messages
Browse files Browse the repository at this point in the history
  • Loading branch information
UltraFaceguy committed Jun 4, 2021
1 parent 066df2d commit 4bab27d
Show file tree
Hide file tree
Showing 24 changed files with 842 additions and 972 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</parent>

<artifactId>loot</artifactId>
<version>1.4.1</version>
<version>1.4.2</version>
<packaging>jar</packaging>

<name>loot</name>
Expand Down
30 changes: 27 additions & 3 deletions src/main/java/info/faceland/loot/LootPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.tealcube.minecraft.bukkit.TextUtils;
import com.tealcube.minecraft.bukkit.facecore.logging.PluginLogger;
import com.tealcube.minecraft.bukkit.facecore.plugin.FacePlugin;
import com.tealcube.minecraft.bukkit.shade.acf.PaperCommandManager;
import com.tealcube.minecraft.bukkit.shade.apache.commons.lang3.StringUtils;
import info.faceland.loot.api.creatures.CreatureModBuilder;
import info.faceland.loot.api.creatures.MobInfo;
Expand Down Expand Up @@ -56,6 +57,7 @@
import info.faceland.loot.items.prefabs.ArcaneEnhancer;
import info.faceland.loot.items.prefabs.PurifyingScroll;
import info.faceland.loot.items.prefabs.ShardOfFailure;
import info.faceland.loot.items.prefabs.TinkerersGear;
import info.faceland.loot.listeners.DeconstructListener;
import info.faceland.loot.listeners.EnchantDegradeListener;
import info.faceland.loot.listeners.EnchantMenuListener;
Expand Down Expand Up @@ -120,9 +122,9 @@
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import se.ranzdo.bukkit.methodcommand.CommandHandler;

public final class LootPlugin extends FacePlugin {

Expand Down Expand Up @@ -253,15 +255,30 @@ public void enable() {
DropUtil.refresh();

ArcaneEnhancer.rebuild();
TinkerersGear.rebuild();
PurifyingScroll.rebuild();
ShardOfFailure.rebuild();

PawnMenu.clearPool();

strifePlugin = (StrifePlugin) Bukkit.getPluginManager().getPlugin("Strife");

CommandHandler handler = new CommandHandler(this);
handler.registerCommands(new LootCommand(this));
PaperCommandManager commandManager = new PaperCommandManager(this);
commandManager.registerCommand(new LootCommand(this));

commandManager.getCommandCompletions()
.registerCompletion("gems", c -> socketGemManager.getGemIds());
commandManager.getCommandCompletions()
.registerCompletion("tomes", c -> enchantTomeManager.getTomeIds());
commandManager.getCommandCompletions()
.registerCompletion("tiers", c -> tierManager.getTierIds());
commandManager.getCommandCompletions()
.registerCompletion("rarities", c -> rarityManager.getRarityIds());
commandManager.getCommandCompletions()
.registerCompletion("scrolls", c -> scrollManager.getScrollIds());
commandManager.getCommandCompletions()
.registerCompletion("uniques", c -> customItemManager.listCustomItems());

Bukkit.getPluginManager().registerEvents(new EntityDeathListener(this), this);
Bukkit.getPluginManager().registerEvents(new CombinerListener(this), this);
Bukkit.getPluginManager().registerEvents(new InteractListener(this), this);
Expand Down Expand Up @@ -649,6 +666,13 @@ private void loadCustomItems() {
builder.withCustomData(cs.getInt("custom-data-value", -1));
builder.withBroadcast(cs.getBoolean("broadcast"));
builder.withQuality(cs.getBoolean("can-be-quality-enhanced"));
List<String> flags = cs.getStringList("flags");
Set<ItemFlag> itemFlags = new HashSet<>();
for (String s : flags) {
itemFlags.add(ItemFlag.valueOf(s));
}
builder.withFlags(itemFlags);
builder.withCanBreak(new HashSet<>(cs.getStringList("can-break")));
CustomItem ci = builder.build();
customItems.add(ci);
loaded.add(ci.getName());
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/info/faceland/loot/api/items/CustomItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
*/
package info.faceland.loot.api.items;

import java.util.List;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;

import java.util.List;

public interface CustomItem {

String getName();

String getDisplayName();
Expand All @@ -51,4 +53,8 @@ public interface CustomItem {
boolean isBroadcast();

boolean canBeQuality();

Set<ItemFlag> getFlags();

Set<String> getCanBreak();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
package info.faceland.loot.api.items;

import java.util.List;
import java.util.Set;
import org.bukkit.inventory.ItemFlag;

public interface CustomItemBuilder {

Expand All @@ -47,4 +49,8 @@ public interface CustomItemBuilder {
CustomItemBuilder withBroadcast(boolean b);

CustomItemBuilder withQuality(boolean b);

CustomItemBuilder withFlags(Set<ItemFlag> f);

CustomItemBuilder withCanBreak(Set<String> b);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
package info.faceland.loot.api.managers;

import info.faceland.loot.api.items.CustomItem;

import java.util.Map;
import java.util.Set;

public interface CustomItemManager {

Set<CustomItem> getCustomItems();

Set<String> listCustomItems();

CustomItem getCustomItem(String name);

void addCustomItem(CustomItem ci);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import info.faceland.loot.data.ItemRarity;
import java.util.Map;
import java.util.Set;

public interface RarityManager {

Expand All @@ -35,6 +36,8 @@ public interface RarityManager {

Map<String, ItemRarity> getLoadedRarities();

Set<String> getRarityIds();

ItemRarity getRandomRarity();

ItemRarity getRandomIdRarity();
Expand Down
Loading

0 comments on commit 4bab27d

Please sign in to comment.