Pan only work on water
This commit is contained in:
parent
8e6dcee55f
commit
064321ffd2
|
@ -1,16 +1,13 @@
|
|||
package gg.wildfrontier.goldpanning;
|
||||
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -24,8 +21,6 @@ import org.bukkit.event.Listener;
|
|||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
|
||||
public class GoldPanning extends JavaPlugin implements Listener, CommandExecutor{
|
||||
Set<String> pans = new HashSet<String>();
|
||||
public FileConfiguration config;
|
||||
|
@ -36,8 +31,6 @@ public class GoldPanning extends JavaPlugin implements Listener, CommandExecutor
|
|||
getServer().getPluginManager().registerEvents(this, this);
|
||||
saveDefaultConfig();
|
||||
locadConfig();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void locadConfig() {
|
||||
|
@ -61,13 +54,18 @@ public class GoldPanning extends JavaPlugin implements Listener, CommandExecutor
|
|||
|
||||
@EventHandler
|
||||
public void panEvent(PlayerInteractEvent event) {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
ItemStack item = event.getItem();
|
||||
Action action = event.getAction();
|
||||
Block block = event.getClickedBlock().getRelative(event.getBlockFace());
|
||||
//check if item is a pan that has been right clicked
|
||||
if(item == null || !config.contains("pans."+item.getType().name()) || !action.equals(Action.RIGHT_CLICK_BLOCK))
|
||||
return;
|
||||
|
||||
//check water is clicked
|
||||
if(block.getType() != Material.WATER)
|
||||
return;
|
||||
|
||||
//get pan name
|
||||
String name = item.getType().name();
|
||||
|
||||
|
@ -86,7 +84,6 @@ public class GoldPanning extends JavaPlugin implements Listener, CommandExecutor
|
|||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue