2021-03-24 13:49:21 +01:00
|
|
|
/*
|
|
|
|
This file is a part of the SteamWar software.
|
|
|
|
|
2021-08-31 10:42:42 +02:00
|
|
|
Copyright (C) 2021 SteamWar.de-Serverteam
|
2021-03-24 13:49:21 +01:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2021-08-31 10:42:42 +02:00
|
|
|
*/
|
2021-03-24 13:49:21 +01:00
|
|
|
|
|
|
|
package de.steamwar.fightsystem.utils;
|
|
|
|
|
|
|
|
import de.steamwar.fightsystem.Config;
|
|
|
|
import org.bukkit.Material;
|
2021-08-31 10:42:42 +02:00
|
|
|
import org.bukkit.World;
|
|
|
|
import org.bukkit.block.Block;
|
2021-03-24 13:49:21 +01:00
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.Set;
|
|
|
|
|
2021-08-31 10:42:42 +02:00
|
|
|
public class BlockIdWrapper8 implements BlockIdWrapper.IBlockIdWrapper {
|
|
|
|
@Override
|
|
|
|
public int blockToId(Block block) {
|
|
|
|
return block.getTypeId() << 4 + block.getData();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
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);
|
|
|
|
}
|
2021-03-24 13:49:21 +01:00
|
|
|
|
2021-08-31 10:42:42 +02:00
|
|
|
@Override
|
|
|
|
public Set<Integer> getHiddenBlockIds() {
|
2021-03-24 13:49:21 +01:00
|
|
|
Set<Integer> hiddenBlockIds = new HashSet<>();
|
|
|
|
for(String tag : Config.HiddenBlocks){
|
|
|
|
hiddenBlockIds.add(Material.matchMaterial(tag).getId() << 4);
|
|
|
|
}
|
|
|
|
return hiddenBlockIds;
|
|
|
|
}
|
|
|
|
|
2021-08-31 10:42:42 +02:00
|
|
|
@Override
|
|
|
|
public int getObfuscateWith() {
|
2021-03-24 13:49:21 +01:00
|
|
|
return Material.matchMaterial(Config.ObfuscateWith).getId() << 4;
|
|
|
|
}
|
2021-08-31 10:42:42 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public Object getPose(boolean sneaking) {
|
2021-09-28 18:25:45 +02:00
|
|
|
return Byte.valueOf((byte)(sneaking ? 2 : 0));
|
2021-08-31 10:42:42 +02:00
|
|
|
}
|
2021-03-24 13:49:21 +01:00
|
|
|
}
|