create module to handle villager leveling
This commit is contained in:
parent
e089a416ea
commit
5610b5b929
@ -24,7 +24,7 @@ public class LanguageCache {
|
||||
this.miniMessage = MiniMessage.miniMessage();
|
||||
|
||||
this.no_permission = getTranslation("messages.no-permission", "<red>You don't have permission to use this command.");
|
||||
this.trades_restocked = getListTranslation("messages.restock-success", List.of("<green>All trades restocked!"));
|
||||
this.trades_restocked = getListTranslation("messages.trade-restock.success", List.of("<green>All trades restocked!"));
|
||||
this.nametag_optimize_success = getListTranslation("messages.nametag.optimize-success", List.of("<green>Successfully optimized villager by using a nametag."));
|
||||
this.nametag_on_optimize_cooldown = getListTranslation("messages.nametag.optimize-on-cooldown", List.of("<gray>You need to wait %time% until you can optimize this villager again."));
|
||||
this.nametag_unoptimize_success = getListTranslation("messages.nametag.unoptimize-success", List.of("<green>Successfully unoptimized villager by using a nametag."));
|
||||
|
@ -0,0 +1,41 @@
|
||||
package me.xginko.villageroptimizer.modules;
|
||||
|
||||
import me.xginko.villageroptimizer.VillagerOptimizer;
|
||||
import me.xginko.villageroptimizer.cache.VillagerManager;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class LevelVillagers implements VillagerOptimizerModule, Listener {
|
||||
|
||||
private final VillagerOptimizer plugin;
|
||||
private final VillagerManager villagerManager;
|
||||
|
||||
public LevelVillagers() {
|
||||
this.plugin = VillagerOptimizer.getInstance();
|
||||
this.villagerManager = VillagerOptimizer.getVillagerManager();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
VillagerOptimizer plugin = VillagerOptimizer.getInstance();
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldEnable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
private void onSomething() {
|
||||
|
||||
}
|
||||
}
|
@ -53,10 +53,10 @@ public class RestockTrades implements VillagerOptimizerModule, Listener {
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
private void onInteract(PlayerInteractEntityEvent event) {
|
||||
if (!event.getRightClicked().getType().equals(EntityType.VILLAGER)) return;
|
||||
|
||||
WrappedVillager wVillager = villagerManager.getOrAdd((Villager) event.getRightClicked());
|
||||
if (!wVillager.isOptimized()) return;
|
||||
|
||||
if (wVillager.isOptimized() && wVillager.canRestock(restock_delay)) {
|
||||
if (wVillager.canRestock(restock_delay)) {
|
||||
wVillager.restock();
|
||||
if (notifyPlayer) {
|
||||
Player player = event.getPlayer();
|
||||
|
@ -1,7 +1,8 @@
|
||||
messages:
|
||||
no-permission: "<red>You don't have permission to use this command."
|
||||
restock-success:
|
||||
- "<green>All trades restocked! Next restock in %time%"
|
||||
trade-restock:
|
||||
success:
|
||||
- "<green>All trades restocked! Next restock in %time%"
|
||||
nametag:
|
||||
optimize-success:
|
||||
- "<green>Successfully optimized villager by using a nametag."
|
||||
@ -22,4 +23,11 @@ messages:
|
||||
optimize-on-cooldown:
|
||||
- "<gray>You need to wait %time% until you can optimize this villager again."
|
||||
unoptimize-success:
|
||||
- "<green>Successfully unoptimized villager by removing workstation block %blocktype%."
|
||||
- "<green>Successfully unoptimized villager by removing workstation block %blocktype%."
|
||||
command:
|
||||
optimize-success:
|
||||
- "<green>Successfully optimized %amount% villager(s) in a radius of %radius% blocks."
|
||||
command-on-cooldown:
|
||||
- "<gray>You need to wait %time% until you can use this command again."
|
||||
unoptimize-success:
|
||||
- "<green>Successfully unoptimized %amount% villager(s) in a radius of %radius% blocks."
|
Loading…
x
Reference in New Issue
Block a user