Compare commits

..

No commits in common. "b0c0d211f4fb6cb4b8d1cd436338d7f16dcd97c1" and "8e6dcee55facb2a24cbc98c9cddd3a30aee56cc8" have entirely different histories.

2 changed files with 12 additions and 8 deletions

View File

@ -37,6 +37,7 @@ public class GoldPan implements Runnable {
int adddelaymax = plugin.getConfig().getInt("pans."+pan+".items."+item+".delay.add.max");
int removedelaymin = plugin.getConfig().getInt("pans."+pan+".items."+item+".delay.remove.min");
int removedelaymax = plugin.getConfig().getInt("pans."+pan+".items."+item+".delay.remove.max");
plugin.getLogger().log(Level.INFO, item+String.valueOf(chance));
this.items.add(new PanItem(item, chance, adddelaymin, adddelaymax,
removedelaymin, removedelaymax));

View File

@ -1,13 +1,16 @@
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;
@ -21,6 +24,8 @@ 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;
@ -30,7 +35,9 @@ public class GoldPanning extends JavaPlugin implements Listener, CommandExecutor
public void onEnable(){
getServer().getPluginManager().registerEvents(this, this);
saveDefaultConfig();
locadConfig();
locadConfig();
}
private void locadConfig() {
@ -54,18 +61,13 @@ 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();
@ -84,6 +86,7 @@ public class GoldPanning extends JavaPlugin implements Listener, CommandExecutor
event.setCancelled(true);
}
}
}