Skip to content

Commit

Permalink
Re-work tinkerer, blacksmith and gkitz, info gui
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderbelserion committed Mar 8, 2024
1 parent a8b4d96 commit 1b0de55
Show file tree
Hide file tree
Showing 27 changed files with 505 additions and 692 deletions.
1 change: 1 addition & 0 deletions paper/run/config/paper-global.yml
Expand Up @@ -122,6 +122,7 @@ unsupported-settings:
allow-headless-pistons: false
allow-permanent-block-break-exploits: false
allow-piston-duplication: false
allow-unsafe-end-portal-teleportation: false
compression-format: ZLIB
perform-username-validation: true
watchdog:
Expand Down
11 changes: 11 additions & 0 deletions paper/run/config/paper-world-defaults.yml
Expand Up @@ -199,6 +199,14 @@ entities:
underground_water_creature: -1
water_ambient: -1
water_creature: -1
ticks-per-spawn:
ambient: -1
axolotls: -1
creature: -1
monster: -1
underground_water_creature: -1
water_ambient: -1
water_creature: -1
wandering-trader:
spawn-chance-failure-increment: 25
spawn-chance-max: 75
Expand Down Expand Up @@ -228,6 +236,8 @@ environment:
min: 20
enabled: true
generate-flat-bedrock: false
max-block-ticks: 65536
max-fluid-ticks: 65536
nether-ceiling-void-damage-height: disabled
optimize-explosions: false
portal-create-radius: 16
Expand Down Expand Up @@ -302,4 +312,5 @@ tick-rates:
secondarypoisensor: 40
wet-farmland: 1
unsupported-settings:
disable-world-ticking-when-empty: false
fix-invulnerable-end-crystal-exploit: true
2 changes: 1 addition & 1 deletion paper/run/server.properties
@@ -1,5 +1,5 @@
#Minecraft server properties
#Sat Feb 17 01:27:10 EST 2024
#Fri Mar 08 18:41:42 EST 2024
enable-jmx-monitoring=false
rcon.port=25575
level-seed=
Expand Down
@@ -1,6 +1,9 @@
package com.badbones69.crazyenchantments.paper;

import com.badbones69.crazyenchantments.paper.api.FileManager.Files;
import com.badbones69.crazyenchantments.paper.api.builders.types.blacksmith.BlackSmithMenu;
import com.badbones69.crazyenchantments.paper.api.builders.types.gkitz.KitsMenu;
import com.badbones69.crazyenchantments.paper.api.builders.types.BaseMenu;
import com.badbones69.crazyenchantments.paper.api.builders.types.tinkerer.TinkererMenu;
import com.badbones69.crazyenchantments.paper.commands.BlackSmithCommand;
import com.badbones69.crazyenchantments.paper.commands.CECommand;
Expand All @@ -18,15 +21,12 @@
import com.badbones69.crazyenchantments.paper.enchantments.PickaxeEnchantments;
import com.badbones69.crazyenchantments.paper.enchantments.SwordEnchantments;
import com.badbones69.crazyenchantments.paper.enchantments.ToolEnchantments;
import com.badbones69.crazyenchantments.paper.gui.BlackSmith;
import com.badbones69.crazyenchantments.paper.gui.GKitzController;
import com.badbones69.crazyenchantments.paper.gui.InfoGUIControl;
import com.badbones69.crazyenchantments.paper.listeners.AuraListener;
import com.badbones69.crazyenchantments.paper.listeners.DustControlListener;
import com.badbones69.crazyenchantments.paper.listeners.FireworkDamageListener;
import com.badbones69.crazyenchantments.paper.listeners.MiscListener;
import com.badbones69.crazyenchantments.paper.listeners.ProtectionCrystalListener;
import com.badbones69.crazyenchantments.paper.gui.ShopListener;
import com.badbones69.crazyenchantments.paper.listeners.ShopListener;
import com.badbones69.crazyenchantments.paper.listeners.server.WorldSwitchListener;
import org.bstats.bukkit.Metrics;
import org.bukkit.command.CommandExecutor;
Expand All @@ -51,10 +51,6 @@ public static CrazyEnchantments get() {
private ShopListener shopListener;
private ArmorEnchantments armorEnchantments;

// Menus.
private BlackSmith blackSmith;
private GKitzController gKitzController;

private final BossBarController bossBarController = new BossBarController(this);

@Override
Expand Down Expand Up @@ -87,26 +83,19 @@ public void onEnable() {

if (config.getBoolean("Settings.Toggle-Metrics")) new Metrics(this, 4494);

this.pluginManager.registerEvents(this.blackSmith = new BlackSmith(), this);
this.pluginManager.registerEvents(this.fireworkDamageListener = new FireworkDamageListener(), this);
this.pluginManager.registerEvents(this.shopListener = new ShopListener(), this);

enable();
}

@Override
public void onDisable() {
disable();
}

private void enable() {
// Load what we need to properly enable the plugin.
this.starter.getCrazyManager().load();

this.pluginManager.registerEvents(new MiscListener(), this);
this.pluginManager.registerEvents(new DustControlListener(), this);

this.pluginManager.registerEvents(new BlackSmithMenu.BlackSmithListener(), this);
this.pluginManager.registerEvents(new KitsMenu.KitsListener(), this);
this.pluginManager.registerEvents(new TinkererMenu.TinkererListener(), this);
this.pluginManager.registerEvents(new BaseMenu.InfoMenuListener(), this);

this.pluginManager.registerEvents(new PickaxeEnchantments(), this);
this.pluginManager.registerEvents(new SwordEnchantments(), this);
Expand All @@ -122,7 +111,6 @@ private void enable() {
this.pluginManager.registerEvents(new FireworkDamageListener(), this);
this.pluginManager.registerEvents(new AuraListener(), this);

this.pluginManager.registerEvents(new InfoGUIControl(), this);
this.pluginManager.registerEvents(new LostBookController(), this);
this.pluginManager.registerEvents(new CommandChecker(), this);

Expand All @@ -131,7 +119,7 @@ private void enable() {
if (this.starter.getCrazyManager().isGkitzEnabled()) {
getLogger().info("G-Kitz support is now enabled.");

this.pluginManager.registerEvents(this.gKitzController = new GKitzController(), this);
this.pluginManager.registerEvents(new KitsMenu.KitsListener(), this);
}

registerCommand(getCommand("crazyenchantments"), new CETab(), new CECommand());
Expand All @@ -142,8 +130,10 @@ private void enable() {
registerCommand(getCommand("gkit"), new GkitzTab(), new GkitzCommand());
}

private void disable() {
@Override
public void onDisable() {
this.bossBarController.removeAllBossBars();

if (this.armorEnchantments != null) this.armorEnchantments.stop();

if (this.starter.getAllyManager() != null) this.starter.getAllyManager().forceRemoveAllies();
Expand Down Expand Up @@ -176,14 +166,6 @@ public PluginManager getPluginManager() {
return this.pluginManager;
}

public BlackSmith getBlackSmith() {
return this.blackSmith;
}

public GKitzController getgKitzController() {
return this.gKitzController;
}

public BossBarController getBossBarController() {
return bossBarController;
}
Expand Down
@@ -1,6 +1,7 @@
package com.badbones69.crazyenchantments.paper;

import com.badbones69.crazyenchantments.paper.api.FileManager.Files;
import com.badbones69.crazyenchantments.paper.api.builders.types.MenuManager;
import com.badbones69.crazyenchantments.paper.support.PluginSupport;
import com.badbones69.crazyenchantments.paper.api.economy.Currency;
import com.badbones69.crazyenchantments.paper.api.enums.Messages;
Expand Down Expand Up @@ -43,7 +44,7 @@ public class Methods {
private final OraxenSupport oraxenSupport = this.starter.getOraxenSupport();

public EnchantmentType getFromName(String name) {
for (EnchantmentType enchantmentType : this.starter.getInfoMenuManager().getEnchantmentTypes()) {
for (EnchantmentType enchantmentType : MenuManager.getEnchantmentTypes()) {
if (enchantmentType.getName().equalsIgnoreCase(name)) return enchantmentType;
}

Expand Down
Expand Up @@ -2,16 +2,17 @@

import com.badbones69.crazyenchantments.paper.api.CrazyManager;
import com.badbones69.crazyenchantments.paper.api.FileManager;
import com.badbones69.crazyenchantments.paper.api.builders.types.MenuManager;
import com.badbones69.crazyenchantments.paper.api.builders.types.blacksmith.BlackSmithManager;
import com.badbones69.crazyenchantments.paper.api.builders.types.gkitz.KitsManager;
import com.badbones69.crazyenchantments.paper.support.PluginSupport;
import com.badbones69.crazyenchantments.paper.support.PluginSupport.SupportedPlugins;
import com.badbones69.crazyenchantments.paper.support.SkullCreator;
import com.badbones69.crazyenchantments.paper.api.economy.CurrencyAPI;
import com.badbones69.crazyenchantments.paper.api.economy.vault.VaultSupport;
import com.badbones69.crazyenchantments.paper.api.managers.AllyManager;
import com.badbones69.crazyenchantments.paper.api.managers.ArmorEnchantmentManager;
import com.badbones69.crazyenchantments.paper.api.managers.BlackSmithManager;
import com.badbones69.crazyenchantments.paper.api.managers.BowEnchantmentManager;
import com.badbones69.crazyenchantments.paper.api.managers.guis.InfoMenuManager;
import com.badbones69.crazyenchantments.paper.api.managers.ShopManager;
import com.badbones69.crazyenchantments.paper.api.managers.WingsManager;
import com.badbones69.crazyenchantments.paper.support.anticheats.NoCheatPlusSupport;
Expand Down Expand Up @@ -53,9 +54,6 @@ public class Starter {
// Plugin Managers.
private ArmorEnchantmentManager armorEnchantmentManager;
private BowEnchantmentManager bowEnchantmentManager;
private BlackSmithManager blackSmithManager;

private InfoMenuManager infoMenuManager;
private WingsManager wingsManager;
private AllyManager allyManager;
private ShopManager shopManager;
Expand All @@ -75,7 +73,6 @@ public void run() {

// Plugin Support.
this.pluginSupport = new PluginSupport();

this.pluginSupport.initializeWorldGuard();

if (SupportedPlugins.SUPERIORSKYBLOCK.isPluginLoaded()) this.superiorSkyBlockSupport = new SuperiorSkyBlockSupport();
Expand All @@ -91,7 +88,10 @@ public void run() {
this.protectionCrystalSettings = new ProtectionCrystalSettings();
this.enchantmentBookSettings = new EnchantmentBookSettings();

this.infoMenuManager = new InfoMenuManager();
BlackSmithManager.load();
KitsManager.load();

MenuManager.load();

// Economy Management.
this.currencyAPI = new CurrencyAPI();
Expand All @@ -101,8 +101,6 @@ public void run() {
// Plugin Managers.
this.armorEnchantmentManager = new ArmorEnchantmentManager();
this.bowEnchantmentManager = new BowEnchantmentManager();
this.blackSmithManager = new BlackSmithManager();
this.blackSmithManager.load();
this.wingsManager = new WingsManager();
this.allyManager = new AllyManager();

Expand Down Expand Up @@ -137,10 +135,6 @@ public SkullCreator getSkullCreator() {
return this.skullCreator;
}

public InfoMenuManager getInfoMenuManager() {
return this.infoMenuManager;
}

// Settings.
public ProtectionCrystalSettings getProtectionCrystalSettings() {
return this.protectionCrystalSettings;
Expand Down Expand Up @@ -193,10 +187,6 @@ public BowEnchantmentManager getBowEnchantmentManager() {
return this.bowEnchantmentManager;
}

public BlackSmithManager getBlackSmithManager() {
return this.blackSmithManager;
}

public WingsManager getWingsManager() {
return this.wingsManager;
}
Expand Down
Expand Up @@ -11,7 +11,6 @@
import com.badbones69.crazyenchantments.paper.api.enums.pdc.Enchant;
import com.badbones69.crazyenchantments.paper.api.enums.pdc.DataKeys;
import com.badbones69.crazyenchantments.paper.api.managers.*;
import com.badbones69.crazyenchantments.paper.api.managers.guis.InfoMenuManager;
import com.badbones69.crazyenchantments.paper.api.objects.*;
import com.badbones69.crazyenchantments.paper.api.objects.gkitz.GKitz;
import com.badbones69.crazyenchantments.paper.api.objects.gkitz.GkitCoolDown;
Expand Down Expand Up @@ -90,9 +89,6 @@ public class CrazyManager {
@NotNull
private final ArmorEnchantmentManager armorEnchantmentManager = this.starter.getArmorEnchantmentManager();

@NotNull
private final InfoMenuManager infoMenuManager = this.starter.getInfoMenuManager();

// Arrays.
private final List<GKitz> gkitz = new ArrayList<>();
private final List<CEPlayer> players = new ArrayList<>();
Expand Down Expand Up @@ -174,9 +170,6 @@ public void load() {
});
}

// Loads the info menu manager and the enchantment types.
this.infoMenuManager.load();

Scrolls.getWhiteScrollProtectionName();

this.enchantmentBookSettings.setEnchantmentBook(new ItemBuilder().setMaterial(config.getString("Settings.Enchantment-Book-Item", "BOOK")));
Expand Down
@@ -1,6 +1,8 @@
package com.badbones69.crazyenchantments.paper.api.builders;

import com.badbones69.crazyenchantments.paper.CrazyEnchantments;
import com.badbones69.crazyenchantments.paper.api.objects.enchants.EnchantmentType;
import com.badbones69.crazyenchantments.paper.api.objects.gkitz.GKitz;
import com.badbones69.crazyenchantments.paper.api.utils.ColorUtils;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
Expand All @@ -20,17 +22,48 @@ public abstract class InventoryBuilder implements InventoryHolder {
private int size;
private int page;

private EnchantmentType enchantmentType;

private GKitz kit;

public InventoryBuilder(Player player, int size, String title) {
this.title = title;
this.size = size;

this.player = player;

this.inventory = this.plugin.getServer().createInventory(this, this.size, ColorUtils.color(this.title));
this.kit = null;

this.inventory = this.plugin.getServer().createInventory(this, this.size, ColorUtils.legacyTranslateColourCodes(title));
}

public InventoryBuilder(Player player, int size, String title, GKitz kit) {
this.title = title;
this.size = size;

this.player = player;

this.kit = kit;

this.inventory = this.plugin.getServer().createInventory(this, this.size, ColorUtils.legacyTranslateColourCodes(title));
}

public abstract InventoryBuilder build();

public InventoryBuilder setEnchantmentType(EnchantmentType enchantmentType) {
this.enchantmentType = enchantmentType;

return this;
}

public EnchantmentType getEnchantmentType() {
return this.enchantmentType;
}

public GKitz getKit() {
return this.kit;
}

public void size(int size) {
this.size = size;
}
Expand Down

0 comments on commit 1b0de55

Please sign in to comment.