Skip to content

Commit

Permalink
finally get simple village complete trigger POC
Browse files Browse the repository at this point in the history
  • Loading branch information
insanj committed Mar 19, 2019
1 parent 3390ce9 commit ff43e90
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 98 deletions.
88 changes: 0 additions & 88 deletions plugin/java/me/insanj/mayor/MayorVillager.java

This file was deleted.

2 changes: 0 additions & 2 deletions plugin/java/me/insanj/mayor/MayorVillagerHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,4 @@ public boolean spawnVillager(Location location) {
boolean spawnSuccess = builtVillager.finish();
return spawnSuccess;
}*/


}
24 changes: 16 additions & 8 deletions plugin/java/me/insanj/mayor/MayorVillagerTradeListener.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
package me.insanj.mayor;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;

import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.VillagerReplenishTradeEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryInteractEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.MerchantInventory;
import org.bukkit.inventory.MerchantRecipe;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.ChatColor;

import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftInventoryMerchant;
import net.minecraft.server.v1_13_R2.InventoryMerchant;

class MayorVillagerTradeListener implements Listener {
private final MayorPlugin plugin;
Expand All @@ -21,10 +25,11 @@ public MayorVillagerTradeListener(MayorPlugin plugin) {
this.plugin = plugin;
}


@EventHandler
public void onVillagerReplenishTrade(VillagerReplenishTradeEvent event) {
plugin.getLogger().info("VillagerReplenishTradeEvent");
if (event.getEntity().getName().equals("Mayor")) {
plugin.getServer().broadcastMessage(ChatColor.GREEN + "The Mayor has agreed to build a new structure!");
}
}

/*
Expand All @@ -51,15 +56,18 @@ public void onInventoryClick(InventoryClickEvent event) {
}
}*/

/*
@EventHandler
public void onVillagerTrade(InventoryOpenEvent event) {
if ((event.getInventory() != null) && (event.getInventory().getType() == InventoryType.MERCHANT)) {
MerchantRecipe villagerTradeMeta = (MerchantRecipe) event.getInventory();
if (villagerTradeMeta.getResult().getType() == Material.POPPY) {
CraftInventoryMerchant merchantInventory = (CraftInventoryMerchant) event.getInventory();
InventoryMerchant inventory = merchantInventory.getInventory();
MerchantRecipe recipe = inventory.getRecipe().asBukkit();
if (recipe.getResult().getType() == Material.POPPY) {
plugin.getServer().broadcastMessage(ChatColor.GREEN + event.getPlayer().getName() + " & the Mayor have agreed to build a new structure!");
}
}
}
}*/

/*
@EventHandler
Expand Down

0 comments on commit ff43e90

Please sign in to comment.