mirror of
https://github.com/array-in-a-matrix/brainwine.git
synced 2025-04-02 11:11:58 -04:00
Block mine fieldability check
This commit is contained in:
parent
3520fe2a44
commit
d1e00bded3
3 changed files with 32 additions and 1 deletions
|
@ -0,0 +1,22 @@
|
||||||
|
package brainwine.gameserver.item;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
|
||||||
|
public enum Fieldability {
|
||||||
|
|
||||||
|
TRUE,
|
||||||
|
FALSE,
|
||||||
|
PLACED;
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
private static Fieldability create(String string) {
|
||||||
|
switch(string) {
|
||||||
|
default:
|
||||||
|
return TRUE;
|
||||||
|
case "false":
|
||||||
|
return FALSE;
|
||||||
|
case "placed":
|
||||||
|
return PLACED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,6 +41,9 @@ public class Item {
|
||||||
@JsonProperty("rotation")
|
@JsonProperty("rotation")
|
||||||
private String rotation;
|
private String rotation;
|
||||||
|
|
||||||
|
@JsonProperty("fieldable")
|
||||||
|
private Fieldability fieldability = Fieldability.TRUE;
|
||||||
|
|
||||||
@JsonProperty("loot_graphic")
|
@JsonProperty("loot_graphic")
|
||||||
private LootGraphic lootGraphic = LootGraphic.NONE;
|
private LootGraphic lootGraphic = LootGraphic.NONE;
|
||||||
|
|
||||||
|
@ -146,6 +149,10 @@ public class Item {
|
||||||
return id == 0;
|
return id == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Fieldability getFieldability() {
|
||||||
|
return fieldability;
|
||||||
|
}
|
||||||
|
|
||||||
public LootGraphic getLootGraphic() {
|
public LootGraphic getLootGraphic() {
|
||||||
return lootGraphic;
|
return lootGraphic;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import brainwine.gameserver.entity.player.Player;
|
import brainwine.gameserver.entity.player.Player;
|
||||||
import brainwine.gameserver.item.Action;
|
import brainwine.gameserver.item.Action;
|
||||||
|
import brainwine.gameserver.item.Fieldability;
|
||||||
import brainwine.gameserver.item.Item;
|
import brainwine.gameserver.item.Item;
|
||||||
import brainwine.gameserver.item.ItemUseType;
|
import brainwine.gameserver.item.ItemUseType;
|
||||||
import brainwine.gameserver.item.Layer;
|
import brainwine.gameserver.item.Layer;
|
||||||
|
@ -50,7 +51,8 @@ public class BlockMineRequest extends PlayerRequest {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!digging && zone.isBlockProtected(x, y, player) && !player.isAdmin()) {
|
// TODO block ownership & 'placed' fieldability
|
||||||
|
if(!digging && item.getFieldability() == Fieldability.TRUE && zone.isBlockProtected(x, y, player) && !player.isAdmin()) {
|
||||||
fail(player, "This block is protected.");
|
fail(player, "This block is protected.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue