diff --git a/README.md b/README.md
index 9188f03..e569ede 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,22 @@
-
+
-Source code for EcoWeapons, a premium spigot plugin.
+Source code for EcoItems, a premium spigot plugin.
-
-
+
+
-
-
+
+
-
-
+
+
-
+
@@ -25,13 +25,10 @@
-[]()
-[]()
-[](https://ecoweapons.willfp.com/)
-[]()
+[]()
## License
-*Click here to read [the entire license](https://github.com/Auxilor/EcoWeapons/blob/master/LICENSE.md).*
+*Click here to read [the entire license](https://github.com/Auxilor/EcoItems/blob/master/LICENSE.md).*
diff --git a/build.gradle b/build.gradle
index 01b13e6..a65633c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -57,12 +57,12 @@ allprojects {
}
shadowJar {
- relocate('com.willfp.libreforge', 'com.willfp.ecoweapons.libreforge')
+ relocate('com.willfp.libreforge', 'com.willfp.ecoitems.libreforge')
}
dependencies {
- compileOnly 'com.willfp:eco:6.15.0'
- implementation 'com.willfp:libreforge:2.6.2'
+ compileOnly 'com.willfp:eco:6.17.1'
+ implementation 'com.willfp:libreforge:2.7.0'
compileOnly 'org.jetbrains:annotations:23.0.0'
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/EcoWeaponsPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/EcoItemsPlugin.kt
similarity index 56%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/EcoWeaponsPlugin.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/EcoItemsPlugin.kt
index c5e543b..c8c14e8 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/EcoWeaponsPlugin.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/EcoItemsPlugin.kt
@@ -1,35 +1,35 @@
-package com.willfp.ecoweapons
+package com.willfp.ecoitems
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.command.impl.PluginCommand
import com.willfp.eco.core.display.DisplayModule
import com.willfp.eco.core.integrations.IntegrationLoader
-import com.willfp.ecoweapons.commands.CommandEcoweapons
-import com.willfp.ecoweapons.config.EcoWeaponsYml
-import com.willfp.ecoweapons.display.WeaponsDisplay
-import com.willfp.ecoweapons.fuels.FuelHandler
-import com.willfp.ecoweapons.util.DiscoverRecipeListener
-import com.willfp.ecoweapons.weapons.WeaponListener
-import com.willfp.ecoweapons.weapons.WeaponModifierListener
-import com.willfp.ecoweapons.weapons.WeaponUtils
-import com.willfp.ecoweapons.weapons.toSingletonList
+import com.willfp.ecoitems.commands.CommandEcoItems
+import com.willfp.ecoitems.config.ItemsYml
+import com.willfp.ecoitems.display.ItemsDisplay
+import com.willfp.ecoitems.fuels.FuelHandler
+import com.willfp.ecoitems.util.DiscoverRecipeListener
+import com.willfp.ecoitems.items.ItemListener
+import com.willfp.ecoitems.items.ItemAttributeListener
+import com.willfp.ecoitems.items.ItemUtils
+import com.willfp.ecoitems.items.toSingletonList
import com.willfp.libreforge.LibReforge
import org.bukkit.event.Listener
-class EcoWeaponsPlugin : EcoPlugin(1241, 12134, "ff0000", true) {
+class EcoItemsPlugin : EcoPlugin(1241, 12205, "ff0000", true) {
/**
- * ecoweapons.yml.
+ * items.yml.
*/
- val ecoWeaponsYml: EcoWeaponsYml
+ val itemsYml: ItemsYml
/**
* Internal constructor called by bukkit on plugin load.
*/
init {
instance = this
- ecoWeaponsYml = EcoWeaponsYml(this)
+ itemsYml = ItemsYml(this)
LibReforge.init(this)
- LibReforge.registerHolderProvider { WeaponUtils.getWeaponOnPlayer(it).toSingletonList() }
+ LibReforge.registerHolderProvider { ItemUtils.getEcoItemOnPlayer(it).toSingletonList() }
}
override fun handleEnable() {
@@ -48,9 +48,9 @@ class EcoWeaponsPlugin : EcoPlugin(1241, 12134, "ff0000", true) {
override fun loadListeners(): List {
return listOf(
DiscoverRecipeListener(this),
- WeaponListener(this),
+ ItemListener(this),
FuelHandler(),
- WeaponModifierListener(this)
+ ItemAttributeListener(this)
)
}
@@ -60,12 +60,12 @@ class EcoWeaponsPlugin : EcoPlugin(1241, 12134, "ff0000", true) {
override fun loadPluginCommands(): List {
return listOf(
- CommandEcoweapons(this)
+ CommandEcoItems(this)
)
}
override fun createDisplayModule(): DisplayModule {
- return WeaponsDisplay(this)
+ return ItemsDisplay(this)
}
override fun getMinimumEcoVersion(): String {
@@ -74,9 +74,9 @@ class EcoWeaponsPlugin : EcoPlugin(1241, 12134, "ff0000", true) {
companion object {
/**
- * Instance of EcoWeapons.
+ * Instance of EcoItems.
*/
@JvmStatic
- lateinit var instance: EcoWeaponsPlugin
+ lateinit var instance: EcoItemsPlugin
}
}
\ No newline at end of file
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/commands/CommandEcoItems.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/commands/CommandEcoItems.kt
new file mode 100644
index 0000000..322f005
--- /dev/null
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/commands/CommandEcoItems.kt
@@ -0,0 +1,25 @@
+package com.willfp.ecoitems.commands
+
+import com.willfp.eco.core.EcoPlugin
+import com.willfp.eco.core.command.CommandHandler
+import com.willfp.eco.core.command.impl.PluginCommand
+import org.bukkit.command.CommandSender
+
+class CommandEcoItems(
+ plugin: EcoPlugin
+) : PluginCommand(
+ plugin,
+ "ecoitems",
+ "ecoitems.command.ecoitems",
+ false) {
+ init {
+ addSubcommand(CommandReload(plugin))
+ .addSubcommand(CommandGive(plugin))
+ }
+
+ override fun onExecute(sender: CommandSender, args: List) {
+ sender.sendMessage(
+ plugin.langYml.getMessage("invalid-command")
+ )
+ }
+}
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/commands/CommandGive.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/commands/CommandGive.kt
new file mode 100644
index 0000000..a577416
--- /dev/null
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/commands/CommandGive.kt
@@ -0,0 +1,89 @@
+package com.willfp.ecoitems.commands
+
+import com.willfp.eco.core.EcoPlugin
+import com.willfp.eco.core.command.impl.Subcommand
+import com.willfp.ecoitems.fuels.Fuels
+import com.willfp.ecoitems.items.EcoItems
+import org.bukkit.Bukkit
+import org.bukkit.command.CommandSender
+import org.bukkit.inventory.ItemStack
+import org.bukkit.util.StringUtil
+
+class CommandGive(plugin: EcoPlugin) : Subcommand(plugin, "give", "ecoitems.command.give", false) {
+ private val numbers = listOf(
+ "1",
+ "2",
+ "3",
+ "4",
+ "5",
+ "10",
+ "32",
+ "64"
+ )
+
+ override fun onExecute(sender: CommandSender, args: List) {
+ if (args.isEmpty()) {
+ sender.sendMessage(plugin.langYml.getMessage("needs-player"))
+ return
+ }
+ if (args.size == 1) {
+ sender.sendMessage(plugin.langYml.getMessage("needs-item"))
+ return
+ }
+ val receiverName = args[0]
+ val receiver = Bukkit.getPlayer(receiverName)
+ if (receiver == null) {
+ sender.sendMessage(plugin.langYml.getMessage("invalid-player"))
+ return
+ }
+ val itemID = args[1]
+ var amount = 1
+ val ecoItem = EcoItems.getByID(itemID.lowercase())
+ val fuel = Fuels.getByID(itemID.lowercase())
+ if (ecoItem == null && fuel == null) {
+ sender.sendMessage(plugin.langYml.getMessage("invalid-item"))
+ return
+ }
+ var message = plugin.langYml.getMessage("give-success")
+ message = message.replace("%item%", itemID).replace("%recipient%", receiver.name)
+ sender.sendMessage(message)
+ if (args.size == 3) {
+ amount = args[2].toIntOrNull() ?: 1
+ }
+ val item: ItemStack = ecoItem?.itemStack ?: fuel?.itemStack!!
+ item.amount = amount
+ receiver.inventory.addItem(item)
+ }
+
+ override fun tabComplete(sender: CommandSender, args: List): List {
+ val completions = mutableListOf()
+
+ if (args.isEmpty()) {
+ return EcoItems.values().map { it.id }
+ }
+
+ if (args.size == 1) {
+ StringUtil.copyPartialMatches(
+ args[0],
+ Bukkit.getOnlinePlayers().map { it.name },
+ completions
+ )
+ return completions
+ }
+
+ if (args.size == 2) {
+ val itemNames = EcoItems.values().map { it.id } union Fuels.values().map { it.id }
+
+ StringUtil.copyPartialMatches(args[1], itemNames, completions)
+ completions.sort()
+ return completions
+ }
+
+ if (args.size == 3) {
+ StringUtil.copyPartialMatches(args[2], numbers, completions)
+ return completions
+ }
+
+ return emptyList()
+ }
+}
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/commands/CommandReload.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/commands/CommandReload.kt
new file mode 100644
index 0000000..12da5b6
--- /dev/null
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/commands/CommandReload.kt
@@ -0,0 +1,13 @@
+package com.willfp.ecoitems.commands
+
+import com.willfp.eco.core.EcoPlugin
+import com.willfp.eco.core.command.impl.Subcommand
+import com.willfp.eco.core.command.CommandHandler
+import org.bukkit.command.CommandSender
+
+class CommandReload(plugin: EcoPlugin) : Subcommand(plugin, "reload", "ecoitems.command.reload", false) {
+ override fun onExecute(sender: CommandSender, args: List) {
+ plugin.reload()
+ sender.sendMessage(plugin.langYml.getMessage("reloaded"))
+ }
+}
\ No newline at end of file
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/config/ItemsYml.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/config/ItemsYml.kt
new file mode 100644
index 0000000..1c8a408
--- /dev/null
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/config/ItemsYml.kt
@@ -0,0 +1,7 @@
+package com.willfp.ecoitems.config
+
+import com.willfp.eco.core.EcoPlugin
+import com.willfp.eco.core.config.BaseConfig
+import com.willfp.eco.core.config.ConfigType
+
+class ItemsYml(plugin: EcoPlugin) : BaseConfig("items", plugin, false, ConfigType.YAML)
\ No newline at end of file
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/display/WeaponsDisplay.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/display/ItemsDisplay.kt
similarity index 61%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/display/WeaponsDisplay.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/display/ItemsDisplay.kt
index 484dc12..73e8657 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/display/WeaponsDisplay.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/display/ItemsDisplay.kt
@@ -1,19 +1,19 @@
-package com.willfp.ecoweapons.display
+package com.willfp.ecoitems.display
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.display.DisplayModule
import com.willfp.eco.core.display.DisplayPriority
-import com.willfp.ecoweapons.fuels.FuelUtils
-import com.willfp.ecoweapons.weapons.WeaponUtils
+import com.willfp.ecoitems.fuels.FuelUtils
+import com.willfp.ecoitems.items.ItemUtils
import org.bukkit.inventory.ItemStack
-class WeaponsDisplay(plugin: EcoPlugin) : DisplayModule(plugin, DisplayPriority.LOWEST) {
+class ItemsDisplay(plugin: EcoPlugin) : DisplayModule(plugin, DisplayPriority.LOWEST) {
override fun display(
itemStack: ItemStack,
vararg args: Any
) {
val meta = itemStack.itemMeta ?: return
- val weapon = WeaponUtils.getWeaponFromItem(meta)
+ val ecoItem = ItemUtils.getEcoItem(meta)
val fuel = FuelUtils.getFuelFromItem(meta)
if (fuel != null) {
@@ -29,17 +29,17 @@ class WeaponsDisplay(plugin: EcoPlugin) : DisplayModule(plugin, DisplayPriority.
itemStack.itemMeta = meta
}
- if (weapon != null) {
- val weaponMeta = weapon.itemStack.itemMeta ?: return
- val lore: MutableList = weaponMeta.lore?.toMutableList() ?: return
+ if (ecoItem != null) {
+ val ecoItemMeta = ecoItem.itemStack.itemMeta ?: return
+ val lore: MutableList = ecoItemMeta.lore?.toMutableList() ?: return
if (meta.hasLore()) {
lore.addAll(meta.lore ?: return)
}
meta.lore = lore
- meta.setDisplayName(weaponMeta.displayName)
- meta.addItemFlags(*weaponMeta.itemFlags.toTypedArray())
+ meta.setDisplayName(ecoItemMeta.displayName)
+ meta.addItemFlags(*ecoItemMeta.itemFlags.toTypedArray())
itemStack.itemMeta = meta
}
}
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/ConditionHasFuel.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/ConditionHasFuel.kt
similarity index 95%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/ConditionHasFuel.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/ConditionHasFuel.kt
index 566e5e9..e773055 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/ConditionHasFuel.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/ConditionHasFuel.kt
@@ -1,4 +1,4 @@
-package com.willfp.ecoweapons.fuels
+package com.willfp.ecoitems.fuels
import com.willfp.eco.core.config.interfaces.Config
import com.willfp.libreforge.ConfigViolation
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/Fuel.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/Fuel.kt
similarity index 96%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/Fuel.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/Fuel.kt
index af55cbc..d8195cd 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/Fuel.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/Fuel.kt
@@ -1,4 +1,4 @@
-package com.willfp.ecoweapons.fuels
+package com.willfp.ecoitems.fuels
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.config.interfaces.Config
@@ -59,6 +59,6 @@ class Fuel(
}
override fun toString(): String {
- return "Weapon{$id}"
+ return "Fuel{$id}"
}
}
\ No newline at end of file
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/FuelHandler.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/FuelHandler.kt
similarity index 70%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/FuelHandler.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/FuelHandler.kt
index 0a5c1e3..89545e0 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/FuelHandler.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/FuelHandler.kt
@@ -1,7 +1,7 @@
-package com.willfp.ecoweapons.fuels
+package com.willfp.ecoitems.fuels
import com.willfp.eco.core.EcoPlugin
-import com.willfp.ecoweapons.weapons.Weapon
+import com.willfp.ecoitems.items.EcoItem
import com.willfp.libreforge.events.EffectActivateEvent
import com.willfp.libreforge.updateEffects
import org.bukkit.Material
@@ -11,25 +11,25 @@ import org.bukkit.event.Listener
class FuelHandler : Listener {
@EventHandler
- fun onUseWeapon(event: EffectActivateEvent) {
- val weapon = event.holder as? Weapon ?: return
- if (weapon.fuels.isEmpty()) {
+ fun onUseItem(event: EffectActivateEvent) {
+ val item = event.holder as? EcoItem ?: return
+ if (item.fuels.isEmpty()) {
return
}
- queue[event.player] = weapon
+ queue[event.player] = item
}
companion object {
- private val queue = mutableMapOf()
+ private val queue = mutableMapOf()
private fun consumeFuel() {
- for ((player, weapon) in queue.toMap()) {
- fuelIter@ for (fuel in weapon.fuels) {
+ for ((player, item) in queue.toMap()) {
+ fuelIter@ for (fuel in item.fuels) {
for (i in player.inventory.contents.indices) {
val itemStack = player.inventory.getItem(i) ?: continue
- if (weapon.fuels.contains(FuelUtils.getFuelFromItem(itemStack))) {
+ if (item.fuels.contains(FuelUtils.getFuelFromItem(itemStack))) {
if (itemStack.amount == 1) {
itemStack.type = Material.AIR
} else {
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/FuelUtils.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/FuelUtils.kt
similarity index 72%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/FuelUtils.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/FuelUtils.kt
index b09d11a..c4b1e18 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/FuelUtils.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/FuelUtils.kt
@@ -1,7 +1,7 @@
-package com.willfp.ecoweapons.fuels
+package com.willfp.ecoitems.fuels
-import com.willfp.ecoweapons.EcoWeaponsPlugin.Companion.instance
-import com.willfp.ecoweapons.weapons.Weapon
+import com.willfp.ecoitems.EcoItemsPlugin.Companion.instance
+import com.willfp.ecoitems.items.EcoItem
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.ItemMeta
@@ -9,15 +9,15 @@ import org.bukkit.persistence.PersistentDataType
object FuelUtils {
/**
- * Instance of EcoWeapons.
+ * Instance of EcoItems.
*/
private val PLUGIN = instance
/**
- * Get fuel weapon from an item.
+ * Get fuel from an item.
*
* @param itemStack The itemStack to check.
- * @return The weapon, or null if no weapon is found.
+ * @return The fuel, or null if no fuel is found.
*/
fun getFuelFromItem(itemStack: ItemStack?): Fuel? {
itemStack ?: return null
@@ -26,10 +26,10 @@ object FuelUtils {
}
/**
- * Get fuel weapon on an item.
+ * Get fuel on an item.
*
* @param meta The itemStack to check.
- * @return The weapon, or null if no weapon is found.
+ * @return The fuel, or null if no fuel is found.
*/
fun getFuelFromItem(meta: ItemMeta): Fuel? {
val container = meta.persistentDataContainer
@@ -41,17 +41,17 @@ object FuelUtils {
}
/**
- * If player has fuel for a weapon.
+ * If player has fuel for an item.
*
* @param player The player to check.
- * @param weapon The weapon.
+ * @param item The item.
* @return If the player has fuel for it.
*/
- fun hasFuelFor(player: Player, weapon: Weapon): Boolean {
- if (weapon.fuels.isEmpty()) {
+ fun hasFuelFor(player: Player, item: EcoItem): Boolean {
+ if (item.fuels.isEmpty()) {
return true
}
- for (fuel in weapon.fuels) {
+ for (fuel in item.fuels) {
if (hasFuel(player, fuel)) {
return true
}
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/Fuels.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/Fuels.kt
similarity index 78%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/Fuels.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/Fuels.kt
index bf73d04..d13d1ca 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/fuels/Fuels.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/fuels/Fuels.kt
@@ -1,10 +1,10 @@
-package com.willfp.ecoweapons.fuels
+package com.willfp.ecoitems.fuels
import com.google.common.collect.BiMap
import com.google.common.collect.HashBiMap
import com.google.common.collect.ImmutableList
import com.willfp.eco.core.config.updating.ConfigUpdater
-import com.willfp.ecoweapons.EcoWeaponsPlugin
+import com.willfp.ecoitems.EcoItemsPlugin
object Fuels {
/**
@@ -38,21 +38,21 @@ object Fuels {
/**
* Update all [Fuel]s.
*
- * @param plugin Instance of EcoWeapons.
+ * @param plugin Instance of EcoItems.
*/
@ConfigUpdater
@JvmStatic
- fun update(plugin: EcoWeaponsPlugin) {
+ fun update(plugin: EcoItemsPlugin) {
for (fuel in values()) {
removeFuel(fuel)
}
- for (setConfig in plugin.ecoWeaponsYml.getSubsections("fuels")) {
+ for (setConfig in plugin.itemsYml.getSubsections("fuels")) {
addNewFuel(Fuel(setConfig, plugin))
}
}
/**
- * Add new [Fuel] to EcoWeapons.
+ * Add new [Fuel] to EcoItems.
*
* @param fuel The [Fuel] to add.
*/
@@ -63,9 +63,9 @@ object Fuels {
}
/**
- * Remove [Fuel] from EcoWeapons.
+ * Remove [Fuel] from EcoItems.
*
- * @param weapon The [Fuel] to remove.
+ * @param fuel The [Fuel] to remove.
*/
@JvmStatic
fun removeFuel(fuel: Fuel) {
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/Weapon.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/EcoItem.kt
similarity index 83%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/Weapon.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/EcoItem.kt
index 953297c..da4ffef 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/Weapon.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/EcoItem.kt
@@ -1,4 +1,4 @@
-package com.willfp.ecoweapons.weapons
+package com.willfp.ecoitems.items
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.config.interfaces.Config
@@ -7,7 +7,7 @@ import com.willfp.eco.core.items.CustomItem
import com.willfp.eco.core.items.Items
import com.willfp.eco.core.items.builder.ItemStackBuilder
import com.willfp.eco.core.recipe.Recipes
-import com.willfp.ecoweapons.fuels.Fuels
+import com.willfp.ecoitems.fuels.Fuels
import com.willfp.libreforge.Holder
import com.willfp.libreforge.conditions.Conditions
import com.willfp.libreforge.effects.Effects
@@ -15,18 +15,18 @@ import org.bukkit.inventory.ItemStack
import org.bukkit.persistence.PersistentDataType
import java.util.Objects
-class Weapon(
+class EcoItem(
private val config: Config,
private val plugin: EcoPlugin
) : Holder {
val id = config.getString("id")
override val effects = config.getSubsections("effects").mapNotNull {
- Effects.compile(it, "Weapon ID $id")
+ Effects.compile(it, "Item ID $id")
}.toSet()
override val conditions = config.getSubsections("conditions").mapNotNull {
- Conditions.compile(it, "Weapon ID $id")
+ Conditions.compile(it, "Item ID $id")
}.toSet()
val itemStack: ItemStack = run {
@@ -36,16 +36,16 @@ class Weapon(
addLoreLines(
itemConfig.getFormattedStrings("lore").map { "${Display.PREFIX}$it" })
writeMetaKey(
- this@Weapon.plugin.namespacedKeyFactory.create("weapon"),
+ this@EcoItem.plugin.namespacedKeyFactory.create("item"),
PersistentDataType.STRING,
- this@Weapon.id
+ this@EcoItem.id
)
}.build()
}
val customItem = CustomItem(
plugin.namespacedKeyFactory.create(id),
- { test -> WeaponUtils.getWeaponFromItem(test) == this },
+ { test -> ItemUtils.getEcoItem(test) == this },
itemStack
).apply { register() }
@@ -65,7 +65,7 @@ class Weapon(
val baseAttackSpeed = config.getDouble("baseAttackSpeed")
override fun equals(other: Any?): Boolean {
- if (other !is Weapon) {
+ if (other !is EcoItem) {
return false
}
@@ -77,6 +77,6 @@ class Weapon(
}
override fun toString(): String {
- return "Weapon{$id}"
+ return "EcoItem{$id}"
}
}
\ No newline at end of file
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/EcoItems.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/EcoItems.kt
new file mode 100644
index 0000000..4ea52bf
--- /dev/null
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/EcoItems.kt
@@ -0,0 +1,75 @@
+package com.willfp.ecoitems.items
+
+import com.google.common.collect.BiMap
+import com.google.common.collect.HashBiMap
+import com.google.common.collect.ImmutableList
+import com.willfp.eco.core.config.updating.ConfigUpdater
+import com.willfp.ecoitems.EcoItemsPlugin
+import com.willfp.ecoitems.fuels.ConditionHasFuel
+
+object EcoItems {
+ /**
+ * Registered items.
+ */
+ private val BY_ID: BiMap = HashBiMap.create()
+
+ val CONDITION_HAS_FUEL = ConditionHasFuel()
+
+ /**
+ * Get all registered [EcoItem]s.
+ *
+ * @return A list of all [EcoItem]s.
+ */
+ @JvmStatic
+ fun values(): List {
+ return ImmutableList.copyOf(BY_ID.values)
+ }
+
+ /**
+ * Get [EcoItem] matching id.
+ *
+ * @param name The id to search for.
+ * @return The matching [EcoItem], or null if not found.
+ */
+ @JvmStatic
+ fun getByID(name: String): EcoItem? {
+ return BY_ID[name]
+ }
+
+ /**
+ * Update all [EcoItem]s.
+ *
+ * @param plugin Instance of EcoItems.
+ */
+ @ConfigUpdater
+ @JvmStatic
+ fun update(plugin: EcoItemsPlugin) {
+ for (item in values()) {
+ removeItem(item)
+ }
+ for (setConfig in plugin.itemsYml.getSubsections("items")) {
+ addNewItem(EcoItem(setConfig, plugin))
+ }
+ }
+
+ /**
+ * Add new [EcoItem] to EcoItems.
+ *
+ * @param item The [EcoItem] to add.
+ */
+ @JvmStatic
+ fun addNewItem(item: EcoItem) {
+ BY_ID.remove(item.id)
+ BY_ID[item.id] = item
+ }
+
+ /**
+ * Remove [EcoItem] from EcoItems.
+ *
+ * @param item The [EcoItem] to remove.
+ */
+ @JvmStatic
+ fun removeItem(item: EcoItem) {
+ BY_ID.remove(item.id)
+ }
+}
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/WeaponModifierListener.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/ItemAttributeListener.kt
similarity index 57%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/WeaponModifierListener.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/ItemAttributeListener.kt
index 21524cb..5b1f7e8 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/WeaponModifierListener.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/ItemAttributeListener.kt
@@ -1,4 +1,4 @@
-package com.willfp.ecoweapons.weapons
+package com.willfp.ecoitems.items
import com.willfp.eco.core.EcoPlugin
import org.bukkit.attribute.Attribute
@@ -9,7 +9,7 @@ import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerItemHeldEvent
import java.util.UUID
-class WeaponModifierListener(private val plugin: EcoPlugin) : Listener {
+class ItemAttributeListener(private val plugin: EcoPlugin) : Listener {
@EventHandler
fun handle(event: PlayerItemHeldEvent) {
if (event.isCancelled) {
@@ -21,11 +21,29 @@ class WeaponModifierListener(private val plugin: EcoPlugin) : Listener {
}
private fun apply(player: Player) {
- val weapon = WeaponUtils.getWeaponOnPlayer(player)
+ val item = ItemUtils.getEcoItemOnPlayer(player)
val damageInst = player.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE) ?: return
val speedInst = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED) ?: return
+ damageInst.removeModifier(
+ AttributeModifier(
+ UUID.nameUUIDFromBytes("ecoitems_ad".toByteArray()),
+ "EcoItems Damage",
+ 1.0, // Irrelevant
+ AttributeModifier.Operation.ADD_NUMBER
+ )
+ )
+ speedInst.removeModifier(
+ AttributeModifier(
+ UUID.nameUUIDFromBytes("ecoitems_as".toByteArray()),
+ "EcoItems Speed",
+ 1.0, // Irrelevant
+ AttributeModifier.Operation.ADD_NUMBER
+ )
+ )
+
+ // Legacy
damageInst.removeModifier(
AttributeModifier(
UUID.nameUUIDFromBytes("ecoweapons_ad".toByteArray()),
@@ -43,21 +61,21 @@ class WeaponModifierListener(private val plugin: EcoPlugin) : Listener {
)
)
- if (weapon != null) {
+ if (item != null) {
damageInst.addModifier(
AttributeModifier(
- UUID.nameUUIDFromBytes("ecoweapons_ad".toByteArray()),
- "EcoWeapons Damage",
- weapon.baseDamage - player.inventory.itemInMainHand.type.getBaseDamage(),
+ UUID.nameUUIDFromBytes("ecoitems_ad".toByteArray()),
+ "EcoItems Damage",
+ item.baseDamage - player.inventory.itemInMainHand.type.getBaseDamage(),
AttributeModifier.Operation.ADD_NUMBER
)
)
speedInst.addModifier(
AttributeModifier(
- UUID.nameUUIDFromBytes("ecoweapons_as".toByteArray()),
- "EcoWeapons Speed",
- weapon.baseAttackSpeed - player.inventory.itemInMainHand.type.getBaseAttackSpeed(),
+ UUID.nameUUIDFromBytes("ecoitems_as".toByteArray()),
+ "EcoItems Speed",
+ item.baseAttackSpeed - player.inventory.itemInMainHand.type.getBaseAttackSpeed(),
AttributeModifier.Operation.ADD_NUMBER
)
)
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/WeaponListener.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/ItemListener.kt
similarity index 87%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/WeaponListener.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/ItemListener.kt
index 5e96724..30df950 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/WeaponListener.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/ItemListener.kt
@@ -1,4 +1,4 @@
-package com.willfp.ecoweapons.weapons
+package com.willfp.ecoitems.items
import com.willfp.eco.core.EcoPlugin
import com.willfp.libreforge.updateEffects
@@ -6,7 +6,7 @@ import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerItemHeldEvent
-class WeaponListener(
+class ItemListener(
private val plugin: EcoPlugin
): Listener {
@EventHandler
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/WeaponUtils.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/ItemUtils.kt
similarity index 70%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/WeaponUtils.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/ItemUtils.kt
index 926aa3e..84755f3 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/WeaponUtils.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/items/ItemUtils.kt
@@ -1,53 +1,70 @@
-package com.willfp.ecoweapons.weapons
+package com.willfp.ecoitems.items
-import com.willfp.ecoweapons.EcoWeaponsPlugin.Companion.instance
+import com.willfp.ecoitems.EcoItemsPlugin.Companion.instance
import org.bukkit.Material
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.ItemMeta
import org.bukkit.persistence.PersistentDataType
-object WeaponUtils {
+object ItemUtils {
/**
- * Instance of EcoWeapons.
+ * Instance of EcoItems.
*/
private val PLUGIN = instance
/**
- * Get weapon from an item.
+ * Get EcoItem from an item.
*
* @param itemStack The itemStack to check.
- * @return The weapon, or null if no weapon is found.
+ * @return The EcoItem, or null if no EcoItem is found.
*/
- fun getWeaponFromItem(itemStack: ItemStack?): Weapon? {
+ fun getEcoItem(itemStack: ItemStack?): EcoItem? {
itemStack ?: return null
val meta = itemStack.itemMeta ?: return null
- return getWeaponFromItem(meta)
+ val item = getEcoItem(meta)
+ itemStack.itemMeta = meta
+ return item
}
/**
- * Get weapon on an item.
+ * Get EcoItem from an item.
*
* @param meta The itemStack to check.
- * @return The weapon, or null if no weapon is found.
+ * @return The EcoItem, or null if no EcoItem is found.
*/
- fun getWeaponFromItem(meta: ItemMeta): Weapon? {
+ fun getEcoItem(meta: ItemMeta): EcoItem? {
val container = meta.persistentDataContainer
- val weaponName = container.get(
+ val legacy = container.get(
PLUGIN.namespacedKeyFactory.create("weapon"),
PersistentDataType.STRING
+ )
+
+ if (legacy != null) {
+ container.set(
+ PLUGIN.namespacedKeyFactory.create("item"),
+ PersistentDataType.STRING,
+ legacy
+ )
+ container.remove(PLUGIN.namespacedKeyFactory.create("weapon"))
+ }
+
+ val id = container.get(
+ PLUGIN.namespacedKeyFactory.create("item"),
+ PersistentDataType.STRING
) ?: return null
- return Weapons.getByID(weaponName)
+
+ return EcoItems.getByID(id)
}
/**
- * Get weapon on a player.
+ * Get EcoItem on a player.
*
* @param player The player to check.
- * @return The weapon, or null if no weapon is found.
+ * @return The EcoItem, or null if no EcoItem is found.
*/
- fun getWeaponOnPlayer(player: Player): Weapon? {
- return getWeaponFromItem(player.inventory.itemInMainHand)
+ fun getEcoItemOnPlayer(player: Player): EcoItem? {
+ return getEcoItem(player.inventory.itemInMainHand)
}
}
@@ -56,7 +73,7 @@ inline fun T?.toSingletonList(): List {
}
fun Material.getBaseDamage(): Double {
- return when(this) {
+ return when (this) {
Material.WOODEN_SWORD -> 4.0
Material.WOODEN_SHOVEL -> 2.5
Material.WOODEN_PICKAXE -> 2.0
@@ -94,7 +111,7 @@ fun Material.getBaseDamage(): Double {
}
fun Material.getBaseAttackSpeed(): Double {
- return when(this) {
+ return when (this) {
Material.WOODEN_SWORD -> 1.6
Material.STONE_SWORD -> 1.6
Material.IRON_SWORD -> 1.6
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/util/DiscoverRecipeListener.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/util/DiscoverRecipeListener.kt
similarity index 95%
rename from eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/util/DiscoverRecipeListener.kt
rename to eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/util/DiscoverRecipeListener.kt
index ffa4db6..14fc62b 100644
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/util/DiscoverRecipeListener.kt
+++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/util/DiscoverRecipeListener.kt
@@ -1,4 +1,4 @@
-package com.willfp.ecoweapons.util
+package com.willfp.ecoitems.util
import com.willfp.eco.core.EcoPlugin
import org.bukkit.Bukkit
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/commands/CommandEcoweapons.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/commands/CommandEcoweapons.kt
deleted file mode 100644
index 43994b3..0000000
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/commands/CommandEcoweapons.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.willfp.ecoweapons.commands
-
-import com.willfp.eco.core.EcoPlugin
-import com.willfp.eco.core.command.CommandHandler
-import com.willfp.eco.core.command.impl.PluginCommand
-
-class CommandEcoweapons(
- plugin: EcoPlugin
-) : PluginCommand(
- plugin,
- "ecoweapons",
- "ecoweapons.command.ecoweapons",
- false) {
- init {
- addSubcommand(CommandReload(plugin))
- .addSubcommand(CommandGive(plugin))
- }
- override fun getHandler(): CommandHandler {
- return CommandHandler { sender, _ ->
- sender.sendMessage(
- plugin.langYml.getMessage("invalid-command")
- )
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/commands/CommandGive.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/commands/CommandGive.kt
deleted file mode 100644
index 5ec5e80..0000000
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/commands/CommandGive.kt
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.willfp.ecoweapons.commands
-
-import com.willfp.eco.core.EcoPlugin
-import com.willfp.eco.core.command.CommandHandler
-import com.willfp.eco.core.command.TabCompleteHandler
-import com.willfp.eco.core.command.impl.Subcommand
-import com.willfp.ecoweapons.fuels.Fuels
-import com.willfp.ecoweapons.weapons.Weapons
-import org.bukkit.Bukkit
-import org.bukkit.inventory.ItemStack
-import org.bukkit.util.StringUtil
-
-class CommandGive(plugin: EcoPlugin) : Subcommand(plugin, "give", "ecoweapons.command.give", false) {
- private val numbers = listOf(
- "1",
- "2",
- "3",
- "4",
- "5",
- "10",
- "32",
- "64"
- )
-
- override fun getHandler(): CommandHandler {
- return CommandHandler { sender, args ->
- if (args.isEmpty()) {
- sender.sendMessage(plugin.langYml.getMessage("needs-player"))
- return@CommandHandler
- }
- if (args.size == 1) {
- sender.sendMessage(plugin.langYml.getMessage("needs-item"))
- return@CommandHandler
- }
- val receiverName = args[0]
- val receiver = Bukkit.getPlayer(receiverName)
- if (receiver == null) {
- sender.sendMessage(plugin.langYml.getMessage("invalid-player"))
- return@CommandHandler
- }
- val itemID = args[1]
- var amount = 1
- val weapon = Weapons.getByID(itemID.lowercase())
- val fuel = Fuels.getByID(itemID.lowercase())
- if (weapon == null && fuel == null) {
- sender.sendMessage(plugin.langYml.getMessage("invalid-item"))
- return@CommandHandler
- }
- var message = plugin.langYml.getMessage("give-success")
- message = message.replace("%item%", itemID).replace("%recipient%", receiver.name)
- sender.sendMessage(message)
- if (args.size == 3) {
- amount = args[2].toIntOrNull() ?: 1
- }
- val item: ItemStack = weapon?.itemStack ?: fuel?.itemStack!!
- item.amount = amount
- receiver.inventory.addItem(item)
- }
- }
-
- override fun getTabCompleter(): TabCompleteHandler {
- return TabCompleteHandler { _, args ->
- val completions = mutableListOf()
-
- if (args.isEmpty()) {
- return@TabCompleteHandler Weapons.values().map { it.id }
- }
-
- if (args.size == 1) {
- StringUtil.copyPartialMatches(
- args[0],
- Bukkit.getOnlinePlayers().map { it.name },
- completions
- )
- return@TabCompleteHandler completions
- }
-
- if (args.size == 2) {
- val itemNames = Weapons.values().map { it.id } union Fuels.values().map { it.id }
-
- StringUtil.copyPartialMatches(args[1], itemNames, completions)
- completions.sort()
- return@TabCompleteHandler completions
- }
-
- if (args.size == 3) {
- StringUtil.copyPartialMatches(args[2], numbers, completions)
- return@TabCompleteHandler completions
- }
-
- emptyList()
- }
- }
-}
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/commands/CommandReload.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/commands/CommandReload.kt
deleted file mode 100644
index d0542ab..0000000
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/commands/CommandReload.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.willfp.ecoweapons.commands
-
-import com.willfp.eco.core.EcoPlugin
-import com.willfp.eco.core.command.impl.Subcommand
-import com.willfp.eco.core.command.CommandHandler
-import org.bukkit.command.CommandSender
-
-class CommandReload(plugin: EcoPlugin) : Subcommand(plugin, "reload", "ecoweapons.command.reload", false) {
- override fun getHandler(): CommandHandler {
- return CommandHandler { sender: CommandSender, _: List? ->
- plugin.reload()
- sender.sendMessage(plugin.langYml.getMessage("reloaded"))
- }
- }
-}
\ No newline at end of file
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/config/EcoWeaponsYml.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/config/EcoWeaponsYml.kt
deleted file mode 100644
index 783de9a..0000000
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/config/EcoWeaponsYml.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.willfp.ecoweapons.config
-
-import com.willfp.eco.core.EcoPlugin
-import com.willfp.eco.core.config.json.JSONStaticBaseConfig
-import com.willfp.eco.core.config.yaml.YamlBaseConfig
-
-class EcoWeaponsYml(plugin: EcoPlugin) : YamlBaseConfig("ecoweapons", false, plugin)
\ No newline at end of file
diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/Weapons.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/Weapons.kt
deleted file mode 100644
index 87bd4c5..0000000
--- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoweapons/weapons/Weapons.kt
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.willfp.ecoweapons.weapons
-
-import com.google.common.collect.BiMap
-import com.google.common.collect.HashBiMap
-import com.google.common.collect.ImmutableList
-import com.willfp.eco.core.config.updating.ConfigUpdater
-import com.willfp.ecoweapons.EcoWeaponsPlugin
-import com.willfp.ecoweapons.fuels.ConditionHasFuel
-
-object Weapons {
- /**
- * Registered weapons.
- */
- private val BY_ID: BiMap = HashBiMap.create()
-
- val CONDITION_HAS_FUEL = ConditionHasFuel()
-
- /**
- * Get all registered [Weapon]s.
- *
- * @return A list of all [Weapon]s.
- */
- @JvmStatic
- fun values(): List {
- return ImmutableList.copyOf(BY_ID.values)
- }
-
- /**
- * Get [Weapon] matching id.
- *
- * @param name The id to search for.
- * @return The matching [Weapon], or null if not found.
- */
- @JvmStatic
- fun getByID(name: String): Weapon? {
- return BY_ID[name]
- }
-
- /**
- * Update all [Weapon]s.
- *
- * @param plugin Instance of EcoWeapons.
- */
- @ConfigUpdater
- @JvmStatic
- fun update(plugin: EcoWeaponsPlugin) {
- for (weapon in values()) {
- removeWeapon(weapon)
- }
- for (setConfig in plugin.ecoWeaponsYml.getSubsections("weapons")) {
- addNewWeapon(Weapon(setConfig, plugin))
- }
- }
-
- /**
- * Add new [Weapon] to EcoWeapons.
- *
- * @param weapon The [Weapon] to add.
- */
- @JvmStatic
- fun addNewWeapon(weapon: Weapon) {
- BY_ID.remove(weapon.id)
- BY_ID[weapon.id] = weapon
- }
-
- /**
- * Remove [Weapon] from EcoWeapons.
- *
- * @param weapon The [Weapon] to remove.
- */
- @JvmStatic
- fun removeWeapon(weapon: Weapon) {
- BY_ID.remove(weapon.id)
- }
-}
diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml
index d9bd540..bd1fe3a 100644
--- a/eco-core/core-plugin/src/main/resources/config.yml
+++ b/eco-core/core-plugin/src/main/resources/config.yml
@@ -1,5 +1,5 @@
#
-# EcoWeapons
+# EcoItems
# by Auxilor
#
diff --git a/eco-core/core-plugin/src/main/resources/ecoweapons.yml b/eco-core/core-plugin/src/main/resources/items.yml
similarity index 99%
rename from eco-core/core-plugin/src/main/resources/ecoweapons.yml
rename to eco-core/core-plugin/src/main/resources/items.yml
index d1f4ab1..606a092 100644
--- a/eco-core/core-plugin/src/main/resources/ecoweapons.yml
+++ b/eco-core/core-plugin/src/main/resources/items.yml
@@ -1,4 +1,4 @@
-weapons:
+items:
- id: rogue_zweihander
baseDamage: 7
baseAttackSpeed: 1.2
diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml
index c875659..611adf9 100644
--- a/eco-core/core-plugin/src/main/resources/lang.yml
+++ b/eco-core/core-plugin/src/main/resources/lang.yml
@@ -1,9 +1,9 @@
messages:
- prefix: "ff0000&lEcoWeapons&r &8» &r"
+ prefix: "ff0000&lEcoItems&r &8» &r"
no-permission: "&cYou don't have permission to do this!"
not-player: "&cThis command must be run by a player"
invalid-command: "&cUnknown subcommand!"
- reloaded: "Reloaded! (Restart if you're removed weapons!)"
+ reloaded: "Reloaded! (Restart if you're removed items!)"
needs-player: "&cYou must specify a player"
invalid-player: "&cInvalid player!"
needs-item: "&cYou must specify an item!"
diff --git a/eco-core/core-plugin/src/main/resources/plugin.yml b/eco-core/core-plugin/src/main/resources/plugin.yml
index f9c6b14..6e11ae0 100644
--- a/eco-core/core-plugin/src/main/resources/plugin.yml
+++ b/eco-core/core-plugin/src/main/resources/plugin.yml
@@ -1,6 +1,6 @@
-name: EcoWeapons
+name: EcoItems
version: ${projectVersion}
-main: com.willfp.ecoweapons.EcoWeaponsPlugin
+main: com.willfp.ecoitems.EcoItemsPlugin
api-version: 1.16
authors: [ Auxilor ]
website: willfp.com
@@ -15,31 +15,30 @@ libraries:
- 'org.jetbrains.kotlin:kotlin-stdlib:1.6.0'
commands:
- ecoweapons:
+ ecoitems:
description: Base Command
- permission: ecoweapons.command.ecoweapons
+ permission: ecoitems.command.ecoitems
permissions:
- ecoweapons.*:
- description: All ecoweapons permissions
+ ecoitems.*:
+ description: All ecoitems permissions
default: op
children:
- ecoweapons.command.*: true
- ecoweapons.noflydisable: true
- ecoweapons.command.*:
+ ecoitems.command.*: true
+ ecoitems.command.*:
description: All commands
default: op
children:
- ecoweapons.command.reload: true
- ecoweapons.command.ecoweapons: true
- ecoweapons.command.give: true
+ ecoitems.command.reload: true
+ ecoitems.command.ecoitems: true
+ ecoitems.command.give: true
- ecoweapons.command.reload:
+ ecoitems.command.reload:
description: Allows reloading the config
default: op
- ecoweapons.command.give:
- description: Allows the use of /ecoweapons give
+ ecoitems.command.give:
+ description: Allows the use of /ecoitems give
default: op
- ecoweapons.command.ecoweapons:
- description: Allows the user of /ecoweapons.
+ ecoitems.command.ecoitems:
+ description: Allows the user of /ecoitems.
default: true
diff --git a/gradle.properties b/gradle.properties
index 83dda63..bb8ea54 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,2 +1,2 @@
-version = 2.6.0
-plugin-name = EcoWeapons
\ No newline at end of file
+version = 3.0.0
+plugin-name = EcoItems
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index e979aa0..f2e57a6 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,4 @@
-rootProject.name = 'EcoWeapons'
+rootProject.name = 'EcoItems'
// Core
include ':eco-core'