-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
98 lines (74 loc) · 2.3 KB
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package autoinv;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.configuration.file.FileConfiguration;
public class Main extends JavaPlugin implements Listener {
private static WorldGuardPlugin worldguard;
public static FileConfiguration fc;
@Override
public void onEnable() {
registerEvents();
worldguard = (WorldGuardPlugin) Bukkit.getPluginManager().getPlugin("WorldGuard");
}
public static boolean isFull(Inventory inv, Material mat)
{
int count = 0;
for (int i = 0; i <= inv.getSize() - 1; i++) {
try
{
if ((inv.getContents()[i].getType() != Material.AIR) && (
(inv.getContents()[i].getType() != mat) ||
(inv.getContents()[i].getAmount() >= inv.getContents()[i].getMaxStackSize()))) {
count++;
}
}
catch (NullPointerException localNullPointerException) {}
}
if (count == inv.getSize()) {
return true;
}
return false;
}
private static WorldGuardPlugin getWG()
{
return worldguard;
}
public static boolean canBuild(Player p, Block b)
{
return getWG().canBuild(p, b);
}
public static WorldGuardPlugin getWorldGuard() {
return worldguard;
}
public static Plugin getPlugin() {
return Bukkit.getPluginManager().getPlugin("AtticaAutoInv");
}
ArrayList<String> frozen = new ArrayList();
ArrayList<String> has = new ArrayList();
public boolean isAxe(Material m)
{
if ((m == Material.DIAMOND_AXE) || (m == Material.IRON_AXE) || (m == Material.STONE_AXE) || (m == Material.GOLD_AXE) ||
(m == Material.WOOD_AXE)) {
return true;
}
return false;
}
public void registerEvents() {
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new AutoInv(), this);
pm.registerEvents(this, this);
}
}