Merge pull request 'Neues Inventarhandling' (#301) from newInventory into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #301 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
2413970b32
@ -29,16 +29,19 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class BlockIdWrapper8 implements BlockIdWrapper.IBlockIdWrapper {
|
public class BlockIdWrapper8 implements BlockIdWrapper.IBlockIdWrapper {
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public int blockToId(Block block) {
|
public int blockToId(Block block) {
|
||||||
return block.getTypeId() << 4 + block.getData();
|
return block.getTypeId() << 4 + block.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void setBlock(World world, int x, int y, int z, int blockState) {
|
public void setBlock(World world, int x, int y, int z, int blockState) {
|
||||||
world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false);
|
world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public Set<Integer> getHiddenBlockIds() {
|
public Set<Integer> getHiddenBlockIds() {
|
||||||
Set<Integer> hiddenBlockIds = new HashSet<>();
|
Set<Integer> hiddenBlockIds = new HashSet<>();
|
||||||
for(String tag : Config.HiddenBlocks){
|
for(String tag : Config.HiddenBlocks){
|
||||||
@ -48,6 +51,7 @@ public class BlockIdWrapper8 implements BlockIdWrapper.IBlockIdWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public int getObfuscateWith() {
|
public int getObfuscateWith() {
|
||||||
return Material.matchMaterial(Config.ObfuscateWith).getId() << 4;
|
return Material.matchMaterial(Config.ObfuscateWith).getId() << 4;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class GUI {
|
|||||||
anvilInv.setItem(Material.LEATHER_CHESTPLATE);
|
anvilInv.setItem(Material.LEATHER_CHESTPLATE);
|
||||||
anvilInv.setCallback(s -> {
|
anvilInv.setCallback(s -> {
|
||||||
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
|
||||||
if(PersonalKit.nameInUse(user.getId(), Config.SchematicType.toDB(), s)) {
|
if(PersonalKit.get(user.getId(), Config.SchematicType.toDB(), s).isInUse()) {
|
||||||
msg.sendPrefixless("KITNAME_IN_USE", p, ChatMessageType.ACTION_BAR);
|
msg.sendPrefixless("KITNAME_IN_USE", p, ChatMessageType.ACTION_BAR);
|
||||||
p.closeInventory();
|
p.closeInventory();
|
||||||
return;
|
return;
|
||||||
|
@ -29,8 +29,6 @@ import org.bukkit.event.block.BlockDispenseEvent;
|
|||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class InFightInventory implements Listener {
|
public class InFightInventory implements Listener {
|
||||||
|
|
||||||
@ -40,22 +38,12 @@ public class InFightInventory implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
Inventory clicked = event.getClickedInventory();
|
InventoryType top = event.getView().getTopInventory().getType();
|
||||||
if(event.getClick().isShiftClick()){
|
if(top == InventoryType.CRAFTING)
|
||||||
ItemStack clickedOn = event.getCurrentItem();
|
return;
|
||||||
|
|
||||||
if(
|
if ((event.getCursor() != null && event.getCursor().getType() != Material.TNT) || (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.TNT))
|
||||||
clickedOn != null &&
|
event.setCancelled(true); // Deny if transferred item is not TNT
|
||||||
event.getView().getTopInventory().getType() != InventoryType.CRAFTING &&
|
|
||||||
clicked == event.getWhoClicked().getInventory())
|
|
||||||
event.setCancelled(true);
|
|
||||||
}else if (
|
|
||||||
clicked != event.getWhoClicked().getInventory() &&
|
|
||||||
clicked != null &&
|
|
||||||
clicked.getType() != InventoryType.PLAYER &&
|
|
||||||
event.getCursor() != null &&
|
|
||||||
event.getCursor().getType() != Material.AIR)
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -41,6 +41,8 @@ public class ItemBuilder {
|
|||||||
item = new ItemStack(matrial, amount);
|
item = new ItemStack(matrial, amount);
|
||||||
meta = item.getItemMeta();
|
meta = item.getItemMeta();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public ItemBuilder(Material matrial, short subid) {
|
public ItemBuilder(Material matrial, short subid) {
|
||||||
item = new ItemStack(matrial, 1, subid);
|
item = new ItemStack(matrial, 1, subid);
|
||||||
meta = item.getItemMeta();
|
meta = item.getItemMeta();
|
||||||
|
1
pom.xml
1
pom.xml
@ -24,6 +24,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
|
<compilerArgs>-Xlint</compilerArgs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren