fix #13 this time for real
This commit is contained in:
parent
d4e49e1e58
commit
bf69a0a1dd
@ -1,3 +1,7 @@
|
|||||||
|
Flan 1.1.4
|
||||||
|
======================
|
||||||
|
- Directly check player class for item usage. So fake players get ignored.
|
||||||
|
|
||||||
Flan 1.1.3
|
Flan 1.1.3
|
||||||
======================
|
======================
|
||||||
- Ignore item usage with non player (e.g. with modded machines). Fix #12
|
- Ignore item usage with non player (e.g. with modded machines). Fix #12
|
||||||
|
@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx2G
|
|||||||
loader_version=0.9.1+build.205
|
loader_version=0.9.1+build.205
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.1.3
|
mod_version = 1.1.4
|
||||||
maven_group = com.flemmli97.flan
|
maven_group = com.flemmli97.flan
|
||||||
archives_base_name = flan
|
archives_base_name = flan
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@ public class ItemInteractEvents {
|
|||||||
private static final Set<Item> blackListedItems = Sets.newHashSet(Items.COMPASS, Items.FILLED_MAP, Items.FIREWORK_ROCKET);
|
private static final Set<Item> blackListedItems = Sets.newHashSet(Items.COMPASS, Items.FILLED_MAP, Items.FIREWORK_ROCKET);
|
||||||
|
|
||||||
public static ActionResult onItemUseBlock(ItemUsageContext context) {
|
public static ActionResult onItemUseBlock(ItemUsageContext context) {
|
||||||
if (context.getWorld().isClient || context.getStack().isEmpty())
|
//Check for Fakeplayer. Since there is no api for that directly check the class
|
||||||
|
if (!(context.getPlayer() instanceof ServerPlayerEntity) || !context.getPlayer().getClass().equals(ServerPlayerEntity.class) || context.getStack().isEmpty())
|
||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
ClaimStorage storage = ClaimStorage.get((ServerWorld) context.getWorld());
|
ClaimStorage storage = ClaimStorage.get((ServerWorld) context.getWorld());
|
||||||
BlockPos placePos = new ItemPlacementContext(context).getBlockPos();
|
BlockPos placePos = new ItemPlacementContext(context).getBlockPos();
|
||||||
@ -84,8 +85,6 @@ public class ItemInteractEvents {
|
|||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
boolean actualInClaim = !(claim instanceof Claim) || placePos.getY() >= ((Claim) claim).getDimensions()[4];
|
boolean actualInClaim = !(claim instanceof Claim) || placePos.getY() >= ((Claim) claim).getDimensions()[4];
|
||||||
ServerPlayerEntity player = (ServerPlayerEntity) context.getPlayer();
|
ServerPlayerEntity player = (ServerPlayerEntity) context.getPlayer();
|
||||||
if(player==null)
|
|
||||||
return ActionResult.PASS;
|
|
||||||
if (context.getStack().getItem() == Items.END_CRYSTAL) {
|
if (context.getStack().getItem() == Items.END_CRYSTAL) {
|
||||||
if (claim.canInteract(player, EnumPermission.ENDCRYSTALPLACE, placePos, false))
|
if (claim.canInteract(player, EnumPermission.ENDCRYSTALPLACE, placePos, false))
|
||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
|
Loading…
Reference in New Issue
Block a user