-
-
Notifications
You must be signed in to change notification settings - Fork 102
/
BlockHelper.java
73 lines (53 loc) · 2.23 KB
/
BlockHelper.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
package com.denizenscript.denizen.nms.interfaces;
import com.denizenscript.denizen.utilities.blocks.ModernBlockData;
import com.denizenscript.denizen.nms.util.PlayerProfile;
import com.denizenscript.denizen.nms.util.jnbt.CompoundTag;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Skull;
import org.bukkit.event.world.PortalCreateEvent;
import java.util.List;
public interface BlockHelper {
void applyPhysics(Location location);
PlayerProfile getPlayerProfile(Skull skull);
void setPlayerProfile(Skull skull, PlayerProfile playerProfile);
CompoundTag getNbtData(Block block);
void setNbtData(Block block, CompoundTag compoundTag);
boolean hasBlock(Material material);
boolean setBlockResistance(Material material, float resistance);
float getBlockResistance(Material material);
default BlockState generateBlockState(Material mat) {
return null;
}
List<Location> getBlocksList(PortalCreateEvent event);
default String getPushReaction(Material mat) {
throw new UnsupportedOperationException();
}
default void setPushReaction(Material mat, String reaction) {
throw new UnsupportedOperationException();
}
default float getBlockStength(Material mat) {
throw new UnsupportedOperationException();
}
default void setBlockStrength(Material mat, float strength) {
throw new UnsupportedOperationException();
}
default ModernBlockData parseBlockData(String text) {
int openBracket = text.indexOf('[');
String material = text;
String otherData = null;
if (openBracket > 0) {
material = text.substring(0, openBracket);
otherData = text.substring(openBracket);
}
if (material.startsWith("minecraft:")) {
material = material.substring("minecraft:".length());
}
return parseBlockData(Material.getMaterial(material.toUpperCase()), otherData);
}
default ModernBlockData parseBlockData(Material material, String otherData) {
throw new UnsupportedOperationException();
}
}