Skip to content

Commit

Permalink
Merge pull request #150 from TiagoFar78/removeToolsMinecraftAttributes
Browse files Browse the repository at this point in the history
Remove minecraft attributes from tools lore
  • Loading branch information
iquelli authored Apr 15, 2024
2 parents 696a7b6 + 390dda3 commit 53a5b6c
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.bukkit.Material;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

Expand All @@ -31,6 +32,13 @@ public static void setLore(ItemStack item, List<String> lore) {
item.setItemMeta(meta);
}

public static void removeAttributes(ItemStack item) {
ItemMeta meta = item.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);

item.setItemMeta(meta);
}

@SuppressWarnings("deprecation")
public static ItemStack getEventItem(PlayerInteractEvent e) {
return getEventItem(e.getPlayer().getItemInHand());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package net.tiagofar78.prisonescape.items;

import net.tiagofar78.prisonescape.bukkit.BukkitItems;
import net.tiagofar78.prisonescape.managers.MessageLanguageManager;

import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

public class MetalShovelItem extends ToolItem {

Expand All @@ -24,6 +28,15 @@ public boolean isIllegal() {
return true;
}

@Override
public ItemStack toItemStack(MessageLanguageManager messages) {
ItemStack item = super.toItemStack(messages);

BukkitItems.removeAttributes(item);

return item;
}

@Override
public Material getMaterial() {
return Material.DIAMOND_SHOVEL;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package net.tiagofar78.prisonescape.items;

import net.tiagofar78.prisonescape.bukkit.BukkitItems;
import net.tiagofar78.prisonescape.managers.MessageLanguageManager;

import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

public class MetalSpoonItem extends ToolItem {

Expand All @@ -24,6 +28,15 @@ public boolean isIllegal() {
return true;
}

@Override
public ItemStack toItemStack(MessageLanguageManager messages) {
ItemStack item = super.toItemStack(messages);

BukkitItems.removeAttributes(item);

return item;
}

@Override
public Material getMaterial() {
return Material.GOLDEN_SHOVEL;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package net.tiagofar78.prisonescape.items;

import net.tiagofar78.prisonescape.bukkit.BukkitItems;
import net.tiagofar78.prisonescape.managers.MessageLanguageManager;

import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

public class PlasticShovelItem extends ToolItem {

Expand All @@ -24,6 +28,15 @@ public boolean isIllegal() {
return true;
}

@Override
public ItemStack toItemStack(MessageLanguageManager messages) {
ItemStack item = super.toItemStack(messages);

BukkitItems.removeAttributes(item);

return item;
}

@Override
public Material getMaterial() {
return Material.STONE_SHOVEL;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package net.tiagofar78.prisonescape.items;

import net.tiagofar78.prisonescape.bukkit.BukkitItems;
import net.tiagofar78.prisonescape.managers.MessageLanguageManager;

import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

public class PlasticSpoonItem extends ToolItem {

Expand All @@ -24,6 +28,15 @@ public boolean isIllegal() {
return false;
}

@Override
public ItemStack toItemStack(MessageLanguageManager messages) {
ItemStack item = super.toItemStack(messages);

BukkitItems.removeAttributes(item);

return item;
}

@Override
public Material getMaterial() {
return Material.WOODEN_SHOVEL;
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/net/tiagofar78/prisonescape/items/WrenchItem.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package net.tiagofar78.prisonescape.items;

import net.tiagofar78.prisonescape.bukkit.BukkitItems;
import net.tiagofar78.prisonescape.managers.MessageLanguageManager;

import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

public class WrenchItem extends ToolItem {

Expand All @@ -24,6 +28,15 @@ public boolean isIllegal() {
return true;
}

@Override
public ItemStack toItemStack(MessageLanguageManager messages) {
ItemStack item = super.toItemStack(messages);

BukkitItems.removeAttributes(item);

return item;
}

@Override
public Material getMaterial() {
return Material.IRON_PICKAXE;
Expand Down

0 comments on commit 53a5b6c

Please sign in to comment.