(PlayerInteractEvent aEvent)
| 185 | private static final HashSetNoNulls<String> CHECKED_PLAYERS = new HashSetNoNulls<>(); |
| 186 | |
| 187 | @SubscribeEvent(priority = EventPriority.HIGHEST) |
| 188 | public void onPlayerInteraction(PlayerInteractEvent aEvent) { |
| 189 | if (aEvent.entityPlayer == null || aEvent.entityPlayer.worldObj == null || aEvent.action == null || aEvent.world.provider == null) return; |
| 190 | String aName = aEvent.entityPlayer.getCommandSenderName(), aNameLowercase = aName.toLowerCase(); |
| 191 | if (!aEvent.world.isRemote && CHECKED_PLAYERS.add(aName)) { |
| 192 | if (mSupporterListSilver.contains(aEvent.entityPlayer.getUniqueID().toString()) || mSupporterListGold.contains(aEvent.entityPlayer.getUniqueID().toString()) || mSupporterListSilver.contains(aNameLowercase) || mSupporterListGold.contains(aNameLowercase)) { |
| 193 | if (!MultiTileEntityCertificate.ALREADY_RECEIVED.contains(aNameLowercase)) { |
| 194 | if (ST.give(aEvent.entityPlayer, MultiTileEntityCertificate.getCertificate(1, aName), F)) { |
| 195 | MultiTileEntityCertificate.ALREADY_RECEIVED.add(aNameLowercase); |
| 196 | UT.Entities.sendchat(aEvent.entityPlayer, CHAT_GREG + "Thank you, " + aName + ", for Supporting GregTech! Here, have a Certificate. ;)"); |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | ItemStack aStack = aEvent.entityPlayer.getCurrentEquippedItem(); |
| 203 | if (aStack != null && aStack.stackSize > 0) { |
| 204 | if (aEvent.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR) { |
| 205 | if (aStack.getItem() == Items.glass_bottle) { |
| 206 | aEvent.setCanceled(T); |
| 207 | if (aEvent.world.isRemote) { |
| 208 | GT_API.api_proxy.sendUseItemPacket(aEvent.entityPlayer, aEvent.world, aStack); |
| 209 | return; |
| 210 | } |
| 211 | |
| 212 | MovingObjectPosition tTarget = WD.getMOP(aEvent.world, aEvent.entityPlayer, T); |
| 213 | if (tTarget == null || tTarget.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK || !aEvent.world.canMineBlock(aEvent.entityPlayer, tTarget.blockX, tTarget.blockY, tTarget.blockZ) || !aEvent.entityPlayer.canPlayerEdit(tTarget.blockX, tTarget.blockY, tTarget.blockZ, tTarget.sideHit, aStack)) return; |
| 214 | Block tBlock = aEvent.world.getBlock(tTarget.blockX, tTarget.blockY, tTarget.blockZ); |
| 215 | |
| 216 | if (tBlock == Blocks.water || tBlock == Blocks.flowing_water) { |
| 217 | if (aEvent.world.getBlockMetadata(tTarget.blockX, tTarget.blockY, tTarget.blockZ) != 0) return; |
| 218 | for (int i = 0; i < 3 && aStack.stackSize > 0; i++) { |
| 219 | if (aStack.stackSize == 1) { |
| 220 | aEvent.entityPlayer.inventory.mainInventory[aEvent.entityPlayer.inventory.currentItem] = ST.make(Items.potionitem, 1, 0); |
| 221 | } else { |
| 222 | ST.use(aEvent.entityPlayer, aStack); |
| 223 | ST.give(aEvent.entityPlayer, ST.make(Items.potionitem, 1, 0), F); |
| 224 | } |
| 225 | } |
| 226 | if (!WD.infiniteWater(aEvent.world, tTarget.blockX, tTarget.blockY, tTarget.blockZ)) aEvent.world.setBlockToAir(tTarget.blockX, tTarget.blockY, tTarget.blockZ); |
| 227 | ST.update(aEvent.entityPlayer); |
| 228 | return; |
| 229 | } |
| 230 | if (tBlock == BlocksGT.River || WD.waterstream(tBlock)) { |
| 231 | ItemStack tStack = FL.Water.fill(aStack); |
| 232 | if (tStack == null) return; |
| 233 | ST.use(aEvent.entityPlayer, aStack); |
| 234 | ST.give(aEvent.entityPlayer, tStack, F); |
| 235 | return; |
| 236 | } |
| 237 | if (tBlock == BlocksGT.Ocean) { |
| 238 | ItemStack tStack = FL.Ocean.fill(aStack); |
| 239 | if (tStack == null) return; |
| 240 | ST.use(aEvent.entityPlayer, aStack); |
| 241 | ST.give(aEvent.entityPlayer, tStack, F); |
| 242 | return; |
| 243 | } |
| 244 | if (tBlock == BlocksGT.Swamp) { |
nothing calls this directly
no test coverage detected