├── src
├── plugin.yml
└── com
│ └── tjplaysnow
│ └── chiselertool
│ ├── api
│ ├── events
│ │ └── Events.java
│ └── config
│ │ ├── Config.java
│ │ └── ItemManager.java
│ └── main
│ └── PluginMain.java
├── production
└── production
│ └── Chiseler Tool (Rotates blocks)
│ ├── plugin.yml
│ └── com
│ └── tjplaysnow
│ └── chiselertool
│ ├── main
│ └── PluginMain.class
│ └── api
│ ├── config
│ ├── Config.class
│ └── ItemManager.class
│ └── events
│ └── Events.class
├── .idea
├── vcs.xml
├── modules.xml
├── artifacts
│ └── Chiseler_Tool.xml
├── misc.xml
└── libraries
│ └── spigot_1_12_2.xml
├── README.md
└── Chiseler Tool (Rotates blocks).iml
/src/plugin.yml:
--------------------------------------------------------------------------------
1 | name: Chiseler-Tool
2 | version: 1.0
3 | main: com.tjplaysnow.chiselertool.main.PluginMain
4 | author: TJPlaysNow
--------------------------------------------------------------------------------
/production/production/Chiseler Tool (Rotates blocks)/plugin.yml:
--------------------------------------------------------------------------------
1 | name: Chiseler-Tool
2 | version: 1.0
3 | main: com.tjplaysnow.chiselertool.main.PluginMain
4 | author: TJPlaysNow
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/production/production/Chiseler Tool (Rotates blocks)/com/tjplaysnow/chiselertool/main/PluginMain.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TJPlaysNow/Chiseler-Tool/master/production/production/Chiseler Tool (Rotates blocks)/com/tjplaysnow/chiselertool/main/PluginMain.class
--------------------------------------------------------------------------------
/production/production/Chiseler Tool (Rotates blocks)/com/tjplaysnow/chiselertool/api/config/Config.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TJPlaysNow/Chiseler-Tool/master/production/production/Chiseler Tool (Rotates blocks)/com/tjplaysnow/chiselertool/api/config/Config.class
--------------------------------------------------------------------------------
/production/production/Chiseler Tool (Rotates blocks)/com/tjplaysnow/chiselertool/api/events/Events.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TJPlaysNow/Chiseler-Tool/master/production/production/Chiseler Tool (Rotates blocks)/com/tjplaysnow/chiselertool/api/events/Events.class
--------------------------------------------------------------------------------
/production/production/Chiseler Tool (Rotates blocks)/com/tjplaysnow/chiselertool/api/config/ItemManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TJPlaysNow/Chiseler-Tool/master/production/production/Chiseler Tool (Rotates blocks)/com/tjplaysnow/chiselertool/api/config/ItemManager.class
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Chiseler-Tool
2 | Chiseler tool is a survival friendly tool that can rotate blocks.
3 |
4 | - Hey guys, thanks for helping support. Goto the spigot page to download:
5 | - https://www.spigotmc.org/resources/chiseler-tool.55148/
6 |
7 | If you find a bug add it to the issues page and I'll get it sorted!
8 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/artifacts/Chiseler_Tool.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | $PROJECT_DIR$/../../../Central/Server/Test Server/plugins
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/spigot_1_12_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Chiseler Tool (Rotates blocks).iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | SPIGOT
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/com/tjplaysnow/chiselertool/api/events/Events.java:
--------------------------------------------------------------------------------
1 | package com.tjplaysnow.chiselertool.api.events;
2 |
3 | import org.bukkit.event.Event;
4 | import org.bukkit.event.EventPriority;
5 | import org.bukkit.event.Listener;
6 | import org.bukkit.plugin.EventExecutor;
7 | import org.bukkit.plugin.Plugin;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 | import java.util.function.Consumer;
12 |
13 | public class Events implements Listener {
14 |
15 | private final List> listeners = new ArrayList>();
16 |
17 | public Events(Plugin plugin, Class E) {
18 | this(plugin, E, EventPriority.NORMAL);
19 | }
20 |
21 | public Events(Plugin plugin, Class E, EventPriority prio) {
22 | EventExecutor eventExecutor = (listener, e) -> {
23 | eventListener((T) e);
24 | };
25 | plugin.getServer().getPluginManager().registerEvent(E, this, prio, eventExecutor, plugin);
26 | }
27 |
28 | public boolean onEvent(Consumer listener) {
29 | return listeners.add(listener);
30 | }
31 |
32 | public List> getListeners() {
33 | return listeners;
34 | }
35 |
36 | public void eventListener(T event) {
37 | listeners.forEach(consumer -> consumer.accept(event));
38 | }
39 | }
--------------------------------------------------------------------------------
/src/com/tjplaysnow/chiselertool/api/config/Config.java:
--------------------------------------------------------------------------------
1 | package com.tjplaysnow.chiselertool.api.config;
2 |
3 | import org.bukkit.Bukkit;
4 | import org.bukkit.Location;
5 | import org.bukkit.configuration.file.FileConfiguration;
6 | import org.bukkit.configuration.file.YamlConfiguration;
7 | import org.bukkit.inventory.ItemStack;
8 | import org.bukkit.plugin.Plugin;
9 |
10 | import java.io.File;
11 | import java.io.IOException;
12 |
13 | public class Config {
14 |
15 | private File file;
16 | private FileConfiguration fileConfig;
17 |
18 | /** Creates a new config at the path, with the fileName, with a configCreate method caller, and uses the Plugin */
19 | public Config(String path, String fileName, Runnable callback, Plugin plugin) {
20 | if (!fileName.contains(".yml")) {
21 | fileName = fileName + ".yml";
22 | }
23 | file = new File(path, fileName);
24 | fileConfig = YamlConfiguration.loadConfiguration(file);
25 |
26 | if (!file.exists()) {
27 | fileConfig.options().copyDefaults(true);
28 | callback.run();
29 | try {
30 | fileConfig.save(file);
31 | } catch (IOException exception) {
32 | exception.printStackTrace();
33 | }
34 | }
35 | }
36 |
37 | /** Creates a new config at the path, with the fileName, and uses the Plugin */
38 | public Config(String path, String fileName, Plugin plugin) {
39 | if (!fileName.contains(".yml")) {
40 | fileName = fileName + ".yml";
41 | }
42 | file = new File(path, fileName);
43 | fileConfig = YamlConfiguration.loadConfiguration(file);
44 |
45 | if (!file.exists()) {
46 | fileConfig.options().copyDefaults(true);
47 | try {
48 | fileConfig.save(file);
49 | } catch (IOException exception) {
50 | exception.printStackTrace();
51 | }
52 | }
53 | }
54 |
55 | /** Get the Configuration section */
56 | public FileConfiguration getConfig() {
57 | return fileConfig;
58 | }
59 |
60 | /** Save the config */
61 | public void saveConfig() {
62 | try {
63 | fileConfig.save(file);
64 | } catch (IOException exception) {
65 | exception.printStackTrace();
66 | }
67 | }
68 |
69 | /** Set a location in the config */
70 | public void setLocation(String path, Location location) {
71 | fileConfig.set(path + ".World", location.getWorld().getName());
72 | fileConfig.set(path + ".X", location.getX());
73 | fileConfig.set(path + ".Y", location.getY());
74 | fileConfig.set(path + ".Z", location.getZ());
75 | fileConfig.set(path + ".Pitch", location.getPitch());
76 | fileConfig.set(path + ".Yaw", location.getYaw());
77 | saveConfig();
78 | }
79 |
80 | /** Get a location in the config */
81 | public Location getLocation(String path) {
82 | if (fileConfig.getString(path + ".World") == null) {
83 | return null;
84 | }
85 | Location location = new Location(Bukkit.getWorld(fileConfig.getString(path + ".World")), fileConfig.getDouble(path + ".X"), fileConfig.getDouble(path + ".Y"), fileConfig.getDouble(path + ".Z"), (float) fileConfig.getDouble(path + ".Yaw"), (float) fileConfig.getDouble(path + ".Pitch"));
86 | return location;
87 | }
88 |
89 | @Deprecated
90 | public void setItemStack(String path, ItemStack item) {
91 | fileConfig.set(path, item);
92 | }
93 |
94 | @Deprecated
95 | public ItemStack getItemStack(String path) {
96 | return fileConfig.getItemStack(path);
97 | }
98 | }
--------------------------------------------------------------------------------
/src/com/tjplaysnow/chiselertool/api/config/ItemManager.java:
--------------------------------------------------------------------------------
1 | package com.tjplaysnow.chiselertool.api.config;
2 |
3 | import org.bukkit.Material;
4 | import org.bukkit.SkullType;
5 | import org.bukkit.enchantments.Enchantment;
6 | import org.bukkit.inventory.ItemStack;
7 | import org.bukkit.inventory.meta.ItemMeta;
8 | import org.bukkit.inventory.meta.SkullMeta;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class ItemManager {
14 |
15 | public static ItemStack getSkull(SkullType type) {
16 | ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (short) type.ordinal());
17 | return item;
18 | }
19 |
20 | @SuppressWarnings("deprecation")
21 | public static ItemStack getSkull(String playerName) {
22 | ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
23 | SkullMeta im = (SkullMeta) item.getItemMeta();
24 | im.setOwner(playerName);
25 | item.setItemMeta(im);
26 | return item;
27 | }
28 |
29 | @SuppressWarnings("deprecation")
30 | public static ItemStack setNameAndLoreandSkull(String name, String playerName, String... lore) {
31 | ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
32 | SkullMeta im = (SkullMeta) item.getItemMeta();
33 | im.setDisplayName(name);
34 | List il = new ArrayList();
35 | for (String l : lore) {
36 | il.add(l);
37 | }
38 | im.setLore(il);
39 | im.setOwner(playerName);
40 | item.setItemMeta(im);
41 | return item;
42 | }
43 |
44 | public static ItemStack setNameAndLore(ItemStack item, String name, String... lore) {
45 | ItemMeta im = item.getItemMeta();
46 | im.setDisplayName(name);
47 | List il = new ArrayList();
48 | for (String l : lore) {
49 | il.add(l);
50 | }
51 | im.setLore(il);
52 | item.setItemMeta(im);
53 | return item;
54 | }
55 |
56 | public static ItemStack setNameAndLore(ItemStack item, String name, List il) {
57 | ItemMeta im = item.getItemMeta();
58 | im.setDisplayName(name);
59 | im.setLore(il);
60 | item.setItemMeta(im);
61 | return item;
62 | }
63 |
64 | public static ItemStack setNameAndLoreandEnchants(ItemStack item, String name, List il, List enchants) {
65 | ItemMeta im = item.getItemMeta();
66 | im.setDisplayName(name);
67 | im.setLore(il);
68 | for (String enchant : enchants) {
69 | String[] part = enchant.split(":");
70 | im.addEnchant(Enchantment.getByName(part[0]), Integer.getInteger(part[1]), true);
71 | }
72 | item.setItemMeta(im);
73 | return item;
74 | }
75 |
76 | public static ItemStack setName(ItemStack item, String name) {
77 | ItemMeta im = item.getItemMeta();
78 | im.setDisplayName(name);
79 | item.setItemMeta(im);
80 | return item;
81 | }
82 |
83 | public static ItemStack setLore(ItemStack item, String... lore) {
84 | ItemMeta im = item.getItemMeta();
85 | List il = new ArrayList();
86 | for (String l : lore) {
87 | il.add(l);
88 | }
89 | im.setLore(il);
90 | item.setItemMeta(im);
91 | return item;
92 | }
93 |
94 | public static ItemStack setLore(ItemStack item, List lore) {
95 | ItemMeta im = item.getItemMeta();
96 | List il = new ArrayList();
97 | for (String l : lore) {
98 | il.add(l);
99 | }
100 | im.setLore(il);
101 | item.setItemMeta(im);
102 | return item;
103 | }
104 |
105 | // public static ItemStack setUnbreakable(ItemStack item) {
106 | // ItemMeta meta = item.getItemMeta();
107 | // meta.setUnbreakable(true);
108 | // item.setItemMeta(meta);
109 | // return item;
110 | // }
111 |
112 | public static ItemStack stripLore(ItemStack item) {
113 | if (item.getType().equals(Material.SKULL) || item.getType().equals(Material.SKULL_ITEM)) {
114 | SkullMeta meta = (SkullMeta) item.getItemMeta();
115 | List lore = new ArrayList();
116 | meta.setLore(lore);
117 | item.setItemMeta(meta);
118 | return item;
119 | } else {
120 | ItemMeta meta = item.getItemMeta();
121 | List lore = new ArrayList();
122 | meta.setLore(lore);
123 | item.setItemMeta(meta);
124 | return item;
125 | }
126 | }
127 |
128 | public static boolean isEqual(ItemStack item1, ItemStack item2) {
129 | if (stripLore(item1.clone()).equals(stripLore(item2.clone()))) {
130 | return true;
131 | } else {
132 | return false;
133 | }
134 | }
135 |
136 | public static ItemStack setUnbreakable(ItemStack itemStack) {
137 | ItemMeta meta = itemStack.getItemMeta();
138 | meta.setUnbreakable(true);
139 | itemStack.setItemMeta(meta);
140 | return itemStack;
141 | }
142 | }
--------------------------------------------------------------------------------
/src/com/tjplaysnow/chiselertool/main/PluginMain.java:
--------------------------------------------------------------------------------
1 | package com.tjplaysnow.chiselertool.main;
2 |
3 | import com.tjplaysnow.chiselertool.api.config.Config;
4 | import com.tjplaysnow.chiselertool.api.config.ItemManager;
5 | import com.tjplaysnow.chiselertool.api.events.Events;
6 | import org.bukkit.Bukkit;
7 | import org.bukkit.Material;
8 | import org.bukkit.NamespacedKey;
9 | import org.bukkit.Sound;
10 | import org.bukkit.block.Block;
11 | import org.bukkit.event.block.Action;
12 | import org.bukkit.event.player.PlayerInteractEvent;
13 | import org.bukkit.inventory.ItemStack;
14 | import org.bukkit.inventory.ShapedRecipe;
15 | import org.bukkit.plugin.Plugin;
16 | import org.bukkit.plugin.java.JavaPlugin;
17 |
18 | import java.util.ArrayList;
19 | import java.util.List;
20 |
21 | public class PluginMain extends JavaPlugin {
22 |
23 | Plugin plugin;
24 |
25 | Config config;
26 | boolean configCreated = true;
27 |
28 | Events playerInteractEvents;
29 |
30 | @Override
31 | public void onEnable() {
32 | plugin = this;
33 |
34 | config = new Config("plugins/" + getName(), "Config.yml", () -> {
35 | configCreated = false;
36 | }, plugin);
37 | if (!configCreated) {
38 | List materials = new ArrayList<>();
39 | for (Material mat : Material.values()) {
40 | if (mat.toString().contains("STAIR")) {
41 | materials.add(mat.toString());
42 | }
43 | if (mat.toString().contains("TERRACOTTA")) {
44 | materials.add(mat.toString());
45 | }
46 | if (mat.toString().contains("HOPPER")) {
47 | materials.add(mat.toString());
48 | }
49 | if (mat.toString().contains("RAIL")) {
50 | materials.add(mat.toString());
51 | }
52 | if (mat.toString().contains("PISTON")) {
53 | materials.add(mat.toString());
54 | }
55 | if (mat.toString().contains("LOG")) {
56 | materials.add(mat.toString());
57 | }
58 | if (mat.toString().contains("SLAB") || mat.toString().contains("STEP")) {
59 | materials.add(mat.toString());
60 | }
61 | if (mat.toString().contains("DOOR") && !mat.equals(Material.IRON_DOOR)&& !mat.equals(Material.IRON_DOOR_BLOCK)) {
62 | materials.add(mat.toString());
63 | }
64 | if (mat.toString().contains("SHULKER_BOX")) {
65 | materials.add(mat.toString());
66 | }
67 | }
68 | materials.add(Material.REDSTONE_COMPARATOR.toString());
69 | materials.add(Material.REDSTONE_COMPARATOR_OFF.toString());
70 | materials.add(Material.REDSTONE_COMPARATOR_ON.toString());
71 | materials.add(Material.OBSERVER.toString());
72 | materials.add(Material.DROPPER.toString());
73 | materials.add(Material.DISPENSER.toString());
74 | materials.add(Material.DIODE.toString());
75 | materials.add(Material.DIODE_BLOCK_OFF.toString());
76 | materials.add(Material.DIODE_BLOCK_ON.toString());
77 | materials.add(Material.HAY_BLOCK.toString());
78 | materials.add(Material.QUARTZ_BLOCK.toString());
79 | materials.add(Material.BONE_BLOCK.toString());
80 | materials.add(Material.ANVIL.toString());
81 | materials.add(Material.SIGN_POST.toString());
82 | materials.add(Material.ENDER_CHEST.toString());
83 | materials.add(Material.PURPUR_PILLAR.toString());
84 | config.getConfig().set("Rotatable", materials);
85 | config.getConfig().set("Chiseler.ItemData", 2);
86 | config.getConfig().set("Chiseler.Durability", 1024);
87 | config.saveConfig();
88 | }
89 |
90 | playerInteractEvents = new Events<>(this, PlayerInteractEvent.class);
91 |
92 | ItemStack item = ItemManager.setNameAndLore(ItemManager.setUnbreakable(new ItemStack(Material.WOOD_HOE, 1, (short) 2)), "§fChiseler", "§7Uses: " + config.getConfig().get("Chiseler.Durability") + "/" + config.getConfig().get("Chiseler.Durability"));
93 |
94 | ShapedRecipe recipe1 = new ShapedRecipe(new NamespacedKey(plugin, "chisel-1"), item);
95 | recipe1.shape(" ", "D ", "S ");
96 | recipe1.setIngredient('D', Material.DIAMOND);
97 | recipe1.setIngredient('S', Material.STICK);
98 | Bukkit.addRecipe(recipe1);
99 |
100 | ShapedRecipe recipe2 = new ShapedRecipe(new NamespacedKey(plugin, "chisel-2"), item);
101 | recipe2.shape(" ", " D ", " S ");
102 | recipe2.setIngredient('D', Material.DIAMOND);
103 | recipe2.setIngredient('S', Material.STICK);
104 | Bukkit.addRecipe(recipe2);
105 |
106 | ShapedRecipe recipe3 = new ShapedRecipe(new NamespacedKey(plugin, "chisel-3"), item);
107 | recipe3.shape(" ", " D", " S");
108 | recipe3.setIngredient('D', Material.DIAMOND);
109 | recipe3.setIngredient('S', Material.STICK);
110 | Bukkit.addRecipe(recipe3);
111 |
112 | ShapedRecipe recipe4 = new ShapedRecipe(new NamespacedKey(plugin, "chisel-4"), item);
113 | recipe4.shape("D ", "S ", " ");
114 | recipe4.setIngredient('D', Material.DIAMOND);
115 | recipe4.setIngredient('S', Material.STICK);
116 | Bukkit.addRecipe(recipe4);
117 |
118 | ShapedRecipe recipe5 = new ShapedRecipe(new NamespacedKey(plugin, "chisel-5"), item);
119 | recipe5.shape(" D ", " S ", " ");
120 | recipe5.setIngredient('D', Material.DIAMOND);
121 | recipe5.setIngredient('S', Material.STICK);
122 | Bukkit.addRecipe(recipe5);
123 |
124 | ShapedRecipe recipe6 = new ShapedRecipe(new NamespacedKey(plugin, "chisel-6"), item);
125 | recipe6.shape(" D", " S", " ");
126 | recipe6.setIngredient('D', Material.DIAMOND);
127 | recipe6.setIngredient('S', Material.STICK);
128 | Bukkit.addRecipe(recipe6);
129 |
130 | playerInteractEvents.onEvent((event) -> {
131 | if (event.getItem() == null) {
132 | return;
133 | }
134 | if (event.getAction().equals(Action.LEFT_CLICK_BLOCK) || event.getAction().equals(Action.LEFT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_AIR)) {
135 | return;
136 | }
137 | if (ItemManager.isEqual(event.getItem(), item)) {
138 | event.setCancelled(true);
139 | List lore = event.getItem().getItemMeta().getLore();
140 | String stringDamage = lore.get(0).replace("§7Uses: ", "");
141 | stringDamage = stringDamage.replace("/" + config.getConfig().get("Chiseler.Durability"), "");
142 | int damage = Integer.valueOf(stringDamage);
143 | if (event.getClickedBlock() == null) {
144 | return;
145 | }
146 | boolean worked = false;
147 | for (String materialName : config.getConfig().getStringList("Rotatable")) {
148 | if (event.getClickedBlock().getType().equals(Material.valueOf(materialName))) {
149 | worked = true;
150 | break;
151 | }
152 | }
153 | if (worked) {
154 | Block block = event.getClickedBlock();
155 | byte blockData = block.getData();
156 |
157 | if (block.getType().toString().contains("RAIL") && !block.getType().equals(Material.RAILS)) {
158 | if (blockData == 1) {
159 | blockData = 0;
160 | } else {
161 | blockData++;
162 | }
163 | } else if (block.getType().equals(Material.RAILS)) {
164 | if (blockData == 1) {
165 | blockData = 6;
166 | } else
167 | if (blockData == 9) {
168 | blockData = 0;
169 | } else {
170 | blockData++;
171 | }
172 | } else if (block.getType().equals(Material.REDSTONE_COMPARATOR) || block.getType().equals(Material.REDSTONE_COMPARATOR_OFF) || block.getType().equals(Material.REDSTONE_COMPARATOR_ON)) {
173 | if (blockData == 7) {
174 | blockData = 0;
175 | } else {
176 | blockData++;
177 | }
178 | } else if (block.getType().toString().contains("SLAB") || block.getType().toString().contains("STEP")) {
179 | if (blockData < 8) {
180 | blockData += 8;
181 | } else if (blockData >= 8) {
182 | blockData -= 8;
183 | }
184 | } else if (block.getType().equals(Material.ANVIL)) {
185 | if (blockData >= 0 && blockData <= 3) {
186 | if (blockData == 3) {
187 | blockData = 0;
188 | } else {
189 | blockData++;
190 | }
191 | } else if (blockData >= 4 && blockData <= 7) {
192 | if (blockData == 7) {
193 | blockData = 4;
194 | } else {
195 | blockData++;
196 | }
197 | } else if (blockData >= 8 && blockData <= 11) {
198 | if (blockData == 11) {
199 | blockData = 8;
200 | } else {
201 | blockData++;
202 | }
203 | }
204 | } else if (block.getType().toString().contains("PISTON")) {
205 | if (blockData == 5) {
206 | blockData = 0;
207 | } else {
208 | blockData++;
209 | }
210 | } else if (block.getType().toString().contains("LOG") || block.getType().equals(Material.PURPUR_PILLAR)) {
211 | blockData += 4;
212 | } else if (block.getType().equals(Material.QUARTZ_BLOCK)) {
213 | if (blockData >= 2 && blockData <= 4) {
214 | if (blockData == 4) {
215 | blockData = 2;
216 | } else {
217 | blockData++;
218 | }
219 | }
220 | } else if (block.getType().equals(Material.HOPPER)) {
221 | if (blockData == 0) {
222 | blockData = 2;
223 | } else {
224 | blockData++;
225 | }
226 | } else {
227 | if (blockData == 15) {
228 | blockData = 0;
229 | } else {
230 | blockData++;
231 | }
232 | }
233 |
234 | block.setData(blockData);
235 | damage--;
236 | if (damage < 0) {
237 | event.getPlayer().getInventory().setItemInMainHand(new ItemStack(Material.AIR));
238 | event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F);
239 | } else {
240 | event.getPlayer().getInventory().setItemInMainHand(ItemManager.setLore(event.getPlayer().getInventory().getItemInMainHand(), "§7Uses: " + damage + "/" + config.getConfig().getInt("Chiseler.Durability")));
241 | }
242 | }
243 | }
244 | });
245 | }
246 | }
247 |
--------------------------------------------------------------------------------